mbox series

[v4,0/7] Add SD/MMC driver for Actions Semi S900 SoC

Message ID 20190916154546.24982-1-manivannan.sadhasivam@linaro.org
Headers show
Series Add SD/MMC driver for Actions Semi S900 SoC | expand

Message

Manivannan Sadhasivam Sept. 16, 2019, 3:45 p.m. UTC
Hello,

This patchset adds SD/MMC driver for Actions Semi S900 SoC from Owl
family SoCs. There are 4 SD/MMC controller present in this SoC but
only 2 are enabled currently for Bubblegum96 board to access uSD and
onboard eMMC. SDIO support for this driver is not currently implemented.

Note: Currently, driver uses 2 completion mechanisms for maintaining
the coherency between SDC and DMA interrupts and I know that it is not
efficient. Hence, I'd like to hear any suggestions for reimplementing
the logic if anyone has.

With this driver, this patchset also fixes one clk driver issue and enables
the Actions Semi platform in ARM64 defconfig.

Thanks,
Mani

Changes in v4:

* Incorporated review comments from Rob on dt binding

Changes in v3:

* Incorporated a review comment from Andreas on board dts patch
* Modified the MAINTAINERS entry for devicetree YAML binding

Changes in v2:

* Converted the devicetree bindings to YAML
* Misc changes to bubblegum devicetree as per the review from Andreas
* Dropped the read/write wrappers and renamed all functions to use owl-
  prefix as per the review from Ulf
* Renamed clk_val_best to owl_clk_val_best and added Reviewed-by tag
  from Stephen

Manivannan Sadhasivam (7):
  clk: actions: Fix factor clk struct member access
  dt-bindings: mmc: Add Actions Semi SD/MMC/SDIO controller binding
  arm64: dts: actions: Add MMC controller support for S900
  arm64: dts: actions: Add uSD and eMMC support for Bubblegum96
  mmc: Add Actions Semi Owl SoCs SD/MMC driver
  MAINTAINERS: Add entry for Actions Semi SD/MMC driver and binding
  arm64: configs: Enable Actions Semi platform in defconfig

 .../devicetree/bindings/mmc/owl-mmc.yaml      |  59 ++
 MAINTAINERS                                   |   2 +
 .../boot/dts/actions/s900-bubblegum-96.dts    |  62 ++
 arch/arm64/boot/dts/actions/s900.dtsi         |  45 ++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/clk/actions/owl-factor.c              |   7 +-
 drivers/mmc/host/Kconfig                      |   8 +
 drivers/mmc/host/Makefile                     |   1 +
 drivers/mmc/host/owl-mmc.c                    | 696 ++++++++++++++++++
 9 files changed, 877 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/owl-mmc.yaml
 create mode 100644 drivers/mmc/host/owl-mmc.c

-- 
2.17.1

Comments

Manivannan Sadhasivam Sept. 17, 2019, 4:36 p.m. UTC | #1
On Tue, Sep 17, 2019 at 09:34:18AM -0700, Stephen Boyd wrote:
> Quoting Manivannan Sadhasivam (2019-09-16 08:45:40)

> > Since the helper "owl_factor_helper_round_rate" is shared between factor

> > and composite clocks, using the factor clk specific helper function

> > like "hw_to_owl_factor" to access its members will create issues when

> > called from composite clk specific code. Hence, pass the "factor_hw"

> > struct pointer directly instead of fetching it using factor clk specific

> > helpers.

> > 

> > This issue has been observed when a composite clock like "sd0_clk" tried

> > to call "owl_factor_helper_round_rate" resulting in pointer dereferencing

> > error.

> > 

> > While we are at it, let's rename the "clk_val_best" function to

> > "owl_clk_val_best" since this is an owl SoCs specific helper.

> > 

> > Fixes: 4bb78fc9744a ("clk: actions: Add factor clock support")

> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

> > Reviewed-by: Stephen Boyd <sboyd@kernel.org>

> > ---

> 

