sched: Drop the rq argument to sched_class::select_task_rq()
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-omap2 / board-zoom-debugboard.c
blob007ebdc6c993eec5a8d73243a18a6be382557501
1 /*
2 * Copyright (C) 2009 Texas Instruments Inc.
3 * Mikkel Christensen <mlc@ti.com>
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 */
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 #include <linux/interrupt.h>
17 #include <plat/gpmc.h>
19 #include <mach/board-zoom.h>
21 #define ZOOM_SMSC911X_CS 7
22 #define ZOOM_SMSC911X_GPIO 158
23 #define ZOOM_QUADUART_CS 3
24 #define ZOOM_QUADUART_GPIO 102
25 #define QUART_CLK 1843200
26 #define DEBUG_BASE 0x08000000
27 #define ZOOM_ETHR_START DEBUG_BASE
29 static struct resource zoom_smsc911x_resources[] = {
30 [0] = {
31 .start = ZOOM_ETHR_START,
32 .end = ZOOM_ETHR_START + SZ_4K,
33 .flags = IORESOURCE_MEM,
35 [1] = {
36 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
40 static struct smsc911x_platform_config zoom_smsc911x_config = {
41 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
42 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
43 .flags = SMSC911X_USE_32BIT,
44 .phy_interface = PHY_INTERFACE_MODE_MII,
47 static struct platform_device zoom_smsc911x_device = {
48 .name = "smsc911x",
49 .id = -1,
50 .num_resources = ARRAY_SIZE(zoom_smsc911x_resources),
51 .resource = zoom_smsc911x_resources,
52 .dev = {
53 .platform_data = &zoom_smsc911x_config,
57 static inline void __init zoom_init_smsc911x(void)
59 int eth_cs;
60 unsigned long cs_mem_base;
61 int eth_gpio = 0;
63 eth_cs = ZOOM_SMSC911X_CS;
65 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
66 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
67 return;
70 zoom_smsc911x_resources[0].start = cs_mem_base + 0x0;
71 zoom_smsc911x_resources[0].end = cs_mem_base + 0xff;
73 eth_gpio = ZOOM_SMSC911X_GPIO;
75 zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
77 if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
78 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
79 eth_gpio);
80 return;
82 gpio_direction_input(eth_gpio);
85 static struct plat_serial8250_port serial_platform_data[] = {
87 .mapbase = ZOOM_UART_BASE,
88 .irq = OMAP_GPIO_IRQ(102),
89 .flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,
90 .irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING,
91 .iotype = UPIO_MEM,
92 .regshift = 1,
93 .uartclk = QUART_CLK,
94 }, {
95 .flags = 0
99 static struct platform_device zoom_debugboard_serial_device = {
100 .name = "serial8250",
101 .id = PLAT8250_DEV_PLATFORM,
102 .dev = {
103 .platform_data = serial_platform_data,
107 static inline void __init zoom_init_quaduart(void)
109 int quart_cs;
110 unsigned long cs_mem_base;
111 int quart_gpio = 0;
113 quart_cs = ZOOM_QUADUART_CS;
115 if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {
116 printk(KERN_ERR "Failed to request GPMC mem"
117 "for Quad UART(TL16CP754C)\n");
118 return;
121 quart_gpio = ZOOM_QUADUART_GPIO;
123 if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) {
124 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
125 quart_gpio);
126 return;
128 gpio_direction_input(quart_gpio);
131 static inline int omap_zoom_debugboard_detect(void)
133 int debug_board_detect = 0;
134 int ret = 1;
136 debug_board_detect = ZOOM_SMSC911X_GPIO;
138 if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) {
139 printk(KERN_ERR "Failed to request GPIO%d for Zoom debug"
140 "board detect\n", debug_board_detect);
141 return 0;
143 gpio_direction_input(debug_board_detect);
145 if (!gpio_get_value(debug_board_detect)) {
146 ret = 0;
148 gpio_free(debug_board_detect);
149 return ret;
152 static struct platform_device *zoom_devices[] __initdata = {
153 &zoom_smsc911x_device,
154 &zoom_debugboard_serial_device,
157 int __init zoom_debugboard_init(void)
159 if (!omap_zoom_debugboard_detect())
160 return 0;
162 zoom_init_smsc911x();
163 zoom_init_quaduart();
164 return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));