Root/target/linux/ubicom32/files/arch/ubicom32/mach-ip7k/board-ip7160bringup.c

1/*
2 * arch/ubicom32/mach-ip7k/board-ip7160bringup.c
3 * Support for the IP7160 bringup board.
4 *
5 * (C) Copyright 2009, Ubicom, Inc.
6 *
7 * This file is part of the Ubicom32 Linux Kernel Port.
8 *
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
22 *
23 * Ubicom32 implementation derived from (with many thanks):
24 * arch/m68knommu
25 * arch/blackfin
26 * arch/parisc
27 */
28#include <linux/device.h>
29#include <linux/platform_device.h>
30#include <linux/gpio.h>
31#include <linux/leds.h>
32#include <linux/delay.h>
33#include <linux/input.h>
34
35#include <asm/board.h>
36#include <asm/machdep.h>
37#include <asm/ubicom32input.h>
38
39#ifdef CONFIG_SERIAL_UBI32_SERDES
40#include <asm/ubicom32suart.h>
41#endif
42
43/*
44 * Use ubicom32input driver to monitor the various pushbuttons on this board.
45 *
46 * WPS PD5
47 * FACT_DEFAULT PD6
48 *
49 * TODO: pick some ubicom understood EV_xxx define for WPS and Fact Default
50 */
51static struct ubicom32input_button ip7160bringup_ubicom32input_buttons[] = {
52    {
53        .type = EV_KEY,
54        .code = KEY_FN_F1,
55        .gpio = GPIO_RD_5,
56        .desc = "WPS",
57        .active_low = 1,
58    },
59    {
60        .type = EV_KEY,
61        .code = KEY_FN_F2,
62        .gpio = GPIO_RD_6,
63        .desc = "Factory Default",
64        .active_low = 1,
65    },
66};
67
68static struct ubicom32input_platform_data ip7160bringup_ubicom32input_data = {
69    .buttons = ip7160bringup_ubicom32input_buttons,
70    .nbuttons = ARRAY_SIZE(ip7160bringup_ubicom32input_buttons),
71};
72
73static struct platform_device ip7160bringup_ubicom32input_device = {
74    .name = "ubicom32input",
75    .id = -1,
76    .dev = {
77        .platform_data = &ip7160bringup_ubicom32input_data,
78    },
79};
80
81#ifdef CONFIG_SERIAL_UBI32_SERDES
82static struct resource ip7160bringup_ubicom32_suart_resources[] = {
83    {
84        .start = RE,
85        .end = RE,
86        .flags = IORESOURCE_MEM,
87    },
88    {
89        .start = PORT_OTHER_INT(RE),
90        .end = PORT_OTHER_INT(RE),
91        .flags = IORESOURCE_IRQ,
92    },
93    {
94        .start = 250000000,
95        .end = 250000000,
96        .flags = UBICOM32_SUART_IORESOURCE_CLOCK,
97    },
98};
99
100static struct platform_device ip7160bringup_ubicom32_suart_device = {
101    .name = "ubicom32suart",
102    .id = -1,
103    .num_resources = ARRAY_SIZE(ip7160bringup_ubicom32_suart_resources),
104    .resource = ip7160bringup_ubicom32_suart_resources,
105};
106#endif
107
108/*
109 * List of all devices in our system
110 */
111static struct platform_device *ip7160bringup_devices[] __initdata = {
112#ifdef CONFIG_SERIAL_UBI32_SERDES
113    &ip7160bringup_ubicom32_suart_device,
114#endif
115    &ip7160bringup_ubicom32input_device,
116};
117
118/*
119 * ip7160bringup_init
120 * Called to add the devices which we have on this board
121 */
122static int __init ip7160bringup_init(void)
123{
124    board_init();
125
126    ubi_gpio_init();
127
128    printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__);
129    platform_add_devices(ip7160bringup_devices, ARRAY_SIZE(ip7160bringup_devices));
130
131    return 0;
132}
133
134arch_initcall(ip7160bringup_init);
135

Archive Download this file



interactive