Skip to contentSkip to conversation

Prerequisites for BCM63XX UDC driver

PATCH In review Kevin Cernekee 4 participants 13 messages Jun 23, 2012 – Aug 30, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Prerequisites for BCM63XX UDC driver

These patches are intended to lay the groundwork for a new USB Device Controller (gadget UDC) driver. arch/mips/bcm63xx updates include:

Clock enable bits
DMA descriptor updates
New register and IRQ definitions
Create platform_device and platform_data

Baseline is:

git://git.linux-mips.org/pub/scm/ralf/upstream-sfr.git #mips-for-linux-next

Note that this is not an OTG-capable controller. Therefore, boards are permanently wired up for either host mode or device mode. Device vs. host can be determined in board_bcm963xx.c based on the detected board ID. Some boards have connectors/pads for both modes, but need to be reworked to run in device mode; usually this involves moving 0-ohm resistors on the D+ and D- lines.

#1 lore raw

PATCH 1/7 MIPS: BCM63XX: Expose the USBH/USBD clocks on BCM6328/BCM6368

---
 arch/mips/bcm63xx/clk.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
arch/mips/bcm63xx/clk.c +20 -1
index 1db48ad..dff79ab 100644
@@ -160,7 +160,9 @@ static struct clk clk_pcm = {
  */
 static void usbh_set(struct clk *clk, int enable)
 {
-	if (BCMCPU_IS_6348())
+	if (BCMCPU_IS_6328())
+		bcm_hwclock_set(CKCTL_6328_USBH_EN, enable);
+	else if (BCMCPU_IS_6348())
 		bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
 	else if (BCMCPU_IS_6368())
 		bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
@@ -171,6 +173,21 @@ static struct clk clk_usbh = {
 };
 
 /*
+ * USB device clock
+ */
+static void usbd_set(struct clk *clk, int enable)
+{
+	if (BCMCPU_IS_6328())
+		bcm_hwclock_set(CKCTL_6328_USBD_EN, enable);
+	else if (BCMCPU_IS_6368())
+		bcm_hwclock_set(CKCTL_6368_USBD_EN, enable);
+}
+
+static struct clk clk_usbd = {
+	.set	= usbd_set,
+};
+
+/*
  * SPI clock
  */
 static void spi_set(struct clk *clk, int enable)
@@ -284,6 +301,8 @@ struct clk *clk_get(struct device *dev, const char *id)
 		return &clk_ephy;
 	if (!strcmp(id, "usbh"))
 		return &clk_usbh;
+	if (!strcmp(id, "usbd"))
+		return &clk_usbd;
 	if (!strcmp(id, "spi"))
 		return &clk_spi;
 	if (!strcmp(id, "xtm"))
Signature · 1 line
1.7.11.1
#2 lore raw

PATCH 2/7 MIPS: BCM63XX: Move DMA descriptor definition into common header file

In reply to Kevin Cernekee

The "IUDMA" engine used by bcm63xx_enet is also used by other blocks, such as the USB 2.0 device. Move the definitions into a common file so that they do not need to be duplicated in each driver.

---
 .../include/asm/mach-bcm63xx/bcm63xx_dev_enet.h    | 29 +++++++++++++++++++++
 drivers/net/ethernet/broadcom/bcm63xx_enet.h       | 30 +---------------------
 2 files changed, 30 insertions(+), 29 deletions(-)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h +29 -0
index d53f611..650604e 100644
@@ -3,6 +3,7 @@
 
 #include <linux/if_ether.h>
 #include <linux/init.h>
+#include <linux/types.h>
 
 /*
  * on board ethernet platform data
@@ -42,4 +43,32 @@ struct bcm63xx_enet_platform_data {
 int __init bcm63xx_enet_register(int unit,
 				 const struct bcm63xx_enet_platform_data *pd);
 
+/*
+ * rx/tx iudma descriptor
+ */
+struct bcm_enet_desc {
+	u32 len_stat;
+	u32 address;
+};
+
+#define DMADESC_LENGTH_SHIFT	16
+#define DMADESC_LENGTH_MASK	(0xfff << DMADESC_LENGTH_SHIFT)
+#define DMADESC_OWNER_MASK	(1 << 15)
+#define DMADESC_EOP_MASK	(1 << 14)
+#define DMADESC_SOP_MASK	(1 << 13)
+#define DMADESC_ESOP_MASK	(DMADESC_EOP_MASK | DMADESC_SOP_MASK)
+#define DMADESC_WRAP_MASK	(1 << 12)
+
+#define DMADESC_UNDER_MASK	(1 << 9)
+#define DMADESC_APPEND_CRC	(1 << 8)
+#define DMADESC_OVSIZE_MASK	(1 << 4)
+#define DMADESC_RXER_MASK	(1 << 2)
+#define DMADESC_CRC_MASK	(1 << 1)
+#define DMADESC_OV_MASK		(1 << 0)
+#define DMADESC_ERR_MASK	(DMADESC_UNDER_MASK | \
+				DMADESC_OVSIZE_MASK | \
+				DMADESC_RXER_MASK | \
+				DMADESC_CRC_MASK | \
+				DMADESC_OV_MASK)
+
 #endif /* ! BCM63XX_DEV_ENET_H_ */
drivers/net/ethernet/broadcom/bcm63xx_enet.h +1 -29
index 0e3048b..df19535 100644
@@ -10,6 +10,7 @@
 #include <bcm63xx_regs.h>
 #include <bcm63xx_irq.h>
 #include <bcm63xx_io.h>
+#include <bcm63xx_dev_enet.h>
 
 /* default number of descriptor */
 #define BCMENET_DEF_RX_DESC	64
@@ -31,35 +32,6 @@
 #define BCMENET_MAX_MTU		2046
 
 /*
- * rx/tx dma descriptor
- */
-struct bcm_enet_desc {
-	u32 len_stat;
-	u32 address;
-};
-
-#define DMADESC_LENGTH_SHIFT	16
-#define DMADESC_LENGTH_MASK	(0xfff << DMADESC_LENGTH_SHIFT)
-#define DMADESC_OWNER_MASK	(1 << 15)
-#define DMADESC_EOP_MASK	(1 << 14)
-#define DMADESC_SOP_MASK	(1 << 13)
-#define DMADESC_ESOP_MASK	(DMADESC_EOP_MASK | DMADESC_SOP_MASK)
-#define DMADESC_WRAP_MASK	(1 << 12)
-
-#define DMADESC_UNDER_MASK	(1 << 9)
-#define DMADESC_APPEND_CRC	(1 << 8)
-#define DMADESC_OVSIZE_MASK	(1 << 4)
-#define DMADESC_RXER_MASK	(1 << 2)
-#define DMADESC_CRC_MASK	(1 << 1)
-#define DMADESC_OV_MASK		(1 << 0)
-#define DMADESC_ERR_MASK	(DMADESC_UNDER_MASK | \
-				DMADESC_OVSIZE_MASK | \
-				DMADESC_RXER_MASK | \
-				DMADESC_CRC_MASK | \
-				DMADESC_OV_MASK)
-
-
-/*
  * MIB Counters register definitions
 */
 #define ETH_MIB_TX_GD_OCTETS			0
