Re: [PATCH 1/8] omap_hsmmc: move gpio and regulator control from board file
ext Tony Lindgren wrote: * Adrian Hunter adrian.hun...@nokia.com [100113 03:38]: From c2ed3074a73fc13d088c53193af546c01d1061b1 Mon Sep 17 00:00:00 2001 From: Adrian Hunter adrian.hun...@nokia.com Date: Mon, 4 Jan 2010 13:44:36 +0200 Subject: [PATCH] omap_hsmmc: move gpio and regulator control from board file This patch moves the setup code for GPIO's and Voltage Regulators from the board file mmc-twl4030.c to the driver omap_hsmmc.c. Moving GPIO code to the driver makes the board initialisation code independent of when GPIO's are defined. That makes the board initialisation now entirely independent of its original twl4030 roots. Moving Voltage Regulator code to the driver allows for further development of regulator support in the core MMC code. It also permits the MMC core to be compiled as a module, because the board code no longer calls MMC core functions. Signed-off-by: Adrian Hunter adrian.hun...@nokia.com --- arch/arm/configs/rx51_defconfig |4 +- arch/arm/mach-omap2/control.c |2 + arch/arm/mach-omap2/mmc-twl4030.c | 419 + arch/arm/mach-omap2/mmc-twl4030.h |4 +- arch/arm/plat-omap/include/plat/mmc.h |2 +- drivers/mmc/host/omap_hsmmc.c | 417 +++- 6 files changed, 419 insertions(+), 429 deletions(-) snip diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index cdd1f35..f3e31dc 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -162,6 +162,7 @@ u32 omap_ctrl_readl(u16 offset) { return __raw_readl(OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_readl); void omap_ctrl_writeb(u8 val, u16 offset) { @@ -177,6 +178,7 @@ void omap_ctrl_writel(u32 val, u16 offset) { __raw_writel(val, OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_writel); #if defined(CONFIG_ARCH_OMAP3) defined(CONFIG_PM) /* NAK, we don't want to export omap_ctrl_read/write. That will lead into a horrible mess again of all the drivers tinkering with the omap hardware registers directly. OK All code like that needs to stay under mach-omap2. This same mmc controller could in theory be used on other hardware too, not just omaps. The ctrl registers are omap specific, not mmc controller specific. Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/8] omap_hsmmc: move gpio and regulator control from board file
ext Madhusudhan wrote: -Original Message- From: Adrian Hunter [mailto:adrian.hun...@nokia.com] Sent: Wednesday, January 13, 2010 5:40 AM To: Tony Lindgren Cc: linux-mmc Mailing List; Adrian Hunter; Andrew Morton; linux-omap Mailing List; Madhusudhan Chikkature Subject: [PATCH 1/8] omap_hsmmc: move gpio and regulator control from board file From c2ed3074a73fc13d088c53193af546c01d1061b1 Mon Sep 17 00:00:00 2001 From: Adrian Hunter adrian.hun...@nokia.com Date: Mon, 4 Jan 2010 13:44:36 +0200 Subject: [PATCH] omap_hsmmc: move gpio and regulator control from board file This patch moves the setup code for GPIO's and Voltage Regulators from the board file mmc-twl4030.c to the driver omap_hsmmc.c. Moving GPIO code to the driver makes the board initialisation code independent of when GPIO's are defined. That makes the board initialisation now entirely independent of its original twl4030 roots. Moving Voltage Regulator code to the driver allows for further development of regulator support in the core MMC code. It also permits the MMC core to be compiled as a module, because the board code no longer calls MMC core functions. Signed-off-by: Adrian Hunter adrian.hun...@nokia.com --- arch/arm/configs/rx51_defconfig |4 +- arch/arm/mach-omap2/control.c |2 + arch/arm/mach-omap2/mmc-twl4030.c | 419 +--- - arch/arm/mach-omap2/mmc-twl4030.h |4 +- arch/arm/plat-omap/include/plat/mmc.h |2 +- drivers/mmc/host/omap_hsmmc.c | 417 +++- 6 files changed, 419 insertions(+), 429 deletions(-) diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig index b6eeebb..426ae94 100644 --- a/arch/arm/configs/rx51_defconfig +++ b/arch/arm/configs/rx51_defconfig @@ -1354,7 +1354,7 @@ CONFIG_USB_OTG_UTILS=y # CONFIG_USB_GPIO_VBUS is not set # CONFIG_ISP1301_OMAP is not set CONFIG_TWL4030_USB=y -CONFIG_MMC=y +CONFIG_MMC=m # CONFIG_MMC_DEBUG is not set # CONFIG_MMC_UNSAFE_RESUME is not set @@ -1362,7 +1362,7 @@ CONFIG_MMC=y # MMC/SD/SDIO Card Drivers # CONFIG_MMC_BLOCK=m -CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_MMC_BLOCK_BOUNCE is not set # CONFIG_SDIO_UART is not set # CONFIG_MMC_TEST is not set diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index cdd1f35..f3e31dc 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -162,6 +162,7 @@ u32 omap_ctrl_readl(u16 offset) { return __raw_readl(OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_readl); void omap_ctrl_writeb(u8 val, u16 offset) { @@ -177,6 +178,7 @@ void omap_ctrl_writel(u32 val, u16 offset) { __raw_writel(val, OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_writel); #if defined(CONFIG_ARCH_OMAP3) defined(CONFIG_PM) /* diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc- twl4030.c index 0c3c72d..e846d56 100644 --- a/arch/arm/mach-omap2/mmc-twl4030.c +++ b/arch/arm/mach-omap2/mmc-twl4030.c @@ -9,195 +9,22 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include linux/err.h -#include linux/io.h -#include linux/module.h -#include linux/platform_device.h -#include linux/interrupt.h -#include linux/delay.h -#include linux/gpio.h -#include linux/mmc/host.h -#include linux/regulator/consumer.h - +#include linux/kernel.h +#include linux/slab.h +#include linux/string.h #include mach/hardware.h -#include plat/control.h #include plat/mmc.h -#include plat/board.h #include mmc-twl4030.h - -#if defined(CONFIG_REGULATOR) \ - (defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)) - -static u16 control_pbias_offset; -static u16 control_devconf1_offset; +#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) #define HSMMC_NAME_LEN 9 static struct twl_mmc_controller { - struct omap_mmc_platform_data *mmc; - /* Vcc == configured supply - * Vcc_alt == optional - * - MMC1, supply for DAT4..DAT7 - * - MMC2/MMC2, external level shifter voltage supply, for - * chip (SDIO, eMMC, etc) or transceiver (MMC2 only) - */ - struct regulator*vcc; - struct regulator*vcc_aux; charname[HSMMC_NAME_LEN + 1]; } hsmmc[OMAP34XX_NR_MMC]; -static int twl_mmc_card_detect(int irq) -{ - unsigned i; - - for (i = 0; i ARRAY_SIZE(hsmmc); i++) { - struct omap_mmc_platform_data *mmc; - - mmc = hsmmc[i].mmc; - if (!mmc) - continue; - if (irq != mmc-slots[0].card_detect_irq) - continue; - - /* NOTE: assumes card detect signal is active-low */ - return !gpio_get_value_cansleep(mmc-slots[0].switch_pin); - } - return -ENOSYS; -} - -static int twl_mmc_get_ro(struct device *dev, int slot) -{ - struct
Re: [PATCH 1/8] omap_hsmmc: move gpio and regulator control from board file
* Adrian Hunter adrian.hun...@nokia.com [100113 03:38]: From c2ed3074a73fc13d088c53193af546c01d1061b1 Mon Sep 17 00:00:00 2001 From: Adrian Hunter adrian.hun...@nokia.com Date: Mon, 4 Jan 2010 13:44:36 +0200 Subject: [PATCH] omap_hsmmc: move gpio and regulator control from board file This patch moves the setup code for GPIO's and Voltage Regulators from the board file mmc-twl4030.c to the driver omap_hsmmc.c. Moving GPIO code to the driver makes the board initialisation code independent of when GPIO's are defined. That makes the board initialisation now entirely independent of its original twl4030 roots. Moving Voltage Regulator code to the driver allows for further development of regulator support in the core MMC code. It also permits the MMC core to be compiled as a module, because the board code no longer calls MMC core functions. Signed-off-by: Adrian Hunter adrian.hun...@nokia.com --- arch/arm/configs/rx51_defconfig |4 +- arch/arm/mach-omap2/control.c |2 + arch/arm/mach-omap2/mmc-twl4030.c | 419 + arch/arm/mach-omap2/mmc-twl4030.h |4 +- arch/arm/plat-omap/include/plat/mmc.h |2 +- drivers/mmc/host/omap_hsmmc.c | 417 +++- 6 files changed, 419 insertions(+), 429 deletions(-) snip diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index cdd1f35..f3e31dc 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -162,6 +162,7 @@ u32 omap_ctrl_readl(u16 offset) { return __raw_readl(OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_readl); void omap_ctrl_writeb(u8 val, u16 offset) { @@ -177,6 +178,7 @@ void omap_ctrl_writel(u32 val, u16 offset) { __raw_writel(val, OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_writel); #if defined(CONFIG_ARCH_OMAP3) defined(CONFIG_PM) /* NAK, we don't want to export omap_ctrl_read/write. That will lead into a horrible mess again of all the drivers tinkering with the omap hardware registers directly. All code like that needs to stay under mach-omap2. This same mmc controller could in theory be used on other hardware too, not just omaps. The ctrl registers are omap specific, not mmc controller specific. Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/8] omap_hsmmc: move gpio and regulator control from board file
-Original Message- From: Adrian Hunter [mailto:adrian.hun...@nokia.com] Sent: Wednesday, January 13, 2010 5:40 AM To: Tony Lindgren Cc: linux-mmc Mailing List; Adrian Hunter; Andrew Morton; linux-omap Mailing List; Madhusudhan Chikkature Subject: [PATCH 1/8] omap_hsmmc: move gpio and regulator control from board file From c2ed3074a73fc13d088c53193af546c01d1061b1 Mon Sep 17 00:00:00 2001 From: Adrian Hunter adrian.hun...@nokia.com Date: Mon, 4 Jan 2010 13:44:36 +0200 Subject: [PATCH] omap_hsmmc: move gpio and regulator control from board file This patch moves the setup code for GPIO's and Voltage Regulators from the board file mmc-twl4030.c to the driver omap_hsmmc.c. Moving GPIO code to the driver makes the board initialisation code independent of when GPIO's are defined. That makes the board initialisation now entirely independent of its original twl4030 roots. Moving Voltage Regulator code to the driver allows for further development of regulator support in the core MMC code. It also permits the MMC core to be compiled as a module, because the board code no longer calls MMC core functions. Signed-off-by: Adrian Hunter adrian.hun...@nokia.com --- arch/arm/configs/rx51_defconfig |4 +- arch/arm/mach-omap2/control.c |2 + arch/arm/mach-omap2/mmc-twl4030.c | 419 +--- - arch/arm/mach-omap2/mmc-twl4030.h |4 +- arch/arm/plat-omap/include/plat/mmc.h |2 +- drivers/mmc/host/omap_hsmmc.c | 417 +++- 6 files changed, 419 insertions(+), 429 deletions(-) diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig index b6eeebb..426ae94 100644 --- a/arch/arm/configs/rx51_defconfig +++ b/arch/arm/configs/rx51_defconfig @@ -1354,7 +1354,7 @@ CONFIG_USB_OTG_UTILS=y # CONFIG_USB_GPIO_VBUS is not set # CONFIG_ISP1301_OMAP is not set CONFIG_TWL4030_USB=y -CONFIG_MMC=y +CONFIG_MMC=m # CONFIG_MMC_DEBUG is not set # CONFIG_MMC_UNSAFE_RESUME is not set @@ -1362,7 +1362,7 @@ CONFIG_MMC=y # MMC/SD/SDIO Card Drivers # CONFIG_MMC_BLOCK=m -CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_MMC_BLOCK_BOUNCE is not set # CONFIG_SDIO_UART is not set # CONFIG_MMC_TEST is not set diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index cdd1f35..f3e31dc 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -162,6 +162,7 @@ u32 omap_ctrl_readl(u16 offset) { return __raw_readl(OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_readl); void omap_ctrl_writeb(u8 val, u16 offset) { @@ -177,6 +178,7 @@ void omap_ctrl_writel(u32 val, u16 offset) { __raw_writel(val, OMAP_CTRL_REGADDR(offset)); } +EXPORT_SYMBOL(omap_ctrl_writel); #if defined(CONFIG_ARCH_OMAP3) defined(CONFIG_PM) /* diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc- twl4030.c index 0c3c72d..e846d56 100644 --- a/arch/arm/mach-omap2/mmc-twl4030.c +++ b/arch/arm/mach-omap2/mmc-twl4030.c @@ -9,195 +9,22 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include linux/err.h -#include linux/io.h -#include linux/module.h -#include linux/platform_device.h -#include linux/interrupt.h -#include linux/delay.h -#include linux/gpio.h -#include linux/mmc/host.h -#include linux/regulator/consumer.h - +#include linux/kernel.h +#include linux/slab.h +#include linux/string.h #include mach/hardware.h -#include plat/control.h #include plat/mmc.h -#include plat/board.h #include mmc-twl4030.h - -#if defined(CONFIG_REGULATOR) \ - (defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)) - -static u16 control_pbias_offset; -static u16 control_devconf1_offset; +#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) #define HSMMC_NAME_LEN 9 static struct twl_mmc_controller { - struct omap_mmc_platform_data *mmc; - /* Vcc == configured supply - * Vcc_alt == optional - * - MMC1, supply for DAT4..DAT7 - * - MMC2/MMC2, external level shifter voltage supply, for - * chip (SDIO, eMMC, etc) or transceiver (MMC2 only) - */ - struct regulator*vcc; - struct regulator*vcc_aux; charname[HSMMC_NAME_LEN + 1]; } hsmmc[OMAP34XX_NR_MMC]; -static int twl_mmc_card_detect(int irq) -{ - unsigned i; - - for (i = 0; i ARRAY_SIZE(hsmmc); i++) { - struct omap_mmc_platform_data *mmc; - - mmc = hsmmc[i].mmc; - if (!mmc) - continue; - if (irq != mmc-slots[0].card_detect_irq) - continue; - - /* NOTE: assumes card detect signal is active-low */ - return