Re: [LEDE-DEV] [PATCH] brcm2708: backport upstream sdhost controller driver

2017-04-13 Thread Álvaro Fernández Rojas
You only added CONFIG_MMC_BCM2835_UPSTREAM symbol for bcm2708, missing bcm2709 
and bcm2710, which will break buildbot for those subtargets.

Apart from that, what's the purpose of adding a disabled driver?
Maybe you should create a branch in your staging repo in which this driver is 
enabled by default, in order to see if it works or not.

El 01/04/2017 a las 15:30, Rafał Miłecki escribió:
> From: Rafał Miłecki 
> 
> Signed-off-by: Rafał Miłecki 
> ---
>  target/linux/brcm2708/bcm2708/config-4.9   |1 +
>  ...-Add-new-driver-for-the-sdhost-controller.patch | 1536 
> 
>  ...-Fix-possible-NULL-ptr-dereference-in-bcm.patch |   30 +
>  ...-rename-Kconfig-symbol-to-avoid-downstrea.patch |   40 +
>  4 files changed, 1607 insertions(+)
>  create mode 100644 
> target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
>  create mode 100644 
> target/linux/brcm2708/patches-4.9/080-0002-mmc-bcm2835-Fix-possible-NULL-ptr-dereference-in-bcm.patch
>  create mode 100644 
> target/linux/brcm2708/patches-4.9/080-0100-mmc-bcm2835-rename-Kconfig-symbol-to-avoid-downstrea.patch
> 
> diff --git a/target/linux/brcm2708/bcm2708/config-4.9 
> b/target/linux/brcm2708/bcm2708/config-4.9
> index c1bed074c3..76dd1fde18 100644
> --- a/target/linux/brcm2708/bcm2708/config-4.9
> +++ b/target/linux/brcm2708/bcm2708/config-4.9
> @@ -251,6 +251,7 @@ CONFIG_MMC_BCM2835=y
>  CONFIG_MMC_BCM2835_DMA=y
>  CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2
>  CONFIG_MMC_BCM2835_SDHOST=y
> +# CONFIG_MMC_BCM2835_UPSTREAM is not set
>  CONFIG_MMC_BLOCK=y
>  CONFIG_MMC_BLOCK_MINORS=32
>  CONFIG_MMC_SDHCI=y
> diff --git 
> a/target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
>  
> b/target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
> new file mode 100644
> index 00..2c0238cad9
> --- /dev/null
> +++ 
> b/target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
> @@ -0,0 +1,1536 @@
> +From a7d3e315a02c3154c38d09e51fc9461ba2cac396 Mon Sep 17 00:00:00 2001
> +From: Eric Anholt 
> +Date: Wed, 8 Mar 2017 10:19:03 +0100
> +Subject: [PATCH] mmc: bcm2835: Add new driver for the sdhost controller.
> +
> +The 2835 has two SD controllers: The Arasan sdhci controller (supported
> +by the iproc driver) and a custom sdhost controller.  This patch adds a
> +driver for the latter.
> +
> +The sdhci controller supports both sdcard and sdio.  The sdhost
> +controller supports the sdcard only, but has better performance.  Also
> +note that the rpi3 has sdio wifi, so driving the sdcard with the sdhost
> +controller allows to use the sdhci controller for wifi support.
> +
> +The configuration is done by devicetree via pin muxing.  Both SD
> +controller are available on the same pins (2 pin groups = pin 22 to 27 +
> +pin 48 to 53).  So it's possible to use both SD controllers at the same
> +time with different pin groups.
> +
> +The code was originally written by Phil Elwell in the downstream
> +Rasbperry Pi tree.   In preparation for the upstream merge it was
> +cleaned up and the code base was moderized by Eric Anholt, Stefan
> +Wahren and Gerd Hoffmann.
> +
> +Signed-off-by: Eric Anholt 
> +Signed-off-by: Stefan Wahren 
> +Signed-off-by: Gerd Hoffmann 
> +Signed-off-by: Ulf Hansson 
> +---
> + drivers/mmc/host/Kconfig   |   14 +
> + drivers/mmc/host/Makefile  |1 +
> + drivers/mmc/host/bcm2835.c | 1465 
> 
> + 3 files changed, 1480 insertions(+)
> + create mode 100644 drivers/mmc/host/bcm2835.c
> +
> +--- a/drivers/mmc/host/Kconfig
>  b/drivers/mmc/host/Kconfig
> +@@ -769,6 +769,20 @@ config MMC_TOSHIBA_PCI
> + depends on PCI
> + help
> + 
> ++config MMC_BCM2835
> ++tristate "Broadcom BCM2835 SDHOST MMC Controller support"
> ++depends on ARCH_BCM2835 || COMPILE_TEST
> ++depends on HAS_DMA
> ++help
> ++  This selects the BCM2835 SDHOST MMC controller. If you have
> ++  a BCM2835 platform with SD or MMC devices, say Y or M here.
> ++
> ++  Note that the BCM2835 has two SD controllers: The Arasan
> ++  sdhci controller (supported by MMC_SDHCI_IPROC) and a custom
> ++  sdhost controller (supported by this driver).
> ++
> ++  If unsure, say N.
> ++
> + config MMC_MTK
> + tristate "MediaTek SD/MMC Card Interface support"
> + depends on HAS_DMA
> +--- a/drivers/mmc/host/Makefile
>  b/drivers/mmc/host/Makefile
> +@@ -57,6 +57,7 @@ obj-$(CONFIG_MMC_MOXART)   += moxart-mmc.o
> + obj-$(CONFIG_MMC_SUNXI) += sunxi-mmc.o
> + obj-$(CONFIG_MMC_USDHI6ROL0)+= usdhi6rol0.o
> + obj-$(CONFIG_MMC_TOSHIBA_PCI)   += toshsd.o
> ++obj-$(CONFIG_MMC_BCM2835)   += bcm2835.o
> + 
> + obj-$(CONFIG_MMC_REALTEK_PCI)  

