From c0d35bd6e76ccabfbbbddc41a0d77ecdfbb4ee31 Mon Sep 17 00:00:00 2001 From: "ziv.xu" Date: Sun, 4 Feb 2024 10:35:24 +0800 Subject: [PATCH 04/55] spi: spl022: Get and deassert reset in probe() This fix spi1~6 communication time out. Signed-off-by: ziv.xu Signed-off-by: Hal Feng --- 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 #include #include +#include /* * This macro is used to define some register default values. @@ -363,6 +364,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; struct spi_transfer *cur_transfer; @@ -1930,6 +1932,19 @@ static int pl022_probe(struct amba_devic goto err_no_clk; } + 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; + } + /* Disable SSP */ writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); @@ -1985,6 +2000,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: err_no_clk: err_no_ioremap: amba_release_regions(adev);