From 5c105d9f3fd086aff195d3849dcf847d6b0bd927 Mon Sep 17 00:00:00 2001 From: blogic Date: Fri, 5 Oct 2012 10:12:53 +0000 Subject: branch Attitude Adjustment git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/arch/ubicom32/mach-common/vdc_tio.c | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 target/linux/ubicom32/files/arch/ubicom32/mach-common/vdc_tio.c (limited to 'target/linux/ubicom32/files/arch/ubicom32/mach-common/vdc_tio.c') diff --git a/target/linux/ubicom32/files/arch/ubicom32/mach-common/vdc_tio.c b/target/linux/ubicom32/files/arch/ubicom32/mach-common/vdc_tio.c new file mode 100644 index 000000000..cde0cb20f --- /dev/null +++ b/target/linux/ubicom32/files/arch/ubicom32/mach-common/vdc_tio.c @@ -0,0 +1,111 @@ +/* + * arch/ubicom32/mach-common/vdc_tio.c + * Generic initialization for VDC + * + * (C) Copyright 2009, Ubicom, Inc. + * + * This file is part of the Ubicom32 Linux Kernel Port. + * + * The Ubicom32 Linux Kernel Port is free software: you can redistribute + * it and/or modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * The Ubicom32 Linux Kernel Port is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Ubicom32 Linux Kernel Port. If not, + * see . + * + * Ubicom32 implementation derived from (with many thanks): + * arch/m68knommu + * arch/blackfin + * arch/parisc + */ + +#include +#include + +#include +#include + +/* + * Resources that this driver uses + */ +static struct resource vdc_tio_resources[] = { + /* + * Send IRQ + */ + [0] = { + /* + * The init routine will query the devtree and fill this in + */ + .flags = IORESOURCE_IRQ, + }, + + /* + * Receive IRQ (optional) + */ + [1] = { + /* + * The init routine will query the devtree and fill this in + */ + .flags = IORESOURCE_IRQ, + }, + + /* + * Memory Mapped Registers + */ + [2] = { + /* + * The init routine will query the devtree and fill this in + */ + .flags = IORESOURCE_MEM, + }, +}; + +/* + * The platform_device structure which is passed to the driver + */ +static struct platform_device vdc_tio_platform_device = { + .name = "ubicom32fb", + .id = -1, + .resource = vdc_tio_resources, + .num_resources = ARRAY_SIZE(vdc_tio_resources), +}; + +/* + * vdc_tio_init + * Checks the device tree and instantiates the driver if found + */ +void __init vdc_tio_init(void) +{ + /* + * Check the device tree for the vdc_tio + */ + struct vdc_tio_node *vdc_node = + (struct vdc_tio_node *)devtree_find_node("vdctio"); + if (!vdc_node) { + printk(KERN_WARNING "No vdc_tio found\n"); + return; + } + + /* + * Fill in the resources and platform data from devtree information + */ + vdc_tio_resources[0].start = vdc_node->dn.sendirq; + vdc_tio_resources[1].start = vdc_node->dn.recvirq; + vdc_tio_resources[2].start = (u32_t)vdc_node->regs; + vdc_tio_resources[2].end = (u32_t)vdc_node->regs + + sizeof(struct vdc_tio_vp_regs); + + /* + * Try to get the device registered + */ + if (platform_device_register(&vdc_tio_platform_device) < 0) { + printk(KERN_WARNING "VDC failed to register\n"); + } +} -- cgit v1.2.3