From owner-freebsd-mips@FreeBSD.ORG Sun Mar 9 20:18:45 2014 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 591CF931 for ; Sun, 9 Mar 2014 20:18:45 +0000 (UTC) Received: from mail-qc0-x233.google.com (mail-qc0-x233.google.com [IPv6:2607:f8b0:400d:c01::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0FBF3FE7 for ; Sun, 9 Mar 2014 20:18:44 +0000 (UTC) Received: by mail-qc0-f179.google.com with SMTP id m20so6784292qcx.38 for ; Sun, 09 Mar 2014 13:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=i5zdn85b78qXJl2IRhjT2mkyoZ2EKiuwXTaoYxpzDbs=; b=gkDDv+A6pi1O4V2UgHRbjBBVguj11C0zMdp852+X/zmtv93b73m3LGwznDgn57qc+j J+mJafpDcClHH9sB6wS7ZGWsWop50vnpib3ratT26XsVMWxhxxn1GRpA3iXejUvWtaYq X1jrmMXu1mhKYaqnsrjhD4m6IxkuQlGwlQG+6eqgcF/vt1NAQPw02GaDA/ENY2HcHzmk a5uJ60P2HoFD0gs6hFV1MGnmCFPZUFw5R9hdS059QS+6pQpqhj5g0BQ67kWL46NL4FCf TLlsGXfqFJsRtXLDtwinN1FVPPGKeul7N3LAG/2eugjxsHn7/URtR1lf7hl7NzOXCrOA lWyQ== MIME-Version: 1.0 X-Received: by 10.140.42.21 with SMTP id b21mr3153101qga.87.1394396324279; Sun, 09 Mar 2014 13:18:44 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.8.137 with HTTP; Sun, 9 Mar 2014 13:18:43 -0700 (PDT) In-Reply-To: <20140309083919.2810fa97@zeta.dino.sk> References: <20140301143607.13a96bd6@zeta.dino.sk> <20140301200546.7ff373d1@zeta.dino.sk> <20140301231239.023b8733@zeta.dino.sk> <20140307140432.0a460da1@zeta.dino.sk> <20140307204230.3c86b9b1@zeta.dino.sk> <20140308140901.19782009@zeta.dino.sk> <20140308173642.0a48d2c2@zeta.dino.sk> <20140308234129.76800b5c@zeta.dino.sk> <20140309083919.2810fa97@zeta.dino.sk> Date: Sun, 9 Mar 2014 13:18:43 -0700 X-Google-Sender-Auth: hDnyEBIasyj1oBB1gRakZcI6QLM Message-ID: Subject: Re: I (think) the AR8327 switch support now works From: Adrian Chadd To: Milan Obuch Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-mips@freebsd.org" X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Mar 2014 20:18:45 -0000 Hi, Yes, I do think you're right. I think the MDIO IO is not being terribly stable. Unfortunately I don't have the time to figure it out. So if someone wants to buy/ship me an RB2011 of some flavour, I'll likely have a much better chance of figuring out what's going on. Thanks, -a On 8 March 2014 23:39, Milan Obuch wrote: > On Sat, 8 Mar 2014 14:50:14 -0800 > Adrian Chadd wrote: > >> Ok, well now let's figure out if the reset is working or not. >> >> look at arswitch_attach(): >> >> * It sets up the default methods; >> * it calls ar8327_attach(); >> * it resets the switch via arswitch_reset(); >> * it calls the HAL methods to set things up; >> * it attaches the PHYs; >> * it attaches said PHYs; >> * it starts the periodic checks via arswitch_tick(). >> >> So, I'd add some printf()s in arswitch_attach() to see where it's >> getting to before it calls return (ENXIO) or return (err). >> >> >> -a >> > > OK, so I patched said function with some printf's (in attachment), > built new kernel and got following result: > > mdio0: on argemdio0 > mdioproxy0: on mdio0 > arswitch0: readreg 0x00000000: 0x12041204 > arswitch0: readreg 0x00000000: 0x00000000 > arswitch0: on mdio0 > arswitch0: arswitch_attach 1 > device_attach: arswitch0 attach returned 6 > > Now I put there some more printf's (in arswitch_probe) and things go a > bit stranger. I've got: > > mdio0: on argemdio0 > mdioproxy0: on mdio0 > unknown: arswitch_probe 1 > arswitch0: readreg 0x00000000: 0x00000000 > unknown: arswitch_probe 2 0 > > and for the second time, just doing one more reboot: > > mdio0: on argemdio0 > mdioproxy0: on mdio0 > unknown: arswitch_probe 1 > arswitch0: readreg 0x00000000: 0x12041204 > unknown: arswitch_probe 2 6 > unknown: arswitch_probe 1 > arswitch0: readreg 0x00000000: 0x00000000 > unknown: arswitch_probe 2 0 > arswitch0: on mdio0 > arswitch0: arswitch_attach 1 0 > device_attach: arswitch0 attach returned 6 > > Next reboot brings again the first result, next one the second, again > the second, again the first one etc. It looks like two two > possibilities are alternating with some level of randomness. To me this > tells that mdio does not work reliably in this case - am I right > thinking that reading register 0 should always return the same value, > 0x12041204, at least when no other register is touched in between? > > Well, this was with soft reset - I got every time mountroot promp, so > just pressing enter gives me panic and then I typed reboot. when doing > power-cycle, things are a bit deterministic - three time in a row I got > the first result. > > Next question - why is arswitch_probe function called second time? It > is called twice for both switches, so it is probably by design, and as > the second switch is only 'hint probed', it does not matter. But for > 8327, register is read, unfortunatelly not the same result is given > both times. > > Also, I played with if_arge.c - arge_fetch_mdiobus_clock_rate() > function a bit, but no matter the clock divider I used, the results are > still the same. I see in next function, arge_reset_miibus a comment > about resetting the mdio block(s), so I suspect it is something to be > done, maybe, but is not yet. I have no idea how to try it, however. I > can just wait for next hint, now. > > Regards, > Milan