[LEDE-DEV] [PATCH] brcm2708: backport upstream sdhost controller driver

2017-04-01 Thread Rafał Miłecki
From: Rafał Miłecki 

Signed-off-by: Rafał Miłecki 
---
 target/linux/brcm2708/bcm2708/config-4.9   |1 +
 ...-Add-new-driver-for-the-sdhost-controller.patch | 1536 
 ...-Fix-possible-NULL-ptr-dereference-in-bcm.patch |   30 +
 ...-rename-Kconfig-symbol-to-avoid-downstrea.patch |   40 +
 4 files changed, 1607 insertions(+)
 create mode 100644 
target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
 create mode 100644 
target/linux/brcm2708/patches-4.9/080-0002-mmc-bcm2835-Fix-possible-NULL-ptr-dereference-in-bcm.patch
 create mode 100644 
target/linux/brcm2708/patches-4.9/080-0100-mmc-bcm2835-rename-Kconfig-symbol-to-avoid-downstrea.patch

diff --git a/target/linux/brcm2708/bcm2708/config-4.9 
b/target/linux/brcm2708/bcm2708/config-4.9
index c1bed074c3..76dd1fde18 100644
--- a/target/linux/brcm2708/bcm2708/config-4.9
+++ b/target/linux/brcm2708/bcm2708/config-4.9
@@ -251,6 +251,7 @@ CONFIG_MMC_BCM2835=y
 CONFIG_MMC_BCM2835_DMA=y
 CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2
 CONFIG_MMC_BCM2835_SDHOST=y
+# CONFIG_MMC_BCM2835_UPSTREAM is not set
 CONFIG_MMC_BLOCK=y
 CONFIG_MMC_BLOCK_MINORS=32
 CONFIG_MMC_SDHCI=y
diff --git 
a/target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
 
