Skip to contentSkip to conversation

spi: spi-axi-spi-engine: Access register after clock initialization

PATCH Ardelean, Alexandru 1 participant 1 message Apr 9, 2020 1 message not in the archive SPI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · Rafał Hibner

[External]

Move register access after clock initialization.

Clock "s_axi_aclk" is needed for register access. Without the clock running

AXI bus hangs and causes kernel freeze.

This email looks like it has HTML formatting.

Can you switch to [and use only] plain-text?

Out of curiosity: did you use the 'git send-email' command for this patch?

Quoted 115 lines
Cc Alexandru Ardelean <[email protected]>

---

 drivers/spi/spi-axi-spi-engine.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/spi/spi-axi-spi- renamed from drivers/spi/spi-axi-spi-engine.c +0 -0

engine.c

index eb9b78a90d..af86e6d6e1 100644

--- a/drivers/spi/spi-axi-spi-engine.c

+++ b/drivers/spi/spi-axi-spi-engine.c

drivers/spi/spi-axi-spi- renamed from drivers/spi/spi-axi-spi-engine.c +16 -17
@@ -489,22 +489,6 @@ static int spi_engine_probe(struct platform_device *pdev)
 
 
 
  spin_lock_init(&spi_engine->lock);
 
 
 
- spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
 
- if (IS_ERR(spi_engine->base)) {
 
- ret = PTR_ERR(spi_engine->base);
 
- goto err_put_master;
 
- }
 
-
 
- version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
 
- if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
 
- dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
 
- SPI_ENGINE_VERSION_MAJOR(version),
 
- SPI_ENGINE_VERSION_MINOR(version),
 
- SPI_ENGINE_VERSION_PATCH(version));
 
- ret = -ENODEV;
 
- goto err_put_master;
 
- }
 
-
 
  spi_engine->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
 
  if (IS_ERR(spi_engine->clk)) {
 
  ret = PTR_ERR(spi_engine->clk);
@@ -525,6 +509,22 @@ static int spi_engine_probe(struct platform_device *pdev)
 
  if (ret)
 
  goto err_clk_disable;
 
 
 
+ spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
 
+ if (IS_ERR(spi_engine->base)) {
 
+ ret = PTR_ERR(spi_engine->base);
 
+ goto err_ref_clk_disable;
 
+ }
 
+
 
+ version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
 
+ if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
 
+ dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
 
+ SPI_ENGINE_VERSION_MAJOR(version),
 
+ SPI_ENGINE_VERSION_MINOR(version),
 
+ SPI_ENGINE_VERSION_PATCH(version));
 
+ ret = -ENODEV;
 
+ goto err_ref_clk_disable;
 
+ }
 
+
 
  writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_RESET);
 
  writel_relaxed(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
 
  writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE);
 
--

2.24.1