Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Problems enabling the PCIe/USB3.0 port on MT7623N
@ 2017-11-02 22:25 Kristian Evensen
       [not found] ` <CAKfDRXjNJSJZe_QjuE8H+_ZXVWo1NKM7vrqHBhJ-tAMXqsyxwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Kristian Evensen @ 2017-11-02 22:25 UTC (permalink / raw)
  To: linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hello,

I am working on adding mainline support for an MT7623N-based board.
The board uses eMMC for storage, so I have based my work on a DTS-file
for the eMMC reference board (from the LEDE repository).

The kernel currently boots just fine to my rootfs, and the switch, usb
port and the two "pure" pcie slots are working. However, for the last
couple of days I have been banging my head against the wall trying to
get the combined pcie/usb3 slot to work. I have tried to add different
nodes to the DTS, experimented with GPIOs and analyzed logs of the
proprietary firmware (where to slot works), to no good.

Does anyone have any experience with activating this slot or hints or
tips on where to look?

Thanks in advance for any help,
Kristian

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

* Re: Problems enabling the PCIe/USB3.0 port on MT7623N
       [not found] ` <CAKfDRXjNJSJZe_QjuE8H+_ZXVWo1NKM7vrqHBhJ-tAMXqsyxwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-11-03  2:13   ` Ryder Lee
  2017-11-03 11:07     ` Kristian Evensen
  0 siblings, 1 reply; 7+ messages in thread
From: Ryder Lee @ 2017-11-03  2:13 UTC (permalink / raw)
  To: Kristian Evensen; +Cc: linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi,

On Thu, 2017-11-02 at 23:25 +0100, Kristian Evensen wrote:
> Hello,
> 
> I am working on adding mainline support for an MT7623N-based board.
> The board uses eMMC for storage, so I have based my work on a DTS-file
> for the eMMC reference board (from the LEDE repository).
> 
> The kernel currently boots just fine to my rootfs, and the switch, usb
> port and the two "pure" pcie slots are working. However, for the last
> couple of days I have been banging my head against the wall trying to
> get the combined pcie/usb3 slot to work. I have tried to add different
> nodes to the DTS, experimented with GPIOs and analyzed logs of the
> proprietary firmware (where to slot works), to no good.
> 
> Does anyone have any experience with activating this slot or hints or
> tips on where to look?

Glad to see someone else interested in the MT7623N. In your case you
need to set extra bit to switch the PCIe/USB function, which is not
supported in mainline yet...

Please see the below link and search 'HIF_SYSCFG1'.

https://patchwork.kernel.org/patch/9694575/


Thanks.

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

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

* Re: Problems enabling the PCIe/USB3.0 port on MT7623N
  2017-11-03  2:13   ` Ryder Lee
@ 2017-11-03 11:07     ` Kristian Evensen
       [not found]       ` <CAKfDRXjrDPKo-mveCb8o7YFdBbBa53kt8WTPDi1RhMXMcbvMYw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Kristian Evensen @ 2017-11-03 11:07 UTC (permalink / raw)
  To: Ryder Lee, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Ryder,

Thanks for the quick reply!

On Fri, Nov 3, 2017 at 3:13 AM, Ryder Lee <ryder.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> Glad to see someone else interested in the MT7623N. In your case you
> need to set extra bit to switch the PCIe/USB function, which is not
> supported in mainline yet...
>
> Please see the below link and search 'HIF_SYSCFG1'.
>
> https://patchwork.kernel.org/patch/9694575/

I am currently building LEDE for the board and noticed that they have
a different patch for PCIe
(https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/mediatek/patches-4.9/0003-PCI-mediatek-add-support-for-PCIe-found-on-MT7623-MT.patch;h=43f51ef6b334d6ff859dca6218a9710ba1b9e3d5;hb=HEAD).
This patch does the same regmap_update_bits() call (with the same
values) and I added some logs to confirm that the functions is called.
So at least that part should be fine.

Yesterday evening, I had some discussions with the producer of the
board, as they provided me with two firmware images - one where I can
see the device connected to the slot (provided to the vendor by
Mediatek) and one where the device is not available (image compiled by
the vendor). According to the vendor, the difference between the
images is that the image provided by Mediatek enables USB
OTG-functionality and this is required for the slot. However, they
could not give me any technical details on how to enable OTG. When
searching the linux-mediatek mailing list archives, I couldn't find
any OTG-specific patches. Are there any specific steps that has to be
taken to enable OTG?

I am not sure if it matters, but when I look at the image where I can
see the device, the content of USB devices is:
# ls /sys/bus/usb/devices/
2-0:1.0  1-0:1.0  3-1:1.0  usb3     usb1     1-1
1-1:1.0  3-1:1.1  3-0:1.0  usb2     3-1

With LEDE or the other vendor-firmware, it contains the follows:
root@LEDE:/# ls /sys/bus/usb/devices/
1-0:1.0  2-0:1.0  usb1     usb2

I was also provided with the toolchain yesterday, so I will try to
compile the linux-mediatek kernel for the board. Which branch is the
best to use?

Thanks for all the help so far,
Kristian

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

* Re: Problems enabling the PCIe/USB3.0 port on MT7623N
       [not found]       ` <CAKfDRXjrDPKo-mveCb8o7YFdBbBa53kt8WTPDi1RhMXMcbvMYw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-11-03 12:19         ` John Crispin
       [not found]           ` <d9c34106-3a90-1df0-6765-1ab230372468-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: John Crispin @ 2017-11-03 12:19 UTC (permalink / raw)
  To: Kristian Evensen, Ryder Lee,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r



