imx: mach-bug: add sdio platform data
Subsystems (3)
PATCH 1/1 imx: mach-bug: add sdio platform data
--- arch/arm/mach-imx/mach-bug.c | 106 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 106 insertions(+), 0 deletions(-)
arch/arm/mach-imx/mach-bug.c +106 -0
@@ -22,6 +22,8 @@#include <mach/iomux-mx3.h> #include <mach/hardware.h> #include <mach/common.h> +#include <mach/gpio.h> +#include <mach/mx31.h> #include <asm/mach/time.h> #include <asm/mach/arch.h>
@@ -40,11 +42,115 @@ static const unsigned int bug_pins[] __initconst = { MX31_PIN_PC_BVD1__RXD5, }; +static int sdhc1_pins[] = { +MX31_PIN_SD1_DATA3__SD1_DATA3 , +MX31_PIN_SD1_DATA2__SD1_DATA2 , +MX31_PIN_SD1_DATA1__SD1_DATA1 , +MX31_PIN_SD1_DATA0__SD1_DATA0 , +MX31_PIN_SD1_CLK__SD1_CLK , +MX31_PIN_SD1_CMD__SD1_CMD , +}; + +static int sdhc2_pins[] = { +MX31_PIN_PC_PWRON__SD2_DATA3 , +MX31_PIN_PC_VS1__SD2_DATA2 , +MX31_PIN_PC_READY__SD2_DATA1 , +MX31_PIN_PC_WAIT_B__SD2_DATA0 , +MX31_PIN_PC_CD2_B__SD2_CLK , +MX31_PIN_PC_CD1_B__SD2_CMD , +}; + +static int mxc_bug_sdhc1_init (struct device *dev,irq_handler_t h,void *data) +{ +return mxc_iomux_setup_multiple_pins (sdhc1_pins,ARRAY_SIZE (sdhc1_pins), +"sdhc-1" ); +} + +static void mxc_bug_sdhc1_exit (struct device *dev,void *data) +{ +mxc_iomux_release_multiple_pins (sdhc1_pins,ARRAY_SIZE (sdhc1_pins)); +} + +static int mxc_bug_sdhc2_init (struct device *dev,irq_handler_t h,void *data) +{ +return mxc_iomux_setup_multiple_pins (sdhc2_pins,ARRAY_SIZE (sdhc2_pins), +"sdhc-2" ); +} + +static void mxc_bug_sdhc2_exit (struct device *dev,void *data) +{ +mxc_iomux_release_multiple_pins (sdhc2_pins,ARRAY_SIZE (sdhc2_pins)); +} + +/* No card and rw detection at the moment */ +static struct imxmmc_platform_data sdhc1_pdata = { + .init = mxc_bug_sdhc1_init, + .exit = mxc_bug_sdhc1_exit, + .ocr_avail =MMC_VDD_27_28 |MMC_VDD_28_29 |MMC_VDD_29_30 | +MMC_VDD_32_33 |MMC_VDD_33_34 , +}; + +static struct imxmmc_platform_data sdhc2_pdata = { + .init = mxc_bug_sdhc2_init, + .exit = mxc_bug_sdhc2_exit, +}; + + +static struct resource mxcsdhc0_resources[] = { + { + .start =MX31_SDHC1_BASE_ADDR , + .end =MX31_SDHC1_BASE_ADDR +SZ_16K -1 , + .flags =IORESOURCE_MEM , + }, { + .start =MX31_INT_SDHC1 , + .end =MX31_INT_SDHC1 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource mxcsdhc1_resources[] = { + { + .start =MX31_SDHC2_BASE_ADDR , + .end =MX31_SDHC2_BASE_ADDR +SZ_16K -1 , + .flags =IORESOURCE_MEM , + }, { + .start =MX31_INT_SDHC2 , + .end =MX31_INT_SDHC2 , + .flags =IORESOURCE_IRQ , + }, +}; + +struct platform_device mxcsdhc_device0 = { + .name ="mxc-mmc" , + .id =0 , + .num_resources =ARRAY_SIZE (mxcsdhc0_resources), + .resource = mxcsdhc0_resources, +}; + +struct platform_device mxcsdhc_device1 = { + .name ="mxc-mmc" , + .id =1 , + .num_resources =ARRAY_SIZE (mxcsdhc1_resources), + .resource = mxcsdhc1_resources, +}; +static void __init bug_board_init (void ) {mxc_iomux_setup_multiple_pins (bug_pins,ARRAY_SIZE (bug_pins),"uart-4" );imx31_add_imx_uart4 (&uart_pdata); + +/* Turn off Wifi by default */ +if ( !mxc_iomux_alloc_pin ( +IOMUX_MODE (MX31_PIN_USB_BYP ,IOMUX_CONFIG_GPIO ),"bug-wifi" ) + ){ +if (!gpio_request (IOMUX_TO_GPIO (MX31_PIN_USB_BYP ), +"bug-wifi" )) +gpio_direction_output (IOMUX_TO_GPIO ( +MX31_PIN_USB_BYP ),0 ); + } +mxc_register_device (&mxcsdhc_device0, &sdhc1_pdata); +mxc_register_device (&mxcsdhc_device1, &sdhc2_pdata); }static void __init bug_timer_init (void )
Signature · 1 line
1.7.1
PATCH 1/1 imx: mach-bug: add sdio platform data
Hello Denis,
Quoted 34 lines · Denis 'GNUtoo' Carikli
Signed-off-by Denis 'GNUtoo' Carikli <[email protected]>--- arch/arm/mach-imx/mach-bug.c | 106 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 106 insertions(+), 0 deletions(-)arch/arm/mach-imx/mach-bug.c +14
-0@@ -22,6 +22,8 @@#include <mach/iomux-mx3.h> #include <mach/hardware.h> #include <mach/common.h> +#include <mach/gpio.h> +#include <mach/mx31.h> #include <asm/mach/time.h> #include <asm/mach/arch.h> @@ -40,11 +42,115 @@ static const unsigned int bug_pins[] __initconst = { MX31_PIN_PC_BVD1__RXD5, }; +static int sdhc1_pins[] = { +MX31_PIN_SD1_DATA3__SD1_DATA3 , +MX31_PIN_SD1_DATA2__SD1_DATA2 , +MX31_PIN_SD1_DATA1__SD1_DATA1 , +MX31_PIN_SD1_DATA0__SD1_DATA0 , +MX31_PIN_SD1_CLK__SD1_CLK , +MX31_PIN_SD1_CMD__SD1_CMD , +}; + +static int sdhc2_pins[] = { +MX31_PIN_PC_PWRON__SD2_DATA3 , +MX31_PIN_PC_VS1__SD2_DATA2 ,
arch/arm/mach-imx/mach-bug.c static const unsigned int bug_pins[] __initconst = { · line 66
Quoted 10 lines
arch/arm/mach-imx/mach-bug.c +10
-0+MX31_PIN_PC_READY__SD2_DATA1 , +MX31_PIN_PC_WAIT_B__SD2_DATA0 , +MX31_PIN_PC_CD2_B__SD2_CLK , + MX31_PIN_PC_CD1_B__SD2_CMD, +}; + +static int mxc_bug_sdhc1_init (struct device *dev,irq_handler_t h,void *data) +{ +return mxc_iomux_setup_multiple_pins (sdhc1_pins,ARRAY_SIZE (sdhc1_pins), +"sdhc-1" );
Why not adding these to the static list and just make init and exit empty?
Quoted 14 lines
arch/arm/mach-imx/mach-bug.c +14
-0+} + +static void mxc_bug_sdhc1_exit (struct device *dev,void *data) +{ +mxc_iomux_release_multiple_pins (sdhc1_pins,ARRAY_SIZE (sdhc1_pins)); +} + +static int mxc_bug_sdhc2_init (struct device *dev,irq_handler_t h,void *data) +{ +return mxc_iomux_setup_multiple_pins (sdhc2_pins,ARRAY_SIZE (sdhc2_pins), +"sdhc-2" ); +} + +static void mxc_bug_sdhc2_exit (struct device *dev,void *data)
arch/arm/mach-imx/mach-bug.c static const unsigned int bug_pins[] __initconst = { · line 90
Quoted 10 lines
arch/arm/mach-imx/mach-bug.c +10
-0+{ +mxc_iomux_release_multiple_pins (sdhc2_pins,ARRAY_SIZE (sdhc2_pins)); +} + +/* No card and rw detection at the moment */ +static struct imxmmc_platform_data sdhc1_pdata = { + .init = mxc_bug_sdhc1_init, + .exit = mxc_bug_sdhc1_exit, + .ocr_avail =MMC_VDD_27_28 |MMC_VDD_28_29 |MMC_VDD_29_30 | +MMC_VDD_32_33 |MMC_VDD_33_34 ,
Please indent this line a bit further. Should be const and __initconst.
arch/arm/mach-imx/mach-bug.c static const unsigned int bug_pins[] __initconst = { · line 96
Quoted 6 lines
arch/arm/mach-imx/mach-bug.c +6
-0+}; + +static struct imxmmc_platform_data sdhc2_pdata = { + .init = mxc_bug_sdhc2_init, + .exit = mxc_bug_sdhc2_exit, +};
const and __initconst
arch/arm/mach-imx/mach-bug.c static const unsigned int bug_pins[] __initconst = { · line 98
Quoted 2 lines
arch/arm/mach-imx/mach-bug.c +2
-0+ +
one nl is enough.
Quoted 27 lines
arch/arm/mach-imx/mach-bug.c +27
-0+static struct resource mxcsdhc0_resources[] = { + { + .start =MX31_SDHC1_BASE_ADDR , + .end =MX31_SDHC1_BASE_ADDR +SZ_16K -1 , + .flags =IORESOURCE_MEM , + }, { + .start =MX31_INT_SDHC1 , + .end =MX31_INT_SDHC1 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource mxcsdhc1_resources[] = { + { + .start =MX31_SDHC2_BASE_ADDR , + .end =MX31_SDHC2_BASE_ADDR +SZ_16K -1 , + .flags =IORESOURCE_MEM , + }, { + .start =MX31_INT_SDHC2 , + .end =MX31_INT_SDHC2 , + .flags =IORESOURCE_IRQ , + }, +}; + +struct platform_device mxcsdhc_device0 = { + .name ="mxc-mmc" , + .id =0 ,
arch/arm/mach-imx/mach-bug.c static const unsigned int bug_pins[] __initconst = { · line 135
Quoted 10 lines
arch/arm/mach-imx/mach-bug.c +10
-0+ .num_resources = ARRAY_SIZE(mxcsdhc0_resources), + .resource = mxcsdhc0_resources, +}; + +struct platform_device mxcsdhc_device1 = { + .name ="mxc-mmc" , + .id =1 , + .num_resources =ARRAY_SIZE (mxcsdhc1_resources), + .resource = mxcsdhc1_resources, +};
Nooooooooooooooooooooooooooooooooooooooo ...
Quoted 7 lines
arch/arm/mach-imx/mach-bug.c +2
-0+static void __init bug_board_init (void ) {mxc_iomux_setup_multiple_pins (bug_pins,ARRAY_SIZE (bug_pins),"uart-4" );imx31_add_imx_uart4 (&uart_pdata); +
arch/arm/mach-imx/mach-bug.c static const unsigned int bug_pins[] __initconst = { · line 152
Quoted 10 lines
arch/arm/mach-imx/mach-bug.c +10
-0+/* Turn off Wifi by default */ +if ( !mxc_iomux_alloc_pin ( +IOMUX_MODE (MX31_PIN_USB_BYP ,IOMUX_CONFIG_GPIO ),"bug-wifi" ) + ){ +if (!gpio_request (IOMUX_TO_GPIO (MX31_PIN_USB_BYP ), +"bug-wifi" )) +gpio_direction_output (IOMUX_TO_GPIO ( +MX31_PIN_USB_BYP ),0 ); + } +mxc_register_device (&mxcsdhc_device0, &sdhc1_pdata);
imx31_add_mxc_mmc(0, &sdhc1_pdata); please
Quoted 8 lines
arch/arm/mach-imx/mach-bug.c +1
-0+mxc_register_device (&mxcsdhc_device1, &sdhc2_pdata); }static void __init bug_timer_init (void )Signature · 1 line
1.7.1
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |