devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support
@ 2016-01-27 22:25 Stefan Wahren
  2016-01-27 22:25 ` [PATCH 1/3] mmc: sdhci-iproc: define MMC caps in platform data Stefan Wahren
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stefan Wahren @ 2016-01-27 22:25 UTC (permalink / raw)
  To: Scott Branden, Ray Jui, Jon Mason, Stephen Warren, Lee Jones,
	Eric Anholt
  Cc: Rob Herring, Mark Rutland, Arnd Bergmann, Ulf Hansson, kernel,
	devicetree, linux-rpi-kernel, linux-mmc, jszhang, shawn.lin,
	bcm-kernel-feedback-list, Stefan Wahren

This patch series based on the suggestion of Scott Branden to implement
bcm2835 support into sdhci-iproc [1].

These changes provide the following advantages:
  * no need to maintain a separate driver for bcm2835
  * improve support and test coverage of bcm2835 mmc support
  * get the rid of SDHCI_CAPABILITIES hack in bcm2835_sdhci_readl
  * increase write performance by avoiding delays in write ops

Patch 1 prepare sdhci-iproc for another platform. Patch 2 and 3
are the actually changes for bcm2835 support.

These series has been tested on Raspberry Pi B with dd (direct I/O):

sdhci-bcm2835

378 kB/s WRITE
10,6 MB/s READ

sdhci-iproc (after applying patch series)

881 kB/s WRITE
10,8 MB/s READ

Changes since RFC:
  * drop patch which tries to add quirks for bcm2835 in DT and define all
    quirks in driver instead to keep old DTs working with sdhci-iproc
    (suggestion by Stephen Warren)
  * define MMC caps in shdci-iproc platform data to make adding new
    platforms more easily (suggestion by Stephen Warren)

[1] - https://lkml.org/lkml/2015/12/22/525

Stefan Wahren (3):
  mmc: sdhci-iproc: define MMC caps in platform data
  mmc: sdhci-iproc: add bcm2835 support
  DT: sdhci-iproc: add bcm2835 compatible

 .../devicetree/bindings/mmc/brcm,sdhci-iproc.txt   |    5 ++++-
 drivers/mmc/host/Kconfig                           |    6 +++---
 drivers/mmc/host/sdhci-iproc.c                     |   20 ++++++++++++++++++--
 3 files changed, 25 insertions(+), 6 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] mmc: sdhci-iproc: define MMC caps in platform data
  2016-01-27 22:25 [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
@ 2016-01-27 22:25 ` Stefan Wahren
  2016-01-27 22:25 ` [PATCH 2/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2016-01-27 22:25 UTC (permalink / raw)
  To: Scott Branden, Ray Jui, Jon Mason, Stephen Warren, Lee Jones,
	Eric Anholt
  Cc: Rob Herring, Mark Rutland, Arnd Bergmann, Ulf Hansson, kernel,
	devicetree, linux-rpi-kernel, linux-mmc, jszhang, shawn.lin,
	bcm-kernel-feedback-list, Stefan Wahren

This patch moves the definition of the MMC capabilities
from the probe function into iproc platform data. After
that we are able to add support for another platform more
easily.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Suggested-by: Stephen Warren <swarren@wwwdotorg.org>
---
 drivers/mmc/host/sdhci-iproc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 55bc348..cdc6c4a 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -26,6 +26,7 @@ struct sdhci_iproc_data {
 	const struct sdhci_pltfm_data *pdata;
 	u32 caps;
 	u32 caps1;
+	u32 mmc_caps;
 };
 
 struct sdhci_iproc_host {
@@ -165,6 +166,7 @@ static const struct sdhci_iproc_data iproc_data = {
 	.pdata = &sdhci_iproc_pltfm_data,
 	.caps = 0x05E90000,
 	.caps1 = 0x00000064,
+	.mmc_caps = MMC_CAP_1_8V_DDR,
 };
 
 static const struct of_device_id sdhci_iproc_of_match[] = {
@@ -199,8 +201,7 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
 	mmc_of_parse(host->mmc);
 	sdhci_get_of_property(pdev);
 
-	/* Enable EMMC 1/8V DDR capable */
-	host->mmc->caps |= MMC_CAP_1_8V_DDR;
+	host->mmc->caps |= iproc_host->data->mmc_caps;
 
 	pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pltfm_host->clk)) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] mmc: sdhci-iproc: add bcm2835 support
  2016-01-27 22:25 [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
  2016-01-27 22:25 ` [PATCH 1/3] mmc: sdhci-iproc: define MMC caps in platform data Stefan Wahren
