aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-zoom-debugboard.c
diff options
context:
space:
mode:
authorVikram Pandita <vikram.pandita@ti.com>2009-05-28 17:04:04 -0400
committerTony Lindgren <tony@atomide.com>2009-05-28 17:04:04 -0400
commit577145f45487b41b4d47eeaedb9d37e494f80715 (patch)
treef2dc96a149fe43053463d2fe6ef10b749ce41458 /arch/arm/mach-omap2/board-zoom-debugboard.c
parentf52eeee83d360d536cab1c0296eae0ec5f05e4dd (diff)
ARM: OMAP3: Add support for OMAP3 Zoom2 board
This patch creates the minimal OMAP3 Zoom2 board support. Signed-off-by: Mikkel Christensen <mlc@ti.com> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> Acked-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-zoom-debugboard.c')
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c160
1 files changed, 160 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
new file mode 100644
index 000000000000..bac5c4321ff7
--- /dev/null
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -0,0 +1,160 @@
1/*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 * Mikkel Christensen <mlc@ti.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/gpio.h>
13#include <linux/serial_8250.h>
14#include <linux/smsc911x.h>
15
16#include <mach/gpmc.h>
17
18#define ZOOM2_SMSC911X_CS 7
19#define ZOOM2_SMSC911X_GPIO 158
20#define ZOOM2_QUADUART_CS 3
21#define ZOOM2_QUADUART_GPIO 102
22#define QUART_CLK 1843200
23#define DEBUG_BASE 0x08000000
24#define ZOOM2_ETHR_START DEBUG_BASE
25
26static struct resource zoom2_smsc911x_resources[] = {
27 [0] = {
28 .start = ZOOM2_ETHR_START,
29 .end = ZOOM2_ETHR_START + SZ_4K,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
34 },
35};
36
37static struct smsc911x_platform_config zoom2_smsc911x_config = {
38 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
39 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
40 .flags = SMSC911X_USE_32BIT,
41 .phy_interface = PHY_INTERFACE_MODE_MII,
42};
43
44static struct platform_device zoom2_smsc911x_device = {
45 .name = "smsc911x",
46 .id = -1,
47 .num_resources = ARRAY_SIZE(zoom2_smsc911x_resources),
48 .resource = zoom2_smsc911x_resources,
49 .dev = {
50 .platform_data = &zoom2_smsc911x_config,
51 },
52};
53
54static inline void __init zoom2_init_smsc911x(void)
55{
56 int eth_cs;
57 unsigned long cs_mem_base;
58 int eth_gpio = 0;
59
60 eth_cs = ZOOM2_SMSC911X_CS;
61
62 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
63 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
64 return;
65 }
66
67 zoom2_smsc911x_resources[0].start = cs_mem_base + 0x0;
68 zoom2_smsc911x_resources[0].end = cs_mem_base + 0xff;
69
70 eth_gpio = ZOOM2_SMSC911X_GPIO;
71
72 zoom2_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
73
74 if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
75 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
76 eth_gpio);
77 return;
78 }
79 gpio_direction_input(eth_gpio);
80}
81
82static struct plat_serial8250_port serial_platform_data[] = {
83 {
84 .mapbase = 0x10000000,
85 .irq = OMAP_GPIO_IRQ(102),
86 .flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,
87 .iotype = UPIO_MEM,
88 .regshift = 1,
89 .uartclk = QUART_CLK,
90 }, {
91 .flags = 0
92 }
93};
94
95static struct platform_device zoom2_debugboard_serial_device = {
96 .name = "serial8250",
97 .id = PLAT8250_DEV_PLATFORM1,
98 .dev = {
99 .platform_data = serial_platform_data,
100 },
101};
102
103static inline void __init zoom2_init_quaduart(void)
104{
105 int quart_cs;
106 unsigned long cs_mem_base;
107 int quart_gpio = 0;
108
109 quart_cs = ZOOM2_QUADUART_CS;
110
111 if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {
112 printk(KERN_ERR "Failed to request GPMC mem"
113 "for Quad UART(TL16CP754C)\n");
114 return;
115 }
116
117 quart_gpio = ZOOM2_QUADUART_GPIO;
118
119 if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) {
120 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
121 quart_gpio);
122 return;
123 }
124 gpio_direction_input(quart_gpio);
125}
126
127static inline int omap_zoom2_debugboard_detect(void)
128{
129 int debug_board_detect = 0;
130
131 debug_board_detect = ZOOM2_SMSC911X_GPIO;
132
133 if (gpio_request(debug_board_detect, "Zoom2 debug board detect") < 0) {
134 printk(KERN_ERR "Failed to request GPIO%d for Zoom2 debug"
135 "board detect\n", debug_board_detect);
136 return 0;
137 }
138 gpio_direction_input(debug_board_detect);
139
140 if (!gpio_get_value(debug_board_detect)) {
141 gpio_free(debug_board_detect);
142 return 0;
143 }
144 return 1;
145}
146
147static struct platform_device *zoom2_devices[] __initdata = {
148 &zoom2_smsc911x_device,
149 &zoom2_debugboard_serial_device,
150};
151
152int __init omap_zoom2_debugboard_init(void)
153{
154 if (!omap_zoom2_debugboard_detect())
155 return 0;
156
157 zoom2_init_smsc911x();
158 zoom2_init_quaduart();
159 return platform_add_devices(zoom2_devices, ARRAY_SIZE(zoom2_devices));
160}