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,
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>
34 static int pcm970_pins
[] = {
42 GPIO_PORTC
| 28 | GPIO_GPIO
| GPIO_IN
, /* card detect */
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
,
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
)
101 ret
= request_irq(IRQ_GPIOC(29), detect_irq
, IRQF_TRIGGER_FALLING
,
102 "imx-mmc-detect", data
);
106 ret
= gpio_request(GPIO_PORTC
+ 28, "imx-mmc-ro");
108 free_irq(IRQ_GPIOC(29), data
);
112 gpio_direction_input(GPIO_PORTC
+ 28);
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
[] = {
132 .name
= "Sharp-LQ035Q7",
136 .pixclock
= 188679, /* in ps (5.3MHz) */
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
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),
183 static struct imx_fb_platform_data pcm038_fb_data
= {
184 .mode
= pcm970_modes
,
185 .num_modes
= ARRAY_SIZE(pcm970_modes
),
192 static struct resource pcm970_sja1000_resources
[] = {
194 .start
= CS4_BASE_ADDR
,
195 .end
= CS4_BASE_ADDR
+ 0x100 - 1,
196 .flags
= IORESOURCE_MEM
,
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,
210 static struct platform_device pcm970_sja1000
= {
211 .name
= "sja1000_platform",
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
),
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
);