From patchwork Thu Mar 26 22:42:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "tomcwarren3959 at gmail.com" X-Patchwork-Id: 244358 List-Id: U-Boot discussion From: tomcwarren3959 at gmail.com (tomcwarren3959 at gmail.com) Date: Thu, 26 Mar 2020 15:42:00 -0700 Subject: [PATCH 1/3] qspi: t210: Fix claim_bus's use of the wrong bus/device In-Reply-To: <1585262522-6127-1-git-send-email-tomcwarren3959@gmail.com> References: <1585262522-6127-1-git-send-email-tomcwarren3959@gmail.com> Message-ID: <1585262522-6127-2-git-send-email-tomcwarren3959@gmail.com> From: Tom Warren claim_bus() is passed a udevice *dev, which is the bus device's parent. In this driver, claim_bus assumed it was the bus, which caused the 'priv' info pointer to be wrong, and periph_id was incorrect. This in turn caused the periph clock call to assign the wrong clock (PLLM instead of PLLP0), which caused a kernel warning. I only saw the 'bad' periph_id when enabling DEBUG due to an assert. Not sure how QSPI was working w/this errant clock, but it was moot as QSPI wasn't active unless you probed it, and that wasn't happening until I posted a patch to enable env save to QSPI for Nano (coming soon). Signed-off-by: Tom Warren --- Changes in v2: - None drivers/spi/tegra210_qspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c index d82ecaa..2a77126 100644 --- a/drivers/spi/tegra210_qspi.c +++ b/drivers/spi/tegra210_qspi.c @@ -2,7 +2,8 @@ /* * NVIDIA Tegra210 QSPI controller driver * - * (C) Copyright 2015 NVIDIA Corporation + * (C) Copyright 2015-2019 NVIDIA Corporation + * */ #include @@ -137,8 +138,9 @@ static int tegra210_qspi_probe(struct udevice *bus) return 0; } -static int tegra210_qspi_claim_bus(struct udevice *bus) +static int tegra210_qspi_claim_bus(struct udevice *dev) { + struct udevice *bus = dev->parent; struct tegra210_qspi_priv *priv = dev_get_priv(bus); struct qspi_regs *regs = priv->regs;