Re: [PATCH v3 0/2] mmc: sdhci-milbeaut: add Milbeaut SD driver

2019-10-06 Thread orito.takao

Thanks for checking and pushing my patch !

Orito

> On Tue, 10 Sep 2019 at 03:39, Takao Orito  wrote:
> >
> > The following patches add driver for SD Host controller on
> > Socionext's Milbeaut M10V platforms.
> >
> > SD Host controller on Milbeaut consists of two controller parts.
> > One is core controller F_SDH30, this is similar to sdhci-fujitsu
> > controller.
> > Another is bridge controller. This bridge controller is not compatible
> > with sdhci-fujitsu controller. This is special for Milbeaut series.
> >
> > It has the several parts,
> >  - reset control
> >  - clock enable / select for SDR50/25/12
> >  - hold control of DATA/CMD line
> >  - select characteristics for WP/CD/LED line
> >  - Re-tuning control for mode3
> >  - Capability setting
> >Timeout Clock / Base Clock / Timer Count for Re-Tuning /
> >Debounce period
> > These requires special procedures at reset or clock enable/change or
> >  further tuning of clock.
> >
> > Takao Orito (2):
> >   dt-bindings: mmc: add DT bindings for Milbeaut SD controller
> >   mmc: sdhci-milbeaut: add Milbeaut SD controller driver
> >
> >  .../devicetree/bindings/mmc/sdhci-milbeaut.txt |  30 ++
> >  drivers/mmc/host/Kconfig   |  11 +
> >  drivers/mmc/host/Makefile  |   1 +
> >  drivers/mmc/host/sdhci-milbeaut.c  | 362 
> > +
> >  drivers/mmc/host/sdhci_f_sdh30.c   |  26 +-
> >  drivers/mmc/host/sdhci_f_sdh30.h   |  32 ++
> >  6 files changed, 437 insertions(+), 25 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> >  create mode 100644 drivers/mmc/host/sdhci-milbeaut.c
> >  create mode 100644 drivers/mmc/host/sdhci_f_sdh30.h
> >
> > --
> > 1.9.1
> >
> >
> 
> Applied for next, thanks!
> 
> Kind regards
> Uffe

-
Takao Orito
Socionext Inc.
E-mail:orito.ta...@socionext.com
Tel:+81-80-9815-1460
-


Re: [PATCH v3 0/2] mmc: sdhci-milbeaut: add Milbeaut SD driver

2019-09-30 Thread orito.takao

Hello

Does anyone have any comments on this ?

> The following patches add driver for SD Host controller on
> Socionext's Milbeaut M10V platforms.
> 
> SD Host controller on Milbeaut consists of two controller parts.
> One is core controller F_SDH30, this is similar to sdhci-fujitsu
> controller.
> Another is bridge controller. This bridge controller is not compatible
> with sdhci-fujitsu controller. This is special for Milbeaut series.
> 
> It has the several parts,
>  - reset control
>  - clock enable / select for SDR50/25/12
>  - hold control of DATA/CMD line
>  - select characteristics for WP/CD/LED line
>  - Re-tuning control for mode3
>  - Capability setting
>Timeout Clock / Base Clock / Timer Count for Re-Tuning /
>Debounce period
> These requires special procedures at reset or clock enable/change or
>  further tuning of clock.
> 
> Takao Orito (2):
>   dt-bindings: mmc: add DT bindings for Milbeaut SD controller
>   mmc: sdhci-milbeaut: add Milbeaut SD controller driver
> 
>  .../devicetree/bindings/mmc/sdhci-milbeaut.txt |  30 ++
>  drivers/mmc/host/Kconfig   |  11 +
>  drivers/mmc/host/Makefile  |   1 +
>  drivers/mmc/host/sdhci-milbeaut.c  | 362 
> +
>  drivers/mmc/host/sdhci_f_sdh30.c   |  26 +-
>  drivers/mmc/host/sdhci_f_sdh30.h   |  32 ++
>  6 files changed, 437 insertions(+), 25 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
>  create mode 100644 drivers/mmc/host/sdhci-milbeaut.c
>  create mode 100644 drivers/mmc/host/sdhci_f_sdh30.h
> 
> -- 
> 1.9.1
> 

Thanks
Orito

