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-mx27.h>
28 #include <mach/hardware.h>
30 #include "devices-imx27.h"
33 static const int pcm970_pins[] __initconst = {
70 * it seems the data line misses a pullup, so we must enable
71 * the internal pullup as a local workaround
73 PD17_PF_I2C_DATA | GPIO_PUEN,
90 static int pcm970_sdhc2_get_ro(struct device *dev)
92 return gpio_get_value(GPIO_PORTC + 28);
95 static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
99 ret = request_irq(IRQ_GPIOC(29), detect_irq, IRQF_TRIGGER_FALLING,
100 "imx-mmc-detect", data);
104 ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
106 free_irq(IRQ_GPIOC(29), data);
110 gpio_direction_input(GPIO_PORTC + 28);
115 static void pcm970_sdhc2_exit(struct device *dev, void *data)
117 free_irq(IRQ_GPIOC(29), data);
118 gpio_free(GPIO_PORTC + 28);
121 static const struct imxmmc_platform_data sdhc_pdata __initconst = {
122 .get_ro = pcm970_sdhc2_get_ro,
123 .init = pcm970_sdhc2_init,
124 .exit = pcm970_sdhc2_exit,
127 static struct imx_fb_videomode pcm970_modes[] = {
130 .name = "Sharp-LQ035Q7",
134 .pixclock = 188679, /* in ps (5.3MHz) */
143 * - HSYNC active high
144 * - VSYNC active high
145 * - clk notenabled while idle
146 * - clock not inverted
147 * - data not inverted
148 * - data enable low active
149 * - enable sharp mode
168 * - HSYNC active low (1 << 22)
169 * - VSYNC active low (1 << 23)
170 * - clk notenabled while idle
171 * - clock not inverted
172 * - data not inverted
173 * - data enable low active
174 * - enable sharp mode
176 .pcr = 0xF0008080 | (1<<22) | (1<<23) | (1<<19),
181 static const struct imx_fb_platform_data pcm038_fb_data __initconst = {
182 .mode = pcm970_modes,
183 .num_modes = ARRAY_SIZE(pcm970_modes),
190 static struct resource pcm970_sja1000_resources[] = {
192 .start = MX27_CS4_BASE_ADDR,
193 .end = MX27_CS4_BASE_ADDR + 0x100 - 1,
194 .flags = IORESOURCE_MEM,
196 .start = IRQ_GPIOE(19),
197 .end = IRQ_GPIOE(19),
198 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
202 static struct sja1000_platform_data pcm970_sja1000_platform_data = {
203 .osc_freq = 16000000,
204 .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
208 static struct platform_device pcm970_sja1000 = {
209 .name = "sja1000_platform",
211 .platform_data = &pcm970_sja1000_platform_data,
213 .resource = pcm970_sja1000_resources,
214 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
218 * system init for baseboard usage. Will be called by pcm038 init.
220 * Add platform devices present on this baseboard and init
221 * them from CPU side as far as required to use them later on
223 void __init pcm970_baseboard_init(void)
225 mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins),
228 imx27_add_imx_fb(&pcm038_fb_data);
229 mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
230 imx27_add_mxc_mmc(1, &sdhc_pdata);
231 platform_device_register(&pcm970_sja1000);