All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kristian Evensen <kristian.evensen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Ryder Lee <ryder.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Cc: Matthias Brugger
	<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
Subject: Re: Questions about bringing up MT7623 board
Date: Mon, 30 Apr 2018 18:12:40 +0200	[thread overview]
Message-ID: <CAKfDRXiYdxSusSSZ5rC38quM+vk+n1mKdmpedDvPG1sNZSd=wA@mail.gmail.com> (raw)
In-Reply-To: <1525052532.5013.5.camel@mtkswgap22>

[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]

Hi Ryder,

On Mon, Apr 30, 2018 at 3:42 AM, Ryder Lee <ryder.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> We didn't support port2 (pcie@2,0) for mainline version, but if you want
> to use it you could take a look at -
> https://patchwork.kernel.org/patch/9747713/
>
> grep: HIF_SYSCFG1 /HIF_SYSCFG1_PHY2_MASK
>
> That is, you need to clear these bits to 0 to enable PHY for pcie@2,0.

Thanks a lot for the pointer. With the attached patch and a slight
update to my DTS (add a reference to hifsys for usb3phy2), both the
PCIe-slots work and I have both 2.4Ghz and 5GHz.

The "only" thing left now is the USB OTG-port. I got the SDK from the
vendor yesterday, but without any proper documentation. Looking
through the kernel configuration for my board, the only relevant
select options (that I could find), was that USB_MUSB_HDRC and
MUSB_PIO_ONLY was enabled. Enabling those options for my 4.14 kernel
has seemingly no effect, the modem connected to PCIe-slot connected to
the OTG-port (puh) is not visible. Does anyone know where I should
start looking in order to enable this port? I see that there is some
mention of OTG in phy-mtk-tphy.c, but not sure if that is relevant.
Also, as far as I can tell, my device should be set to host mode and
both usb-phys are activated (phy1 is the port on the front of my
board, phy2 shared with pcie).

Thanks in advance for any help (again)!

BR,
Kristian

