openwrt/target/linux/starfive/patches-6.6/0051-spi-spl022-Get-and-deassert-reset-in-probe.patch
Zoltan HERPAI e2e2fc3cd0 starfive: add patches for 6.6
Add updated patches for 6.6. DMA/cache-handling patches
have been reworked / backported from upstream.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2024-09-03 00:03:19 +02:00

61 lines
1.7 KiB
Diff

From 2cd3e51cb76d49d8db6274ebdc1ba1eb5c872f10 Mon Sep 17 00:00:00 2001
From: "ziv.xu" <ziv.xu@starfivetech.com>
Date: Sun, 4 Feb 2024 10:35:24 +0800
Subject: [PATCH 051/116] spi: spl022: Get and deassert reset in probe()
This fix spi1~6 communication time out.
Signed-off-by: ziv.xu <ziv.xu@starfivetech.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
---
drivers/spi/spi-pl022.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -33,6 +33,7 @@
#include <linux/pm_runtime.h>
#include <linux/of.h>
#include <linux/pinctrl/consumer.h>
+#include <linux/reset.h>
/*
* This macro is used to define some register default values.
@@ -370,6 +371,7 @@ struct pl022 {
resource_size_t phybase;
void __iomem *virtbase;
struct clk *clk;
+ struct reset_control *rst;
struct spi_controller *host;
struct pl022_ssp_controller *host_info;
/* Message per-transfer pump */
@@ -2181,6 +2183,19 @@ static int pl022_probe(struct amba_devic
goto err_no_clk_en;
}
+ pl022->rst = devm_reset_control_get(&adev->dev, NULL);
+ if (IS_ERR(pl022->rst)) {
+ status = PTR_ERR(pl022->rst);
+ dev_err(&adev->dev, "could not retrieve SSP/SPI bus reset\n");
+ goto err_no_rst;
+ }
+
+ status = reset_control_deassert(pl022->rst);
+ if (status) {
+ dev_err(&adev->dev, "could not deassert SSP/SPI bus reset\n");
+ goto err_no_rst_de;
+ }
+
/* Initialize transfer pump */
tasklet_init(&pl022->pump_transfers, pump_transfers,
(unsigned long)pl022);
@@ -2240,6 +2255,8 @@ static int pl022_probe(struct amba_devic
if (platform_info->enable_dma)
pl022_dma_remove(pl022);
err_no_irq:
+ err_no_rst_de:
+ err_no_rst:
clk_disable_unprepare(pl022->clk);
err_no_clk_en:
err_no_clk: