diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-04-16 09:45:45 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-05-07 10:19:38 -0400 |
commit | f231ea441a6e4b025d971b023ff010094626fdb0 (patch) | |
tree | 1c5e0803598929aaa7fa4066054c111353cebd2a /arch/arm/mach-mx2/pcm970-baseboard.c | |
parent | 60c24dc79f01edfaa14290ada39a9074050ffbcc (diff) |
pcm038: Setup all iomux pins at once
Also, remove usage of set_irq_type after request_irq.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx2/pcm970-baseboard.c')
-rw-r--r-- | arch/arm/mach-mx2/pcm970-baseboard.c | 113 |
1 files changed, 64 insertions, 49 deletions
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-mx2/pcm970-baseboard.c index 16f33443efc1..6dcd625f3f40 100644 --- a/arch/arm/mach-mx2/pcm970-baseboard.c +++ b/arch/arm/mach-mx2/pcm970-baseboard.c | |||
@@ -30,57 +30,93 @@ | |||
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,27 +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 void pcm038_fb_exit(struct platform_device *pdev) | ||
109 | { | ||
110 | mxc_gpio_release_multiple_pins(mxc_fb_pins, ARRAY_SIZE(mxc_fb_pins)); | ||
111 | } | ||
112 | |||
113 | /* | 128 | /* |
114 | * Connected is a portrait Sharp-QVGA display | 129 | * Connected is a portrait Sharp-QVGA display |
115 | * of type: LQ035Q7DH06 | 130 | * of type: LQ035Q7DH06 |
@@ -142,9 +157,6 @@ static struct imx_fb_platform_data pcm038_fb_data = { | |||
142 | .pwmr = 0x00A903FF, | 157 | .pwmr = 0x00A903FF, |
143 | .lscr1 = 0x00120300, | 158 | .lscr1 = 0x00120300, |
144 | .dmacr = 0x00020010, | 159 | .dmacr = 0x00020010, |
145 | |||
146 | .init = pcm038_fb_init, | ||
147 | .exit = pcm038_fb_exit, | ||
148 | }; | 160 | }; |
149 | 161 | ||
150 | /* | 162 | /* |
@@ -155,6 +167,9 @@ static struct imx_fb_platform_data pcm038_fb_data = { | |||
155 | */ | 167 | */ |
156 | void __init pcm970_baseboard_init(void) | 168 | void __init pcm970_baseboard_init(void) |
157 | { | 169 | { |
170 | mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins), | ||
171 | "PCM970"); | ||
172 | |||
158 | mxc_register_device(&mxc_fb_device, &pcm038_fb_data); | 173 | mxc_register_device(&mxc_fb_device, &pcm038_fb_data); |
159 | mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); | 174 | mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); |
160 | } | 175 | } |