Add MediaTek MUSB Controller Driver
Subsystems (6)
v3 cover Add MediaTek MUSB Controller Driver
From: Min Guo <[email protected]>
These patches introduce the MediaTek MUSB controller driver.
The driver can be configured as Dual-Role Device (DRD), Peripheral Only and Host Only modes. This has beed tested on MT2701 with a variety of devices in host mode and with the f_mass gadget driver in peripheral mode, plugging otg cables in/out a lot of times in all possible imaginable plug orders.
changes in v3:
changes of driver suggested by Bin:
1. Add a new patch for musb_readb/w/l() to remove const attribute
2. Use is_out as function parameter in set_toggle/get_toggle() hooks
3. Remove 'u8/u16 data' parameter in clearb/w() hooks
4. Remove musb_default_clearb/w()
5. Replace musb_readb/w() with musb_clearb/w() to clear pending interrupts
6. Add comments to clearb/w() hooks
7. Replace musb_save_toggle() with musb->io.get_toggle()
8. Replace musb_set_toggle() with musb->io.set_toggle()
changes in v2:
changes of dt-bindings suggested by Rob:
1. Modify DRC to DRD
2. Drop the "<soc-model>-musb" in compatible
3. Remove phy-names
4. Add space after comma in clock-names
dtsi:
1. Remove phy-names
changes of driver suggested by Bin:
1. Add a new patch for musb_set_toggle
2. Add summarize of MediaTek musb controller differences in the commit log
3. Abondon patch "usb: musb: Move musbhsdma macro definition to musb_dma.h"
4. Add "|| COMPILE_TEST" in Kconfig
5. Add musb_clearb() and musb_clearw() hooks
6. Add get_toggle() and set_toggle() hooks
7. Replace musb_readl() with musb_readw() to read 16bit toggle register
8. Move MediaTek's private toggle registers from musb_regs.h to mediatek.c
9. Create musbhs_dma_controller_create_noirq()
Min Guo (4):
dt-bindings: usb: musb: Add support for MediaTek musb controller
arm: dts: mt2701: Add usb2 device nodes
usb: musb: Delete the const attribute of addr parameter in readb/w/l
hooks
usb: musb: Add support for MediaTek musb controller
.../devicetree/bindings/usb/mediatek,musb.txt | 43 ++ arch/arm/boot/dts/mt2701-evb.dts | 21 + arch/arm/boot/dts/mt2701.dtsi | 33 ++ drivers/usb/musb/Kconfig | 8 +- drivers/usb/musb/Makefile | 1 + drivers/usb/musb/mediatek.c | 624 +++++++++++++++++++++ drivers/usb/musb/musb_core.c | 74 ++- drivers/usb/musb/musb_core.h | 13 +- drivers/usb/musb/musb_dma.h | 9 + drivers/usb/musb/musb_host.c | 46 +- drivers/usb/musb/musb_io.h | 12 +- drivers/usb/musb/musbhsdma.c | 57 +- drivers/usb/musb/sunxi.c | 4 +- drivers/usb/musb/tusb6010.c | 2 +- 14 files changed, 876 insertions(+), 71 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/mediatek,musb.txt create mode 100644 drivers/usb/musb/mediatek.c
Signature · 1 line
1.9.1
PATCH v3 1/4 dt-bindings: usb: musb: Add support for MediaTek musb controller
From: Min Guo <[email protected]>
This adds support for MediaTek musb controller in
host, peripheral and otg mode.
--- .../devicetree/bindings/usb/mediatek,musb.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/mediatek,musb.txt
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +43 -0
@@ -0,0 +1,43 @@ +MediaTek musb DRD/OTG controller +------------------------------------------- + +Required properties: + - compatible : should be "mediatek,mtk-musb" + - reg : specifies physical base address and size of + the registers + - interrupts : interrupt used by musb controller + - interrupt-names : must be "mc" + - phys : PHY specifier for the OTG phy + - dr_mode : should be one of "host", "peripheral" or "otg", + refer to usb/generic.txt + - clocks : a list of phandle + clock-specifier pairs, one for + each entry in clock-names + - clock-names : must contain "main", "mcu", "univpll" + for clocks of controller + +Optional properties: + - extcon : external connector for VBUS and IDPIN changes detection, + needed when supports dual-role mode. + - vbus-supply : reference to the VBUS regulator, needed when supports + dual-role mode. + - power-domains : a phandle to USB power domain node to control USB's + MTCMOS + +Example: + +usb2: usb@11200000 { + compatible = "mediatek,mt2701-musb", + "mediatek,mtk-musb"; + reg = <0 0x11200000 0 0x1000>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>; + interrupt-names = "mc"; + phys = <&u2port2 PHY_TYPE_USB2>; + vbus-supply = <&usb_vbus>; + extcon = <&extcon_usb>; + dr_mode = "otg"; + clocks = <&pericfg CLK_PERI_USB0>, + <&pericfg CLK_PERI_USB0_MCU>, + <&pericfg CLK_PERI_USB_SLV>; + clock-names = "main","mcu","univpll"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>; +};
Signature · 1 line
1.9.1
Re: [PATCH v3 1/4] dt-bindings: usb: musb: Add support for MediaTek musb controller
Hello!
Quoted 17 lines · On 01/17/2019 10:15 AM, [email protected] wrote:
From: Min Guo <[email protected]>
This adds support for MediaTek musb controller in
host, peripheral and otg mode.Signed-off-by Min Guo <[email protected]>--- .../devicetree/bindings/usb/mediatek,musb.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/mediatek,musb.txtDocumentation/devicetree/bindings/usb/mediatek,musb.txt new file +0
-0
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 7
Quoted 7 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +7
-0@@ -0,0 +1,43 @@ +MediaTek musb DRD/OTG controller +------------------------------------------- + +Required properties: + - compatible : should be "mediatek,mtk-musb" + - reg : specifies physical base address and size of + the registers
I'd indent it more to align with "specifies", else it looks weird.
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 12
Quoted 5 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +5
-0+ - interrupts : interrupt used by musb controller + - interrupt-names : must be "mc" + - phys : PHY specifier for the OTG phy + - dr_mode : should be one of "host", "peripheral" or "otg", + refer to usb/generic.txt
Same here...
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 14
Quoted 2 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +2
-0+ - clocks : a list of phandle + clock-specifier pairs, one for + each entry in clock-names
Here...
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 16
Quoted 2 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +2
-0+ - clock-names : must contain "main", "mcu", "univpll" + for clocks of controller
And here.
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 19
Quoted 3 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +3
-0+ +Optional properties: + - extcon : external connector for VBUS and IDPIN changes detection,
ID pin, maybe?
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 24
Quoted 5 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +5
-0+ needed when supports dual-role mode. + - vbus-supply : reference to the VBUS regulator, needed when supports + dual-role mode. + - power-domains : a phandle to USB power domain node to control USB's + MTCMOS
[...]
MBR, Sergei
Re: [PATCH v3 1/4] dt-bindings: usb: musb: Add support for MediaTek musb controller
Hello!
Quoted 15 lines · Sergei Shtylyov
Hello!
Quoted 11 lines · On 01/17/2019 10:15 AM, [email protected] wrote:
From: Min Guo <[email protected]>
This adds support for MediaTek musb controller in
host, peripheral and otg mode.Signed-off-by Min Guo <[email protected]>--- .../devicetree/bindings/usb/mediatek,musb.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/mediatek,musb.txt
Quoted 15 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 7
Quoted 13 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +7
-0@@ -0,0 +1,43 @@ +MediaTek musb DRD/OTG controller +------------------------------------------- + +Required properties: + - compatible : should be "mediatek,mtk-musb" + - reg : specifies physical base address and size of + the registersI'd indent it more to align with "specifies", else it looks weird.
Okay.
Quoted 7 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 12
Quoted 5 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +5
-0+ - interrupts : interrupt used by musb controller + - interrupt-names : must be "mc" + - phys : PHY specifier for the OTG phy + - dr_mode : should be one of "host", "peripheral" or "otg", + refer to usb/generic.txtSame here...
Okay.
Quoted 4 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 14
Quoted 2 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +2
-0+ - clocks : a list of phandle + clock-specifier pairs, one for + each entry in clock-namesHere...
Okay.
Quoted 4 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 16
Quoted 2 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +2
-0+ - clock-names : must contain "main", "mcu", "univpll" + for clocks of controllerAnd here.
Okay.
Quoted 5 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 19
Quoted 3 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +3
-0+ +Optional properties: + - extcon : external connector for VBUS and IDPIN changes detection,ID pin, maybe?
Okay.
Quoted 8 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 24
Quoted 5 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +5
-0+ needed when supports dual-role mode. + - vbus-supply : reference to the VBUS regulator, needed when supports + dual-role mode. + - power-domains : a phandle to USB power domain node to control USB's + MTCMOS[...]
MBR, Sergei
PATCH v3 2/4 arm: dts: mt2701: Add usb2 device nodes
In reply to [email protected]From: Min Guo <[email protected]>
Add musb nodes and usb2 phy nodes for MT2701
--- arch/arm/boot/dts/mt2701-evb.dts | 21 +++++++++++++++++++++ arch/arm/boot/dts/mt2701.dtsi | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
arch/arm/boot/dts/mt2701-evb.dts +21 -0
@@ -6,6 +6,7 @@ */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> #include "mt2701.dtsi" / {
@@ -60,6 +61,20 @@ >; default-brightness-level = <9>; }; + + extcon_usb: extcon_iddig { + compatible = "linux,extcon-usb-gpio"; + id-gpio = <&pio 44 GPIO_ACTIVE_HIGH>; + }; + + usb_vbus: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&pio 45 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &auxadc {
@@ -229,3 +244,9 @@ &uart0 { status = "okay"; }; + +&usb2 { + vbus-supply = <&usb_vbus>; + extcon = <&extcon_usb>; + status = "okay"; +};
arch/arm/boot/dts/mt2701.dtsi +33 -0
@@ -670,6 +670,39 @@ }; }; + usb2: usb@11200000 { + compatible = "mediatek,mt2701-musb", + "mediatek,mtk-musb"; + reg = <0 0x11200000 0 0x1000>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>; + interrupt-names = "mc"; + phys = <&u2port2 PHY_TYPE_USB2>; + dr_mode = "otg"; + clocks = <&pericfg CLK_PERI_USB0>, + <&pericfg CLK_PERI_USB0_MCU>, + <&pericfg CLK_PERI_USB_SLV>; + clock-names = "main","mcu","univpll"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>; + status = "disabled"; + }; + + u2phy0: usb-phy@11210000 { + compatible = "mediatek,generic-tphy-v1"; + reg = <0 0x11210000 0 0x0800>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + status = "okay"; + + u2port2: usb-phy@1a1c4800 { + reg = <0 0x11210800 0 0x0100>; + clocks = <&topckgen CLK_TOP_USB_PHY48M>; + clock-names = "ref"; + #phy-cells = <1>; + status = "okay"; + }; + }; + ethsys: syscon@1b000000 { compatible = "mediatek,mt2701-ethsys", "syscon"; reg = <0 0x1b000000 0 0x1000>;
Signature · 1 line
1.9.1
PATCH v3 3/4 usb: musb: Delete the const attribute of addr parameter in readb/w/l hooks
In reply to [email protected]From: Min Guo <[email protected]>
These changes are for implementing clearing W1C registers.
--- drivers/usb/musb/musb_core.c | 10 +++++----- drivers/usb/musb/musb_core.h | 4 ++-- drivers/usb/musb/musb_io.h | 6 +++--- drivers/usb/musb/sunxi.c | 4 ++-- drivers/usb/musb/tusb6010.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-)
drivers/usb/musb/musb_core.c +5 -5
@@ -246,7 +246,7 @@ static u32 musb_default_busctl_offset(u8 epnum, u16 offset)return 0x80 + (0x08 * epnum) + offset; } -static u8 musb_default_readb (const void __iomem *addr,unsigned offset) +static u8 musb_default_readb (void __iomem *addr,unsigned offset) {u8 data =__raw_readb (addr + offset);
@@ -260,7 +260,7 @@ static void musb_default_writeb(void __iomem *addr, unsigned offset, u8 data)__raw_writeb (data, addr + offset); } -static u16 musb_default_readw (const void __iomem *addr,unsigned offset) +static u16 musb_default_readw (void __iomem *addr,unsigned offset) {u16 data =__raw_readw (addr + offset);
@@ -364,19 +364,19 @@ static void musb_default_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)/* * Old style IO functions */ -u8 (*musb_readb)(const void __iomem *addr,unsigned offset); +u8 (*musb_readb)(void __iomem *addr,unsigned offset);EXPORT_SYMBOL_GPL (musb_readb);void (*musb_writeb)(void __iomem *addr,unsigned offset,u8 data);EXPORT_SYMBOL_GPL (musb_writeb); -u16 (*musb_readw)(const void __iomem *addr,unsigned offset); +u16 (*musb_readw)(void __iomem *addr,unsigned offset);EXPORT_SYMBOL_GPL (musb_readw);void (*musb_writew)(void __iomem *addr,unsigned offset,u16 data);EXPORT_SYMBOL_GPL (musb_writew); -u32 musb_readl (const void __iomem *addr,unsigned offset) +u32 musb_readl (void __iomem *addr,unsigned offset) {u32 data =__raw_readl (addr + offset);
drivers/usb/musb/musb_core.h +2 -2
@@ -161,9 +161,9 @@ struct musb_platform_ops {u16 fifo_mode;u32 (*fifo_offset)(u8 epnum);u32 (*busctl_offset)(u8 epnum,u16 offset); -u8 (*readb)(const void __iomem *addr,unsigned offset); +u8 (*readb)(void __iomem *addr,unsigned offset);void (*writeb)(void __iomem *addr,unsigned offset,u8 data); -u16 (*readw)(const void __iomem *addr,unsigned offset); +u16 (*readw)(void __iomem *addr,unsigned offset);void (*writew)(void __iomem *addr,unsigned offset,u16 data);void (*read_fifo)(struct musb_hw_ep *hw_ep,u16 len,u8 *buf);void (*write_fifo)(struct musb_hw_ep *hw_ep,u16 len,const u8 *buf);
drivers/usb/musb/musb_io.h +3 -3
@@ -33,11 +33,11 @@ struct musb_io { };/* Do not add new entries here, add them the struct musb_io instead */ -extern u8 (*musb_readb)(const void __iomem *addr,unsigned offset); +extern u8 (*musb_readb)(void __iomem *addr,unsigned offset);extern void (*musb_writeb)(void __iomem *addr,unsigned offset,u8 data); -extern u16 (*musb_readw)(const void __iomem *addr,unsigned offset); +extern u16 (*musb_readw)(void __iomem *addr,unsigned offset);extern void (*musb_writew)(void __iomem *addr,unsigned offset,u16 data); -extern u32 musb_readl (const void __iomem *addr,unsigned offset); +extern u32 musb_readl (void __iomem *addr,unsigned offset);extern void musb_writel (void __iomem *addr,unsigned offset,u32 data);#endif
drivers/usb/musb/sunxi.c +2 -2
@@ -407,7 +407,7 @@ static u32 sunxi_musb_busctl_offset(u8 epnum, u16 offset)return SUNXI_MUSB_TXFUNCADDR + offset; } -static u8 sunxi_musb_readb (const void __iomem *addr,unsigned offset) +static u8 sunxi_musb_readb (void __iomem *addr,unsigned offset) {struct sunxi_glue *glue;
@@ -520,7 +520,7 @@ static void sunxi_musb_writeb(void __iomem *addr, unsigned offset, u8 data) (int)(addr - sunxi_musb->mregs)); } -static u16 sunxi_musb_readw (const void __iomem *addr,unsigned offset) +static u16 sunxi_musb_readw (void __iomem *addr,unsigned offset) {if (addr == sunxi_musb->mregs) {/* generic control or fifo control reg access */
drivers/usb/musb/tusb6010.c +1 -1
@@ -142,7 +142,7 @@ static void tusb_ep_select(void __iomem *mbase, u8 epnum)/* * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum. */ -static u8 tusb_readb (const void __iomem *addr,unsigned offset) +static u8 tusb_readb (void __iomem *addr,unsigned offset) {u16 tmp;u8 val;
Signature · 1 line
1.9.1
PATCH v3 4/4 usb: musb: Add support for MediaTek musb controller
In reply to [email protected]From: Min Guo <[email protected]>
This adds support for MediaTek musb controller in host, peripheral and otg mode.
There are some quirk of MediaTek musb controller, such as:
-W1C interrupt status registers
-Private data toggle registers
-No dedicated DMA interrupt line
--- drivers/usb/musb/Kconfig | 8 +- drivers/usb/musb/Makefile | 1 + drivers/usb/musb/mediatek.c | 624 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/musb/musb_core.c | 64 ++++- drivers/usb/musb/musb_core.h | 9 + drivers/usb/musb/musb_dma.h | 9 + drivers/usb/musb/musb_host.c | 46 +--- drivers/usb/musb/musb_io.h | 6 + drivers/usb/musb/musbhsdma.c | 57 ++-- 9 files changed, 766 insertions(+), 58 deletions(-) create mode 100644 drivers/usb/musb/mediatek.c
drivers/usb/musb/Kconfig +7 -1
@@ -115,6 +115,12 @@ config USB_MUSB_JZ4740 depends on USB_MUSB_GADGET depends on USB_OTG_BLACKLIST_HUB +config USB_MUSB_MEDIATEK + tristate "MediaTek platforms" + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on NOP_USB_XCEIV + depends on GENERIC_PHY + config USB_MUSB_AM335X_CHILD tristate
@@ -141,7 +147,7 @@ config USB_UX500_DMA config USB_INVENTRA_DMA bool 'Inventra' - depends on USB_MUSB_OMAP2PLUS + depends on USB_MUSB_OMAP2PLUS || USB_MUSB_MEDIATEK help Enable DMA transfers using Mentor's engine.
drivers/usb/musb/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o obj-$(CONFIG_USB_MUSB_UX500) += ux500.o obj-$(CONFIG_USB_MUSB_JZ4740) += jz4740.o obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o +obj-$(CONFIG_USB_MUSB_MEDIATEK) += mediatek.o obj-$(CONFIG_USB_MUSB_AM335X_CHILD) += musb_am335x.o
drivers/usb/musb/mediatek.c new file +624 -0
624 lines not on this page · raw message
drivers/usb/musb/musb_core.c +60 -4
110 lines not on this page · raw message
drivers/usb/musb/musb_core.h +9 -0
@@ -27,6 +27,7 @@struct musb ;struct musb_hw_ep ;struct musb_ep ; +struct musb_qh ;/* Helper defines for struct musb->hwvers */ #define MUSB_HWVERS_MAJOR (x) ((x >> 10) & 0x1f)
@@ -119,10 +120,14 @@ enum musb_g_ep0_state {* @fifo_offset: returns the fifo offset * @readb: read 8 bits * @writeb: write 8 bits +* @clearb: could be clear-on-readb or W1C * @readw: read 16 bits * @writew: write 16 bits +* @clearw: could be clear-on-readw or W1C * @read_fifo: reads the fifo * @write_fifo: writes to fifo +* @get_toggle: platform specific get toggle function +* @set_toggle: platform specific set toggle function * @dma_init: platform specific dma init function * @dma_exit: platform specific dma exit function * @init: turns on clocks, sets up platform-specific registers, etc
@@ -163,10 +168,14 @@ struct musb_platform_ops {u32 (*busctl_offset)(u8 epnum,u16 offset);u8 (*readb)(void __iomem *addr,unsigned offset);void (*writeb)(void __iomem *addr,unsigned offset,u8 data); +u8 (*clearb)(void __iomem *addr,unsigned int offset);u16 (*readw)(void __iomem *addr,unsigned offset);void (*writew)(void __iomem *addr,unsigned offset,u16 data); +u16 (*clearw)(void __iomem *addr,unsigned int offset);void (*read_fifo)(struct musb_hw_ep *hw_ep,u16 len,u8 *buf);void (*write_fifo)(struct musb_hw_ep *hw_ep,u16 len,const u8 *buf); +u16 (*get_toggle)(struct musb_qh *qh,int is_out); +u16 (*set_toggle)(struct musb_qh *qh,int is_out,struct urb *urb);struct dma_controller * (*dma_init) (struct musb *musb,void __iomem *base);void (*dma_exit)(struct dma_controller *c);
drivers/usb/musb/musb_dma.h +9 -0
@@ -35,6 +35,12 @@* whether shared with the Inventra core or separate. */ +#define MUSB_HSDMA_BASE 0x200 +#define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0) +#define MUSB_HSDMA_CONTROL 0x4 +#define MUSB_HSDMA_ADDRESS 0x8 +#define MUSB_HSDMA_COUNT 0xc +#define DMA_ADDR_INVALID (~(dma_addr_t)0)#ifdef CONFIG_MUSB_PIO_ONLY
@@ -191,6 +197,9 @@ static inline void musb_dma_controller_destroy(struct dma_controller *d) { }extern struct dma_controller *musbhs_dma_controller_create (struct musb *musb,void __iomem *base);extern void musbhs_dma_controller_destroy (struct dma_controller *c); +extern struct dma_controller * +musbhs_dma_controller_create_noirq (struct musb *musb,void __iomem *base); +extern irqreturn_t dma_controller_irq (int irq,void *private_data);extern struct dma_controller *tusb_dma_controller_create (struct musb *musb,void __iomem *base);
drivers/usb/musb/musb_host.c +10 -36
92 lines not on this page · raw message
drivers/usb/musb/musb_io.h +6 -0
@@ -22,6 +22,8 @@* @read_fifo: platform specific function to read fifo * @write_fifo: platform specific function to write fifo * @busctl_offset: platform specific function to get busctl offset +* @get_toggle: platform specific function to get toggle +* @set_toggle: platform specific function to set toggle */ struct musb_io {u32 (*ep_offset)(u8 epnum,u16 offset);
@@ -30,13 +32,17 @@ struct musb_io {void (*read_fifo)(struct musb_hw_ep *hw_ep,u16 len,u8 *buf);void (*write_fifo)(struct musb_hw_ep *hw_ep,u16 len,const u8 *buf);u32 (*busctl_offset)(u8 epnum,u16 offset); +u16 (*get_toggle)(struct musb_qh *qh,int is_out); +u16 (*set_toggle)(struct musb_qh *qh,int is_out,struct urb *urb); };/* Do not add new entries here, add them the struct musb_io instead */ extern u8 (*musb_readb)(void __iomem *addr,unsigned offset);extern void (*musb_writeb)(void __iomem *addr,unsigned offset,u8 data); +extern u8 (*musb_clearb)(void __iomem *addr,unsigned int offset);extern u16 (*musb_readw)(void __iomem *addr,unsigned offset);extern void (*musb_writew)(void __iomem *addr,unsigned offset,u16 data); +extern u16 (*musb_clearw)(void __iomem *addr,unsigned int offset);extern u32 musb_readl (void __iomem *addr,unsigned offset);extern void musb_writel (void __iomem *addr,unsigned offset,u32 data);
drivers/usb/musb/musbhsdma.c +40 -17
98 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 4/4] usb: musb: Add support for MediaTek musb controller
Hi,
Quoted 4 lines · * [email protected] <[email protected]> [190117 07:16]:
There are some quirk of MediaTek musb controller, such as:
-W1C interrupt status registers
-Private data toggle registers
-No dedicated DMA interrupt line
Can you please separate the musb generic changes listed above into separate individual patches in preparation for adding support for new hardware?
Otherwise we'll have hard time finding out with git bisect what exactly breaks things if we run into trouble.
Regards,
Tony
Re: [PATCH v3 4/4] usb: musb: Add support for MediaTek musb controller
Quoted 8 lines · Tony Lindgren
Hi,
Quoted 4 lines · * [email protected] <[email protected]> [190117 07:16]:
There are some quirk of MediaTek musb controller, such as:
-W1C interrupt status registers
-Private data toggle registers
-No dedicated DMA interrupt line
Quoted 6 lines
Can you please separate the musb generic changes listed above into separate individual patches in preparation for adding support for new hardware?
Otherwise we'll have hard time finding out with git bisect what exactly breaks things if we run into trouble.
Thanks for your suggestion.
I prepared to divide these changes into separate patches. Later, Mr.Bin suggested not to do this.
The detailed information can be referred to:
https://patchwork.kernel.org/patch/10743561/
https://patchwork.kernel.org/patch/10763737/
https://patchwork.kernel.org/patch/107463741/
Quoted 3 lines
Regards,
Tony
Bin Liu
maintainerRe: [PATCH v3 4/4] usb: musb: Add support for MediaTek musb controller
Hi Min,
Quoted 13 lines · Min Guo
Quoted 12 lines · Tony Lindgren
Hi,
Quoted 4 lines · * [email protected] <[email protected]> [190117 07:16]:
There are some quirk of MediaTek musb controller, such as:
-W1C interrupt status registers
-Private data toggle registers
-No dedicated DMA interrupt lineCan you please separate the musb generic changes listed above into separate individual patches in preparation for adding support for new hardware?
Quoted 6 lines
Quoted 2 lines
Otherwise we'll have hard time finding out with git bisect what exactly breaks things if we run into trouble.
Thanks for your suggestion.
I prepared to divide these changes into separate patches. Later, Mr.Bin suggested not to do this.
Initially I thought the clearb/w() changes should be just a couple lines, so didn't think to separate it. But after reviewed the final implemenation, I agree Tony's comment is the right thing to do, please separate the musb core changes, each for clearb/w(), get/set_toggle(), and dma.
Regards,
-Bin.
Re: [PATCH v3 4/4] usb: musb: Add support for MediaTek musb controller
Quoted 23 lines · Bin Liu
Hi Min,
Quoted 13 lines · Min Guo
Quoted 12 lines · Tony Lindgren
Hi,
Quoted 4 lines · * [email protected] <[email protected]> [190117 07:16]:
There are some quirk of MediaTek musb controller, such as:
-W1C interrupt status registers
-Private data toggle registers
-No dedicated DMA interrupt lineCan you please separate the musb generic changes listed above into separate individual patches in preparation for adding support for new hardware?
Quoted 6 lines
Quoted 2 lines
Otherwise we'll have hard time finding out with git bisect what exactly breaks things if we run into trouble.
Thanks for your suggestion.
I prepared to divide these changes into separate patches. Later, Mr.Bin suggested not to do this.
Quoted 5 lines
Initially I thought the clearb/w() changes should be just a couple lines, so didn't think to separate it. But after reviewed the final implemenation, I agree Tony's comment is the right thing to do, please separate the musb core changes, each for clearb/w(), get/set_toggle(), and dma.
OKay.
Quoted 2 lines
Regards,
-Bin.
Bin Liu
maintainerQuoted 11 lines · On Thu, Jan 17, 2019 at 03:15:44PM +0800, [email protected] wrote:
From: Min Guo <[email protected]>
These patches introduce the MediaTek MUSB controller driver.
The driver can be configured as Dual-Role Device (DRD), Peripheral Only and Host Only modes. This has beed tested on MT2701 with a variety of devices in host mode and with the
f_massgadget driver in peripheral mode, plugging otg cables in/out a lot of times in all possible imaginable plug orders.changes in v3:
Please put the change log in each individual patch, which helps in viewing patches.
Regards,
-Bin.
Hi Bin,
Quoted 11 lines · Bin Liu
Quoted 10 lines · On Thu, Jan 17, 2019 at 03:15:44PM +0800, [email protected] wrote:
From: Min Guo <[email protected]>
These patches introduce the MediaTek MUSB controller driver.
The driver can be configured as Dual-Role Device (DRD), Peripheral Only and Host Only modes. This has beed tested on MT2701 with a variety of devices in host mode and with the
f_massgadget driver in peripheral mode, plugging otg cables in/out a lot of times in all possible imaginable plug orders.
Quoted 4 lines
Quoted 1 line
changes in v3:
Please put the change log in each individual patch, which helps in viewing patches.
Okay.
Quoted 2 lines
Regards,
-Bin.