linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] usb: mtu3: remove mtu3_ep0_setup() declaration in mtu3.h
@ 2021-05-28  6:10 Chunfeng Yun
  2021-05-28  6:10 ` [PATCH 2/5] usb: mtu3: remove repeated setting of speed Chunfeng Yun
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chunfeng Yun @ 2021-05-28  6:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Eddie Hung

It's defined and only used in the same file, so remove its declaration
in mtu3.h, and make it static

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3.h      | 1 -
 drivers/usb/mtu3/mtu3_core.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
index aef0a0bba25a..a8a7ee11f7b7 100644
--- a/drivers/usb/mtu3/mtu3.h
+++ b/drivers/usb/mtu3/mtu3.h
@@ -422,7 +422,6 @@ int mtu3_config_ep(struct mtu3 *mtu, struct mtu3_ep *mep,
 		int interval, int burst, int mult);
 void mtu3_deconfig_ep(struct mtu3 *mtu, struct mtu3_ep *mep);
 void mtu3_ep_stall_set(struct mtu3_ep *mep, bool set);
-void mtu3_ep0_setup(struct mtu3 *mtu);
 void mtu3_start(struct mtu3 *mtu);
 void mtu3_stop(struct mtu3 *mtu);
 void mtu3_dev_on_off(struct mtu3 *mtu, int is_on);
diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index b3b459937566..2ef528f39ba3 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -536,7 +536,7 @@ static void get_ep_fifo_config(struct mtu3 *mtu)
 		rx_fifo->base, rx_fifo->limit);
 }
 
-void mtu3_ep0_setup(struct mtu3 *mtu)
+static void mtu3_ep0_setup(struct mtu3 *mtu)
 {
 	u32 maxpacket = mtu->g.ep0->maxpacket;
 	u32 csr;
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/5] usb: mtu3: remove repeated setting of speed
  2021-05-28  6:10 [PATCH 1/5] usb: mtu3: remove mtu3_ep0_setup() declaration in mtu3.h Chunfeng Yun
@ 2021-05-28  6:10 ` Chunfeng Yun
  2021-05-28  6:10 ` [PATCH 3/5] usb: mtu3: dump a status register of IPPC Chunfeng Yun
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chunfeng Yun @ 2021-05-28  6:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Eddie Hung

mtu3_gadget_start() will set speed, no need set it again in
mtu3_gadget_set_speed(), just save the desired speed.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3.h        | 1 -
 drivers/usb/mtu3/mtu3_core.c   | 2 +-
 drivers/usb/mtu3/mtu3_gadget.c | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
index a8a7ee11f7b7..531b9c78d7c3 100644
--- a/drivers/usb/mtu3/mtu3.h
+++ b/drivers/usb/mtu3/mtu3.h
@@ -425,7 +425,6 @@ void mtu3_ep_stall_set(struct mtu3_ep *mep, bool set);
 void mtu3_start(struct mtu3 *mtu);
 void mtu3_stop(struct mtu3 *mtu);
 void mtu3_dev_on_off(struct mtu3 *mtu, int is_on);
-void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed);
 
 int mtu3_gadget_setup(struct mtu3 *mtu);
 void mtu3_gadget_cleanup(struct mtu3 *mtu);
diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 2ef528f39ba3..6b5da98de648 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -207,7 +207,7 @@ static void mtu3_intr_enable(struct mtu3 *mtu)
 	mtu3_writel(mbase, U3D_DEV_LINK_INTR_ENABLE, SSUSB_DEV_SPEED_CHG_INTR);
 }
 
-void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed)
+static void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed)
 {
 	void __iomem *mbase = mtu->mac_base;
 
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 38f17d66d5bc..5e21ba05ebf0 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -577,7 +577,7 @@ mtu3_gadget_set_speed(struct usb_gadget *g, enum usb_device_speed speed)
 	dev_dbg(mtu->dev, "%s %s\n", __func__, usb_speed_string(speed));
 
 	spin_lock_irqsave(&mtu->lock, flags);
-	mtu3_set_speed(mtu, speed);
+	mtu->speed = speed;
 	spin_unlock_irqrestore(&mtu->lock, flags);
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/5] usb: mtu3: dump a status register of IPPC
  2021-05-28  6:10 [PATCH 1/5] usb: mtu3: remove mtu3_ep0_setup() declaration in mtu3.h Chunfeng Yun
  2021-05-28  6:10 ` [PATCH 2/5] usb: mtu3: remove repeated setting of speed Chunfeng Yun