-
Takao Orito
Socionext Inc.
E-mail:orito.ta...@socionext.com
Tel:+81-80-9815-1460
-


Re: [PATCH v2 1/2] dt-bindings: mmc: add DT bindings for Milbeaut SD controller

2019-07-10 Thread orito.takao

Thanks for checking my patch.

> On Thu, May 30, 2019 at 06:22:11PM +0900, Takao Orito wrote:
> > Add the device-tree binding documentation for Milbeaut SDHCI driver.
> > 
> > Signed-off-by: Takao Orito 
> > ---
> >  .../devicetree/bindings/mmc/sdhci-milbeaut.txt | 32 
> > ++
> >  1 file changed, 32 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt 
> > b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > new file mode 100644
> > index 000..6063116
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > @@ -0,0 +1,32 @@
> > +* SOCIONEXT Milbeaut SDHCI controller
> > +
> > +This file documents differences between the core properties in mmc.txt
> > +and the properties used by the sdhci_milbeaut driver.
> > +
> > +Required properties:
> > +- compatible: "socionext,milbeaut-m10v-sdhci-3.0"
> > +- clocks: Must contain an entry for each entry in clock-names. It is a
> > +  list of phandles and clock-specifier pairs.
> > +  See ../clocks/clock-bindings.txt for details.
> > +- clock-names: Should contain the following two entries:
> > +   "iface" - clock used for sdhci interface
> > +   "core"  - core clock for sdhci controller
> > +- vmmc-supply: a phandle of a fixed GPIO regulator
> 
> Being a fixed GPIO regulator is board specific and outside the scope of 
> the binding. Otherwise,
> 
> Reviewed-by: Rob Herring 

I see. I will remove vmmc-supply and send new patch.

Thanks
Orito

> 
> > +
> > +Optional properties:
> > +- fujitsu,cmd-dat-delay-select: boolean property indicating that this host
> > +  requires the CMD_DAT_DELAY control to be enabled.
> > +
> > +Example:
> > +   sdhci3: mmc@1b01 {
> > +   compatible = "socionext,milbeaut-m10v-sdhci-3.0";
> > +   reg = <0x1b01 0x1>;
> > +   interrupts = <0 265 0x4>;
> > +   voltage-ranges = <3300 3300>;
> > +   bus-width = <4>;
> > +   clocks = < 7>, <_clk>;
> > +   clock-names = "core", "iface";
> > +   cap-sdio-irq;
> > +   vmmc-supply = <_sdhci3>;
> > +   fujitsu,cmd-dat-delay-select;
> > +   };
> > -- 
> > 1.9.1
> > 
> > 

-- 
Takao Orito 


Re: [PATCH v2 1/2] dt-bindings: mmc: add DT bindings for Milbeaut SD controller

2019-06-23 Thread orito.takao

Hello

Does anyone have any comments on this ?

> Add the device-tree binding documentation for Milbeaut SDHCI driver.
> 
> Signed-off-by: Takao Orito 
> ---
>  .../devicetree/bindings/mmc/sdhci-milbeaut.txt | 32 
> ++
>  1 file changed, 32 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> 
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt 
> b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> new file mode 100644
> index 000..6063116
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> @@ -0,0 +1,32 @@
> +* SOCIONEXT Milbeaut SDHCI controller
> +
> +This file documents differences between the core properties in mmc.txt
> +and the properties used by the sdhci_milbeaut driver.
> +
> +Required properties:
> +- compatible: "socionext,milbeaut-m10v-sdhci-3.0"
> +- clocks: Must contain an entry for each entry in clock-names. It is a
> +  list of phandles and clock-specifier pairs.
> +  See ../clocks/clock-bindings.txt for details.
> +- clock-names: Should contain the following two entries:
> + "iface" - clock used for sdhci interface
> + "core"  - core clock for sdhci controller
> +- vmmc-supply: a phandle of a fixed GPIO regulator
> +
> +Optional properties:
> +- fujitsu,cmd-dat-delay-select: boolean property indicating that this host
> +  requires the CMD_DAT_DELAY control to be enabled.
> +
> +Example:
> + sdhci3: mmc@1b01 {
> + compatible = "socionext,milbeaut-m10v-sdhci-3.0";
> + reg = <0x1b01 0x1>;
> + interrupts = <0 265 0x4>;
> + voltage-ranges = <3300 3300>;
> + bus-width = <4>;
> + clocks = < 7>, <_clk>;
> + clock-names = "core", "iface";
> + cap-sdio-irq;
> + vmmc-supply = <_sdhci3>;
> + fujitsu,cmd-dat-delay-select;
> + };
> -- 
> 1.9.1
> 

