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/hardware.h>
29 #include "devices-imx27.h"
30 #include "iomux-mx27.h"
32 static const int pcm970_pins[] __initconst = {
69 * it seems the data line misses a pullup, so we must enable
70 * the internal pullup as a local workaround
72 PD17_PF_I2C_DATA | GPIO_PUEN,
89 static int pcm970_sdhc2_get_ro(struct device *dev)
91 return gpio_get_value(GPIO_PORTC + 28);
94 static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
98 ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq,
99 IRQF_TRIGGER_FALLING, "imx-mmc-detect", data);
103 ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
105 free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
109 gpio_direction_input(GPIO_PORTC + 28);
114 static void pcm970_sdhc2_exit(struct device *dev, void *data)
116 free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
117 gpio_free(GPIO_PORTC + 28);
120 static const struct imxmmc_platform_data sdhc_pdata __initconst = {
121 .get_ro = pcm970_sdhc2_get_ro,
122 .init = pcm970_sdhc2_init,
123 .exit = pcm970_sdhc2_exit,
126 static struct imx_fb_videomode pcm970_modes[] = {
129 .name = "Sharp-LQ035Q7",
133 .pixclock = 188679, /* in ps (5.3MHz) */
142 * - HSYNC active high
143 * - VSYNC active high
144 * - clk notenabled while idle
145 * - clock not inverted
146 * - data not inverted
147 * - data enable low active
148 * - enable sharp mode
167 * - HSYNC active low (1 << 22)
168 * - VSYNC active low (1 << 23)
169 * - clk notenabled while idle
170 * - clock not inverted
171 * - data not inverted
172 * - data enable low active
173 * - enable sharp mode
175 .pcr = 0xF0008080 | (1<<22) | (1<<23) | (1<<19),
180 static const struct imx_fb_platform_data pcm038_fb_data __initconst = {
181 .mode = pcm970_modes,
182 .num_modes = ARRAY_SIZE(pcm970_modes),
189 static struct resource pcm970_sja1000_resources[] = {
191 .start = MX27_CS4_BASE_ADDR,
192 .end = MX27_CS4_BASE_ADDR + 0x100 - 1,
193 .flags = IORESOURCE_MEM,
195 /* irq number is run-time assigned */
196 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
200 static struct sja1000_platform_data pcm970_sja1000_platform_data = {
201 .osc_freq = 16000000,
202 .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
206 static struct platform_device pcm970_sja1000 = {
207 .name = "sja1000_platform",
209 .platform_data = &pcm970_sja1000_platform_data,
211 .resource = pcm970_sja1000_resources,
212 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
216 * system init for baseboard usage. Will be called by pcm038 init.
218 * Add platform devices present on this baseboard and init
219 * them from CPU side as far as required to use them later on
221 void __init pcm970_baseboard_init(void)
223 mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins),
226 imx27_add_imx_fb(&pcm038_fb_data);
227 mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
228 imx27_add_mxc_mmc(1, &sdhc_pdata);
229 pcm970_sja1000_resources[1].start = gpio_to_irq(IMX_GPIO_NR(5, 19));
230 pcm970_sja1000_resources[1].end = gpio_to_irq(IMX_GPIO_NR(5, 19));
231 platform_device_register(&pcm970_sja1000);