-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MIPS: BCM63XX: Create platform_device for USBD
Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com> Patchwork: http://patchwork.linux-mips.org/patch/4111/ Signed-off-by: John Crispin <blogic@openwrt.org>
- Loading branch information
Kevin Cernekee
authored and
John Crispin
committed
Aug 30, 2012
1 parent
5fd66c2
commit 22df90f
Showing
5 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ | ||
dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-rng.o \ | ||
dev-spi.o dev-uart.o dev-wdt.o | ||
dev-spi.o dev-uart.o dev-wdt.o dev-usb-usbd.o | ||
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | ||
|
||
obj-y += boards/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* This file is subject to the terms and conditions of the GNU General Public | ||
* License. See the file "COPYING" in the main directory of this archive | ||
* for more details. | ||
* | ||
* Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> | ||
* Copyright (C) 2012 Kevin Cernekee <cernekee@gmail.com> | ||
* Copyright (C) 2012 Broadcom Corporation | ||
*/ | ||
|
||
#include <linux/init.h> | ||
#include <linux/kernel.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/dma-mapping.h> | ||
#include <bcm63xx_cpu.h> | ||
#include <bcm63xx_dev_usb_usbd.h> | ||
|
||
#define NUM_MMIO 2 | ||
#define NUM_IRQ 7 | ||
|
||
static struct resource usbd_resources[NUM_MMIO + NUM_IRQ]; | ||
|
||
static u64 usbd_dmamask = DMA_BIT_MASK(32); | ||
|
||
static struct platform_device bcm63xx_usbd_device = { | ||
.name = "bcm63xx_udc", | ||
.id = -1, | ||
.num_resources = ARRAY_SIZE(usbd_resources), | ||
.resource = usbd_resources, | ||
.dev = { | ||
.dma_mask = &usbd_dmamask, | ||
.coherent_dma_mask = DMA_BIT_MASK(32), | ||
}, | ||
}; | ||
|
||
int __init bcm63xx_usbd_register(const struct bcm63xx_usbd_platform_data *pd) | ||
{ | ||
const int irq_list[NUM_IRQ] = { IRQ_USBD, | ||
IRQ_USBD_RXDMA0, IRQ_USBD_TXDMA0, | ||
IRQ_USBD_RXDMA1, IRQ_USBD_TXDMA1, | ||
IRQ_USBD_RXDMA2, IRQ_USBD_TXDMA2 }; | ||
int i; | ||
|
||
if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368()) | ||
return 0; | ||
|
||
usbd_resources[0].start = bcm63xx_regset_address(RSET_USBD); | ||
usbd_resources[0].end = usbd_resources[0].start + RSET_USBD_SIZE - 1; | ||
usbd_resources[0].flags = IORESOURCE_MEM; | ||
|
||
usbd_resources[1].start = bcm63xx_regset_address(RSET_USBDMA); | ||
usbd_resources[1].end = usbd_resources[1].start + RSET_USBDMA_SIZE - 1; | ||
usbd_resources[1].flags = IORESOURCE_MEM; | ||
|
||
for (i = 0; i < NUM_IRQ; i++) { | ||
struct resource *r = &usbd_resources[NUM_MMIO + i]; | ||
|
||
r->start = r->end = bcm63xx_get_irq_number(irq_list[i]); | ||
r->flags = IORESOURCE_IRQ; | ||
} | ||
|
||
platform_device_add_data(&bcm63xx_usbd_device, pd, sizeof(*pd)); | ||
|
||
return platform_device_register(&bcm63xx_usbd_device); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef BCM63XX_DEV_USB_USBD_H_ | ||
#define BCM63XX_DEV_USB_USBD_H_ | ||
|
||
/* | ||
* usb device platform data | ||
*/ | ||
struct bcm63xx_usbd_platform_data { | ||
/* board can only support full speed (USB 1.1) */ | ||
int use_fullspeed; | ||
|
||
/* 0-based port index, for chips with >1 USB PHY */ | ||
int port_no; | ||
}; | ||
|
||
int bcm63xx_usbd_register(const struct bcm63xx_usbd_platform_data *pd); | ||
|
||
#endif /* BCM63XX_DEV_USB_USBD_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters