Re: [PATCH v4 2/2] mmc: sdhci-cadence: add Cadence SD4HC support

2016-12-08 Thread Adrian Hunter
On 05/12/16 04:10, Masahiro Yamada wrote:
> Add a driver for the Cadence SD4HC SD/SDIO/eMMC Controller.
> 
> For SD, it basically relies on the SDHCI standard code.
> For eMMC, this driver provides some callbacks to support the
> hardware part that is specific to this IP design.
> 
> Signed-off-by: Masahiro Yamada 

Acked-by: Adrian Hunter 

> ---
> 
> Changes in v4:
>   - Override mmc_host_ops.execute_tuning instead of the
> .platform_execute_tuning implementation
> 
> Changes in v3:
>   - Remove unneeded explanation about HRS and SRS from DT binding;
> the offsets to HRS/SRS are fixed for this hardware and this is
> quite normal, like each hardware has a fixed register view except
> the register base.  The detailed register map is what the driver
> cares about, so no need to explain it in the binding.
> 
> Changes in v2:
>   - Remove unnecessary "select MMC_SDHCI_IO_ACCESSORS"
> 
>  .../devicetree/bindings/mmc/sdhci-cadence.txt  |  30 +++
>  drivers/mmc/host/Kconfig   |  11 +
>  drivers/mmc/host/Makefile  |   1 +
>  drivers/mmc/host/sdhci-cadence.c   | 280 
> +
>  4 files changed, 322 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
>  create mode 100644 drivers/mmc/host/sdhci-cadence.c
> 
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt 
> b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
> new file mode 100644
> index 000..750374f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
> @@ -0,0 +1,30 @@
> +* Cadence SD/SDIO/eMMC Host Controller
> +
> +Required properties:
> +- compatible: should be "cdns,sd4hc".
> +- reg: offset and length of the register set for the device.
> +- interrupts: a single interrupt specifier.
> +- clocks: phandle to the input clock.
> +
> +Optional properties:
> +For eMMC configuration, supported speed modes are not indicated by the SDHCI
> +Capabilities Register.  Instead, the following properties should be specified
> +if supported.  See mmc.txt for details.
> +- mmc-ddr-1_8v
> +- mmc-ddr-1_2v
> +- mmc-hs200-1_8v
> +- mmc-hs200-1_2v
> +- mmc-hs400-1_8v
> +- mmc-hs400-1_2v
> +
> +Example:
> + emmc: sdhci@5a00 {
> + compatible = "cdns,sd4hc";
> + reg = <0x5a00 0x400>;
> + interrupts = <0 78 4>;
> + clocks = <&clk 4>;
> + bus-width = <8>;
> + mmc-ddr-1_8v;
> + mmc-hs200-1_8v;
> + mmc-hs400-1_8v;
> + };
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index ab9181e..8ac1640 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -164,6 +164,17 @@ config MMC_SDHCI_OF_HLWD
>  
> If unsure, say N.
>  
> +config MMC_SDHCI_CADENCE
> + tristate "SDHCI support for the Cadence SD/SDIO/eMMC controller"
> + depends on MMC_SDHCI_PLTFM
> + depends on OF
> + help
> +   This selects the Cadence SD/SDIO/eMMC driver.
> +
> +   If you have a controller with this interface, say Y or M here.
> +
> +   If unsure, say N.
> +
>  config MMC_SDHCI_CNS3XXX
>   tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
>   depends on ARCH_CNS3XXX
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index e49a82a..55f7193 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -63,6 +63,7 @@ obj-$(CONFIG_MMC_REALTEK_PCI)   += rtsx_pci_sdmmc.o
>  obj-$(CONFIG_MMC_REALTEK_USB)+= rtsx_usb_sdmmc.o
>  
>  obj-$(CONFIG_MMC_SDHCI_PLTFM)+= sdhci-pltfm.o
> +obj-$(CONFIG_MMC_SDHCI_CADENCE)  += sdhci-cadence.o
>  obj-$(CONFIG_MMC_SDHCI_CNS3XXX)  += sdhci-cns3xxx.o
>  obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)+= sdhci-esdhc-imx.o
>  obj-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o
> diff --git a/drivers/mmc/host/sdhci-cadence.c 
> b/drivers/mmc/host/sdhci-cadence.c
> new file mode 100644
> index 000..6e2545f
> --- /dev/null
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -0,0 +1,280 @@
> +/*
> + * Copyright (C) 2016 Socionext Inc.
> + *   Author: Masahiro Yamada 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "sdhci-pltfm.h"
> +
> +/* HRS - Host Register Set (specific to Cadence) */
> +#define SDHCI_CDNS_HRS04 0x10/* PHY access port */
> +#d

