blob: 2b41c6de274d5f393f5081af4c300ce059d1203a [file] [log] [blame]
Igor Grinbergd04b6202010-09-21 16:03:09 +00001/*
2 * linux/arch/arm/mach-omap2/board-cm-t3517.c
3 *
4 * Support for the CompuLab CM-T3517 modules
5 *
6 * Copyright (C) 2010 CompuLab, Ltd.
7 * Author: Igor Grinberg <grinberg@compulab.co.il>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/platform_device.h>
28#include <linux/gpio.h>
29#include <linux/leds.h>
Igor Grinberg46893a52010-09-21 16:03:10 +000030#include <linux/rtc-v3020.h>
Igor Grinbergd04b6202010-09-21 16:03:09 +000031
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35
36#include <plat/board.h>
37#include <plat/common.h>
38#include <plat/control.h>
39
40#include "mux.h"
41
42#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
43static struct gpio_led cm_t3517_leds[] = {
44 [0] = {
45 .gpio = 186,
46 .name = "cm-t3517:green",
47 .default_trigger = "heartbeat",
48 .active_low = 0,
49 },
50};
51
52static struct gpio_led_platform_data cm_t3517_led_pdata = {
53 .num_leds = ARRAY_SIZE(cm_t3517_leds),
54 .leds = cm_t3517_leds,
55};
56
57static struct platform_device cm_t3517_led_device = {
58 .name = "leds-gpio",
59 .id = -1,
60 .dev = {
61 .platform_data = &cm_t3517_led_pdata,
62 },
63};
64
65static void __init cm_t3517_init_leds(void)
66{
67 platform_device_register(&cm_t3517_led_device);
68}
69#else
70static inline void cm_t3517_init_leds(void) {}
71#endif
72
Igor Grinberg46893a52010-09-21 16:03:10 +000073#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
74#define RTC_IO_GPIO (153)
75#define RTC_WR_GPIO (154)
76#define RTC_RD_GPIO (160)
77#define RTC_CS_GPIO (163)
78
79struct v3020_platform_data cm_t3517_v3020_pdata = {
80 .use_gpio = 1,
81 .gpio_cs = RTC_CS_GPIO,
82 .gpio_wr = RTC_WR_GPIO,
83 .gpio_rd = RTC_RD_GPIO,
84 .gpio_io = RTC_IO_GPIO,
85};
86
87static struct platform_device cm_t3517_rtc_device = {
88 .name = "v3020",
89 .id = -1,
90 .dev = {
91 .platform_data = &cm_t3517_v3020_pdata,
92 }
93};
94
95static void __init cm_t3517_init_rtc(void)
96{
97 platform_device_register(&cm_t3517_rtc_device);
98}
99#else
100static inline void cm_t3517_init_rtc(void) {}
101#endif
Igor Grinbergd04b6202010-09-21 16:03:09 +0000102
103static struct omap_board_config_kernel cm_t3517_config[] __initdata = {
104};
105
106static void __init cm_t3517_init_irq(void)
107{
108 omap_board_config = cm_t3517_config;
109 omap_board_config_size = ARRAY_SIZE(cm_t3517_config);
110
111 omap2_init_common_hw(NULL, NULL);
112 omap_init_irq();
113 omap_gpio_init();
114}
115
116static struct omap_board_mux board_mux[] __initdata = {
117 /* GPIO186 - Green LED */
118 OMAP3_MUX(SYS_CLKOUT2, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
Igor Grinberg46893a52010-09-21 16:03:10 +0000119 /* RTC GPIOs: IO, WR#, RD#, CS# */
120 OMAP3_MUX(MCBSP4_DR, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
121 OMAP3_MUX(MCBSP4_DX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
122 OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
123 OMAP3_MUX(UART3_CTS_RCTX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
Igor Grinbergd04b6202010-09-21 16:03:09 +0000124
125 { .reg_offset = OMAP_MUX_TERMINATOR },
126};
127
128static void __init cm_t3517_init(void)
129{
130 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
131 omap_serial_init();
132 cm_t3517_init_leds();
Igor Grinberg46893a52010-09-21 16:03:10 +0000133 cm_t3517_init_rtc();
Igor Grinbergd04b6202010-09-21 16:03:09 +0000134}
135
136MACHINE_START(CM_T3517, "Compulab CM-T3517")
137 .phys_io = 0x48000000,
138 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
139 .boot_params = 0x80000100,
140 .map_io = omap3_map_io,
141 .reserve = omap_reserve,
142 .init_irq = cm_t3517_init_irq,
143 .init_machine = cm_t3517_init,
144 .timer = &omap_timer,
145MACHINE_END