Thanks
Orito

-- 
Takao Orito 


Re: [PATCH v2 2/2] mmc: sdhci-milbeaut: add Milbeaut SD controller driver

2019-06-05 Thread orito.takao

Hi

> On 3/06/19 4:48 PM, Ulf Hansson wrote:
> > + Adrian
> > 
> > On Thu, 30 May 2019 at 11:20, Takao Orito  wrote:
> >>
> >> SD Host controller on Milbeaut consists of two controller parts.
> >> One is core controller F_SDH30, this is similar to sdhci-fujitsu
> >> controller.
> >> Another is bridge controller.
> >> This bridge controller is not compatible with sdhci-fujitsu controller.
> >> This is special for Milbeaut series. This has some functions.
> >> For example, reset control, clock enable/select for SDR50/25/12, set
> >> property of SD physical pins, retuning control, set capabilityies.
> >>
> >> This bridge controller requires special procedures at reset or clock
> >> enablement or change for further tuning of clock.
> >>
> >> Signed-off-by: Takao Orito 
> > 
> > This looks good to me, however I have looped in Adrian who maintains
> > SDHCI drivers, to allow him to provide some input.
> 
> Looks OK.
> 
> Could address the output of: scripts/checkpatch.pl --strict
> 
> And the "readl(host->ioaddr + SDHCI_INT_STATUS) == 0x" thing only
> makes sense for PCI.
> 
> Nevertheless:
> 
> Acked-by: Adrian Hunter 
> 

Thank you !
Orito