Re: [PATCH v4 2/2] mmc: sdhci-cadence: add Cadence SD4HC support

2016-12-08 Thread Ulf Hansson
On 5 December 2016 at 03:10, Masahiro Yamada
 wrote:
> Add a driver for the Cadence SD4HC SD/SDIO/eMMC Controller.
>
> For SD, it basically relies on the SDHCI standard code.
> For eMMC, this driver provides some callbacks to support the
> hardware part that is specific to this IP design.
>
> Signed-off-by: Masahiro Yamada 

Thanks, applied for next!

Kind regards
Uffe


> ---
>
> Changes in v4:
>   - Override mmc_host_ops.execute_tuning instead of the
> .platform_execute_tuning implementation
>
> Changes in v3:
>   - Remove unneeded explanation about HRS and SRS from DT binding;
> the offsets to HRS/SRS are fixed for this hardware and this is
> quite normal, like each hardware has a fixed register view except
> the register base.  The detailed register map is what the driver
> cares about, so no need to explain it in the binding.
>
> Changes in v2:
>   - Remove unnecessary "select MMC_SDHCI_IO_ACCESSORS"
>
>  .../devicetree/bindings/mmc/sdhci-cadence.txt  |  30 +++
>  drivers/mmc/host/Kconfig   |  11 +
>  drivers/mmc/host/Makefile  |   1 +
>  drivers/mmc/host/sdhci-cadence.c   | 280 
> +
>  4 files changed, 322 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
>  create mode 100644 drivers/mmc/host/sdhci-cadence.c
>
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt 
> b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
> new file mode 100644
> index 000..750374f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
> @@ -0,0 +1,30 @@
> +* Cadence SD/SDIO/eMMC Host Controller
> +
> +Required properties:
> +- compatible: should be "cdns,sd4hc".
> +- reg: offset and length of the register set for the device.
> +- interrupts: a single interrupt specifier.
> +- clocks: phandle to the input clock.
> +
> +Optional properties:
> +For eMMC configuration, supported speed modes are not indicated by the SDHCI
> +Capabilities Register.  Instead, the following properties should be specified
> +if supported.  See mmc.txt for details.
> +- mmc-ddr-1_8v
> +- mmc-ddr-1_2v
> +- mmc-hs200-1_8v
> +- mmc-hs200-1_2v
> +- mmc-hs400-1_8v
> +- mmc-hs400-1_2v
> +
> +Example:
> +   emmc: sdhci@5a00 {
> +   compatible = "cdns,sd4hc";
> +   reg = <0x5a00 0x400>;
> +   interrupts = <0 78 4>;
> +   clocks = <&clk 4>;
> +   bus-width = <8>;
> +   mmc-ddr-1_8v;
> +   mmc-hs200-1_8v;
> +   mmc-hs400-1_8v;
> +   };
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index ab9181e..8ac1640 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -164,6 +164,17 @@ config MMC_SDHCI_OF_HLWD
>
>   If unsure, say N.
>
> +config MMC_SDHCI_CADENCE
> +   tristate "SDHCI support for the Cadence SD/SDIO/eMMC controller"
> +   depends on MMC_SDHCI_PLTFM
> +   depends on OF
> +   help
> + This selects the Cadence SD/SDIO/eMMC driver.
> +
> + If you have a controller with this interface, say Y or M here.
> +
> + If unsure, say N.
> +
>  config MMC_SDHCI_CNS3XXX
> tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
> depends on ARCH_CNS3XXX
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index e49a82a..55f7193 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -63,6 +63,7 @@ obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o
>  obj-$(CONFIG_MMC_REALTEK_USB)  += rtsx_usb_sdmmc.o
>
>  obj-$(CONFIG_MMC_SDHCI_PLTFM)  += sdhci-pltfm.o
> +obj-$(CONFIG_MMC_SDHCI_CADENCE)+= sdhci-cadence.o
>  obj-$(CONFIG_MMC_SDHCI_CNS3XXX)+= sdhci-cns3xxx.o
>  obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)  += sdhci-esdhc-imx.o
>  obj-$(CONFIG_MMC_SDHCI_DOVE)   += sdhci-dove.o
> diff --git a/drivers/mmc/host/sdhci-cadence.c 
> b/drivers/mmc/host/sdhci-cadence.c
> new file mode 100644
> index 000..6e2545f
> --- /dev/null
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -0,0 +1,280 @@
> +/*
> + * Copyright (C) 2016 Socionext Inc.
> + *   Author: Masahiro Yamada 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "sdhci-pltfm.h"
> +
> +/* HRS - Host Register Set (specific to Cadence) */
> +#define SDHCI_CDNS_HRS04   

