Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Board support file for OMAP4430 SDP. |
| 3 | * |
| 4 | * Copyright (C) 2009 Texas Instruments |
| 5 | * |
| 6 | * Author: Santosh Shilimkar <santosh.shilimkar@ti.com> |
| 7 | * |
| 8 | * Based on mach-omap2/board-3430sdp.c |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/io.h> |
| 19 | #include <linux/gpio.h> |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 20 | #include <linux/usb/otg.h> |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame^] | 21 | #include <linux/spi/spi.h> |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 22 | |
| 23 | #include <mach/hardware.h> |
| 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
| 26 | #include <asm/mach/map.h> |
| 27 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 28 | #include <plat/board.h> |
| 29 | #include <plat/common.h> |
| 30 | #include <plat/control.h> |
| 31 | #include <plat/timer-gp.h> |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 32 | #include <plat/usb.h> |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 33 | #include <asm/hardware/gic.h> |
Santosh Shilimkar | d309427 | 2010-02-04 19:37:09 +0100 | [diff] [blame] | 34 | #include <asm/hardware/cache-l2x0.h> |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 35 | |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame^] | 36 | #define ETH_KS8851_IRQ 34 |
| 37 | #define ETH_KS8851_POWER_ON 48 |
| 38 | #define ETH_KS8851_QUART 138 |
| 39 | |
| 40 | static struct spi_board_info sdp4430_spi_board_info[] __initdata = { |
| 41 | { |
| 42 | .modalias = "ks8851", |
| 43 | .bus_num = 1, |
| 44 | .chip_select = 0, |
| 45 | .max_speed_hz = 24000000, |
| 46 | .irq = ETH_KS8851_IRQ, |
| 47 | }, |
| 48 | }; |
| 49 | |
| 50 | static int omap_ethernet_init(void) |
| 51 | { |
| 52 | int status; |
| 53 | |
| 54 | /* Request of GPIO lines */ |
| 55 | |
| 56 | status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); |
| 57 | if (status) { |
| 58 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); |
| 59 | return status; |
| 60 | } |
| 61 | |
| 62 | status = gpio_request(ETH_KS8851_QUART, "quart"); |
| 63 | if (status) { |
| 64 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); |
| 65 | goto error1; |
| 66 | } |
| 67 | |
| 68 | status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); |
| 69 | if (status) { |
| 70 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); |
| 71 | goto error2; |
| 72 | } |
| 73 | |
| 74 | /* Configuration of requested GPIO lines */ |
| 75 | |
| 76 | status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); |
| 77 | if (status) { |
| 78 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); |
| 79 | goto error3; |
| 80 | } |
| 81 | |
| 82 | status = gpio_direction_output(ETH_KS8851_QUART, 1); |
| 83 | if (status) { |
| 84 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); |
| 85 | goto error3; |
| 86 | } |
| 87 | |
| 88 | status = gpio_direction_input(ETH_KS8851_IRQ); |
| 89 | if (status) { |
| 90 | pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); |
| 91 | goto error3; |
| 92 | } |
| 93 | |
| 94 | return 0; |
| 95 | |
| 96 | error3: |
| 97 | gpio_free(ETH_KS8851_IRQ); |
| 98 | error2: |
| 99 | gpio_free(ETH_KS8851_QUART); |
| 100 | error1: |
| 101 | gpio_free(ETH_KS8851_POWER_ON); |
| 102 | return status; |
| 103 | } |
| 104 | |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 105 | static struct platform_device sdp4430_lcd_device = { |
| 106 | .name = "sdp4430_lcd", |
| 107 | .id = -1, |
| 108 | }; |
| 109 | |
| 110 | static struct platform_device *sdp4430_devices[] __initdata = { |
| 111 | &sdp4430_lcd_device, |
| 112 | }; |
| 113 | |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 114 | static struct omap_lcd_config sdp4430_lcd_config __initdata = { |
| 115 | .ctrl_name = "internal", |
| 116 | }; |
| 117 | |
| 118 | static struct omap_board_config_kernel sdp4430_config[] __initdata = { |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 119 | { OMAP_TAG_LCD, &sdp4430_lcd_config }, |
| 120 | }; |
| 121 | |
Santosh Shilimkar | d309427 | 2010-02-04 19:37:09 +0100 | [diff] [blame] | 122 | #ifdef CONFIG_CACHE_L2X0 |
Santosh Shilimkar | d309427 | 2010-02-04 19:37:09 +0100 | [diff] [blame] | 123 | static int __init omap_l2_cache_init(void) |
| 124 | { |
Santosh Shilimkar | d660f9a | 2010-03-11 07:33:46 +0000 | [diff] [blame] | 125 | extern void omap_smc1(u32 fn, u32 arg); |
Santosh Shilimkar | d309427 | 2010-02-04 19:37:09 +0100 | [diff] [blame] | 126 | void __iomem *l2cache_base; |
| 127 | |
| 128 | /* To avoid code running on other OMAPs in |
| 129 | * multi-omap builds |
| 130 | */ |
| 131 | if (!cpu_is_omap44xx()) |
| 132 | return -ENODEV; |
| 133 | |
| 134 | /* Static mapping, never released */ |
| 135 | l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K); |
| 136 | BUG_ON(!l2cache_base); |
| 137 | |
| 138 | /* Enable PL310 L2 Cache controller */ |
| 139 | omap_smc1(0x102, 0x1); |
| 140 | |
| 141 | /* 32KB way size, 16-way associativity, |
| 142 | * parity disabled |
| 143 | */ |
| 144 | l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff); |
| 145 | |
| 146 | return 0; |
| 147 | } |
| 148 | early_initcall(omap_l2_cache_init); |
| 149 | #endif |
| 150 | |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 151 | static void __init gic_init_irq(void) |
| 152 | { |
Tony Lindgren | e4e7a13 | 2009-10-19 15:25:26 -0700 | [diff] [blame] | 153 | void __iomem *base; |
| 154 | |
| 155 | /* Static mapping, never released */ |
| 156 | base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); |
| 157 | BUG_ON(!base); |
| 158 | gic_dist_init(0, base, 29); |
| 159 | |
| 160 | /* Static mapping, never released */ |
| 161 | gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); |
| 162 | BUG_ON(!gic_cpu_base_addr); |
| 163 | gic_cpu_init(0, gic_cpu_base_addr); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | static void __init omap_4430sdp_init_irq(void) |
| 167 | { |
Santosh Shilimkar | 5b7815b | 2009-10-22 14:48:14 -0700 | [diff] [blame] | 168 | omap_board_config = sdp4430_config; |
| 169 | omap_board_config_size = ARRAY_SIZE(sdp4430_config); |
Jean Pihet | 58cda88 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 170 | omap2_init_common_hw(NULL, NULL); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 171 | #ifdef CONFIG_OMAP_32K_TIMER |
| 172 | omap2_gp_clockevent_set_gptimer(1); |
| 173 | #endif |
| 174 | gic_init_irq(); |
| 175 | omap_gpio_init(); |
| 176 | } |
| 177 | |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 178 | static struct omap_musb_board_data musb_board_data = { |
| 179 | .interface_type = MUSB_INTERFACE_UTMI, |
| 180 | .mode = MUSB_PERIPHERAL, |
| 181 | .power = 100, |
| 182 | }; |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 183 | |
| 184 | static void __init omap_4430sdp_init(void) |
| 185 | { |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame^] | 186 | int status; |
| 187 | |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 188 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 189 | omap_serial_init(); |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 190 | /* OMAP4 SDP uses internal transceiver so register nop transceiver */ |
| 191 | usb_nop_xceiv_register(); |
Santosh Shilimkar | ae46ec7 | 2010-02-16 19:29:20 +0530 | [diff] [blame] | 192 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ |
| 193 | if (!cpu_is_omap44xx()) |
| 194 | usb_musb_init(&musb_board_data); |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame^] | 195 | |
| 196 | status = omap_ethernet_init(); |
| 197 | if (status) { |
| 198 | pr_err("Ethernet initialization failed: %d\n", status); |
| 199 | } else { |
| 200 | sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); |
| 201 | spi_register_board_info(sdp4430_spi_board_info, |
| 202 | ARRAY_SIZE(sdp4430_spi_board_info)); |
| 203 | } |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | static void __init omap_4430sdp_map_io(void) |
| 207 | { |
| 208 | omap2_set_globals_443x(); |
Tony Lindgren | 6fbd55d | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 209 | omap44xx_map_common_io(); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") |
| 213 | /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ |
| 214 | .phys_io = 0x48000000, |
Santosh Shilimkar | b4224b2 | 2009-10-19 17:25:55 -0700 | [diff] [blame] | 215 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 216 | .boot_params = 0x80000100, |
| 217 | .map_io = omap_4430sdp_map_io, |
| 218 | .init_irq = omap_4430sdp_init_irq, |
| 219 | .init_machine = omap_4430sdp_init, |
| 220 | .timer = &omap_timer, |
| 221 | MACHINE_END |