> > 
> > Kind regards
> > Uffe
> > 
> > 
> >> ---
> >>  drivers/mmc/host/Kconfig  |  11 ++
> >>  drivers/mmc/host/Makefile |   1 +
> >>  drivers/mmc/host/sdhci-milbeaut.c | 362 
> >> ++
> >>  drivers/mmc/host/sdhci_f_sdh30.c  |  26 +--
> >>  drivers/mmc/host/sdhci_f_sdh30.h  |  32 
> >>  5 files changed, 407 insertions(+), 25 deletions(-)
> >>  create mode 100644 drivers/mmc/host/sdhci-milbeaut.c
> >>  create mode 100644 drivers/mmc/host/sdhci_f_sdh30.h
> >>
> >> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> >> index 28fcd8f..9b39111 100644
> >> --- a/drivers/mmc/host/Kconfig
> >> +++ b/drivers/mmc/host/Kconfig
> >> @@ -353,6 +353,17 @@ config MMC_SDHCI_F_SDH30
> >>
> >>   If unsure, say N.
> >>
> >> +config MMC_SDHCI_MILBEAUT
> >> +   tristate "SDHCI support for Socionext Milbeaut Serieas using 
> >> F_SDH30"
> >> +   depends on MMC_SDHCI_PLTFM
> >> +   depends on OF
> >> +   help
> >> + This selects the Secure Digital Host Controller Interface (SDHCI)
> >> + Needed by Milbeaut SoC for MMC / SD / SDIO support.
> >> + If you have a controller with this interface, say Y or M here.
> >> +
> >> + If unsure, say N.
> >> +
> >>  config MMC_SDHCI_IPROC
> >> tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller"
> >> depends on ARCH_BCM2835 || ARCH_BCM_IPROC || COMPILE_TEST
> >> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> >> index 7357871..db98e8a 100644
> >> --- a/drivers/mmc/host/Makefile
> >> +++ b/drivers/mmc/host/Makefile
> >> @@ -21,6 +21,7 @@ obj-$(CONFIG_MMC_SDHCI_PXAV2) += sdhci-pxav2.o
> >>  obj-$(CONFIG_MMC_SDHCI_S3C)+= sdhci-s3c.o
> >>  obj-$(CONFIG_MMC_SDHCI_SIRF)   += sdhci-sirf.o
> >>  obj-$(CONFIG_MMC_SDHCI_F_SDH30)+= sdhci_f_sdh30.o
> >> +obj-$(CONFIG_MMC_SDHCI_MILBEAUT)   += sdhci-milbeaut.o
> >>  obj-$(CONFIG_MMC_SDHCI_SPEAR)  += sdhci-spear.o
> >>  obj-$(CONFIG_MMC_SDHCI_AM654)  += sdhci_am654.o
> >>  obj-$(CONFIG_MMC_WBSD) += wbsd.o
> >> diff --git a/drivers/mmc/host/sdhci-milbeaut.c 
> >> b/drivers/mmc/host/sdhci-milbeaut.c
> >> new file mode 100644
> >> index 000..a1aa21b
> >> --- /dev/null
> >> +++ b/drivers/mmc/host/sdhci-milbeaut.c
> >> @@ -0,0 +1,362 @@
> >> +// SPDX-License-Identifier: GPL-2.0
> >> +/*
> >> + * Copyright (C) 2013 - 2015 Fujitsu Semiconductor, Ltd
> >> + *  Vincent Yang 
> >> + * Copyright (C) 2015 Linaro Ltd  Andy Green 
> >> + * Copyright (C) 2019 Socionext Inc.
> >> + *  Takao Orito 
> >> + */
> >> +
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +
> >> +#include "sdhci-pltfm.h"
> >> +#include "sdhci_f_sdh30.h"
> >> +
> >> +/* milbeaut bridge controller register */
> >> +#define MLB_SOFT_RESET 0x0200
> >> +#define  MLB_SOFT_RESET_RSTX   BIT(0)
> >> +
> >> +#define MLB_WP_CD_LED_SET  0x0210
> >> +#define  MLB_WP_CD_LED_SET_LED_INV  BIT(2)
> >> +
> >> +#define MLB_CR_SET 0x0220
> >> +#define  MLB_CR_SET_CR_TOCLKUNIT   BIT(24)
> >> +#define  MLB_CR_SET_CR_TOCLKFREQ_SFT   (16)
> >> +#define  MLB_CR_SET_CR_TOCLKFREQ_MASK  (0x3F << 
> >> MLB_CR_SET_CR_TOCLKFREQ_SFT)
> >> +#define  MLB_CR_SET_CR_BCLKFREQ_SFT(8)
> >> +#define  MLB_CR_SET_CR_BCLKFREQ_MASK   (0xFF << 
> >> MLB_CR_SET_CR_BCLKFREQ_SFT)
> >> +#define  MLB_CR_SET_CR_RTUNTIMER_SFT   (4)
> >> +#define  MLB_CR_SET_CR_RTUNTIMER_MASK  (0xF << 
> >> MLB_CR_SET_CR_RTUNTIMER_SFT)
> >> +
> >> +#define MLB_SD_TOCLK_I_DIV  16
> >> +#define MLB_TOCLKFREQ_UNIT_THRES1600
> >> +#define MLB_CAL_TOCLKFREQ_MHZ(rate) (rate / MLB_SD_TOCLK_I_DIV / 100)
> >> +#define MLB_CAL_TOCLKFREQ_KHZ(rate) (rate / 

Re: [PATCH 1/2] dt-bindings: mmc: add DT bindings for Milbeaut SD controller

2019-05-07 Thread orito.takao
Thank you for reviewing my patches.
Sorry for my late reply. Japan was in Spring Vacation.

> On Fri, Apr 26, 2019 at 11:06:32AM +0900, Takao Orito wrote:
> 
> Needs a commit msg.

I see. I will add message.