@ 2016-01-27 22:25 ` Stefan Wahren
  2016-01-27 22:25 ` [PATCH 3/3] DT: sdhci-iproc: add bcm2835 compatible Stefan Wahren
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2016-01-27 22:25 UTC (permalink / raw)
  To: Scott Branden, Ray Jui, Jon Mason, Stephen Warren, Lee Jones,
	Eric Anholt
  Cc: Rob Herring, Mark Rutland, Arnd Bergmann, Ulf Hansson, kernel,
	devicetree, linux-rpi-kernel, linux-mmc, jszhang, shawn.lin,
	bcm-kernel-feedback-list, Stefan Wahren

Scott Branden from Broadcom said that the BCM2835 eMMC IP core is
very similar to IPROC and share most of the quirks. So use this driver
instead of separate one.

The sdhci-iproc contains a better workaround for the clock domain
crossing problem which doesn't need any delays. This results in a
better write performance.

Btw we get the rid of the SDHCI_CAPABILITIES hack in the sdhci_readl
function.

Suggested-by: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Eric Anholt <eric@anholt.net>
---
 drivers/mmc/host/Kconfig       |    6 +++---
 drivers/mmc/host/sdhci-iproc.c |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 1526b8a..60de1e4 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -318,15 +318,15 @@ config MMC_SDHCI_F_SDH30
 	  If unsure, say N.
 
 config MMC_SDHCI_IPROC
-	tristate "SDHCI platform support for the iProc SD/MMC Controller"
-	depends on ARCH_BCM_IPROC || COMPILE_TEST
+	tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller"
+	depends on ARCH_BCM2835 || ARCH_BCM_IPROC || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	default ARCH_BCM_IPROC
 	select MMC_SDHCI_IO_ACCESSORS
 	help
 	  This selects the iProc SD/MMC controller.
 
-	  If you have an IPROC platform with SD or MMC devices,
+	  If you have a BCM2835 or IPROC platform with SD or MMC devices,
 	  say Y or M here.
 
 	  If unsure, say N.
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index cdc6c4a..871c92c 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -169,7 +169,22 @@ static const struct sdhci_iproc_data iproc_data = {
 	.mmc_caps = MMC_CAP_1_8V_DDR,
 };
 
