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> |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 29 | |
| 30 | #include "generic.h" |
| 31 | #include "devices.h" |
| 32 | |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 33 | #if defined(CONFIG_AX88796) |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 34 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) |
Daniel Mack | 22a0200 | 2009-04-02 08:33:14 +0200 | [diff] [blame] | 35 | |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 36 | /* |
| 37 | * Asix AX88796 Ethernet |
| 38 | */ |
| 39 | static struct ax_plat_data colibri_asix_platdata = { |
Daniel Mack | 22a0200 | 2009-04-02 08:33:14 +0200 | [diff] [blame] | 40 | .flags = 0, /* defined later */ |
| 41 | .wordlength = 2, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | static struct resource colibri_asix_resource[] = { |
| 45 | [0] = { |
| 46 | .start = PXA3xx_CS2_PHYS, |
Daniel Mack | 626806d | 2009-03-23 02:04:16 +0100 | [diff] [blame] | 47 | .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 48 | .flags = IORESOURCE_MEM, |
| 49 | }, |
| 50 | [1] = { |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 51 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
| 52 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
Daniel Mack | 8a28b10 | 2009-04-02 08:33:15 +0200 | [diff] [blame] | 53 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 54 | } |
| 55 | }; |
| 56 | |
| 57 | static struct platform_device asix_device = { |
| 58 | .name = "ax88796", |
| 59 | .id = 0, |
| 60 | .num_resources = ARRAY_SIZE(colibri_asix_resource), |
| 61 | .resource = colibri_asix_resource, |
| 62 | .dev = { |
| 63 | .platform_data = &colibri_asix_platdata |
| 64 | } |
| 65 | }; |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 66 | |
| 67 | static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = { |
| 68 | GPIO1_nCS2, /* AX88796 chip select */ |
| 69 | GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */ |
| 70 | }; |
| 71 | |
| 72 | static void __init colibri_pxa300_init_eth(void) |
| 73 | { |
Daniel Mack | 22a0200 | 2009-04-02 08:33:14 +0200 | [diff] [blame] | 74 | colibri_pxa3xx_init_eth(&colibri_asix_platdata); |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 75 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 76 | platform_device_register(&asix_device); |
| 77 | } |
| 78 | #else |
| 79 | static inline void __init colibri_pxa300_init_eth(void) {} |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 80 | #endif /* CONFIG_AX88796 */ |
| 81 | |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 82 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 83 | static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = { |
| 84 | GPIO0_2_USBH_PEN, |
| 85 | GPIO1_2_USBH_PWR, |
| 86 | }; |
| 87 | |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 88 | static struct pxaohci_platform_data colibri_pxa300_ohci_info = { |
| 89 | .port_mode = PMM_GLOBAL_MODE, |
| 90 | .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
| 91 | }; |
| 92 | |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 93 | void __init colibri_pxa300_init_ohci(void) |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 94 | { |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 95 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config)); |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 96 | pxa_set_ohci_info(&colibri_pxa300_ohci_info); |
| 97 | } |
| 98 | #else |
| 99 | static inline void colibri_pxa300_init_ohci(void) {} |
| 100 | #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ |
| 101 | |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 102 | static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = { |
| 103 | GPIO7_MMC1_CLK, |
| 104 | GPIO14_MMC1_CMD, |
| 105 | GPIO3_MMC1_DAT0, |
| 106 | GPIO4_MMC1_DAT1, |
| 107 | GPIO5_MMC1_DAT2, |
| 108 | GPIO6_MMC1_DAT3, |
| 109 | }; |
| 110 | |
Daniel Mack | 91fcfb9 | 2009-03-23 02:04:19 +0100 | [diff] [blame] | 111 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
| 112 | static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = { |
| 113 | GPIO54_LCD_LDD_0, |
| 114 | GPIO55_LCD_LDD_1, |
| 115 | GPIO56_LCD_LDD_2, |
| 116 | GPIO57_LCD_LDD_3, |
| 117 | GPIO58_LCD_LDD_4, |
| 118 | GPIO59_LCD_LDD_5, |
| 119 | GPIO60_LCD_LDD_6, |
| 120 | GPIO61_LCD_LDD_7, |
| 121 | GPIO62_LCD_LDD_8, |
| 122 | GPIO63_LCD_LDD_9, |
| 123 | GPIO64_LCD_LDD_10, |
| 124 | GPIO65_LCD_LDD_11, |
| 125 | GPIO66_LCD_LDD_12, |
| 126 | GPIO67_LCD_LDD_13, |
| 127 | GPIO68_LCD_LDD_14, |
| 128 | GPIO69_LCD_LDD_15, |
| 129 | GPIO70_LCD_LDD_16, |
| 130 | GPIO71_LCD_LDD_17, |
| 131 | GPIO62_LCD_CS_N, |
| 132 | GPIO72_LCD_FCLK, |
| 133 | GPIO73_LCD_LCLK, |
| 134 | GPIO74_LCD_PCLK, |
| 135 | GPIO75_LCD_BIAS, |
| 136 | GPIO76_LCD_VSYNC, |
| 137 | }; |
| 138 | |
| 139 | static void __init colibri_pxa300_init_lcd(void) |
| 140 | { |
| 141 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config)); |
| 142 | } |
| 143 | |
| 144 | #else |
| 145 | static inline void colibri_pxa300_init_lcd(void) {} |
| 146 | #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */ |
| 147 | |
Daniel Mack | e2bb5be | 2009-03-23 02:04:20 +0100 | [diff] [blame] | 148 | #if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE) |
| 149 | static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = { |
| 150 | GPIO24_AC97_SYSCLK, |
| 151 | GPIO23_AC97_nACRESET, |
| 152 | GPIO25_AC97_SDATA_IN_0, |
| 153 | GPIO27_AC97_SDATA_OUT, |
| 154 | GPIO28_AC97_SYNC, |
| 155 | GPIO29_AC97_BITCLK |
| 156 | }; |
| 157 | |
| 158 | static inline void __init colibri_pxa310_init_ac97(void) |
| 159 | { |
| 160 | /* no AC97 codec on Colibri PXA300 */ |
| 161 | if (!cpu_is_pxa310()) |
| 162 | return; |
| 163 | |
| 164 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config)); |
| 165 | pxa_set_ac97_info(NULL); |
| 166 | } |
| 167 | #else |
| 168 | static inline void colibri_pxa310_init_ac97(void) {} |
| 169 | #endif |
| 170 | |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 171 | void __init colibri_pxa300_init(void) |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 172 | { |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 173 | pxa_set_ffuart_info(NULL); |
| 174 | pxa_set_btuart_info(NULL); |
| 175 | pxa_set_stuart_info(NULL); |
| 176 | |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 177 | colibri_pxa300_init_eth(); |
Daniel Mack | 42e07ad | 2009-03-13 16:37:11 +0100 | [diff] [blame] | 178 | colibri_pxa300_init_ohci(); |
Daniel Mack | 53740df | 2009-06-17 10:32:54 +0200 | [diff] [blame] | 179 | colibri_pxa3xx_init_nand(); |
Daniel Mack | 91fcfb9 | 2009-03-23 02:04:19 +0100 | [diff] [blame] | 180 | colibri_pxa300_init_lcd(); |
Daniel Mack | c9b7818 | 2009-03-27 22:00:09 +0100 | [diff] [blame] | 181 | colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO)); |
Daniel Mack | e2bb5be | 2009-03-23 02:04:20 +0100 | [diff] [blame] | 182 | colibri_pxa310_init_ac97(); |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 183 | colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config), |
| 184 | mfp_to_gpio(MFP_PIN_GPIO13)); |
Daniel Mack | 5fc9f9a | 2009-03-13 16:37:09 +0100 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | MACHINE_START(COLIBRI300, "Toradex Colibri PXA300") |
| 188 | .phys_io = 0x40000000, |
| 189 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 190 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, |
| 191 | .init_machine = colibri_pxa300_init, |
| 192 | .map_io = pxa_map_io, |
| 193 | .init_irq = pxa3xx_init_irq, |
| 194 | .timer = &pxa_timer, |
| 195 | MACHINE_END |
| 196 | |