@ 2021-05-28  6:10 ` Chunfeng Yun
  2021-05-28  6:10 ` [PATCH 4/5] usb: mtu3: use dev_err_probe to print error log about extcon Chunfeng Yun
  2021-05-28  6:11 ` [PATCH 5/5] usb: mtu3: skip getting extcon when use manual drd switch Chunfeng Yun
  3 siblings, 0 replies; 5+ messages in thread
From: Chunfeng Yun @ 2021-05-28  6:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Eddie Hung

Add a SSUSB_IP_PW_STS1 register to show ip sleep status

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
index 7537bfd651af..d27de647c86a 100644
--- a/drivers/usb/mtu3/mtu3_debugfs.c
+++ b/drivers/usb/mtu3/mtu3_debugfs.c
@@ -30,6 +30,7 @@ static const struct debugfs_reg32 mtu3_ippc_regs[] = {
 	dump_register(SSUSB_IP_PW_CTRL1),
 	dump_register(SSUSB_IP_PW_CTRL2),
 	dump_register(SSUSB_IP_PW_CTRL3),
+	dump_register(SSUSB_IP_PW_STS1),
 	dump_register(SSUSB_OTG_STS),
 	dump_register(SSUSB_IP_XHCI_CAP),
 	dump_register(SSUSB_IP_DEV_CAP),
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/5] usb: mtu3: use dev_err_probe to print error log about extcon
  2021-05-28  6:10 [PATCH 1/5] usb: mtu3: remove mtu3_ep0_setup() declaration in mtu3.h Chunfeng Yun
  2021-05-28  6:10 ` [PATCH 2/5] usb: mtu3: remove repeated setting of speed Chunfeng Yun
  2021-05-28  6:10 ` [PATCH 3/5] usb: mtu3: dump a status register of IPPC Chunfeng Yun
@ 2021-05-28  6:10 ` Chunfeng Yun
  2021-05-28  6:11 ` [PATCH 5/5] usb: mtu3: skip getting extcon when use manual drd switch Chunfeng Yun
  3 siblings, 0 replies; 5+ messages in thread
From: Chunfeng Yun @ 2021-05-28  6:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Eddie Hung

Print an error log when the error number is not -EPROBE_DEFER

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_plat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index 7786a95a874e..eaeda391693a 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -302,8 +302,8 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
 	if (!otg_sx->role_sw_used && of_property_read_bool(node, "extcon")) {
 		otg_sx->edev = extcon_get_edev_by_phandle(ssusb->dev, 0);
 		if (IS_ERR(otg_sx->edev)) {
-			dev_err(ssusb->dev, "couldn't get extcon device\n");
-			return PTR_ERR(otg_sx->edev);
+			return dev_err_probe(dev, PTR_ERR(otg_sx->edev),
+					     "couldn't get extcon device\n");
 		}
 	}
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 5/5] usb: mtu3: skip getting extcon when use manual drd switch
  2021-05-28  6:10 [PATCH 1/5] usb: mtu3: remove mtu3_ep0_setup() declaration in mtu3.h Chunfeng Yun
                   ` (2 preceding siblings ...)
  2021-05-28  6:10 ` [PATCH 4/5] usb: mtu3: use dev_err_probe to print error log about extcon Chunfeng Yun
@ 2021-05-28  6:11 ` Chunfeng Yun
  3 siblings, 0 replies; 5+ messages in thread
From: Chunfeng Yun @ 2021-05-28  6:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Eddie Hung

When use manual drd switch, extcon is not used in fact, so no
need get it even it exists, just skip it like using role switch.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_plat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index eaeda391693a..bbfabdc1e79b 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -299,7 +299,10 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
 		of_property_read_bool(node, "enable-manual-drd");
 	otg_sx->role_sw_used = of_property_read_bool(node, "usb-role-switch");
 
-	if (!otg_sx->role_sw_used && of_property_read_bool(node, "extcon")) {
+	if (otg_sx->role_sw_used || otg_sx->manual_drd_enabled)
+		goto out;
+
+	if (of_property_read_bool(node, "extcon")) {
 		otg_sx->edev = extcon_get_edev_by_phandle(ssusb->dev, 0);
 		if (IS_ERR(otg_sx->edev)) {
 			return dev_err_probe(dev, PTR_ERR(otg_sx->edev),
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-28  6:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28  6:10 [PATCH 1/5] usb: mtu3: remove mtu3_ep0_setup() declaration in mtu3.h Chunfeng Yun
2021-05-28  6:10 ` [PATCH 2/5] usb: mtu3: remove repeated setting of speed Chunfeng Yun
2021-05-28  6:10 ` [PATCH 3/5] usb: mtu3: dump a status register of IPPC Chunfeng Yun
2021-05-28  6:10 ` [PATCH 4/5] usb: mtu3: use dev_err_probe to print error log about extcon Chunfeng Yun
2021-05-28  6:11 ` [PATCH 5/5] usb: mtu3: skip getting extcon when use manual drd switch Chunfeng Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).