diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-apollon.c')
| -rw-r--r-- | arch/arm/mach-omap2/board-apollon.c | 99 |
1 files changed, 90 insertions, 9 deletions
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index 878ff9181d0e..3bb49c17c858 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
| 26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
| 28 | #include <linux/leds.h> | ||
| 29 | #include <linux/irq.h> | ||
| 28 | 30 | ||
| 29 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
| 30 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
| @@ -32,10 +34,12 @@ | |||
| 32 | #include <asm/mach/flash.h> | 34 | #include <asm/mach/flash.h> |
| 33 | 35 | ||
| 34 | #include <asm/arch/gpio.h> | 36 | #include <asm/arch/gpio.h> |
| 37 | #include <asm/arch/led.h> | ||
| 35 | #include <asm/arch/mux.h> | 38 | #include <asm/arch/mux.h> |
| 36 | #include <asm/arch/usb.h> | 39 | #include <asm/arch/usb.h> |
| 37 | #include <asm/arch/board.h> | 40 | #include <asm/arch/board.h> |
| 38 | #include <asm/arch/common.h> | 41 | #include <asm/arch/common.h> |
| 42 | #include <asm/arch/gpmc.h> | ||
| 39 | #include "prcm-regs.h" | 43 | #include "prcm-regs.h" |
| 40 | 44 | ||
| 41 | /* LED & Switch macros */ | 45 | /* LED & Switch macros */ |
| @@ -46,6 +50,9 @@ | |||
| 46 | #define SW_UP_GPIO17 17 | 50 | #define SW_UP_GPIO17 17 |
| 47 | #define SW_DOWN_GPIO58 58 | 51 | #define SW_DOWN_GPIO58 58 |
| 48 | 52 | ||
| 53 | #define APOLLON_FLASH_CS 0 | ||
| 54 | #define APOLLON_ETH_CS 1 | ||
| 55 | |||
| 49 | static struct mtd_partition apollon_partitions[] = { | 56 | static struct mtd_partition apollon_partitions[] = { |
| 50 | { | 57 | { |
| 51 | .name = "X-Loader + U-Boot", | 58 | .name = "X-Loader + U-Boot", |
| @@ -85,10 +92,10 @@ static struct flash_platform_data apollon_flash_data = { | |||
| 85 | .nr_parts = ARRAY_SIZE(apollon_partitions), | 92 | .nr_parts = ARRAY_SIZE(apollon_partitions), |
| 86 | }; | 93 | }; |
| 87 | 94 | ||
| 88 | static struct resource apollon_flash_resource = { | 95 | static struct resource apollon_flash_resource[] = { |
| 89 | .start = APOLLON_CS0_BASE, | 96 | [0] = { |
| 90 | .end = APOLLON_CS0_BASE + SZ_128K, | 97 | .flags = IORESOURCE_MEM, |
| 91 | .flags = IORESOURCE_MEM, | 98 | }, |
| 92 | }; | 99 | }; |
| 93 | 100 | ||
| 94 | static struct platform_device apollon_onenand_device = { | 101 | static struct platform_device apollon_onenand_device = { |
| @@ -97,14 +104,24 @@ static struct platform_device apollon_onenand_device = { | |||
| 97 | .dev = { | 104 | .dev = { |
| 98 | .platform_data = &apollon_flash_data, | 105 | .platform_data = &apollon_flash_data, |
| 99 | }, | 106 | }, |
| 100 | .num_resources = ARRAY_SIZE(&apollon_flash_resource), | 107 | .num_resources = ARRAY_SIZE(apollon_flash_resource), |
| 101 | .resource = &apollon_flash_resource, | 108 | .resource = apollon_flash_resource, |
| 102 | }; | 109 | }; |
| 103 | 110 | ||
| 111 | static void __init apollon_flash_init(void) | ||
| 112 | { | ||
| 113 | unsigned long base; | ||
| 114 | |||
| 115 | if (gpmc_cs_request(APOLLON_FLASH_CS, SZ_128K, &base) < 0) { | ||
| 116 | printk(KERN_ERR "Cannot request OneNAND GPMC CS\n"); | ||
| 117 | return; | ||
| 118 | } | ||
| 119 | apollon_flash_resource[0].start = base; | ||
| 120 | apollon_flash_resource[0].end = base + SZ_128K - 1; | ||
| 121 | } | ||
| 122 | |||
| 104 | static struct resource apollon_smc91x_resources[] = { | 123 | static struct resource apollon_smc91x_resources[] = { |
| 105 | [0] = { | 124 | [0] = { |
| 106 | .start = APOLLON_ETHR_START, /* Physical */ | ||
| 107 | .end = APOLLON_ETHR_START + 0xf, | ||
| 108 | .flags = IORESOURCE_MEM, | 125 | .flags = IORESOURCE_MEM, |
| 109 | }, | 126 | }, |
| 110 | [1] = { | 127 | [1] = { |
| @@ -126,14 +143,51 @@ static struct platform_device apollon_lcd_device = { | |||
| 126 | .id = -1, | 143 | .id = -1, |
| 127 | }; | 144 | }; |
| 128 | 145 | ||
| 146 | static struct omap_led_config apollon_led_config[] = { | ||
| 147 | { | ||
| 148 | .cdev = { | ||
| 149 | .name = "apollon:led0", | ||
| 150 | }, | ||
| 151 | .gpio = LED0_GPIO13, | ||
| 152 | }, | ||
| 153 | { | ||
| 154 | .cdev = { | ||
| 155 | .name = "apollon:led1", | ||
| 156 | }, | ||
| 157 | .gpio = LED1_GPIO14, | ||
| 158 | }, | ||
| 159 | { | ||
| 160 | .cdev = { | ||
| 161 | .name = "apollon:led2", | ||
| 162 | }, | ||
| 163 | .gpio = LED2_GPIO15, | ||
| 164 | }, | ||
| 165 | }; | ||
| 166 | |||
| 167 | static struct omap_led_platform_data apollon_led_data = { | ||
| 168 | .nr_leds = ARRAY_SIZE(apollon_led_config), | ||
| 169 | .leds = apollon_led_config, | ||
| 170 | }; | ||
| 171 | |||
| 172 | static struct platform_device apollon_led_device = { | ||
| 173 | .name = "omap-led", | ||
| 174 | .id = -1, | ||
| 175 | .dev = { | ||
| 176 | .platform_data = &apollon_led_data, | ||
| 177 | }, | ||
| 178 | }; | ||
| 179 | |||
| 129 | static struct platform_device *apollon_devices[] __initdata = { | 180 | static struct platform_device *apollon_devices[] __initdata = { |
| 130 | &apollon_onenand_device, | 181 | &apollon_onenand_device, |
| 131 | &apollon_smc91x_device, | 182 | &apollon_smc91x_device, |
| 132 | &apollon_lcd_device, | 183 | &apollon_lcd_device, |
| 184 | &apollon_led_device, | ||
| 133 | }; | 185 | }; |
| 134 | 186 | ||
| 135 | static inline void __init apollon_init_smc91x(void) | 187 | static inline void __init apollon_init_smc91x(void) |
| 136 | { | 188 | { |
| 189 | unsigned long base; | ||
| 190 | |||
| 137 | /* Make sure CS1 timings are correct */ | 191 | /* Make sure CS1 timings are correct */ |
| 138 | GPMC_CONFIG1_1 = 0x00011203; | 192 | GPMC_CONFIG1_1 = 0x00011203; |
| 139 | GPMC_CONFIG2_1 = 0x001f1f01; | 193 | GPMC_CONFIG2_1 = 0x001f1f01; |
| @@ -141,13 +195,20 @@ static inline void __init apollon_init_smc91x(void) | |||
| 141 | GPMC_CONFIG4_1 = 0x1c091c09; | 195 | GPMC_CONFIG4_1 = 0x1c091c09; |
| 142 | GPMC_CONFIG5_1 = 0x041f1f1f; | 196 | GPMC_CONFIG5_1 = 0x041f1f1f; |
| 143 | GPMC_CONFIG6_1 = 0x000004c4; | 197 | GPMC_CONFIG6_1 = 0x000004c4; |
| 144 | GPMC_CONFIG7_1 = 0x00000f40 | (APOLLON_CS1_BASE >> 24); | 198 | |
| 199 | if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) { | ||
| 200 | printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); | ||
| 201 | return; | ||
| 202 | } | ||
| 203 | apollon_smc91x_resources[0].start = base + 0x300; | ||
| 204 | apollon_smc91x_resources[0].end = base + 0x30f; | ||
| 145 | udelay(100); | 205 | udelay(100); |
| 146 | 206 | ||
| 147 | omap_cfg_reg(W4__24XX_GPIO74); | 207 | omap_cfg_reg(W4__24XX_GPIO74); |
| 148 | if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) { | 208 | if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) { |
| 149 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | 209 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", |
| 150 | APOLLON_ETHR_GPIO_IRQ); | 210 | APOLLON_ETHR_GPIO_IRQ); |
| 211 | gpmc_cs_free(APOLLON_ETH_CS); | ||
| 151 | return; | 212 | return; |
| 152 | } | 213 | } |
| 153 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); | 214 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); |
| @@ -175,6 +236,13 @@ static struct omap_mmc_config apollon_mmc_config __initdata = { | |||
| 175 | }, | 236 | }, |
| 176 | }; | 237 | }; |
| 177 | 238 | ||
| 239 | static struct omap_usb_config apollon_usb_config __initdata = { | ||
| 240 | .register_dev = 1, | ||
| 241 | .hmc_mode = 0x14, /* 0:dev 1:host1 2:disable */ | ||
| 242 | |||
| 243 | .pins[0] = 6, | ||
| 244 | }; | ||
| 245 | |||
| 178 | static struct omap_lcd_config apollon_lcd_config __initdata = { | 246 | static struct omap_lcd_config apollon_lcd_config __initdata = { |
| 179 | .ctrl_name = "internal", | 247 | .ctrl_name = "internal", |
| 180 | }; | 248 | }; |
| @@ -182,6 +250,7 @@ static struct omap_lcd_config apollon_lcd_config __initdata = { | |||
| 182 | static struct omap_board_config_kernel apollon_config[] = { | 250 | static struct omap_board_config_kernel apollon_config[] = { |
| 183 | { OMAP_TAG_UART, &apollon_uart_config }, | 251 | { OMAP_TAG_UART, &apollon_uart_config }, |
| 184 | { OMAP_TAG_MMC, &apollon_mmc_config }, | 252 | { OMAP_TAG_MMC, &apollon_mmc_config }, |
| 253 | { OMAP_TAG_USB, &apollon_usb_config }, | ||
| 185 | { OMAP_TAG_LCD, &apollon_lcd_config }, | 254 | { OMAP_TAG_LCD, &apollon_lcd_config }, |
| 186 | }; | 255 | }; |
| 187 | 256 | ||
| @@ -250,10 +319,22 @@ static void __init apollon_sw_init(void) | |||
| 250 | return; | 319 | return; |
| 251 | } | 320 | } |
| 252 | 321 | ||
| 322 | static void __init apollon_usb_init(void) | ||
| 323 | { | ||
| 324 | /* USB device */ | ||
| 325 | /* DEVICE_SUSPEND */ | ||
| 326 | omap_cfg_reg(P21_242X_GPIO12); | ||
| 327 | omap_request_gpio(12); | ||
| 328 | omap_set_gpio_direction(12, 0); /* OUT */ | ||
| 329 | omap_set_gpio_dataout(12, 0); | ||
| 330 | } | ||
| 331 | |||
| 253 | static void __init omap_apollon_init(void) | 332 | static void __init omap_apollon_init(void) |
| 254 | { | 333 | { |
| 255 | apollon_led_init(); | 334 | apollon_led_init(); |
| 256 | apollon_sw_init(); | 335 | apollon_sw_init(); |
| 336 | apollon_flash_init(); | ||
| 337 | apollon_usb_init(); | ||
| 257 | 338 | ||
| 258 | /* REVISIT: where's the correct place */ | 339 | /* REVISIT: where's the correct place */ |
| 259 | omap_cfg_reg(W19_24XX_SYS_NIRQ); | 340 | omap_cfg_reg(W19_24XX_SYS_NIRQ); |
