From 2cd3e51cb76d49d8db6274ebdc1ba1eb5c872f10 Mon Sep 17 00:00:00 2001 From: "ziv.xu" 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 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. @@ -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: