Linux MultiMedia Card development
 help / color / mirror / Atom feed
* Re: [PATCH v8 04/16] ARM: dts: Add xo to sdhc clock node on qcom platforms
From: Ritesh Harjani @ 2016-11-21  6:30 UTC (permalink / raw)
  To: Andy Gross
  Cc: ulf.hansson, linux-mmc, adrian.hunter, sboyd, shawn.lin,
	devicetree, linux-clk, david.brown, linux-arm-msm, georgi.djakov,
	alex.lemberg, mateusz.nowak, Yuliy.Izrailov, asutoshd,
	david.griego, stummala, venkatg, rnayak, pramod.gurav, jeremymc
In-Reply-To: <20161118035619.GA6400@hector>



On 11/18/2016 9:26 AM, Andy Gross wrote:
> On Thu, Nov 17, 2016 at 06:13:39AM +0530, Ritesh Harjani wrote:
>> Add xo entry to sdhc clock node on all qcom platforms.
>>
>> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
>> ---
>>  arch/arm/boot/dts/qcom-apq8084.dtsi   | 16 ++++++++++------
>>  arch/arm/boot/dts/qcom-msm8974.dtsi   | 16 ++++++++++------
>>  arch/arm64/boot/dts/qcom/msm8916.dtsi | 10 ++++++----
>>  arch/arm64/boot/dts/qcom/msm8996.dtsi |  9 +++++----
>>  4 files changed, 31 insertions(+), 20 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi b/arch/arm/boot/dts/qcom-apq8084.dtsi
>> index 39eb7a4..f756cbb 100644
>> --- a/arch/arm/boot/dts/qcom-apq8084.dtsi
>> +++ b/arch/arm/boot/dts/qcom-apq8084.dtsi
>> @@ -182,13 +182,13 @@
>>  	};
>>
>>  	clocks {
>> -		xo_board {
>> +		xo_board: xo_board {
>>  			compatible = "fixed-clock";
>>  			#clock-cells = <0>;
>>  			clock-frequency = <19200000>;
>>  		};
>>
>> -		sleep_clk {
>> +		sleep_clk: sleep_clk {
>>  			compatible = "fixed-clock";
>>  			#clock-cells = <0>;
>>  			clock-frequency = <32768>;
>> @@ -416,8 +416,10 @@
>>  			reg-names = "hc_mem", "core_mem";
>>  			interrupts = <0 123 0>, <0 138 0>;
>>  			interrupt-names = "hc_irq", "pwr_irq";
>> -			clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>;
>> -			clock-names = "core", "iface";
>> +			clocks = <&gcc GCC_SDCC1_APPS_CLK>,
>> +				 <&gcc GCC_SDCC1_AHB_CLK>,
>> +				 <&xo_board 0>;
>
> With clock-cells = <0>, this should be <&xo_board>
Ok, done.
>
> Somehow this passes the dtc compiler.  But it is still incorrect.  Please fix
> all instances of this to use the correct number of cells in the xo_board
> references.
Sure.
>
>
> Andy
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply

* [GIT PULL] dw-mmc controller fixes
From: Jaehoon Chung @ 2016-11-21  4:28 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org; +Cc: Ulf Hansson

Dear Ulf,

Could you pull this patch into your "fixes" branch?
Before applied this patch, there is the potential lock issue.

Best Regards,
Jaehoon Chung


The following changes since commit b0921d5c9ed6ffa8a4d6afc5ee5f136b87445f14:

  mmc: sdhci-of-esdhc: fixup PRESENT_STATE read (2016-11-18 14:41:47 +0100)

are available in the git repository at:

  https://github.com/jh80chung/dw-mmc.git fixes

for you to fetch changes up to 93fad54b87ace925631d8a09de6e0ac7d26af96d:

  mmc: dw_mmc: fix the error handling for dma operation (2016-11-21 13:21:38 +0900)

----------------------------------------------------------------
Jaehoon Chung (1):
      mmc: dw_mmc: fix the error handling for dma operation

 drivers/mmc/host/dw_mmc.c | 1 +
 1 file changed, 1 insertion(+)

^ permalink raw reply

* Re: [RESEND PATCHv2] mmc: dw_mmc: fix the error handling for dma operation
From: Jaehoon Chung @ 2016-11-21  4:23 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, m.szyprowski
In-Reply-To: <20161121015148.5699-1-jh80.chung@samsung.com>

On 11/21/2016 10:51 AM, Jaehoon Chung wrote:
> When dma->start is failed,then it has to fall back to PIO mode
> for current transfer.
> 
> But Host controller was already set to bits relevant to DMA operation.
> If needs to use the PIO mode, Host controller has to stop the DMA
> operation. (It's more stable than now.)
> 
> When it occurred error, it's not running any request.
> 
> Fixes: 3fc7eaef44db ("mmc: dw_mmc: Add external dma interface support")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

Applied on my fixes branch with stable tags.

Best Regards,
Jaehoon Chung

> ---
> Changelog on V2
> - Change the Fixes Commit Id
> - Added the Marek's Reported-by tags
> 
>  drivers/mmc/host/dw_mmc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 50a674b..df478ae 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1058,6 +1058,7 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
>  	spin_unlock_irqrestore(&host->irq_lock, irqflags);
>  
>  	if (host->dma_ops->start(host, sg_len)) {
> +		host->dma_ops->stop(host);
>  		/* We can't do DMA, try PIO for this one */
>  		dev_dbg(host->dev,
>  			"%s: fall back to PIO mode for current transfer\n",
> 


^ permalink raw reply

* [RESEND PATCHv2] mmc: dw_mmc: fix the error handling for dma operation
From: Jaehoon Chung @ 2016-11-21  1:51 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, m.szyprowski, Jaehoon Chung

When dma->start is failed,then it has to fall back to PIO mode
for current transfer.

But Host controller was already set to bits relevant to DMA operation.
If needs to use the PIO mode, Host controller has to stop the DMA
operation. (It's more stable than now.)

When it occurred error, it's not running any request.

Fixes: 3fc7eaef44db ("mmc: dw_mmc: Add external dma interface support")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Changelog on V2
- Change the Fixes Commit Id
- Added the Marek's Reported-by tags

 drivers/mmc/host/dw_mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 50a674b..df478ae 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1058,6 +1058,7 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
 	spin_unlock_irqrestore(&host->irq_lock, irqflags);
 
 	if (host->dma_ops->start(host, sg_len)) {
+		host->dma_ops->stop(host);
 		/* We can't do DMA, try PIO for this one */
 		dev_dbg(host->dev,
 			"%s: fall back to PIO mode for current transfer\n",
-- 
2.10.1


^ permalink raw reply related

* Re: [PATCH v6 3/5] Documentation: synopsys-dw-mshc: add binding for fifo quirks
From: Jun Nie @ 2016-11-21  1:28 UTC (permalink / raw)
  To: Shawn Guo, xie.baoyou, Rob Herring, mark.rutland
  Cc: Ulf Hansson, Jaehoon Chung, Jason Liu, chen.chaokai, lai.binz,
	linux-mmc, Jun Nie, devicetree
In-Reply-To: <1479450555-19047-4-git-send-email-jun.nie@linaro.org>

2016-11-18 14:29 GMT+08:00 Jun Nie <jun.nie@linaro.org>:
> Add fifo-addr property and fifo-watermark-quirk property to
> synopsys-dw-mshc bindings. It is intended to provide more
> dt interface to support SoCs specific configuration.
>
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
>  Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
> index 4e00e85..8bf2e41 100644
> --- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
> +++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
> @@ -76,6 +76,17 @@ Optional properties:
>
>  * broken-cd: as documented in mmc core bindings.
>
> +* data-addr: Override fifo address with value provided by DT. The default FIFO reg
> +  offset is assumed as 0x100 (version < 0x240A) and 0x200(version >= 0x240A) by
> +  driver. If the controller does not follow this rule, please use this property
> +  to set fifo address in device tree.
> +
> +* fifo-watermark-aligned: Data done irq is expected if data length is less than
> +  watermark in PIO mode. But fifo watermark is requested to be aligned with data
> +  length in some SoC so that TX/RX irq can be generated with data done irq. Add this
> +  watermark quirk to mark this requirement and force fifo watermark setting
> +  accordingly.
> +
>  * vmmc-supply: The phandle to the regulator to use for vmmc.  If this is
>    specified we'll defer probe until we can find this regulator.
>
> @@ -103,6 +114,8 @@ board specific portions as listed below.
>                 interrupts = <0 75 0>;
>                 #address-cells = <1>;
>                 #size-cells = <0>;
> +               data-addr = <0x200>;
> +               fifo-watermark-aligned;
>         };
>
>  [board specific internal DMA resources]
> --
> 1.9.1
>

Add DT maintainer to review and act. Thank you!

Jun

^ permalink raw reply

* Re: [PATCH v6 1/5] mmc: dt-bindings: add ZTE ZX296718 MMC bindings
From: Jun Nie @ 2016-11-21  1:26 UTC (permalink / raw)
  To: Shawn Guo, xie.baoyou, Rob Herring, mark.rutland
  Cc: Ulf Hansson, Jaehoon Chung, Jason Liu, chen.chaokai, lai.binz,
	linux-mmc, Jun Nie, devicetree
In-Reply-To: <1479450555-19047-2-git-send-email-jun.nie@linaro.org>

2016-11-18 14:29 GMT+08:00 Jun Nie <jun.nie@linaro.org>:
> Document the device-tree binding of ZTE MMC host on
> ZX296718 SoC.
>
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
>  .../devicetree/bindings/mmc/zx-dw-mshc.txt         | 35 ++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt
> new file mode 100644
> index 0000000..c175c4b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt
> @@ -0,0 +1,35 @@
> +* ZTE specific extensions to the Synopsys Designware Mobile Storage
> +  Host Controller
> +
> +The Synopsys designware mobile storage host controller is used to interface
> +a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
> +differences between the core Synopsys dw mshc controller properties described
> +by synopsys-dw-mshc.txt and the properties used by the ZTE specific
> +extensions to the Synopsys Designware Mobile Storage Host Controller.
> +
> +Required Properties:
> +
> +* compatible: should be
> +       - "zte,zx296718-dw-mshc": for ZX SoCs
> +
> +Example:
> +
> +       mmc1: mmc@1110000 {
> +               compatible = "zte,zx296718-dw-mshc";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               reg = <0x01110000 0x1000>;
> +               interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
> +               fifo-depth = <32>;
> +               data-addr = <0x200>;
> +               fifo-watermark-aligned;
> +               bus-width = <4>;
> +               clock-frequency = <50000000>;
> +               clocks = <&topcrm SD0_AHB>, <&topcrm SD0_WCLK>;
> +               clock-names = "biu", "ciu";
> +               num-slots = <1>;
> +               max-frequency = <50000000>;
> +               cap-sdio-irq;
> +               cap-sd-highspeed;
> +               status = "disabled";
> +       };
> --
> 1.9.1
>

Add DT maintainer to review and act. Thank you!

Jun

^ permalink raw reply

* Re: [PATCH v6 0/5] Add intial support to DW MMC host on ZTE SoC
From: Jaehoon Chung @ 2016-11-21  1:22 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Jun Nie, Shawn Guo, xie.baoyou, jason.liu, chen.chaokai, lai.binz,
	linux-mmc
In-Reply-To: <CAPDyKFrjmQCN=YckNTrQtLNk3pCsCt5PFxRdqpk5rEqCHWh1bw@mail.gmail.com>

Hi Ulf,

On 11/18/2016 11:31 PM, Ulf Hansson wrote:
> On 18 November 2016 at 07:52, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> Hi Jun,
>>
>> On 11/18/2016 03:29 PM, Jun Nie wrote:
>>> Add intial support to DW MMC host on ZTE SoC. It include platform
>>> specific wrapper driver and workarounds for fifo quirk.
>>>
>>> Patches are prepared based on latest dw mmc runtime change:
>>>    https://github.com/jh80chung/dw-mmc.git for-ulf
>>
>> Applied on my dwmmc repository.
>> I have applied your patches, after modifying some conflict and subject prefix as "dw_mmc*".
>> And added Shawn's reviewed-by tags. Thanks!
> 
> [...]
> 
>>> Jun Nie (5):
>>>   mmc: dt-bindings: add ZTE ZX296718 MMC bindings
> 
> Don't forget to make sure DT bindings get acked. I don't think I have
> seen that happening for this change, unless I missed it of course.

Thanks for noticing this. I will wait for DT guy's acked.

Best Regards,
Jaehoon Chung

> 
> [...]
> 
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 


^ permalink raw reply

* Re: [PATCH 2/2] MMC: davinci: request gpios using gpio descriptors
From: David Lechner @ 2016-11-18 22:45 UTC (permalink / raw)
  To: Axel Haslam, ulf.hansson, nsekhar, khilman; +Cc: linux-mmc, linux-kernel
In-Reply-To: <20161115162822.25791-3-ahaslam@baylibre.com>

On 11/15/2016 10:28 AM, Axel Haslam wrote:
> Request card detect and write protect gpios using the provided API
> by mmc core.
>
> If a gpio is provided for card detect, we don't need to poll.
> So only use polling when a gpio is not provided.
>
> Once all pdata users register the gpios using gpio descriptors,
> we could remove the platform callbacks.
>
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
> ---

Tested-by: David Lechner <david@lechnology.com>

Working for me on LEGO MINDSTORMS EV3.



^ permalink raw reply

* Re: [PATCH 1/2] MMC: davinci: use mmc_of_parse to parse common mmc configuration
From: David Lechner @ 2016-11-18 22:45 UTC (permalink / raw)
  To: Axel Haslam, ulf.hansson, nsekhar, khilman; +Cc: linux-mmc, linux-kernel
In-Reply-To: <20161115162822.25791-2-ahaslam@baylibre.com>

On 11/15/2016 10:28 AM, Axel Haslam wrote:
> Card detect and write protect are currently not working on a DT
> boot, and the driver relies on polling to get the state
> of the card. The current code depends on platform data callbacks
> to register and get the state of the gpios.
>
> mmc core provides a generic way to parse device tree configuration,
> which will take care of registering the gpios for us, lets use it
> so that we don't need to poll, and parse the same properties.
>
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
> ---

Tested-by: David Lechner <david@lechnology.com>

Working for me on LEGO MINDSTORMS EV3.


^ permalink raw reply

* Re: [PATCH] mmc: pwrseq: add support for Marvell SD8787 chip
From: Tony Lindgren @ 2016-11-18 20:19 UTC (permalink / raw)
  To: Matt Ranostay
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, Ulf Hansson, Mark Rutland,
	Srinivas Kandagatla
In-Reply-To: <1479434109-8745-1-git-send-email-matt-sk+viVC6FLCDq+mSdOJa79kegs52MxvZ@public.gmane.org>

* Matt Ranostay <matt-sk+viVC6FLCDq+mSdOJa79kegs52MxvZ@public.gmane.org> [161117 17:55]:
> Allow power sequencing for the Marvell SD8787 Wifi/BT chip.
> This can be abstracted to other chipsets if needed in the future.

Good to see this happening:

Acked-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

^ permalink raw reply

* Re: [PATCH 9/9] mmc: core: Allow CMD13 polling when switch to HS400ES mode
From: Adrian Hunter @ 2016-11-18 14:43 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Linus Walleij, Chaotian Jing,
	Stephen Boyd, Michael Walle, Yong Mao, Shawn Lin
In-Reply-To: <CAPDyKFrqTG_pHPL-dydJ-OdEWfU7Ftu=0XG-GNZvXPZnX8aysw@mail.gmail.com>

On 18/11/16 16:37, Ulf Hansson wrote:
> On 18 November 2016 at 14:35, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 16/11/16 12:51, Ulf Hansson wrote:
>>> In cases when the mmc host doesn't support HW busy detection, polling for
>>> busy by using CMD13 is beneficial. The reasons have already been explained
>>> in earlier change logs.
>>>
>>> Moreover, when polling with CMD13 during bus timing changes, we should
>>> retry instead of fail when we get CRC errors.
>>>
>>> Switching to HS400ES includes several steps, where each step changes the
>>> bus speed timing. Let's improve the behaviour during these sequences, by
>>> allowing CMD13 polling for each of the step. Let's also make sure the CMD13
>>> polling becomes retried, while receiving a CRC error.
>>>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>> ---
>>>  drivers/mmc/core/mmc.c | 35 +++++++++++------------------------
>>>  1 file changed, 11 insertions(+), 24 deletions(-)
>>>
>>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>>> index 24b9e72..b6f0035 100644
>>> --- a/drivers/mmc/core/mmc.c
>>> +++ b/drivers/mmc/core/mmc.c
>>> @@ -1227,31 +1227,24 @@ static int mmc_select_hs400es(struct mmc_card *card)
>>>               goto out_err;
>>>
>>>       /* Switch card to HS mode */
>>> -     err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>>> -                        EXT_CSD_HS_TIMING, EXT_CSD_TIMING_HS,
>>> -                        card->ext_csd.generic_cmd6_time, 0,
>>> -                        true, false, true);
>>> +     err = mmc_select_hs(card);
>>>       if (err) {
>>>               pr_err("%s: switch to hs for hs400es failed, err:%d\n",
>>>                       mmc_hostname(host), err);
>>>               goto out_err;
>>>       }
>>>
>>> -     mmc_set_timing(host, MMC_TIMING_MMC_HS);
>>> -     err = mmc_switch_status(card);
>>> -     if (err)
>>> -             goto out_err;
>>> -
>>>       mmc_set_clock(host, card->ext_csd.hs_max_dtr);
>>>
>>> -     /* Switch card to DDR with strobe bit */
>>> +     /* Switch card to HS DDR with strobe bit */
>>>       val = EXT_CSD_DDR_BUS_WIDTH_8 | EXT_CSD_BUS_WIDTH_STROBE;
>>> -     err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>>> -                      EXT_CSD_BUS_WIDTH,
>>> -                      val,
>>> -                      card->ext_csd.generic_cmd6_time);
>>> +     err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>>> +                        EXT_CSD_BUS_WIDTH, val,
>>> +                        card->ext_csd.generic_cmd6_time,
>>> +                        MMC_TIMING_MMC_DDR52,
>>> +                        true, true, true);
>>>       if (err) {
>>> -             pr_err("%s: switch to bus width for hs400es failed, err:%d\n",
>>> +             pr_err("%s: switch to hs ddr for hs400es failed, err:%d\n",
>>>                       mmc_hostname(host), err);
>>>               goto out_err;
>>>       }
>>> @@ -1261,26 +1254,20 @@ static int mmc_select_hs400es(struct mmc_card *card)
>>>             card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
>>>       err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>>>                          EXT_CSD_HS_TIMING, val,
>>> -                        card->ext_csd.generic_cmd6_time, 0,
>>> -                        true, false, true);
>>> +                        card->ext_csd.generic_cmd6_time,
>>> +                        MMC_TIMING_MMC_HS400,
>>> +                        true, true, true);
>>
>> This could be a problem because the CMD13 is being sent to a card in HS400
>> enhanced strobe mode but we haven't enabled enhanced strobe on the host
>> controller yet.  Previously mmc_switch_status(card) was below
>> host->ops->hs400_enhanced_strobe().
>>
> 
> Yes, more or less the same reasons as before. We need the "tuning" (in
> this case the "strobing") to be done before validating the switch
> status.
> 
> Although, the change a little further above, when switching to HS DDR
> in the intermediate step - that should be fine, don't you think?

Yes


^ permalink raw reply

* Re: [PATCH 9/9] mmc: core: Allow CMD13 polling when switch to HS400ES mode
From: Ulf Hansson @ 2016-11-18 14:37 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: linux-mmc, Jaehoon Chung, Linus Walleij, Chaotian Jing,
	Stephen Boyd, Michael Walle, Yong Mao, Shawn Lin
In-Reply-To: <851c300f-ba5e-1944-64fd-51a32f88cb89@intel.com>

On 18 November 2016 at 14:35, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 16/11/16 12:51, Ulf Hansson wrote:
>> In cases when the mmc host doesn't support HW busy detection, polling for
>> busy by using CMD13 is beneficial. The reasons have already been explained
>> in earlier change logs.
>>
>> Moreover, when polling with CMD13 during bus timing changes, we should
>> retry instead of fail when we get CRC errors.
>>
>> Switching to HS400ES includes several steps, where each step changes the
>> bus speed timing. Let's improve the behaviour during these sequences, by
>> allowing CMD13 polling for each of the step. Let's also make sure the CMD13
>> polling becomes retried, while receiving a CRC error.
>>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>>  drivers/mmc/core/mmc.c | 35 +++++++++++------------------------
>>  1 file changed, 11 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index 24b9e72..b6f0035 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -1227,31 +1227,24 @@ static int mmc_select_hs400es(struct mmc_card *card)
>>               goto out_err;
>>
>>       /* Switch card to HS mode */
>> -     err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> -                        EXT_CSD_HS_TIMING, EXT_CSD_TIMING_HS,
>> -                        card->ext_csd.generic_cmd6_time, 0,
>> -                        true, false, true);
>> +     err = mmc_select_hs(card);
>>       if (err) {
>>               pr_err("%s: switch to hs for hs400es failed, err:%d\n",
>>                       mmc_hostname(host), err);
>>               goto out_err;
>>       }
>>
>> -     mmc_set_timing(host, MMC_TIMING_MMC_HS);
>> -     err = mmc_switch_status(card);
>> -     if (err)
>> -             goto out_err;
>> -
>>       mmc_set_clock(host, card->ext_csd.hs_max_dtr);
>>
>> -     /* Switch card to DDR with strobe bit */
>> +     /* Switch card to HS DDR with strobe bit */
>>       val = EXT_CSD_DDR_BUS_WIDTH_8 | EXT_CSD_BUS_WIDTH_STROBE;
>> -     err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> -                      EXT_CSD_BUS_WIDTH,
>> -                      val,
>> -                      card->ext_csd.generic_cmd6_time);
>> +     err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> +                        EXT_CSD_BUS_WIDTH, val,
>> +                        card->ext_csd.generic_cmd6_time,
>> +                        MMC_TIMING_MMC_DDR52,
>> +                        true, true, true);
>>       if (err) {
>> -             pr_err("%s: switch to bus width for hs400es failed, err:%d\n",
>> +             pr_err("%s: switch to hs ddr for hs400es failed, err:%d\n",
>>                       mmc_hostname(host), err);
>>               goto out_err;
>>       }
>> @@ -1261,26 +1254,20 @@ static int mmc_select_hs400es(struct mmc_card *card)
>>             card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
>>       err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>>                          EXT_CSD_HS_TIMING, val,
>> -                        card->ext_csd.generic_cmd6_time, 0,
>> -                        true, false, true);
>> +                        card->ext_csd.generic_cmd6_time,
>> +                        MMC_TIMING_MMC_HS400,
>> +                        true, true, true);
>
> This could be a problem because the CMD13 is being sent to a card in HS400
> enhanced strobe mode but we haven't enabled enhanced strobe on the host
> controller yet.  Previously mmc_switch_status(card) was below
> host->ops->hs400_enhanced_strobe().
>

Yes, more or less the same reasons as before. We need the "tuning" (in
this case the "strobing") to be done before validating the switch
status.

Although, the change a little further above, when switching to HS DDR
in the intermediate step - that should be fine, don't you think?

Kind regards
Uffe

^ permalink raw reply

* Re: [PATCH v6 0/5] Add intial support to DW MMC host on ZTE SoC
From: Ulf Hansson @ 2016-11-18 14:31 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: Jun Nie, Shawn Guo, xie.baoyou, jason.liu, chen.chaokai, lai.binz,
	linux-mmc
In-Reply-To: <2205472e-963f-319b-6523-76a4f486cafe@samsung.com>

On 18 November 2016 at 07:52, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi Jun,
>
> On 11/18/2016 03:29 PM, Jun Nie wrote:
>> Add intial support to DW MMC host on ZTE SoC. It include platform
>> specific wrapper driver and workarounds for fifo quirk.
>>
>> Patches are prepared based on latest dw mmc runtime change:
>>    https://github.com/jh80chung/dw-mmc.git for-ulf
>
> Applied on my dwmmc repository.
> I have applied your patches, after modifying some conflict and subject prefix as "dw_mmc*".
> And added Shawn's reviewed-by tags. Thanks!

[...]

>> Jun Nie (5):
>>   mmc: dt-bindings: add ZTE ZX296718 MMC bindings

Don't forget to make sure DT bindings get acked. I don't think I have
seen that happening for this change, unless I missed it of course.

[...]

Kind regards
Uffe

^ permalink raw reply

* Re: [PATCH 0/3] More MMC block core cleanup
From: Ulf Hansson @ 2016-11-18 14:30 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-mmc, Chunyan Zhang, Baolin Wang
In-Reply-To: <1479472576-2687-1-git-send-email-linus.walleij@linaro.org>

On 18 November 2016 at 13:36, Linus Walleij <linus.walleij@linaro.org> wrote:
> The more I dig the more I find. These are pretty straight-forward
> and should be possible to merge right off.
>
> Linus Walleij (3):
>   mmc: block: use mmc_req_is_special()
>   mmc: block: rename data to blkdata
>   mmc: block: move packed command struct init
>
>  drivers/mmc/card/block.c | 67 ++++++++++++++++++++++++++++++++++++++----------
>  drivers/mmc/card/queue.c | 43 -------------------------------
>  drivers/mmc/card/queue.h |  6 ++---
>  3 files changed, 56 insertions(+), 60 deletions(-)
>
> --
> 2.7.4
>

Thanks, applied for next!

Kind regards
Uffe

^ permalink raw reply

* Re: [PATCH v2 -next] soc: fsl: fix section mismatch build warnings
From: Ulf Hansson @ 2016-11-18 14:30 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Sudeep Holla, linux-kernel@vger.kernel.org, linux-mmc, Scott Wood,
	Yangbo Lu
In-Reply-To: <9979998.AzNsm2rgFQ@wuerfel>

On 17 November 2016 at 16:25, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday, November 17, 2016 3:11:59 PM CET Sudeep Holla wrote:
>>
>> Cc: Scott Wood <oss@buserror.net>
>> Cc: Yangbo Lu <yangbo.lu@nxp.com>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Ulf Hansson <ulf.hansson@linaro.org>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>>
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> Ulf, can you pick this up into the mmc tree?

Yes, I have applied it for my next branch, thanks!

Kind regards
Uffe

^ permalink raw reply

* Re: [PATCH 0/2] MMC: davinci: fix card detect and write protect
From: Ulf Hansson @ 2016-11-18 14:29 UTC (permalink / raw)
  To: Axel Haslam
  Cc: Sekhar Nori, Kevin Hilman, David Lechner, linux-mmc,
	linux-kernel@vger.kernel.org
In-Reply-To: <20161115162822.25791-1-ahaslam@baylibre.com>

On 15 November 2016 at 17:28, Axel Haslam <ahaslam@baylibre.com> wrote:
> This series fixes the card detect and write protect parsing for
> the davinci_mmc driver, and takes care of a technical debt to
> remove card polling when a card detect gpio is available.
>
> In the case of a platform based boot we register the gpios
> using the APIs provided by slot-gpio.
>
> In the case of a DT based boot we use the mmc_of_parse API to parse
> all DT properties and register the gpios.
>
> If this series is accepted, the next series will convert all users
> to use gpio descriptors and we could then remove the platform
> callbacks.
>
> This was tested on the omap138-lcdk, and the da850-evm, with
> additional patches to platform data and dts files.
>
> Axel Haslam (2):
>   MMC: davinci: use mmc_of_parse to parse common mmc configuration
>   MMC: davinci: request gpios using gpio descriptors
>
>  drivers/mmc/host/davinci_mmc.c | 130 +++++++++++++++++++++--------------------
>  1 file changed, 66 insertions(+), 64 deletions(-)
>
> --
> 2.10.1
>

Thanks, applied for next!

Kind regards
Uffe

^ permalink raw reply

* Re: [PATCH 2/2] mmc: tmio: remove SDIO from TODO list
From: Ulf Hansson @ 2016-11-18 14:29 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, Linux-Renesas, Simon Horman
In-Reply-To: <20161113142912.4041-3-wsa+renesas@sang-engineering.com>

On 13 November 2016 at 15:29, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> We surely have SDIO support by now :)
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks, applied for next!

