Received: by 10.213.65.68 with SMTP id h4csp95785imn; Mon, 19 Mar 2018 21:03:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELuI8bc4n2KHZQlYBTdyWkMizW8HOAlDMvx7fSh6L2yk8r/TnwfAmXzdwiUxtXQ3Qnk7TQcQ X-Received: by 10.98.190.26 with SMTP id l26mr12318374pff.62.1521518580028; Mon, 19 Mar 2018 21:03:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521518579; cv=none; d=google.com; s=arc-20160816; b=RNA4j8BVFK2ZJQue8U41gKsMG9rbk6KRLwiENNuUVffqyEWSqs+c+I+1JUQJyguSXd 3+ijfq+ZCl5aFNuoc1U/7D0WZsGTkcprBnv1503ocbAMiTeV69nj6kC3QxFk97xizlrm tsu7it0//GVu9ia4HovymRRk/+PWPbKvZxDtKfcwimhchaLcwek9Wm2k24XrDp9Arv2W 6Zj8UyIjiorbJWqYTDNm/0sSB87HXs1lFLHMQtOuT2Bg5itK7y7u0VESkOlsKNxgozHq t0iIutzTDC7ziicokE48TM41Q0lGQjppHWQGOZRVCNni5Wrshh9Yk2+keutUA4yCw9xq W5tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:subject:cc:date :to:from:arc-authentication-results; bh=XmrdA6LKKg9k6cH3yBAjDElPk9vm2ZLOAsafxXUjYuo=; b=rPQanX8lIwdRxEtjZGT5yS2Dc0cIDP7cqDUpdB95XHnEUrKCyFLYV8mpVO2uE8nBdN LCmgHFggBkMRzNT3Eo7CR48z52NOVWVbtBSqJAGcTE/xj+wl3rOd33yTlikdUAUw/NHc gaIQ2DgVlQOgaSanXPYsytgrXE8FK2jXzPkix3r78hvGNipnkyzLZjMVoRKNZQlBNZEy /+mfaMvYlZqnOk77Hg3OtCR88hVK3aC9O4XVhqt0pFIZVHuOIl4yPWNp/PO9UTXFcA2A 18NFR4BU+Nh6AlWvWrTm8yiCC3b4acDtturX+ObZlb9DH1mDtJvI93O+Kxf8A4cu3lQ5 05/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23si590754pgn.186.2018.03.19.21.02.46; Mon, 19 Mar 2018 21:02:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752382AbeCTEBJ (ORCPT + 99 others); Tue, 20 Mar 2018 00:01:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:47687 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752354AbeCTEBF (ORCPT ); Tue, 20 Mar 2018 00:01:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 378D2AF48; Tue, 20 Mar 2018 04:01:04 +0000 (UTC) From: NeilBrown To: John Crispin , Ralf Baechle , James Hogan Date: Tue, 20 Mar 2018 15:00:55 +1100 Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: ralink: fix booting on mt7621 Message-ID: <87efkf9z0o.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Since commit 3af5a67c86a3 ("MIPS: Fix early CM probing") the MT7621 has not been able to boot. This patched caused mips_cm_probe() to be called before mt7621.c::proc_soc_init(). prom_soc_init() has a comment explaining that mips_cm_probe() "wipes out the bootloader config" and means that configuration registers are no longer available. It has some code to re-enable this config. Before this re-enable code is run, the sysc register cannot be read, so when SYSC_REG_CHIP_NAME0 is read, a garbage value is returned and panic() is called. If we move the config-repair code to the top of prom_soc_init(), the registers can be read and boot can proceed. Fixes: 3af5a67c86a3 ("MIPS: Fix early CM probing") Signed-off-by: NeilBrown =2D-- arch/mips/ralink/mt7621.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c index 1b274742077d..5a1b19bebd5b 100644 =2D-- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c @@ -170,6 +170,27 @@ void prom_soc_init(struct ralink_soc_info *soc_info) u32 n1; u32 rev; =20 + /* Early detection of CMP support */ + mips_cm_probe(); + mips_cpc_probe(); + + if (mips_cps_numiocu(0)) { + /* + * mips_cm_probe() wipes out bootloader + * config for CM regions and we have to configure them + * again. This SoC cannot talk to pamlbus devices + * witout proper iocu region set up. + * + * FIXME: it would be better to do this with values + * from DT, but we need this very early because + * without this we cannot talk to pretty much anything + * including serial. + */ + write_gcr_reg0_base(MT7621_PALMBUS_BASE); + write_gcr_reg0_mask(~MT7621_PALMBUS_SIZE | + CM_GCR_REGn_MASK_CMTGT_IOCU0); + } + n0 =3D __raw_readl(sysc + SYSC_REG_CHIP_NAME0); n1 =3D __raw_readl(sysc + SYSC_REG_CHIP_NAME1); =20 @@ -194,26 +215,6 @@ void prom_soc_init(struct ralink_soc_info *soc_info) =20 rt2880_pinmux_data =3D mt7621_pinmux_data; =20 =2D /* Early detection of CMP support */ =2D mips_cm_probe(); =2D mips_cpc_probe(); =2D =2D if (mips_cps_numiocu(0)) { =2D /* =2D * mips_cm_probe() wipes out bootloader =2D * config for CM regions and we have to configure them =2D * again. This SoC cannot talk to pamlbus devices =2D * witout proper iocu region set up. =2D * =2D * FIXME: it would be better to do this with values =2D * from DT, but we need this very early because =2D * without this we cannot talk to pretty much anything =2D * including serial. =2D */ =2D write_gcr_reg0_base(MT7621_PALMBUS_BASE); =2D write_gcr_reg0_mask(~MT7621_PALMBUS_SIZE | =2D CM_GCR_REGn_MASK_CMTGT_IOCU0); =2D } =20 if (!register_cps_smp_ops()) return; =2D-=20 2.14.0.rc0.dirty --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIyBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlqwh3gACgkQOeye3VZi gbmKRg/4tZZnDqQU5XUQfWHRUnBhbjYUrXEibv6EiQr/qsxbKVxamZFMf6aWSZvM YyOQvCFIkpH5ImnP8bk26CUxbn9EapuncuK46Yw4PITVWEZ3Z3RTLsp3rSruGNsz tKdn/Pvx+otRk3Or7dNZEW6uJUrtPHk74Pu6DKAlCIAaWh0WUY2JkQsrovSy0xvW ZhmzHwHL9ztbrc37GaJvIL4ZwN/945pmsebEXywDaOiV7K23qe8NRQQ2RFvX47WC qmMnIQipC7af1p7xXhrFUr0siSigdr3PwuFApfCsZ0bcFWPD1vjaHYnFNdDBLCQI 9LRF7huoadCpKGE7elHHowTN8ZUHnPBiDgnQMY0Uxmxl13X6K2uGaqWyuEsj1Sn9 jneFqmS3NfDEK9P9qLo8WfDVz9WFODbI+aoAm7TipKLVNwBRsmUVRnLr4nZPOGCI iq7AI3OU9qiVdNyxgsfFiu1mlwsA6J9lFA+2PDGk8pS3i7KkUXFEQaK2D0so3yZZ YbwH6PLraI85Ea5lpLbaUtj979iPv4ZMH6/BM9A1jB+DyAp29aY1UV/l4UmYL85i Mda9f59u3lDzUIrTVZjY7gzo4YRgnYthcVpByJU13bwh6joAKsUDyKRKv/nfRlI0 cwUEAQoKsrFm1uWpBi33vuDFKq6FO9/FduoiPdSHegg4N/E55A== =8fUY -----END PGP SIGNATURE----- --=-=-=--