Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757228Ab3EVVCM (ORCPT ); Wed, 22 May 2013 17:02:12 -0400 Received: from mail-ee0-f42.google.com ([74.125.83.42]:37394 "EHLO mail-ee0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753218Ab3EVVCK (ORCPT ); Wed, 22 May 2013 17:02:10 -0400 Message-ID: <519D324D.6070903@gmail.com> Date: Wed, 22 May 2013 23:02:05 +0200 From: Sebastian Hesselbarth User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Jason Gunthorpe CC: Andrew Lunn , Jason Cooper , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, David Miller , Lennert Buytenhek Subject: Re: [PATCH 2/2] net: mv643xx_eth: proper initialization for Kirkwood SoCs References: <1369154510-4927-1-git-send-email-sebastian.hesselbarth@gmail.com> <1369253042-15082-1-git-send-email-sebastian.hesselbarth@gmail.com> <1369253042-15082-2-git-send-email-sebastian.hesselbarth@gmail.com> <20130522201607.GA18823@obsidianresearch.com> In-Reply-To: <20130522201607.GA18823@obsidianresearch.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2191 Lines: 48 On 05/22/2013 10:16 PM, Jason Gunthorpe wrote: > On Wed, May 22, 2013 at 10:04:02PM +0200, Sebastian Hesselbarth wrote: >> Ethernet controllers found on Kirkwood SoCs not only suffer from loosing >> MAC address register contents on clock gating but also some important >> registers are reset to values that would break ethernet. This patch > > FWIW, we found that the bootloader has to write to PSC1, the driver > doesn't work with the power on/reset value of the register. So I think > it is safe to assume that all kirkwood bootloaders alter the value. It is safe to assume the bootloader alters it, but that modification is lost when clocks get gated. I assume on clock ungate, the controller is reset. Saying this, I will double check Dove's reset value but looks like reset mess has been fixed in that later SoC. > Our systems write the value 0x00638488 to PSC1. > > I looked at patching mv643xx_eth, but ran into the same complexity you > did, it isn't clear what variants of this IP block have the > register/etc. For Orion SoCs it is quite clear to me, with Gregory Clement and Thomas Petazzoni we could also confirm if it does any harm there if we unconditionally clear it. But for PPC system controllers I have no idea... >> + /* Kirkwood resets some registers on gated clocks. Especially >> + * CLK125_BYPASS_EN must be cleared but is not available on >> + * all other SoCs/System Controllers using this driver. >> + */ >> + if (of_machine_is_compatible("marvell,kirkwood")) >> + wrlp(mp, PORT_SERIAL_CONTROL1, >> + rdlp(mp, PORT_SERIAL_CONTROL1)& ~CLK125_BYPASS_EN); > > of_machine_is_compatible seems heavy handed, I would expect this to be > based on the compatible string of the ethernet node itself, not the > machine?? I have no strong opinion about checking the machine compatible or have an extra compatible string for Kirkwood ethernet. Both would work fine and are checked once upon probe anyway. Sebastian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/