* [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver @ 2018-07-06 7:19 Jisheng Zhang 2018-07-06 7:20 ` [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC Jisheng Zhang ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Jisheng Zhang @ 2018-07-06 7:19 UTC (permalink / raw) To: linux-arm-kernel Add support for Synopsys SDHCI compatible DesignWare Cores Mobile Storage Host Controller which can support eMMC/SD/SDIO. Since v1: - move the dt bindings into a separate patch Jisheng Zhang (2): dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC dirver .../bindings/mmc/sdhci-of-dwcmshc.txt | 20 +++ drivers/mmc/host/Kconfig | 11 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-of-dwcmshc.c | 116 ++++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt create mode 100644 drivers/mmc/host/sdhci-of-dwcmshc.c -- 2.18.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC 2018-07-06 7:19 [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver Jisheng Zhang @ 2018-07-06 7:20 ` Jisheng Zhang 2018-07-11 16:12 ` Rob Herring 2018-07-06 7:23 ` [PATCH v2 2/2] mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC driver Jisheng Zhang 2018-07-09 11:32 ` [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver Ulf Hansson 2 siblings, 1 reply; 7+ messages in thread From: Jisheng Zhang @ 2018-07-06 7:20 UTC (permalink / raw) To: linux-arm-kernel Synopsys SDHCI compatible DesignWare Cores Mobile Storage Host Controller can support eMMC/SD/SDIO. Add the bindings. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> --- .../bindings/mmc/sdhci-of-dwcmshc.txt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt new file mode 100644 index 000000000000..ee4253b33be2 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt @@ -0,0 +1,20 @@ +* Synopsys DesignWare Cores Mobile Storage Host Controller + +Required properties: +- compatible: should be one of the following: + "snps,dwcmshc-sdhci" +- reg: offset and length of the register set for the device. +- interrupts: a single interrupt specifier. +- clocks: Array of clocks required for SDHCI; requires at least one for + core clock. +- clock-names: Array of names corresponding to clocks property; shall be + "core" for core clock and "bus" for optional bus clock. + +Example: + sdhci2: sdhci at aa0000 { + compatible = "snps,dwcmshc-sdhci"; + reg = <0xaa0000 0x1000>; + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&emmcclk>; + bus-width = <8>; + } -- 2.18.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC 2018-07-06 7:20 ` [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC Jisheng Zhang @ 2018-07-11 16:12 ` Rob Herring 2018-07-12 2:06 ` Jisheng Zhang 0 siblings, 1 reply; 7+ messages in thread From: Rob Herring @ 2018-07-11 16:12 UTC (permalink / raw) To: linux-arm-kernel On Fri, Jul 06, 2018 at 03:20:47PM +0800, Jisheng Zhang wrote: > Synopsys SDHCI compatible DesignWare Cores Mobile Storage Host > Controller can support eMMC/SD/SDIO. Add the bindings. > > Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> > --- > .../bindings/mmc/sdhci-of-dwcmshc.txt | 20 +++++++++++++++++++ > 1 file changed, 20 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > new file mode 100644 > index 000000000000..ee4253b33be2 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > @@ -0,0 +1,20 @@ > +* Synopsys DesignWare Cores Mobile Storage Host Controller > + > +Required properties: > +- compatible: should be one of the following: > + "snps,dwcmshc-sdhci" Needs to note that there must also be an SoC specific compatible. > +- reg: offset and length of the register set for the device. > +- interrupts: a single interrupt specifier. > +- clocks: Array of clocks required for SDHCI; requires at least one for > + core clock. > +- clock-names: Array of names corresponding to clocks property; shall be > + "core" for core clock and "bus" for optional bus clock. > + > +Example: > + sdhci2: sdhci at aa0000 { > + compatible = "snps,dwcmshc-sdhci"; > + reg = <0xaa0000 0x1000>; > + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; > + clocks = <&emmcclk>; > + bus-width = <8>; > + } > -- > 2.18.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC 2018-07-11 16:12 ` Rob Herring @ 2018-07-12 2:06 ` Jisheng Zhang 2018-07-16 21:59 ` Rob Herring 0 siblings, 1 reply; 7+ messages in thread From: Jisheng Zhang @ 2018-07-12 2:06 UTC (permalink / raw) To: linux-arm-kernel Hi Rob, On Wed, 11 Jul 2018 10:12:06 -0600 Rob Herring wrote: > On Fri, Jul 06, 2018 at 03:20:47PM +0800, Jisheng Zhang wrote: > > Synopsys SDHCI compatible DesignWare Cores Mobile Storage Host > > Controller can support eMMC/SD/SDIO. Add the bindings. > > > > Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> > > --- > > .../bindings/mmc/sdhci-of-dwcmshc.txt | 20 +++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > > > > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > > new file mode 100644 > > index 000000000000..ee4253b33be2 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > > @@ -0,0 +1,20 @@ > > +* Synopsys DesignWare Cores Mobile Storage Host Controller > > + > > +Required properties: > > +- compatible: should be one of the following: > > + "snps,dwcmshc-sdhci" > > Needs to note that there must also be an SoC specific compatible. Currently, there's no SoC specific code in this driver, so the binding could be extended to SoC compatible if necessary. What do you think? Thanks, Jisheng ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC 2018-07-12 2:06 ` Jisheng Zhang @ 2018-07-16 21:59 ` Rob Herring 0 siblings, 0 replies; 7+ messages in thread From: Rob Herring @ 2018-07-16 21:59 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jul 12, 2018 at 10:06:11AM +0800, Jisheng Zhang wrote: > Hi Rob, > > On Wed, 11 Jul 2018 10:12:06 -0600 Rob Herring wrote: > > > On Fri, Jul 06, 2018 at 03:20:47PM +0800, Jisheng Zhang wrote: > > > Synopsys SDHCI compatible DesignWare Cores Mobile Storage Host > > > Controller can support eMMC/SD/SDIO. Add the bindings. > > > > > > Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> > > > --- > > > .../bindings/mmc/sdhci-of-dwcmshc.txt | 20 +++++++++++++++++++ > > > 1 file changed, 20 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > > > > > > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > > > new file mode 100644 > > > index 000000000000..ee4253b33be2 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > > > @@ -0,0 +1,20 @@ > > > +* Synopsys DesignWare Cores Mobile Storage Host Controller > > > + > > > +Required properties: > > > +- compatible: should be one of the following: > > > + "snps,dwcmshc-sdhci" > > > > Needs to note that there must also be an SoC specific compatible. > > Currently, there's no SoC specific code in this driver, so the binding could > be extended to SoC compatible if necessary. What do you think? Doesn't matter what's in the driver, it can use this compatible. But experience has shown that a compatible for a licensed IP is never sufficient. There are versions of the blocks, configuration options, and integration differences. I'm not asking you to add any SoC specific compatible now unless you are working on a particular SoC, but just state one is needed. Rob ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC driver 2018-07-06 7:19 [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver Jisheng Zhang 2018-07-06 7:20 ` [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC Jisheng Zhang @ 2018-07-06 7:23 ` Jisheng Zhang 2018-07-09 11:32 ` [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver Ulf Hansson 2 siblings, 0 replies; 7+ messages in thread From: Jisheng Zhang @ 2018-07-06 7:23 UTC (permalink / raw) To: linux-arm-kernel Add a driver for SDHCI OF Synopsys DesignWare Cores Mobile Storage Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> --- drivers/mmc/host/Kconfig | 11 +++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-of-dwcmshc.c | 116 ++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 drivers/mmc/host/sdhci-of-dwcmshc.c diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 0581c199c996..694d0828215d 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -176,6 +176,17 @@ config MMC_SDHCI_OF_HLWD If unsure, say N. +config MMC_SDHCI_OF_DWCMSHC + tristate "SDHCI OF support for the Synopsys DWC MSHC" + depends on MMC_SDHCI_PLTFM + depends on OF + depends on COMMON_CLK + help + This selects Synopsys DesignWare Cores Mobile Storage Controller + support. + If you have a controller with this interface, say Y or M here. + If unsure, say N. + config MMC_SDHCI_CADENCE tristate "SDHCI support for the Cadence SD/SDIO/eMMC controller" depends on MMC_SDHCI_PLTFM diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index 85dc1322c3de..a18fbba1b97e 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_ARASAN) += sdhci-of-arasan.o obj-$(CONFIG_MMC_SDHCI_OF_AT91) += sdhci-of-at91.o obj-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o obj-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o +obj-$(CONFIG_MMC_SDHCI_OF_DWCMSHC) += sdhci-of-dwcmshc.o obj-$(CONFIG_MMC_SDHCI_BCM_KONA) += sdhci-bcm-kona.o obj-$(CONFIG_MMC_SDHCI_IPROC) += sdhci-iproc.o obj-$(CONFIG_MMC_SDHCI_MSM) += sdhci-msm.o diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c new file mode 100644 index 000000000000..1b7cd144fb01 --- /dev/null +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for Synopsys DesignWare Cores Mobile Storage Host Controller + * + * Copyright (C) 2018 Synaptics Incorporated + * + * Author: Jisheng Zhang <jszhang@kernel.org> + */ + +#include <linux/clk.h> +#include <linux/module.h> +#include <linux/of.h> + +#include "sdhci-pltfm.h" + +struct dwcmshc_priv { + struct clk *bus_clk; +}; + +static const struct sdhci_ops sdhci_dwcmshc_ops = { + .set_clock = sdhci_set_clock, + .set_bus_width = sdhci_set_bus_width, + .set_uhs_signaling = sdhci_set_uhs_signaling, + .get_max_clock = sdhci_pltfm_clk_get_max_clock, + .reset = sdhci_reset, +}; + +static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = { + .ops = &sdhci_dwcmshc_ops, + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, +}; + +static int dwcmshc_probe(struct platform_device *pdev) +{ + struct sdhci_pltfm_host *pltfm_host; + struct sdhci_host *host; + struct dwcmshc_priv *priv; + int err; + + host = sdhci_pltfm_init(pdev, &sdhci_dwcmshc_pdata, + sizeof(struct dwcmshc_priv)); + if (IS_ERR(host)) + return PTR_ERR(host); + + pltfm_host = sdhci_priv(host); + priv = sdhci_pltfm_priv(pltfm_host); + + pltfm_host->clk = devm_clk_get(&pdev->dev, "core"); + if (IS_ERR(pltfm_host->clk)) { + err = PTR_ERR(pltfm_host->clk); + dev_err(&pdev->dev, "failed to get core clk: %d\n", err); + goto free_pltfm; + } + err = clk_prepare_enable(pltfm_host->clk); + if (err) + goto free_pltfm; + + priv->bus_clk = devm_clk_get(&pdev->dev, "bus"); + if (!IS_ERR(priv->bus_clk)) + clk_prepare_enable(priv->bus_clk); + + err = mmc_of_parse(host->mmc); + if (err) + goto err_clk; + + sdhci_get_of_property(pdev); + + err = sdhci_add_host(host); + if (err) + goto err_clk; + + return 0; + +err_clk: + clk_disable_unprepare(pltfm_host->clk); + clk_disable_unprepare(priv->bus_clk); +free_pltfm: + sdhci_pltfm_free(pdev); + return err; +} + +static int dwcmshc_remove(struct platform_device *pdev) +{ + struct sdhci_host *host = platform_get_drvdata(pdev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host); + + sdhci_remove_host(host, 0); + + clk_disable_unprepare(pltfm_host->clk); + clk_disable_unprepare(priv->bus_clk); + + sdhci_pltfm_free(pdev); + + return 0; +} + +static const struct of_device_id sdhci_dwcmshc_dt_ids[] = { + { .compatible = "snps,dwcmshc-sdhci" }, + {} +}; +MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids); + +static struct platform_driver sdhci_dwcmshc_driver = { + .driver = { + .name = "sdhci-dwcmshc", + .of_match_table = sdhci_dwcmshc_dt_ids, + }, + .probe = dwcmshc_probe, + .remove = dwcmshc_remove, +}; +module_platform_driver(sdhci_dwcmshc_driver); + +MODULE_DESCRIPTION("SDHCI platform driver for Synopsys DWC MSHC"); +MODULE_AUTHOR("Jisheng Zhang <jszhang@kernel.org>"); +MODULE_LICENSE("GPL v2"); -- 2.18.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver 2018-07-06 7:19 [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver Jisheng Zhang 2018-07-06 7:20 ` [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC Jisheng Zhang 2018-07-06 7:23 ` [PATCH v2 2/2] mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC driver Jisheng Zhang @ 2018-07-09 11:32 ` Ulf Hansson 2 siblings, 0 replies; 7+ messages in thread From: Ulf Hansson @ 2018-07-09 11:32 UTC (permalink / raw) To: linux-arm-kernel On 6 July 2018 at 09:19, Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote: > Add support for Synopsys SDHCI compatible DesignWare Cores Mobile > Storage Host Controller which can support eMMC/SD/SDIO. > > Since v1: > - move the dt bindings into a separate patch > > Jisheng Zhang (2): > dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC > mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC dirver > > .../bindings/mmc/sdhci-of-dwcmshc.txt | 20 +++ > drivers/mmc/host/Kconfig | 11 ++ > drivers/mmc/host/Makefile | 1 + > drivers/mmc/host/sdhci-of-dwcmshc.c | 116 ++++++++++++++++++ > 4 files changed, 148 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > create mode 100644 drivers/mmc/host/sdhci-of-dwcmshc.c > > -- > 2.18.0 > Thanks, applied for next! Kind regards Uffe ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-16 21:59 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-07-06 7:19 [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver Jisheng Zhang 2018-07-06 7:20 ` [PATCH v2 1/2] dt: bindings: Add bindings for SDHCI Synopsys DWC MSHC Jisheng Zhang 2018-07-11 16:12 ` Rob Herring 2018-07-12 2:06 ` Jisheng Zhang 2018-07-16 21:59 ` Rob Herring 2018-07-06 7:23 ` [PATCH v2 2/2] mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC driver Jisheng Zhang 2018-07-09 11:32 ` [PATCH v2 0/2] mmc: add SDHCI OF Synopsys DWC MSHC dirver Ulf Hansson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).