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>
27 #include "devices-imx27.h"
29 #include "iomux-mx27.h"
31 static const int pcm970_pins[] __initconst = {
68 * it seems the data line misses a pullup, so we must enable
69 * the internal pullup as a local workaround
71 PD17_PF_I2C_DATA | GPIO_PUEN,
88 static int pcm970_sdhc2_get_ro(struct device *dev)
90 return gpio_get_value(GPIO_PORTC + 28);
93 static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
97 ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq,
98 IRQF_TRIGGER_FALLING, "imx-mmc-detect", data);
102 ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
104 free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
108 gpio_direction_input(GPIO_PORTC + 28);
113 static void pcm970_sdhc2_exit(struct device *dev, void *data)
115 free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
116 gpio_free(GPIO_PORTC + 28);
119 static const struct imxmmc_platform_data sdhc_pdata __initconst = {
120 .get_ro = pcm970_sdhc2_get_ro,
121 .init = pcm970_sdhc2_init,
122 .exit = pcm970_sdhc2_exit,
125 static struct imx_fb_videomode pcm970_modes[] = {
128 .name = "Sharp-LQ035Q7",
132 .pixclock = 188679, /* in ps (5.3MHz) */
141 * - HSYNC active high
142 * - VSYNC active high
143 * - clk notenabled while idle
144 * - clock not inverted
145 * - data not inverted
146 * - data enable low active
147 * - enable sharp mode
166 * - HSYNC active low (1 << 22)
167 * - VSYNC active low (1 << 23)
168 * - clk notenabled while idle
169 * - clock not inverted
170 * - data not inverted
171 * - data enable low active
172 * - enable sharp mode
174 .pcr = 0xF0008080 | (1<<22) | (1<<23) | (1<<19),
179 static const struct imx_fb_platform_data pcm038_fb_data __initconst = {
180 .mode = pcm970_modes,
181 .num_modes = ARRAY_SIZE(pcm970_modes),
188 static struct resource pcm970_sja1000_resources[] = {
190 .start = MX27_CS4_BASE_ADDR,
191 .end = MX27_CS4_BASE_ADDR + 0x100 - 1,
192 .flags = IORESOURCE_MEM,
194 /* irq number is run-time assigned */
195 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
199 static struct sja1000_platform_data pcm970_sja1000_platform_data = {
200 .osc_freq = 16000000,
201 .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
205 static struct platform_device pcm970_sja1000 = {
206 .name = "sja1000_platform",
208 .platform_data = &pcm970_sja1000_platform_data,
210 .resource = pcm970_sja1000_resources,
211 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
215 * system init for baseboard usage. Will be called by pcm038 init.
217 * Add platform devices present on this baseboard and init
218 * them from CPU side as far as required to use them later on
220 void __init pcm970_baseboard_init(void)
222 mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins),
225 imx27_add_imx_fb(&pcm038_fb_data);
226 mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
227 imx27_add_mxc_mmc(1, &sdhc_pdata);
228 pcm970_sja1000_resources[1].start = gpio_to_irq(IMX_GPIO_NR(5, 19));
229 pcm970_sja1000_resources[1].end = gpio_to_irq(IMX_GPIO_NR(5, 19));
230 platform_device_register(&pcm970_sja1000);