Igor Grinberg | d04b620 | 2010-09-21 16:03:09 +0000 | [diff] [blame^] | 1 | /* |
| 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> |
| 30 | |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
| 33 | #include <asm/mach/map.h> |
| 34 | |
| 35 | #include <plat/board.h> |
| 36 | #include <plat/common.h> |
| 37 | #include <plat/control.h> |
| 38 | |
| 39 | #include "mux.h" |
| 40 | |
| 41 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
| 42 | static struct gpio_led cm_t3517_leds[] = { |
| 43 | [0] = { |
| 44 | .gpio = 186, |
| 45 | .name = "cm-t3517:green", |
| 46 | .default_trigger = "heartbeat", |
| 47 | .active_low = 0, |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static struct gpio_led_platform_data cm_t3517_led_pdata = { |
| 52 | .num_leds = ARRAY_SIZE(cm_t3517_leds), |
| 53 | .leds = cm_t3517_leds, |
| 54 | }; |
| 55 | |
| 56 | static struct platform_device cm_t3517_led_device = { |
| 57 | .name = "leds-gpio", |
| 58 | .id = -1, |
| 59 | .dev = { |
| 60 | .platform_data = &cm_t3517_led_pdata, |
| 61 | }, |
| 62 | }; |
| 63 | |
| 64 | static void __init cm_t3517_init_leds(void) |
| 65 | { |
| 66 | platform_device_register(&cm_t3517_led_device); |
| 67 | } |
| 68 | #else |
| 69 | static inline void cm_t3517_init_leds(void) {} |
| 70 | #endif |
| 71 | |
| 72 | |
| 73 | static struct omap_board_config_kernel cm_t3517_config[] __initdata = { |
| 74 | }; |
| 75 | |
| 76 | static void __init cm_t3517_init_irq(void) |
| 77 | { |
| 78 | omap_board_config = cm_t3517_config; |
| 79 | omap_board_config_size = ARRAY_SIZE(cm_t3517_config); |
| 80 | |
| 81 | omap2_init_common_hw(NULL, NULL); |
| 82 | omap_init_irq(); |
| 83 | omap_gpio_init(); |
| 84 | } |
| 85 | |
| 86 | static struct omap_board_mux board_mux[] __initdata = { |
| 87 | /* GPIO186 - Green LED */ |
| 88 | OMAP3_MUX(SYS_CLKOUT2, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), |
| 89 | |
| 90 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 91 | }; |
| 92 | |
| 93 | static void __init cm_t3517_init(void) |
| 94 | { |
| 95 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
| 96 | omap_serial_init(); |
| 97 | cm_t3517_init_leds(); |
| 98 | } |
| 99 | |
| 100 | MACHINE_START(CM_T3517, "Compulab CM-T3517") |
| 101 | .phys_io = 0x48000000, |
| 102 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, |
| 103 | .boot_params = 0x80000100, |
| 104 | .map_io = omap3_map_io, |
| 105 | .reserve = omap_reserve, |
| 106 | .init_irq = cm_t3517_init_irq, |
| 107 | .init_machine = cm_t3517_init, |
| 108 | .timer = &omap_timer, |
| 109 | MACHINE_END |