[-- Attachment #2: 0001-Add-hifsys-support-to-phy-mtk-tphy.patch --]
[-- Type: text/x-patch, Size: 2168 bytes --]

From 4d054fa1f72c65e9640b3dd1a90c2ecb6dd57445 Mon Sep 17 00:00:00 2001
From: Kristian Evensen <kristian.evensen@gmail.com>
Date: Mon, 30 Apr 2018 14:38:01 +0200
Subject: [PATCH] Add hifsys-support to phy-mtk-tphy

---
 drivers/phy/mediatek/phy-mtk-tphy.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index 721a2a1c9..0cb1cea53 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -22,6 +22,8 @@
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
 /* version V1 sub-banks offset base address */
 /* banks shared by multiple phys */
@@ -259,6 +261,9 @@
 #define RG_CDR_BIRLTD0_GEN3_MSK		GENMASK(4, 0)
 #define RG_CDR_BIRLTD0_GEN3_VAL(x)	(0x1f & (x))
 
+#define HIF_SYSCFG1			0x14
+#define HIF_SYSCFG1_PHY2_MASK		(0x3 << 20)
+
 enum mtk_phy_version {
 	MTK_PHY_V1 = 1,
 	MTK_PHY_V2,
@@ -302,6 +307,7 @@ struct mtk_tphy {
 	struct clk *u3phya_ref;	/* reference clock of usb3 anolog phy */
 	const struct mtk_phy_pdata *pdata;
 	struct mtk_phy_instance **phys;
+	struct regmap *hif;
 	int nphys;
 };
 
@@ -594,6 +600,10 @@ static void pcie_phy_instance_init(struct mtk_tphy *tphy,
 	if (tphy->pdata->version != MTK_PHY_V1)
 		return;
 
+	if (tphy->hif)
+		regmap_update_bits(tphy->hif, HIF_SYSCFG1,
+				   HIF_SYSCFG1_PHY2_MASK, 0);
+
 	tmp = readl(u3_banks->phya + U3P_U3_PHYA_DA_REG0);
 	tmp &= ~(P3A_RG_XTAL_EXT_PE1H | P3A_RG_XTAL_EXT_PE2H);
 	tmp |= P3A_RG_XTAL_EXT_PE1H_VAL(0x2) | P3A_RG_XTAL_EXT_PE2H_VAL(0x2);
@@ -1008,6 +1018,16 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 		tphy->u3phya_ref = NULL;
 	}
 
+	if (of_find_property(np, "mediatek,phy-switch", NULL)) {
+		tphy->hif = syscon_regmap_lookup_by_phandle(np,
+							    "mediatek,phy-switch");
+		if (IS_ERR(tphy->hif)) {
+			dev_err(&pdev->dev,
+				"missing \"mediatek,phy-switch\" phandle\n");
+			return PTR_ERR(tphy->hif);
+		}
+	}
+
 	port = 0;
 	for_each_child_of_node(np, child_np) {
 		struct mtk_phy_instance *instance;
-- 
2.14.1


[-- Attachment #3: Type: text/plain, Size: 200 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2018-04-30 16:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10 22:02 Questions about bringing up MT7623 board Kristian Evensen
     [not found] ` <CAKfDRXhhrndoKMidZYsw=E8BmS7AFsTJHbS4dcYbEoADhjD44Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 10:33   ` Kristian Evensen
     [not found]     ` <CAKfDRXg0jeHP9xZRGDNm5tfW1afZd-TPfwbwUzEPiWsy_bfuUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 10:36       ` John Crispin
     [not found]         ` <fc2bf32a-eb81-6cd1-9085-b8786ddf0f9c-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2018-02-11 10:40           ` Kristian Evensen
     [not found]             ` <CAKfDRXjpG4CNeHfKC1Kg=6mrqUTZ8A7bD1aivLkSQ2L0eK755Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 10:41               ` John Crispin
     [not found]                 ` <6ae4103b-45bf-c427-d0d9-87f6f4eb83b5-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2018-02-11 10:55                   ` Kristian Evensen
     [not found]                     ` <CAKfDRXiJCMpA+qj4HmoSg0F_Yt4LnjQ=Dvy_tkxa=Dnh_pN13g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 11:11                       ` John Crispin
     [not found]                         ` <12343512-196f-c89f-e7dc-2e35cad49fc8-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2018-02-11 11:13                           ` Kristian Evensen
     [not found]                             ` <CAKfDRXg66Un3c7U=WTSUYoduDkAD+jsL-tzxnYUSLHKrmFKiOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 14:01                               ` Kristian Evensen
     [not found]                                 ` <CAKfDRXiQb3LMSdjfE=CkfJE5bj9H+GAVD2Kj4syNfQD-eUPmWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 14:46                                   ` John Crispin
     [not found]                                     ` <CAKfDRXjVSsYke-d2Bww+SrqRepfgVXzHBbeyfahOhc9Tr5Zmbw@mail.gmail.com>
     [not found]                                       ` <CAKfDRXjVSsYke-d2Bww+SrqRepfgVXzHBbeyfahOhc9Tr5Zmbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 17:45                                         ` John Crispin
     [not found]                                           ` <CAKfDRXiirPhTbaUTcxseS7UuAiFDR_oY-QdvwvYc6Ua2vwuLSw@mail.gmail.com>
     [not found]                                             ` <CAKfDRXiirPhTbaUTcxseS7UuAiFDR_oY-QdvwvYc6Ua2vwuLSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-11 17:56                                               ` John Crispin
     [not found]                                                 ` <ba2e3623-dd21-9802-9ae6-12cd8baaac1e-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2018-02-11 20:53                                                   ` Kristian Evensen
2018-02-12 11:08                       ` Matthias Brugger
     [not found]                         ` <a594ffaa-4098-4171-f824-1aa3f332c9fc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-12 12:02                           ` Kristian Evensen
     [not found]                             ` <CAKfDRXgNGRHu9JMs-9vb4n72w+PmR8buqDnz8ObEQNXtP1pM4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-12 14:37                               ` Sean Wang
2018-02-12 14:49                                 ` Kristian Evensen
     [not found]                                   ` <CAKfDRXi57H5V+Qv-YO6+8OKdZLbTw7T_h64uZTMQZP6biO7Wpg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-29 20:18                                     ` Kristian Evensen
     [not found]                                       ` <CAKfDRXg419rBTeqZ+UqQJFRj5s6CVg0YXzjmhyFxrbJgMkM8fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-30  1:42                                         ` Ryder Lee
2018-04-30 16:12                                           ` Kristian Evensen [this message]
2018-02-17 19:10                           ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKfDRXiYdxSusSSZ5rC38quM+vk+n1mKdmpedDvPG1sNZSd=wA@mail.gmail.com' \
    --to=kristian.evensen-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org \
    --cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ryder.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
    --cc=sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.