> I can apply this to clk-next?


Yes, please :-) Rest can go through Ulf's tree.

Thanks,
Mani

>
Stephen Boyd Sept. 17, 2019, 8:01 p.m. UTC | #2
Quoting Manivannan Sadhasivam (2019-09-16 08:45:40)
> Since the helper "owl_factor_helper_round_rate" is shared between factor

> and composite clocks, using the factor clk specific helper function

> like "hw_to_owl_factor" to access its members will create issues when

> called from composite clk specific code. Hence, pass the "factor_hw"

> struct pointer directly instead of fetching it using factor clk specific

> helpers.

> 

> This issue has been observed when a composite clock like "sd0_clk" tried

> to call "owl_factor_helper_round_rate" resulting in pointer dereferencing

> error.

> 

> While we are at it, let's rename the "clk_val_best" function to

> "owl_clk_val_best" since this is an owl SoCs specific helper.

> 

> Fixes: 4bb78fc9744a ("clk: actions: Add factor clock support")

> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

> Reviewed-by: Stephen Boyd <sboyd@kernel.org>

> ---


Applied to clk-next
Ulf Hansson Oct. 3, 2019, 10:01 a.m. UTC | #3
On Mon, 16 Sep 2019 at 17:46, Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>

> Hello,

>

> This patchset adds SD/MMC driver for Actions Semi S900 SoC from Owl

> family SoCs. There are 4 SD/MMC controller present in this SoC but

> only 2 are enabled currently for Bubblegum96 board to access uSD and

> onboard eMMC. SDIO support for this driver is not currently implemented.

>

> Note: Currently, driver uses 2 completion mechanisms for maintaining

> the coherency between SDC and DMA interrupts and I know that it is not

> efficient. Hence, I'd like to hear any suggestions for reimplementing

> the logic if anyone has.

>

> With this driver, this patchset also fixes one clk driver issue and enables

> the Actions Semi platform in ARM64 defconfig.

>

> Thanks,

> Mani

>

> Changes in v4:

>

> * Incorporated review comments from Rob on dt binding

>

> Changes in v3:

>

> * Incorporated a review comment from Andreas on board dts patch

> * Modified the MAINTAINERS entry for devicetree YAML binding

>

> Changes in v2:

>

> * Converted the devicetree bindings to YAML

> * Misc changes to bubblegum devicetree as per the review from Andreas

> * Dropped the read/write wrappers and renamed all functions to use owl-

>   prefix as per the review from Ulf

> * Renamed clk_val_best to owl_clk_val_best and added Reviewed-by tag

>   from Stephen

>

> Manivannan Sadhasivam (7):

>   clk: actions: Fix factor clk struct member access

>   dt-bindings: mmc: Add Actions Semi SD/MMC/SDIO controller binding

>   arm64: dts: actions: Add MMC controller support for S900

>   arm64: dts: actions: Add uSD and eMMC support for Bubblegum96

>   mmc: Add Actions Semi Owl SoCs SD/MMC driver

>   MAINTAINERS: Add entry for Actions Semi SD/MMC driver and binding

>   arm64: configs: Enable Actions Semi platform in defconfig

>

>  .../devicetree/bindings/mmc/owl-mmc.yaml      |  59 ++

>  MAINTAINERS                                   |   2 +

>  .../boot/dts/actions/s900-bubblegum-96.dts    |  62 ++

>  arch/arm64/boot/dts/actions/s900.dtsi         |  45 ++

>  arch/arm64/configs/defconfig                  |   1 +

>  drivers/clk/actions/owl-factor.c              |   7 +-

>  drivers/mmc/host/Kconfig                      |   8 +

>  drivers/mmc/host/Makefile                     |   1 +

>  drivers/mmc/host/owl-mmc.c                    | 696 ++++++++++++++++++

>  9 files changed, 877 insertions(+), 4 deletions(-)

>  create mode 100644 Documentation/devicetree/bindings/mmc/owl-mmc.yaml