> 
> > Signed-off-by: Takao Orito 
> > ---
> >  .../devicetree/bindings/mmc/sdhci-milbeaut.txt | 35 
> > ++
> >  1 file changed, 35 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt 
> > b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > new file mode 100644
> > index 000..7008462
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > @@ -0,0 +1,35 @@
> > +* SOCIONEXT SDHCI controller
> > +
> > +This file documents differences between the core properties in mmc.txt
> > +and the properties used by the sdhci_milbeaut driver.
> > +
> > +Required properties:
> > +- compatible: "socionext,milbeaut-m10v-sdhci-3.0"
> > +- clocks: Must contain an entry for each entry in clock-names. It is a
> > +  list of phandles and clock-specifier pairs.
> > +  See ../clocks/clock-bindings.txt for details.
> > +- clock-names: Should contain the following two entries:
> > +   "iface" - clock used for sdhci interface
> > +   "core"  - core clock for sdhci controller
> > +
> > +Optional properties:
> > +- vqmmc-supply: phandle to the regulator device tree node, mentioned
> > +  as the VCCQ/VDD_IO supply in the eMMC/SD specs.
> > +- fujitsu,cmd-dat-delay-select: boolean property indicating that this host
> > +  requires the CMD_DAT_DELAY control to be enabled.
> > +- sni,mmc-power-gpio: set property indicating that power on or off needs
> > +  control of gpios.
> > +
> > +Example:
> > +   sdhci3: mmc@1b01 {
> > +   compatible = "socionext,milbeaut-m10v-sdhci-3.0";
> > +   reg = <0x1b01 0x1>;
> > +   interrupts = <0 265 0x4>;
> > +   voltage-ranges = <3300 3300>;
> > +   bus-width = <4>;
> > +   clocks = < 7>, <_clk>;
> > +   clock-names = "core", "iface";
> > +   cap-sdio-irq;
> > +   sni,mmc-power-gpio = < 53 GPIO_ACTIVE_HIGH>;
> > +   fujitsu,cmd-dat-delay-select;
> 
> Whitespace problem.

Sorry, I will fix.

Thanks
Orito

> 
> > +   };
> > -- 
> > 1.9.1
> > 
> > 

-- 
Takao Orito 


Re: [PATCH 2/2] mmc: sdhci-milbeaut: add Milbeaut SD controller driver

2019-05-07 Thread orito.takao

Thank you for reviewing my patches.

> [...]
> 
> > +
> > +static void sdhci_milbeaut_power_off(struct sdhci_host *host)
> > +{
> > +   struct f_sdhost_priv *priv = sdhci_priv(host);
> > +
> > +   gpiod_set_value(priv->power_gpio, 0);
> > +   udelay(1000);
> > +}
> > +
> > +static void sdhci_milbeaut_power_on(struct sdhci_host *host)
> > +{
> > +   struct f_sdhost_priv *priv = sdhci_priv(host);
> > +
> > +   gpiod_set_value(priv->power_gpio, 1);
> > +}
> > +
> 
> As stated for the DT doc patch, please use a fixed GPIO regulator
> instead. In this way you will also get a the OCR mask based upon the
> GPIO regulator, which is parsed out by the mmc core when sdhci calls
> mmc_regulator_get_supply().

I see. I will update this part too at the view point of using regurator.

Thanks
Orito

> 
> Otherwise, this looks good to me.
> 
> [...]
> 
> Kind regards
> Uffe

-- 
Takao Orito 


Re: [PATCH 1/2] dt-bindings: mmc: add DT bindings for Milbeaut SD controller

2019-05-07 Thread orito.takao

Thank you for reviewing my patches.
Sorry for my late reply. Japan was in Spring Vacation.

> On Fri, 26 Apr 2019 at 04:04, Takao Orito  wrote:
> >
> > Signed-off-by: Takao Orito 
> > ---
> >  .../devicetree/bindings/mmc/sdhci-milbeaut.txt | 35 
> > ++
> >  1 file changed, 35 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> >
> > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt 
> > b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > new file mode 100644
> > index 000..7008462
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/sdhci-milbeaut.txt
> > @@ -0,0 +1,35 @@
> > +* SOCIONEXT SDHCI controller
> > +
> > +This file documents differences between the core properties in mmc.txt
> > +and the properties used by the sdhci_milbeaut driver.
> > +
> > +Required properties:
> > +- compatible: "socionext,milbeaut-m10v-sdhci-3.0"
> > +- clocks: Must contain an entry for each entry in clock-names. It is a
> > +  list of phandles and clock-specifier pairs.
> > +  See ../clocks/clock-bindings.txt for details.
> > +- clock-names: Should contain the following two entries:
> > +   "iface" - clock used for sdhci interface
> > +   "core"  - core clock for sdhci controller
> > +
> > +Optional properties:
> > +- vqmmc-supply: phandle to the regulator device tree node, mentioned
> > +  as the VCCQ/VDD_IO supply in the eMMC/SD specs.
> > +- fujitsu,cmd-dat-delay-select: boolean property indicating that this host
> > +  requires the CMD_DAT_DELAY control to be enabled.
> > +- sni,mmc-power-gpio: set property indicating that power on or off needs
> > +  control of gpios.
> 
> Please use a vmmc-supply instead of "power-gpio" (which means you need
> to model this as a fixed GPIO regulator).

