diff options
Diffstat (limited to 'arch/arm/mach-mx2/pcm970-baseboard.c')
| -rw-r--r-- | arch/arm/mach-mx2/pcm970-baseboard.c | 123 |
1 files changed, 68 insertions, 55 deletions
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-mx2/pcm970-baseboard.c index bf4e520bc1bc..6a3acaf57dd4 100644 --- a/arch/arm/mach-mx2/pcm970-baseboard.c +++ b/arch/arm/mach-mx2/pcm970-baseboard.c | |||
| @@ -16,71 +16,107 @@ | |||
| 16 | * MA 02110-1301, USA. | 16 | * MA 02110-1301, USA. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/platform_device.h> | ||
| 20 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
| 21 | #include <linux/irq.h> | 20 | #include <linux/irq.h> |
| 21 | #include <linux/platform_device.h> | ||
| 22 | 22 | ||
| 23 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
| 24 | 24 | ||
| 25 | #include <mach/hardware.h> | ||
| 26 | #include <mach/common.h> | 25 | #include <mach/common.h> |
| 27 | #include <mach/mmc.h> | ||
| 28 | #include <mach/imxfb.h> | ||
| 29 | #include <mach/iomux.h> | 26 | #include <mach/iomux.h> |
| 27 | #include <mach/imxfb.h> | ||
| 28 | #include <mach/hardware.h> | ||
| 29 | #include <mach/mmc.h> | ||
| 30 | 30 | ||
| 31 | #include "devices.h" | 31 | #include "devices.h" |
| 32 | 32 | ||
| 33 | static int pcm970_sdhc2_get_ro(struct device *dev) | 33 | static int pcm970_pins[] = { |
| 34 | { | 34 | /* SDHC */ |
| 35 | return gpio_get_value(GPIO_PORTC + 28); | ||
| 36 | } | ||
| 37 | |||
| 38 | static int pcm970_sdhc2_pins[] = { | ||
| 39 | PB4_PF_SD2_D0, | 35 | PB4_PF_SD2_D0, |
| 40 | PB5_PF_SD2_D1, | 36 | PB5_PF_SD2_D1, |
| 41 | PB6_PF_SD2_D2, | 37 | PB6_PF_SD2_D2, |
| 42 | PB7_PF_SD2_D3, | 38 | PB7_PF_SD2_D3, |
| 43 | PB8_PF_SD2_CMD, | 39 | PB8_PF_SD2_CMD, |
| 44 | PB9_PF_SD2_CLK, | 40 | PB9_PF_SD2_CLK, |
| 41 | GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN, /* card detect */ | ||
| 42 | /* display */ | ||
| 43 | PA5_PF_LSCLK, | ||
| 44 | PA6_PF_LD0, | ||
| 45 | PA7_PF_LD1, | ||
| 46 | PA8_PF_LD2, | ||
| 47 | PA9_PF_LD3, | ||
| 48 | PA10_PF_LD4, | ||
| 49 | PA11_PF_LD5, | ||
| 50 | PA12_PF_LD6, | ||
| 51 | PA13_PF_LD7, | ||
| 52 | PA14_PF_LD8, | ||
| 53 | PA15_PF_LD9, | ||
| 54 | PA16_PF_LD10, | ||
| 55 | PA17_PF_LD11, | ||
| 56 | PA18_PF_LD12, | ||
| 57 | PA19_PF_LD13, | ||
| 58 | PA20_PF_LD14, | ||
| 59 | PA21_PF_LD15, | ||
| 60 | PA22_PF_LD16, | ||
| 61 | PA23_PF_LD17, | ||
| 62 | PA24_PF_REV, | ||
| 63 | PA25_PF_CLS, | ||
| 64 | PA26_PF_PS, | ||
| 65 | PA27_PF_SPL_SPR, | ||
| 66 | PA28_PF_HSYNC, | ||
| 67 | PA29_PF_VSYNC, | ||
| 68 | PA30_PF_CONTRAST, | ||
| 69 | PA31_PF_OE_ACD, | ||
| 70 | /* | ||
| 71 | * it seems the data line misses a pullup, so we must enable | ||
| 72 | * the internal pullup as a local workaround | ||
| 73 | */ | ||
| 74 | PD17_PF_I2C_DATA | GPIO_PUEN, | ||
| 75 | PD18_PF_I2C_CLK, | ||
| 76 | /* Camera */ | ||
| 77 | PB10_PF_CSI_D0, | ||
| 78 | PB11_PF_CSI_D1, | ||
| 79 | PB12_PF_CSI_D2, | ||
| 80 | PB13_PF_CSI_D3, | ||
| 81 | PB14_PF_CSI_D4, | ||
| 82 | PB15_PF_CSI_MCLK, | ||
| 83 | PB16_PF_CSI_PIXCLK, | ||
| 84 | PB17_PF_CSI_D5, | ||
| 85 | PB18_PF_CSI_D6, | ||
| 86 | PB19_PF_CSI_D7, | ||
| 87 | PB20_PF_CSI_VSYNC, | ||
| 88 | PB21_PF_CSI_HSYNC, | ||
| 45 | }; | 89 | }; |
| 46 | 90 | ||
| 91 | static int pcm970_sdhc2_get_ro(struct device *dev) | ||
| 92 | { | ||
| 93 | return gpio_get_value(GPIO_PORTC + 28); | ||
| 94 | } | ||
| 95 | |||
| 47 | static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data) | 96 | static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data) |
| 48 | { | 97 | { |
| 49 | int ret; | 98 | int ret; |
| 50 | 99 | ||
| 51 | ret = mxc_gpio_setup_multiple_pins(pcm970_sdhc2_pins, | 100 | ret = request_irq(IRQ_GPIOC(29), detect_irq, IRQF_TRIGGER_FALLING, |
| 52 | ARRAY_SIZE(pcm970_sdhc2_pins), "sdhc2"); | ||
| 53 | if(ret) | ||
| 54 | return ret; | ||
| 55 | |||
| 56 | ret = request_irq(IRQ_GPIOC(29), detect_irq, 0, | ||
| 57 | "imx-mmc-detect", data); | 101 | "imx-mmc-detect", data); |
| 58 | if (ret) | 102 | if (ret) |
| 59 | goto out_release_gpio; | 103 | return ret; |
| 60 | |||
| 61 | set_irq_type(IRQ_GPIOC(29), IRQF_TRIGGER_FALLING); | ||
| 62 | 104 | ||
| 63 | ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro"); | 105 | ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro"); |
| 64 | if (ret) | 106 | if (ret) { |
| 65 | goto out_release_gpio; | 107 | free_irq(IRQ_GPIOC(29), data); |
| 108 | return ret; | ||
| 109 | } | ||
| 66 | 110 | ||
| 67 | mxc_gpio_mode((GPIO_PORTC | 28) | GPIO_GPIO | GPIO_IN); | ||
| 68 | gpio_direction_input(GPIO_PORTC + 28); | 111 | gpio_direction_input(GPIO_PORTC + 28); |
| 69 | 112 | ||
| 70 | return 0; | 113 | return 0; |
| 71 | |||
| 72 | out_release_gpio: | ||
| 73 | mxc_gpio_release_multiple_pins(pcm970_sdhc2_pins, | ||
| 74 | ARRAY_SIZE(pcm970_sdhc2_pins)); | ||
| 75 | return ret; | ||
| 76 | } | 114 | } |
| 77 | 115 | ||
| 78 | static void pcm970_sdhc2_exit(struct device *dev, void *data) | 116 | static void pcm970_sdhc2_exit(struct device *dev, void *data) |
| 79 | { | 117 | { |
| 80 | free_irq(IRQ_GPIOC(29), data); | 118 | free_irq(IRQ_GPIOC(29), data); |
| 81 | gpio_free(GPIO_PORTC + 28); | 119 | gpio_free(GPIO_PORTC + 28); |
| 82 | mxc_gpio_release_multiple_pins(pcm970_sdhc2_pins, | ||
| 83 | ARRAY_SIZE(pcm970_sdhc2_pins)); | ||
| 84 | } | 120 | } |
| 85 | 121 | ||
| 86 | static struct imxmmc_platform_data sdhc_pdata = { | 122 | static struct imxmmc_platform_data sdhc_pdata = { |
| @@ -89,29 +125,6 @@ static struct imxmmc_platform_data sdhc_pdata = { | |||
| 89 | .exit = pcm970_sdhc2_exit, | 125 | .exit = pcm970_sdhc2_exit, |
| 90 | }; | 126 | }; |
| 91 | 127 | ||
| 92 | static int mxc_fb_pins[] = { | ||
| 93 | PA5_PF_LSCLK, PA6_PF_LD0, PA7_PF_LD1, PA8_PF_LD2, | ||
| 94 | PA9_PF_LD3, PA10_PF_LD4, PA11_PF_LD5, PA12_PF_LD6, | ||
| 95 | PA13_PF_LD7, PA14_PF_LD8, PA15_PF_LD9, PA16_PF_LD10, | ||
| 96 | PA17_PF_LD11, PA18_PF_LD12, PA19_PF_LD13, PA20_PF_LD14, | ||
| 97 | PA21_PF_LD15, PA22_PF_LD16, PA23_PF_LD17, PA24_PF_REV, | ||
| 98 | PA25_PF_CLS, PA26_PF_PS, PA27_PF_SPL_SPR, PA28_PF_HSYNC, | ||
| 99 | PA29_PF_VSYNC, PA30_PF_CONTRAST, PA31_PF_OE_ACD | ||
| 100 | }; | ||
| 101 | |||
| 102 | static int pcm038_fb_init(struct platform_device *pdev) | ||
| 103 | { | ||
| 104 | return mxc_gpio_setup_multiple_pins(mxc_fb_pins, | ||
| 105 | ARRAY_SIZE(mxc_fb_pins), "FB"); | ||
| 106 | } | ||
| 107 | |||
| 108 | static int pcm038_fb_exit(struct platform_device *pdev) | ||
| 109 | { | ||
| 110 | mxc_gpio_release_multiple_pins(mxc_fb_pins, ARRAY_SIZE(mxc_fb_pins)); | ||
| 111 | |||
| 112 | return 0; | ||
| 113 | } | ||
| 114 | |||
| 115 | /* | 128 | /* |
| 116 | * Connected is a portrait Sharp-QVGA display | 129 | * Connected is a portrait Sharp-QVGA display |
| 117 | * of type: LQ035Q7DH06 | 130 | * of type: LQ035Q7DH06 |
| @@ -144,9 +157,6 @@ static struct imx_fb_platform_data pcm038_fb_data = { | |||
| 144 | .pwmr = 0x00A903FF, | 157 | .pwmr = 0x00A903FF, |
| 145 | .lscr1 = 0x00120300, | 158 | .lscr1 = 0x00120300, |
| 146 | .dmacr = 0x00020010, | 159 | .dmacr = 0x00020010, |
| 147 | |||
| 148 | .init = pcm038_fb_init, | ||
| 149 | .exit = pcm038_fb_exit, | ||
| 150 | }; | 160 | }; |
| 151 | 161 | ||
| 152 | /* | 162 | /* |
| @@ -157,6 +167,9 @@ static struct imx_fb_platform_data pcm038_fb_data = { | |||
| 157 | */ | 167 | */ |
| 158 | void __init pcm970_baseboard_init(void) | 168 | void __init pcm970_baseboard_init(void) |
| 159 | { | 169 | { |
| 170 | mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins), | ||
| 171 | "PCM970"); | ||
| 172 | |||
| 160 | mxc_register_device(&mxc_fb_device, &pcm038_fb_data); | 173 | mxc_register_device(&mxc_fb_device, &pcm038_fb_data); |
| 161 | mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); | 174 | mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); |
| 162 | } | 175 | } |