>  create mode 100644 drivers/mmc/host/owl-mmc.c

>

> --

> 2.17.1

>


I have picked up the mmc patches for next and as Stephen picked the
clock patch, the rest are now for arm-soc, I guess!?

Kind regards
Uffe
Manivannan Sadhasivam Oct. 3, 2019, 4:17 p.m. UTC | #4
Hi Ulf,

On Thu, Oct 03, 2019 at 12:01:18PM +0200, Ulf Hansson wrote:
> On Mon, 16 Sep 2019 at 17:46, Manivannan Sadhasivam

> <manivannan.sadhasivam@linaro.org> wrote:

> >

> > Hello,

> >

> > This patchset adds SD/MMC driver for Actions Semi S900 SoC from Owl

> > family SoCs. There are 4 SD/MMC controller present in this SoC but

> > only 2 are enabled currently for Bubblegum96 board to access uSD and

> > onboard eMMC. SDIO support for this driver is not currently implemented.

> >

> > Note: Currently, driver uses 2 completion mechanisms for maintaining

> > the coherency between SDC and DMA interrupts and I know that it is not

> > efficient. Hence, I'd like to hear any suggestions for reimplementing

> > the logic if anyone has.

> >

> > With this driver, this patchset also fixes one clk driver issue and enables

> > the Actions Semi platform in ARM64 defconfig.

> >

> > Thanks,

> > Mani

> >

> > Changes in v4:

> >

> > * Incorporated review comments from Rob on dt binding

> >

> > Changes in v3:

> >

> > * Incorporated a review comment from Andreas on board dts patch

> > * Modified the MAINTAINERS entry for devicetree YAML binding

> >

> > Changes in v2:

> >

> > * Converted the devicetree bindings to YAML

> > * Misc changes to bubblegum devicetree as per the review from Andreas

> > * Dropped the read/write wrappers and renamed all functions to use owl-

> >   prefix as per the review from Ulf

> > * Renamed clk_val_best to owl_clk_val_best and added Reviewed-by tag

> >   from Stephen

> >

> > Manivannan Sadhasivam (7):

> >   clk: actions: Fix factor clk struct member access

> >   dt-bindings: mmc: Add Actions Semi SD/MMC/SDIO controller binding

> >   arm64: dts: actions: Add MMC controller support for S900

> >   arm64: dts: actions: Add uSD and eMMC support for Bubblegum96

> >   mmc: Add Actions Semi Owl SoCs SD/MMC driver

> >   MAINTAINERS: Add entry for Actions Semi SD/MMC driver and binding

> >   arm64: configs: Enable Actions Semi platform in defconfig

> >

> >  .../devicetree/bindings/mmc/owl-mmc.yaml      |  59 ++

> >  MAINTAINERS                                   |   2 +

> >  .../boot/dts/actions/s900-bubblegum-96.dts    |  62 ++

> >  arch/arm64/boot/dts/actions/s900.dtsi         |  45 ++

> >  arch/arm64/configs/defconfig                  |   1 +

> >  drivers/clk/actions/owl-factor.c              |   7 +-

> >  drivers/mmc/host/Kconfig                      |   8 +

> >  drivers/mmc/host/Makefile                     |   1 +

> >  drivers/mmc/host/owl-mmc.c                    | 696 ++++++++++++++++++

> >  9 files changed, 877 insertions(+), 4 deletions(-)

> >  create mode 100644 Documentation/devicetree/bindings/mmc/owl-mmc.yaml

> >  create mode 100644 drivers/mmc/host/owl-mmc.c

> >

> > --

> > 2.17.1

> >

> 

> I have picked up the mmc patches for next


Thanks :)

> and as Stephen picked the

> clock patch, the rest are now for arm-soc, I guess!?

> 


Yes, I'll queue them through actions tree (unless Andreas wants to do the PR).

Regards,
Mani

> Kind regards

> Uffe
Manivannan Sadhasivam Oct. 14, 2019, 2:44 p.m. UTC | #5
On Mon, Sep 16, 2019 at 09:15:42PM +0530, Manivannan Sadhasivam wrote:
> Add MMC controller support for Actions Semi S900 SoC. There are 4 MMC

> controllers in this SoC which can be used for accessing SD/MMC/SDIO cards.

> 

> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>


Applied for v5.5.

Thanks,
Mani

> ---

>  arch/arm64/boot/dts/actions/s900.dtsi | 45 +++++++++++++++++++++++++++

>  1 file changed, 45 insertions(+)

> 

> diff --git a/arch/arm64/boot/dts/actions/s900.dtsi b/arch/arm64/boot/dts/actions/s900.dtsi

> index df3a68a3ac97..eb35cf78ab73 100644

> --- a/arch/arm64/boot/dts/actions/s900.dtsi

> +++ b/arch/arm64/boot/dts/actions/s900.dtsi

> @@ -4,6 +4,7 @@

>   */

>  

>  #include <dt-bindings/clock/actions,s900-cmu.h>

> +#include <dt-bindings/gpio/gpio.h>

>  #include <dt-bindings/interrupt-controller/arm-gic.h>

>  #include <dt-bindings/reset/actions,s900-reset.h>

>  

> @@ -284,5 +285,49 @@

>  			dma-requests = <46>;

>  			clocks = <&cmu CLK_DMAC>;

>  		};

> +

> +		mmc0: mmc@e0330000 {

> +			compatible = "actions,owl-mmc";

> +			reg = <0x0 0xe0330000 0x0 0x4000>;

> +			interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;

> +			clocks = <&cmu CLK_SD0>;

> +			resets = <&cmu RESET_SD0>;

> +			dmas = <&dma 2>;

> +			dma-names = "mmc";

> +			status = "disabled";

> +		};

> +

> +		mmc1: mmc@e0334000 {

> +			compatible = "actions,owl-mmc";

> +			reg = <0x0 0xe0334000 0x0 0x4000>;

> +			interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;

> +			clocks = <&cmu CLK_SD1>;

> +			resets = <&cmu RESET_SD1>;

> +			dmas = <&dma 3>;

> +			dma-names = "mmc";

> +			status = "disabled";

> +		};

> +

> +		mmc2: mmc@e0338000 {

> +			compatible = "actions,owl-mmc";

> +			reg = <0x0 0xe0338000 0x0 0x4000>;

> +			interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;

> +			clocks = <&cmu CLK_SD2>;

> +			resets = <&cmu RESET_SD2>;

> +			dmas = <&dma 4>;

> +			dma-names = "mmc";

> +			status = "disabled";

> +		};

> +

> +		mmc3: mmc@e033c000 {

> +			compatible = "actions,owl-mmc";

> +			reg = <0x0 0xe033c000 0x0 0x4000>;

> +			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;

> +			clocks = <&cmu CLK_SD3>;

> +			resets = <&cmu RESET_SD3>;

> +			dmas = <&dma 46>;

> +			dma-names = "mmc";

> +			status = "disabled";

> +		};

>  	};

>  };

> -- 

> 2.17.1

>
Manivannan Sadhasivam Oct. 14, 2019, 2:45 p.m. UTC | #6
On Mon, Sep 16, 2019 at 09:15:43PM +0530, Manivannan Sadhasivam wrote:
> Add uSD and eMMC support for Bubblegum96 board based on Actions Semi

> S900 SoC. SD0 is connected to uSD slot and SD2 is connected to eMMC.

> Since there is no PMIC support added yet, fixed regulator has been

> used as a regulator node.

> 

> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>


Applied for v5.5.

Thanks,
Mani

> ---

>  .../boot/dts/actions/s900-bubblegum-96.dts    | 62 +++++++++++++++++++

>  1 file changed, 62 insertions(+)

> 

> diff --git a/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts b/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts

> index 732daaa6e9d3..59291e0ea1ee 100644

