| 1 | From a2d78246e4cb45b5978fc682aad19c0fff0cd20d Mon Sep 17 00:00:00 2001 |
| 2 | From: Maxime Bizon <mbizon@freebox.fr> |
| 3 | Date: Tue, 24 May 2011 21:50:33 +0200 |
| 4 | Subject: [PATCH 26/63] MIPS: BCM63XX: register ehci device. |
| 5 | |
| 6 | --- |
| 7 | arch/mips/bcm63xx/Kconfig | 2 + |
| 8 | arch/mips/bcm63xx/Makefile | 2 +- |
| 9 | arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++ |
| 10 | arch/mips/bcm63xx/dev-usb-ehci.c | 50 ++++++++++++++++++++ |
| 11 | .../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h | 6 ++ |
| 12 | 5 files changed, 63 insertions(+), 1 deletions(-) |
| 13 | create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c |
| 14 | create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h |
| 15 | |
| 16 | --- a/arch/mips/bcm63xx/Kconfig |
| 17 | +++ b/arch/mips/bcm63xx/Kconfig |
| 18 | @@ -22,6 +22,7 @@ config BCM63XX_CPU_6358 |
| 19 | bool "support 6358 CPU" |
| 20 | select HW_HAS_PCI |
| 21 | select USB_ARCH_HAS_OHCI if USB_SUPPORT |
| 22 | + select USB_ARCH_HAS_EHCI if USB_SUPPORT |
| 23 | |
| 24 | config BCM63XX_CPU_6362 |
| 25 | bool "support 6362 CPU" |
| 26 | @@ -31,6 +32,7 @@ config BCM63XX_CPU_6368 |
| 27 | bool "support 6368 CPU" |
| 28 | select HW_HAS_PCI |
| 29 | select USB_ARCH_HAS_OHCI if USB_SUPPORT |
| 30 | + select USB_ARCH_HAS_EHCI if USB_SUPPORT |
| 31 | endmenu |
| 32 | |
| 33 | source "arch/mips/bcm63xx/boards/Kconfig" |
| 34 | --- a/arch/mips/bcm63xx/Makefile |
| 35 | +++ b/arch/mips/bcm63xx/Makefile |
| 36 | @@ -1,6 +1,6 @@ |
| 37 | obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ |
| 38 | dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-rng.o \ |
| 39 | - dev-spi.o dev-uart.o dev-usb-ohci.o dev-wdt.o |
| 40 | + dev-spi.o dev-uart.o dev-usb-ehci.o dev-usb-ohci.o dev-wdt.o |
| 41 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
| 42 | |
| 43 | obj-y += boards/ |
| 44 | --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c |
| 45 | +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c |
| 46 | @@ -28,6 +28,7 @@ |
| 47 | #include <bcm63xx_dev_pcmcia.h> |
| 48 | #include <bcm63xx_dev_spi.h> |
| 49 | #include <bcm63xx_dev_usb_ohci.h> |
| 50 | +#include <bcm63xx_dev_usb_ehci.h> |
| 51 | #include <board_bcm963xx.h> |
| 52 | #include <linux/bcm963xx_tag.h> |
| 53 | |
| 54 | @@ -917,6 +918,9 @@ int __init board_register_devices(void) |
| 55 | !board_get_mac_address(board.enet1.mac_addr)) |
| 56 | bcm63xx_enet_register(1, &board.enet1); |
| 57 | |
| 58 | + if (board.has_ehci0) |
| 59 | + bcm63xx_ehci_register(); |
| 60 | + |
| 61 | if (board.has_ohci0) |
| 62 | bcm63xx_ohci_register(); |
| 63 | |
| 64 | --- /dev/null |
| 65 | +++ b/arch/mips/bcm63xx/dev-usb-ehci.c |
| 66 | @@ -0,0 +1,50 @@ |
| 67 | +/* |
| 68 | + * This file is subject to the terms and conditions of the GNU General Public |
| 69 | + * License. See the file "COPYING" in the main directory of this archive |
| 70 | + * for more details. |
| 71 | + * |
| 72 | + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> |
| 73 | + */ |
| 74 | + |
| 75 | +#include <linux/init.h> |
| 76 | +#include <linux/kernel.h> |
| 77 | +#include <linux/platform_device.h> |
| 78 | +#include <bcm63xx_cpu.h> |
| 79 | +#include <bcm63xx_dev_usb_ehci.h> |
| 80 | + |
| 81 | +static struct resource ehci_resources[] = { |
| 82 | + { |
| 83 | + .start = -1, /* filled at runtime */ |
| 84 | + .end = -1, /* filled at runtime */ |
| 85 | + .flags = IORESOURCE_MEM, |
| 86 | + }, |
| 87 | + { |
| 88 | + .start = -1, /* filled at runtime */ |
| 89 | + .flags = IORESOURCE_IRQ, |
| 90 | + }, |
| 91 | +}; |
| 92 | + |
| 93 | +static u64 ehci_dmamask = ~(u32)0; |
| 94 | + |
| 95 | +static struct platform_device bcm63xx_ehci_device = { |
| 96 | + .name = "bcm63xx_ehci", |
| 97 | + .id = 0, |
| 98 | + .num_resources = ARRAY_SIZE(ehci_resources), |
| 99 | + .resource = ehci_resources, |
| 100 | + .dev = { |
| 101 | + .dma_mask = &ehci_dmamask, |
| 102 | + .coherent_dma_mask = 0xffffffff, |
| 103 | + }, |
| 104 | +}; |
| 105 | + |
| 106 | +int __init bcm63xx_ehci_register(void) |
| 107 | +{ |
| 108 | + if (!BCMCPU_IS_6358() && !BCMCPU_IS_6368()) |
| 109 | + return 0; |
| 110 | + |
| 111 | + ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); |
| 112 | + ehci_resources[0].end = ehci_resources[0].start; |
| 113 | + ehci_resources[0].end += RSET_EHCI_SIZE - 1; |
| 114 | + ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0); |
| 115 | + return platform_device_register(&bcm63xx_ehci_device); |
| 116 | +} |
| 117 | --- /dev/null |
| 118 | +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h |
| 119 | @@ -0,0 +1,6 @@ |
| 120 | +#ifndef BCM63XX_DEV_USB_EHCI_H_ |
| 121 | +#define BCM63XX_DEV_USB_EHCI_H_ |
| 122 | + |
| 123 | +int bcm63xx_ehci_register(void); |
| 124 | + |
| 125 | +#endif /* BCM63XX_DEV_USB_EHCI_H_ */ |
| 126 | |