2 * arch/ubicom32/mach-common/vdc_tio.c
3 * Generic initialization for VDC
5 * (C) Copyright 2009, Ubicom, Inc.
7 * This file is part of the Ubicom32 Linux Kernel Port.
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.
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.
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/>.
23 * Ubicom32 implementation derived from (with many thanks):
29 #include <linux/platform_device.h>
30 #include <linux/types.h>
32 #include <asm/devtree.h>
33 #include <asm/vdc_tio.h>
36 * Resources that this driver uses
38 static struct resource vdc_tio_resources
[] = {
44 * The init routine will query the devtree and fill this in
46 .flags
= IORESOURCE_IRQ
,
50 * Receive IRQ (optional)
54 * The init routine will query the devtree and fill this in
56 .flags
= IORESOURCE_IRQ
,
60 * Memory Mapped Registers
64 * The init routine will query the devtree and fill this in
66 .flags
= IORESOURCE_MEM
,
71 * The platform_device structure which is passed to the driver
73 static struct platform_device vdc_tio_platform_device
= {
76 .resource
= vdc_tio_resources
,
77 .num_resources
= ARRAY_SIZE(vdc_tio_resources
),
82 * Checks the device tree and instantiates the driver if found
84 void __init
vdc_tio_init(void)
87 * Check the device tree for the vdc_tio
89 struct vdc_tio_node
*vdc_node
=
90 (struct vdc_tio_node
*)devtree_find_node("vdctio");
92 printk(KERN_WARNING
"No vdc_tio found\n");
97 * Fill in the resources and platform data from devtree information
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
);
106 * Try to get the device registered
108 if (platform_device_register(&vdc_tio_platform_device
) < 0) {
109 printk(KERN_WARNING
"VDC failed to register\n");