+static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {
+	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
+		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
+		  SDHCI_QUIRK_MISSING_CAPS,
+	.ops = &sdhci_iproc_ops,
+};
+
+static const struct sdhci_iproc_data bcm2835_data = {
+	.pdata = &sdhci_bcm2835_pltfm_data,
+	.caps = SDHCI_CAN_VDD_330,
+	.caps1 = 0x00000000,
+	.mmc_caps = 0x00000000,
+};
+
 static const struct of_device_id sdhci_iproc_of_match[] = {
+	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
 	{ .compatible = "brcm,sdhci-iproc-cygnus", .data = &iproc_data },
 	{ }
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] DT: sdhci-iproc: add bcm2835 compatible
  2016-01-27 22:25 [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
  2016-01-27 22:25 ` [PATCH 1/3] mmc: sdhci-iproc: define MMC caps in platform data Stefan Wahren
  2016-01-27 22:25 ` [PATCH 2/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
@ 2016-01-27 22:25 ` Stefan Wahren
  2016-01-28  0:36 ` [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Scott Branden
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2016-01-27 22:25 UTC (permalink / raw)
  To: Scott Branden, Ray Jui, Jon Mason, Stephen Warren, Lee Jones,
	Eric Anholt
  Cc: Rob Herring, Mark Rutland, Arnd Bergmann, Ulf Hansson, kernel,
	devicetree, linux-rpi-kernel, linux-mmc, jszhang, shawn.lin,
	bcm-kernel-feedback-list, Stefan Wahren

Since sdhci-iproc can support bcm2835 we need add the
compatible string to the binding.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Scott Branden <sbranden@broadcom.com>
Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/mmc/brcm,sdhci-iproc.txt   |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt b/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt
index 72cc9cc..a9330a4 100644
--- a/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt
+++ b/Documentation/devicetree/bindings/mmc/brcm,sdhci-iproc.txt
@@ -4,7 +4,10 @@ This file documents differences between the core properties described
 by mmc.txt and the properties that represent the IPROC SDHCI controller.
 
 Required properties:
-- compatible : Should be "brcm,sdhci-iproc-cygnus".
+- compatible : Should be one of the following
+	       "brcm,bcm2835-sdhci"
+	       "brcm,sdhci-iproc-cygnus"
+
 - clocks : The clock feeding the SDHCI controller.
 
 Optional properties:
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support
  2016-01-27 22:25 [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
                   ` (2 preceding siblings ...)
  2016-01-27 22:25 ` [PATCH 3/3] DT: sdhci-iproc: add bcm2835 compatible Stefan Wahren
@ 2016-01-28  0:36 ` Scott Branden
       [not found] ` <1453933542-30287-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
  2016-01-29 11:41 ` Ulf Hansson
  5 siblings, 0 replies; 7+ messages in thread
From: Scott Branden @ 2016-01-28  0:36 UTC (permalink / raw)
  To: Stefan Wahren, Ray Jui, Jon Mason, Stephen Warren, Lee Jones,
	Eric Anholt
  Cc: Rob Herring, Mark Rutland, Arnd Bergmann, Ulf Hansson, kernel,
	devicetree, linux-rpi-kernel, linux-mmc, jszhang, shawn.lin,
	bcm-kernel-feedback-list

Looks clean Stefan.  I'll try and revisit the caps setting in the future 
and may be able to provide additional settings in a later patch.

This patch series:
Acked-by: Scott Branden <sbranden@broadcom.com>


On 16-01-27 02:25 PM, Stefan Wahren wrote:
> This patch series based on the suggestion of Scott Branden to implement
> bcm2835 support into sdhci-iproc [1].
>
> These changes provide the following advantages:
>    * no need to maintain a separate driver for bcm2835
>    * improve support and test coverage of bcm2835 mmc support
>    * get the rid of SDHCI_CAPABILITIES hack in bcm2835_sdhci_readl
>    * increase write performance by avoiding delays in write ops
>
> Patch 1 prepare sdhci-iproc for another platform. Patch 2 and 3
> are the actually changes for bcm2835 support.
>
> These series has been tested on Raspberry Pi B with dd (direct I/O):
>
> sdhci-bcm2835
>
> 378 kB/s WRITE
> 10,6 MB/s READ
>
> sdhci-iproc (after applying patch series)
>
> 881 kB/s WRITE
> 10,8 MB/s READ
>
> Changes since RFC:
>    * drop patch which tries to add quirks for bcm2835 in DT and define all
>      quirks in driver instead to keep old DTs working with sdhci-iproc
>      (suggestion by Stephen Warren)
>    * define MMC caps in shdci-iproc platform data to make adding new
>      platforms more easily (suggestion by Stephen Warren)
>
> [1] - https://lkml.org/lkml/2015/12/22/525
>
> Stefan Wahren (3):
>    mmc: sdhci-iproc: define MMC caps in platform data
>    mmc: sdhci-iproc: add bcm2835 support
>    DT: sdhci-iproc: add bcm2835 compatible
>
>   .../devicetree/bindings/mmc/brcm,sdhci-iproc.txt   |    5 ++++-
>   drivers/mmc/host/Kconfig                           |    6 +++---
>   drivers/mmc/host/sdhci-iproc.c                     |   20 ++++++++++++++++++--
>   3 files changed, 25 insertions(+), 6 deletions(-)
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support
       [not found] ` <1453933542-30287-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
@ 2016-01-29  5:10   ` Stephen Warren
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2016-01-29  5:10 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Scott Branden, Ray Jui, Jon Mason, Lee Jones, Eric Anholt,
	Rob Herring, Mark Rutland, Arnd Bergmann, Ulf Hansson,
	kernel-TqfNSX0MhmxHKSADF0wUEw, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, jszhang-eYqpPyKDWXRBDgjK7y7TUQ,
	shawn.lin-TNX95d0MmH7DzftRWevZcw,
	bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w

On 01/27/2016 03:25 PM, Stefan Wahren wrote:
> This patch series based on the suggestion of Scott Branden to implement
> bcm2835 support into sdhci-iproc [1].

The series,
Acked-by: Stephen Warren <Swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

--
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	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support
  2016-01-27 22:25 [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
                   ` (4 preceding siblings ...)
       [not found] ` <1453933542-30287-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
@ 2016-01-29 11:41 ` Ulf Hansson
  5 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2016-01-29 11:41 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Scott Branden, Ray Jui, Jon Mason, Stephen Warren, Lee Jones,
	Eric Anholt, Rob Herring, Mark Rutland, Arnd Bergmann, kernel,
	devicetree@vger.kernel.org, linux-rpi-kernel, linux-mmc,
	Jisheng Zhang, Shawn Lin, bcm-kernel-feedback-list

On 27 January 2016 at 23:25, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> This patch series based on the suggestion of Scott Branden to implement
> bcm2835 support into sdhci-iproc [1].
>
> These changes provide the following advantages:
>   * no need to maintain a separate driver for bcm2835
>   * improve support and test coverage of bcm2835 mmc support
>   * get the rid of SDHCI_CAPABILITIES hack in bcm2835_sdhci_readl
>   * increase write performance by avoiding delays in write ops
>
> Patch 1 prepare sdhci-iproc for another platform. Patch 2 and 3
> are the actually changes for bcm2835 support.
>
> These series has been tested on Raspberry Pi B with dd (direct I/O):
>
> sdhci-bcm2835
>
> 378 kB/s WRITE
> 10,6 MB/s READ
>
> sdhci-iproc (after applying patch series)
>
> 881 kB/s WRITE
> 10,8 MB/s READ
>
> Changes since RFC:
>   * drop patch which tries to add quirks for bcm2835 in DT and define all
>     quirks in driver instead to keep old DTs working with sdhci-iproc
>     (suggestion by Stephen Warren)
>   * define MMC caps in shdci-iproc platform data to make adding new
>     platforms more easily (suggestion by Stephen Warren)
>
> [1] - https://lkml.org/lkml/2015/12/22/525
>
> Stefan Wahren (3):
>   mmc: sdhci-iproc: define MMC caps in platform data
>   mmc: sdhci-iproc: add bcm2835 support
>   DT: sdhci-iproc: add bcm2835 compatible
>
>  .../devicetree/bindings/mmc/brcm,sdhci-iproc.txt   |    5 ++++-
>  drivers/mmc/host/Kconfig                           |    6 +++---
>  drivers/mmc/host/sdhci-iproc.c                     |   20 ++++++++++++++++++--
>  3 files changed, 25 insertions(+), 6 deletions(-)
>
> --
> 1.7.9.5
>


Thanks, applied for next!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-29 11:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 22:25 [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
2016-01-27 22:25 ` [PATCH 1/3] mmc: sdhci-iproc: define MMC caps in platform data Stefan Wahren
2016-01-27 22:25 ` [PATCH 2/3] mmc: sdhci-iproc: add bcm2835 support Stefan Wahren
2016-01-27 22:25 ` [PATCH 3/3] DT: sdhci-iproc: add bcm2835 compatible Stefan Wahren
2016-01-28  0:36 ` [PATCH 0/3] mmc: sdhci-iproc: add bcm2835 support Scott Branden
     [not found] ` <1453933542-30287-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-01-29  5:10   ` Stephen Warren
2016-01-29 11:41 ` 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).