* [PATCH 0/7] support sdhci-esdhc-imx as an OF device
@ 2011-03-14 14:25 Shawn Guo
[not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 24+ messages in thread
From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linaro-dev-cunTk1MwBs8s++Sfvej+rw
Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A
This patch set is to support sdhci-esdhc-imx as an OF device. As
there is already powerpc based esdhc OF support, it chose to add OF
support for imx esdhc driver in a different way from what sdhci-tegra
did.
It consolidates sdhci_pltfm_data sdhci_of_data into sdhci_data and get
sdhci-esdhc-imx work with both platform bus and OF.
The first patch is not related to imx esdhc OF support, but we need it
to fix the following show-stopper issue.
https://bugs.launchpad.net/bugs/723159
Hi Nicolas,
The fix has already been merged by Sascha, so you may want to apply it
on Linaro tree to get rid of the problem.
Regards,
Shawn
Richard Zhu (1):
mx51 enchance the sd/mmc HW timing compatibility on mx51 boards.
Shawn Guo (6):
arm/dt: add pad configurations for mx51 babbage
mmc: make the reference to sdhci_tegra_dt_pdata conditional
mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one
mmc: support sdhci-esdhc-imx as an OF device
arm/dts: babbage: add device nodes for esdhc
dt: update fsl-esdhc bindings for imx esdhc OF support
.../devicetree/bindings/mmc/fsl-esdhc.txt | 5 +-
arch/arm/boot/dts/babbage.dts | 14 +++
arch/arm/mach-mx5/board-dt.c | 94 ++++++++++++++++++++
arch/arm/plat-mxc/include/mach/iomux-mx51.h | 40 ++++----
drivers/mmc/host/Kconfig | 7 +-
drivers/mmc/host/Makefile | 3 +-
drivers/mmc/host/sdhci-cns3xxx.c | 3 +-
drivers/mmc/host/sdhci-dove.c | 2 +-
drivers/mmc/host/sdhci-esdhc-imx.c | 19 ++--
drivers/mmc/host/sdhci-of-core.c | 53 +++++++----
drivers/mmc/host/sdhci-of-esdhc.c | 28 +++---
drivers/mmc/host/sdhci-of-hlwd.c | 20 +++--
drivers/mmc/host/sdhci-of.h | 10 +--
drivers/mmc/host/sdhci-pltfm.c | 49 +++++-----
drivers/mmc/host/sdhci-pltfm.h | 18 ++--
drivers/mmc/host/sdhci-tegra.c | 10 +-
drivers/mmc/host/sdhci.h | 15 +++
include/linux/mmc/sdhci-pltfm.h | 35 -------
18 files changed, 267 insertions(+), 158 deletions(-)
^ permalink raw reply [flat|nested] 24+ messages in thread[parent not found: <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* [PATCH 1/7] mx51 enchance the sd/mmc HW timing compatibility on mx51 boards. [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2011-03-14 14:25 ` Shawn Guo 2011-03-14 14:25 ` [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage Shawn Guo ` (6 subsequent siblings) 7 siblings, 0 replies; 24+ messages in thread From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw) To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, Richard Zhu From: Richard Zhu <Hong-Xing.Zhu-KZfg59tc24xl57MIdRCFDg@public.gmane.org> Some cards have the CRC errors in read on mx51 BBG board. Configure the eSDHC pad configurations to level up the compatibility to fix this issue. Signed-off-by: Richard Zhu <Hong-Xing.Zhu-KZfg59tc24xl57MIdRCFDg@public.gmane.org> Tested-by: Shawn Guo <shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> --- arch/arm/plat-mxc/include/mach/iomux-mx51.h | 40 +++++++++++++------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h index b6767f9..3e41348 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h +++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h @@ -985,11 +985,11 @@ #define MX51_PAD_NANDF_WE_B__GPIO3_3 (_MX51_PAD_NANDF_WE_B__GPIO3_3 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_WE_B__NANDF_WE_B (_MX51_PAD_NANDF_WE_B__NANDF_WE_B | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_WE_B__PATA_DIOW (_MX51_PAD_NANDF_WE_B__PATA_DIOW | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_WE_B__SD3_DATA0 (_MX51_PAD_NANDF_WE_B__SD3_DATA0 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_WE_B__SD3_DATA0 (_MX51_PAD_NANDF_WE_B__SD3_DATA0 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_RE_B__GPIO3_4 (_MX51_PAD_NANDF_RE_B__GPIO3_4 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_RE_B__NANDF_RE_B (_MX51_PAD_NANDF_RE_B__NANDF_RE_B | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_RE_B__PATA_DIOR (_MX51_PAD_NANDF_RE_B__PATA_DIOR | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_RE_B__SD3_DATA1 (_MX51_PAD_NANDF_RE_B__SD3_DATA1 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_RE_B__SD3_DATA1 (_MX51_PAD_NANDF_RE_B__SD3_DATA1 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_ALE__GPIO3_5 (_MX51_PAD_NANDF_ALE__GPIO3_5 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_ALE__NANDF_ALE (_MX51_PAD_NANDF_ALE__NANDF_ALE | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_ALE__PATA_BUFFER_EN (_MX51_PAD_NANDF_ALE__PATA_BUFFER_EN | MUX_PAD_CTRL(NO_PAD_CTRL)) @@ -999,18 +999,18 @@ #define MX51_PAD_NANDF_WP_B__GPIO3_7 (_MX51_PAD_NANDF_WP_B__GPIO3_7 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_WP_B__NANDF_WP_B (_MX51_PAD_NANDF_WP_B__NANDF_WP_B | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_WP_B__PATA_DMACK (_MX51_PAD_NANDF_WP_B__PATA_DMACK | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_WP_B__SD3_DATA2 (_MX51_PAD_NANDF_WP_B__SD3_DATA2 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_WP_B__SD3_DATA2 (_MX51_PAD_NANDF_WP_B__SD3_DATA2 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_RB0__ECSPI2_SS1 (_MX51_PAD_NANDF_RB0__ECSPI2_SS1 | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_NANDF_RB0__GPIO3_8 (_MX51_PAD_NANDF_RB0__GPIO3_8 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_RB0__NANDF_RB0 (_MX51_PAD_NANDF_RB0__NANDF_RB0 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_RB0__PATA_DMARQ (_MX51_PAD_NANDF_RB0__PATA_DMARQ | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_RB0__SD3_DATA3 (_MX51_PAD_NANDF_RB0__SD3_DATA3 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_RB0__SD3_DATA3 (_MX51_PAD_NANDF_RB0__SD3_DATA3 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_RB1__CSPI_MOSI (_MX51_PAD_NANDF_RB1__CSPI_MOSI | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_NANDF_RB1__ECSPI2_RDY (_MX51_PAD_NANDF_RB1__ECSPI2_RDY | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_NANDF_RB1__GPIO3_9 (_MX51_PAD_NANDF_RB1__GPIO3_9 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_RB1__NANDF_RB1 (_MX51_PAD_NANDF_RB1__NANDF_RB1 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_RB1__PATA_IORDY (_MX51_PAD_NANDF_RB1__PATA_IORDY | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_RB1__SD4_CMD (_MX51_PAD_NANDF_RB1__SD4_CMD | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_RB1__SD4_CMD (_MX51_PAD_NANDF_RB1__SD4_CMD | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_RB2__DISP2_WAIT (_MX51_PAD_NANDF_RB2__DISP2_WAIT | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_RB2__ECSPI2_SCLK (_MX51_PAD_NANDF_RB2__ECSPI2_SCLK | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_NANDF_RB2__FEC_COL (_MX51_PAD_NANDF_RB2__FEC_COL | MUX_PAD_CTRL(MX51_PAD_CTRL_2)) @@ -1036,41 +1036,41 @@ #define MX51_PAD_NANDF_CS2__GPIO3_18 (_MX51_PAD_NANDF_CS2__GPIO3_18 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_CS2__NANDF_CS2 (_MX51_PAD_NANDF_CS2__NANDF_CS2 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS2__PATA_CS_0 (_MX51_PAD_NANDF_CS2__PATA_CS_0 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_CS2__SD4_CLK (_MX51_PAD_NANDF_CS2__SD4_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_CS2__SD4_CLK (_MX51_PAD_NANDF_CS2__SD4_CLK | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)) #define MX51_PAD_NANDF_CS2__USBH3_H1_DP (_MX51_PAD_NANDF_CS2__USBH3_H1_DP | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS3__FEC_MDC (_MX51_PAD_NANDF_CS3__FEC_MDC | MUX_PAD_CTRL(MX51_PAD_CTRL_5)) #define MX51_PAD_NANDF_CS3__GPIO3_19 (_MX51_PAD_NANDF_CS3__GPIO3_19 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_CS3__NANDF_CS3 (_MX51_PAD_NANDF_CS3__NANDF_CS3 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS3__PATA_CS_1 (_MX51_PAD_NANDF_CS3__PATA_CS_1 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_CS3__SD4_DAT0 (_MX51_PAD_NANDF_CS3__SD4_DAT0 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_CS3__SD4_DAT0 (_MX51_PAD_NANDF_CS3__SD4_DAT0 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_CS3__USBH3_H1_DM (_MX51_PAD_NANDF_CS3__USBH3_H1_DM | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS4__FEC_TDATA1 (_MX51_PAD_NANDF_CS4__FEC_TDATA1 | MUX_PAD_CTRL(MX51_PAD_CTRL_5)) #define MX51_PAD_NANDF_CS4__GPIO3_20 (_MX51_PAD_NANDF_CS4__GPIO3_20 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_CS4__NANDF_CS4 (_MX51_PAD_NANDF_CS4__NANDF_CS4 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS4__PATA_DA_0 (_MX51_PAD_NANDF_CS4__PATA_DA_0 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_CS4__SD4_DAT1 (_MX51_PAD_NANDF_CS4__SD4_DAT1 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_CS4__SD4_DAT1 (_MX51_PAD_NANDF_CS4__SD4_DAT1 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_CS4__USBH3_STP (_MX51_PAD_NANDF_CS4__USBH3_STP | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS5__FEC_TDATA2 (_MX51_PAD_NANDF_CS5__FEC_TDATA2 | MUX_PAD_CTRL(MX51_PAD_CTRL_5)) #define MX51_PAD_NANDF_CS5__GPIO3_21 (_MX51_PAD_NANDF_CS5__GPIO3_21 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_CS5__NANDF_CS5 (_MX51_PAD_NANDF_CS5__NANDF_CS5 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS5__PATA_DA_1 (_MX51_PAD_NANDF_CS5__PATA_DA_1 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_CS5__SD4_DAT2 (_MX51_PAD_NANDF_CS5__SD4_DAT2 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_CS5__SD4_DAT2 (_MX51_PAD_NANDF_CS5__SD4_DAT2 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_CS5__USBH3_DIR (_MX51_PAD_NANDF_CS5__USBH3_DIR | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS6__CSPI_SS3 (_MX51_PAD_NANDF_CS6__CSPI_SS3 | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_NANDF_CS6__FEC_TDATA3 (_MX51_PAD_NANDF_CS6__FEC_TDATA3 | MUX_PAD_CTRL(MX51_PAD_CTRL_5)) #define MX51_PAD_NANDF_CS6__GPIO3_22 (_MX51_PAD_NANDF_CS6__GPIO3_22 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_CS6__NANDF_CS6 (_MX51_PAD_NANDF_CS6__NANDF_CS6 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_NANDF_CS6__PATA_DA_2 (_MX51_PAD_NANDF_CS6__PATA_DA_2 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_CS6__SD4_DAT3 (_MX51_PAD_NANDF_CS6__SD4_DAT3 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_CS6__SD4_DAT3 (_MX51_PAD_NANDF_CS6__SD4_DAT3 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_CS7__FEC_TX_EN (_MX51_PAD_NANDF_CS7__FEC_TX_EN | MUX_PAD_CTRL(MX51_PAD_CTRL_5)) #define MX51_PAD_NANDF_CS7__GPIO3_23 (_MX51_PAD_NANDF_CS7__GPIO3_23 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_CS7__NANDF_CS7 (_MX51_PAD_NANDF_CS7__NANDF_CS7 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_CS7__SD3_CLK (_MX51_PAD_NANDF_CS7__SD3_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_CS7__SD3_CLK (_MX51_PAD_NANDF_CS7__SD3_CLK | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)) #define MX51_PAD_NANDF_RDY_INT__ECSPI2_SS0 (_MX51_PAD_NANDF_RDY_INT__ECSPI2_SS0 | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK (_MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK | MUX_PAD_CTRL(MX51_PAD_CTRL_4)) #define MX51_PAD_NANDF_RDY_INT__GPIO3_24 (_MX51_PAD_NANDF_RDY_INT__GPIO3_24 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_RDY_INT__NANDF_RDY_INT (_MX51_PAD_NANDF_RDY_INT__NANDF_RDY_INT | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_NANDF_RDY_INT__SD3_CMD (_MX51_PAD_NANDF_RDY_INT__SD3_CMD | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_NANDF_RDY_INT__SD3_CMD (_MX51_PAD_NANDF_RDY_INT__SD3_CMD | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_NANDF_D15__ECSPI2_MOSI (_MX51_PAD_NANDF_D15__ECSPI2_MOSI | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_NANDF_D15__GPIO3_25 (_MX51_PAD_NANDF_D15__GPIO3_25 | MUX_PAD_CTRL(MX51_GPIO_PAD_CTRL)) #define MX51_PAD_NANDF_D15__NANDF_D15 (_MX51_PAD_NANDF_D15__NANDF_D15 | MUX_PAD_CTRL(NO_PAD_CTRL)) @@ -1479,26 +1479,26 @@ #define MX51_PAD_SD1_CLK__SD1_CLK (_MX51_PAD_SD1_CLK__SD1_CLK | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)) #define MX51_PAD_SD1_DATA0__AUD5_TXD (_MX51_PAD_SD1_DATA0__AUD5_TXD | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_SD1_DATA0__CSPI_MISO (_MX51_PAD_SD1_DATA0__CSPI_MISO | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) -#define MX51_PAD_SD1_DATA0__SD1_DATA0 (_MX51_PAD_SD1_DATA0__SD1_DATA0 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD1_DATA0__SD1_DATA0 (_MX51_PAD_SD1_DATA0__SD1_DATA0 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_EIM_DA0__EIM_DA0 (_MX51_PAD_EIM_DA0__EIM_DA0 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA1__EIM_DA1 (_MX51_PAD_EIM_DA1__EIM_DA1 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA2__EIM_DA2 (_MX51_PAD_EIM_DA2__EIM_DA2 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA3__EIM_DA3 (_MX51_PAD_EIM_DA3__EIM_DA3 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_SD1_DATA1__AUD5_RXD (_MX51_PAD_SD1_DATA1__AUD5_RXD | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_SD1_DATA1__SD1_DATA1 (_MX51_PAD_SD1_DATA1__SD1_DATA1 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD1_DATA1__SD1_DATA1 (_MX51_PAD_SD1_DATA1__SD1_DATA1 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_EIM_DA4__EIM_DA4 (_MX51_PAD_EIM_DA4__EIM_DA4 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA5__EIM_DA5 (_MX51_PAD_EIM_DA5__EIM_DA5 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA6__EIM_DA6 (_MX51_PAD_EIM_DA6__EIM_DA6 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA7__EIM_DA7 (_MX51_PAD_EIM_DA7__EIM_DA7 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_SD1_DATA2__AUD5_TXC (_MX51_PAD_SD1_DATA2__AUD5_TXC | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_SD1_DATA2__SD1_DATA2 (_MX51_PAD_SD1_DATA2__SD1_DATA2 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD1_DATA2__SD1_DATA2 (_MX51_PAD_SD1_DATA2__SD1_DATA2 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_EIM_DA10__EIM_DA10 (_MX51_PAD_EIM_DA10__EIM_DA10 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA11__EIM_DA11 (_MX51_PAD_EIM_DA11__EIM_DA11 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA8__EIM_DA8 (_MX51_PAD_EIM_DA8__EIM_DA8 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_EIM_DA9__EIM_DA9 (_MX51_PAD_EIM_DA9__EIM_DA9 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_SD1_DATA3__AUD5_TXFS (_MX51_PAD_SD1_DATA3__AUD5_TXFS | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_SD1_DATA3__CSPI_SS1 (_MX51_PAD_SD1_DATA3__CSPI_SS1 | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) -#define MX51_PAD_SD1_DATA3__SD1_DATA3 (_MX51_PAD_SD1_DATA3__SD1_DATA3 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD1_DATA3__SD1_DATA3 (_MX51_PAD_SD1_DATA3__SD1_DATA3 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_GPIO1_0__CSPI_SS2 (_MX51_PAD_GPIO1_0__CSPI_SS2 | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_GPIO1_0__GPIO1_0 (_MX51_PAD_GPIO1_0__GPIO1_0 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_GPIO1_0__SD1_CD (_MX51_PAD_GPIO1_0__SD1_CD | MUX_PAD_CTRL(MX51_ESDHC_PAD_CTRL)) @@ -1517,16 +1517,16 @@ #define MX51_PAD_SD2_CLK__SD2_CLK (_MX51_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)) #define MX51_PAD_SD2_DATA0__CSPI_MISO (_MX51_PAD_SD2_DATA0__CSPI_MISO | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_SD2_DATA0__SD1_DAT4 (_MX51_PAD_SD2_DATA0__SD1_DAT4 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_SD2_DATA0__SD2_DATA0 (_MX51_PAD_SD2_DATA0__SD2_DATA0 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD2_DATA0__SD2_DATA0 (_MX51_PAD_SD2_DATA0__SD2_DATA0 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_SD2_DATA1__SD1_DAT5 (_MX51_PAD_SD2_DATA1__SD1_DAT5 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_SD2_DATA1__SD2_DATA1 (_MX51_PAD_SD2_DATA1__SD2_DATA1 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD2_DATA1__SD2_DATA1 (_MX51_PAD_SD2_DATA1__SD2_DATA1 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_SD2_DATA1__USBH3_H2_DP (_MX51_PAD_SD2_DATA1__USBH3_H2_DP | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_SD2_DATA2__SD1_DAT6 (_MX51_PAD_SD2_DATA2__SD1_DAT6 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_SD2_DATA2__SD2_DATA2 (_MX51_PAD_SD2_DATA2__SD2_DATA2 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD2_DATA2__SD2_DATA2 (_MX51_PAD_SD2_DATA2__SD2_DATA2 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_SD2_DATA2__USBH3_H2_DM (_MX51_PAD_SD2_DATA2__USBH3_H2_DM | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_SD2_DATA3__CSPI_SS2 (_MX51_PAD_SD2_DATA3__CSPI_SS2 | MUX_PAD_CTRL(MX51_ECSPI_PAD_CTRL)) #define MX51_PAD_SD2_DATA3__SD1_DAT7 (_MX51_PAD_SD2_DATA3__SD1_DAT7 | MUX_PAD_CTRL(NO_PAD_CTRL)) -#define MX51_PAD_SD2_DATA3__SD2_DATA3 (_MX51_PAD_SD2_DATA3__SD2_DATA3 | MUX_PAD_CTRL(NO_PAD_CTRL)) +#define MX51_PAD_SD2_DATA3__SD2_DATA3 (_MX51_PAD_SD2_DATA3__SD2_DATA3 | MUX_PAD_CTRL(MX51_SDHCI_PAD_CTRL)) #define MX51_PAD_GPIO1_2__CCM_OUT_2 (_MX51_PAD_GPIO1_2__CCM_OUT_2 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_GPIO1_2__GPIO1_2 (_MX51_PAD_GPIO1_2__GPIO1_2 | MUX_PAD_CTRL(NO_PAD_CTRL)) #define MX51_PAD_GPIO1_2__I2C2_SCL (_MX51_PAD_GPIO1_2__I2C2_SCL | MUX_PAD_CTRL(MX51_I2C_PAD_CTRL)) -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2011-03-14 14:25 ` [PATCH 1/7] mx51 enchance the sd/mmc HW timing compatibility on mx51 boards Shawn Guo @ 2011-03-14 14:25 ` Shawn Guo [not found] ` <1300112759-3495-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2011-03-14 14:25 ` [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional Shawn Guo ` (5 subsequent siblings) 7 siblings, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw) To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A The pad configuration is something common between dt and non-dt kernel, so it can be copied from non-dt code directly. Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- arch/arm/mach-mx5/board-dt.c | 94 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mx5/board-dt.c b/arch/arm/mach-mx5/board-dt.c index 45d1e37..4850251 100644 --- a/arch/arm/mach-mx5/board-dt.c +++ b/arch/arm/mach-mx5/board-dt.c @@ -31,6 +31,97 @@ #include "devices.h" +static iomux_v3_cfg_t mx51babbage_pads[] = { + /* UART1 */ + MX51_PAD_UART1_RXD__UART1_RXD, + MX51_PAD_UART1_TXD__UART1_TXD, + MX51_PAD_UART1_RTS__UART1_RTS, + MX51_PAD_UART1_CTS__UART1_CTS, + + /* UART2 */ + MX51_PAD_UART2_RXD__UART2_RXD, + MX51_PAD_UART2_TXD__UART2_TXD, + + /* UART3 */ + MX51_PAD_EIM_D25__UART3_RXD, + MX51_PAD_EIM_D26__UART3_TXD, + MX51_PAD_EIM_D27__UART3_RTS, + MX51_PAD_EIM_D24__UART3_CTS, + + /* I2C1 */ + MX51_PAD_EIM_D16__I2C1_SDA, + MX51_PAD_EIM_D19__I2C1_SCL, + + /* I2C2 */ + MX51_PAD_KEY_COL4__I2C2_SCL, + MX51_PAD_KEY_COL5__I2C2_SDA, + + /* HSI2C */ + MX51_PAD_I2C1_CLK__I2C1_CLK, + MX51_PAD_I2C1_DAT__I2C1_DAT, + + /* USB HOST1 */ + MX51_PAD_USBH1_CLK__USBH1_CLK, + MX51_PAD_USBH1_DIR__USBH1_DIR, + MX51_PAD_USBH1_NXT__USBH1_NXT, + MX51_PAD_USBH1_DATA0__USBH1_DATA0, + MX51_PAD_USBH1_DATA1__USBH1_DATA1, + MX51_PAD_USBH1_DATA2__USBH1_DATA2, + MX51_PAD_USBH1_DATA3__USBH1_DATA3, + MX51_PAD_USBH1_DATA4__USBH1_DATA4, + MX51_PAD_USBH1_DATA5__USBH1_DATA5, + MX51_PAD_USBH1_DATA6__USBH1_DATA6, + MX51_PAD_USBH1_DATA7__USBH1_DATA7, + + /* USB HUB reset line*/ + MX51_PAD_GPIO1_7__GPIO1_7, + + /* FEC */ + MX51_PAD_EIM_EB2__FEC_MDIO, + MX51_PAD_EIM_EB3__FEC_RDATA1, + MX51_PAD_EIM_CS2__FEC_RDATA2, + MX51_PAD_EIM_CS3__FEC_RDATA3, + MX51_PAD_EIM_CS4__FEC_RX_ER, + MX51_PAD_EIM_CS5__FEC_CRS, + MX51_PAD_NANDF_RB2__FEC_COL, + MX51_PAD_NANDF_RB3__FEC_RX_CLK, + MX51_PAD_NANDF_D9__FEC_RDATA0, + MX51_PAD_NANDF_D8__FEC_TDATA0, + MX51_PAD_NANDF_CS2__FEC_TX_ER, + MX51_PAD_NANDF_CS3__FEC_MDC, + MX51_PAD_NANDF_CS4__FEC_TDATA1, + MX51_PAD_NANDF_CS5__FEC_TDATA2, + MX51_PAD_NANDF_CS6__FEC_TDATA3, + MX51_PAD_NANDF_CS7__FEC_TX_EN, + MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK, + + /* FEC PHY reset line */ + MX51_PAD_EIM_A20__GPIO2_14, + + /* SD 1 */ + MX51_PAD_SD1_CMD__SD1_CMD, + MX51_PAD_SD1_CLK__SD1_CLK, + MX51_PAD_SD1_DATA0__SD1_DATA0, + MX51_PAD_SD1_DATA1__SD1_DATA1, + MX51_PAD_SD1_DATA2__SD1_DATA2, + MX51_PAD_SD1_DATA3__SD1_DATA3, + + /* SD 2 */ + MX51_PAD_SD2_CMD__SD2_CMD, + MX51_PAD_SD2_CLK__SD2_CLK, + MX51_PAD_SD2_DATA0__SD2_DATA0, + MX51_PAD_SD2_DATA1__SD2_DATA1, + MX51_PAD_SD2_DATA2__SD2_DATA2, + MX51_PAD_SD2_DATA3__SD2_DATA3, + + /* eCSPI1 */ + MX51_PAD_CSPI1_MISO__ECSPI1_MISO, + MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, + MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK, + MX51_PAD_CSPI1_SS0__GPIO4_24, + MX51_PAD_CSPI1_SS1__GPIO4_25, +}; + static struct of_device_id mx51_dt_match_table[] __initdata = { { .compatible = "simple-bus", }, {} @@ -39,6 +130,9 @@ static struct of_device_id mx51_dt_match_table[] __initdata = { static void __init mx51_dt_board_init(void) { of_platform_bus_probe(NULL, mx51_dt_match_table, NULL); + + mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, + ARRAY_SIZE(mx51babbage_pads)); } static void __init mx51_dt_timer_init(void) -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <1300112759-3495-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage [not found] ` <1300112759-3495-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2011-03-14 15:20 ` Rob Herring [not found] ` <4D7E3230.6040505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 24+ messages in thread From: Rob Herring @ 2011-03-14 15:20 UTC (permalink / raw) To: Shawn Guo Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Shawn, On 03/14/2011 09:25 AM, Shawn Guo wrote: > The pad configuration is something common between dt and non-dt > kernel, so it can be copied from non-dt code directly. > > Signed-off-by: Shawn Guo<shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > --- > arch/arm/mach-mx5/board-dt.c | 94 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 94 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/mach-mx5/board-dt.c b/arch/arm/mach-mx5/board-dt.c > index 45d1e37..4850251 100644 > --- a/arch/arm/mach-mx5/board-dt.c > +++ b/arch/arm/mach-mx5/board-dt.c > @@ -31,6 +31,97 @@ > > #include "devices.h" > > +static iomux_v3_cfg_t mx51babbage_pads[] = { > + /* UART1 */ > + MX51_PAD_UART1_RXD__UART1_RXD, > + MX51_PAD_UART1_TXD__UART1_TXD, > + MX51_PAD_UART1_RTS__UART1_RTS, > + MX51_PAD_UART1_CTS__UART1_CTS, > + > + /* UART2 */ > + MX51_PAD_UART2_RXD__UART2_RXD, > + MX51_PAD_UART2_TXD__UART2_TXD, > + > + /* UART3 */ > + MX51_PAD_EIM_D25__UART3_RXD, > + MX51_PAD_EIM_D26__UART3_TXD, > + MX51_PAD_EIM_D27__UART3_RTS, > + MX51_PAD_EIM_D24__UART3_CTS, > + > + /* I2C1 */ > + MX51_PAD_EIM_D16__I2C1_SDA, > + MX51_PAD_EIM_D19__I2C1_SCL, > + > + /* I2C2 */ > + MX51_PAD_KEY_COL4__I2C2_SCL, > + MX51_PAD_KEY_COL5__I2C2_SDA, > + > + /* HSI2C */ > + MX51_PAD_I2C1_CLK__I2C1_CLK, > + MX51_PAD_I2C1_DAT__I2C1_DAT, > + > + /* USB HOST1 */ > + MX51_PAD_USBH1_CLK__USBH1_CLK, > + MX51_PAD_USBH1_DIR__USBH1_DIR, > + MX51_PAD_USBH1_NXT__USBH1_NXT, > + MX51_PAD_USBH1_DATA0__USBH1_DATA0, > + MX51_PAD_USBH1_DATA1__USBH1_DATA1, > + MX51_PAD_USBH1_DATA2__USBH1_DATA2, > + MX51_PAD_USBH1_DATA3__USBH1_DATA3, > + MX51_PAD_USBH1_DATA4__USBH1_DATA4, > + MX51_PAD_USBH1_DATA5__USBH1_DATA5, > + MX51_PAD_USBH1_DATA6__USBH1_DATA6, > + MX51_PAD_USBH1_DATA7__USBH1_DATA7, > + > + /* USB HUB reset line*/ > + MX51_PAD_GPIO1_7__GPIO1_7, > + > + /* FEC */ > + MX51_PAD_EIM_EB2__FEC_MDIO, > + MX51_PAD_EIM_EB3__FEC_RDATA1, > + MX51_PAD_EIM_CS2__FEC_RDATA2, > + MX51_PAD_EIM_CS3__FEC_RDATA3, > + MX51_PAD_EIM_CS4__FEC_RX_ER, > + MX51_PAD_EIM_CS5__FEC_CRS, > + MX51_PAD_NANDF_RB2__FEC_COL, > + MX51_PAD_NANDF_RB3__FEC_RX_CLK, > + MX51_PAD_NANDF_D9__FEC_RDATA0, > + MX51_PAD_NANDF_D8__FEC_TDATA0, > + MX51_PAD_NANDF_CS2__FEC_TX_ER, > + MX51_PAD_NANDF_CS3__FEC_MDC, > + MX51_PAD_NANDF_CS4__FEC_TDATA1, > + MX51_PAD_NANDF_CS5__FEC_TDATA2, > + MX51_PAD_NANDF_CS6__FEC_TDATA3, > + MX51_PAD_NANDF_CS7__FEC_TX_EN, > + MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK, > + > + /* FEC PHY reset line */ > + MX51_PAD_EIM_A20__GPIO2_14, > + > + /* SD 1 */ > + MX51_PAD_SD1_CMD__SD1_CMD, > + MX51_PAD_SD1_CLK__SD1_CLK, > + MX51_PAD_SD1_DATA0__SD1_DATA0, > + MX51_PAD_SD1_DATA1__SD1_DATA1, > + MX51_PAD_SD1_DATA2__SD1_DATA2, > + MX51_PAD_SD1_DATA3__SD1_DATA3, > + > + /* SD 2 */ > + MX51_PAD_SD2_CMD__SD2_CMD, > + MX51_PAD_SD2_CLK__SD2_CLK, > + MX51_PAD_SD2_DATA0__SD2_DATA0, > + MX51_PAD_SD2_DATA1__SD2_DATA1, > + MX51_PAD_SD2_DATA2__SD2_DATA2, > + MX51_PAD_SD2_DATA3__SD2_DATA3, > + > + /* eCSPI1 */ > + MX51_PAD_CSPI1_MISO__ECSPI1_MISO, > + MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, > + MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK, > + MX51_PAD_CSPI1_SS0__GPIO4_24, > + MX51_PAD_CSPI1_SS1__GPIO4_25, > +}; This data already exists, so you should not duplicate it here. Iomux setup is a good candidate for a DT binding as it is just data, but I never came up with a good solution that was not bloated with a 32-bit value for every setting of each pin. Rob ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <4D7E3230.6040505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage [not found] ` <4D7E3230.6040505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2011-03-14 15:53 ` Shawn Guo [not found] ` <20110314155313.GC3674-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org> 2011-03-15 7:57 ` Grant Likely 1 sibling, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-14 15:53 UTC (permalink / raw) To: Rob Herring Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Mon, Mar 14, 2011 at 10:20:16AM -0500, Rob Herring wrote: > Shawn, > Hi Rob, > On 03/14/2011 09:25 AM, Shawn Guo wrote: > >The pad configuration is something common between dt and non-dt > >kernel, so it can be copied from non-dt code directly. > > > >Signed-off-by: Shawn Guo<shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > >--- > > arch/arm/mach-mx5/board-dt.c | 94 ++++++++++++++++++++++++++++++++++++++++++ > > 1 files changed, 94 insertions(+), 0 deletions(-) > > > >diff --git a/arch/arm/mach-mx5/board-dt.c b/arch/arm/mach-mx5/board-dt.c > >index 45d1e37..4850251 100644 > >--- a/arch/arm/mach-mx5/board-dt.c > >+++ b/arch/arm/mach-mx5/board-dt.c > >@@ -31,6 +31,97 @@ > > > > #include "devices.h" > > > >+static iomux_v3_cfg_t mx51babbage_pads[] = { > >+ /* UART1 */ > >+ MX51_PAD_UART1_RXD__UART1_RXD, > >+ MX51_PAD_UART1_TXD__UART1_TXD, > >+ MX51_PAD_UART1_RTS__UART1_RTS, > >+ MX51_PAD_UART1_CTS__UART1_CTS, [...] > >+}; > > This data already exists, so you should not duplicate it here. > So you are suggesting remove the 'static' where is first defined, and refer to it here directly? Correct me if I misunderstood you comment. > Iomux setup is a good candidate for a DT binding as it is just data, > but I never came up with a good solution that was not bloated with a > 32-bit value for every setting of each pin. > Honestly, this is something new for me, and I never thought about it, but will, if later we all think this is something we should do. -- Regards, Shawn ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <20110314155313.GC3674-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>]
* Re: [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage [not found] ` <20110314155313.GC3674-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org> @ 2011-03-15 0:57 ` Shawn Guo 0 siblings, 0 replies; 24+ messages in thread From: Shawn Guo @ 2011-03-15 0:57 UTC (permalink / raw) To: Rob Herring Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Mon, Mar 14, 2011 at 11:53:14PM +0800, Shawn Guo wrote: > On Mon, Mar 14, 2011 at 10:20:16AM -0500, Rob Herring wrote: > > Shawn, > > > Hi Rob, > > > On 03/14/2011 09:25 AM, Shawn Guo wrote: > > >The pad configuration is something common between dt and non-dt > > >kernel, so it can be copied from non-dt code directly. > > > > > >Signed-off-by: Shawn Guo<shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > >--- > > > arch/arm/mach-mx5/board-dt.c | 94 ++++++++++++++++++++++++++++++++++++++++++ > > > 1 files changed, 94 insertions(+), 0 deletions(-) > > > > > >diff --git a/arch/arm/mach-mx5/board-dt.c b/arch/arm/mach-mx5/board-dt.c > > >index 45d1e37..4850251 100644 > > >--- a/arch/arm/mach-mx5/board-dt.c > > >+++ b/arch/arm/mach-mx5/board-dt.c > > >@@ -31,6 +31,97 @@ > > > > > > #include "devices.h" > > > > > >+static iomux_v3_cfg_t mx51babbage_pads[] = { > > >+ /* UART1 */ > > >+ MX51_PAD_UART1_RXD__UART1_RXD, > > >+ MX51_PAD_UART1_TXD__UART1_TXD, > > >+ MX51_PAD_UART1_RTS__UART1_RTS, > > >+ MX51_PAD_UART1_CTS__UART1_CTS, > [...] > > >+}; > > > > This data already exists, so you should not duplicate it here. > > > So you are suggesting remove the 'static' where is first defined, and > refer to it here directly? Correct me if I misunderstood you comment. > In this case, we have to build dt machine together with non-dt one. So I would duplicate it here to keep dt support independent from non-dt one. -- Regards, Shawn ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage [not found] ` <4D7E3230.6040505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2011-03-14 15:53 ` Shawn Guo @ 2011-03-15 7:57 ` Grant Likely 1 sibling, 0 replies; 24+ messages in thread From: Grant Likely @ 2011-03-15 7:57 UTC (permalink / raw) To: Rob Herring Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Mon, Mar 14, 2011 at 10:20:16AM -0500, Rob Herring wrote: > Shawn, > > On 03/14/2011 09:25 AM, Shawn Guo wrote: > >The pad configuration is something common between dt and non-dt > >kernel, so it can be copied from non-dt code directly. > > > >Signed-off-by: Shawn Guo<shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > >--- > > arch/arm/mach-mx5/board-dt.c | 94 ++++++++++++++++++++++++++++++++++++++++++ > > 1 files changed, 94 insertions(+), 0 deletions(-) > > > >diff --git a/arch/arm/mach-mx5/board-dt.c b/arch/arm/mach-mx5/board-dt.c > >index 45d1e37..4850251 100644 > >--- a/arch/arm/mach-mx5/board-dt.c > >+++ b/arch/arm/mach-mx5/board-dt.c > >@@ -31,6 +31,97 @@ > > > > #include "devices.h" > > > >+static iomux_v3_cfg_t mx51babbage_pads[] = { > >+ /* UART1 */ > >+ MX51_PAD_UART1_RXD__UART1_RXD, > >+ MX51_PAD_UART1_TXD__UART1_TXD, > >+ MX51_PAD_UART1_RTS__UART1_RTS, > >+ MX51_PAD_UART1_CTS__UART1_CTS, > >+ > >+ /* UART2 */ > >+ MX51_PAD_UART2_RXD__UART2_RXD, > >+ MX51_PAD_UART2_TXD__UART2_TXD, > >+ > >+ /* UART3 */ > >+ MX51_PAD_EIM_D25__UART3_RXD, > >+ MX51_PAD_EIM_D26__UART3_TXD, > >+ MX51_PAD_EIM_D27__UART3_RTS, > >+ MX51_PAD_EIM_D24__UART3_CTS, > >+ > >+ /* I2C1 */ > >+ MX51_PAD_EIM_D16__I2C1_SDA, > >+ MX51_PAD_EIM_D19__I2C1_SCL, > >+ > >+ /* I2C2 */ > >+ MX51_PAD_KEY_COL4__I2C2_SCL, > >+ MX51_PAD_KEY_COL5__I2C2_SDA, > >+ > >+ /* HSI2C */ > >+ MX51_PAD_I2C1_CLK__I2C1_CLK, > >+ MX51_PAD_I2C1_DAT__I2C1_DAT, > >+ > >+ /* USB HOST1 */ > >+ MX51_PAD_USBH1_CLK__USBH1_CLK, > >+ MX51_PAD_USBH1_DIR__USBH1_DIR, > >+ MX51_PAD_USBH1_NXT__USBH1_NXT, > >+ MX51_PAD_USBH1_DATA0__USBH1_DATA0, > >+ MX51_PAD_USBH1_DATA1__USBH1_DATA1, > >+ MX51_PAD_USBH1_DATA2__USBH1_DATA2, > >+ MX51_PAD_USBH1_DATA3__USBH1_DATA3, > >+ MX51_PAD_USBH1_DATA4__USBH1_DATA4, > >+ MX51_PAD_USBH1_DATA5__USBH1_DATA5, > >+ MX51_PAD_USBH1_DATA6__USBH1_DATA6, > >+ MX51_PAD_USBH1_DATA7__USBH1_DATA7, > >+ > >+ /* USB HUB reset line*/ > >+ MX51_PAD_GPIO1_7__GPIO1_7, > >+ > >+ /* FEC */ > >+ MX51_PAD_EIM_EB2__FEC_MDIO, > >+ MX51_PAD_EIM_EB3__FEC_RDATA1, > >+ MX51_PAD_EIM_CS2__FEC_RDATA2, > >+ MX51_PAD_EIM_CS3__FEC_RDATA3, > >+ MX51_PAD_EIM_CS4__FEC_RX_ER, > >+ MX51_PAD_EIM_CS5__FEC_CRS, > >+ MX51_PAD_NANDF_RB2__FEC_COL, > >+ MX51_PAD_NANDF_RB3__FEC_RX_CLK, > >+ MX51_PAD_NANDF_D9__FEC_RDATA0, > >+ MX51_PAD_NANDF_D8__FEC_TDATA0, > >+ MX51_PAD_NANDF_CS2__FEC_TX_ER, > >+ MX51_PAD_NANDF_CS3__FEC_MDC, > >+ MX51_PAD_NANDF_CS4__FEC_TDATA1, > >+ MX51_PAD_NANDF_CS5__FEC_TDATA2, > >+ MX51_PAD_NANDF_CS6__FEC_TDATA3, > >+ MX51_PAD_NANDF_CS7__FEC_TX_EN, > >+ MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK, > >+ > >+ /* FEC PHY reset line */ > >+ MX51_PAD_EIM_A20__GPIO2_14, > >+ > >+ /* SD 1 */ > >+ MX51_PAD_SD1_CMD__SD1_CMD, > >+ MX51_PAD_SD1_CLK__SD1_CLK, > >+ MX51_PAD_SD1_DATA0__SD1_DATA0, > >+ MX51_PAD_SD1_DATA1__SD1_DATA1, > >+ MX51_PAD_SD1_DATA2__SD1_DATA2, > >+ MX51_PAD_SD1_DATA3__SD1_DATA3, > >+ > >+ /* SD 2 */ > >+ MX51_PAD_SD2_CMD__SD2_CMD, > >+ MX51_PAD_SD2_CLK__SD2_CLK, > >+ MX51_PAD_SD2_DATA0__SD2_DATA0, > >+ MX51_PAD_SD2_DATA1__SD2_DATA1, > >+ MX51_PAD_SD2_DATA2__SD2_DATA2, > >+ MX51_PAD_SD2_DATA3__SD2_DATA3, > >+ > >+ /* eCSPI1 */ > >+ MX51_PAD_CSPI1_MISO__ECSPI1_MISO, > >+ MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, > >+ MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK, > >+ MX51_PAD_CSPI1_SS0__GPIO4_24, > >+ MX51_PAD_CSPI1_SS1__GPIO4_25, > >+}; > > This data already exists, so you should not duplicate it here. > > Iomux setup is a good candidate for a DT binding as it is just data, > but I never came up with a good solution that was not bloated with a > 32-bit value for every setting of each pin. Yes, it makes perfect sense to encode the pin mux settings into the dt. It will require some engineering and creativity to develop a good binding. g. ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2011-03-14 14:25 ` [PATCH 1/7] mx51 enchance the sd/mmc HW timing compatibility on mx51 boards Shawn Guo 2011-03-14 14:25 ` [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage Shawn Guo @ 2011-03-14 14:25 ` Shawn Guo [not found] ` <1300112759-3495-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2011-03-14 14:25 ` [PATCH 4/7] mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one Shawn Guo ` (4 subsequent siblings) 7 siblings, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw) To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A Wrap tegra dt_id with CONFIG_MMC_SDHCI_TEGRA to make the reference to sdhci_tegra_dt_pdata conditional, otherwise it will stop build for other mmc driver when OF is enabled. Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- drivers/mmc/host/sdhci-pltfm.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index ccc04ac..4125fbf 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -52,7 +52,9 @@ static struct sdhci_ops sdhci_pltfm_ops = { #if defined(CONFIG_OF) #include <linux/of_device.h> static const struct of_device_id sdhci_dt_ids[] = { +#ifdef CONFIG_MMC_SDHCI_TEGRA { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_pdata }, +#endif { } }; MODULE_DEVICE_TABLE(platform, sdhci_dt_ids); -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <1300112759-3495-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional [not found] ` <1300112759-3495-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2011-03-15 7:58 ` Grant Likely [not found] ` <20110315075859.GL23050-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org> 0 siblings, 1 reply; 24+ messages in thread From: Grant Likely @ 2011-03-15 7:58 UTC (permalink / raw) To: Shawn Guo Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Mon, Mar 14, 2011 at 10:25:55PM +0800, Shawn Guo wrote: > Wrap tegra dt_id with CONFIG_MMC_SDHCI_TEGRA to make the reference to > sdhci_tegra_dt_pdata conditional, otherwise it will stop build for > other mmc driver when OF is enabled. > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Looks right to me. g. > --- > drivers/mmc/host/sdhci-pltfm.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c > index ccc04ac..4125fbf 100644 > --- a/drivers/mmc/host/sdhci-pltfm.c > +++ b/drivers/mmc/host/sdhci-pltfm.c > @@ -52,7 +52,9 @@ static struct sdhci_ops sdhci_pltfm_ops = { > #if defined(CONFIG_OF) > #include <linux/of_device.h> > static const struct of_device_id sdhci_dt_ids[] = { > +#ifdef CONFIG_MMC_SDHCI_TEGRA > { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_pdata }, > +#endif > { } > }; > MODULE_DEVICE_TABLE(platform, sdhci_dt_ids); > -- > 1.7.1 > ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <20110315075859.GL23050-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>]
* Re: [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional [not found] ` <20110315075859.GL23050-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org> @ 2011-03-17 19:59 ` Grant Likely [not found] ` <AANLkTi=umf9nDpExLEBgJEMgUP-CJUUEbAQrQfdBw7Fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 24+ messages in thread From: Grant Likely @ 2011-03-17 19:59 UTC (permalink / raw) To: Shawn Guo Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Tue, Mar 15, 2011 at 1:58 AM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote: > On Mon, Mar 14, 2011 at 10:25:55PM +0800, Shawn Guo wrote: >> Wrap tegra dt_id with CONFIG_MMC_SDHCI_TEGRA to make the reference to >> sdhci_tegra_dt_pdata conditional, otherwise it will stop build for >> other mmc driver when OF is enabled. >> >> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > Looks right to me. Actually... > > g. > >> --- >> drivers/mmc/host/sdhci-pltfm.c | 2 ++ >> 1 files changed, 2 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c >> index ccc04ac..4125fbf 100644 >> --- a/drivers/mmc/host/sdhci-pltfm.c >> +++ b/drivers/mmc/host/sdhci-pltfm.c >> @@ -52,7 +52,9 @@ static struct sdhci_ops sdhci_pltfm_ops = { >> #if defined(CONFIG_OF) >> #include <linux/of_device.h> >> static const struct of_device_id sdhci_dt_ids[] = { >> +#ifdef CONFIG_MMC_SDHCI_TEGRA >> { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_pdata }, >> +#endif >> { } >> }; >> MODULE_DEVICE_TABLE(platform, sdhci_dt_ids); It would be better if the #ifdef went around the entire sdhci_dt_ids table including the MODULE_DEVICE_TABLE registration. g. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <AANLkTi=umf9nDpExLEBgJEMgUP-CJUUEbAQrQfdBw7Fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional [not found] ` <AANLkTi=umf9nDpExLEBgJEMgUP-CJUUEbAQrQfdBw7Fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-03-18 1:22 ` Shawn Guo [not found] ` <20110318012202.GA26951-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org> 0 siblings, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-18 1:22 UTC (permalink / raw) To: Grant Likely Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Thu, Mar 17, 2011 at 01:59:00PM -0600, Grant Likely wrote: > On Tue, Mar 15, 2011 at 1:58 AM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote: > > On Mon, Mar 14, 2011 at 10:25:55PM +0800, Shawn Guo wrote: > >> Wrap tegra dt_id with CONFIG_MMC_SDHCI_TEGRA to make the reference to > >> sdhci_tegra_dt_pdata conditional, otherwise it will stop build for > >> other mmc driver when OF is enabled. > >> > >> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > > > Looks right to me. > > Actually... > > > > > g. > > > >> --- > >> drivers/mmc/host/sdhci-pltfm.c | 2 ++ > >> 1 files changed, 2 insertions(+), 0 deletions(-) > >> > >> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c > >> index ccc04ac..4125fbf 100644 > >> --- a/drivers/mmc/host/sdhci-pltfm.c > >> +++ b/drivers/mmc/host/sdhci-pltfm.c > >> @@ -52,7 +52,9 @@ static struct sdhci_ops sdhci_pltfm_ops = { > >> #if defined(CONFIG_OF) > >> #include <linux/of_device.h> > >> static const struct of_device_id sdhci_dt_ids[] = { > >> +#ifdef CONFIG_MMC_SDHCI_TEGRA > >> { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_pdata }, > >> +#endif > >> { } > >> }; > >> MODULE_DEVICE_TABLE(platform, sdhci_dt_ids); > > It would be better if the #ifdef went around the entire sdhci_dt_ids > table including the MODULE_DEVICE_TABLE registration. > You really want to go this? In that case, all the references to sdhci_dt_ids will have to get around by the #ifdef. -- Regards, Shawn ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <20110318012202.GA26951-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>]
* Re: [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional [not found] ` <20110318012202.GA26951-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org> @ 2011-03-18 4:58 ` Grant Likely 0 siblings, 0 replies; 24+ messages in thread From: Grant Likely @ 2011-03-18 4:58 UTC (permalink / raw) To: Shawn Guo Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Fri, Mar 18, 2011 at 09:22:03AM +0800, Shawn Guo wrote: > On Thu, Mar 17, 2011 at 01:59:00PM -0600, Grant Likely wrote: > > On Tue, Mar 15, 2011 at 1:58 AM, Grant Likely <grant.likely@secretlab.ca> wrote: > > > On Mon, Mar 14, 2011 at 10:25:55PM +0800, Shawn Guo wrote: > > >> Wrap tegra dt_id with CONFIG_MMC_SDHCI_TEGRA to make the reference to > > >> sdhci_tegra_dt_pdata conditional, otherwise it will stop build for > > >> other mmc driver when OF is enabled. > > >> > > >> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > > > > > Looks right to me. > > > > Actually... > > > > > > > > g. > > > > > >> --- > > >> drivers/mmc/host/sdhci-pltfm.c | 2 ++ > > >> 1 files changed, 2 insertions(+), 0 deletions(-) > > >> > > >> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c > > >> index ccc04ac..4125fbf 100644 > > >> --- a/drivers/mmc/host/sdhci-pltfm.c > > >> +++ b/drivers/mmc/host/sdhci-pltfm.c > > >> @@ -52,7 +52,9 @@ static struct sdhci_ops sdhci_pltfm_ops = { > > >> #if defined(CONFIG_OF) > > >> #include <linux/of_device.h> > > >> static const struct of_device_id sdhci_dt_ids[] = { > > >> +#ifdef CONFIG_MMC_SDHCI_TEGRA > > >> { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_pdata }, > > >> +#endif > > >> { } > > >> }; > > >> MODULE_DEVICE_TABLE(platform, sdhci_dt_ids); > > > > It would be better if the #ifdef went around the entire sdhci_dt_ids > > table including the MODULE_DEVICE_TABLE registration. > > > You really want to go this? In that case, all the references to > sdhci_dt_ids will have to get around by the #ifdef. Sorry, my mistake. I wasn't reading the patch correctly when I looked at it again. Your change is indeed correct. g. ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 4/7] mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> ` (2 preceding siblings ...) 2011-03-14 14:25 ` [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional Shawn Guo @ 2011-03-14 14:25 ` Shawn Guo [not found] ` <1300112759-3495-5-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2011-03-14 14:25 ` [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device Shawn Guo ` (3 subsequent siblings) 7 siblings, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw) To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A This patch is motivated by the work of supporting sdhci-esdhc-imx as an OF device. The sdhci-esdhc-imx driver was well designed to be able to work with either platform or OF bus, with a little effort to decouple the driver from sdhci_pltfm_data. Like sdhci_ops works for both platform and OF sdhci driver, the patch demonstrates that sdhci_pltfm_data and sdhci_of_data can be consolidated into sdhci_data, which should work for both. As one of the results, header linux/mmc/sdhci-pltfm.h can be deleted. Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- drivers/mmc/host/sdhci-cns3xxx.c | 3 +- drivers/mmc/host/sdhci-dove.c | 2 +- drivers/mmc/host/sdhci-esdhc-imx.c | 19 ++++++------- drivers/mmc/host/sdhci-of-core.c | 50 +++++++++++++++++++++++------------- drivers/mmc/host/sdhci-of-esdhc.c | 28 +++++++++++--------- drivers/mmc/host/sdhci-of-hlwd.c | 20 ++++++++------ drivers/mmc/host/sdhci-of.h | 9 +----- drivers/mmc/host/sdhci-pltfm.c | 47 ++++++++++++++++----------------- drivers/mmc/host/sdhci-pltfm.h | 18 ++++++------ drivers/mmc/host/sdhci-tegra.c | 10 +++--- drivers/mmc/host/sdhci.h | 15 +++++++++++ include/linux/mmc/sdhci-pltfm.h | 35 ------------------------- 12 files changed, 123 insertions(+), 133 deletions(-) delete mode 100644 include/linux/mmc/sdhci-pltfm.h diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c index 9ebd1d7..6d494d5 100644 --- a/drivers/mmc/host/sdhci-cns3xxx.c +++ b/drivers/mmc/host/sdhci-cns3xxx.c @@ -15,7 +15,6 @@ #include <linux/delay.h> #include <linux/device.h> #include <linux/mmc/host.h> -#include <linux/mmc/sdhci-pltfm.h> #include <mach/cns3xxx.h> #include "sdhci.h" #include "sdhci-pltfm.h" @@ -86,7 +85,7 @@ static struct sdhci_ops sdhci_cns3xxx_ops = { .set_clock = sdhci_cns3xxx_set_clock, }; -struct sdhci_pltfm_data sdhci_cns3xxx_pdata = { +struct sdhci_data sdhci_cns3xxx_data = { .ops = &sdhci_cns3xxx_ops, .quirks = SDHCI_QUIRK_BROKEN_DMA | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c index 2aeef4f..7d14402 100644 --- a/drivers/mmc/host/sdhci-dove.c +++ b/drivers/mmc/host/sdhci-dove.c @@ -61,7 +61,7 @@ static struct sdhci_ops sdhci_dove_ops = { .read_l = sdhci_dove_readl, }; -struct sdhci_pltfm_data sdhci_dove_pdata = { +struct sdhci_data sdhci_dove_data = { .ops = &sdhci_dove_ops, .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER | SDHCI_QUIRK_NO_BUSY_IRQ | diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 9b82910..dfd1ccb 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -16,7 +16,6 @@ #include <linux/err.h> #include <linux/clk.h> #include <linux/mmc/host.h> -#include <linux/mmc/sdhci-pltfm.h> #include <mach/hardware.h> #include "sdhci.h" #include "sdhci-pltfm.h" @@ -86,21 +85,21 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg) esdhc_clrset_le(host, 0xff, val, reg); } -static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) +static unsigned int esdhc_get_max_clock(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); return clk_get_rate(pltfm_host->clk); } -static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) +static unsigned int esdhc_get_min_clock(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); return clk_get_rate(pltfm_host->clk) / 256 / 16; } -static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pdata) +static int esdhc_init(struct sdhci_host *host, struct sdhci_data *pdata) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct clk *clk; @@ -123,7 +122,7 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd return 0; } -static void esdhc_pltfm_exit(struct sdhci_host *host) +static void esdhc_exit(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); @@ -136,14 +135,14 @@ static struct sdhci_ops sdhci_esdhc_ops = { .write_w = esdhc_writew_le, .write_b = esdhc_writeb_le, .set_clock = esdhc_set_clock, - .get_max_clock = esdhc_pltfm_get_max_clock, - .get_min_clock = esdhc_pltfm_get_min_clock, + .get_max_clock = esdhc_get_max_clock, + .get_min_clock = esdhc_get_min_clock, }; -struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = { +struct sdhci_data sdhci_esdhc_imx_data = { .quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_ADMA, /* ADMA has issues. Might be fixable */ .ops = &sdhci_esdhc_ops, - .init = esdhc_pltfm_init, - .exit = esdhc_pltfm_exit, + .init = esdhc_init, + .exit = esdhc_exit, }; diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c index dd84124..0b32ad7 100644 --- a/drivers/mmc/host/sdhci-of-core.c +++ b/drivers/mmc/host/sdhci-of-core.c @@ -23,6 +23,7 @@ #include <linux/of_platform.h> #include <linux/of_address.h> #include <linux/of_irq.h> +#include <linux/of_device.h> #include <linux/mmc/host.h> #ifdef CONFIG_PPC #include <asm/machdep.h> @@ -30,6 +31,20 @@ #include "sdhci-of.h" #include "sdhci.h" +static const struct of_device_id sdhci_of_match[] = { +#ifdef CONFIG_MMC_SDHCI_OF_ESDHC + { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc_data, }, + { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc_data, }, + { .compatible = "fsl,esdhc", .data = &sdhci_esdhc_data, }, +#endif +#ifdef CONFIG_MMC_SDHCI_OF_HLWD + { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_hlwd, }, +#endif + { .compatible = "generic-sdhci", }, + {}, +}; +MODULE_DEVICE_TABLE(of, sdhci_of_match); + #ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER /* @@ -128,7 +143,7 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, const struct of_device_id *match) { struct device_node *np = ofdev->dev.of_node; - struct sdhci_of_data *sdhci_of_data = match->data; + struct sdhci_data *data = match->data; struct sdhci_host *host; struct sdhci_of_host *of_host; const __be32 *clk; @@ -158,9 +173,14 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, } host->hw_name = dev_name(&ofdev->dev); - if (sdhci_of_data) { - host->quirks = sdhci_of_data->quirks; - host->ops = &sdhci_of_data->ops; + if (data) { + host->quirks = data->quirks; + host->ops = data->ops; + if (data->init) { + ret = data->init(host, data); + if (ret) + goto err_of_init; + } } if (of_get_property(np, "sdhci,auto-cmd12", NULL)) @@ -184,6 +204,9 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, return 0; err_add_host: + if (data && data->exit) + data->exit(host); +err_of_init: irq_dispose_mapping(host->irq); err_no_irq: iounmap(host->ioaddr); @@ -195,7 +218,12 @@ err_addr_map: static int __devexit sdhci_of_remove(struct platform_device *ofdev) { struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); + const struct of_device_id *match = + of_match_device(sdhci_of_match, &ofdev->dev); + struct sdhci_data *data = match->data; + if (data && data->exit) + data->exit(host); sdhci_remove_host(host, 0); sdhci_free_host(host); irq_dispose_mapping(host->irq); @@ -203,20 +231,6 @@ static int __devexit sdhci_of_remove(struct platform_device *ofdev) return 0; } -static const struct of_device_id sdhci_of_match[] = { -#ifdef CONFIG_MMC_SDHCI_OF_ESDHC - { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc, }, - { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc, }, - { .compatible = "fsl,esdhc", .data = &sdhci_esdhc, }, -#endif -#ifdef CONFIG_MMC_SDHCI_OF_HLWD - { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_hlwd, }, -#endif - { .compatible = "generic-sdhci", }, - {}, -}; -MODULE_DEVICE_TABLE(of, sdhci_of_match); - static struct of_platform_driver sdhci_of_driver = { .driver = { .name = "sdhci-of", diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index fcd0e1f..8a68e7a 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -72,18 +72,20 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) return of_host->clock / 256 / 16; } -struct sdhci_of_data sdhci_esdhc = { +static struct sdhci_ops sdhci_esdhc_ops = { + .read_l = sdhci_be32bs_readl, + .read_w = esdhc_readw, + .read_b = sdhci_be32bs_readb, + .write_l = sdhci_be32bs_writel, + .write_w = esdhc_writew, + .write_b = esdhc_writeb, + .set_clock = esdhc_set_clock, + .enable_dma = esdhc_of_enable_dma, + .get_max_clock = esdhc_of_get_max_clock, + .get_min_clock = esdhc_of_get_min_clock, +}; + +struct sdhci_of_data sdhci_esdhc_data = { .quirks = ESDHC_DEFAULT_QUIRKS, - .ops = { - .read_l = sdhci_be32bs_readl, - .read_w = esdhc_readw, - .read_b = sdhci_be32bs_readb, - .write_l = sdhci_be32bs_writel, - .write_w = esdhc_writew, - .write_b = esdhc_writeb, - .set_clock = esdhc_set_clock, - .enable_dma = esdhc_of_enable_dma, - .get_max_clock = esdhc_of_get_max_clock, - .get_min_clock = esdhc_of_get_min_clock, - }, + .ops = &sdhci_esdhc_ops, }; diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c index 68ddb75..188a317 100644 --- a/drivers/mmc/host/sdhci-of-hlwd.c +++ b/drivers/mmc/host/sdhci-of-hlwd.c @@ -51,15 +51,17 @@ static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg) udelay(SDHCI_HLWD_WRITE_DELAY); } -struct sdhci_of_data sdhci_hlwd = { +static struct sdhci_ops sdhci_hlwd_ops = { + .read_l = sdhci_be32bs_readl, + .read_w = sdhci_be32bs_readw, + .read_b = sdhci_be32bs_readb, + .write_l = sdhci_hlwd_writel, + .write_w = sdhci_hlwd_writew, + .write_b = sdhci_hlwd_writeb, +}; + +struct sdhci_of_data sdhci_hlwd_data = { .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_32BIT_DMA_SIZE, - .ops = { - .read_l = sdhci_be32bs_readl, - .read_w = sdhci_be32bs_readw, - .read_b = sdhci_be32bs_readb, - .write_l = sdhci_hlwd_writel, - .write_w = sdhci_hlwd_writew, - .write_b = sdhci_hlwd_writeb, - }, + .ops = &sdhci_hlwd_ops, }; diff --git a/drivers/mmc/host/sdhci-of.h b/drivers/mmc/host/sdhci-of.h index ad09ad9..e88fe2e 100644 --- a/drivers/mmc/host/sdhci-of.h +++ b/drivers/mmc/host/sdhci-of.h @@ -19,11 +19,6 @@ #include <linux/types.h> #include "sdhci.h" -struct sdhci_of_data { - unsigned int quirks; - struct sdhci_ops ops; -}; - struct sdhci_of_host { unsigned int clock; u16 xfer_mode_shadow; @@ -36,7 +31,7 @@ extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg); extern void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg); extern void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg); -extern struct sdhci_of_data sdhci_esdhc; -extern struct sdhci_of_data sdhci_hlwd; +extern struct sdhci_data sdhci_esdhc_data; +extern struct sdhci_data sdhci_hlwd_data; #endif /* __SDHCI_OF_H */ diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index 4125fbf..6b4f94c 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -30,7 +30,6 @@ #include <linux/mmc/host.h> #include <linux/io.h> -#include <linux/mmc/sdhci-pltfm.h> #include "sdhci.h" #include "sdhci-pltfm.h" @@ -53,7 +52,7 @@ static struct sdhci_ops sdhci_pltfm_ops = { #include <linux/of_device.h> static const struct of_device_id sdhci_dt_ids[] = { #ifdef CONFIG_MMC_SDHCI_TEGRA - { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_pdata }, + { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_data }, #endif { } }; @@ -75,18 +74,18 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) { const struct platform_device_id *platid = platform_get_device_id(pdev); const struct of_device_id *dtid = sdhci_get_of_device_id(pdev); - struct sdhci_pltfm_data *pdata; + struct sdhci_data *data; struct sdhci_host *host; struct sdhci_pltfm_host *pltfm_host; struct resource *iomem; int ret; if (platid && platid->driver_data) - pdata = (void *)platid->driver_data; + data = (void *)platid->driver_data; else if (dtid && dtid->data) - pdata = dtid->data; + data = dtid->data; else - pdata = pdev->dev.platform_data; + data = pdev->dev.platform_data; iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!iomem) { @@ -112,12 +111,12 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) pltfm_host = sdhci_priv(host); host->hw_name = "platform"; - if (pdata && pdata->ops) - host->ops = pdata->ops; + if (data && data->ops) + host->ops = data->ops; else host->ops = &sdhci_pltfm_ops; - if (pdata) - host->quirks = pdata->quirks; + if (data) + host->quirks = data->quirks; host->irq = platform_get_irq(pdev, 0); if (!request_mem_region(iomem->start, resource_size(iomem), @@ -134,8 +133,8 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) goto err_remap; } - if (pdata && pdata->init) { - ret = pdata->init(host, pdata); + if (data && data->init) { + ret = data->init(host, data); if (ret) goto err_plat_init; } @@ -149,8 +148,8 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) return 0; err_add_host: - if (pdata && pdata->exit) - pdata->exit(host); + if (data && data->exit) + data->exit(host); err_plat_init: iounmap(host->ioaddr); err_remap: @@ -166,18 +165,18 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev) { const struct platform_device_id *platid = platform_get_device_id(pdev); const struct of_device_id *dtid = sdhci_get_of_device_id(pdev); - struct sdhci_pltfm_data *pdata; + struct sdhci_data *data; struct sdhci_host *host = platform_get_drvdata(pdev); struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); int dead; u32 scratch; if (platid && platid->driver_data) - pdata = (void *)platid->driver_data; + data = (void *)platid->driver_data; else if (dtid && dtid->data) - pdata = dtid->data; + data = dtid->data; else - pdata = pdev->dev.platform_data; + data = pdev->dev.platform_data; dead = 0; scratch = readl(host->ioaddr + SDHCI_INT_STATUS); @@ -185,8 +184,8 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev) dead = 1; sdhci_remove_host(host, dead); - if (pdata && pdata->exit) - pdata->exit(host); + if (data && data->exit) + data->exit(host); iounmap(host->ioaddr); release_mem_region(iomem->start, resource_size(iomem)); sdhci_free_host(host); @@ -198,16 +197,16 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev) static const struct platform_device_id sdhci_pltfm_ids[] = { { "sdhci", }, #ifdef CONFIG_MMC_SDHCI_CNS3XXX - { "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_pdata }, + { "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_data }, #endif #ifdef CONFIG_MMC_SDHCI_ESDHC_IMX - { "sdhci-esdhc-imx", (kernel_ulong_t)&sdhci_esdhc_imx_pdata }, + { "sdhci-esdhc-imx", (kernel_ulong_t)&sdhci_esdhc_imx_data }, #endif #ifdef CONFIG_MMC_SDHCI_DOVE - { "sdhci-dove", (kernel_ulong_t)&sdhci_dove_pdata }, + { "sdhci-dove", (kernel_ulong_t)&sdhci_dove_data }, #endif #ifdef CONFIG_MMC_SDHCI_TEGRA - { "sdhci-tegra", (kernel_ulong_t)&sdhci_tegra_pdata }, + { "sdhci-tegra", (kernel_ulong_t)&sdhci_tegra_data }, #endif { }, }; diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h index c67523d..a240bc9 100644 --- a/drivers/mmc/host/sdhci-pltfm.h +++ b/drivers/mmc/host/sdhci-pltfm.h @@ -8,22 +8,22 @@ * published by the Free Software Foundation. */ -#ifndef _DRIVERS_MMC_SDHCI_PLTFM_H -#define _DRIVERS_MMC_SDHCI_PLTFM_H +#ifndef _SDHCI_PLTFM_H +#define _SDHCI_PLTFM_H #include <linux/clk.h> #include <linux/types.h> -#include <linux/mmc/sdhci-pltfm.h> +#include "sdhci.h" struct sdhci_pltfm_host { struct clk *clk; u32 scratchpad; /* to handle quirks across io-accessor calls */ }; -extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata; -extern struct sdhci_pltfm_data sdhci_esdhc_imx_pdata; -extern struct sdhci_pltfm_data sdhci_dove_pdata; -extern struct sdhci_pltfm_data sdhci_tegra_pdata; -extern struct sdhci_pltfm_data sdhci_tegra_dt_pdata; +extern struct sdhci_data sdhci_cns3xxx_data; +extern struct sdhci_data sdhci_esdhc_imx_data; +extern struct sdhci_data sdhci_dove_data; +extern struct sdhci_data sdhci_tegra_data; +extern struct sdhci_data sdhci_tegra_dt_data; -#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */ +#endif /* _SDHCI_PLTFM_H */ diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index c3d6f83..ec1778d 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -120,7 +120,7 @@ static int tegra_sdhci_8bit(struct sdhci_host *host, int bus_width) static int tegra_sdhci_pltfm_init(struct sdhci_host *host, - struct sdhci_pltfm_data *pdata) + struct sdhci_data *data) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); @@ -214,7 +214,7 @@ out: } static int tegra_sdhci_pltfm_dt_init(struct sdhci_host *host, - struct sdhci_pltfm_data *pdata) + struct sdhci_data *data) { struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); struct tegra_sdhci_platform_data *plat; @@ -237,7 +237,7 @@ static int tegra_sdhci_pltfm_dt_init(struct sdhci_host *host, dev_info(&pdev->dev, "using gpios cd=%i, wp=%i power=%i\n", plat->cd_gpio, plat->wp_gpio, plat->power_gpio); - return tegra_sdhci_pltfm_init(host, pdata); + return tegra_sdhci_pltfm_init(host, data); } static void tegra_sdhci_pltfm_exit(struct sdhci_host *host) @@ -285,7 +285,7 @@ static struct sdhci_ops tegra_sdhci_ops = { .platform_8bit_width = tegra_sdhci_8bit, }; -struct sdhci_pltfm_data sdhci_tegra_pdata = { +struct sdhci_data sdhci_tegra_data = { .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_SINGLE_POWER_WRITE | SDHCI_QUIRK_NO_HISPD_BIT | @@ -295,7 +295,7 @@ struct sdhci_pltfm_data sdhci_tegra_pdata = { .exit = tegra_sdhci_pltfm_exit, }; -struct sdhci_pltfm_data sdhci_tegra_dt_pdata = { +struct sdhci_data sdhci_tegra_dt_data = { .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_SINGLE_POWER_WRITE | SDHCI_QUIRK_NO_HISPD_BIT | diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 6e0969e..6388953 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -201,6 +201,21 @@ #define SDHCI_MAX_DIV_SPEC_200 256 #define SDHCI_MAX_DIV_SPEC_300 2046 +/** + * struct sdhci_data - SDHCI platform/OF specific information & hooks + * @ops: optional pointer to the platform/OF provided SDHCI ops + * @quirks: optional SDHCI quirks + * @init: optional hook that is called during device probe, before the + * driver tries to access any SDHCI registers + * @exit: optional hook that is called during device removal + */ +struct sdhci_data { + struct sdhci_ops *ops; + unsigned int quirks; + int (*init)(struct sdhci_host *host, struct sdhci_data *data); + void (*exit)(struct sdhci_host *host); +}; + struct sdhci_ops { #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS u32 (*read_l)(struct sdhci_host *host, int reg); diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h deleted file mode 100644 index 548d59d..0000000 --- a/include/linux/mmc/sdhci-pltfm.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Platform data declarations for the sdhci-pltfm driver. - * - * Copyright (c) 2010 MontaVista Software, LLC. - * - * Author: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ - -#ifndef _SDHCI_PLTFM_H -#define _SDHCI_PLTFM_H - -struct sdhci_ops; -struct sdhci_host; - -/** - * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks - * @ops: optional pointer to the platform-provided SDHCI ops - * @quirks: optional SDHCI quirks - * @init: optional hook that is called during device probe, before the - * driver tries to access any SDHCI registers - * @exit: optional hook that is called during device removal - */ -struct sdhci_pltfm_data { - struct sdhci_ops *ops; - unsigned int quirks; - int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata); - void (*exit)(struct sdhci_host *host); -}; - -#endif /* _SDHCI_PLTFM_H */ -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <1300112759-3495-5-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 4/7] mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one [not found] ` <1300112759-3495-5-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2011-03-15 19:55 ` Grant Likely [not found] ` <20110315195513.GA20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org> 0 siblings, 1 reply; 24+ messages in thread From: Grant Likely @ 2011-03-15 19:55 UTC (permalink / raw) To: Shawn Guo Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Mon, Mar 14, 2011 at 10:25:56PM +0800, Shawn Guo wrote: > This patch is motivated by the work of supporting sdhci-esdhc-imx as > an OF device. The sdhci-esdhc-imx driver was well designed to be > able to work with either platform or OF bus, with a little effort to > decouple the driver from sdhci_pltfm_data. > > Like sdhci_ops works for both platform and OF sdhci driver, the patch > demonstrates that sdhci_pltfm_data and sdhci_of_data can be > consolidated into sdhci_data, which should work for both. As one of > the results, header linux/mmc/sdhci-pltfm.h can be deleted. > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> I like the push to unify DT and non-DT usage with the SDHCI drivers, but I'm not convinced on the approach. Actually, that's more a comment on the existing code than it is on the this patch. I don't like the way that sdhci-pltfm.c and sdhci-of-core.c each take responsibility for the .probe hook on each of the implementations. Doing it that way means that each implementation needs to add a set of hooks into those core files protected by #ifdefs based on whether or not the driver is enabled. It also means that loading one driver means that all the configured sdhci drivers get loaded into the kernel. This seems backwards. >From what I can see, sdhci-pltfm.c and sdhci-of-core.c both provide useful common functions that would be used by all sdhci host drivers. The interface would be a lot cleaner if those routines were exported for use by other modules, and each driver registered its own probe hook. It would keep all the driver specific stuff out of sdhci_pltfm_ids and I think it would result in a cleaner interface overall. Here is how I would do it: 1) break the bulk of the sdhci_pltfm.c and sdhci_of_core.c .probe and .remove hooks out into separate functions; callable by other modules 2) for each driver, add its own probe and remove hooks which calls into the new functions created in step 1. This would eliminate the need for the ->exit and ->init callbacks since they would get rolled into the new .probe and .remove callbacks 3) finally, when all drivers are removed; eliminate the driver registration from sdhci_pltfm.c and sdhci_of_core.c because there wouldn't be any users left. drivers/mmc/host/sdhci-pxa.c appears to be a good example of how I think sdhci platform_drivers should be structured. At the same time, the functionality from sdhci_of_core.c could easily be migrated into sdhci_pltfm.c. g. > --- > drivers/mmc/host/sdhci-cns3xxx.c | 3 +- > drivers/mmc/host/sdhci-dove.c | 2 +- > drivers/mmc/host/sdhci-esdhc-imx.c | 19 ++++++------- > drivers/mmc/host/sdhci-of-core.c | 50 +++++++++++++++++++++++------------- > drivers/mmc/host/sdhci-of-esdhc.c | 28 +++++++++++--------- > drivers/mmc/host/sdhci-of-hlwd.c | 20 ++++++++------ > drivers/mmc/host/sdhci-of.h | 9 +----- > drivers/mmc/host/sdhci-pltfm.c | 47 ++++++++++++++++----------------- > drivers/mmc/host/sdhci-pltfm.h | 18 ++++++------ > drivers/mmc/host/sdhci-tegra.c | 10 +++--- > drivers/mmc/host/sdhci.h | 15 +++++++++++ > include/linux/mmc/sdhci-pltfm.h | 35 ------------------------- > 12 files changed, 123 insertions(+), 133 deletions(-) > delete mode 100644 include/linux/mmc/sdhci-pltfm.h > > diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c > index 9ebd1d7..6d494d5 100644 > --- a/drivers/mmc/host/sdhci-cns3xxx.c > +++ b/drivers/mmc/host/sdhci-cns3xxx.c > @@ -15,7 +15,6 @@ > #include <linux/delay.h> > #include <linux/device.h> > #include <linux/mmc/host.h> > -#include <linux/mmc/sdhci-pltfm.h> > #include <mach/cns3xxx.h> > #include "sdhci.h" > #include "sdhci-pltfm.h" > @@ -86,7 +85,7 @@ static struct sdhci_ops sdhci_cns3xxx_ops = { > .set_clock = sdhci_cns3xxx_set_clock, > }; > > -struct sdhci_pltfm_data sdhci_cns3xxx_pdata = { > +struct sdhci_data sdhci_cns3xxx_data = { > .ops = &sdhci_cns3xxx_ops, > .quirks = SDHCI_QUIRK_BROKEN_DMA | > SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | > diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c > index 2aeef4f..7d14402 100644 > --- a/drivers/mmc/host/sdhci-dove.c > +++ b/drivers/mmc/host/sdhci-dove.c > @@ -61,7 +61,7 @@ static struct sdhci_ops sdhci_dove_ops = { > .read_l = sdhci_dove_readl, > }; > > -struct sdhci_pltfm_data sdhci_dove_pdata = { > +struct sdhci_data sdhci_dove_data = { > .ops = &sdhci_dove_ops, > .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER | > SDHCI_QUIRK_NO_BUSY_IRQ | > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c > index 9b82910..dfd1ccb 100644 > --- a/drivers/mmc/host/sdhci-esdhc-imx.c > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c > @@ -16,7 +16,6 @@ > #include <linux/err.h> > #include <linux/clk.h> > #include <linux/mmc/host.h> > -#include <linux/mmc/sdhci-pltfm.h> > #include <mach/hardware.h> > #include "sdhci.h" > #include "sdhci-pltfm.h" > @@ -86,21 +85,21 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg) > esdhc_clrset_le(host, 0xff, val, reg); > } > > -static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) > +static unsigned int esdhc_get_max_clock(struct sdhci_host *host) > { > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > return clk_get_rate(pltfm_host->clk); > } > > -static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) > +static unsigned int esdhc_get_min_clock(struct sdhci_host *host) > { > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > return clk_get_rate(pltfm_host->clk) / 256 / 16; > } > > -static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pdata) > +static int esdhc_init(struct sdhci_host *host, struct sdhci_data *pdata) > { > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > struct clk *clk; > @@ -123,7 +122,7 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd > return 0; > } > > -static void esdhc_pltfm_exit(struct sdhci_host *host) > +static void esdhc_exit(struct sdhci_host *host) > { > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > @@ -136,14 +135,14 @@ static struct sdhci_ops sdhci_esdhc_ops = { > .write_w = esdhc_writew_le, > .write_b = esdhc_writeb_le, > .set_clock = esdhc_set_clock, > - .get_max_clock = esdhc_pltfm_get_max_clock, > - .get_min_clock = esdhc_pltfm_get_min_clock, > + .get_max_clock = esdhc_get_max_clock, > + .get_min_clock = esdhc_get_min_clock, > }; > > -struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = { > +struct sdhci_data sdhci_esdhc_imx_data = { > .quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_ADMA, > /* ADMA has issues. Might be fixable */ > .ops = &sdhci_esdhc_ops, > - .init = esdhc_pltfm_init, > - .exit = esdhc_pltfm_exit, > + .init = esdhc_init, > + .exit = esdhc_exit, > }; > diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c > index dd84124..0b32ad7 100644 > --- a/drivers/mmc/host/sdhci-of-core.c > +++ b/drivers/mmc/host/sdhci-of-core.c > @@ -23,6 +23,7 @@ > #include <linux/of_platform.h> > #include <linux/of_address.h> > #include <linux/of_irq.h> > +#include <linux/of_device.h> > #include <linux/mmc/host.h> > #ifdef CONFIG_PPC > #include <asm/machdep.h> > @@ -30,6 +31,20 @@ > #include "sdhci-of.h" > #include "sdhci.h" > > +static const struct of_device_id sdhci_of_match[] = { > +#ifdef CONFIG_MMC_SDHCI_OF_ESDHC > + { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc_data, }, > + { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc_data, }, > + { .compatible = "fsl,esdhc", .data = &sdhci_esdhc_data, }, > +#endif > +#ifdef CONFIG_MMC_SDHCI_OF_HLWD > + { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_hlwd, }, > +#endif > + { .compatible = "generic-sdhci", }, > + {}, > +}; > +MODULE_DEVICE_TABLE(of, sdhci_of_match); > + > #ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER > > /* > @@ -128,7 +143,7 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, > const struct of_device_id *match) > { > struct device_node *np = ofdev->dev.of_node; > - struct sdhci_of_data *sdhci_of_data = match->data; > + struct sdhci_data *data = match->data; > struct sdhci_host *host; > struct sdhci_of_host *of_host; > const __be32 *clk; > @@ -158,9 +173,14 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, > } > > host->hw_name = dev_name(&ofdev->dev); > - if (sdhci_of_data) { > - host->quirks = sdhci_of_data->quirks; > - host->ops = &sdhci_of_data->ops; > + if (data) { > + host->quirks = data->quirks; > + host->ops = data->ops; > + if (data->init) { > + ret = data->init(host, data); > + if (ret) > + goto err_of_init; > + } > } > > if (of_get_property(np, "sdhci,auto-cmd12", NULL)) > @@ -184,6 +204,9 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev, > return 0; > > err_add_host: > + if (data && data->exit) > + data->exit(host); > +err_of_init: > irq_dispose_mapping(host->irq); > err_no_irq: > iounmap(host->ioaddr); > @@ -195,7 +218,12 @@ err_addr_map: > static int __devexit sdhci_of_remove(struct platform_device *ofdev) > { > struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); > + const struct of_device_id *match = > + of_match_device(sdhci_of_match, &ofdev->dev); > + struct sdhci_data *data = match->data; > > + if (data && data->exit) > + data->exit(host); > sdhci_remove_host(host, 0); > sdhci_free_host(host); > irq_dispose_mapping(host->irq); > @@ -203,20 +231,6 @@ static int __devexit sdhci_of_remove(struct platform_device *ofdev) > return 0; > } > > -static const struct of_device_id sdhci_of_match[] = { > -#ifdef CONFIG_MMC_SDHCI_OF_ESDHC > - { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc, }, > - { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc, }, > - { .compatible = "fsl,esdhc", .data = &sdhci_esdhc, }, > -#endif > -#ifdef CONFIG_MMC_SDHCI_OF_HLWD > - { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_hlwd, }, > -#endif > - { .compatible = "generic-sdhci", }, > - {}, > -}; > -MODULE_DEVICE_TABLE(of, sdhci_of_match); > - > static struct of_platform_driver sdhci_of_driver = { > .driver = { > .name = "sdhci-of", > diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c > index fcd0e1f..8a68e7a 100644 > --- a/drivers/mmc/host/sdhci-of-esdhc.c > +++ b/drivers/mmc/host/sdhci-of-esdhc.c > @@ -72,18 +72,20 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) > return of_host->clock / 256 / 16; > } > > -struct sdhci_of_data sdhci_esdhc = { > +static struct sdhci_ops sdhci_esdhc_ops = { > + .read_l = sdhci_be32bs_readl, > + .read_w = esdhc_readw, > + .read_b = sdhci_be32bs_readb, > + .write_l = sdhci_be32bs_writel, > + .write_w = esdhc_writew, > + .write_b = esdhc_writeb, > + .set_clock = esdhc_set_clock, > + .enable_dma = esdhc_of_enable_dma, > + .get_max_clock = esdhc_of_get_max_clock, > + .get_min_clock = esdhc_of_get_min_clock, > +}; > + > +struct sdhci_of_data sdhci_esdhc_data = { > .quirks = ESDHC_DEFAULT_QUIRKS, > - .ops = { > - .read_l = sdhci_be32bs_readl, > - .read_w = esdhc_readw, > - .read_b = sdhci_be32bs_readb, > - .write_l = sdhci_be32bs_writel, > - .write_w = esdhc_writew, > - .write_b = esdhc_writeb, > - .set_clock = esdhc_set_clock, > - .enable_dma = esdhc_of_enable_dma, > - .get_max_clock = esdhc_of_get_max_clock, > - .get_min_clock = esdhc_of_get_min_clock, > - }, > + .ops = &sdhci_esdhc_ops, > }; > diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c > index 68ddb75..188a317 100644 > --- a/drivers/mmc/host/sdhci-of-hlwd.c > +++ b/drivers/mmc/host/sdhci-of-hlwd.c > @@ -51,15 +51,17 @@ static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg) > udelay(SDHCI_HLWD_WRITE_DELAY); > } > > -struct sdhci_of_data sdhci_hlwd = { > +static struct sdhci_ops sdhci_hlwd_ops = { > + .read_l = sdhci_be32bs_readl, > + .read_w = sdhci_be32bs_readw, > + .read_b = sdhci_be32bs_readb, > + .write_l = sdhci_hlwd_writel, > + .write_w = sdhci_hlwd_writew, > + .write_b = sdhci_hlwd_writeb, > +}; > + > +struct sdhci_of_data sdhci_hlwd_data = { > .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | > SDHCI_QUIRK_32BIT_DMA_SIZE, > - .ops = { > - .read_l = sdhci_be32bs_readl, > - .read_w = sdhci_be32bs_readw, > - .read_b = sdhci_be32bs_readb, > - .write_l = sdhci_hlwd_writel, > - .write_w = sdhci_hlwd_writew, > - .write_b = sdhci_hlwd_writeb, > - }, > + .ops = &sdhci_hlwd_ops, > }; > diff --git a/drivers/mmc/host/sdhci-of.h b/drivers/mmc/host/sdhci-of.h > index ad09ad9..e88fe2e 100644 > --- a/drivers/mmc/host/sdhci-of.h > +++ b/drivers/mmc/host/sdhci-of.h > @@ -19,11 +19,6 @@ > #include <linux/types.h> > #include "sdhci.h" > > -struct sdhci_of_data { > - unsigned int quirks; > - struct sdhci_ops ops; > -}; > - > struct sdhci_of_host { > unsigned int clock; > u16 xfer_mode_shadow; > @@ -36,7 +31,7 @@ extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg); > extern void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg); > extern void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg); > > -extern struct sdhci_of_data sdhci_esdhc; > -extern struct sdhci_of_data sdhci_hlwd; > +extern struct sdhci_data sdhci_esdhc_data; > +extern struct sdhci_data sdhci_hlwd_data; > > #endif /* __SDHCI_OF_H */ > diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c > index 4125fbf..6b4f94c 100644 > --- a/drivers/mmc/host/sdhci-pltfm.c > +++ b/drivers/mmc/host/sdhci-pltfm.c > @@ -30,7 +30,6 @@ > #include <linux/mmc/host.h> > > #include <linux/io.h> > -#include <linux/mmc/sdhci-pltfm.h> > > #include "sdhci.h" > #include "sdhci-pltfm.h" > @@ -53,7 +52,7 @@ static struct sdhci_ops sdhci_pltfm_ops = { > #include <linux/of_device.h> > static const struct of_device_id sdhci_dt_ids[] = { > #ifdef CONFIG_MMC_SDHCI_TEGRA > - { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_pdata }, > + { .compatible = "nvidia,tegra250-sdhci", .data = &sdhci_tegra_dt_data }, > #endif > { } > }; > @@ -75,18 +74,18 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) > { > const struct platform_device_id *platid = platform_get_device_id(pdev); > const struct of_device_id *dtid = sdhci_get_of_device_id(pdev); > - struct sdhci_pltfm_data *pdata; > + struct sdhci_data *data; > struct sdhci_host *host; > struct sdhci_pltfm_host *pltfm_host; > struct resource *iomem; > int ret; > > if (platid && platid->driver_data) > - pdata = (void *)platid->driver_data; > + data = (void *)platid->driver_data; > else if (dtid && dtid->data) > - pdata = dtid->data; > + data = dtid->data; > else > - pdata = pdev->dev.platform_data; > + data = pdev->dev.platform_data; > > iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (!iomem) { > @@ -112,12 +111,12 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) > pltfm_host = sdhci_priv(host); > > host->hw_name = "platform"; > - if (pdata && pdata->ops) > - host->ops = pdata->ops; > + if (data && data->ops) > + host->ops = data->ops; > else > host->ops = &sdhci_pltfm_ops; > - if (pdata) > - host->quirks = pdata->quirks; > + if (data) > + host->quirks = data->quirks; > host->irq = platform_get_irq(pdev, 0); > > if (!request_mem_region(iomem->start, resource_size(iomem), > @@ -134,8 +133,8 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) > goto err_remap; > } > > - if (pdata && pdata->init) { > - ret = pdata->init(host, pdata); > + if (data && data->init) { > + ret = data->init(host, data); > if (ret) > goto err_plat_init; > } > @@ -149,8 +148,8 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) > return 0; > > err_add_host: > - if (pdata && pdata->exit) > - pdata->exit(host); > + if (data && data->exit) > + data->exit(host); > err_plat_init: > iounmap(host->ioaddr); > err_remap: > @@ -166,18 +165,18 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev) > { > const struct platform_device_id *platid = platform_get_device_id(pdev); > const struct of_device_id *dtid = sdhci_get_of_device_id(pdev); > - struct sdhci_pltfm_data *pdata; > + struct sdhci_data *data; > struct sdhci_host *host = platform_get_drvdata(pdev); > struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > int dead; > u32 scratch; > > if (platid && platid->driver_data) > - pdata = (void *)platid->driver_data; > + data = (void *)platid->driver_data; > else if (dtid && dtid->data) > - pdata = dtid->data; > + data = dtid->data; > else > - pdata = pdev->dev.platform_data; > + data = pdev->dev.platform_data; > > dead = 0; > scratch = readl(host->ioaddr + SDHCI_INT_STATUS); > @@ -185,8 +184,8 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev) > dead = 1; > > sdhci_remove_host(host, dead); > - if (pdata && pdata->exit) > - pdata->exit(host); > + if (data && data->exit) > + data->exit(host); > iounmap(host->ioaddr); > release_mem_region(iomem->start, resource_size(iomem)); > sdhci_free_host(host); > @@ -198,16 +197,16 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev) > static const struct platform_device_id sdhci_pltfm_ids[] = { > { "sdhci", }, > #ifdef CONFIG_MMC_SDHCI_CNS3XXX > - { "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_pdata }, > + { "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_data }, > #endif > #ifdef CONFIG_MMC_SDHCI_ESDHC_IMX > - { "sdhci-esdhc-imx", (kernel_ulong_t)&sdhci_esdhc_imx_pdata }, > + { "sdhci-esdhc-imx", (kernel_ulong_t)&sdhci_esdhc_imx_data }, > #endif > #ifdef CONFIG_MMC_SDHCI_DOVE > - { "sdhci-dove", (kernel_ulong_t)&sdhci_dove_pdata }, > + { "sdhci-dove", (kernel_ulong_t)&sdhci_dove_data }, > #endif > #ifdef CONFIG_MMC_SDHCI_TEGRA > - { "sdhci-tegra", (kernel_ulong_t)&sdhci_tegra_pdata }, > + { "sdhci-tegra", (kernel_ulong_t)&sdhci_tegra_data }, > #endif > { }, > }; > diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h > index c67523d..a240bc9 100644 > --- a/drivers/mmc/host/sdhci-pltfm.h > +++ b/drivers/mmc/host/sdhci-pltfm.h > @@ -8,22 +8,22 @@ > * published by the Free Software Foundation. > */ > > -#ifndef _DRIVERS_MMC_SDHCI_PLTFM_H > -#define _DRIVERS_MMC_SDHCI_PLTFM_H > +#ifndef _SDHCI_PLTFM_H > +#define _SDHCI_PLTFM_H > > #include <linux/clk.h> > #include <linux/types.h> > -#include <linux/mmc/sdhci-pltfm.h> > +#include "sdhci.h" > > struct sdhci_pltfm_host { > struct clk *clk; > u32 scratchpad; /* to handle quirks across io-accessor calls */ > }; > > -extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata; > -extern struct sdhci_pltfm_data sdhci_esdhc_imx_pdata; > -extern struct sdhci_pltfm_data sdhci_dove_pdata; > -extern struct sdhci_pltfm_data sdhci_tegra_pdata; > -extern struct sdhci_pltfm_data sdhci_tegra_dt_pdata; > +extern struct sdhci_data sdhci_cns3xxx_data; > +extern struct sdhci_data sdhci_esdhc_imx_data; > +extern struct sdhci_data sdhci_dove_data; > +extern struct sdhci_data sdhci_tegra_data; > +extern struct sdhci_data sdhci_tegra_dt_data; > > -#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */ > +#endif /* _SDHCI_PLTFM_H */ > diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c > index c3d6f83..ec1778d 100644 > --- a/drivers/mmc/host/sdhci-tegra.c > +++ b/drivers/mmc/host/sdhci-tegra.c > @@ -120,7 +120,7 @@ static int tegra_sdhci_8bit(struct sdhci_host *host, int bus_width) > > > static int tegra_sdhci_pltfm_init(struct sdhci_host *host, > - struct sdhci_pltfm_data *pdata) > + struct sdhci_data *data) > { > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); > @@ -214,7 +214,7 @@ out: > } > > static int tegra_sdhci_pltfm_dt_init(struct sdhci_host *host, > - struct sdhci_pltfm_data *pdata) > + struct sdhci_data *data) > { > struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); > struct tegra_sdhci_platform_data *plat; > @@ -237,7 +237,7 @@ static int tegra_sdhci_pltfm_dt_init(struct sdhci_host *host, > dev_info(&pdev->dev, "using gpios cd=%i, wp=%i power=%i\n", > plat->cd_gpio, plat->wp_gpio, plat->power_gpio); > > - return tegra_sdhci_pltfm_init(host, pdata); > + return tegra_sdhci_pltfm_init(host, data); > } > > static void tegra_sdhci_pltfm_exit(struct sdhci_host *host) > @@ -285,7 +285,7 @@ static struct sdhci_ops tegra_sdhci_ops = { > .platform_8bit_width = tegra_sdhci_8bit, > }; > > -struct sdhci_pltfm_data sdhci_tegra_pdata = { > +struct sdhci_data sdhci_tegra_data = { > .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | > SDHCI_QUIRK_SINGLE_POWER_WRITE | > SDHCI_QUIRK_NO_HISPD_BIT | > @@ -295,7 +295,7 @@ struct sdhci_pltfm_data sdhci_tegra_pdata = { > .exit = tegra_sdhci_pltfm_exit, > }; > > -struct sdhci_pltfm_data sdhci_tegra_dt_pdata = { > +struct sdhci_data sdhci_tegra_dt_data = { > .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | > SDHCI_QUIRK_SINGLE_POWER_WRITE | > SDHCI_QUIRK_NO_HISPD_BIT | > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index 6e0969e..6388953 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -201,6 +201,21 @@ > #define SDHCI_MAX_DIV_SPEC_200 256 > #define SDHCI_MAX_DIV_SPEC_300 2046 > > +/** > + * struct sdhci_data - SDHCI platform/OF specific information & hooks > + * @ops: optional pointer to the platform/OF provided SDHCI ops > + * @quirks: optional SDHCI quirks > + * @init: optional hook that is called during device probe, before the > + * driver tries to access any SDHCI registers > + * @exit: optional hook that is called during device removal > + */ > +struct sdhci_data { > + struct sdhci_ops *ops; > + unsigned int quirks; > + int (*init)(struct sdhci_host *host, struct sdhci_data *data); > + void (*exit)(struct sdhci_host *host); > +}; > + > struct sdhci_ops { > #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS > u32 (*read_l)(struct sdhci_host *host, int reg); > diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h > deleted file mode 100644 > index 548d59d..0000000 > --- a/include/linux/mmc/sdhci-pltfm.h > +++ /dev/null > @@ -1,35 +0,0 @@ > -/* > - * Platform data declarations for the sdhci-pltfm driver. > - * > - * Copyright (c) 2010 MontaVista Software, LLC. > - * > - * Author: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> > - * > - * This program is free software; you can redistribute it and/or modify > - * it under the terms of the GNU General Public License as published by > - * the Free Software Foundation; either version 2 of the License, or (at > - * your option) any later version. > - */ > - > -#ifndef _SDHCI_PLTFM_H > -#define _SDHCI_PLTFM_H > - > -struct sdhci_ops; > -struct sdhci_host; > - > -/** > - * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks > - * @ops: optional pointer to the platform-provided SDHCI ops > - * @quirks: optional SDHCI quirks > - * @init: optional hook that is called during device probe, before the > - * driver tries to access any SDHCI registers > - * @exit: optional hook that is called during device removal > - */ > -struct sdhci_pltfm_data { > - struct sdhci_ops *ops; > - unsigned int quirks; > - int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata); > - void (*exit)(struct sdhci_host *host); > -}; > - > -#endif /* _SDHCI_PLTFM_H */ > -- > 1.7.1 > ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <20110315195513.GA20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>]
* Re: [PATCH 4/7] mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one [not found] ` <20110315195513.GA20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org> @ 2011-03-17 6:33 ` Shawn Guo 2011-03-17 20:29 ` Grant Likely 0 siblings, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-17 6:33 UTC (permalink / raw) To: Grant Likely Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Tue, Mar 15, 2011 at 01:55:13PM -0600, Grant Likely wrote: > On Mon, Mar 14, 2011 at 10:25:56PM +0800, Shawn Guo wrote: > > This patch is motivated by the work of supporting sdhci-esdhc-imx as > > an OF device. The sdhci-esdhc-imx driver was well designed to be > > able to work with either platform or OF bus, with a little effort to > > decouple the driver from sdhci_pltfm_data. > > > > Like sdhci_ops works for both platform and OF sdhci driver, the patch > > demonstrates that sdhci_pltfm_data and sdhci_of_data can be > > consolidated into sdhci_data, which should work for both. As one of > > the results, header linux/mmc/sdhci-pltfm.h can be deleted. > > > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > I like the push to unify DT and non-DT usage with the SDHCI drivers, > but I'm not convinced on the approach. Actually, that's more a > comment on the existing code than it is on the this patch. > Yes, this patch is not supposed to mean that much. It only intends to unify one data structure so that sdhci-esdhc-imx.c can work for both cases. The topic you raised here is a bigger one which may involve debate with authors of both sdhci-pltfm.c and sdhci-of-core.c. We can take it as the final goal, and this patch could be a first step to that goal. -- Regards, Shawn > I don't like the way that sdhci-pltfm.c and sdhci-of-core.c each take > responsibility for the .probe hook on each of the implementations. > Doing it that way means that each implementation needs to add a set of > hooks into those core files protected by #ifdefs based on whether or > not the driver is enabled. It also means that loading one driver > means that all the configured sdhci drivers get loaded into the > kernel. This seems backwards. > > From what I can see, sdhci-pltfm.c and sdhci-of-core.c both provide > useful common functions that would be used by all sdhci host drivers. > The interface would be a lot cleaner if those routines were exported > for use by other modules, and each driver registered its own probe > hook. It would keep all the driver specific stuff out of > sdhci_pltfm_ids and I think it would result in a cleaner interface > overall. > > Here is how I would do it: > > 1) break the bulk of the sdhci_pltfm.c and sdhci_of_core.c .probe and > .remove hooks out into separate functions; callable by other modules > 2) for each driver, add its own probe and remove hooks which calls > into the new functions created in step 1. This would eliminate the > need for the ->exit and ->init callbacks since they would get rolled > into the new .probe and .remove callbacks > 3) finally, when all drivers are removed; eliminate the driver > registration from sdhci_pltfm.c and sdhci_of_core.c because there > wouldn't be any users left. > > drivers/mmc/host/sdhci-pxa.c appears to be a good example of how I > think sdhci platform_drivers should be structured. > > At the same time, the functionality from sdhci_of_core.c could easily > be migrated into sdhci_pltfm.c. > ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 4/7] mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one 2011-03-17 6:33 ` Shawn Guo @ 2011-03-17 20:29 ` Grant Likely 0 siblings, 0 replies; 24+ messages in thread From: Grant Likely @ 2011-03-17 20:29 UTC (permalink / raw) To: Shawn Guo Cc: Shawn Guo, nicolas.pitre, devicetree-discuss, linaro-dev, linux-mmc [cc'ing linux-mmc@vger.kernel.org] On Thu, Mar 17, 2011 at 02:33:20PM +0800, Shawn Guo wrote: > On Tue, Mar 15, 2011 at 01:55:13PM -0600, Grant Likely wrote: > > On Mon, Mar 14, 2011 at 10:25:56PM +0800, Shawn Guo wrote: > > > This patch is motivated by the work of supporting sdhci-esdhc-imx as > > > an OF device. The sdhci-esdhc-imx driver was well designed to be > > > able to work with either platform or OF bus, with a little effort to > > > decouple the driver from sdhci_pltfm_data. > > > > > > Like sdhci_ops works for both platform and OF sdhci driver, the patch > > > demonstrates that sdhci_pltfm_data and sdhci_of_data can be > > > consolidated into sdhci_data, which should work for both. As one of > > > the results, header linux/mmc/sdhci-pltfm.h can be deleted. > > > > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > > > > I like the push to unify DT and non-DT usage with the SDHCI drivers, > > but I'm not convinced on the approach. Actually, that's more a > > comment on the existing code than it is on the this patch. > > > Yes, this patch is not supposed to mean that much. It only intends > to unify one data structure so that sdhci-esdhc-imx.c can work for > both cases. > > The topic you raised here is a bigger one which may involve debate > with authors of both sdhci-pltfm.c and sdhci-of-core.c. We can take > it as the final goal, and this patch could be a first step to that > goal. I doubt very much that the sdhci-of-core.c users/developers will have a problem with this. There is a strong trend toward unifying DT and non-DT code, and Linux has a strong pattern of each driver handling its own registration. I actually don't have an objection to this patch specifically, but rather I want to see the overall direction be to eliminate sdhci-of-core.c and sdhci-pltfm.c entirely instead of using it more.. On another note, this patch changes a number of names, both of structures and variables. Specifically: {sdhci_pltfm_data,sdhci_of_data} ==> sdhci_data and pdata ==> data However, it would be easier to review if the pdata==>data change was dropped (the name of the local variable doesn't matter that much), and if sdhci_of_data was renamed to sdhci_pltfm_data. Doing so would make the diff much smaller without changing the sanity of the resulting code. g. > > -- > Regards, > Shawn > > > I don't like the way that sdhci-pltfm.c and sdhci-of-core.c each take > > responsibility for the .probe hook on each of the implementations. > > Doing it that way means that each implementation needs to add a set of > > hooks into those core files protected by #ifdefs based on whether or > > not the driver is enabled. It also means that loading one driver > > means that all the configured sdhci drivers get loaded into the > > kernel. This seems backwards. > > > > From what I can see, sdhci-pltfm.c and sdhci-of-core.c both provide > > useful common functions that would be used by all sdhci host drivers. > > The interface would be a lot cleaner if those routines were exported > > for use by other modules, and each driver registered its own probe > > hook. It would keep all the driver specific stuff out of > > sdhci_pltfm_ids and I think it would result in a cleaner interface > > overall. > > > > Here is how I would do it: > > > > 1) break the bulk of the sdhci_pltfm.c and sdhci_of_core.c .probe and > > .remove hooks out into separate functions; callable by other modules > > 2) for each driver, add its own probe and remove hooks which calls > > into the new functions created in step 1. This would eliminate the > > need for the ->exit and ->init callbacks since they would get rolled > > into the new .probe and .remove callbacks > > 3) finally, when all drivers are removed; eliminate the driver > > registration from sdhci_pltfm.c and sdhci_of_core.c because there > > wouldn't be any users left. > > > > drivers/mmc/host/sdhci-pxa.c appears to be a good example of how I > > think sdhci platform_drivers should be structured. > > > > At the same time, the functionality from sdhci_of_core.c could easily > > be migrated into sdhci_pltfm.c. > > > ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> ` (3 preceding siblings ...) 2011-03-14 14:25 ` [PATCH 4/7] mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one Shawn Guo @ 2011-03-14 14:25 ` Shawn Guo [not found] ` <1300112759-3495-6-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2011-03-14 14:25 ` [PATCH 6/7] arm/dts: babbage: add device nodes for esdhc Shawn Guo ` (2 subsequent siblings) 7 siblings, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw) To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- drivers/mmc/host/Kconfig | 7 ++++--- drivers/mmc/host/Makefile | 3 ++- drivers/mmc/host/sdhci-of-core.c | 3 +++ drivers/mmc/host/sdhci-of.h | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index afe8c6f..9746ec1 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -133,12 +133,13 @@ config MMC_SDHCI_CNS3XXX If unsure, say N. config MMC_SDHCI_ESDHC_IMX - bool "SDHCI platform support for the Freescale eSDHC i.MX controller" - depends on MMC_SDHCI_PLTFM && (ARCH_MX25 || ARCH_MX35 || ARCH_MX5) + bool "SDHCI support for the Freescale eSDHC i.MX controller" + depends on ARCH_MX25 || ARCH_MX35 || ARCH_MX5 + depends on MMC_SDHCI_PLTFM || MMC_SDHCI_OF select MMC_SDHCI_IO_ACCESSORS help This selects the Freescale eSDHC controller support on the platform - bus, found on platforms like mx35/51. + or OF bus, found on platforms like mx35/51. If unsure, say N. diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index e834fb2..cca8dfd 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -39,7 +39,6 @@ obj-$(CONFIG_MMC_USHC) += ushc.o obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o sdhci-platform-y := sdhci-pltfm.o sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o -sdhci-platform-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o sdhci-platform-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o sdhci-platform-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o @@ -48,6 +47,8 @@ sdhci-of-y := sdhci-of-core.o sdhci-of-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o sdhci-of-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o +obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o + ifeq ($(CONFIG_CB710_DEBUG),y) CFLAGS-cb710-mmc += -DDEBUG endif diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c index 0b32ad7..d803fa5 100644 --- a/drivers/mmc/host/sdhci-of-core.c +++ b/drivers/mmc/host/sdhci-of-core.c @@ -32,6 +32,9 @@ #include "sdhci.h" static const struct of_device_id sdhci_of_match[] = { +#ifdef CONFIG_MMC_SDHCI_ESDHC_IMX + { .compatible = "fsl,imx-esdhc", .data = &sdhci_esdhc_imx_data, }, +#endif #ifdef CONFIG_MMC_SDHCI_OF_ESDHC { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc_data, }, { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc_data, }, diff --git a/drivers/mmc/host/sdhci-of.h b/drivers/mmc/host/sdhci-of.h index e88fe2e..90fb2eb 100644 --- a/drivers/mmc/host/sdhci-of.h +++ b/drivers/mmc/host/sdhci-of.h @@ -31,6 +31,7 @@ extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg); extern void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg); extern void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg); +extern struct sdhci_data sdhci_esdhc_imx_data; extern struct sdhci_data sdhci_esdhc_data; extern struct sdhci_data sdhci_hlwd_data; -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <1300112759-3495-6-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device [not found] ` <1300112759-3495-6-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2011-03-15 19:59 ` Grant Likely [not found] ` <20110315195926.GB20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org> 0 siblings, 1 reply; 24+ messages in thread From: Grant Likely @ 2011-03-15 19:59 UTC (permalink / raw) To: Shawn Guo Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Mon, Mar 14, 2011 at 10:25:57PM +0800, Shawn Guo wrote: > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> dt support can be added directly to sdchi-pltfm.c drivers now. There is no longer any need to use sdhci-of-core.c any more. For an example, see the patch titled "of/tegra: add sdhci device tree handling" in my devicetree/test branch. http://git.secretlab.ca/?p=linux-2.6.git;a=commit;h=1437bd1d5a1fec2dcf17d9fde73b385569c82084 g. > --- > drivers/mmc/host/Kconfig | 7 ++++--- > drivers/mmc/host/Makefile | 3 ++- > drivers/mmc/host/sdhci-of-core.c | 3 +++ > drivers/mmc/host/sdhci-of.h | 1 + > 4 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig > index afe8c6f..9746ec1 100644 > --- a/drivers/mmc/host/Kconfig > +++ b/drivers/mmc/host/Kconfig > @@ -133,12 +133,13 @@ config MMC_SDHCI_CNS3XXX > If unsure, say N. > > config MMC_SDHCI_ESDHC_IMX > - bool "SDHCI platform support for the Freescale eSDHC i.MX controller" > - depends on MMC_SDHCI_PLTFM && (ARCH_MX25 || ARCH_MX35 || ARCH_MX5) > + bool "SDHCI support for the Freescale eSDHC i.MX controller" > + depends on ARCH_MX25 || ARCH_MX35 || ARCH_MX5 > + depends on MMC_SDHCI_PLTFM || MMC_SDHCI_OF > select MMC_SDHCI_IO_ACCESSORS > help > This selects the Freescale eSDHC controller support on the platform > - bus, found on platforms like mx35/51. > + or OF bus, found on platforms like mx35/51. > > If unsure, say N. > > diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile > index e834fb2..cca8dfd 100644 > --- a/drivers/mmc/host/Makefile > +++ b/drivers/mmc/host/Makefile > @@ -39,7 +39,6 @@ obj-$(CONFIG_MMC_USHC) += ushc.o > obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o > sdhci-platform-y := sdhci-pltfm.o > sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o > -sdhci-platform-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o > sdhci-platform-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o > sdhci-platform-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o > > @@ -48,6 +47,8 @@ sdhci-of-y := sdhci-of-core.o > sdhci-of-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o > sdhci-of-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o > > +obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o > + > ifeq ($(CONFIG_CB710_DEBUG),y) > CFLAGS-cb710-mmc += -DDEBUG > endif > diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c > index 0b32ad7..d803fa5 100644 > --- a/drivers/mmc/host/sdhci-of-core.c > +++ b/drivers/mmc/host/sdhci-of-core.c > @@ -32,6 +32,9 @@ > #include "sdhci.h" > > static const struct of_device_id sdhci_of_match[] = { > +#ifdef CONFIG_MMC_SDHCI_ESDHC_IMX > + { .compatible = "fsl,imx-esdhc", .data = &sdhci_esdhc_imx_data, }, > +#endif > #ifdef CONFIG_MMC_SDHCI_OF_ESDHC > { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc_data, }, > { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc_data, }, > diff --git a/drivers/mmc/host/sdhci-of.h b/drivers/mmc/host/sdhci-of.h > index e88fe2e..90fb2eb 100644 > --- a/drivers/mmc/host/sdhci-of.h > +++ b/drivers/mmc/host/sdhci-of.h > @@ -31,6 +31,7 @@ extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg); > extern void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg); > extern void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg); > > +extern struct sdhci_data sdhci_esdhc_imx_data; > extern struct sdhci_data sdhci_esdhc_data; > extern struct sdhci_data sdhci_hlwd_data; > > -- > 1.7.1 > ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <20110315195926.GB20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>]
* Re: [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device [not found] ` <20110315195926.GB20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org> @ 2011-03-16 14:39 ` Shawn Guo 2011-03-17 20:22 ` Grant Likely 0 siblings, 1 reply; 24+ messages in thread From: Shawn Guo @ 2011-03-16 14:39 UTC (permalink / raw) To: Grant Likely Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw On Tue, Mar 15, 2011 at 01:59:26PM -0600, Grant Likely wrote: > On Mon, Mar 14, 2011 at 10:25:57PM +0800, Shawn Guo wrote: > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > dt support can be added directly to sdchi-pltfm.c drivers now. There > is no longer any need to use sdhci-of-core.c any more. For an > example, see the patch titled "of/tegra: add sdhci device tree > handling" in my devicetree/test branch. > I mentioned this a little bit in the cover letter of the patch set as below. "This patch set is to support sdhci-esdhc-imx as an OF device. As there is already powerpc based esdhc OF support, it chose to add OF support for imx esdhc driver in a different way from what sdhci-tegra did." The tegra approach you made was one of the two options I had, and I happened to love the another more, as it consolidates the eSDHC OF driver for Freescale MPCxxx and i.MX family. I can turn it around to your approach if you can convince me :) -- Regards, Shawn ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device 2011-03-16 14:39 ` Shawn Guo @ 2011-03-17 20:22 ` Grant Likely 2011-03-17 20:42 ` Rob Herring 0 siblings, 1 reply; 24+ messages in thread From: Grant Likely @ 2011-03-17 20:22 UTC (permalink / raw) To: Shawn Guo Cc: Shawn Guo, nicolas.pitre, devicetree-discuss, linaro-dev, linux-mmc [cc'ing linux-mmc to continue this discussion] On Wed, Mar 16, 2011 at 10:39:16PM +0800, Shawn Guo wrote: > On Tue, Mar 15, 2011 at 01:59:26PM -0600, Grant Likely wrote: > > On Mon, Mar 14, 2011 at 10:25:57PM +0800, Shawn Guo wrote: > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > > > > dt support can be added directly to sdchi-pltfm.c drivers now. There > > is no longer any need to use sdhci-of-core.c any more. For an > > example, see the patch titled "of/tegra: add sdhci device tree > > handling" in my devicetree/test branch. > > > I mentioned this a little bit in the cover letter of the patch set > as below. > > "This patch set is to support sdhci-esdhc-imx as an OF device. As > there is already powerpc based esdhc OF support, it chose to add OF > support for imx esdhc driver in a different way from what sdhci-tegra > did." I should read your descriptions more carefully. :-) > The tegra approach you made was one of the two options I had, and I > happened to love the another more, as it consolidates the eSDHC OF > driver for Freescale MPCxxx and i.MX family. Heh, I don't dispute the value of merging code. However, with this approach it means that DT and non-DT imx platforms will be using different drivers for the same device. Given the choices, I'd rather see the imx driver used in both DT and non-DT situations instead of sharing code with the powerpc version. I've learnt the hard way that it is just too painful having two drivers for the same hardware; particularly when the only difference is the method used to probe them. Actually, what I'd *really* rather see is the powerpc code migrated over to sdhci_pltfm.c, and then have the imx compatible value added to it. I'll make sure to get some help from the Freescale powerpc folks to test any patch you produce to that end. g. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device 2011-03-17 20:22 ` Grant Likely @ 2011-03-17 20:42 ` Rob Herring 0 siblings, 0 replies; 24+ messages in thread From: Rob Herring @ 2011-03-17 20:42 UTC (permalink / raw) To: Grant Likely Cc: Shawn Guo, nicolas.pitre, linux-mmc, devicetree-discuss, linaro-dev On 03/17/2011 03:22 PM, Grant Likely wrote: > [cc'ing linux-mmc to continue this discussion] > > On Wed, Mar 16, 2011 at 10:39:16PM +0800, Shawn Guo wrote: >> On Tue, Mar 15, 2011 at 01:59:26PM -0600, Grant Likely wrote: >>> On Mon, Mar 14, 2011 at 10:25:57PM +0800, Shawn Guo wrote: >>>> Signed-off-by: Shawn Guo<shawn.guo@linaro.org> >>> >>> dt support can be added directly to sdchi-pltfm.c drivers now. There >>> is no longer any need to use sdhci-of-core.c any more. For an >>> example, see the patch titled "of/tegra: add sdhci device tree >>> handling" in my devicetree/test branch. >>> >> I mentioned this a little bit in the cover letter of the patch set >> as below. >> >> "This patch set is to support sdhci-esdhc-imx as an OF device. As >> there is already powerpc based esdhc OF support, it chose to add OF >> support for imx esdhc driver in a different way from what sdhci-tegra >> did." > > I should read your descriptions more carefully. :-) > >> The tegra approach you made was one of the two options I had, and I >> happened to love the another more, as it consolidates the eSDHC OF >> driver for Freescale MPCxxx and i.MX family. > > Heh, I don't dispute the value of merging code. However, with this > approach it means that DT and non-DT imx platforms will be using > different drivers for the same device. Given the choices, I'd > rather see the imx driver used in both DT and non-DT situations > instead of sharing code with the powerpc version. I've learnt the > hard way that it is just too painful having two drivers for the same > hardware; particularly when the only difference is the method used to > probe them. > > Actually, what I'd *really* rather see is the powerpc code migrated > over to sdhci_pltfm.c, and then have the imx compatible value added to > it. I'll make sure to get some help from the Freescale powerpc folks > to test any patch you produce to that end. Based on past experience, there will be differences between imx and ppc h/w even though it is the "same" block. Rob ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 6/7] arm/dts: babbage: add device nodes for esdhc [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> ` (4 preceding siblings ...) 2011-03-14 14:25 ` [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device Shawn Guo @ 2011-03-14 14:25 ` Shawn Guo 2011-03-14 14:25 ` [PATCH 7/7] dt: update fsl-esdhc bindings for imx esdhc OF support Shawn Guo 2011-03-14 15:46 ` [PATCH 0/7] support sdhci-esdhc-imx as an OF device Shawn Guo 7 siblings, 0 replies; 24+ messages in thread From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw) To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- arch/arm/boot/dts/babbage.dts | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/babbage.dts b/arch/arm/boot/dts/babbage.dts index 378cd7d..d1824ab 100644 --- a/arch/arm/boot/dts/babbage.dts +++ b/arch/arm/boot/dts/babbage.dts @@ -572,6 +572,20 @@ compatible = "simple-bus"; ranges = <0x0 0x70000000 0x100000>; + sdhci@4000 { + compatible = "fsl,imx-esdhc", "fsl,esdhc"; + reg = <0x4000 0x4000>; + interrupts = <1>; + bus-clock = <&esdhc1_clk>, "esdhc"; + }; + + sdhci@8000 { + compatible = "fsl,imx-esdhc", "fsl,esdhc"; + reg = <0x8000 0x4000>; + interrupts = <2>; + bus-clock = <&esdhc2_clk>, "esdhc"; + }; + imx-uart@c000 { compatible = "fsl,imx51-uart"; reg = <0xc000 0x1000>; -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 7/7] dt: update fsl-esdhc bindings for imx esdhc OF support [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> ` (5 preceding siblings ...) 2011-03-14 14:25 ` [PATCH 6/7] arm/dts: babbage: add device nodes for esdhc Shawn Guo @ 2011-03-14 14:25 ` Shawn Guo 2011-03-14 15:46 ` [PATCH 0/7] support sdhci-esdhc-imx as an OF device Shawn Guo 7 siblings, 0 replies; 24+ messages in thread From: Shawn Guo @ 2011-03-14 14:25 UTC (permalink / raw) To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- .../devicetree/bindings/mmc/fsl-esdhc.txt | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt index 64bcb8b..fac52e2 100644 --- a/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt +++ b/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt @@ -9,7 +9,10 @@ Required properties: - reg : should contain eSDHC registers location and length. - interrupts : should contain eSDHC interrupt. - interrupt-parent : interrupt source phandle. - - clock-frequency : specifies eSDHC base clock frequency. + - clock-frequency : (mandatory for powerpc platform) specifies + eSDHC base clock frequency. + - bus-clock : (mandatory for arm platform) specifies phandle of + eSDHC clock provider. - sdhci,wp-inverted : (optional) specifies that eSDHC controller reports inverted write-protect state; - sdhci,1-bit-only : (optional) specifies that a controller can -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 0/7] support sdhci-esdhc-imx as an OF device [not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> ` (6 preceding siblings ...) 2011-03-14 14:25 ` [PATCH 7/7] dt: update fsl-esdhc bindings for imx esdhc OF support Shawn Guo @ 2011-03-14 15:46 ` Shawn Guo 7 siblings, 0 replies; 24+ messages in thread From: Shawn Guo @ 2011-03-14 15:46 UTC (permalink / raw) To: Shawn Guo Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linaro-dev-cunTk1MwBs8s++Sfvej+rw Due to something I should not put on git send-email command, the following CC setting did not work for this patch set. [sendemail] cc = patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org Sorry. I will be careful next time. -- Regards, Shawn On Mon, Mar 14, 2011 at 10:25:52PM +0800, Shawn Guo wrote: > This patch set is to support sdhci-esdhc-imx as an OF device. As > there is already powerpc based esdhc OF support, it chose to add OF > support for imx esdhc driver in a different way from what sdhci-tegra > did. > > It consolidates sdhci_pltfm_data sdhci_of_data into sdhci_data and get > sdhci-esdhc-imx work with both platform bus and OF. > ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2011-03-18 4:58 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-14 14:25 [PATCH 0/7] support sdhci-esdhc-imx as an OF device Shawn Guo
[not found] ` <1300112759-3495-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-14 14:25 ` [PATCH 1/7] mx51 enchance the sd/mmc HW timing compatibility on mx51 boards Shawn Guo
2011-03-14 14:25 ` [PATCH 2/7] arm/dt: add pad configurations for mx51 babbage Shawn Guo
[not found] ` <1300112759-3495-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-14 15:20 ` Rob Herring
[not found] ` <4D7E3230.6040505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-14 15:53 ` Shawn Guo
[not found] ` <20110314155313.GC3674-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-15 0:57 ` Shawn Guo
2011-03-15 7:57 ` Grant Likely
2011-03-14 14:25 ` [PATCH 3/7] mmc: make the reference to sdhci_tegra_dt_pdata conditional Shawn Guo
[not found] ` <1300112759-3495-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-15 7:58 ` Grant Likely
[not found] ` <20110315075859.GL23050-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-17 19:59 ` Grant Likely
[not found] ` <AANLkTi=umf9nDpExLEBgJEMgUP-CJUUEbAQrQfdBw7Fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-18 1:22 ` Shawn Guo
[not found] ` <20110318012202.GA26951-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-18 4:58 ` Grant Likely
2011-03-14 14:25 ` [PATCH 4/7] mmc: consolidate sdhci_pltfm_data and sdhci_of_data into one Shawn Guo
[not found] ` <1300112759-3495-5-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-15 19:55 ` Grant Likely
[not found] ` <20110315195513.GA20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-17 6:33 ` Shawn Guo
2011-03-17 20:29 ` Grant Likely
2011-03-14 14:25 ` [PATCH 5/7] mmc: support sdhci-esdhc-imx as an OF device Shawn Guo
[not found] ` <1300112759-3495-6-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-15 19:59 ` Grant Likely
[not found] ` <20110315195926.GB20845-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-16 14:39 ` Shawn Guo
2011-03-17 20:22 ` Grant Likely
2011-03-17 20:42 ` Rob Herring
2011-03-14 14:25 ` [PATCH 6/7] arm/dts: babbage: add device nodes for esdhc Shawn Guo
2011-03-14 14:25 ` [PATCH 7/7] dt: update fsl-esdhc bindings for imx esdhc OF support Shawn Guo
2011-03-14 15:46 ` [PATCH 0/7] support sdhci-esdhc-imx as an OF device Shawn Guo
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).