From patchwork Tue Jan 28 08:24:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 3545611 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5630C02DC for ; Tue, 28 Jan 2014 08:24:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B90F82015E for ; Tue, 28 Jan 2014 08:24:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF57320154 for ; Tue, 28 Jan 2014 08:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754384AbaA1IY0 (ORCPT ); Tue, 28 Jan 2014 03:24:26 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:48734 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754054AbaA1IYZ (ORCPT ); Tue, 28 Jan 2014 03:24:25 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N0300MGXRCOOHA0@mailout3.samsung.com> for linux-mmc@vger.kernel.org; Tue, 28 Jan 2014 17:24:24 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.112]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 6C.3F.12635.73967E25; Tue, 28 Jan 2014 17:24:23 +0900 (KST) X-AuditID: cbfee68d-b7fcd6d00000315b-36-52e76937ef11 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E1.9C.29263.73967E25; Tue, 28 Jan 2014 17:24:23 +0900 (KST) Received: from [10.252.81.186] by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N0300LGJRCNBGD0@mmp1.samsung.com>; Tue, 28 Jan 2014 17:24:23 +0900 (KST) Message-id: <52E76956.1090107@samsung.com> Date: Tue, 28 Jan 2014 17:24:54 +0900 From: Jaehoon Chung User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-version: 1.0 To: "linux-mmc@vger.kernel.org" Cc: Chris Ball , Seungwon Jeon Subject: [PATCH v2 3/8] mmc: dw_mmc: replace the bus_hz checking point Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42JZI2JSoGue+TzI4MhVJYsJl7czWhz5389o 8eH+RWYHZo8brxYyefRtWcXo8XmTXABzFJdNSmpOZllqkb5dAldG7+MW5oLXQhXv3/xhamD8 xdfFyMkhIWAicWThBmYIW0ziwr31bCC2kMBSRolpa1JhahoPrGfpYuQCii9ilGi+1McG4bxm lOi9dhOsm1dAS+L79lWsIDaLgKrEsxv72UFsNgEdie3fjjOB2KICYRJTT1xlgagXlPgx+R6Q zcEhImAt0fxbFiTMLOAuMeXjLbBWYQE3iXcL3zFCxHUk9rdOY4Ow5SU2r3nLDHKDhEA7u8SL DSuYIfYKSHybfAhspoSArMSmA1CPSUocXHGDZQKjyCwkm2chGTsLydgFjMyrGEVTC5ILipPS iwz1ihNzi0vz0vWS83M3MQIj4fS/Z707GG8fsD7EmAy0ciKzlGhyPjCS8kriDY3NjCxMTUyN jcwtzUgTVhLnTXqYFCQkkJ5YkpqdmlqQWhRfVJqTWnyIkYmDU6qBkbEmoHjtRscPf3eabH5y oL/205Jrx/oFH3zJM9zarr2fR/DM7aI3B1ue+kdtzjSJu2VjsPCSe2Oab9H7l3X1ejdebNLk SDQo/t53TvgdQ7Tiuq3PY6qml76UnqI59UNEQ5xD4LHorxeyH0uV+RWetDDS3LBb9MJrG/an P0/e1DTplNsTFsbLoMRSnJFoqMVcVJwIAN7rWqiaAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsVy+t9jAV3zzOdBBr3LpC0mXN7OaHHkfz+j xYf7F5kdmD1uvFrI5NG3ZRWjx+dNcgHMUQ2MNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaG uoaWFuZKCnmJuam2Si4+AbpumTlAm5QUyhJzSoFCAYnFxUr6dpgmhIa46VrANEbo+oYEwfUY GaCBhDWMGb2PW5gLXgtVvH/zh6mB8RdfFyMnh4SAiUTjgfUsELaYxIV769m6GLk4hAQWMUo0 X+qDcl4zSvReu8kMUsUroCXxffsqVhCbRUBV4tmN/ewgNpuAjsT2b8eZQGxRgTCJqSeuskDU C0r8mHwPyObgEBGwlmj+LQsSZhZwl5jy8RZYq7CAm8S7he8YIeI6Evtbp7FB2PISm9e8ZZ7A yDcLyaRZSMpmISlbwMi8ilE0tSC5oDgpPddQrzgxt7g0L10vOT93EyM40p5J7WBc2WBxiFGA g1GJh7ej81mQEGtiWXFl7iFGCQ5mJRHes1OAQrwpiZVVqUX58UWlOanFhxiTgR6dyCwlmpwP TAJ5JfGGxiZmRpZG5oYWRsbmpAkrifMeaLUOFBJITyxJzU5NLUgtgtnCxMEp1cBoum9TqtnE szPWTj/18YZsa+ufyZtebvfZJ6euekPriHLfK+aUlanhD7yW7M//P83Bt+V9hnJv4u2d23+v 0d7pmiY1le96zxG7mIqqks+Hs53uF3BPaSiYKyJ27pqo4W71cHZOu1U7/wY7iqW35nIvvOaz 85lSbZ1UTqJI+0+F57N2nLi1Y/ciJZbijERDLeai4kQApLkq4fgCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's right that check immediately whether host->bus_hz is assigned or not. If drv_data->setup_clock is presented, then host->bus_hz should be set at there. When setup_clock didn't present, assigned to value with clk_get_rate(). Signed-off-by: Jaehoon Chung --- Changelog V2: - When drv_data->setup_clock is present, set to bus_hz with it. drivers/mmc/host/dw_mmc.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 8193e21..ead2998 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2427,10 +2427,27 @@ int dw_mci_probe(struct dw_mci *host) ret = clk_set_rate(host->ciu_clk, host->pdata->bus_hz); if (ret) dev_warn(host->dev, - "Unable to set bus rate to %ul\n", + "Unable to set bus rate to %uHz\n", host->pdata->bus_hz); } - host->bus_hz = clk_get_rate(host->ciu_clk); + + if (drv_data && drv_data->setup_clock) { + ret = drv_data->setup_clock(host); + if (ret) { + dev_err(host->dev, "implementation specific \" + "clock setup failed\n"); + goto err_clk_ciu; + } + } else { + host->bus_hz = clk_get_rate(host->ciu_clk); + } + } + + if (!host->bus_hz) { + dev_err(host->dev, + "Platform data must supply bus speed\n"); + ret = -ENODEV; + goto err_clk_ciu; } if (drv_data && drv_data->init) { @@ -2442,15 +2459,6 @@ int dw_mci_probe(struct dw_mci *host) } } - if (drv_data && drv_data->setup_clock) { - ret = drv_data->setup_clock(host); - if (ret) { - dev_err(host->dev, - "implementation specific clock setup failed\n"); - goto err_clk_ciu; - } - } - host->vmmc = devm_regulator_get_optional(host->dev, "vmmc"); if (IS_ERR(host->vmmc)) { ret = PTR_ERR(host->vmmc); @@ -2469,13 +2477,6 @@ int dw_mci_probe(struct dw_mci *host) } } - if (!host->bus_hz) { - dev_err(host->dev, - "Platform data must supply bus speed\n"); - ret = -ENODEV; - goto err_regulator; - } - host->quirks = host->pdata->quirks; spin_lock_init(&host->lock); @@ -2619,8 +2620,6 @@ err_workqueue: err_dmaunmap: if (host->use_dma && host->dma_ops->exit) host->dma_ops->exit(host); - -err_regulator: if (host->vmmc) regulator_disable(host->vmmc);