Add MediaTek MUSB Controller Driver
Subsystems (6)
v4 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 v4:
changes of dt-bindings suggested by Sergei:
1. String alignment
changes of driver suggested by Tony and Bin:
1. Add a new patch for set/get_toggle()
2. Add a new patch for noirq type of dma
3. Add a new patch musb_clearb/w()
4. Abondon patch "usb: musb: Delete the const attribute of addr parameter in readb/w/l hooks"
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 and Bin:
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 (6):
dt-bindings: usb: musb: Add support for MediaTek musb controller
arm: dts: mt2701: Add usb2 device nodes
usb: musb: Add get/set toggle hooks
usb: musb: Add noirq type of dma create interface
usb: musb: Add musb_clearb/w() interface
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 v4 1/6 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.
---
changes in v4:
suggested by Sergei:
1. String alignment
changes in v3:
1. no changes
changes in v2:
suggested by Bin:
1. Modify DRC to DRD
suggested by Rob:
2. Drop the "<soc-model>-musb" in compatible
3. Remove phy-names
4. Add space after comma in clock-names
--- .../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 ID pin 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
Rob Herring
maintainerRe: [PATCH v4 1/6] dt-bindings: usb: musb: Add support for MediaTek musb controller
Quoted 11 lines · On Mon, Jan 21, 2019 at 08:22:26PM +0800, [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]>---
changes in v4:
suggested by Sergei:
1. String alignment
Quoted 8 lines
changes in v3:
1. no changeschanges in v2:
suggested by Bin:
1. Modify DRC to DRD
suggested by Rob:
2. Drop the "<soc-model>-musb" in compatible
This is not what I said. I gave you the exact text to put.
Quoted 23 lines
3. Remove phy-names
4. Add space after comma in clock-names--- .../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 +10
-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
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 20
Quoted 10 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +10
-0+ - 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 ID pin changes detection, + needed when supports dual-role mode
Again, do not use extcon in new bindings.
Quoted 31 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +23
-0+ - 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 · 7 lines
1.9.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v4 1/6] dt-bindings: usb: musb: Add support for MediaTek musb controller
Hi Bin,
Sorry to bother you again, I encounter a problem about the extcon property.
I don't find a common driver describing the usb-connector. Is there any driver that I can refer to, specially the way to switch MUSB controller between host and device mode?
If it needs to implement by myself, is it possible to emulate an usb-connector driver by extcon-usb-gpio, and also use the notifier mechanism or can you give me some advices?
Hi Rob,
Quoted 15 lines · Rob Herring
Quoted 14 lines · On Mon, Jan 21, 2019 at 08:22:26PM +0800, [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]>---
changes in v4:
suggested by Sergei:
1. String alignmentchanges in v3:
1. no changes
Quoted 7 lines
Quoted 5 lines
changes in v2:
suggested by Bin:
1. Modify DRC to DRD
suggested by Rob:
2. Drop the "<soc-model>-musb" in compatibleThis is not what I said. I gave you the exact text to put.
Sorry to misunderstood your meaning last time, I will modify it in next patch.
compatible: should be one of "mediatek,mt2701-musb"...,followed by
"mediatek,mtk-musb"
Quoted 27 lines
Quoted 27 lines
3. Remove phy-names
4. Add space after comma in clock-names--- .../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 +14
-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
Quoted 8 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt line 20
Quoted 6 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +6
-0+ - clock-names : must contain "main", "mcu", "univpll" + for clocks of controller + +Optional properties: + - extcon : external connector for VBUS and ID pin changes detection, + needed when supports dual-role modeAgain, do not use extcon in new bindings.
Thanks, ok.
Quoted 27 lines
Quoted 27 lines
Documentation/devicetree/bindings/usb/mediatek,musb.txt new file +23
-0+ - 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
Quoted 4 lines
Quoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Regards,
Min.
Bin Liu
maintainerRe: [PATCH v4 1/6] dt-bindings: usb: musb: Add support for MediaTek musb controller
Hi Min,
Quoted 11 lines · Min Guo
Hi Bin,
Sorry to bother you again, I encounter a problem about the extcon property.
I don't find a common driver describing the usb-connector. Is there any driver that I can refer to, specially the way to switch MUSB controller between host and device mode?
If it needs to implement by myself, is it possible to emulate an usb-connector driver by extcon-usb-gpio, and also use the notifier mechanism or can you give me some advices?
I am afraid I am unable to help you on this. I wasn't really pay attention when usb-connector was introduced and not sure how it can replace extcon. Now after read usb-connector.txt, it seems the binding only defines a/b/c-connector, but not ab-connector, and there is no enough information (at least for me) explaining how VBUS and ID fix into this usb-connector binding.
Maybe Rob can provide some hint.
Regards,
-Bin.
Re: [PATCH v4 1/6] dt-bindings: usb: musb: Add support for MediaTek musb controller
Hi Bin,
Thanks for your help.
Hi Rob,
I find that Samsung describes the usb-connector attribute in DTS, and uses a private driver.
And try to write DTS as following:
usb-connector node:
musb_con: musb_connector{
compatible = "linux,extcon-usb-gpio","usb-b-connector";
lable = "micro-USB";
type = "micro";
id-gpio = <&pio 44 GPIO_ACTIVE_HIGH>
vbus-supply = <&usb_vbus>;
port {
usb_to_connector: endpoint {
remote-endpoint = <&connector_to_usb>;
};
};
};usb node:
&usb2{
status = "okay";
port {
connector_to_usb: endpoint {
remote-endpoint = <&usb_to_connector>;
};
};
}Can I describe usb-connector like this? Or can you give me some advices?
Regards,
Min.
Quoted 26 lines · Bin Liu
Hi Min,
Quoted 11 lines · Min Guo
Hi Bin,
Sorry to bother you again, I encounter a problem about the extcon property.
I don't find a common driver describing the usb-connector. Is there any driver that I can refer to, specially the way to switch MUSB controller between host and device mode?
If it needs to implement by myself, is it possible to emulate an usb-connector driver by extcon-usb-gpio, and also use the notifier mechanism or can you give me some advices?I am afraid I am unable to help you on this. I wasn't really pay attention when usb-connector was introduced and not sure how it can replace extcon. Now after read usb-connector.txt, it seems the binding only defines a/b/c-connector, but not ab-connector, and there is no enough information (at least for me) explaining how VBUS and ID fix into this usb-connector binding.
Maybe Rob can provide some hint.
Regards,
-Bin.
Re: [PATCH v4 1/6] dt-bindings: usb: musb: Add support for MediaTek musb controller
Hi Rob,
Sorry to bother you again.
Can I describe usb-connector in usb node like this?
usb2: usb@11200000 {
compatible = "mediatek,mt2701-musb";
"mediatek,mtk-musb";
reg = <0 0x11200000 0 0x1000>;
...
usb_connector: musb_connector {
compatible = "usb-b-connector";
label = "micro-USB";
type = "micro";
extcon = <&extcon_usb>;
vbus-supply = <&usb_vbus>; };
};
Regards,
Min.
Quoted 67 lines · Min Guo
Hi Bin,
Thanks for your help.
Hi Rob,
I find that Samsung describes the usb-connector attribute in DTS, and uses a private driver.
And try to write DTS as following:usb-connector node:
musb_con: musb_connector{ compatible = "linux,extcon-usb-gpio","usb-b-connector"; lable = "micro-USB"; type = "micro"; id-gpio = <&pio 44 GPIO_ACTIVE_HIGH> vbus-supply = <&usb_vbus>; port { usb_to_connector: endpoint { remote-endpoint = <&connector_to_usb>; }; }; };usb node:
&usb2{ status = "okay"; port { connector_to_usb: endpoint { remote-endpoint = <&usb_to_connector>; }; }; }Can I describe usb-connector like this? Or can you give me some advices?
Regards,
Min.Quoted 26 lines · Bin Liu
Hi Min,
Quoted 11 lines · Min Guo
Hi Bin,
Sorry to bother you again, I encounter a problem about the extcon property.
I don't find a common driver describing the usb-connector. Is there any driver that I can refer to, specially the way to switch MUSB controller between host and device mode?
If it needs to implement by myself, is it possible to emulate an usb-connector driver by extcon-usb-gpio, and also use the notifier mechanism or can you give me some advices?I am afraid I am unable to help you on this. I wasn't really pay attention when usb-connector was introduced and not sure how it can replace extcon. Now after read usb-connector.txt, it seems the binding only defines a/b/c-connector, but not ab-connector, and there is no enough information (at least for me) explaining how VBUS and ID fix into this usb-connector binding.
Maybe Rob can provide some hint.
Regards,
-Bin.
PATCH v4 2/6 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
---
changes in v4:
1. no changes
changes in v3:
1. no changes
changes in v2:
1. Remove phy-names
--- 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 v4 3/6 usb: musb: Add get/set toggle hooks
In reply to [email protected]From: Min Guo <[email protected]>
Add get/set toggle hooks in struct musb_io and struct musb_platform_ops for special platform; remove function musb_save_toggle, use the set/get callback to handle toggle.
---
new patch based on v3:
--- drivers/usb/musb/musb_core.c | 42 ++++++++++++++++++++++++++++++++++++++++ drivers/usb/musb/musb_core.h | 5 +++++ drivers/usb/musb/musb_host.c | 46 ++++++++++---------------------------------- drivers/usb/musb/musb_io.h | 4 ++++ 4 files changed, 61 insertions(+), 36 deletions(-)
drivers/usb/musb/musb_core.c +42 -0
@@ -274,6 +274,38 @@ static void musb_default_writew(void __iomem *addr, unsigned offset, u16 data)__raw_writew (data, addr + offset); } +static u16 musb_default_get_toggle (struct musb_qh *qh,int is_out) +{ +void __iomem *epio = qh->hw_ep->regs; +u16 csr; + +if (is_out) + csr =musb_readw (epio,MUSB_TXCSR ) &MUSB_TXCSR_H_DATATOGGLE ; +else + csr =musb_readw (epio,MUSB_RXCSR ) &MUSB_RXCSR_H_DATATOGGLE ; + +return csr; +} + +static u16 musb_default_set_toggle (struct musb_qh *qh,int is_out, +struct urb *urb) +{ +u16 csr; +u16 toggle; + + toggle =usb_gettoggle (urb->dev, qh->epnum, is_out); + +if (is_out) + csr = toggle ? (MUSB_TXCSR_H_WR_DATATOGGLE + |MUSB_TXCSR_H_DATATOGGLE ) + :MUSB_TXCSR_CLRDATATOG ; +else + csr = toggle ? (MUSB_RXCSR_H_WR_DATATOGGLE + |MUSB_RXCSR_H_DATATOGGLE ) :0 ; + +return csr; +} +/* * Load an endpoint's FIFO */
@@ -2277,6 +2309,16 @@ static void musb_deassert_reset(struct work_struct *work)else musb->io.write_fifo = musb_default_write_fifo; +if (musb->ops->get_toggle) + musb->io.get_toggle = musb->ops->get_toggle; +else + musb->io.get_toggle = musb_default_get_toggle; + +if (musb->ops->set_toggle) + musb->io.set_toggle = musb->ops->set_toggle; +else + musb->io.set_toggle = musb_default_set_toggle; +if (!musb->xceiv->io_ops) { musb->xceiv->io_dev = musb->controller; musb->xceiv->io_priv = musb->mregs;
drivers/usb/musb/musb_core.h +5 -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)
@@ -123,6 +124,8 @@ enum musb_g_ep0_state {* @writew: write 16 bits * @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
@@ -167,6 +170,8 @@ struct musb_platform_ops {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); +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_host.c +10 -36
92 lines not on this page · raw message
drivers/usb/musb/musb_io.h +4 -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,6 +32,8 @@ 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 */
Signature · 1 line
1.9.1
PATCH v4 4/6 usb: musb: Add noirq type of dma create interface
In reply to [email protected]From: Min Guo <[email protected]>
Add noirq type of dma create interface for platform which do not have dedicated DMA interrupt line, move musbhsdma macro definition to musb_dma.h
---
new patch based on v3:
--- drivers/usb/musb/musb_dma.h | 9 ++++++++ drivers/usb/musb/musbhsdma.c | 54 ++++++++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 17 deletions(-)
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/musbhsdma.c +37 -17
89 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 5/6 usb: musb: Add musb_clearb/w() interface
In reply to [email protected]From: Min Guo <[email protected]>
Delete the const attribute of addr parameter in readb/w/l hooks, these changes are for implementing clearing W1C registers. Replace musb_readb/w with musb_clearb/w to clear the interrupt status.
---
new patch based on v3:
--- drivers/usb/musb/musb_core.c | 32 +++++++++++++++++++++++--------- drivers/usb/musb/musb_core.h | 8 ++++++-- drivers/usb/musb/musb_io.h | 8 +++++--- drivers/usb/musb/musbhsdma.c | 3 +++ drivers/usb/musb/sunxi.c | 4 ++-- drivers/usb/musb/tusb6010.c | 2 +- 6 files changed, 40 insertions(+), 17 deletions(-)
drivers/usb/musb/musb_core.c +23 -9
@@ -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);
@@ -396,19 +396,25 @@ 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); +u8 (*musb_clearb)(void __iomem *addr,unsigned int offset); +EXPORT_SYMBOL_GPL (musb_clearb); + +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) +u16 (*musb_clearw)(void __iomem *addr,unsigned int offset); +EXPORT_SYMBOL_GPL (musb_clearw); + +u32 musb_readl (void __iomem *addr,unsigned offset) {u32 data =__raw_readl (addr + offset);
@@ -1047,7 +1053,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,static void musb_disable_interrupts (struct musb *musb) {void __iomem *mbase = musb->mregs; -u16 temp;/* disable interrupts */ musb_writeb (mbase,MUSB_INTRUSBE ,0 );
@@ -1057,9 +1062,9 @@ static void musb_disable_interrupts(struct musb *musb)musb_writew (mbase,MUSB_INTRRXE ,0 );/* flush pending interrupts */ - temp =musb_readb (mbase,MUSB_INTRUSB ); - temp =musb_readw (mbase,MUSB_INTRTX ); - temp =musb_readw (mbase,MUSB_INTRRX ); +musb_clearb (mbase,MUSB_INTRUSB ); +musb_clearw (mbase,MUSB_INTRTX ); +musb_clearw (mbase,MUSB_INTRRX ); }static void musb_enable_interrupts (struct musb *musb)
@@ -2284,10 +2289,19 @@ static void musb_deassert_reset(struct work_struct *work) musb_readb = musb->ops->readb;if (musb->ops->writeb) musb_writeb = musb->ops->writeb; +if (musb->ops->clearb) + musb_clearb = musb->ops->clearb; +else + musb_clearb = musb_readb; +if (musb->ops->readw) musb_readw = musb->ops->readw;if (musb->ops->writew) musb_writew = musb->ops->writew; +if (musb->ops->clearw) + musb_clearw = musb->ops->clearw; +else + musb_clearw = musb_readw;#ifndef CONFIG_MUSB_PIO_ONLY if (!musb->ops->dma_init || !musb->ops->dma_exit) {
drivers/usb/musb/musb_core.h +6 -2
@@ -120,8 +120,10 @@ 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
@@ -164,10 +166,12 @@ 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); +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);
drivers/usb/musb/musb_io.h +5 -3
@@ -37,11 +37,13 @@ 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 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 u32 musb_readl (const void __iomem *addr,unsigned offset); +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);#endif
drivers/usb/musb/musbhsdma.c +3 -0
@@ -286,6 +286,9 @@ irqreturn_t dma_controller_irq(int irq, void *private_data) int_hsdma =musb_readb (mbase,MUSB_HSDMA_INTR ); +/* clear pending interrupts by manual */ +musb_clearb (musb->mregs,MUSB_HSDMA_INTR ); +if (!int_hsdma) {musb_dbg (musb,"spurious DMA irq" );
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
Bin Liu
maintainerRe: [PATCH v4 5/6] usb: musb: Add musb_clearb/w() interface
Hi Min,
Quoted 22 lines · On Mon, Jan 21, 2019 at 08:22:30PM +0800, [email protected] wrote:
From: Min Guo <[email protected]>
Delete the const attribute of addr parameter in readb/w/l hooks, these changes are for implementing clearing W1C registers. Replace musb_readb/w with musb_clearb/w to clear the interrupt status.
Signed-off-by Min Guo <[email protected]>---
new patch based on v3:--- drivers/usb/musb/musb_core.c | 32 +++++++++++++++++++++++--------- drivers/usb/musb/musb_core.h | 8 ++++++-- drivers/usb/musb/musb_io.h | 8 +++++--- drivers/usb/musb/musbhsdma.c | 3 +++ drivers/usb/musb/sunxi.c | 4 ++-- drivers/usb/musb/tusb6010.c | 2 +- 6 files changed, 40 insertions(+), 17 deletions(-)drivers/usb/musb/musb_core.c +0
-0
[snip]
drivers/usb/musb/musbhsdma.c irqreturn_t dma_controller_irq(int irq, void *private_data) · line 291
Quoted 11 lines
drivers/usb/musb/musbhsdma.c +3
-0@@ -286,6 +286,9 @@ irqreturn_t dma_controller_irq(int irq, void *private_data) int_hsdma =musb_readb (mbase,MUSB_HSDMA_INTR ); +/* clear pending interrupts by manual */ +musb_clearb (musb->mregs,MUSB_HSDMA_INTR ); +
Make musb_clearb/w() return the value of the _read() instead of _write(), so that we don't have to read twice here. The value of _write() is not used anyway.
The change above can be:
int_hsdma = musb_clearb(mbase, MUSB_HSDMA_INTR);
Please see my comments in 6/6 for details.
Regards,
-Bin.
Re: [PATCH v4 5/6] usb: musb: Add musb_clearb/w() interface
Hi Bin,
Quoted 44 lines · Bin Liu
Hi Min,
Quoted 22 lines · On Mon, Jan 21, 2019 at 08:22:30PM +0800, [email protected] wrote:
From: Min Guo <[email protected]>
Delete the const attribute of addr parameter in readb/w/l hooks, these changes are for implementing clearing W1C registers. Replace musb_readb/w with musb_clearb/w to clear the interrupt status.
Signed-off-by Min Guo <[email protected]>---
new patch based on v3:--- drivers/usb/musb/musb_core.c | 32 +++++++++++++++++++++++--------- drivers/usb/musb/musb_core.h | 8 ++++++-- drivers/usb/musb/musb_io.h | 8 +++++--- drivers/usb/musb/musbhsdma.c | 3 +++ drivers/usb/musb/sunxi.c | 4 ++-- drivers/usb/musb/tusb6010.c | 2 +- 6 files changed, 40 insertions(+), 17 deletions(-)drivers/usb/musb/musb_core.c +0
-0[snip]
drivers/usb/musb/musbhsdma.c irqreturn_t dma_controller_irq(int irq, void *private_data) · line 291
Quoted 11 lines
drivers/usb/musb/musbhsdma.c +3
-0@@ -286,6 +286,9 @@ irqreturn_t dma_controller_irq(int irq, void *private_data) int_hsdma =musb_readb (mbase,MUSB_HSDMA_INTR ); +/* clear pending interrupts by manual */ +musb_clearb (musb->mregs,MUSB_HSDMA_INTR ); +Make musb_clearb/w() return the value of the
_read()instead of_write(), so that we don't have to read twice here. The value of_write()is not used anyway.
Quoted 5 lines
The change above can be:
int_hsdma = musb_clearb(mbase, MUSB_HSDMA_INTR);Please see my comments in 6/6 for details.
Okay.
Quoted 2 lines
Regards,
-Bin.
PATCH v4 6/6 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
---
changes in v4:
1. no changes
changes in v3:
suggested by Bin:
1. Remove 'u8/u16 data' parameter in clearb/w() hooks
2. Replace musb_readb/w() with musb_clearb/w() to clear interrupts status
changes in v2:
suggested by Bin:
1. Add summarize of MediaTek musb controller differences in the commit log
2. Add "|| COMPILE_TEST" in Kconfig
3. Move MediaTek's private toggle registers from musb_regs.h to mediatek.c
4. Replace musb_readl() with musb_readw() to read 16bit toggle register
--- drivers/usb/musb/Kconfig | 8 +- drivers/usb/musb/Makefile | 1 + drivers/usb/musb/mediatek.c | 624 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 632 insertions(+), 1 deletion(-) 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
Signature · 1 line
1.9.1
Bin Liu
maintainerRe: [PATCH v4 6/6] usb: musb: Add support for MediaTek musb controller
Hi Min,
Quoted 33 lines · On Mon, Jan 21, 2019 at 08:22:31PM +0800, [email protected] wrote:
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 lineSigned-off-by Min Guo <[email protected]>Signed-off-by Yonglong Wu <[email protected]>---
changes in v4:
1. no changeschanges in v3:
suggested by Bin:
1. Remove 'u8/u16 data' parameter in clearb/w() hooks
2. Replace musb_readb/w() with musb_clearb/w() to clear interrupts statuschanges in v2:
suggested by Bin:
1. Add summarize of MediaTek musb controller differences in the commit log
2. Add "||COMPILE_TEST" inKconfig
3. Move MediaTek's private toggle registers frommusb_regs.htomediatek.c
4. Replacemusb_readl()withmusb_readw()to read 16bit toggle register--- drivers/usb/musb/Kconfig | 8 +- drivers/usb/musb/Makefile | 1 + drivers/usb/musb/mediatek.c | 624 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 632 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/musb/mediatek.c
[snip]
drivers/usb/musb/mediatek.c line 262
Quoted 13 lines
drivers/usb/musb/mediatek.c new file +13
-0+static irqreturn_t generic_interrupt (int irq,void *__hci) +{ +unsigned long flags; +irqreturn_t retval =IRQ_NONE ; +struct musb *musb = __hci; + +spin_lock_irqsave (&musb->lock, flags); + musb->int_usb =musb_readb (musb->mregs,MUSB_INTRUSB ) & +musb_readb (musb->mregs,MUSB_INTRUSBE ); + musb->int_tx =musb_readw (musb->mregs,MUSB_INTRTX ) + &musb_readw (musb->mregs,MUSB_INTRTXE ); + musb->int_rx =musb_readw (musb->mregs,MUSB_INTRRX ) + &musb_readw (musb->mregs,MUSB_INTRRXE );
Based on my comment in 5/6, the above 3 musb_readb/w() can be changed to
drivers/usb/musb/mediatek.c line 266
Quoted 4 lines
drivers/usb/musb/mediatek.c new file +4
-0+/* MediaTek controller interrupt status is W1C */ +musb_clearw (musb->mregs,MUSB_INTRRX ); +musb_clearw (musb->mregs,MUSB_INTRTX ); +musb_clearb (musb->mregs,MUSB_INTRUSB );
musb->int_usb = musb_clearb(musb->mregs, MUSB_INTRUSB) musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX); musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
Quoted 9 lines
drivers/usb/musb/mediatek.c new file +9
-0+ +if (musb->int_usb || musb->int_tx || musb->int_rx) + retval =musb_interrupt (musb); + +spin_unlock_irqrestore (&musb->lock, flags); + +return retval; +} +
[snip]
drivers/usb/musb/mediatek.c line 307
Quoted 9 lines
drivers/usb/musb/mediatek.c new file +9
-0+ +static u8 mtk_musb_clearb (void __iomem *addr,unsigned int offset) +{ +u8 data; + +/* W1C */ + data =musb_readb (addr, offset); +musb_writeb (addr, offset, data); +return musb_readb (addr, offset);
return data;
drivers/usb/musb/mediatek.c line 317
Quoted 10 lines
drivers/usb/musb/mediatek.c new file +10
-0+} + +static u16 mtk_musb_clearw (void __iomem *addr,unsigned int offset) +{ +u16 data; + +/* W1C */ + data =musb_readw (addr, offset); +musb_writew (addr, offset, data); +return musb_readw (addr, offset);
return data;
Regards,
-Bin.
Re: [PATCH v4 6/6] usb: musb: Add support for MediaTek musb controller
Hi Bin,
Quoted 55 lines · Bin Liu
Hi Min,
Quoted 33 lines · On Mon, Jan 21, 2019 at 08:22:31PM +0800, [email protected] wrote:
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 lineSigned-off-by Min Guo <[email protected]>Signed-off-by Yonglong Wu <[email protected]>---
changes in v4:
1. no changeschanges in v3:
suggested by Bin:
1. Remove 'u8/u16 data' parameter in clearb/w() hooks
2. Replace musb_readb/w() with musb_clearb/w() to clear interrupts statuschanges in v2:
suggested by Bin:
1. Add summarize of MediaTek musb controller differences in the commit log
2. Add "||COMPILE_TEST" inKconfig
3. Move MediaTek's private toggle registers frommusb_regs.htomediatek.c
4. Replacemusb_readl()withmusb_readw()to read 16bit toggle register--- drivers/usb/musb/Kconfig | 8 +- drivers/usb/musb/Makefile | 1 + drivers/usb/musb/mediatek.c | 624 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 632 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/musb/mediatek.c[snip]
drivers/usb/musb/mediatek.c line 262
Quoted 13 lines
drivers/usb/musb/mediatek.c new file +13
-0+static irqreturn_t generic_interrupt (int irq,void *__hci) +{ +unsigned long flags; +irqreturn_t retval =IRQ_NONE ; +struct musb *musb = __hci; + +spin_lock_irqsave (&musb->lock, flags); + musb->int_usb =musb_readb (musb->mregs,MUSB_INTRUSB ) & +musb_readb (musb->mregs,MUSB_INTRUSBE ); + musb->int_tx =musb_readw (musb->mregs,MUSB_INTRTX ) + &musb_readw (musb->mregs,MUSB_INTRTXE ); + musb->int_rx =musb_readw (musb->mregs,MUSB_INTRRX ) + &musb_readw (musb->mregs,MUSB_INTRRXE );Based on my comment in 5/6, the above 3 musb_readb/w() can be changed to
Quoted 8 lines
drivers/usb/musb/mediatek.c line 266
Quoted 4 lines
drivers/usb/musb/mediatek.c new file +4
-0+/* MediaTek controller interrupt status is W1C */ +musb_clearw (musb->mregs,MUSB_INTRRX ); +musb_clearw (musb->mregs,MUSB_INTRTX ); +musb_clearb (musb->mregs,MUSB_INTRUSB );musb->int_usb = musb_clearb(musb->mregs, MUSB_INTRUSB) musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX); musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
Okay.
Quoted 12 lines
Quoted 9 lines
drivers/usb/musb/mediatek.c new file +9
-0+ +if (musb->int_usb || musb->int_tx || musb->int_rx) + retval =musb_interrupt (musb); + +spin_unlock_irqrestore (&musb->lock, flags); + +return retval; +} +[snip]
Quoted 11 lines
drivers/usb/musb/mediatek.c line 307
Quoted 9 lines
drivers/usb/musb/mediatek.c new file +9
-0+ +static u8 mtk_musb_clearb (void __iomem *addr,unsigned int offset) +{ +u8 data; + +/* W1C */ + data =musb_readb (addr, offset); +musb_writeb (addr, offset, data); +return musb_readb (addr, offset);return data;
Okay.
Quoted 4 lines
Quoted 4 lines
drivers/usb/musb/mediatek.c new file +4
-0+} + +static u16 mtk_musb_clearw (void __iomem *addr,unsigned int offset) +{
Quoted 8 lines
drivers/usb/musb/mediatek.c line 317
Quoted 6 lines
drivers/usb/musb/mediatek.c new file +6
-0+u16 data; + +/* W1C */ + data =musb_readw (addr, offset); +musb_writew (addr, offset, data); +return musb_readw (addr, offset);return data;
Okay.
Quoted 3 lines
Regards,
-Bin.