Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-pxa/colibri-pxa300.c |
| 3 | * |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 4 | * Support for Toradex PXA300/310 based Colibri module |
| 5 | * |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 6 | * Daniel Mack <daniel@caiaq.de> |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 7 | * Matthias Meier <matthias.j.meier@gmx.net> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 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> |
Daniel Mack | 8a28b10 | 2009-04-02 08:33:15 +0200 | [diff] [blame] | 18 | #include <linux/interrupt.h> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 19 | |
| 20 | #include <asm/mach-types.h> |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 21 | #include <asm/sizes.h> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/mach/irq.h> |
| 24 | |
| 25 | #include <mach/pxa300.h> |
| 26 | #include <mach/colibri.h> |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 27 | #include <mach/ohci.h> |
Daniel Mack | 91fcfb9 | 2009-03-23 02:04:19 +0100 | [diff] [blame] | 28 | #include <mach/pxafb.h> |
pieterg | 7fad698 | 2010-07-08 19:04:05 +0200 | [diff] [blame] | 29 | #include <mach/audio.h> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 30 | |
| 31 | #include "generic.h" |
| 32 | #include "devices.h" |
| 33 | |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 34 | |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 35 | #ifdef CONFIG_MACH_COLIBRI_EVALBOARD |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 36 | static 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, |
Bjørn Forsman | 57834a7 | 2010-12-23 16:01:02 +0100 | [diff] [blame] | 44 | GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */ |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 45 | |
| 46 | /* UHC */ |
| 47 | GPIO0_2_USBH_PEN, |
| 48 | GPIO1_2_USBH_PWR, |
Bjorn Forsman | 3534ccc | 2010-11-03 00:46:04 +0100 | [diff] [blame] | 49 | GPIO77_USB_P3_1, |
| 50 | GPIO78_USB_P3_2, |
| 51 | GPIO79_USB_P3_3, |
| 52 | GPIO80_USB_P3_4, |
| 53 | GPIO81_USB_P3_5, |
| 54 | GPIO82_USB_P3_6, |
Marek Vasut | 072e1ae | 2010-08-12 01:30:39 +0200 | [diff] [blame] | 55 | |
| 56 | /* I2C */ |
| 57 | GPIO21_I2C_SCL, |
| 58 | GPIO22_I2C_SDA, |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 59 | }; |
| 60 | #else |
| 61 | static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {}; |
| 62 | #endif |
| 63 | |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 64 | #if defined(CONFIG_AX88796) |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 65 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 66 | /* |
| 67 | * Asix AX88796 Ethernet |
| 68 | */ |
| 69 | static struct ax_plat_data colibri_asix_platdata = { |
Daniel Mack | 22a0200 | 2009-04-02 08:33:14 +0200 | [diff] [blame] | 70 | .flags = 0, /* defined later */ |
| 71 | .wordlength = 2, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | static struct resource colibri_asix_resource[] = { |
| 75 | [0] = { |
| 76 | .start = PXA3xx_CS2_PHYS, |
Daniel Mack | 626806d | 2009-03-23 02:04:16 +0100 | [diff] [blame] | 77 | .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 78 | .flags = IORESOURCE_MEM, |
| 79 | }, |
| 80 | [1] = { |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 81 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
| 82 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
Daniel Mack | 8a28b10 | 2009-04-02 08:33:15 +0200 | [diff] [blame] | 83 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 84 | } |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device asix_device = { |
| 88 | .name = "ax88796", |
| 89 | .id = 0, |
| 90 | .num_resources = ARRAY_SIZE(colibri_asix_resource), |
| 91 | .resource = colibri_asix_resource, |
| 92 | .dev = { |
| 93 | .platform_data = &colibri_asix_platdata |
| 94 | } |
| 95 | }; |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 96 | |
| 97 | static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = { |
| 98 | GPIO1_nCS2, /* AX88796 chip select */ |
| 99 | GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */ |
| 100 | }; |
| 101 | |
| 102 | static void __init colibri_pxa300_init_eth(void) |
| 103 | { |
Daniel Mack | 22a0200 | 2009-04-02 08:33:14 +0200 | [diff] [blame] | 104 | colibri_pxa3xx_init_eth(&colibri_asix_platdata); |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 105 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 106 | platform_device_register(&asix_device); |
| 107 | } |
| 108 | #else |
| 109 | static inline void __init colibri_pxa300_init_eth(void) {} |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 110 | #endif /* CONFIG_AX88796 */ |
| 111 | |
Daniel Mack | 91fcfb9 | 2009-03-23 02:04:19 +0100 | [diff] [blame] | 112 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
| 113 | static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = { |
| 114 | GPIO54_LCD_LDD_0, |
| 115 | GPIO55_LCD_LDD_1, |
| 116 | GPIO56_LCD_LDD_2, |
| 117 | GPIO57_LCD_LDD_3, |
| 118 | GPIO58_LCD_LDD_4, |
| 119 | GPIO59_LCD_LDD_5, |
| 120 | GPIO60_LCD_LDD_6, |
| 121 | GPIO61_LCD_LDD_7, |
| 122 | GPIO62_LCD_LDD_8, |
| 123 | GPIO63_LCD_LDD_9, |
| 124 | GPIO64_LCD_LDD_10, |
| 125 | GPIO65_LCD_LDD_11, |
| 126 | GPIO66_LCD_LDD_12, |
| 127 | GPIO67_LCD_LDD_13, |
| 128 | GPIO68_LCD_LDD_14, |
| 129 | GPIO69_LCD_LDD_15, |
| 130 | GPIO70_LCD_LDD_16, |
| 131 | GPIO71_LCD_LDD_17, |
| 132 | GPIO62_LCD_CS_N, |
| 133 | GPIO72_LCD_FCLK, |
| 134 | GPIO73_LCD_LCLK, |
| 135 | GPIO74_LCD_PCLK, |
| 136 | GPIO75_LCD_BIAS, |
| 137 | GPIO76_LCD_VSYNC, |
| 138 | }; |
| 139 | |
| 140 | static void __init colibri_pxa300_init_lcd(void) |
| 141 | { |
| 142 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config)); |
| 143 | } |
| 144 | |
| 145 | #else |
| 146 | static inline void colibri_pxa300_init_lcd(void) {} |
| 147 | #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */ |
| 148 | |
pieterg | 7fad698 | 2010-07-08 19:04:05 +0200 | [diff] [blame] | 149 | #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE) |
Daniel Mack | e2bb5be | 2009-03-23 02:04:20 +0100 | [diff] [blame] | 150 | static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = { |
| 151 | GPIO24_AC97_SYSCLK, |
| 152 | GPIO23_AC97_nACRESET, |
| 153 | GPIO25_AC97_SDATA_IN_0, |
| 154 | GPIO27_AC97_SDATA_OUT, |
| 155 | GPIO28_AC97_SYNC, |
| 156 | GPIO29_AC97_BITCLK |
| 157 | }; |
| 158 | |
| 159 | static inline void __init colibri_pxa310_init_ac97(void) |
| 160 | { |
| 161 | /* no AC97 codec on Colibri PXA300 */ |
| 162 | if (!cpu_is_pxa310()) |
| 163 | return; |
| 164 | |
| 165 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config)); |
| 166 | pxa_set_ac97_info(NULL); |
| 167 | } |
| 168 | #else |
| 169 | static inline void colibri_pxa310_init_ac97(void) {} |
| 170 | #endif |
| 171 | |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 172 | void __init colibri_pxa300_init(void) |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 173 | { |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 174 | colibri_pxa300_init_eth(); |
Daniel Mack | 53740df | 2009-06-17 10:32:54 +0200 | [diff] [blame] | 175 | colibri_pxa3xx_init_nand(); |
Daniel Mack | 91fcfb9 | 2009-03-23 02:04:19 +0100 | [diff] [blame] | 176 | colibri_pxa300_init_lcd(); |
Daniel Mack | c9b7818 | 2009-03-27 22:00:09 +0100 | [diff] [blame] | 177 | colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO)); |
Daniel Mack | e2bb5be | 2009-03-23 02:04:20 +0100 | [diff] [blame] | 178 | colibri_pxa310_init_ac97(); |
Marek Vasut | 9b6956f | 2010-08-12 01:18:38 +0200 | [diff] [blame] | 179 | |
| 180 | /* Evalboard init */ |
| 181 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config)); |
Marek Vasut | a3172e5 | 2010-08-12 01:45:05 +0200 | [diff] [blame] | 182 | colibri_evalboard_init(); |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | MACHINE_START(COLIBRI300, "Toradex Colibri PXA300") |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 186 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
| 187 | .init_machine = colibri_pxa300_init, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 188 | .map_io = pxa3xx_map_io, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 189 | .init_irq = pxa3xx_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 190 | .handle_irq = pxa3xx_handle_irq, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 191 | .timer = &pxa_timer, |
| 192 | MACHINE_END |
| 193 | |