Root/target/linux/ubicom32/files/arch/ubicom32/mach-ip5k/board-ip5160dev.c

1/*
2 * arch/ubicom32/mach-ip5k/board-ip5160dev.c
3 * Platform initialization for ip5160dev 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
32#include <asm/board.h>
33#include <asm/machdep.h>
34#ifdef CONFIG_SERIAL_UBI32_SERDES
35#include <asm/ubicom32suart.h>
36#endif
37
38/*
39 * Factory Default Button on the board at PXn
40 * TODO: This is just a placeholder and it needs to include proper header files
41 */
42struct ubicom32fdb_platform_data {
43    int fdb_gpio;
44    bool fdb_polarity;
45};
46
47static struct ubicom32fdb_platform_data ip5160dev_fdb_data = {
48    .fdb_gpio = 0,
49    .fdb_polarity = true,
50};
51
52static struct platform_device ip5160dev_fdb_device = {
53    .name = "ubicom32fdb",
54    .id = -1,
55    .dev = {
56        .platform_data = &ip5160dev_fdb_data,
57    },
58};
59
60#ifdef CONFIG_SERIAL_UBI32_SERDES
61static struct resource ip5160dev_ubicom32_suart_resources[] = {
62        {
63        .start = RD,
64        .end = RD,
65        .flags = IORESOURCE_MEM,
66        },
67        {
68        .start = PORT_OTHER_INT(RD),
69        .end = PORT_OTHER_INT(RD),
70        .flags = IORESOURCE_IRQ,
71        },
72        {
73        .start = 240000000,
74        .end = 240000000,
75        .flags = UBICOM32_SUART_IORESOURCE_CLOCK,
76        },
77};
78
79static struct platform_device ip5160dev_ubicom32_suart_device = {
80    .name = "ubicom32suart",
81    .id = -1,
82        .num_resources = ARRAY_SIZE(ip5160dev_ubicom32_suart_resources),
83        .resource = ip5160dev_ubicom32_suart_resources,
84};
85#endif
86
87/*
88 * List of all devices in our system
89 */
90static struct platform_device *ip5160dev_devices[] __initdata = {
91#ifdef CONFIG_SERIAL_UBI32_SERDES
92    &ip5160dev_ubicom32_suart_device,
93#endif
94    &ip5160dev_fdb_device,
95};
96
97/*
98 * ip5160dev_init
99 * Called to add the devices which we have on this board
100 */
101static int __init ip5160dev_init(void)
102{
103    ubi_gpio_init();
104    printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__);
105    platform_add_devices(ip5160dev_devices, ARRAY_SIZE(ip5160dev_devices));
106    return 0;
107}
108
109arch_initcall(ip5160dev_init);
110

Archive Download this file



interactive