Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751920Ab3FGFfr (ORCPT ); Fri, 7 Jun 2013 01:35:47 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:23834 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394Ab3FGFfm (ORCPT ); Fri, 7 Jun 2013 01:35:42 -0400 X-AuditID: cbfee68d-b7f096d0000043fc-a3-51b1712c1749 Message-id: <51B1712C.5030705@samsung.com> Date: Fri, 07 Jun 2013 14:35:40 +0900 From: Jaehoon Chung User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-version: 1.0 To: Doug Anderson Cc: Chris Ball , Olof Johansson , Andrew Bresticker , Alim Akhtar , Abhilash Kesavan , Tomasz Figa , Jaehoon Chung , Seungwon Jeon , Grant Likely , Rob Herring , Rob Landley , Will Newton , devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Subject: Re: [PATCH 2/2] mmc: dw_mmc: Add the ability to set the ciu clock frequency References: <1370580406-10254-1-git-send-email-dianders@chromium.org> <1370580406-10254-2-git-send-email-dianders@chromium.org> In-reply-to: <1370580406-10254-2-git-send-email-dianders@chromium.org> Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42JZI2JSoqtbuDHQoGMei8XjNYuZLFa+/8to 8WDeNjaL7a83slkcmP2Q1eLssoNA1p8djBY3frWxWixsW8JicXnXHDaLI//7GS1OXf/MZnF4 xQEmi3Uvp7NYfLh/kdli1a4/jBZ/+nayOAh6LPh8hd1jdsNFFo+ds+6ye/TsPMPo8Wr1TFaP Q1fWMnrcubaHzeP8jIWMHldONLF69G1ZxejxeZNcAHcUl01Kak5mWWqRvl0CV0bXt8lMBVNl K7onyTQwzhLvYuTg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AROJC418XYycQKaYxIV769m6 GLk4hASmM0r03HnGDuG8ZJSYcmwqE0gVr4CWxJzeVywgNouAqsTTHydZQWw2AR2J7d+Og9WI CoRJbOpphqoXlPgx+R5YvYiApsSzhpfMIEOZBc6wSGy8tgysSBio4fC1CYwQ2xoZJe78W8sM kuAUcJPovXeFHcRmBtqwv3UaG4QtL7F5zVvmCYwCs5AsmYWkbBaSsgWMzKsYRVMLkguKk9Jz jfSKE3OLS/PS9ZLzczcxgtPOM+kdjKsaLA4xCnAwKvHw/li1IVCINbGsuDL3EKMEB7OSCO/6 tI2BQrwpiZVVqUX58UWlOanFhxiTgWEwkVlKNDkfmBLzSuINjU3MjCyNzA0tjIzNSRNWEuc9 2GodKCSQnliSmp2aWpBaBLOFiYNTqoGxs67rbdWr3zE8s7b7cczcrL3U5WzDZVHXwrz2tozs y9Mqr+cYNaw38/kitSFcwiKU51j6dNO+3Qemm/wW5W3i2Xj+lXjuvSmzOR5ae7vmvCl7Ot3x 7eRuvwuTIlkv86ya7ySx0bXs+Ylf0SIPt/8XU2xvXlOarOrFe0n59Nutyy65BvwQ33FQiaU4 I9FQi7moOBEACecnOH8DAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3887 Lines: 96 Looks good to me. If you can add the usage example, it will be more helpful to me. Acked-by: Jaehoon Chung On 06/07/2013 01:46 PM, Doug Anderson wrote: > As of now we rely on code outside of the driver to set the ciu clock > frequency. There's no reason to do that. Add support for setting up > the clock in the driver during probe. > > Signed-off-by: Doug Anderson > --- > .../devicetree/bindings/mmc/synopsis-dw-mshc.txt | 13 +++++++++++++ > drivers/mmc/host/dw_mmc.c | 17 +++++++++++++---- > 2 files changed, 26 insertions(+), 4 deletions(-) > > diff --git a/Documentation/devicetree/bindings/mmc/synopsis-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synopsis-dw-mshc.txt > index b09d2d0..edb7659 100644 > --- a/Documentation/devicetree/bindings/mmc/synopsis-dw-mshc.txt > +++ b/Documentation/devicetree/bindings/mmc/synopsis-dw-mshc.txt > @@ -39,6 +39,19 @@ Required Properties: > > Optional properties: > > +* clocks: from common clock binding: handle to biu and ciu clocks for the > + bus interface unit clock and the card interface unit clock. > + > +* clock-names: from common clock binding: Shall be "biu" and "ciu". > + If the biu clock is missing we'll simply skip enabling it. If the > + ciu clock is missing we'll just assume that the clock is running at > + clock-frequency. It is an error to omit both the ciu clock and the > + clock-frequency. > + > +* clock-frequency: should be the frequency (in Hz) of the ciu clock. If this > + is specified and the ciu clock is specified then we'll try to set the ciu > + clock to this at probe time. > + > * num-slots: specifies the number of slots supported by the controller. > The number of physical slots actually used could be equal or less than the > value specified by num-slots. If this property is not specified, the value > diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c > index d3a0f8a..7ffb502 100644 > --- a/drivers/mmc/host/dw_mmc.c > +++ b/drivers/mmc/host/dw_mmc.c > @@ -2133,6 +2133,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) > struct device_node *np = dev->of_node; > const struct dw_mci_drv_data *drv_data = host->drv_data; > int idx, ret; > + u32 clock_frequency; > > pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); > if (!pdata) { > @@ -2159,6 +2160,9 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) > > of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms); > > + if (!of_property_read_u32(np, "clock-frequency", &clock_frequency)) > + pdata->bus_hz = clock_frequency; > + > if (drv_data && drv_data->parse_dt) { > ret = drv_data->parse_dt(host); > if (ret) > @@ -2223,18 +2227,23 @@ int dw_mci_probe(struct dw_mci *host) > host->ciu_clk = devm_clk_get(host->dev, "ciu"); > if (IS_ERR(host->ciu_clk)) { > dev_dbg(host->dev, "ciu clock not available\n"); > + host->bus_hz = host->pdata->bus_hz; > } else { > ret = clk_prepare_enable(host->ciu_clk); > if (ret) { > dev_err(host->dev, "failed to enable ciu clock\n"); > goto err_clk_biu; > } > - } > > - if (IS_ERR(host->ciu_clk)) > - host->bus_hz = host->pdata->bus_hz; > - else > + if (host->pdata->bus_hz) { > + 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", > + 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); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/