Signature · 1 line
1.7.11.1
#4 lore raw

PATCH 3/7 MIPS: BCM63XX: Add new IUDMA definitions needed for USBD

In reply to Kevin Cernekee
---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 3 +++
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h     | 6 ++++++
 2 files changed, 9 insertions(+)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h +3 -0
index d12a439..b1e6026 100644
@@ -50,6 +50,7 @@ struct bcm_enet_desc {
 	u32 address;
 };
 
+/* control */
 #define DMADESC_LENGTH_SHIFT	16
 #define DMADESC_LENGTH_MASK	(0xfff << DMADESC_LENGTH_SHIFT)
 #define DMADESC_OWNER_MASK	(1 << 15)
@@ -57,7 +58,9 @@ struct bcm_enet_desc {
 #define DMADESC_SOP_MASK	(1 << 13)
 #define DMADESC_ESOP_MASK	(DMADESC_EOP_MASK | DMADESC_SOP_MASK)
 #define DMADESC_WRAP_MASK	(1 << 12)
+#define DMADESC_USB_ZERO_MASK	(1 << 0)
 
+/* status */
 #define DMADESC_UNDER_MASK	(1 << 9)
 #define DMADESC_APPEND_CRC	(1 << 8)
 #define DMADESC_OVSIZE_MASK	(1 << 4)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +6 -0
index 4ccc2a7..b970940 100644
@@ -670,6 +670,12 @@
 #define ENETDMA_BUFALLOC_FORCE_SHIFT	31
 #define ENETDMA_BUFALLOC_FORCE_MASK	(1 << ENETDMA_BUFALLOC_FORCE_SHIFT)
 
+/* Global interrupt status */
+#define ENETDMA_GLB_IRQSTAT_REG		(0x40)
+
+/* Global interrupt mask */
+#define ENETDMA_GLB_IRQMASK_REG		(0x44)
+
 /* Channel Configuration register */
 #define ENETDMA_CHANCFG_REG(x)		(0x100 + (x) * 0x10)
 #define ENETDMA_CHANCFG_EN_SHIFT	0
Signature · 1 line
1.7.11.1
#5 lore raw

PATCH 4/7 MIPS: BCM63XX: Add register definitions for USBD dependencies

In reply to Kevin Cernekee

The USB 2.0 device depends on some functionality in other blocks, such as GPIO and USBH. Add those register definitions here.

---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h  | 6 +++---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 8 ++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +3 -3
index e104ddb..2b59ae4 100644
@@ -184,9 +184,9 @@ enum bcm63xx_regs_set {
 #define BCM_6328_SPI_BASE		(0xdeadbeef)
 #define BCM_6328_UDC0_BASE		(0xdeadbeef)
 #define BCM_6328_USBDMA_BASE		(0xdeadbeef)
-#define BCM_6328_OHCI0_BASE		(0xdeadbeef)
+#define BCM_6328_OHCI0_BASE		(0xb0002600)
 #define BCM_6328_OHCI_PRIV_BASE		(0xdeadbeef)
-#define BCM_6328_USBH_PRIV_BASE		(0xdeadbeef)
+#define BCM_6328_USBH_PRIV_BASE		(0xb0002700)
 #define BCM_6328_MPI_BASE		(0xdeadbeef)
 #define BCM_6328_PCMCIA_BASE		(0xdeadbeef)
 #define BCM_6328_PCIE_BASE		(0xb0e40000)
@@ -199,7 +199,7 @@ enum bcm63xx_regs_set {
 #define BCM_6328_ENETDMAC_BASE		(0xb000da00)
 #define BCM_6328_ENETDMAS_BASE		(0xb000dc00)
 #define BCM_6328_ENETSW_BASE		(0xb0e00000)
-#define BCM_6328_EHCI0_BASE		(0x10002500)
+#define BCM_6328_EHCI0_BASE		(0xb0002500)
 #define BCM_6328_SDRAM_BASE		(0xdeadbeef)
 #define BCM_6328_MEMC_BASE		(0xdeadbeef)
 #define BCM_6328_DDR_BASE		(0xb0003000)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +8 -0
index b970940..ad2db9c 100644
@@ -543,6 +543,12 @@
 #define GPIO_MODE_6368_SPI_SSN5		(1 << 31)
 
 
+#define GPIO_PINMUX_OTHR_REG		0x24
+#define GPIO_PINMUX_OTHR_6328_USB_SHIFT	12
+#define GPIO_PINMUX_OTHR_6328_USB_MASK	(3 << GPIO_PINMUX_OTHR_6328_USB_SHIFT)
+#define GPIO_PINMUX_OTHR_6328_USB_HOST	(1 << GPIO_PINMUX_OTHR_6328_USB_SHIFT)
+#define GPIO_PINMUX_OTHR_6328_USB_DEV	(2 << GPIO_PINMUX_OTHR_6328_USB_SHIFT)
+
 #define GPIO_BASEMODE_6368_REG		0x38
 #define GPIO_BASEMODE_6368_UART2	0x1
 #define GPIO_BASEMODE_6368_GPIO		0x0
@@ -776,6 +782,8 @@
 #define USBH_PRIV_SWAP_6358_REG		0x0
 #define USBH_PRIV_SWAP_6368_REG		0x1c
 
+#define USBH_PRIV_SWAP_USBD_SHIFT	6
+#define USBH_PRIV_SWAP_USBD_MASK	(1 << USBH_PRIV_SWAP_USBD_SHIFT)
 #define USBH_PRIV_SWAP_EHCI_ENDN_SHIFT	4
 #define USBH_PRIV_SWAP_EHCI_ENDN_MASK	(1 << USBH_PRIV_SWAP_EHCI_ENDN_SHIFT)
 #define USBH_PRIV_SWAP_EHCI_DATA_SHIFT	3
Signature · 1 line
1.7.11.1
#6 lore raw

PATCH 5/7 MIPS: BCM63XX: Fix USB IRQ definitions for 6328

In reply to Kevin Cernekee

OHCI/EHCI are in the high (second) word. Not currently used by any driver.

---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +2 -2
index 2b59ae4..c0e6333 100644
@@ -602,8 +602,8 @@ enum bcm63xx_irq {
 #define BCM_6328_ENET0_IRQ		0
 #define BCM_6328_ENET1_IRQ		0
 #define BCM_6328_ENET_PHY_IRQ		(IRQ_INTERNAL_BASE + 12)
-#define BCM_6328_OHCI0_IRQ		(IRQ_INTERNAL_BASE + 9)
-#define BCM_6328_EHCI0_IRQ		(IRQ_INTERNAL_BASE + 10)
+#define BCM_6328_OHCI0_IRQ		(BCM_6328_HIGH_IRQ_BASE + 9)
+#define BCM_6328_EHCI0_IRQ		(BCM_6328_HIGH_IRQ_BASE + 10)
 #define BCM_6328_PCMCIA_IRQ		0
 #define BCM_6328_ENET0_RXDMA_IRQ	0
 #define BCM_6328_ENET0_TXDMA_IRQ	0
Signature · 1 line
1.7.11.1
#7 lore raw

PATCH 6/7 MIPS: BCM63XX: Add register and IRQ definitions for USB 2.0 device

In reply to Kevin Cernekee
---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h  |  75 ++++++++++-
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 147 ++++++++++++++++++++++
 2 files changed, 221 insertions(+), 1 deletion(-)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +74 -1
index c0e6333..8a68ec4 100644
@@ -120,6 +120,8 @@ enum bcm63xx_regs_set {
 	RSET_OHCI0,
 	RSET_OHCI_PRIV,
 	RSET_USBH_PRIV,
+	RSET_USBD,
+	RSET_USBDMA,
 	RSET_MPI,
 	RSET_PCMCIA,
 	RSET_PCIE,
@@ -162,6 +164,8 @@ enum bcm63xx_regs_set {
 #define RSET_UDC_SIZE			256
 #define RSET_OHCI_SIZE			256
 #define RSET_EHCI_SIZE			256
+#define RSET_USBD_SIZE			256
+#define RSET_USBDMA_SIZE		1280
 #define RSET_PCMCIA_SIZE		12
 #define RSET_M2M_SIZE			256
 #define RSET_ATM_SIZE			4096
@@ -183,10 +187,11 @@ enum bcm63xx_regs_set {
 #define BCM_6328_GPIO_BASE		(0xb0000080)
 #define BCM_6328_SPI_BASE		(0xdeadbeef)
 #define BCM_6328_UDC0_BASE		(0xdeadbeef)
-#define BCM_6328_USBDMA_BASE		(0xdeadbeef)
+#define BCM_6328_USBDMA_BASE		(0xb000c000)
 #define BCM_6328_OHCI0_BASE		(0xb0002600)
 #define BCM_6328_OHCI_PRIV_BASE		(0xdeadbeef)
 #define BCM_6328_USBH_PRIV_BASE		(0xb0002700)
+#define BCM_6328_USBD_BASE		(0xb0002400)
 #define BCM_6328_MPI_BASE		(0xdeadbeef)
 #define BCM_6328_PCMCIA_BASE		(0xdeadbeef)
 #define BCM_6328_PCIE_BASE		(0xb0e40000)
@@ -232,6 +237,7 @@ enum bcm63xx_regs_set {
 #define BCM_6338_OHCI0_BASE		(0xdeadbeef)
 #define BCM_6338_OHCI_PRIV_BASE		(0xfffe3000)
 #define BCM_6338_USBH_PRIV_BASE		(0xdeadbeef)
+#define BCM_6338_USBD_BASE		(0xdeadbeef)
 #define BCM_6338_MPI_BASE		(0xfffe3160)
 #define BCM_6338_PCMCIA_BASE		(0xdeadbeef)
 #define BCM_6338_PCIE_BASE		(0xdeadbeef)
@@ -286,6 +292,7 @@ enum bcm63xx_regs_set {
 #define BCM_6345_OHCI0_BASE		(0xfffe2100)
 #define BCM_6345_OHCI_PRIV_BASE		(0xfffe2200)
 #define BCM_6345_USBH_PRIV_BASE		(0xdeadbeef)
+#define BCM_6345_USBD_BASE		(0xdeadbeef)
 #define BCM_6345_SDRAM_REGS_BASE	(0xfffe2300)
 #define BCM_6345_DSL_BASE		(0xdeadbeef)
 #define BCM_6345_UBUS_BASE		(0xdeadbeef)
@@ -319,9 +326,11 @@ enum bcm63xx_regs_set {
 #define BCM_6348_GPIO_BASE		(0xfffe0400)
 #define BCM_6348_SPI_BASE		(0xfffe0c00)
 #define BCM_6348_UDC0_BASE		(0xfffe1000)
+#define BCM_6348_USBDMA_BASE		(0xdeadbeef)
 #define BCM_6348_OHCI0_BASE		(0xfffe1b00)
 #define BCM_6348_OHCI_PRIV_BASE		(0xfffe1c00)
 #define BCM_6348_USBH_PRIV_BASE		(0xdeadbeef)
+#define BCM_6348_USBD_BASE		(0xdeadbeef)
 #define BCM_6348_MPI_BASE		(0xfffe2000)
 #define BCM_6348_PCMCIA_BASE		(0xfffe2054)
 #define BCM_6348_PCIE_BASE		(0xdeadbeef)
@@ -362,9 +371,11 @@ enum bcm63xx_regs_set {
 #define BCM_6358_GPIO_BASE		(0xfffe0080)
 #define BCM_6358_SPI_BASE		(0xfffe0800)
 #define BCM_6358_UDC0_BASE		(0xfffe0800)
+#define BCM_6358_USBDMA_BASE		(0xdeadbeef)
 #define BCM_6358_OHCI0_BASE		(0xfffe1400)
 #define BCM_6358_OHCI_PRIV_BASE		(0xdeadbeef)
 #define BCM_6358_USBH_PRIV_BASE		(0xfffe1500)
+#define BCM_6358_USBD_BASE		(0xdeadbeef)
 #define BCM_6358_MPI_BASE		(0xfffe1000)
 #define BCM_6358_PCMCIA_BASE		(0xfffe1054)
 #define BCM_6358_PCIE_BASE		(0xdeadbeef)
@@ -406,9 +417,11 @@ enum bcm63xx_regs_set {
 #define BCM_6368_GPIO_BASE		(0xb0000080)
 #define BCM_6368_SPI_BASE		(0xb0000800)
 #define BCM_6368_UDC0_BASE		(0xdeadbeef)
+#define BCM_6368_USBDMA_BASE		(0xb0004800)
 #define BCM_6368_OHCI0_BASE		(0xb0001600)
 #define BCM_6368_OHCI_PRIV_BASE		(0xdeadbeef)
 #define BCM_6368_USBH_PRIV_BASE		(0xb0001700)
+#define BCM_6368_USBD_BASE		(0xb0001400)
 #define BCM_6368_MPI_BASE		(0xb0001000)
 #define BCM_6368_PCMCIA_BASE		(0xb0001054)
 #define BCM_6368_PCIE_BASE		(0xdeadbeef)
@@ -458,6 +471,8 @@ extern const unsigned long *bcm63xx_regs_base;
 	__GEN_RSET_BASE(__cpu, OHCI0)					\
 	__GEN_RSET_BASE(__cpu, OHCI_PRIV)				\
 	__GEN_RSET_BASE(__cpu, USBH_PRIV)				\
+	__GEN_RSET_BASE(__cpu, USBD)					\
+	__GEN_RSET_BASE(__cpu, USBDMA)					\
 	__GEN_RSET_BASE(__cpu, MPI)					\
 	__GEN_RSET_BASE(__cpu, PCMCIA)					\
 	__GEN_RSET_BASE(__cpu, PCIE)					\
@@ -499,6 +514,8 @@ extern const unsigned long *bcm63xx_regs_base;
 	[RSET_OHCI0]		= BCM_## __cpu ##_OHCI0_BASE,		\
 	[RSET_OHCI_PRIV]	= BCM_## __cpu ##_OHCI_PRIV_BASE,	\
 	[RSET_USBH_PRIV]	= BCM_## __cpu ##_USBH_PRIV_BASE,	\
+	[RSET_USBD]		= BCM_## __cpu ##_USBD_BASE,		\
+	[RSET_USBDMA]		= BCM_## __cpu ##_USBDMA_BASE,		\
 	[RSET_MPI]		= BCM_## __cpu ##_MPI_BASE,		\
 	[RSET_PCMCIA]		= BCM_## __cpu ##_PCMCIA_BASE,		\
 	[RSET_PCIE]		= BCM_## __cpu ##_PCIE_BASE,		\
@@ -569,6 +586,13 @@ enum bcm63xx_irq {
 	IRQ_ENET_PHY,
 	IRQ_OHCI0,
 	IRQ_EHCI0,
+	IRQ_USBD,
+	IRQ_USBDMA_RXDMA0,
+	IRQ_USBDMA_TXDMA1,
+	IRQ_USBDMA_RXDMA2,
+	IRQ_USBDMA_TXDMA3,
+	IRQ_USBDMA_RXDMA4,
+	IRQ_USBDMA_TXDMA5,
 	IRQ_ENET0_RXDMA,
 	IRQ_ENET0_TXDMA,
 	IRQ_ENET1_RXDMA,
@@ -604,6 +628,13 @@ enum bcm63xx_irq {
 #define BCM_6328_ENET_PHY_IRQ		(IRQ_INTERNAL_BASE + 12)
 #define BCM_6328_OHCI0_IRQ		(BCM_6328_HIGH_IRQ_BASE + 9)
 #define BCM_6328_EHCI0_IRQ		(BCM_6328_HIGH_IRQ_BASE + 10)
+#define BCM_6328_USBD_IRQ		(IRQ_INTERNAL_BASE + 4)
+#define BCM_6328_USBDMA_RXDMA0_IRQ	(IRQ_INTERNAL_BASE + 5)
+#define BCM_6328_USBDMA_TXDMA1_IRQ	(IRQ_INTERNAL_BASE + 6)
+#define BCM_6328_USBDMA_RXDMA2_IRQ	(IRQ_INTERNAL_BASE + 7)
+#define BCM_6328_USBDMA_TXDMA3_IRQ	(IRQ_INTERNAL_BASE + 8)
+#define BCM_6328_USBDMA_RXDMA4_IRQ	(IRQ_INTERNAL_BASE + 9)
+#define BCM_6328_USBDMA_TXDMA5_IRQ	(IRQ_INTERNAL_BASE + 10)
 #define BCM_6328_PCMCIA_IRQ		0
 #define BCM_6328_ENET0_RXDMA_IRQ	0
 #define BCM_6328_ENET0_TXDMA_IRQ	0
@@ -642,6 +673,13 @@ enum bcm63xx_irq {
 #define BCM_6338_ENET_PHY_IRQ		(IRQ_INTERNAL_BASE + 9)
 #define BCM_6338_OHCI0_IRQ		0
 #define BCM_6338_EHCI0_IRQ		0
+#define BCM_6338_USBD_IRQ		0
+#define BCM_6338_USBDMA_RXDMA0_IRQ	0
+#define BCM_6338_USBDMA_TXDMA1_IRQ	0
+#define BCM_6338_USBDMA_RXDMA2_IRQ	0
+#define BCM_6338_USBDMA_TXDMA3_IRQ	0
+#define BCM_6338_USBDMA_RXDMA4_IRQ	0
+#define BCM_6338_USBDMA_TXDMA5_IRQ	0
 #define BCM_6338_ENET0_RXDMA_IRQ	(IRQ_INTERNAL_BASE + 15)
 #define BCM_6338_ENET0_TXDMA_IRQ	(IRQ_INTERNAL_BASE + 16)
 #define BCM_6338_ENET1_RXDMA_IRQ	0
@@ -673,6 +711,13 @@ enum bcm63xx_irq {
 #define BCM_6345_ENET_PHY_IRQ		(IRQ_INTERNAL_BASE + 12)
 #define BCM_6345_OHCI0_IRQ		0
 #define BCM_6345_EHCI0_IRQ		0
+#define BCM_6345_USBD_IRQ		0
+#define BCM_6345_USBDMA_RXDMA0_IRQ	0
+#define BCM_6345_USBDMA_TXDMA1_IRQ	0
+#define BCM_6345_USBDMA_RXDMA2_IRQ	0
+#define BCM_6345_USBDMA_TXDMA3_IRQ	0
+#define BCM_6345_USBDMA_RXDMA4_IRQ	0
+#define BCM_6345_USBDMA_TXDMA5_IRQ	0
 #define BCM_6345_ENET0_RXDMA_IRQ	(IRQ_INTERNAL_BASE + 13 + 1)
 #define BCM_6345_ENET0_TXDMA_IRQ	(IRQ_INTERNAL_BASE + 13 + 2)
 #define BCM_6345_ENET1_RXDMA_IRQ	0
@@ -704,6 +749,13 @@ enum bcm63xx_irq {
 #define BCM_6348_ENET_PHY_IRQ		(IRQ_INTERNAL_BASE + 9)
 #define BCM_6348_OHCI0_IRQ		(IRQ_INTERNAL_BASE + 12)
 #define BCM_6348_EHCI0_IRQ		0
+#define BCM_6348_USBD_IRQ		0
+#define BCM_6348_USBDMA_RXDMA0_IRQ	0
+#define BCM_6348_USBDMA_TXDMA1_IRQ	0
+#define BCM_6348_USBDMA_RXDMA2_IRQ	0
+#define BCM_6348_USBDMA_TXDMA3_IRQ	0
+#define BCM_6348_USBDMA_RXDMA4_IRQ	0
+#define BCM_6348_USBDMA_TXDMA5_IRQ	0
 #define BCM_6348_ENET0_RXDMA_IRQ	(IRQ_INTERNAL_BASE + 20)
 #define BCM_6348_ENET0_TXDMA_IRQ	(IRQ_INTERNAL_BASE + 21)
 #define BCM_6348_ENET1_RXDMA_IRQ	(IRQ_INTERNAL_BASE + 22)
@@ -735,6 +787,13 @@ enum bcm63xx_irq {
 #define BCM_6358_ENET_PHY_IRQ		(IRQ_INTERNAL_BASE + 9)
 #define BCM_6358_OHCI0_IRQ		(IRQ_INTERNAL_BASE + 5)
 #define BCM_6358_EHCI0_IRQ		(IRQ_INTERNAL_BASE + 10)
+#define BCM_6358_USBD_IRQ		0
+#define BCM_6358_USBDMA_RXDMA0_IRQ	0
+#define BCM_6358_USBDMA_TXDMA1_IRQ	0
+#define BCM_6358_USBDMA_RXDMA2_IRQ	0
+#define BCM_6358_USBDMA_TXDMA3_IRQ	0
+#define BCM_6358_USBDMA_RXDMA4_IRQ	0
+#define BCM_6358_USBDMA_TXDMA5_IRQ	0
 #define BCM_6358_ENET0_RXDMA_IRQ	(IRQ_INTERNAL_BASE + 15)
 #define BCM_6358_ENET0_TXDMA_IRQ	(IRQ_INTERNAL_BASE + 16)
 #define BCM_6358_ENET1_RXDMA_IRQ	(IRQ_INTERNAL_BASE + 17)
@@ -775,6 +834,13 @@ enum bcm63xx_irq {
 #define BCM_6368_ENET_PHY_IRQ		(IRQ_INTERNAL_BASE + 15)
 #define BCM_6368_OHCI0_IRQ		(IRQ_INTERNAL_BASE + 5)
 #define BCM_6368_EHCI0_IRQ		(IRQ_INTERNAL_BASE + 7)
+#define BCM_6368_USBD_IRQ		(IRQ_INTERNAL_BASE + 8)
+#define BCM_6368_USBDMA_RXDMA0_IRQ	(IRQ_INTERNAL_BASE + 26)
+#define BCM_6368_USBDMA_TXDMA1_IRQ	(IRQ_INTERNAL_BASE + 27)
+#define BCM_6368_USBDMA_RXDMA2_IRQ	(IRQ_INTERNAL_BASE + 28)
+#define BCM_6368_USBDMA_TXDMA3_IRQ	(IRQ_INTERNAL_BASE + 29)
+#define BCM_6368_USBDMA_RXDMA4_IRQ	(IRQ_INTERNAL_BASE + 30)
+#define BCM_6368_USBDMA_TXDMA5_IRQ	(IRQ_INTERNAL_BASE + 31)
 #define BCM_6368_PCMCIA_IRQ		0
 #define BCM_6368_ENET0_RXDMA_IRQ	0
 #define BCM_6368_ENET0_TXDMA_IRQ	0
@@ -815,6 +881,13 @@ extern const int *bcm63xx_irqs;
 	[IRQ_ENET_PHY]		= BCM_## __cpu ##_ENET_PHY_IRQ,		\
 	[IRQ_OHCI0]		= BCM_## __cpu ##_OHCI0_IRQ,		\
 	[IRQ_EHCI0]		= BCM_## __cpu ##_EHCI0_IRQ,		\
+	[IRQ_USBD]		= BCM_## __cpu ##_USBD_IRQ,		\
+	[IRQ_USBDMA_RXDMA0]	= BCM_## __cpu ##_USBDMA_RXDMA0_IRQ,	\
+	[IRQ_USBDMA_TXDMA1]	= BCM_## __cpu ##_USBDMA_TXDMA1_IRQ,	\
+	[IRQ_USBDMA_RXDMA2]	= BCM_## __cpu ##_USBDMA_RXDMA2_IRQ,	\
+	[IRQ_USBDMA_TXDMA3]	= BCM_## __cpu ##_USBDMA_TXDMA3_IRQ,	\
+	[IRQ_USBDMA_RXDMA4]	= BCM_## __cpu ##_USBDMA_RXDMA4_IRQ,	\
+	[IRQ_USBDMA_TXDMA5]	= BCM_## __cpu ##_USBDMA_TXDMA5_IRQ,	\
 	[IRQ_ENET0_RXDMA]	= BCM_## __cpu ##_ENET0_RXDMA_IRQ,	\
 	[IRQ_ENET0_TXDMA]	= BCM_## __cpu ##_ENET0_TXDMA_IRQ,	\
 	[IRQ_ENET1_RXDMA]	= BCM_## __cpu ##_ENET1_RXDMA_IRQ,	\
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +147 -0

159 lines not on this page · raw message

Signature · 1 line
1.7.11.1
#8 lore raw

PATCH 7/7 MIPS: BCM63XX: Create platform_device for USBD

In reply to Kevin Cernekee
---
 arch/mips/bcm63xx/Makefile                         |  2 +-
 arch/mips/bcm63xx/boards/board_bcm963xx.c          | 10 +++
 arch/mips/bcm63xx/dev-usb-usbd.c                   | 72 ++++++++++++++++++++++
 .../asm/mach-bcm63xx/bcm63xx_dev_usb_usbd.h        | 17 +++++
 .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h |  5 ++
 5 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/bcm63xx/dev-usb-usbd.c
 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_usbd.h
arch/mips/bcm63xx/Makefile +1 -1
index 833af72..9bbb30a 100644
@@ -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/
arch/mips/bcm63xx/boards/board_bcm963xx.c +10 -0
index feb0525..ea4ea77 100644
@@ -24,6 +24,7 @@
 #include <bcm63xx_dev_flash.h>
 #include <bcm63xx_dev_pcmcia.h>
 #include <bcm63xx_dev_spi.h>
+#include <bcm63xx_dev_usb_usbd.h>
 #include <board_bcm963xx.h>
 
 #define PFX	"board_bcm963xx: "
@@ -42,6 +43,12 @@ static struct board_info __initdata board_96328avng = {
 
 	.has_uart0			= 1,
 	.has_pci			= 1,
+	.has_usbd			= 0,
+
+	.usbd = {
+		.use_fullspeed		= 0,
+		.port_no		= 0,
+	},
 
 	.leds = {
 		{
@@ -888,6 +895,9 @@ int __init board_register_devices(void)
 	    !board_get_mac_address(board.enet1.mac_addr))
 		bcm63xx_enet_register(1, &board.enet1);
 
+	if (board.has_usbd)
+		bcm63xx_usbd_register(&board.usbd);
+
 	if (board.has_dsp)
 		bcm63xx_dsp_register(&board.dsp);
 
arch/mips/bcm63xx/dev-usb-usbd.c new file +72 -0

72 lines not on this page · raw message

arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_usbd.h new file +17 -0
new file mode 100644
index 0000000..5d6d698
@@ -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_ */
arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h +5 -0
index 474daaa..b0dd4bb 100644
@@ -5,6 +5,7 @@
 #include <linux/gpio.h>
 #include <linux/leds.h>
 #include <bcm63xx_dev_enet.h>
+#include <bcm63xx_dev_usb_usbd.h>
 #include <bcm63xx_dev_dsp.h>
 
 /*
@@ -44,6 +45,7 @@ struct board_info {
 	unsigned int	has_pccard:1;
 	unsigned int	has_ohci0:1;
 	unsigned int	has_ehci0:1;
+	unsigned int	has_usbd:1;
 	unsigned int	has_dsp:1;
 	unsigned int	has_uart0:1;
 	unsigned int	has_uart1:1;
@@ -52,6 +54,9 @@ struct board_info {
 	struct bcm63xx_enet_platform_data enet0;
 	struct bcm63xx_enet_platform_data enet1;
 
+	/* USB config */
+	struct bcm63xx_usbd_platform_data usbd;
+
 	/* DSP config */
 	struct bcm63xx_dsp_platform_data dsp;
 
Signature · 1 line
1.7.11.1
#3 lore raw

Re: [PATCH 2/7] MIPS: BCM63XX: Move DMA descriptor definition into common header file

In reply to Kevin Cernekee

Hi Kevin,

Quoted 3 lines · Kevin Cernekee

The "IUDMA" engine used by bcm63xx_enet is also used by other blocks, such as the USB 2.0 device.  Move the definitions into a common file so that they do not need to be duplicated in each driver.

If it's common, maybe then it shouldn't be in bcm63xx_dev_enet.h but something like bcm63xx_iudma.h, and the struct also renamed to something generic (iudma_desc or so).

Regards,
Jonas

#11 lore raw
Quoted 2 lines · Jonas Gorski
Quoted 1 line · Kevin Cernekee

On Fri, Jun 22, 2012 at 10:14 PM, Kevin Cernekee <[email protected]>

Quoted 8 lines · wrote:
Quoted 6 lines
Quoted 2 lines

These patches are intended to lay the groundwork for a new USB Device Controller (gadget UDC) driver.

I have posted "V2" for 4 of the 7 patches. New bundle is here:

http://patchwork.linux-mips.org/bundle/cernekee/bcm63xx-udc-prereq-v2/

These look good to me, and I have no further objections.

Me neither, they look good.

Signature · 1 line
Florian
#12 lore raw
In reply to Kevin Cernekee
Quoted 10 lines · Kevin Cernekee

These patches are intended to lay the groundwork for a new USB Device Controller (gadget UDC) driver. arch/mips/bcm63xx updates include:

Clock enable bits
DMA descriptor updates
New register and IRQ definitions
Create platform_device and platform_data

Baseline is:

Quoted 8 lines

git://git.linux-mips.org/pub/scm/ralf/upstream-sfr.git #mips-for-linux-next

Note that this is not an OTG-capable controller. Therefore, boards are permanently wired up for either host mode or device mode. Device vs. host can be determined in board_bcm963xx.c based on the detected board ID. Some boards have connectors/pads for both modes, but need to be reworked to run in device mode; usually this involves moving 0-ohm resistors on the D+ and D- lines.

Thanks, queued the whole series for 3.7

John