Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap2/board-2430sdp.c |
| 3 | * |
| 4 | * Copyright (C) 2006 Texas Instruments |
| 5 | * |
| 6 | * Modified from mach-omap2/board-generic.c |
| 7 | * |
| 8 | * Initial Code : Based on a patch from Komal Shah and Richard Woodruff |
| 9 | * Updated the Code for 2430 SDP : Syed Mohammed Khasim |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License version 2 as |
| 13 | * published by the Free Software Foundation. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/mtd/mtd.h> |
| 20 | #include <linux/mtd/partitions.h> |
| 21 | #include <linux/delay.h> |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 22 | #include <linux/i2c/twl4030.h> |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 23 | #include <linux/err.h> |
| 24 | #include <linux/clk.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 25 | #include <linux/io.h> |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 26 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | #include <mach/hardware.h> |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 28 | #include <asm/mach-types.h> |
| 29 | #include <asm/mach/arch.h> |
| 30 | #include <asm/mach/map.h> |
| 31 | #include <asm/mach/flash.h> |
| 32 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/gpio.h> |
| 34 | #include <mach/mux.h> |
| 35 | #include <mach/board.h> |
| 36 | #include <mach/common.h> |
| 37 | #include <mach/gpmc.h> |
Felipe Balbi | 18cb7ac | 2009-03-23 18:34:06 -0700 | [diff] [blame] | 38 | #include <mach/usb.h> |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame^] | 39 | #include <mach/gpmc-smc91x.h> |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 40 | |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 41 | #include "mmc-twl4030.h" |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 42 | |
Tony Lindgren | a362fdb | 2009-03-23 18:07:35 -0700 | [diff] [blame] | 43 | #define SDP2430_CS0_BASE 0x04000000 |
Tony Lindgren | a362fdb | 2009-03-23 18:07:35 -0700 | [diff] [blame] | 44 | |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 45 | static struct mtd_partition sdp2430_partitions[] = { |
| 46 | /* bootloader (U-Boot, etc) in first sector */ |
| 47 | { |
| 48 | .name = "bootloader", |
| 49 | .offset = 0, |
| 50 | .size = SZ_256K, |
| 51 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 52 | }, |
| 53 | /* bootloader params in the next sector */ |
| 54 | { |
| 55 | .name = "params", |
| 56 | .offset = MTDPART_OFS_APPEND, |
| 57 | .size = SZ_128K, |
| 58 | .mask_flags = 0, |
| 59 | }, |
| 60 | /* kernel */ |
| 61 | { |
| 62 | .name = "kernel", |
| 63 | .offset = MTDPART_OFS_APPEND, |
| 64 | .size = SZ_2M, |
| 65 | .mask_flags = 0 |
| 66 | }, |
| 67 | /* file system */ |
| 68 | { |
| 69 | .name = "filesystem", |
| 70 | .offset = MTDPART_OFS_APPEND, |
| 71 | .size = MTDPART_SIZ_FULL, |
| 72 | .mask_flags = 0 |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | static struct flash_platform_data sdp2430_flash_data = { |
| 77 | .map_name = "cfi_probe", |
| 78 | .width = 2, |
| 79 | .parts = sdp2430_partitions, |
| 80 | .nr_parts = ARRAY_SIZE(sdp2430_partitions), |
| 81 | }; |
| 82 | |
| 83 | static struct resource sdp2430_flash_resource = { |
| 84 | .start = SDP2430_CS0_BASE, |
| 85 | .end = SDP2430_CS0_BASE + SZ_64M - 1, |
| 86 | .flags = IORESOURCE_MEM, |
| 87 | }; |
| 88 | |
| 89 | static struct platform_device sdp2430_flash_device = { |
| 90 | .name = "omapflash", |
| 91 | .id = 0, |
| 92 | .dev = { |
| 93 | .platform_data = &sdp2430_flash_data, |
| 94 | }, |
| 95 | .num_resources = 1, |
| 96 | .resource = &sdp2430_flash_resource, |
| 97 | }; |
| 98 | |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 99 | static struct platform_device *sdp2430_devices[] __initdata = { |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 100 | &sdp2430_flash_device, |
| 101 | }; |
| 102 | |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame^] | 103 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) |
| 104 | |
| 105 | static struct omap_smc91x_platform_data board_smc91x_data = { |
| 106 | .cs = 5, |
| 107 | .gpio_irq = 149, |
| 108 | .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 | |
| 109 | IORESOURCE_IRQ_LOWLEVEL, |
| 110 | |
| 111 | }; |
| 112 | |
| 113 | static void __init board_smc91x_init(void) |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 114 | { |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame^] | 115 | if (omap_rev() > OMAP3430_REV_ES1_0) |
| 116 | board_smc91x_data.gpio_irq = 6; |
| 117 | else |
| 118 | board_smc91x_data.gpio_irq = 29; |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 119 | |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame^] | 120 | gpmc_smc91x_init(&board_smc91x_data); |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 121 | } |
| 122 | |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame^] | 123 | #else |
| 124 | |
| 125 | static inline void board_smc91x_init(void) |
| 126 | { |
| 127 | } |
| 128 | |
| 129 | #endif |
| 130 | |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 131 | static void __init omap_2430sdp_init_irq(void) |
| 132 | { |
Paul Walmsley | 87246b7 | 2009-01-28 12:27:39 -0700 | [diff] [blame] | 133 | omap2_init_common_hw(NULL); |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 134 | omap_init_irq(); |
| 135 | omap_gpio_init(); |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | static struct omap_uart_config sdp2430_uart_config __initdata = { |
| 139 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), |
| 140 | }; |
| 141 | |
| 142 | static struct omap_board_config_kernel sdp2430_config[] = { |
| 143 | {OMAP_TAG_UART, &sdp2430_uart_config}, |
| 144 | }; |
| 145 | |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 146 | |
| 147 | static struct twl4030_gpio_platform_data sdp2430_gpio_data = { |
| 148 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 149 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 150 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 151 | }; |
| 152 | |
| 153 | static struct twl4030_platform_data sdp2430_twldata = { |
| 154 | .irq_base = TWL4030_IRQ_BASE, |
| 155 | .irq_end = TWL4030_IRQ_END, |
| 156 | |
| 157 | /* platform_data for children goes here */ |
| 158 | .gpio = &sdp2430_gpio_data, |
| 159 | }; |
| 160 | |
| 161 | static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = { |
| 162 | { |
| 163 | I2C_BOARD_INFO("twl4030", 0x48), |
| 164 | .flags = I2C_CLIENT_WAKE, |
| 165 | .irq = INT_24XX_SYS_NIRQ, |
| 166 | .platform_data = &sdp2430_twldata, |
| 167 | }, |
| 168 | }; |
| 169 | |
| 170 | static int __init omap2430_i2c_init(void) |
| 171 | { |
| 172 | omap_register_i2c_bus(1, 400, NULL, 0); |
| 173 | omap_register_i2c_bus(2, 2600, sdp2430_i2c_boardinfo, |
| 174 | ARRAY_SIZE(sdp2430_i2c_boardinfo)); |
| 175 | return 0; |
| 176 | } |
| 177 | |
| 178 | static struct twl4030_hsmmc_info mmc[] __initdata = { |
| 179 | { |
| 180 | .mmc = 1, |
| 181 | .wires = 4, |
| 182 | .gpio_cd = -EINVAL, |
| 183 | .gpio_wp = -EINVAL, |
| 184 | .ext_clock = 1, |
| 185 | }, |
| 186 | {} /* Terminator */ |
| 187 | }; |
| 188 | |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 189 | static void __init omap_2430sdp_init(void) |
| 190 | { |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 191 | omap2430_i2c_init(); |
| 192 | |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 193 | platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); |
| 194 | omap_board_config = sdp2430_config; |
| 195 | omap_board_config_size = ARRAY_SIZE(sdp2430_config); |
| 196 | omap_serial_init(); |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 197 | twl4030_mmc_init(mmc); |
Felipe Balbi | 18cb7ac | 2009-03-23 18:34:06 -0700 | [diff] [blame] | 198 | usb_musb_init(); |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame^] | 199 | board_smc91x_init(); |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | static void __init omap_2430sdp_map_io(void) |
| 203 | { |
Paul Walmsley | c8d2eb8 | 2008-05-07 16:55:13 -0700 | [diff] [blame] | 204 | omap2_set_globals_243x(); |
Syed Mohammed Khasim | 72d0f1c | 2006-12-06 17:14:05 -0800 | [diff] [blame] | 205 | omap2_map_common_io(); |
| 206 | } |
| 207 | |
| 208 | MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") |
| 209 | /* Maintainer: Syed Khasim - Texas Instruments Inc */ |
| 210 | .phys_io = 0x48000000, |
| 211 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, |
| 212 | .boot_params = 0x80000100, |
| 213 | .map_io = omap_2430sdp_map_io, |
| 214 | .init_irq = omap_2430sdp_init_irq, |
| 215 | .init_machine = omap_2430sdp_init, |
| 216 | .timer = &omap_timer, |
| 217 | MACHINE_END |