Blame view
arch/arm/mach-omap2/board-zoom-debugboard.c
2.96 KB
577145f45 ARM: OMAP3: Add s... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/* * Copyright (C) 2009 Texas Instruments Inc. * Mikkel Christensen <mlc@ti.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/gpio.h> #include <linux/serial_8250.h> #include <linux/smsc911x.h> |
c426df87d OMAP2/3: Pass irq... |
15 |
#include <linux/interrupt.h> |
577145f45 ARM: OMAP3: Add s... |
16 |
|
ce491cf85 omap: headers: Mo... |
17 |
#include <plat/gpmc.h> |
21b42731e omap: convert boa... |
18 |
#include <plat/gpmc-smsc911x.h> |
577145f45 ARM: OMAP3: Add s... |
19 |
|
04aeae777 OMAP2plus: Fix st... |
20 |
#include <mach/board-zoom.h> |
62d0b336d omap3: zoom: rena... |
21 22 23 24 |
#define ZOOM_SMSC911X_CS 7 #define ZOOM_SMSC911X_GPIO 158 #define ZOOM_QUADUART_CS 3 #define ZOOM_QUADUART_GPIO 102 |
4e9642528 omap: ZOOM: QUART... |
25 |
#define ZOOM_QUADUART_RST_GPIO 152 |
577145f45 ARM: OMAP3: Add s... |
26 27 |
#define QUART_CLK 1843200 #define DEBUG_BASE 0x08000000 |
62d0b336d omap3: zoom: rena... |
28 |
#define ZOOM_ETHR_START DEBUG_BASE |
577145f45 ARM: OMAP3: Add s... |
29 |
|
21b42731e omap: convert boa... |
30 31 32 33 |
static struct omap_smsc911x_platform_data zoom_smsc911x_cfg = { .cs = ZOOM_SMSC911X_CS, .gpio_irq = ZOOM_SMSC911X_GPIO, .gpio_reset = -EINVAL, |
577145f45 ARM: OMAP3: Add s... |
34 |
.flags = SMSC911X_USE_32BIT, |
577145f45 ARM: OMAP3: Add s... |
35 |
}; |
62d0b336d omap3: zoom: rena... |
36 |
static inline void __init zoom_init_smsc911x(void) |
577145f45 ARM: OMAP3: Add s... |
37 |
{ |
21b42731e omap: convert boa... |
38 |
gpmc_smsc911x_init(&zoom_smsc911x_cfg); |
577145f45 ARM: OMAP3: Add s... |
39 40 41 42 |
} static struct plat_serial8250_port serial_platform_data[] = { { |
a4f57b813 omap2/3: Fix DEBU... |
43 |
.mapbase = ZOOM_UART_BASE, |
577145f45 ARM: OMAP3: Add s... |
44 45 |
.irq = OMAP_GPIO_IRQ(102), .flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ, |
c426df87d OMAP2/3: Pass irq... |
46 |
.irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING, |
577145f45 ARM: OMAP3: Add s... |
47 48 49 50 51 52 53 |
.iotype = UPIO_MEM, .regshift = 1, .uartclk = QUART_CLK, }, { .flags = 0 } }; |
62d0b336d omap3: zoom: rena... |
54 |
static struct platform_device zoom_debugboard_serial_device = { |
577145f45 ARM: OMAP3: Add s... |
55 |
.name = "serial8250", |
fcbcea93a omap3: zoom 2/3: ... |
56 |
.id = PLAT8250_DEV_PLATFORM, |
577145f45 ARM: OMAP3: Add s... |
57 58 59 60 |
.dev = { .platform_data = serial_platform_data, }, }; |
62d0b336d omap3: zoom: rena... |
61 |
static inline void __init zoom_init_quaduart(void) |
577145f45 ARM: OMAP3: Add s... |
62 63 64 65 |
{ int quart_cs; unsigned long cs_mem_base; int quart_gpio = 0; |
4e9642528 omap: ZOOM: QUART... |
66 67 68 69 70 71 72 73 |
if (gpio_request_one(ZOOM_QUADUART_RST_GPIO, GPIOF_OUT_INIT_LOW, "TL16CP754C GPIO") < 0) { pr_err("Failed to request GPIO%d for TL16CP754C ", ZOOM_QUADUART_RST_GPIO); return; } |
62d0b336d omap3: zoom: rena... |
74 |
quart_cs = ZOOM_QUADUART_CS; |
577145f45 ARM: OMAP3: Add s... |
75 76 77 78 79 80 81 |
if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) { printk(KERN_ERR "Failed to request GPMC mem" "for Quad UART(TL16CP754C) "); return; } |
62d0b336d omap3: zoom: rena... |
82 |
quart_gpio = ZOOM_QUADUART_GPIO; |
577145f45 ARM: OMAP3: Add s... |
83 |
|
bc593f5d7 arm: omap2plus: G... |
84 |
if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0) |
577145f45 ARM: OMAP3: Add s... |
85 86 87 |
printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C ", quart_gpio); |
577145f45 ARM: OMAP3: Add s... |
88 |
} |
62d0b336d omap3: zoom: rena... |
89 |
static inline int omap_zoom_debugboard_detect(void) |
577145f45 ARM: OMAP3: Add s... |
90 91 |
{ int debug_board_detect = 0; |
2fcc81a38 OMAP: Zoom2: rele... |
92 |
int ret = 1; |
577145f45 ARM: OMAP3: Add s... |
93 |
|
62d0b336d omap3: zoom: rena... |
94 |
debug_board_detect = ZOOM_SMSC911X_GPIO; |
577145f45 ARM: OMAP3: Add s... |
95 |
|
bc593f5d7 arm: omap2plus: G... |
96 97 |
if (gpio_request_one(debug_board_detect, GPIOF_IN, "Zoom debug board detect") < 0) { |
62d0b336d omap3: zoom: rena... |
98 |
printk(KERN_ERR "Failed to request GPIO%d for Zoom debug" |
577145f45 ARM: OMAP3: Add s... |
99 100 101 102 |
"board detect ", debug_board_detect); return 0; } |
577145f45 ARM: OMAP3: Add s... |
103 104 |
if (!gpio_get_value(debug_board_detect)) { |
2fcc81a38 OMAP: Zoom2: rele... |
105 |
ret = 0; |
577145f45 ARM: OMAP3: Add s... |
106 |
} |
2fcc81a38 OMAP: Zoom2: rele... |
107 108 |
gpio_free(debug_board_detect); return ret; |
577145f45 ARM: OMAP3: Add s... |
109 |
} |
62d0b336d omap3: zoom: rena... |
110 |
static struct platform_device *zoom_devices[] __initdata = { |
62d0b336d omap3: zoom: rena... |
111 |
&zoom_debugboard_serial_device, |
577145f45 ARM: OMAP3: Add s... |
112 |
}; |
62d0b336d omap3: zoom: rena... |
113 |
int __init zoom_debugboard_init(void) |
577145f45 ARM: OMAP3: Add s... |
114 |
{ |
62d0b336d omap3: zoom: rena... |
115 |
if (!omap_zoom_debugboard_detect()) |
577145f45 ARM: OMAP3: Add s... |
116 |
return 0; |
62d0b336d omap3: zoom: rena... |
117 118 119 |
zoom_init_smsc911x(); zoom_init_quaduart(); return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices)); |
577145f45 ARM: OMAP3: Add s... |
120 |
} |