Re: [PATCH v4 2/2] mmc: sdhci-cadence: add Cadence SD4HC support

2016-12-08 Thread Masahiro Yamada
Hi Ulf,


2016-12-08 21:32 GMT+09:00 Ulf Hansson :
> On 5 December 2016 at 03:10, Masahiro Yamada
>  wrote:
>> Add a driver for the Cadence SD4HC SD/SDIO/eMMC Controller.
>>
>> For SD, it basically relies on the SDHCI standard code.
>> For eMMC, this driver provides some callbacks to support the
>> hardware part that is specific to this IP design.
>>
>> Signed-off-by: Masahiro Yamada 
>
> Thanks, applied for next!
>
> Kind regards
> Uffe


Please wait.

I found a small bug in v4.

I will send v5 soon.


Thanks.



-- 
Best Regards
Masahiro Yamada


Re: [PATCH v4 2/2] mmc: sdhci-cadence: add Cadence SD4HC support

2016-12-08 Thread Masahiro Yamada
Hi Ulf,

2016-12-08 21:32 GMT+09:00 Ulf Hansson :
> On 5 December 2016 at 03:10, Masahiro Yamada
>  wrote:
>> Add a driver for the Cadence SD4HC SD/SDIO/eMMC Controller.
>>
>> For SD, it basically relies on the SDHCI standard code.
>> For eMMC, this driver provides some callbacks to support the
>> hardware part that is specific to this IP design.
>>
>> Signed-off-by: Masahiro Yamada 
>
> Thanks, applied for next!
>


Very sorry for my fix at the last minute.

I've just posted v5.

Please make sure to apply v5.

Thanks!



-- 
Best Regards
Masahiro Yamada


Re: [PATCH v4 2/2] mmc: sdhci-cadence: add Cadence SD4HC support

2016-12-08 Thread Ulf Hansson
On 8 December 2016 at 13:52, Masahiro Yamada
 wrote:
> Hi Ulf,
>
> 2016-12-08 21:32 GMT+09:00 Ulf Hansson :
>> On 5 December 2016 at 03:10, Masahiro Yamada
>>  wrote:
>>> Add a driver for the Cadence SD4HC SD/SDIO/eMMC Controller.
>>>
>>> For SD, it basically relies on the SDHCI standard code.
>>> For eMMC, this driver provides some callbacks to support the
>>> hardware part that is specific to this IP design.
>>>
>>> Signed-off-by: Masahiro Yamada 
>>
>> Thanks, applied for next!
>>
>
>
> Very sorry for my fix at the last minute.
>
> I've just posted v5.
>
> Please make sure to apply v5.

Okay, I have replaced v4 with v5.

Perhaps you should have a look at my next branch to make sure it's all okay.

Kind regards
Uffe


Re: [PATCH v4 2/2] mmc: sdhci-cadence: add Cadence SD4HC support

2016-12-08 Thread Masahiro Yamada
Hi Ulf,

2016-12-08 23:05 GMT+09:00 Ulf Hansson :
> On 8 December 2016 at 13:52, Masahiro Yamada
>  wrote:
>> Hi Ulf,
>>
>> 2016-12-08 21:32 GMT+09:00 Ulf Hansson :
>>> On 5 December 2016 at 03:10, Masahiro Yamada
>>>  wrote:
 Add a driver for the Cadence SD4HC SD/SDIO/eMMC Controller.

 For SD, it basically relies on the SDHCI standard code.
 For eMMC, this driver provides some callbacks to support the
 hardware part that is specific to this IP design.

 Signed-off-by: Masahiro Yamada 
>>>
>>> Thanks, applied for next!
>>>
>>
>>
>> Very sorry for my fix at the last minute.
>>
>> I've just posted v5.
>>
>> Please make sure to apply v5.
>
> Okay, I have replaced v4 with v5.
>
> Perhaps you should have a look at my next branch to make sure it's all okay.
>


Yes. Everything looks fine.

Thank you!


-- 
Best Regards
Masahiro Yamada