b/target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
new file mode 100644
index 00..2c0238cad9
--- /dev/null
+++ 
b/target/linux/brcm2708/patches-4.9/080-0001-mmc-bcm2835-Add-new-driver-for-the-sdhost-controller.patch
@@ -0,0 +1,1536 @@
+From a7d3e315a02c3154c38d09e51fc9461ba2cac396 Mon Sep 17 00:00:00 2001
+From: Eric Anholt 
+Date: Wed, 8 Mar 2017 10:19:03 +0100
+Subject: [PATCH] mmc: bcm2835: Add new driver for the sdhost controller.
+
+The 2835 has two SD controllers: The Arasan sdhci controller (supported
+by the iproc driver) and a custom sdhost controller.  This patch adds a
+driver for the latter.
+
+The sdhci controller supports both sdcard and sdio.  The sdhost
+controller supports the sdcard only, but has better performance.  Also
+note that the rpi3 has sdio wifi, so driving the sdcard with the sdhost
+controller allows to use the sdhci controller for wifi support.
+
+The configuration is done by devicetree via pin muxing.  Both SD
+controller are available on the same pins (2 pin groups = pin 22 to 27 +
+pin 48 to 53).  So it's possible to use both SD controllers at the same
+time with different pin groups.
+
+The code was originally written by Phil Elwell in the downstream
+Rasbperry Pi tree.   In preparation for the upstream merge it was
+cleaned up and the code base was moderized by Eric Anholt, Stefan
+Wahren and Gerd Hoffmann.
+
+Signed-off-by: Eric Anholt 
+Signed-off-by: Stefan Wahren 
+Signed-off-by: Gerd Hoffmann 
+Signed-off-by: Ulf Hansson 
+---
+ drivers/mmc/host/Kconfig   |   14 +
+ drivers/mmc/host/Makefile  |1 +
+ drivers/mmc/host/bcm2835.c | 1465 
+ 3 files changed, 1480 insertions(+)
+ create mode 100644 drivers/mmc/host/bcm2835.c
+
+--- a/drivers/mmc/host/Kconfig
 b/drivers/mmc/host/Kconfig
+@@ -769,6 +769,20 @@ config MMC_TOSHIBA_PCI
+   depends on PCI
+   help
+ 
++config MMC_BCM2835
++  tristate "Broadcom BCM2835 SDHOST MMC Controller support"
++  depends on ARCH_BCM2835 || COMPILE_TEST
++  depends on HAS_DMA
++  help
++This selects the BCM2835 SDHOST MMC controller. If you have
++a BCM2835 platform with SD or MMC devices, say Y or M here.
++
++Note that the BCM2835 has two SD controllers: The Arasan
++sdhci controller (supported by MMC_SDHCI_IPROC) and a custom
++sdhost controller (supported by this driver).
++
++If unsure, say N.
++
+ config MMC_MTK
+   tristate "MediaTek SD/MMC Card Interface support"
+   depends on HAS_DMA
+--- a/drivers/mmc/host/Makefile
 b/drivers/mmc/host/Makefile
+@@ -57,6 +57,7 @@ obj-$(CONFIG_MMC_MOXART) += moxart-mmc.o
+ obj-$(CONFIG_MMC_SUNXI)   += sunxi-mmc.o
+ obj-$(CONFIG_MMC_USDHI6ROL0)  += usdhi6rol0.o
+ obj-$(CONFIG_MMC_TOSHIBA_PCI) += toshsd.o
++obj-$(CONFIG_MMC_BCM2835) += bcm2835.o
+ 
+ obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o
+ obj-$(CONFIG_MMC_REALTEK_USB) += rtsx_usb_sdmmc.o
+--- /dev/null
 b/drivers/mmc/host/bcm2835.c
+@@ -0,0 +1,1465 @@
++/*
++ * bcm2835 sdhost driver.
++ *
++ * The 2835 has two SD controllers: The Arasan sdhci controller
++ * (supported by the iproc driver) and a custom sdhost controller
++ * (supported by this driver).
++ *
++ * The sdhci controller supports both sdcard and sdio.  The sdhost
++ * controller supports the sdcard only, but has better performance.
++ * Also note that the rpi3 has sdio wifi, so driving the sdcard with
++ * the sdhost controller allows