Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: pci-mt7620: fix PLL lock check

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 <ilya.lipnitskiy@gmail.com>
Cc: John Crispin <john@phrozen.org>
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 <tsbogend@alpha.franken.de>

authored by

Ilya Lipnitskiy and committed by
Thomas Bogendoerfer
c15b99ae cd26db59

+3 -2
+3 -2
arch/mips/pci/pci-mt7620.c
··· 30 30 #define RALINK_GPIOMODE 0x60 31 31 32 32 #define PPLL_CFG1 0x9c 33 + #define PPLL_LD BIT(23) 33 34 34 35 #define PPLL_DRV 0xa0 35 36 #define PDRV_SW_SET BIT(31) ··· 240 239 rt_sysc_m32(0, RALINK_PCIE0_CLK_EN, RALINK_CLKCFG1); 241 240 mdelay(100); 242 241 243 - if (!(rt_sysc_r32(PPLL_CFG1) & PDRV_SW_SET)) { 244 - dev_err(&pdev->dev, "MT7620 PPLL unlock\n"); 242 + if (!(rt_sysc_r32(PPLL_CFG1) & PPLL_LD)) { 243 + dev_err(&pdev->dev, "pcie PLL not locked, aborting init\n"); 245 244 reset_control_assert(rstpcie0); 246 245 rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1); 247 246 return -1;