--- a/spi.c 2025-01-10 18:08:57.753837165 +0800 +++ b/spi.c 2025-01-13 14:17:01.746850459 +0800 @@ -1057,7 +1057,7 @@ static irqreturn_t morse_spi_irq_handler struct morse *mors = spi_get_drvdata(mspi->spi); MORSE_WARN_ON(FEATURE_ID_SPI, !mors); - if (irq == gpio_to_irq(mors->cfg->mm_spi_irq_gpio)) { + /* * If we are using edge interrupts, we need to continuously service the IRQ until * either the chip has cleared all its IRQ bits, or the pin goes high again. @@ -1067,8 +1067,7 @@ static irqreturn_t morse_spi_irq_handler } while (spi_use_edge_irq && ret && !gpio_get_value(mors->cfg->mm_spi_irq_gpio)); return IRQ_HANDLED; - } - return IRQ_NONE; + } static void morse_spi_enable_irq(struct morse_spi *mspi) @@ -1311,10 +1310,15 @@ static int morse_spi_probe(struct spi_de ret = morse_spi_cmd(mspi, SD_IO_MORSE_INIT, 0x00000000); if (!ret) break; - pr_info("%s: SD_IO_RESET\n", __func__); + MORSE_DBG(mors, "%s: SD_IO_RESET\n", __func__); morse_spi_cmd(mspi, SD_IO_RESET, 0x00000000); } + if (ret) { + MORSE_SPI_ERR(mors, "failed initialise SPI: %d\n", ret); + goto err_cfg; + } + ret = morse_chip_cfg_detect_and_init(mors, mors_chip_series); if (ret) { MORSE_SPI_ERR(mors, "morse_chip_cfg_detect_and_init failed: %d\n", ret); @@ -1327,7 +1331,11 @@ static int morse_spi_probe(struct spi_de mors->cfg->mm_ps_gpios_supported = true; ret = morse_spi_reg32_read(mors, MORSE_REG_CHIP_ID(mors), &mors->chip_id); - if (!ret) { + if (ret) { + MORSE_SPI_ERR(mors, "failed to read chip id: %d\n", ret); + goto err_cfg; + } + /* Find out if the chip id matches our records */ if (!morse_hw_is_valid_chip_id(mors->chip_id, mors->cfg->valid_chip_ids)) { MORSE_SPI_ERR(mors, "%s Morse chip (ChipId=0x%x) not supported\n", @@ -1357,9 +1365,6 @@ static int morse_spi_probe(struct spi_de mspi->inter_block_delay_bytes); } } - } else { - goto err_cfg; - } MORSE_SPI_INFO(mors, "Morse Micro SPI device found, chip ID=0x%04x\n", mors->chip_id); MORSE_SPI_INFO(mors, "Board serial: %s\n", mors->board_serial); @@ -1442,6 +1447,11 @@ static int morse_spi_probe(struct spi_de #ifdef CONFIG_MORSE_ENABLE_TEST_MODES if (test_mode == MORSE_CONFIG_TEST_MODE_BUS) ret = morse_bus_test(mors, "SPI"); + + if (test_mode == MORSE_CONFIG_TEST_MODE_BUS_PROFILE) { + morse_bus_throughput_profiler(mors); + morse_spi_disable_irq(mspi); + } #endif return ret;