usb: ehci: rmobile: Add support ehci host driver of rmobile SoCs
Subsystems (3)
PATCH 1/1 usb: ehci: rmobile: Add support ehci host driver of rmobile SoCs
The rmobile SoC has usb host controller.
This supports USB controllers listed in the R8A7790, R8A7791 and R8A7740.
--- arch/arm/include/asm/arch-rmobile/ehci-rmobile.h | 169 +++++++++++++++++++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-rmobile.c | 109 +++++++++++++++ 3 files changed, 279 insertions(+) create mode 100644 arch/arm/include/asm/arch-rmobile/ehci-rmobile.h create mode 100644 drivers/usb/host/ehci-rmobile.c
arch/arm/include/asm/arch-rmobile/ehci-rmobile.h new file +169 -0
@@ -0,0 +1,169 @@ +/* +* Copyright (C) 2013,2014 Renesas Electronics Corporation +* Copyright (C) 2014 Nobuhiro Iwamatsu <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#ifndef __EHCI_RMOBILE_H__ +#define __EHCI_RMOBILE_H__ + +/* Register offset */ +#define OHCI_OFFSET 0x00 +#define OHCI_SIZE 0x1000 +#define EHCI_OFFSET 0x1000 +#define EHCI_SIZE 0x1000 + +#define EHCI_USBCMD (EHCI_OFFSET + 0x0020) + +/* USBCTR */ +#define DIRPD (1 << 8) +#define PLL_RST (1 << 2) +#define PCICLK_MASK (1 << 1) +#define USBH_RST (1 << 0) + +/* CMND_STS */ +#define SERREN (1 << 8) +#define PERREN (1 << 6) +#define MASTEREN (1 << 2) +#define MEMEN (1 << 1) + +/* PCIAHB_WIN1_CTR and PCIAHB_WIN2_CTR */ +#define PCIAHB_WIN_PREFETCH ((1 << 1)|(1 << 0)) + +/* AHBPCI_WIN1_CTR */ +#define PCIWIN1_PCICMD ((1 << 3)|(1 << 1)) +#define AHB_CFG_AHBPCI 0x40000000 +#define AHB_CFG_HOST 0x80000000 + +/* AHBPCI_WIN2_CTR */ +#define PCIWIN2_PCICMD ((1 << 2)|(1 << 1)) + +/* PCI_INT_ENABLE */ +#define USBH_PMEEN (1 << 19) +#define USBH_INTBEN (1 << 17) +#define USBH_INTAEN (1 << 16) + +/* AHB_BUS_CTR */ +#define SMODE_READY_CTR (1 << 17) +#define SMODE_READ_BURST (1 << 16) +#define MMODE_HBUSREQ (1 << 7) +#define MMODE_BOUNDARY ((1 << 6)|(1 << 5)) +#define MMODE_BURST_WIDTH ((1 << 4)|(1 << 3)) +#define MMODE_SINGLE_MODE ((1 << 4)|(1 << 3)) +#define MMODE_WR_INCR (1 << 2) +#define MMODE_BYTE_BURST (1 << 1) +#define MMODE_HTRANS (1 << 0) + +/* PCI_ARBITER_CTR */ +#define PCIBUS_PARK_TIMER 0x00FF0000 +#define PCIBUS_PARK_TIMER_SET 0x00070000 +#define PCIBP_MODE (1 << 12) +#define PCIREQ7 (1 << 7) +#define PCIREQ6 (1 << 6) +#define PCIREQ5 (1 << 5) +#define PCIREQ4 (1 << 4) +#define PCIREQ3 (1 << 3) +#define PCIREQ2 (1 << 2) +#define PCIREQ1 (1 << 1) +#define PCIREQ0 (1 << 0) + +#define PHYS_OFFSET CONFIG_SYS_SDRAM_BASE +#define SMSTPCR7 0xE615014C +#define SMSTPCR703 (1 << 3) + +/* Init AHB master and slave functions of the host logic */ +#define AHB_BUS_CTR_INIT \ + (SMODE_READY_CTR | MMODE_HBUSREQ | MMODE_WR_INCR | \ + MMODE_BYTE_BURST | MMODE_HTRANS) + +#define USBCTR_WIN_SIZE_1GB 0x800 + +/* PCI Configuration Registers */ +#define PCI_CONF_OHCI_OFFSET 0x10000 +#define PCI_CONF_EHCI_OFFSET 0x10100 +struct ahb_pciconf { +u32 vid_did; +u32 cmnd_sts; +u32 rev; +u32 cache_line; +u32 basead; +}; + +/* PCI Configuration Registers for AHB-PCI Bridge Registers */ +#define PCI_CONF_AHBPCI_OFFSET 0x10000 +struct ahbconf_pci_bridge { +u32 vid_did;/* 0x00 */ +u32 cmnd_sts; +u32 revid_cc; +u32 cls_lt_ht_bist; +u32 basead;/* 0x10 */ +u32 win1_basead; +u32 win2_basead; +u32 dummy0[5 ]; +u32 ssvdi_ssid;/* 0x2C */ +u32 dummy1[4 ]; +u32 intr_line_pin; +}; + +/* AHB-PCI Bridge PCI Communication Registers */ +#define AHBPCI_OFFSET 0x10800 +struct ahbcom_pci_bridge { +u32 pciahb_win1_ctr;/* 0x00 */ +u32 pciahb_win2_ctr; +u32 pciahb_dct_ctr; +u32 dummy0; +u32 ahbpci_win1_ctr;/* 0x10 */ +u32 ahbpci_win2_ctr; +u32 dummy1; +u32 ahbpci_dct_ctr; +u32 pci_int_enable;/* 0x20 */ +u32 pci_int_status; +u32 dummy2[2 ]; +u32 ahb_bus_ctr;/* 0x30 */ +u32 usbctr; +u32 dummy3[2 ]; +u32 pci_arbiter_ctr;/* 0x40 */ +u32 dummy4; +u32 pci_unit_rev;/* 0x48 */ +}; + +struct rmobile_ehci_reg { +u32 hciversion;/* hciversion/caplength */ +u32 hcsparams;/* hcsparams */ +u32 hccparams;/* hccparams */ +u32 hcsp_portroute;/* hcsp_portroute */ +u32 usbcmd;/* usbcmd */ +u32 usbsts;/* usbsts */ +u32 usbintr;/* usbintr */ +u32 frindex;/* frindex */ +u32 ctrldssegment;/* ctrldssegment */ +u32 periodiclistbase;/* periodiclistbase */ +u32 asynclistaddr;/* asynclistaddr */ +u32 dummy[9 ]; +u32 configflag;/* configflag */ +u32 portsc;/* portsc */ +}; + +#if defined(CONFIG_R8A7740 ) +static u32 usb_base_address[CONFIG_USB_MAX_CONTROLLER_COUNT ] = { +0xC6700000 +}; +#elif defined(CONFIG_R8A7790 ) +static u32 usb_base_address[CONFIG_USB_MAX_CONTROLLER_COUNT ] = { +0xEE080000 ,/* USB0 (EHCI) */ +0xEE0A0000 ,/* USB1 */ +0xEE0C0000 ,/* USB2 */ +0xEE000000 /* USB3 (USB3.0 Host)*/ +}; +#elif defined(CONFIG_R8A7791 ) +static u32 usb_base_address[CONFIG_USB_MAX_CONTROLLER_COUNT ] = { +0xEE080000 ,/* USB0 (EHCI) */ +0xEE0C0000 ,/* USB1 */ +0xEE000000 /* USB3 (USB3.0 Host)*/ +}; +#else +#error rmobile EHCI USB driver not supported on this platform +#endif + +#endif /* __EHCI_RMOBILE_H__ */
drivers/usb/host/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o obj-$(CONFIG_USB_EHCI_SPEAR) += ehci-spear.o obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o obj-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o +obj-$(CONFIG_USB_EHCI_RMOBILE) += ehci-rmobile.o # xhci obj-$(CONFIG_USB_XHCI) += xhci.o xhci-mem.o xhci-ring.o
drivers/usb/host/ehci-rmobile.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
1.8.5
PATCH 1/1 usb: ehci: rmobile: Add support ehci host driver of rmobile SoCs
Quoted 12 lines · Nobuhiro Iwamatsu
The rmobile SoC has usb host controller.
This supports USB controllers listed in the R8A7790, R8A7791 and R8A7740.Signed-off-by Nobuhiro Iwamatsu <[email protected]>--- arch/arm/include/asm/arch-rmobile/ehci-rmobile.h | 169 +++++++++++++++++++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-rmobile.c | 109 +++++++++++++++ 3 files changed, 279 insertions(+) create mode 100644 arch/arm/include/asm/arch-rmobile/ehci-rmobile.h create mode 100644 drivers/usb/host/ehci-rmobile.c
[...]
Quoted 1 line
+#define
PHYS_OFFSETCONFIG_SYS_SDRAM_BASE
This is a bit creepy, is this really necessary ?
As for the rest:
Best regards,
Marek Vasut
PATCH 1/1 usb: ehci: rmobile: Add support ehci host driver of rmobile SoCs
Hi,
Thanks for your review.
2014-04-03 7:25 GMT+09:00 Marek Vasut <[email protected]>:
Quoted 14 lines · Nobuhiro Iwamatsu
Quoted 4 lines
The rmobile SoC has usb host controller.
This supports USB controllers listed in the R8A7790, R8A7791 and R8A7740.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Quoted 8 lines
--- arch/arm/include/asm/arch-rmobile/ehci-rmobile.h | 169 +++++++++++++++++++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-rmobile.c | 109 +++++++++++++++ 3 files changed, 279 insertions(+) create mode 100644 arch/arm/include/asm/arch-rmobile/ehci-rmobile.h create mode 100644 drivers/usb/host/ehci-rmobile.c
Quoted 5 lines
[...]
Quoted 1 line
+#define
PHYS_OFFSETCONFIG_SYS_SDRAM_BASEThis is a bit creepy, is this really necessary ?
I see. I will remove PHYS_OFFSET, and use CONFIG_SYS_SDRAM_BASE instead of this. I will re-send.
Quoted 4 lines
As for the rest:
Reviewed-by Marek Vasut <[email protected]>
Thanks!
Quoted 3 lines
Best regards,
Marek Vasut
Best regards,
Nobuhiro
Signature · 1 line
Nobuhiro Iwamatsu