aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c105
2 files changed, 106 insertions, 1 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 535a08ad69b3..8fbbef95021f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -694,6 +694,8 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
694 select HW_HAS_PCI 694 select HW_HAS_PCI
695 select ARCH_SUPPORTS_MSI 695 select ARCH_SUPPORTS_MSI
696 select ZONE_DMA32 696 select ZONE_DMA32
697 select USB_ARCH_HAS_OHCI
698 select USB_ARCH_HAS_EHCI
697 help 699 help
698 This option supports all of the Octeon reference boards from Cavium 700 This option supports all of the Octeon reference boards from Cavium
699 Networks. It builds a kernel that dynamically determines the Octeon 701 Networks. It builds a kernel that dynamically determines the Octeon
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 49c33202843b..cecaf62aef32 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -3,13 +3,14 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004-2009 Cavium Networks 6 * Copyright (C) 2004-2010 Cavium Networks
7 * Copyright (C) 2008 Wind River Systems 7 * Copyright (C) 2008 Wind River Systems
8 */ 8 */
9 9
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/i2c.h> 12#include <linux/i2c.h>
13#include <linux/usb.h>
13#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -337,6 +338,108 @@ out:
337} 338}
338device_initcall(octeon_mgmt_device_init); 339device_initcall(octeon_mgmt_device_init);
339 340
341#ifdef CONFIG_USB
342
343static int __init octeon_ehci_device_init(void)
344{
345 struct platform_device *pd;
346 int ret = 0;
347
348 struct resource usb_resources[] = {
349 {
350 .flags = IORESOURCE_MEM,
351 }, {
352 .flags = IORESOURCE_IRQ,
353 }
354 };
355
356 /* Only Octeon2 has ehci/ohci */
357 if (!OCTEON_IS_MODEL(OCTEON_CN63XX))
358 return 0;
359
360 if (octeon_is_simulation() || usb_disabled())
361 return 0; /* No USB in the simulator. */
362
363 pd = platform_device_alloc("octeon-ehci", 0);
364 if (!pd) {
365 ret = -ENOMEM;
366 goto out;
367 }
368
369 usb_resources[0].start = 0x00016F0000000000ULL;
370 usb_resources[0].end = usb_resources[0].start + 0x100;
371
372 usb_resources[1].start = OCTEON_IRQ_USB0;
373 usb_resources[1].end = OCTEON_IRQ_USB0;
374
375 ret = platform_device_add_resources(pd, usb_resources,
376 ARRAY_SIZE(usb_resources));
377 if (ret)
378 goto fail;
379
380 ret = platform_device_add(pd);
381 if (ret)
382 goto fail;
383
384 return ret;
385fail:
386 platform_device_put(pd);
387out:
388 return ret;
389}
390device_initcall(octeon_ehci_device_init);
391
392static int __init octeon_ohci_device_init(void)
393{
394 struct platform_device *pd;
395 int ret = 0;
396
397 struct resource usb_resources[] = {
398 {
399 .flags = IORESOURCE_MEM,
400 }, {
401 .flags = IORESOURCE_IRQ,
402 }
403 };
404
405 /* Only Octeon2 has ehci/ohci */
406 if (!OCTEON_IS_MODEL(OCTEON_CN63XX))
407 return 0;
408
409 if (octeon_is_simulation() || usb_disabled())
410 return 0; /* No USB in the simulator. */
411
412 pd = platform_device_alloc("octeon-ohci", 0);
413 if (!pd) {
414 ret = -ENOMEM;
415 goto out;
416 }
417
418 usb_resources[0].start = 0x00016F0000000400ULL;
419 usb_resources[0].end = usb_resources[0].start + 0x100;
420
421 usb_resources[1].start = OCTEON_IRQ_USB0;
422 usb_resources[1].end = OCTEON_IRQ_USB0;
423
424 ret = platform_device_add_resources(pd, usb_resources,
425 ARRAY_SIZE(usb_resources));
426 if (ret)
427 goto fail;
428
429 ret = platform_device_add(pd);
430 if (ret)
431 goto fail;
432
433 return ret;
434fail:
435 platform_device_put(pd);
436out:
437 return ret;
438}
439device_initcall(octeon_ohci_device_init);
440
441#endif /* CONFIG_USB */
442
340MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); 443MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>");
341MODULE_LICENSE("GPL"); 444MODULE_LICENSE("GPL");
342MODULE_DESCRIPTION("Platform driver for Octeon SOC"); 445MODULE_DESCRIPTION("Platform driver for Octeon SOC");