Kind regards
Uffe


> ---
>  drivers/mmc/host/tmio_mmc_pio.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 2b04e6e87192c7..87fea67a743674 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -22,7 +22,6 @@
>   * TODO:
>   *   Investigate using a workqueue for PIO transfers
>   *   Eliminate FIXMEs
> - *   SDIO support
>   *   Better Power management
>   *   Handle MMC errors better
>   *   double buffer support
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 1/2] mmc: tmio: fix wrong bitmask for SDIO irqs
From: Ulf Hansson @ 2016-11-18 14:29 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, Linux-Renesas, Simon Horman
In-Reply-To: <20161113142912.4041-2-wsa+renesas@sang-engineering.com>

On 13 November 2016 at 15:29, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> Commit 7729c7a232a953 ("mmc: tmio: Provide separate interrupt handlers")
> refactored the sdio irq handler and wrongly used the mask for SD irqs,
> not for SDIO irqs. This doesn't really matter in practice because both
> values keep the only interrupt we are interested in. But still, this is
> wrong and wants to be fixed.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/tmio_mmc_pio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index dbc3cb14f3321b..2b04e6e87192c7 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -741,7 +741,7 @@ static void tmio_mmc_sdio_irq(int irq, void *devid)
>                 return;
>
>         status = sd_ctrl_read16(host, CTL_SDIO_STATUS);
> -       ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdcard_irq_mask;
> +       ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdio_irq_mask;
>
>         sdio_status = status & ~TMIO_SDIO_MASK_ALL;
>         if (pdata->flags & TMIO_MMC_SDIO_STATUS_QUIRK)
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] mmc: wbsd: implement check for dma mapping error
From: Ulf Hansson @ 2016-11-18 14:29 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Pierre Ossman, linux-mmc, linux-kernel@vger.kernel.org,
	ldv-project
