From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?TWljaGFsIFZva8OhxI0=?= Subject: Re: i.MX6S/DL and QCA8334 switch using DSA driver - CPU port not working Date: Tue, 15 May 2018 16:25:49 +0200 Message-ID: <46a92995-b976-130c-7658-4d9576d5bee9@gmail.com> References: <037faf3c-8e8f-a696-8312-d1380c3b8656@gmail.com> <649c06a4-ca63-cb38-f105-ffd9dc17f5d2@gmail.com> <20180426140629.GB15370@lunn.ch> <48c029f1-1632-573f-c628-86b4972d668c@gmail.com> <20180430132025.GF10066@lunn.ch> <573258a9-b115-ca4a-121c-5174798d5621@gmail.com> <20180504133014.GB9666@lunn.ch> <5e8ecfed-c772-5668-4bac-1549143f599a@gmail.com> <20180510142904.GB7698@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Vivien Didelot , Florian Fainelli To: Andrew Lunn Return-path: Received: from mail-wr0-f178.google.com ([209.85.128.178]:38243 "EHLO mail-wr0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbeEOOZw (ORCPT ); Tue, 15 May 2018 10:25:52 -0400 Received: by mail-wr0-f178.google.com with SMTP id 94-v6so364793wrf.5 for ; Tue, 15 May 2018 07:25:51 -0700 (PDT) In-Reply-To: <20180510142904.GB7698@lunn.ch> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 10.5.2018 16:29, Andrew Lunn wrote: > I would probably add code to dump all the qca8k registers. Compare the > values for your working setup and your non-working setup. Hopefully > they are not too different, and you can quickly get to the bits which > matter. Perfect! Thanks to your suggestion I did that again and much more carefully. After some tedious comparison I think I finally found the problem. The RGMII works only if I write 0x7e to the PORT0_STATUS (0x7c) register from setup. Then I found out that this setup is also described in Qualcomm QCA8334 Q&A document. When I do that, everything work as expected. Both PORT0 and PORT6 may be configured as xGMII, xMII and SerDes and their functions may be exchanged. In all cases the port status register should be set to 0x7X where X depends on the link speed setup. Translated into register bits this means: - clear BIT(12) - disable MAC flow control auto-negotiation (set by default) - clear BIT(7) - disable MAC Tx flow control in half-duplex (set by default) - set BIT(6) - use full-duplex - set BIT(5,4) - enable Rx/Tx flow control - set BIT(3) - enable Rx MAC - this one is tricky, the bit is described as R/O in datasheet but it does not work when not set. - set BIT(2) - enable Tx MAC - set BIT(1,0) - set speed to 1000Mb In general the fixed-link subnode is not handled in qca8k driver. That is why the link speed and flow control is not set properly for the CPU port. And obviously autonegotiation can not be used here. I wonder whether there are some users of this driver and what may be their setup that they are not affected by that? I would like to have confirmed that I understand it correctly and that the problem is really in the driver not handling fixed-link. Then I can try to prepare a patch. It will be a small challenge for me but I would like to do the work. I will look at the other drivers where I think this is already implemented but any advice on how this should be done will be appreciated. Please confirm or correct my suggestions. Thanks, Michal