OK, I will study about regulator/vmmc-supply and change to use it.

Thanks
Orito

> 
> > +
> > +Example:
> > +   sdhci3: mmc@1b01 {
> > +   compatible = "socionext,milbeaut-m10v-sdhci-3.0";
> > +   reg = <0x1b01 0x1>;
> > +   interrupts = <0 265 0x4>;
> > +   voltage-ranges = <3300 3300>;
> > +   bus-width = <4>;
> > +   clocks = < 7>, <_clk>;
> > +   clock-names = "core", "iface";
> > +   cap-sdio-irq;
> > +   sni,mmc-power-gpio = < 53 GPIO_ACTIVE_HIGH>;
> > +   fujitsu,cmd-dat-delay-select;
> > +   };
> > --
> > 1.9.1
> >
> >
> 
> Kind regards
> Uffe

-- 
Takao Orito 


Re: [Milbeaut PATCH v0.4 2/2] mmc: sdhci_f_sdh30: Add support for Milbeaut M10V host controller

2019-04-12 Thread orito.takao

Hi

Thank you for you comment.

> On Tue, 26 Mar 2019 at 05:56, Takao Orito  wrote:
> >
> > SD Host controller on Milbeaut is consist of two controller parts.
> > One is core controller F_SDH30, this is similar to sdhci-fujitsu
> > controller.
> > Another is bridge controller.
> > This bridge controller is not compatible with sdhci-fujitsu controller.
> > This is special for Milbeaut series. This has some functions.
> > For example, reset control, clock enable/select for SDR50/25/12, set
> > property of SD physical pins, retuning control, set capabilityies.
> >
> > This bridge controller requires special procedures at reset or clock
> > enablement or change for further tuning of clock.
> >
> > This new driver uses GPIO descriptor from platform data to switch
> > the power.
> >
> > Signed-off-by: Takao Orito 
> 
> Looks like you should add a new variant driver instead of extending
> sdhci_f_sdh30.c.
> 
> If there are some registers bits or some other minor things that you
> want to share among these variants, you can always do that via a
> header file.

Ok, I see.
I will think to prepare a new variant driver with new common header file
to be shared with sdhci_f_sdh30.c

Thanks
Orito