In-Reply-To: <1478900564-5086-1-git-send-email-khoroshilov@ispras.ru>

On 11 November 2016 at 22:42, Alexey Khoroshilov <khoroshilov@ispras.ru> wrote:
> wbsd_request_dma() does not check for dma mapping errors.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/wbsd.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
> index c3fd16d997ca..80a3b11f3217 100644
> --- a/drivers/mmc/host/wbsd.c
> +++ b/drivers/mmc/host/wbsd.c
> @@ -1395,23 +1395,25 @@ static void wbsd_request_dma(struct wbsd_host *host, int dma)
>          */
>         host->dma_addr = dma_map_single(mmc_dev(host->mmc), host->dma_buffer,
>                 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
> +       if (dma_mapping_error(mmc_dev(host->mmc), host->dma_addr))
> +               goto kfree;
>
>         /*
>          * ISA DMA must be aligned on a 64k basis.
>          */
>         if ((host->dma_addr & 0xffff) != 0)
> -               goto kfree;
> +               goto unmap;
>         /*
>          * ISA cannot access memory above 16 MB.
>          */
>         else if (host->dma_addr >= 0x1000000)
> -               goto kfree;
> +               goto unmap;
>
>         host->dma = dma;
>
>         return;
>
> -kfree:
> +unmap:
>         /*
>          * If we've gotten here then there is some kind of alignment bug
>          */
> @@ -1421,6 +1423,7 @@ static void wbsd_request_dma(struct wbsd_host *host, int dma)
>                 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
>         host->dma_addr = 0;
>
> +kfree:
>         kfree(host->dma_buffer);
>         host->dma_buffer = NULL;
>
> @@ -1434,7 +1437,7 @@ static void wbsd_request_dma(struct wbsd_host *host, int dma)
>
>  static void wbsd_release_dma(struct wbsd_host *host)
>  {
> -       if (host->dma_addr) {
> +       if (!dma_mapping_error(mmc_dev(host->mmc), host->dma_addr)) {
>                 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
>                         WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
>         }
> --
> 2.7.4
>

^ permalink raw reply

* Re: [patch] mmc: mmc_test: Uninitialized return value
From: Ulf Hansson @ 2016-11-18 14:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Per Forlin, Adrian Hunter, Linus Walleij, Wolfram Sang, linux-mmc,
	linux-kernel@vger.kernel.org, kernel-janitors
In-Reply-To: <20161114113134.GA20543@mwanda>

On 14 November 2016 at 12:31, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We never set "ret" to RESULT_OK.
>
> Fixes: 9f9c4180f88d ("mmc: mmc_test: add test for non-blocking transfers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied for next!

Kind regards
Uffe

>
> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
> index f61c812..5ba6d77 100644
> --- a/drivers/mmc/card/mmc_test.c
> +++ b/drivers/mmc/card/mmc_test.c
> @@ -832,7 +832,7 @@ static int mmc_test_nonblock_transfer(struct mmc_test_card *test,
>         struct mmc_async_req *other_areq = &test_areq[1].areq;
>         enum mmc_blk_status status;
>         int i;
> -       int ret;
> +       int ret = RESULT_OK;
>
>         test_areq[0].test = test;
>         test_areq[1].test = test;

^ permalink raw reply

* Re: [PATCH v4] mmc: sdhci-of-esdhc: fixup PRESENT_STATE read
From: Ulf Hansson @ 2016-11-18 14:29 UTC (permalink / raw)
  To: Michael Walle
  Cc: linux-kernel@vger.kernel.org, linux-mmc, Adrian Hunter, yangbo lu,
	Alexander Stein, # 4.0+
In-Reply-To: <1479204796-23982-1-git-send-email-michael@walle.cc>

+stable

On 15 November 2016 at 11:13, Michael Walle <michael@walle.cc> wrote:
> Since commit 87a18a6a5652 ("mmc: mmc: Use ->card_busy() to detect busy
> cards in __mmc_switch()") the ESDHC driver is broken:
>   mmc0: Card stuck in programming state! __mmc_switch
>   mmc0: error -110 whilst initialising MMC card
>
> Since this commit __mmc_switch() uses ->card_busy(), which is
> sdhci_card_busy() for the esdhc driver. sdhci_card_busy() uses the
> PRESENT_STATE register, specifically the DAT0 signal level bit. But the
> ESDHC uses a non-conformant PRESENT_STATE register, thus a read fixup is
> required to make the driver work again.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> Fixes: 87a18a6a5652 ("mmc: mmc: Use ->card_busy() to detect busy cards in __mmc_switch()")
> Acked-by: Yangbo Lu <yangbo.lu@nxp.com>

Thanks, applied for fixes and added a stable tag.

Kind regards
Uffe

> ---
> v4:
>  - add and use SDHCI_CMD_LVL macro
>  - fix typo in comment, thanks alex
>  - add acked-by
>
> v3:
>  - explain the bits in the comments
>  - use bits[19:0] from the original value, all other will be taken from the
>    fixup value.
>
> v2:
>  - use lower bits of the original value (that was actually a typo)
>  - add fixes tag
>  - fix typo
>
>  drivers/mmc/host/sdhci-of-esdhc.c | 14 ++++++++++++++
>  drivers/mmc/host/sdhci.h          |  1 +
>  2 files changed, 15 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index fb71c86..1bb11e4 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -66,6 +66,20 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
>                         return ret;
>                 }
>         }
> +       /*
> +        * The DAT[3:0] line signal levels and the CMD line signal level are
> +        * not compatible with standard SDHC register. The line signal levels
> +        * DAT[7:0] are at bits 31:24 and the command line signal level is at
> +        * bit 23. All other bits are the same as in the standard SDHC
> +        * register.
> +        */
> +       if (spec_reg == SDHCI_PRESENT_STATE) {
> +               ret = value & 0x000fffff;
> +               ret |= (value >> 4) & SDHCI_DATA_LVL_MASK;
> +               ret |= (value << 1) & SDHCI_CMD_LVL;
> +               return ret;
> +       }
> +
>         ret = value;
>         return ret;
>  }
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index c722cd2..ea38962 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -73,6 +73,7 @@
>  #define  SDHCI_DATA_LVL_MASK   0x00F00000
>  #define   SDHCI_DATA_LVL_SHIFT 20
>  #define   SDHCI_DATA_0_LVL_MASK        0x00100000
> +#define  SDHCI_CMD_LVL         0x01000000
>
>  #define SDHCI_HOST_CONTROL     0x28
>  #define  SDHCI_CTRL_LED                0x01
> --
> 2.1.4
>

^ permalink raw reply

* Re: [PATCH] mmc: sdhci: remove unneeded (void *) casts in sdhci_(pltfm_)priv()
From: Ulf Hansson @ 2016-11-18 14:28 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-mmc, linux-kernel@vger.kernel.org, Adrian Hunter
In-Reply-To: <1478784138-18594-1-git-send-email-yamada.masahiro@socionext.com>

On 10 November 2016 at 14:22, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> The type of host->private is (unsigned long *).  No cast is needed
> to return an opaque pointer.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>
>  drivers/mmc/host/sdhci-pltfm.h | 2 +-
>  drivers/mmc/host/sdhci.h       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
> index 3280f20..957839d 100644
> --- a/drivers/mmc/host/sdhci-pltfm.h
> +++ b/drivers/mmc/host/sdhci-pltfm.h
> @@ -106,7 +106,7 @@ extern int sdhci_pltfm_register(struct platform_device *pdev,
>
>  static inline void *sdhci_pltfm_priv(struct sdhci_pltfm_host *host)
>  {
> -       return (void *)host->private;
> +       return host->private;
>  }
>
>  extern const struct dev_pm_ops sdhci_pltfm_pmops;
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 766df17..9886115 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -655,7 +655,7 @@ extern struct sdhci_host *sdhci_alloc_host(struct device *dev,
>
>  static inline void *sdhci_priv(struct sdhci_host *host)
>  {
> -       return (void *)host->private;
> +       return host->private;
>  }
>
>  extern void sdhci_card_detect(struct sdhci_host *host);
> --
> 1.9.1
>

^ permalink raw reply

* Re: [PATCH v8 05/16] dt-bindings: sdhci-msm: Add xo property
From: Rob Herring @ 2016-11-18 14:17 UTC (permalink / raw)
  To: Ritesh Harjani
  Cc: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	adrian.hunter-ral2JQCrhuEAvxtiuMwx3w,
	sboyd-sgV2jX0FEOL9JmXXK+q4OQ, andy.gross-QSEj5FYQhm4dnm+yROfE0A,
	shawn.lin-TNX95d0MmH7DzftRWevZcw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	david.brown-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	georgi.djakov-QSEj5FYQhm4dnm+yROfE0A,
	alex.lemberg-XdAiOPVOjttBDgjK7y7TUQ,
	mateusz.nowak-ral2JQCrhuEAvxtiuMwx3w,
	Yuliy.Izrailov-XdAiOPVOjttBDgjK7y7TUQ,
	asutoshd-sgV2jX0FEOL9JmXXK+q4OQ,
	david.griego-QSEj5FYQhm4dnm+yROfE0A,
	stummala-sgV2jX0FEOL9JmXXK+q4OQ, venkatg-sgV2jX0FEOL9JmXXK+q4OQ,
	rnayak-sgV2jX0FEOL9JmXXK+q4OQ,
	pramod.gurav-QSEj5FYQhm4dnm+yROfE0A,
	jeremymc-H+wXaHxf7aLQT0dZR+AlfA
In-Reply-To: <1479343623-31163-1-git-send-email-riteshh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

On Thu, Nov 17, 2016 at 06:17:03AM +0530, Ritesh Harjani wrote:
> Add "xo" property which is tcxo clock.

Technically, xo is not a property, but a value.

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

> 
> Signed-off-by: Ritesh Harjani <riteshh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 1 +
>  1 file changed, 1 insertion(+)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v8 10/16] mmc: sdhci-msm: Implement set_clock callback for sdhci-msm
From: Adrian Hunter @ 2016-11-18 14:14 UTC (permalink / raw)
  To: Ritesh Harjani, ulf.hansson, linux-mmc, sboyd, andy.gross
  Cc: shawn.lin, devicetree, linux-clk, david.brown, linux-arm-msm,
	georgi.djakov, alex.lemberg, mateusz.nowak, Yuliy.Izrailov,
	asutoshd, david.griego, stummala, venkatg, rnayak, pramod.gurav,
	jeremymc
In-Reply-To: <1479312052-22396-11-git-send-email-riteshh@codeaurora.org>

On 16/11/16 18:00, Ritesh Harjani wrote:
> sdhci-msm controller may have different clk-rates for each
> bus speed mode. Thus implement set_clock callback for
> sdhci-msm driver.
> 
> Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Yes my Ack stands.

> ---
>  drivers/mmc/host/sdhci-msm.c | 66 +++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 65 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 45ead68..6d02fc2 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -84,6 +84,7 @@ struct sdhci_msm_host {
>  	struct clk *pclk;	/* SDHC peripheral bus clock */
>  	struct clk *bus_clk;	/* SDHC bus voter clock */
>  	struct clk *xo_clk;	/* TCXO clk needed for FLL feature of cm_dll*/
> +	unsigned long clk_rate;
>  	struct mmc_host *mmc;
>  	bool use_14lpp_dll_reset;
>  };
> @@ -571,6 +572,69 @@ static unsigned int sdhci_msm_get_min_clock(struct sdhci_host *host)
>  	return SDHCI_MSM_MIN_CLOCK;
>  }
>  
> +/**
> + * __sdhci_msm_set_clock - sdhci_msm clock control.
> + *
> + * Description:
> + * MSM controller does not use internal divider and
> + * instead directly control the GCC clock as per
> + * HW recommendation.
> + **/
> +void __sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
> +{
> +	u16 clk;
> +	/*
> +	 * Keep actual_clock as zero -
> +	 * - since there is no divider used so no need of having actual_clock.
> +	 * - MSM controller uses SDCLK for data timeout calculation. If
> +	 *   actual_clock is zero, host->clock is taken for calculation.
> +	 */
> +	host->mmc->actual_clock = 0;
> +
> +	sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
> +
> +	if (clock == 0)
> +		return;
> +
> +	/*
> +	 * MSM controller do not use clock divider.
> +	 * Thus read SDHCI_CLOCK_CONTROL and only enable
> +	 * clock with no divider value programmed.
> +	 */
> +	clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> +	sdhci_enable_clock(host, clk);
> +}
> +
> +/* sdhci_msm_set_clock - Called with (host->lock) spinlock held. */
> +static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
> +{
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
> +	int rc;
> +
> +	if (!clock) {
> +		msm_host->clk_rate = clock;
> +		goto out;
> +	}
> +
> +	spin_unlock_irq(&host->lock);
> +
> +	rc = clk_set_rate(msm_host->clk, clock);
> +	if (rc) {
> +		pr_err("%s: Failed to set clock at rate %u\n",
> +		       mmc_hostname(host->mmc), clock);
> +		goto out_lock;
> +	}
> +	msm_host->clk_rate = clock;
> +	pr_debug("%s: Setting clock at rate %lu\n",
> +		 mmc_hostname(host->mmc), clk_get_rate(msm_host->clk));
> +
> +out_lock:
> +	spin_lock_irq(&host->lock);
> +out:
> +	__sdhci_msm_set_clock(host, clock);
> +}
> +
>  static const struct of_device_id sdhci_msm_dt_match[] = {
>  	{ .compatible = "qcom,sdhci-msm-v4" },
>  	{},
> @@ -581,7 +645,7 @@ static unsigned int sdhci_msm_get_min_clock(struct sdhci_host *host)
>  static const struct sdhci_ops sdhci_msm_ops = {
>  	.platform_execute_tuning = sdhci_msm_execute_tuning,
>  	.reset = sdhci_reset,
> -	.set_clock = sdhci_set_clock,
> +	.set_clock = sdhci_msm_set_clock,
>  	.get_min_clock = sdhci_msm_get_min_clock,
>  	.get_max_clock = sdhci_msm_get_max_clock,
>  	.set_bus_width = sdhci_set_bus_width,
> 

^ permalink raw reply

* Re: [PATCH v8 09/16] mmc: sdhci: Factor out sdhci_enable_clock
From: Adrian Hunter @ 2016-11-18 13:56 UTC (permalink / raw)
  To: Ritesh Harjani, ulf.hansson, linux-mmc, sboyd, andy.gross
  Cc: shawn.lin, devicetree, linux-clk, david.brown, linux-arm-msm,
	georgi.djakov, alex.lemberg, mateusz.nowak, Yuliy.Izrailov,
	asutoshd, david.griego, stummala, venkatg, rnayak, pramod.gurav,
	jeremymc
In-Reply-To: <1479312052-22396-10-git-send-email-riteshh@codeaurora.org>

On 16/11/16 18:00, Ritesh Harjani wrote:
> Factor out sdhci_enable_clock from sdhci_set_clock
> and make it EXPORT_SYMBOL so that it can be called.

This seems fine apart from minor comments below.

> 
> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
> ---
>  drivers/mmc/host/sdhci.c | 28 +++++++++++++++++-----------
>  drivers/mmc/host/sdhci.h |  1 +
>  2 files changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index d08d507..8a89d89 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1344,20 +1344,10 @@ u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock,
>  }
>  EXPORT_SYMBOL_GPL(sdhci_calc_clk);
>  
> -void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
> +void sdhci_enable_clock(struct sdhci_host *host, unsigned short clk)

We write a u16 so let's make clk a u16 instead of unsigned short.

I would have called it sdhci_enable_clk() to go with sdhci_calc_clk() and
slightly different from sdhci_set_clock() which is a callback whereas the
other 2 are helpers.

>  {
> -	u16 clk;
>  	unsigned long timeout;
>  
> -	host->mmc->actual_clock = 0;
> -
> -	sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
> -
> -	if (clock == 0)
> -		return;
> -
> -	clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock);
> -
>  	clk |= SDHCI_CLOCK_INT_EN;
>  	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
>  
> @@ -1378,6 +1368,22 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
>  	clk |= SDHCI_CLOCK_CARD_EN;
>  	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
>  }
> +EXPORT_SYMBOL_GPL(sdhci_enable_clock);
> +
> +void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
> +{
> +	u16 clk;
> +
> +	host->mmc->actual_clock = 0;
> +
> +	sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
> +
> +	if (clock == 0)
> +		return;
> +
> +	clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock);
> +	sdhci_enable_clock(host, clk);
> +}
>  EXPORT_SYMBOL_GPL(sdhci_set_clock);
>  
>  static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode,
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 766df17..8e77a3b 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -681,6 +681,7 @@ static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host)
>  u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock,
>  		   unsigned int *actual_clock);
>  void sdhci_set_clock(struct sdhci_host *host, unsigned int clock);
> +void sdhci_enable_clock(struct sdhci_host *host, unsigned short clk);
>  void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
>  		     unsigned short vdd);
>  void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
> 

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox