[buildroot] disable sstrip when using musl
[openwrt/svn-archive/archive.git] / target / linux / ubicom32 / files / arch / ubicom32 / mach-common / vdc_tio.c
1 /*
2 * arch/ubicom32/mach-common/vdc_tio.c
3 * Generic initialization for VDC
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
29 #include <linux/platform_device.h>
30 #include <linux/types.h>
31
32 #include <asm/devtree.h>
33 #include <asm/vdc_tio.h>
34
35 /*
36 * Resources that this driver uses
37 */
38 static struct resource vdc_tio_resources[] = {
39 /*
40 * Send IRQ
41 */
42 [0] = {
43 /*
44 * The init routine will query the devtree and fill this in
45 */
46 .flags = IORESOURCE_IRQ,
47 },
48
49 /*
50 * Receive IRQ (optional)
51 */
52 [1] = {
53 /*
54 * The init routine will query the devtree and fill this in
55 */
56 .flags = IORESOURCE_IRQ,
57 },
58
59 /*
60 * Memory Mapped Registers
61 */
62 [2] = {
63 /*
64 * The init routine will query the devtree and fill this in
65 */
66 .flags = IORESOURCE_MEM,
67 },
68 };
69
70 /*
71 * The platform_device structure which is passed to the driver
72 */
73 static struct platform_device vdc_tio_platform_device = {
74 .name = "ubicom32fb",
75 .id = -1,
76 .resource = vdc_tio_resources,
77 .num_resources = ARRAY_SIZE(vdc_tio_resources),
78 };
79
80 /*
81 * vdc_tio_init
82 * Checks the device tree and instantiates the driver if found
83 */
84 void __init vdc_tio_init(void)
85 {
86 /*
87 * Check the device tree for the vdc_tio
88 */
89 struct vdc_tio_node *vdc_node =
90 (struct vdc_tio_node *)devtree_find_node("vdctio");
91 if (!vdc_node) {
92 printk(KERN_WARNING "No vdc_tio found\n");
93 return;
94 }
95
96 /*
97 * Fill in the resources and platform data from devtree information
98 */
99 vdc_tio_resources[0].start = vdc_node->dn.sendirq;
100 vdc_tio_resources[1].start = vdc_node->dn.recvirq;
101 vdc_tio_resources[2].start = (u32_t)vdc_node->regs;
102 vdc_tio_resources[2].end = (u32_t)vdc_node->regs +
103 sizeof(struct vdc_tio_vp_regs);
104
105 /*
106 * Try to get the device registered
107 */
108 if (platform_device_register(&vdc_tio_platform_device) < 0) {
109 printk(KERN_WARNING "VDC failed to register\n");
110 }
111 }