]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/arm/mach-pxa/colibri-pxa300.c
ARM: pxa: Push Colibri evalboard MFP into module files
[mirror_ubuntu-bionic-kernel.git] / arch / arm / mach-pxa / colibri-pxa300.c
CommitLineData
5fc9f9a1
DM
1/*
2 * arch/arm/mach-pxa/colibri-pxa300.c
3 *
acb36559
DM
4 * Support for Toradex PXA300/310 based Colibri module
5 *
5fc9f9a1 6 * Daniel Mack <daniel@caiaq.de>
acb36559 7 * Matthias Meier <matthias.j.meier@gmx.net>
5fc9f9a1
DM
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/platform_device.h>
17#include <linux/gpio.h>
8a28b10e 18#include <linux/interrupt.h>
5fc9f9a1
DM
19
20#include <asm/mach-types.h>
acb36559 21#include <asm/sizes.h>
5fc9f9a1
DM
22#include <asm/mach/arch.h>
23#include <asm/mach/irq.h>
24
25#include <mach/pxa300.h>
26#include <mach/colibri.h>
42e07ad7 27#include <mach/ohci.h>
91fcfb90 28#include <mach/pxafb.h>
7fad6986 29#include <mach/audio.h>
5fc9f9a1
DM
30
31#include "generic.h"
32#include "devices.h"
33
9b6956f4
MV
34
35#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
36static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
37 /* MMC */
38 GPIO7_MMC1_CLK,
39 GPIO14_MMC1_CMD,
40 GPIO3_MMC1_DAT0,
41 GPIO4_MMC1_DAT1,
42 GPIO5_MMC1_DAT2,
43 GPIO6_MMC1_DAT3,
44 GPIO39_GPIO, /* SD detect */
45
46 /* UHC */
47 GPIO0_2_USBH_PEN,
48 GPIO1_2_USBH_PWR,
49};
50#else
51static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
52#endif
53
5fc9f9a1 54#if defined(CONFIG_AX88796)
acb36559 55#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
5fc9f9a1
DM
56/*
57 * Asix AX88796 Ethernet
58 */
59static struct ax_plat_data colibri_asix_platdata = {
22a0200b
DM
60 .flags = 0, /* defined later */
61 .wordlength = 2,
5fc9f9a1
DM
62};
63
64static struct resource colibri_asix_resource[] = {
65 [0] = {
66 .start = PXA3xx_CS2_PHYS,
626806d9 67 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
5fc9f9a1
DM
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
acb36559
DM
71 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
72 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
8a28b10e 73 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
5fc9f9a1
DM
74 }
75};
76
77static struct platform_device asix_device = {
78 .name = "ax88796",
79 .id = 0,
80 .num_resources = ARRAY_SIZE(colibri_asix_resource),
81 .resource = colibri_asix_resource,
82 .dev = {
83 .platform_data = &colibri_asix_platdata
84 }
85};
ebc046c2 86
acb36559
DM
87static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
88 GPIO1_nCS2, /* AX88796 chip select */
89 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
ebc046c2
DM
90};
91
acb36559 92static void __init colibri_pxa300_init_eth(void)
ebc046c2 93{
22a0200b 94 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
acb36559 95 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
acb36559 96 platform_device_register(&asix_device);
ebc046c2 97}
ebc046c2 98#else
acb36559
DM
99static inline void __init colibri_pxa300_init_eth(void) {}
100#endif /* CONFIG_AX88796 */
ebc046c2 101
91fcfb90
DM
102#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
103static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
104 GPIO54_LCD_LDD_0,
105 GPIO55_LCD_LDD_1,
106 GPIO56_LCD_LDD_2,
107 GPIO57_LCD_LDD_3,
108 GPIO58_LCD_LDD_4,
109 GPIO59_LCD_LDD_5,
110 GPIO60_LCD_LDD_6,
111 GPIO61_LCD_LDD_7,
112 GPIO62_LCD_LDD_8,
113 GPIO63_LCD_LDD_9,
114 GPIO64_LCD_LDD_10,
115 GPIO65_LCD_LDD_11,
116 GPIO66_LCD_LDD_12,
117 GPIO67_LCD_LDD_13,
118 GPIO68_LCD_LDD_14,
119 GPIO69_LCD_LDD_15,
120 GPIO70_LCD_LDD_16,
121 GPIO71_LCD_LDD_17,
122 GPIO62_LCD_CS_N,
123 GPIO72_LCD_FCLK,
124 GPIO73_LCD_LCLK,
125 GPIO74_LCD_PCLK,
126 GPIO75_LCD_BIAS,
127 GPIO76_LCD_VSYNC,
128};
129
130static void __init colibri_pxa300_init_lcd(void)
131{
132 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
133}
134
135#else
136static inline void colibri_pxa300_init_lcd(void) {}
137#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
138
7fad6986 139#if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
e2bb5bef
DM
140static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
141 GPIO24_AC97_SYSCLK,
142 GPIO23_AC97_nACRESET,
143 GPIO25_AC97_SDATA_IN_0,
144 GPIO27_AC97_SDATA_OUT,
145 GPIO28_AC97_SYNC,
146 GPIO29_AC97_BITCLK
147};
148
149static inline void __init colibri_pxa310_init_ac97(void)
150{
151 /* no AC97 codec on Colibri PXA300 */
152 if (!cpu_is_pxa310())
153 return;
154
155 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
156 pxa_set_ac97_info(NULL);
157}
158#else
159static inline void colibri_pxa310_init_ac97(void) {}
160#endif
161
acb36559 162void __init colibri_pxa300_init(void)
5fc9f9a1 163{
acb36559 164 colibri_pxa300_init_eth();
53740df1 165 colibri_pxa3xx_init_nand();
91fcfb90 166 colibri_pxa300_init_lcd();
c9b78189 167 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
e2bb5bef 168 colibri_pxa310_init_ac97();
9b6956f4
MV
169
170 /* Evalboard init */
171 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
172 colibri_pxa270_evalboard_init();
5fc9f9a1
DM
173}
174
175MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
5fc9f9a1
DM
176 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
177 .init_machine = colibri_pxa300_init,
851982c1 178 .map_io = pxa3xx_map_io,
5fc9f9a1
DM
179 .init_irq = pxa3xx_init_irq,
180 .timer = &pxa_timer,
181MACHINE_END
182