Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80DC7C433EF for ; Fri, 12 Nov 2021 13:30:57 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D350C61054 for ; Fri, 12 Nov 2021 13:30:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D350C61054 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D3FCB82FAE; Fri, 12 Nov 2021 14:30:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1636723855; bh=clvF7Aj1s6pPTJVyE3OJhFXZT8b5ZTbVSX0n/rMxiN4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Gq5LcrvNkESLHnAWtUu+CbOcySXjr/fMMX9SwZ8TI5KmKTrVQik8PeUWQhLUi/1ug Hy+945PQHI8o4YOjNRNqmVkPpFcqhUpsxT7CN9UKznJU92D2/sljJYfgcLd6ESh/pR Xs+KP+cNQHGgtpOR0TrQsu3NinkJGdy3E621nRt9OE0msxLLo1WcJ0XyRQ1OuuKsaB cnO0q+fI+8RS3X6HfmLKynqZdiDPne/vpKxAB+0yCmIN5/3OVT2alhLr6VFVPCrZwk hpgdct5RCk81ffib+qf5aB7cP7mpYkLdo6tRzMSJd1VoV/TuLo+/6PvNWa57El68HI IBcfgTwYLoa5Q== Received: by phobos.denx.de (Postfix, from userid 109) id 8D69E82FB9; Fri, 12 Nov 2021 14:30:53 +0100 (CET) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [IPv6:2001:67c:2050:1::465:107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 08C4182FAE for ; Fri, 12 Nov 2021 14:30:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4HrKGd6nh4zQjg7; Fri, 12 Nov 2021 14:30:49 +0100 (CET) Message-ID: Date: Fri, 12 Nov 2021 14:30:46 +0100 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-marvell 10/11] arm: mvebu: turris_mox: Fix unstable board topology reading Content-Language: en-US To: =?UTF-8?Q?Marek_Beh=c3=ban?= Cc: u-boot@lists.denx.de, =?UTF-8?Q?Pali_Roh=c3=a1r?= , =?UTF-8?Q?Marek_Beh=c3=ban?= References: <20211103020244.25428-1-kabel@kernel.org> <20211103020244.25428-11-kabel@kernel.org> From: Stefan Roese In-Reply-To: <20211103020244.25428-11-kabel@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 11/3/21 03:02, Marek Behún wrote: > From: Marek Behún > > The pre-relocation board topology reading in board_fix_fdt() is > unstable: sometimes wrong data are read from the SPI bus. > > This is due to wrong order of SPI bus configuration instructions: we > first need to set the pins to SPI mode, and only after that configure > the bus. > > Also add a 1ms delay before enabling chip-select, so that the clock pin > is high for some time before reading the bus. > > Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan > --- > board/CZ.NIC/turris_mox/turris_mox.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c > index 502f6fc010..809ce82d20 100644 > --- a/board/CZ.NIC/turris_mox/turris_mox.c > +++ b/board/CZ.NIC/turris_mox/turris_mox.c > @@ -56,9 +56,11 @@ int board_fix_fdt(void *blob) > * to read SPI by reading/writing SPI registers directly > */ > > - writel(0x10df, ARMADA_37XX_SPI_CFG); > /* put pin from GPIO to SPI mode */ > clrbits_le32(ARMADA_37XX_NB_GPIO_SEL, BIT(12)); > + /* configure cpol, cpha, prescale */ > + writel(0x10df, ARMADA_37XX_SPI_CFG); > + mdelay(1); > /* enable SPI CS1 */ > setbits_le32(ARMADA_37XX_SPI_CTRL, BIT(17)); > > Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de