> 
> Kind regards
> Uffe
> 
> > ---
> >  drivers/mmc/host/sdhci_f_sdh30.c | 324 
> > +++
> >  1 file changed, 296 insertions(+), 28 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci_f_sdh30.c 
> > b/drivers/mmc/host/sdhci_f_sdh30.c
> > index 485f759..994bafd 100644
> > --- a/drivers/mmc/host/sdhci_f_sdh30.c
> > +++ b/drivers/mmc/host/sdhci_f_sdh30.c
> > @@ -11,12 +11,15 @@
> >   */
> >
> >  #include 
> > -#include 
> > +#include 
> >  #include 
> > +#include 
> > +#include 
> > +#include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> > -#include 
> >
> >  #include "sdhci-pltfm.h"
> >
> > @@ -43,14 +46,55 @@
> >
> >  #define F_SDH30_CMD_DAT_DELAY  0x200
> >
> > +/* milbeaut bridge controller register */
> > +#define MLB_SOFT_RESET 0x0200
> > +#define  MLB_SOFT_RESET_RSTX   BIT(0)
> > +
> > +#define MLB_WP_CD_LED_SET  0x0210
> > +#define  MLB_WP_CD_LED_SET_LED_INV  BIT(2)
> > +
> > +#define MLB_CR_SET 0x0220
> > +#define  MLB_CR_SET_CR_TOCLKUNIT   BIT(24)
> > +#define  MLB_CR_SET_CR_TOCLKFREQ_SFT   (16)
> > +#define  MLB_CR_SET_CR_TOCLKFREQ_MASK  (0x3F << 
> > MLB_CR_SET_CR_TOCLKFREQ_SFT)
> > +#define  MLB_CR_SET_CR_BCLKFREQ_SFT(8)
> > +#define  MLB_CR_SET_CR_BCLKFREQ_MASK   (0xFF << MLB_CR_SET_CR_BCLKFREQ_SFT)
> > +#define  MLB_CR_SET_CR_RTUNTIMER_SFT   (4)
> > +#define  MLB_CR_SET_CR_RTUNTIMER_MASK  (0xF << MLB_CR_SET_CR_RTUNTIMER_SFT)
> > +
> > +#define MLB_SD_TOCLK_I_DIV 16
> > +#define MLB_TOCLKFREQ_UNIT_THRES   1600
> > +#define MLB_CAL_TOCLKFREQ_MHZ(rate)(rate / MLB_SD_TOCLK_I_DIV / 
> > 100)
> > +#define MLB_CAL_TOCLKFREQ_KHZ(rate)(rate / MLB_SD_TOCLK_I_DIV / 1000)
> > +#define MLB_TOCLKFREQ_MAX  63
> > +#define MLB_TOCLKFREQ_MIN   1
> > +
> > +#define MLB_SD_BCLK_I_DIV  4
> > +#define MLB_CAL_BCLKFREQ(rate) (rate / MLB_SD_BCLK_I_DIV / 100)
> > +#define MLB_BCLKFREQ_MAX   255
> > +#define MLB_BCLKFREQ_MIN 1
> > +
> > +#define MLB_CDR_SET0x0230
> > +#define MLB_CDR_SET_CLK2POW16  3
> > +
> >  #define F_SDH30_MIN_CLOCK  40
> >
> > +struct f_sdh30_config {
> > +   void (*reset)(struct sdhci_host *host, u8 mask);
> > +   void (*init)(struct sdhci_host *host);
> > +   void (*quirk_init)(struct sdhci_host *host);
> > +   void (*prepare_power)(struct sdhci_host *host, unsigned char mode,
> > +unsigned short vdd);
> > +};
> > +
> >  struct f_sdhost_priv {
> > struct clk *clk_iface;
> > struct clk *clk;
> > u32 vendor_hs200;
> > struct device *dev;
> > bool enable_cmd_dat_delay;
> > +   struct gpio_desc *power_gpio;
> > +   struct f_sdh30_config *config;
> >  };
> >
> >  static void sdhci_f_sdh30_soft_voltage_switch(struct sdhci_host *host)
> > @@ -86,7 +130,46 @@ static unsigned int sdhci_f_sdh30_get_min_clock(struct 
> > sdhci_host *host)
> > return F_SDH30_MIN_CLOCK;
> >  }
> >
> > -static void sdhci_f_sdh30_reset(struct sdhci_host *host, u8 mask)
> > +static void sdhci_milbeaut_reset(struct sdhci_host *host, u8 mask)
> > +{
> > +   struct f_sdhost_priv *priv = sdhci_priv(host);
> > +   u16 clk;
> > +   u32 ctl;
> > +   ktime_t timeout;
> > +
> > +   clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> > +   clk = (clk & ~SDHCI_CLOCK_CARD_EN) | SDHCI_CLOCK_INT_EN;
> > +   sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
> > +
> > +   sdhci_reset(host, mask);
> > +
> > +   clk |= SDHCI_CLOCK_CARD_EN;
> > +   sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
> > +
> > +   timeout = ktime_add_ms(ktime_get(), 10);
> > +   while (1) {
> > +   bool timedout = 

Re: [PATCH v1 1/2] dt-bindings: mmc: sdhci-fujitsu.txt: add miilbeaut driver

2019-04-01 Thread orito.takao

Hi

> On Tue, Mar 26, 2019 at 02:53:37PM +0900, Takao Orito wrote:
> > Add new compatible description for Milbeaut SoC. Socionext
> > inherits F_SDH30 IP from Fujitsu. Then new Soc series "Milbeaut"
> > has F_SDH30 controller specified by "socionext,milbeaut-m10v-sdhci-3.0".
> 
> Subject is wrong, you're not adding a driver.

OK, I will change "dt-bindings: mmc: sdhci-fujitsu.txt: add milbeaut support"

> 
> > 
> > Signed-off-by: Takao Orito 
> > ---
> >  .../devicetree/bindings/mmc/sdhci-fujitsu.txt  | 22 
> > +++---
> >  1 file changed, 19 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-fujitsu.txt 
> > b/Documentation/devicetree/bindings/mmc/sdhci-fujitsu.txt
> > index 3ee9263..405811f 100644
> > --- a/Documentation/devicetree/bindings/mmc/sdhci-fujitsu.txt
> > +++ b/Documentation/devicetree/bindings/mmc/sdhci-fujitsu.txt
> > @@ -1,10 +1,10 @@
> > -* Fujitsu SDHCI controller
> > +* Fujitsu/Socionext SDHCI controller
> >  
> >  This file documents differences between the core properties in mmc.txt
> > -and the properties used by the sdhci_f_sdh30 driver.
> > +and the properties used by the sdhci_f_sdh30.
> >  
> >  Required properties:
> > -- compatible: "fujitsu,mb86s70-sdhci-3.0"
> > +- compatible: "fujitsu,mb86s70-sdhci-3.0", 
> > "socionext,milbeaut-m10v-sdhci-3.0"
> 
> One per line please.

I see, I will fix.

> 
> >  - clocks: Must contain an entry for each entry in clock-names. It is a
> >list of phandles and clock-specifier pairs.
> >See ../clocks/clock-bindings.txt for details.
> > @@ -17,6 +17,8 @@ Optional properties:
> >as the VCCQ/VDD_IO supply in the eMMC/SD specs.
> >  - fujitsu,cmd-dat-delay-select: boolean property indicating that this host
> >requires the CMD_DAT_DELAY control to be enabled.
> > +- sni,mmc-power-gpio: set property indicating that power on or off needs
> > +  control of gpio. This is for only "socionext,milbeaut-m10v-sdhci-3.0".
> 
> s/-gpio/-gpios/

I will fix.

> 
> >  
> >  Example:
> >  
> > @@ -30,3 +32,17 @@ Example:
> > clocks = < 2 2 0>, < 2 3 0>;
> > clock-names = "iface", "core";
> > };
> > +
> > +Exsample2:
> > +   sdhci3: mmc@1b01 {
> > +   compatible = "socionext,milbeaut-m10v-sdhci-3.0";
> > +   reg = <0x1b01 0x1>;
> > +   interrupts = <0 265 0x4>;
> > +   voltage-ranges = <3300 3300>;
> > +   bus-width = <4>;
> > +   clocks = <>, <_clk>;
> > +   clock-names = "core", "iface";
> > +   cap-sdio-irq;
> > +   sni,mmc-power-gpio = < 53 GPIO_ACTIVE_HIGH>;
> > +  fujitsu,cmd-dat-delay-select;
> 
> Indentation problem.

Sorry, I will fix.

Thank you
Orito

> 
> > +   };
> > -- 
> > 1.9.1
> > 
> > 

-- 
Takao Orito 


Re: [Milbeaut PATCH v0.4 0/2] mmc: sdhci_f_sdh30: Add support for Milbeaut

2019-03-25 Thread orito.takao

Hi All

I'm sorry, I had mistaken the Subject format of my patch series.
I will send new patches with right format.
Please ignore this series.

Orito

> The following patches add driver support for SD Host controller on
> Socionext's Milbeaut M10V platforms.
> 
> SD Host controller on Milbeaut is consist of two controller parts.
> One is core controller F_SDH30, this is similar to sdhci-fujitsu
> controller.
> Another is bridge controller. This bridge controller is not compatible
> with sdhci-fujitsu controller. This is special for Milbeaut series.
> 
> It has the several parts,
>  - reset control
>  - clock enable / select for SDR50/25/12
>  - hold control of DATA/CMD line
>  - select characteristics for WP/CD/LED line
>  - Re-tuning control for mode3
>  - Capability setting
>Timeout Clock / Base Clock / Timer Count for Re-Tuning /
>Debounce period
> These requires special procedures at reset or clock enable/change or
>  further tuning of clock.
> 
> Takao Orito (2):
>   dt-bindings: mmc: sdhci-fujitsu.txt: add miilbeaut driver
>   mmc: sdhci_f_sdh30: Add support for Milbeaut M10V host controller
> 
>  .../devicetree/bindings/mmc/sdhci-fujitsu.txt  |  22 +-
>  drivers/mmc/host/sdhci_f_sdh30.c   | 324 
> +++--
>  2 files changed, 315 insertions(+), 31 deletions(-)
> 
> -- 
> 1.9.1
> 

-- 
Takao Orito