On 03/11/17 12:07, Kristian Evensen wrote:
> Hi Ryder,
>
> Thanks for the quick reply!
>
> On Fri, Nov 3, 2017 at 3:13 AM, Ryder Lee <ryder.lee@mediatek.com> wrote:
>> Glad to see someone else interested in the MT7623N. In your case you
>> need to set extra bit to switch the PCIe/USB function, which is not
>> supported in mainline yet...
>>
>> Please see the below link and search 'HIF_SYSCFG1'.
>>
>> https://patchwork.kernel.org/patch/9694575/
> I am currently building LEDE for the board and noticed that they have
> a different patch for PCIe
> (https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/mediatek/patches-4.9/0003-PCI-mediatek-add-support-for-PCIe-found-on-MT7623-MT.patch;h=43f51ef6b334d6ff859dca6218a9710ba1b9e3d5;hb=HEAD).
> This patch does the same regmap_update_bits() call (with the same
> values) and I added some logs to confirm that the functions is called.
> So at least that part should be fine.
>
> Yesterday evening, I had some discussions with the producer of the
> board, as they provided me with two firmware images - one where I can
> see the device connected to the slot (provided to the vendor by
> Mediatek) and one where the device is not available (image compiled by
> the vendor). According to the vendor, the difference between the
> images is that the image provided by Mediatek enables USB
> OTG-functionality and this is required for the slot. However, they
> could not give me any technical details on how to enable OTG. When
> searching the linux-mediatek mailing list archives, I couldn't find
> any OTG-specific patches. Are there any specific steps that has to be
> taken to enable OTG?
>
> I am not sure if it matters, but when I look at the image where I can
> see the device, the content of USB devices is:
> # ls /sys/bus/usb/devices/
> 2-0:1.0  1-0:1.0  3-1:1.0  usb3     usb1     1-1
> 1-1:1.0  3-1:1.1  3-0:1.0  usb2     3-1
>
> With LEDE or the other vendor-firmware, it contains the follows:
> root@LEDE:/# ls /sys/bus/usb/devices/
> 1-0:1.0  2-0:1.0  usb1     usb2
>
> I was also provided with the toolchain yesterday, so I will try to
> compile the linux-mediatek kernel for the board. Which branch is the
> best to use?
>
> Thanks for all the help so far,
> Kristian
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

