aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-usb-udc.c
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-03-17 11:28:54 +0000
committerFlorian Fainelli <florian@openwrt.org>2009-03-17 11:28:54 +0000
commit32c29f1aafd66721153ef54a32d311d0c0a749b8 (patch)
tree978c545e5707615f3837b714e65603e8296dc15c /target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-usb-udc.c
parentfb5b85c7c88fb710fdf9e5f0253127fc7e0443d3 (diff)
downloadupstream-32c29f1aafd66721153ef54a32d311d0c0a749b8.tar.gz
upstream-32c29f1aafd66721153ef54a32d311d0c0a749b8.tar.bz2
upstream-32c29f1aafd66721153ef54a32d311d0c0a749b8.zip
fix SPI register switch and prepare for UDC, thanks to Henk Vergonet (#4783)
SVN-Revision: 14914
Diffstat (limited to 'target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-usb-udc.c')
-rw-r--r--target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-usb-udc.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-usb-udc.c b/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-usb-udc.c
new file mode 100644
index 0000000000..4459f2f003
--- /dev/null
+++ b/target/linux/brcm63xx/files/arch/mips/bcm63xx/dev-usb-udc.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 Henk Vergonet <Henk.Vergonet@gmail.com>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <bcm63xx_cpu.h>
+
+static struct resource udc_resources[] = {
+ {
+ .start = -1, /* filled at runtime */
+ .end = -1, /* filled at runtime */
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = -1, /* filled at runtime */
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 udc_dmamask = ~(u32)0;
+
+static struct platform_device bcm63xx_udc_device = {
+ .name = "bcm63xx-udc",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(udc_resources),
+ .resource = udc_resources,
+ .dev = {
+ .dma_mask = &udc_dmamask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+};
+
+int __init bcm63xx_udc_register(void)
+{
+ if (!BCMCPU_IS_6338() && !BCMCPU_IS_6348())
+ return 0;
+
+ udc_resources[0].start = bcm63xx_regset_address(RSET_UDC0);
+ udc_resources[0].end = udc_resources[0].start;
+ udc_resources[0].end += RSET_UDC_SIZE - 1;
+ udc_resources[1].start = bcm63xx_get_irq_number(IRQ_UDC0);
+ return platform_device_register(&bcm63xx_udc_device);
+}