blob: 41fed9235f8113779a3eb4c8c33543816dd6c9de [file] [log] [blame]
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -07001/*
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 Mankadbce06682010-02-17 14:09:32 -080020#include <linux/usb/otg.h>
Abraham Arceb2aa5e52010-05-14 12:05:26 -070021#include <linux/spi/spi.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070022
23#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070024#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070025#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28
Tony Lindgrence491cf2009-10-20 09:40:47 -070029#include <plat/board.h>
30#include <plat/common.h>
31#include <plat/control.h>
32#include <plat/timer-gp.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080033#include <plat/usb.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070034
Abraham Arceb2aa5e52010-05-14 12:05:26 -070035#define ETH_KS8851_IRQ 34
36#define ETH_KS8851_POWER_ON 48
37#define ETH_KS8851_QUART 138
38
39static 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
49static 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
95error3:
96 gpio_free(ETH_KS8851_IRQ);
97error2:
98 gpio_free(ETH_KS8851_QUART);
99error1:
100 gpio_free(ETH_KS8851_POWER_ON);
101 return status;
102}
103
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700104static struct platform_device sdp4430_lcd_device = {
105 .name = "sdp4430_lcd",
106 .id = -1,
107};
108
109static struct platform_device *sdp4430_devices[] __initdata = {
110 &sdp4430_lcd_device,
111};
112
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700113static struct omap_lcd_config sdp4430_lcd_config __initdata = {
114 .ctrl_name = "internal",
115};
116
117static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700118 { OMAP_TAG_LCD, &sdp4430_lcd_config },
119};
120
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700121static void __init omap_4430sdp_init_irq(void)
122{
Santosh Shilimkar5b7815b2009-10-22 14:48:14 -0700123 omap_board_config = sdp4430_config;
124 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
Jean Pihet58cda882009-07-24 19:43:25 -0600125 omap2_init_common_hw(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700126#ifdef CONFIG_OMAP_32K_TIMER
127 omap2_gp_clockevent_set_gptimer(1);
128#endif
129 gic_init_irq();
130 omap_gpio_init();
131}
132
Maulik Mankadbce06682010-02-17 14:09:32 -0800133static struct omap_musb_board_data musb_board_data = {
134 .interface_type = MUSB_INTERFACE_UTMI,
135 .mode = MUSB_PERIPHERAL,
136 .power = 100,
137};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000138static int __init omap4_i2c_init(void)
139{
140 /*
141 * Phoenix Audio IC needs I2C1 to
142 * start with 400 KHz or less
143 */
144 omap_register_i2c_bus(1, 400, NULL, 0);
145 omap_register_i2c_bus(2, 400, NULL, 0);
146 omap_register_i2c_bus(3, 400, NULL, 0);
147 omap_register_i2c_bus(4, 400, NULL, 0);
148 return 0;
149}
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700150static void __init omap_4430sdp_init(void)
151{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700152 int status;
153
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000154 omap4_i2c_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700155 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700156 omap_serial_init();
Maulik Mankadbce06682010-02-17 14:09:32 -0800157 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
158 usb_nop_xceiv_register();
Santosh Shilimkarae46ec772010-02-16 19:29:20 +0530159 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
160 if (!cpu_is_omap44xx())
161 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700162
163 status = omap_ethernet_init();
164 if (status) {
165 pr_err("Ethernet initialization failed: %d\n", status);
166 } else {
167 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
168 spi_register_board_info(sdp4430_spi_board_info,
169 ARRAY_SIZE(sdp4430_spi_board_info));
170 }
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700171}
172
173static void __init omap_4430sdp_map_io(void)
174{
175 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800176 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700177}
178
179MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
180 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
181 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700182 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700183 .boot_params = 0x80000100,
184 .map_io = omap_4430sdp_map_io,
185 .init_irq = omap_4430sdp_init_irq,
186 .init_machine = omap_4430sdp_init,
187 .timer = &omap_timer,
188MACHINE_END