Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1397840 > unrolled thread
| Started by | Chunfeng Yun <chunfeng.yun@mediatek.com> |
|---|---|
| First post | 2016-05-10 10:30 +0200 |
| Last post | 2016-05-10 10:30 +0200 |
| Articles | 9 — 4 participants |
Back to article view | Back to linux.kernel
Add MediaTek USB3 DRD Driver Chunfeng Yun <chunfeng.yun@mediatek.com> - 2016-05-10 10:30 +0200
[PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Chunfeng Yun <chunfeng.yun@mediatek.com> - 2016-05-10 10:30 +0200
Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Linus Walleij <linus.walleij@linaro.org> - 2016-05-11 14:00 +0200
Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Hongzhou Yang <hongzhou.yang@mediatek.com> - 2016-05-11 20:40 +0200
Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode chunfeng yun <chunfeng.yun@mediatek.com> - 2016-05-12 03:50 +0200
Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Hongzhou Yang <hongzhou.yang@mediatek.com> - 2016-05-12 04:10 +0200
Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Hongzhou Yang <hongzhou.yang@mediatek.com> - 2016-05-12 05:00 +0200
Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Linus Walleij <linus.walleij@linaro.org> - 2016-05-24 13:00 +0200
[PATCH 2/6] usb: xhci-mtk: make IPPC register optional Chunfeng Yun <chunfeng.yun@mediatek.com> - 2016-05-10 10:30 +0200
| From | Chunfeng Yun <chunfeng.yun@mediatek.com> |
|---|---|
| Date | 2016-05-10 10:30 +0200 |
| Subject | Add MediaTek USB3 DRD Driver |
| Message-ID | <rxbdg-76W-5@gated-at.bofh.it> |
From 5e3e992dc3c02eda12f5cf984a18a57f0207333d Mon Sep 17 00:00:00 2001 From: Chunfeng Yun <chunfeng.yun@mediatek.com> Date: Tue, 10 May 2016 16:04:25 +0800 Subject: [PATCH 0/6] Add MediaTek USB3 DRD Driver These patches introduce the MediaTek USB3 dual-role controller driver. The driver can be configured as Dual-Role Device (DRD), Peripheral Only and Host Only (xHCI) modes. It works well with Mass Storage, RNDIS and g_zero on FS/HS and SS. And it is tested on MT8173 platform which only contains USB2.0 device IP, and on MT6290 platform which contains USB3.0 device IP. Chunfeng Yun (6): dt-bindings: mt8173-xhci: support host side of dual-role mode usb: xhci-mtk: make IPPC register optional dt-bindings: mtu3: add devicetree bindings usb: Add MediaTek USB3 DRD Driver arm64: dts: mediatek: add USB3 DRD driver pinctrl: mt8173: set GPIO16 to usb iddig mode .../devicetree/bindings/usb/mt8173-xhci.txt | 48 ++ Documentation/devicetree/bindings/usb/mtu3.txt | 86 ++ arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 46 +- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 28 +- drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h | 2 +- drivers/usb/Kconfig | 2 + drivers/usb/Makefile | 1 + drivers/usb/host/xhci-mtk.c | 32 +- drivers/usb/mtu3/Kconfig | 47 ++ drivers/usb/mtu3/Makefile | 20 + drivers/usb/mtu3/mtu3.h | 422 ++++++++++ drivers/usb/mtu3/mtu3_core.c | 877 +++++++++++++++++++ drivers/usb/mtu3/mtu3_dr.c | 353 ++++++++ drivers/usb/mtu3/mtu3_dr.h | 108 +++ drivers/usb/mtu3/mtu3_gadget.c | 735 ++++++++++++++++ drivers/usb/mtu3/mtu3_gadget_ep0.c | 889 ++++++++++++++++++++ drivers/usb/mtu3/mtu3_host.c | 294 +++++++ drivers/usb/mtu3/mtu3_hw_regs.h | 474 +++++++++++ drivers/usb/mtu3/mtu3_plat.c | 496 +++++++++++ drivers/usb/mtu3/mtu3_qmu.c | 599 +++++++++++++ drivers/usb/mtu3/mtu3_qmu.h | 43 + 21 files changed, 5587 insertions(+), 15 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/mtu3.txt create mode 100644 drivers/usb/mtu3/Kconfig create mode 100644 drivers/usb/mtu3/Makefile create mode 100644 drivers/usb/mtu3/mtu3.h create mode 100644 drivers/usb/mtu3/mtu3_core.c create mode 100644 drivers/usb/mtu3/mtu3_dr.c create mode 100644 drivers/usb/mtu3/mtu3_dr.h create mode 100644 drivers/usb/mtu3/mtu3_gadget.c create mode 100644 drivers/usb/mtu3/mtu3_gadget_ep0.c create mode 100644 drivers/usb/mtu3/mtu3_host.c create mode 100644 drivers/usb/mtu3/mtu3_hw_regs.h create mode 100644 drivers/usb/mtu3/mtu3_plat.c create mode 100644 drivers/usb/mtu3/mtu3_qmu.c create mode 100644 drivers/usb/mtu3/mtu3_qmu.h -- 1.7.9.5
[toc] | [next] | [standalone]
| From | Chunfeng Yun <chunfeng.yun@mediatek.com> |
|---|---|
| Date | 2016-05-10 10:30 +0200 |
| Subject | [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode |
| Message-ID | <rxbdh-76W-29@gated-at.bofh.it> |
| In reply to | #1397840 |
the default mode of GPIO16 pin is gpio, when set EINT16 to
IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
fixed when set its default mode as usb iddig.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
index 13e5b68..9b018fd 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
@@ -201,7 +201,7 @@ static const struct mtk_desc_pin mtk_pins_mt8173[] = {
MTK_PIN(
PINCTRL_PIN(16, "IDDIG"),
NULL, "mt8173",
- MTK_EINT_FUNCTION(0, 16),
+ MTK_EINT_FUNCTION(1, 16),
MTK_FUNCTION(0, "GPIO16"),
MTK_FUNCTION(1, "IDDIG"),
MTK_FUNCTION(2, "CMFLASH"),
--
1.7.9.5
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2016-05-11 14:00 +0200 |
| Subject | Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode |
| Message-ID | <rxAY2-7z7-13@gated-at.bofh.it> |
| In reply to | #1397845 |
On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun <chunfeng.yun@mediatek.com> wrote: > the default mode of GPIO16 pin is gpio, when set EINT16 to > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be > fixed when set its default mode as usb iddig. > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> This looks like it can be merged orthogonally to all the other patches, but I don't understand the patch or if it is correct. Hongzhou/Yingjoe, can either of you review this patch? Yours, Linus Walleij
[toc] | [prev] | [next] | [standalone]
| From | Hongzhou Yang <hongzhou.yang@mediatek.com> |
|---|---|
| Date | 2016-05-11 20:40 +0200 |
| Subject | Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode |
| Message-ID | <rxHd8-5ub-19@gated-at.bofh.it> |
| In reply to | #1398982 |
On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote: > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun > <chunfeng.yun@mediatek.com> wrote: > > > the default mode of GPIO16 pin is gpio, when set EINT16 to > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be > > fixed when set its default mode as usb iddig. > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0. If you want to set its default mode to iddig, you should set it in dts. Yours, Hongzhou
[toc] | [prev] | [next] | [standalone]
| From | chunfeng yun <chunfeng.yun@mediatek.com> |
|---|---|
| Date | 2016-05-12 03:50 +0200 |
| Subject | Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode |
| Message-ID | <rxNVg-3vp-13@gated-at.bofh.it> |
| In reply to | #1399410 |
Hi, On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote: > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote: > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun > > <chunfeng.yun@mediatek.com> wrote: > > > > > the default mode of GPIO16 pin is gpio, when set EINT16 to > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be > > > fixed when set its default mode as usb iddig. > > > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > > > > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0. > If you want to set its default mode to iddig, you should set it in dts. > I set it in DTS, but it didn't work, because when usb driver requested IRQ, pinmux was switched back to default mode set by MTK_EINT_FUNCTION(). > Yours, > Hongzhou >
[toc] | [prev] | [next] | [standalone]
| From | Hongzhou Yang <hongzhou.yang@mediatek.com> |
|---|---|
| Date | 2016-05-12 04:10 +0200 |
| Subject | Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode |
| Message-ID | <rxOeC-3YK-1@gated-at.bofh.it> |
| In reply to | #1399636 |
On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote: > Hi, > > On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote: > > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote: > > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun > > > <chunfeng.yun@mediatek.com> wrote: > > > > > > > the default mode of GPIO16 pin is gpio, when set EINT16 to > > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be > > > > fixed when set its default mode as usb iddig. > > > > > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > > > > > > > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0. > > If you want to set its default mode to iddig, you should set it in dts. > > > I set it in DTS, but it didn't work, because when usb driver requested > IRQ, pinmux was switched back to default mode set by > MTK_EINT_FUNCTION(). > After confirmed, there are something wrong with data sheet and pinmux table, and GPIO16 can only receive interrupt by mode 1. So Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com> Yours, Hongzhou
[toc] | [prev] | [next] | [standalone]
| From | Hongzhou Yang <hongzhou.yang@mediatek.com> |
|---|---|
| Date | 2016-05-12 05:00 +0200 |
| Subject | Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode |
| Message-ID | <rxP0Z-4Bd-5@gated-at.bofh.it> |
| In reply to | #1399640 |
On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote: > On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote: > > Hi, > > > > On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote: > > > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote: > > > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun > > > > <chunfeng.yun@mediatek.com> wrote: > > > > > > > > > the default mode of GPIO16 pin is gpio, when set EINT16 to > > > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be > > > > > fixed when set its default mode as usb iddig. > > > > > > > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > > > > > > > > > > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0. > > > If you want to set its default mode to iddig, you should set it in dts. > > > > > I set it in DTS, but it didn't work, because when usb driver requested > > IRQ, pinmux was switched back to default mode set by > > MTK_EINT_FUNCTION(). > > > > After confirmed, there are something wrong with data sheet and pinmux > table, and GPIO16 can only receive interrupt by mode 1. So > > Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com> > Linus, We find there are some other pins still have the same problem, so please hold on it. Sorry for so much noise. Thanks, Hongzhou
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2016-05-24 13:00 +0200 |
| Subject | Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode |
| Message-ID | <rCie5-2bW-9@gated-at.bofh.it> |
| In reply to | #1399651 |
On Thu, May 12, 2016 at 4:55 AM, Hongzhou Yang <hongzhou.yang@mediatek.com> wrote: > We find there are some other pins still have the same problem, so please > hold on it. Sorry for so much noise. It's OK. Get me a big patch fixing it all when you're combed through things and we can apply it for fixes/stable. Yours, Linus Walleij
[toc] | [prev] | [next] | [standalone]
| From | Chunfeng Yun <chunfeng.yun@mediatek.com> |
|---|---|
| Date | 2016-05-10 10:30 +0200 |
| Subject | [PATCH 2/6] usb: xhci-mtk: make IPPC register optional |
| Message-ID | <rxbdh-76W-33@gated-at.bofh.it> |
| In reply to | #1397840 |
Make IPPC register optional to support host side of dual-role mode,
due to it is moved into common glue layer for simplification.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/host/xhci-mtk.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 79959f1..dc86832 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -94,6 +94,9 @@ static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk)
int ret;
int i;
+ if (ippc == NULL)
+ return 0;
+
/* power on host ip */
value = readl(&ippc->ip_pw_ctr1);
value &= ~CTRL1_IP_HOST_PDN;
@@ -139,6 +142,9 @@ static int xhci_mtk_host_disable(struct xhci_hcd_mtk *mtk)
int ret;
int i;
+ if (ippc == NULL)
+ return 0;
+
/* power down all u3 ports */
for (i = 0; i < mtk->num_u3_ports; i++) {
value = readl(&ippc->u3_ctrl_p[i]);
@@ -173,6 +179,9 @@ static int xhci_mtk_ssusb_config(struct xhci_hcd_mtk *mtk)
struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs;
u32 value;
+ if (ippc == NULL)
+ return 0;
+
/* reset whole ip */
value = readl(&ippc->ip_pw_ctr0);
value |= CTRL0_IP_SW_RST;
@@ -475,6 +484,7 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
/* called during probe() after chip reset completes */
static int xhci_mtk_setup(struct usb_hcd *hcd)
{
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
struct xhci_hcd_mtk *mtk = hcd_to_mtk(hcd);
int ret;
@@ -482,12 +492,21 @@ static int xhci_mtk_setup(struct usb_hcd *hcd)
ret = xhci_mtk_ssusb_config(mtk);
if (ret)
return ret;
+ }
+
+ ret = xhci_gen_setup(hcd, xhci_mtk_quirks);
+ if (ret)
+ return ret;
+
+ if (usb_hcd_is_primary_hcd(hcd)) {
+ mtk->num_u3_ports = xhci->num_usb3_ports;
+ mtk->num_u2_ports = xhci->num_usb2_ports;
ret = xhci_mtk_sch_init(mtk);
if (ret)
return ret;
}
- return xhci_gen_setup(hcd, xhci_mtk_quirks);
+ return ret;
}
static int xhci_mtk_probe(struct platform_device *pdev)
@@ -595,11 +614,14 @@ static int xhci_mtk_probe(struct platform_device *pdev)
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
+ mtk->ippc_regs = NULL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- mtk->ippc_regs = devm_ioremap_resource(dev, res);
- if (IS_ERR(mtk->ippc_regs)) {
- ret = PTR_ERR(mtk->ippc_regs);
- goto put_usb2_hcd;
+ if (res) { /* ippc register is optional */
+ mtk->ippc_regs = devm_ioremap_resource(dev, res);
+ if (IS_ERR(mtk->ippc_regs)) {
+ ret = PTR_ERR(mtk->ippc_regs);
+ goto put_usb2_hcd;
+ }
}
for (phy_num = 0; phy_num < mtk->num_phys; phy_num++) {
--
1.7.9.5
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web