aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-netstar.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2005-07-10 14:58:11 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-07-10 14:58:11 -0400
commitdbdf9cedfcc81202360763530412d746d798b7b6 (patch)
tree5698d59a01b1417cf508a006dd121baf7df9ea03 /arch/arm/mach-omap1/board-netstar.c
parent6f3e14163e066a6f43a54098a12185f25400fd68 (diff)
[PATCH] ARM: 2806/1: OMAP update 5/11: Move board files into mach-omap1 directory
Patch from Tony Lindgren This patch by Paul Mundt and other OMAP developers moves OMAP1 board files into mach-omap1 directory. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/board-netstar.c')
-rw-r--r--arch/arm/mach-omap1/board-netstar.c153
1 files changed, 153 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
new file mode 100644
index 000000000000..8c653734d5a3
--- /dev/null
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -0,0 +1,153 @@
1/*
2 * Modified from board-generic.c
3 *
4 * Copyright (C) 2004 2N Telekomunikace, Ladislav Michl <michl@2n.cz>
5 *
6 * Code for Netstar OMAP board.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/delay.h>
14#include <linux/device.h>
15#include <linux/interrupt.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/notifier.h>
19#include <linux/reboot.h>
20
21#include <asm/hardware.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25
26#include <asm/arch/gpio.h>
27#include <asm/arch/mux.h>
28#include <asm/arch/usb.h>
29
30#include "common.h"
31
32extern void __init omap_init_time(void);
33extern int omap_gpio_init(void);
34
35static struct resource netstar_smc91x_resources[] = {
36 [0] = {
37 .start = OMAP_CS1_PHYS + 0x300,
38 .end = OMAP_CS1_PHYS + 0x300 + 16,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = OMAP_GPIO_IRQ(8),
43 .end = OMAP_GPIO_IRQ(8),
44 .flags = IORESOURCE_IRQ,
45 },
46};
47
48static struct platform_device netstar_smc91x_device = {
49 .name = "smc91x",
50 .id = 0,
51 .num_resources = ARRAY_SIZE(netstar_smc91x_resources),
52 .resource = netstar_smc91x_resources,
53};
54
55static struct platform_device *netstar_devices[] __initdata = {
56 &netstar_smc91x_device,
57};
58
59static void __init netstar_init_irq(void)
60{
61 omap_init_irq();
62 omap_gpio_init();
63}
64
65static void __init netstar_init(void)
66{
67 /* green LED */
68 omap_request_gpio(4);
69 omap_set_gpio_direction(4, 0);
70 /* smc91x reset */
71 omap_request_gpio(7);
72 omap_set_gpio_direction(7, 0);
73 omap_set_gpio_dataout(7, 1);
74 udelay(2); /* wait at least 100ns */
75 omap_set_gpio_dataout(7, 0);
76 mdelay(50); /* 50ms until PHY ready */
77 /* smc91x interrupt pin */
78 omap_request_gpio(8);
79 omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
80
81 omap_request_gpio(12);
82 omap_request_gpio(13);
83 omap_request_gpio(14);
84 omap_request_gpio(15);
85 omap_set_gpio_edge_ctrl(12, OMAP_GPIO_FALLING_EDGE);
86 omap_set_gpio_edge_ctrl(13, OMAP_GPIO_FALLING_EDGE);
87 omap_set_gpio_edge_ctrl(14, OMAP_GPIO_FALLING_EDGE);
88 omap_set_gpio_edge_ctrl(15, OMAP_GPIO_FALLING_EDGE);
89
90 platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices));
91
92 /* Switch on green LED */
93 omap_set_gpio_dataout(4, 0);
94 /* Switch off red LED */
95 omap_writeb(0x00, OMAP_LPG1_PMR); /* Disable clock */
96 omap_writeb(0x80, OMAP_LPG1_LCR);
97}
98
99static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
100
101static void __init netstar_map_io(void)
102{
103 omap_map_io();
104 omap_serial_init(omap_serial_ports);
105}
106
107#define MACHINE_PANICED 1
108#define MACHINE_REBOOTING 2
109#define MACHINE_REBOOT 4
110static unsigned long machine_state;
111
112static int panic_event(struct notifier_block *this, unsigned long event,
113 void *ptr)
114{
115 if (test_and_set_bit(MACHINE_PANICED, &machine_state))
116 return NOTIFY_DONE;
117
118 /* Switch off green LED */
119 omap_set_gpio_dataout(4, 1);
120 /* Flash red LED */
121 omap_writeb(0x78, OMAP_LPG1_LCR);
122 omap_writeb(0x01, OMAP_LPG1_PMR); /* Enable clock */
123
124 return NOTIFY_DONE;
125}
126
127static struct notifier_block panic_block = {
128 .notifier_call = panic_event,
129};
130
131static int __init netstar_late_init(void)
132{
133 /* TODO: Setup front panel switch here */
134
135 /* Setup panic notifier */
136 notifier_chain_register(&panic_notifier_list, &panic_block);
137
138 return 0;
139}
140
141postcore_initcall(netstar_late_init);
142
143MACHINE_START(NETSTAR, "NetStar OMAP5910")
144 /* Maintainer: Ladislav Michl <michl@2n.cz> */
145 .phys_ram = 0x10000000,
146 .phys_io = 0xfff00000,
147 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
148 .boot_params = 0x10000100,
149 .map_io = netstar_map_io,
150 .init_irq = netstar_init_irq,
151 .init_machine = netstar_init,
152 .timer = &omap_timer,
153MACHINE_END