Hi Kristian,
the patch in LEDE is an old version of the driver, feel free to send a 
patch backporting latest from upstream.
I managed to get the 2nd USBport working on the LEDE last night and will 
push a patch today. the usb2 node is simply not getting enabled and the 
2nd phys node is missing 2 properties.
     John


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: Problems enabling the PCIe/USB3.0 port on MT7623N
       [not found]           ` <d9c34106-3a90-1df0-6765-1ab230372468-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
@ 2017-11-03 12:26             ` Kristian Evensen
  2017-11-03 16:20             ` Kristian Evensen
  1 sibling, 0 replies; 7+ messages in thread
From: Kristian Evensen @ 2017-11-03 12:26 UTC (permalink / raw)
  To: John Crispin; +Cc: Ryder Lee, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi John,

On Fri, Nov 3, 2017 at 1:19 PM, John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org> wrote:
> the patch in LEDE is an old version of the driver, feel free to send a patch
> backporting latest from upstream.
> I managed to get the 2nd USBport working on the LEDE last night and will
> push a patch today. the usb2 node is simply not getting enabled and the 2nd
> phys node is missing 2 properties.

Thanks for letting me know! Would it be possible to send me the patch
or share the changes to the dts/dtsi, so that I can test on my board?

 I will give backporting a go. Worst case it will be good exercise and
an introduction to getting more familiar with the archiecture :)

-Kristian

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

* Re: Problems enabling the PCIe/USB3.0 port on MT7623N
       [not found]           ` <d9c34106-3a90-1df0-6765-1ab230372468-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
  2017-11-03 12:26             ` Kristian Evensen
@ 2017-11-03 16:20             ` Kristian Evensen
       [not found]               ` <CAKfDRXg=vno2wOL39JAUGnKHEsXVb4XyewEmPR5CHf5k+66xhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Kristian Evensen @ 2017-11-03 16:20 UTC (permalink / raw)
  To: John Crispin; +Cc: Ryder Lee, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi all,

On Fri, Nov 3, 2017 at 1:19 PM, John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org> wrote:
> I managed to get the 2nd USBport working on the LEDE last night and will
> push a patch today. the usb2 node is simply not getting enabled and the 2nd
> phys node is missing 2 properties.

Based on this comment from John, I took a second look at the
mt7623.dtsi file in LEDE and updated the structure of u3phy2 to match
that of phy1. Now, I can see the hub. I.e., dmesg contains the
following:

[    1.095790] xhci-mtk 1a240000.usb: xHCI Host Controller
[    1.100998] xhci-mtk 1a240000.usb: new USB bus registered, assigned
bus number 3
[    1.108643] xhci-mtk 1a240000.usb: hcc params 0x01401198 hci
version 0x96 quirks 0x00210010
[    1.117009] xhci-mtk 1a240000.usb: irq 198, io mem 0x1a240000
[    1.123373] hub 3-0:1.0: USB hub found
[    1.127154] hub 3-0:1.0: 1 port detected
[    1.131426] xhci-mtk 1a240000.usb: xHCI Host Controller
[    1.136646] xhci-mtk 1a240000.usb: new USB bus registered, assigned
bus number 4
[    1.144068] usb usb4: We don't know the algorithms for LPM for this
host, disabling LPM.
[    1.152707] hub 4-0:1.0: USB hub found
[    1.156480] hub 4-0:1.0: 1 port detected

However, I still can't see the device connected to the slot. I don't
know if that (in most cases at least) should just work out of the box,
or if additional steps are required? I suspect the following error
might be related:

[    1.314407] mediatek-pcie 1a140000.pcie: can't request region for
resource [mem 0x1a244000-0x1a244fff]
[    1.353851] mediatek-pcie 1a140000.pcie: Failed to get pcie phy2
range fffffff0
[    1.361099] mediatek-pcie 1a140000.pcie: failed to request resources: -16
[    1.367896] mediatek-pcie: probe of 1a140000.pcie failed with error -16

I have to admit that I don't have so much experience working with
dts', etc. so apologizes for any stupid questions.

Thanks in advance for all the help so far,
Kristian

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

* Re: Problems enabling the PCIe/USB3.0 port on MT7623N
       [not found]               ` <CAKfDRXg=vno2wOL39JAUGnKHEsXVb4XyewEmPR5CHf5k+66xhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-11-04 12:05                 ` Kristian Evensen
  0 siblings, 0 replies; 7+ messages in thread
From: Kristian Evensen @ 2017-11-04 12:05 UTC (permalink / raw)
  To: John Crispin; +Cc: Ryder Lee, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi all,

First of all, I see that I have completely forgot to mention the board
I am using, sorry about that. It is this one:
http://www.unielecinc.com/q/news/cn/p/product/detail.html?qd_guid=OjXwKCaRlN

On Fri, Nov 3, 2017 at 5:20 PM, Kristian Evensen
<kristian.evensen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> [    1.314407] mediatek-pcie 1a140000.pcie: can't request region for
> resource [mem 0x1a244000-0x1a244fff]
> [    1.353851] mediatek-pcie 1a140000.pcie: Failed to get pcie phy2
> range fffffff0
> [    1.361099] mediatek-pcie 1a140000.pcie: failed to request resources: -16
> [    1.367896] mediatek-pcie: probe of 1a140000.pcie failed with error -16

John explained this error message to me yesterday and we got a working
usb2. However, when disabling pcie2 and enabling usb2, the only thing
that happened was that one of the wifi-cards disappeared. The USB slot
(the one with the LTE module in the picture in the link above) was
still dead. After discovering this, I loaded the proprietary firmware
(version where the slot is working) to check the output of lspci and
see if pcie2 was enabled/disabled. lspci showed three bridges and
three devices - 01:00.0 contained a SATA controller, while 02:00.0 and
03:00.0 contained the wifi radios. I guess this points to the issue of
the dead slot not having to do with usb2 being disabled.

As I mentioned in an earlier email to the list, the manufacturer says
that the modem slot will be exposed if USB OTG is opened (I suspect
they mean put in host mode), so I guess that would be the next path to
explore. I see that there is a USB 2.0 OTG block on the hardware
diagram, and I see that the tphy-driver contains code which always
enables OTG. Has anyone got OTG working and is there any way to verify
that OTG is up and running? I did some research last night and found
this patch: https://patchwork.kernel.org/patch/9963671/. I forced the
bits to be set/unset for OTG and host-mode (separate tests), but
nothing happened.

BR,
Kristian

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

end of thread, other threads:[~2017-11-04 12:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-02 22:25 Problems enabling the PCIe/USB3.0 port on MT7623N Kristian Evensen
     [not found] ` <CAKfDRXjNJSJZe_QjuE8H+_ZXVWo1NKM7vrqHBhJ-tAMXqsyxwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-03  2:13   ` Ryder Lee
2017-11-03 11:07     ` Kristian Evensen
     [not found]       ` <CAKfDRXjrDPKo-mveCb8o7YFdBbBa53kt8WTPDi1RhMXMcbvMYw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-03 12:19         ` John Crispin
     [not found]           ` <d9c34106-3a90-1df0-6765-1ab230372468-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2017-11-03 12:26             ` Kristian Evensen
2017-11-03 16:20             ` Kristian Evensen
     [not found]               ` <CAKfDRXg=vno2wOL39JAUGnKHEsXVb4XyewEmPR5CHf5k+66xhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-04 12:05                 ` Kristian Evensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox