Commit | Line | Data |
---|---|---|
46ba0abf SS |
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> | |
bce06683 | 20 | #include <linux/usb/otg.h> |
b2aa5e57 | 21 | #include <linux/spi/spi.h> |
46ba0abf SS |
22 | |
23 | #include <mach/hardware.h> | |
fbc9be10 | 24 | #include <mach/omap4-common.h> |
46ba0abf SS |
25 | #include <asm/mach-types.h> |
26 | #include <asm/mach/arch.h> | |
27 | #include <asm/mach/map.h> | |
28 | ||
ce491cf8 TL |
29 | #include <plat/board.h> |
30 | #include <plat/common.h> | |
31 | #include <plat/control.h> | |
32 | #include <plat/timer-gp.h> | |
bce06683 | 33 | #include <plat/usb.h> |
46ba0abf | 34 | |
b2aa5e57 AA |
35 | #define ETH_KS8851_IRQ 34 |
36 | #define ETH_KS8851_POWER_ON 48 | |
37 | #define ETH_KS8851_QUART 138 | |
38 | ||
39 | static struct spi_board_info sdp4430_spi_board_info[] __initdata = { | |
40 | { | |
41 | .modalias = "ks8851", | |
42 | .bus_num = 1, | |
43 | .chip_select = 0, | |
44 | .max_speed_hz = 24000000, | |
45 | .irq = ETH_KS8851_IRQ, | |
46 | }, | |
47 | }; | |
48 | ||
49 | static int omap_ethernet_init(void) | |
50 | { | |
51 | int status; | |
52 | ||
53 | /* Request of GPIO lines */ | |
54 | ||
55 | status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); | |
56 | if (status) { | |
57 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); | |
58 | return status; | |
59 | } | |
60 | ||
61 | status = gpio_request(ETH_KS8851_QUART, "quart"); | |
62 | if (status) { | |
63 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); | |
64 | goto error1; | |
65 | } | |
66 | ||
67 | status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); | |
68 | if (status) { | |
69 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); | |
70 | goto error2; | |
71 | } | |
72 | ||
73 | /* Configuration of requested GPIO lines */ | |
74 | ||
75 | status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); | |
76 | if (status) { | |
77 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); | |
78 | goto error3; | |
79 | } | |
80 | ||
81 | status = gpio_direction_output(ETH_KS8851_QUART, 1); | |
82 | if (status) { | |
83 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); | |
84 | goto error3; | |
85 | } | |
86 | ||
87 | status = gpio_direction_input(ETH_KS8851_IRQ); | |
88 | if (status) { | |
89 | pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); | |
90 | goto error3; | |
91 | } | |
92 | ||
93 | return 0; | |
94 | ||
95 | error3: | |
96 | gpio_free(ETH_KS8851_IRQ); | |
97 | error2: | |
98 | gpio_free(ETH_KS8851_QUART); | |
99 | error1: | |
100 | gpio_free(ETH_KS8851_POWER_ON); | |
101 | return status; | |
102 | } | |
103 | ||
46ba0abf SS |
104 | static struct platform_device sdp4430_lcd_device = { |
105 | .name = "sdp4430_lcd", | |
106 | .id = -1, | |
107 | }; | |
108 | ||
109 | static struct platform_device *sdp4430_devices[] __initdata = { | |
110 | &sdp4430_lcd_device, | |
111 | }; | |
112 | ||
46ba0abf SS |
113 | static struct omap_lcd_config sdp4430_lcd_config __initdata = { |
114 | .ctrl_name = "internal", | |
115 | }; | |
116 | ||
117 | static struct omap_board_config_kernel sdp4430_config[] __initdata = { | |
46ba0abf SS |
118 | { OMAP_TAG_LCD, &sdp4430_lcd_config }, |
119 | }; | |
120 | ||
46ba0abf SS |
121 | static void __init omap_4430sdp_init_irq(void) |
122 | { | |
5b7815b5 SS |
123 | omap_board_config = sdp4430_config; |
124 | omap_board_config_size = ARRAY_SIZE(sdp4430_config); | |
58cda884 | 125 | omap2_init_common_hw(NULL, NULL); |
46ba0abf SS |
126 | #ifdef CONFIG_OMAP_32K_TIMER |
127 | omap2_gp_clockevent_set_gptimer(1); | |
128 | #endif | |
129 | gic_init_irq(); | |
130 | omap_gpio_init(); | |
131 | } | |
132 | ||
bce06683 MM |
133 | static struct omap_musb_board_data musb_board_data = { |
134 | .interface_type = MUSB_INTERFACE_UTMI, | |
135 | .mode = MUSB_PERIPHERAL, | |
136 | .power = 100, | |
137 | }; | |
46ba0abf SS |
138 | |
139 | static void __init omap_4430sdp_init(void) | |
140 | { | |
b2aa5e57 AA |
141 | int status; |
142 | ||
46ba0abf | 143 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
46ba0abf | 144 | omap_serial_init(); |
bce06683 MM |
145 | /* OMAP4 SDP uses internal transceiver so register nop transceiver */ |
146 | usb_nop_xceiv_register(); | |
ae46ec77 SS |
147 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ |
148 | if (!cpu_is_omap44xx()) | |
149 | usb_musb_init(&musb_board_data); | |
b2aa5e57 AA |
150 | |
151 | status = omap_ethernet_init(); | |
152 | if (status) { | |
153 | pr_err("Ethernet initialization failed: %d\n", status); | |
154 | } else { | |
155 | sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); | |
156 | spi_register_board_info(sdp4430_spi_board_info, | |
157 | ARRAY_SIZE(sdp4430_spi_board_info)); | |
158 | } | |
46ba0abf SS |
159 | } |
160 | ||
161 | static void __init omap_4430sdp_map_io(void) | |
162 | { | |
163 | omap2_set_globals_443x(); | |
6fbd55d0 | 164 | omap44xx_map_common_io(); |
46ba0abf SS |
165 | } |
166 | ||
167 | MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") | |
168 | /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ | |
169 | .phys_io = 0x48000000, | |
b4224b23 | 170 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
46ba0abf SS |
171 | .boot_params = 0x80000100, |
172 | .map_io = omap_4430sdp_map_io, | |
173 | .init_irq = omap_4430sdp_init_irq, | |
174 | .init_machine = omap_4430sdp_init, | |
175 | .timer = &omap_timer, | |
176 | MACHINE_END |