Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4584415pxj; Wed, 12 May 2021 08:41:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvhKNM7rHsRYFlSV3oMfXyX0AN7mIBayuI4/gNgm6shkA9juXtIbw3q84frgM45B1gtmQ/ X-Received: by 2002:a17:906:7fd4:: with SMTP id r20mr7707080ejs.462.1620834083589; Wed, 12 May 2021 08:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834083; cv=none; d=google.com; s=arc-20160816; b=Hz1YUbLILPxNNhQR74mg6O/mglWW8Wp0JZcuPYtcqEEnUFqsgaz0MoUHhTu+FrDd+W BoZ1Y7vpQTe9oNX94aQx98oiiZ4OZl8ui46mWXkDyktlcrLGzJ4wxtg0HpctyUyVAXbe OxRwzKRpm7XxRjocv00YQD0aikZQ3MF9GimzIgTYTWesNeSM8kMNPtx30gOYfTQEgzzu ScdL6pI78qIHfnZgIX/3Igz886uezQtQFz0bfIIMLOXsUjwE0k0qnteyAocs+jisHOs5 JqN5poBHRWGJzdFQz+0GmMzAcLbI3tXcUZqLugGZkTheEwMUSUT7UahydHkdAC6yF9Z3 wvvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dw/1ocCbLEH9860oe9ZU5bX1IwKMl+9j47T44u4KOU8=; b=nHs3Aw8px3D0kXpoZqMVHNXXXVWvcMBBHTYLF5IeDCSjTC7c3ZjXflgsfDdR6KbDgy R1XKSU9BXSAJTc1jTbh+86ss6ANxnU6uqAoix2f9Bk/xA4D3DCtDlaOTu0C2oJRQbfvu Wf8GT8MaCDshJb7D1VG/+JKxw/e+2b9I4bWl5aOebfbowNsk3VHo3eo2WOAcB0ovkoOh sPNMZiORj1EU2J8WSwPlESa8T6LeUWpiUlfzYngtlsQkq/nS2IRGblJVd+X9ayZsROhE 5KpiWLdCRnE6OMewmUvSE7/r5jqMZX+4LKs75URIHaOw+FDDK30cfGYgIn2BWWrOMXZr 4G4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hsr6RGl0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si268536ejz.234.2021.05.12.08.40.59; Wed, 12 May 2021 08:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hsr6RGl0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236089AbhELPhA (ORCPT + 99 others); Wed, 12 May 2021 11:37:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:41568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233239AbhELPME (ORCPT ); Wed, 12 May 2021 11:12:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F18BE61628; Wed, 12 May 2021 15:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620831813; bh=s3BM/sj6oyrnLcGniBopzOVI6NUof9Zb1aULINA8GoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hsr6RGl0jSb5yG+CGC4qzGgh/Y6Hhb+w3CDi6SltCygsUnZxyMpY8EwISVTwaVYTu THn09oZfppmgRmTLco3SpF+w7DSRgVdfjIEweClIn6dSPCnMek8R8xqcwi6vlcqAb1 Z3m3jpvpq2F9e/FibVNgcwIBru3K6g/9YemEWL6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Lipnitskiy , John Crispin , linux-mips@vger.kernel.org, linux-mediatek@lists.infradead.org, Thomas Bogendoerfer Subject: [PATCH 5.10 025/530] MIPS: pci-mt7620: fix PLL lock check Date: Wed, 12 May 2021 16:42:15 +0200 Message-Id: <20210512144820.562269751@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilya Lipnitskiy commit c15b99ae2ba9ea30da3c7cd4765b8a4707e530a6 upstream. Upstream a long-standing OpenWrt patch [0] that fixes MT7620 PCIe PLL lock check. The existing code checks the wrong register bit: PPLL_SW_SET is not defined in PPLL_CFG1 and bit 31 of PPLL_CFG1 is marked as reserved in the MT7620 Programming Guide. The correct bit to check for PLL lock is PPLL_LD (bit 23). Also reword the error message for clarity. Without this change it is unlikely that this driver ever worked with mainline kernel. [0]: https://lists.infradead.org/pipermail/lede-commits/2017-July/004441.html Signed-off-by: Ilya Lipnitskiy Cc: John Crispin Cc: linux-mips@vger.kernel.org Cc: linux-mediatek@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman --- arch/mips/pci/pci-mt7620.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/arch/mips/pci/pci-mt7620.c +++ b/arch/mips/pci/pci-mt7620.c @@ -30,6 +30,7 @@ #define RALINK_GPIOMODE 0x60 #define PPLL_CFG1 0x9c +#define PPLL_LD BIT(23) #define PPLL_DRV 0xa0 #define PDRV_SW_SET BIT(31) @@ -239,8 +240,8 @@ static int mt7620_pci_hw_init(struct pla rt_sysc_m32(0, RALINK_PCIE0_CLK_EN, RALINK_CLKCFG1); mdelay(100); - if (!(rt_sysc_r32(PPLL_CFG1) & PDRV_SW_SET)) { - dev_err(&pdev->dev, "MT7620 PPLL unlock\n"); + if (!(rt_sysc_r32(PPLL_CFG1) & PPLL_LD)) { + dev_err(&pdev->dev, "pcie PLL not locked, aborting init\n"); reset_control_assert(rstpcie0); rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1); return -1;