> --- a/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts

> +++ b/arch/arm64/boot/dts/actions/s900-bubblegum-96.dts

> @@ -12,6 +12,9 @@

>  	model = "Bubblegum-96";

>  

>  	aliases {

> +		mmc0 = &mmc0;

> +		mmc1 = &mmc1;

> +		mmc2 = &mmc2;

>  		serial5 = &uart5;

>  	};

>  

> @@ -23,6 +26,24 @@

>  		device_type = "memory";

>  		reg = <0x0 0x0 0x0 0x80000000>;

>  	};

> +

> +	/* Fixed regulator used in the absence of PMIC */

> +	vcc_3v1: vcc-3v1 {

> +		compatible = "regulator-fixed";

> +		regulator-name = "fixed-3.1V";

> +		regulator-min-microvolt = <3100000>;

> +		regulator-max-microvolt = <3100000>;

> +		regulator-always-on;

> +	};

> +

> +	/* Fixed regulator used in the absence of PMIC */

> +	sd_vcc: sd-vcc {

> +		compatible = "regulator-fixed";

> +		regulator-name = "fixed-3.1V";

> +		regulator-min-microvolt = <3100000>;

> +		regulator-max-microvolt = <3100000>;

> +		regulator-always-on;

> +	};

>  };

>  

>  &i2c0 {

> @@ -241,6 +262,47 @@

>  			bias-pull-up;

>  		};

>  	};

> +

> +	mmc0_default: mmc0_default {

> +		pinmux {

> +			groups = "sd0_d0_mfp", "sd0_d1_mfp", "sd0_d2_d3_mfp",

> +				 "sd0_cmd_mfp", "sd0_clk_mfp";

> +			function = "sd0";

> +		};

> +	};

> +

> +	mmc2_default: mmc2_default {

> +		pinmux {

> +			groups = "nand0_d0_ceb3_mfp";

> +			function = "sd2";

> +		};

> +	};

> +};

> +

> +/* uSD */

> +&mmc0 {

> +	status = "okay";

> +	pinctrl-names = "default";

> +	pinctrl-0 = <&mmc0_default>;

> +	no-sdio;

> +	no-mmc;

> +	no-1-8-v;

> +	cd-gpios = <&pinctrl 120 GPIO_ACTIVE_LOW>;

> +	bus-width = <4>;

> +	vmmc-supply = <&sd_vcc>;

> +	vqmmc-supply = <&sd_vcc>;

> +};

> +

> +/* eMMC */

> +&mmc2 {

> +	status = "okay";

> +	pinctrl-names = "default";

> +	pinctrl-0 = <&mmc2_default>;

> +	no-sdio;

> +	no-sd;

> +	non-removable;

> +	bus-width = <8>;

> +	vmmc-supply = <&vcc_3v1>;

>  };

>  

>  &timer {

> -- 

> 2.17.1

>
Manivannan Sadhasivam Oct. 14, 2019, 2:46 p.m. UTC | #7
On Mon, Sep 16, 2019 at 09:15:46PM +0530, Manivannan Sadhasivam wrote:
> Since the Actions Semi platform can now boot a distro, enable it in

> ARM64 defconfig.

> 

> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>


Applied for v5.5.

Thanks,
Mani

> ---

>  arch/arm64/configs/defconfig | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig

> index 0e58ef02880c..8e27777d6687 100644

> --- a/arch/arm64/configs/defconfig

> +++ b/arch/arm64/configs/defconfig

> @@ -29,6 +29,7 @@ CONFIG_BLK_DEV_INITRD=y

>  CONFIG_KALLSYMS_ALL=y

>  # CONFIG_COMPAT_BRK is not set

>  CONFIG_PROFILING=y

> +CONFIG_ARCH_ACTIONS=y

>  CONFIG_ARCH_AGILEX=y

>  CONFIG_ARCH_SUNXI=y

>  CONFIG_ARCH_ALPINE=y

> -- 

> 2.17.1

>