Full support for Ginger Console
[linux-ginger.git] / arch / arm / mach-mx2 / pcm970-baseboard.c
blobc261f59b0b4cf014c537af76b0d20b09d5a0a0d8
1 /*
2 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
19 #include <linux/gpio.h>
20 #include <linux/irq.h>
21 #include <linux/platform_device.h>
22 #include <linux/can/platform/sja1000.h>
24 #include <asm/mach/arch.h>
26 #include <mach/common.h>
27 #include <mach/iomux.h>
28 #include <mach/imxfb.h>
29 #include <mach/hardware.h>
30 #include <mach/mmc.h>
32 #include "devices.h"
34 static int pcm970_pins[] = {
35 /* SDHC */
36 PB4_PF_SD2_D0,
37 PB5_PF_SD2_D1,
38 PB6_PF_SD2_D2,
39 PB7_PF_SD2_D3,
40 PB8_PF_SD2_CMD,
41 PB9_PF_SD2_CLK,
42 GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN, /* card detect */
43 /* display */
44 PA5_PF_LSCLK,
45 PA6_PF_LD0,
46 PA7_PF_LD1,
47 PA8_PF_LD2,
48 PA9_PF_LD3,
49 PA10_PF_LD4,
50 PA11_PF_LD5,
51 PA12_PF_LD6,
52 PA13_PF_LD7,
53 PA14_PF_LD8,
54 PA15_PF_LD9,
55 PA16_PF_LD10,
56 PA17_PF_LD11,
57 PA18_PF_LD12,
58 PA19_PF_LD13,
59 PA20_PF_LD14,
60 PA21_PF_LD15,
61 PA22_PF_LD16,
62 PA23_PF_LD17,
63 PA24_PF_REV,
64 PA25_PF_CLS,
65 PA26_PF_PS,
66 PA27_PF_SPL_SPR,
67 PA28_PF_HSYNC,
68 PA29_PF_VSYNC,
69 PA30_PF_CONTRAST,
70 PA31_PF_OE_ACD,
72 * it seems the data line misses a pullup, so we must enable
73 * the internal pullup as a local workaround
75 PD17_PF_I2C_DATA | GPIO_PUEN,
76 PD18_PF_I2C_CLK,
77 /* Camera */
78 PB10_PF_CSI_D0,
79 PB11_PF_CSI_D1,
80 PB12_PF_CSI_D2,
81 PB13_PF_CSI_D3,
82 PB14_PF_CSI_D4,
83 PB15_PF_CSI_MCLK,
84 PB16_PF_CSI_PIXCLK,
85 PB17_PF_CSI_D5,
86 PB18_PF_CSI_D6,
87 PB19_PF_CSI_D7,
88 PB20_PF_CSI_VSYNC,
89 PB21_PF_CSI_HSYNC,
92 static int pcm970_sdhc2_get_ro(struct device *dev)
94 return gpio_get_value(GPIO_PORTC + 28);
97 static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
99 int ret;
101 ret = request_irq(IRQ_GPIOC(29), detect_irq, IRQF_TRIGGER_FALLING,
102 "imx-mmc-detect", data);
103 if (ret)
104 return ret;
106 ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
107 if (ret) {
108 free_irq(IRQ_GPIOC(29), data);
109 return ret;
112 gpio_direction_input(GPIO_PORTC + 28);
114 return 0;
117 static void pcm970_sdhc2_exit(struct device *dev, void *data)
119 free_irq(IRQ_GPIOC(29), data);
120 gpio_free(GPIO_PORTC + 28);
123 static struct imxmmc_platform_data sdhc_pdata = {
124 .get_ro = pcm970_sdhc2_get_ro,
125 .init = pcm970_sdhc2_init,
126 .exit = pcm970_sdhc2_exit,
129 static struct imx_fb_videomode pcm970_modes[] = {
131 .mode = {
132 .name = "Sharp-LQ035Q7",
133 .refresh = 60,
134 .xres = 240,
135 .yres = 320,
136 .pixclock = 188679, /* in ps (5.3MHz) */
137 .hsync_len = 7,
138 .left_margin = 5,
139 .right_margin = 16,
140 .vsync_len = 1,
141 .upper_margin = 7,
142 .lower_margin = 9,
145 * - HSYNC active high
146 * - VSYNC active high
147 * - clk notenabled while idle
148 * - clock not inverted
149 * - data not inverted
150 * - data enable low active
151 * - enable sharp mode
153 .pcr = 0xF00080C0,
154 .bpp = 16,
155 }, {
156 .mode = {
157 .name = "TX090",
158 .refresh = 60,
159 .xres = 240,
160 .yres = 320,
161 .pixclock = 38255,
162 .left_margin = 144,
163 .right_margin = 0,
164 .upper_margin = 7,
165 .lower_margin = 40,
166 .hsync_len = 96,
167 .vsync_len = 1,
170 * - HSYNC active low (1 << 22)
171 * - VSYNC active low (1 << 23)
172 * - clk notenabled while idle
173 * - clock not inverted
174 * - data not inverted
175 * - data enable low active
176 * - enable sharp mode
178 .pcr = 0xF0008080 | (1<<22) | (1<<23) | (1<<19),
179 .bpp = 32,
183 static struct imx_fb_platform_data pcm038_fb_data = {
184 .mode = pcm970_modes,
185 .num_modes = ARRAY_SIZE(pcm970_modes),
187 .pwmr = 0x00A903FF,
188 .lscr1 = 0x00120300,
189 .dmacr = 0x00020010,
192 static struct resource pcm970_sja1000_resources[] = {
194 .start = CS4_BASE_ADDR,
195 .end = CS4_BASE_ADDR + 0x100 - 1,
196 .flags = IORESOURCE_MEM,
197 }, {
198 .start = IRQ_GPIOE(19),
199 .end = IRQ_GPIOE(19),
200 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
204 struct sja1000_platform_data pcm970_sja1000_platform_data = {
205 .clock = 16000000 / 2,
206 .ocr = 0x40 | 0x18,
207 .cdr = 0x40,
210 static struct platform_device pcm970_sja1000 = {
211 .name = "sja1000_platform",
212 .dev = {
213 .platform_data = &pcm970_sja1000_platform_data,
215 .resource = pcm970_sja1000_resources,
216 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
220 * system init for baseboard usage. Will be called by pcm038 init.
222 * Add platform devices present on this baseboard and init
223 * them from CPU side as far as required to use them later on
225 void __init pcm970_baseboard_init(void)
227 mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins),
228 "PCM970");
230 mxc_register_device(&mxc_fb_device, &pcm038_fb_data);
231 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
232 platform_device_register(&pcm970_sja1000);