Hi @jsjeong
The device tree overlay should be fine for the Raspberry Pi Zero 2W.
I believe the issue you are seeing is definitely caused by the chip not being reset properly before the driver probe function is called. Our evaluation kits deploy a chip-reset script which is called early in the boot sequence.
This has some dependence on an MM_RESET to be added to your gpio-line-names in device tree which may not be a desired change.
Ultimately you need something like this
gpioset -m time -u 50000 gpiochip0 5=0
gpioget $1 > /dev/null
sleep 0.05
installed as an early boot script. For most systems this could go in /etc/init.d/, but will need some additional boilerplate depending on your init system. See other scripts in that location for the appropriate format.
Alternatively, because you are using SPI, you could patch the Morse Micro driver to trigger the reset script on driver probe!
diff --git a/hw.c b/hw.c
index e363818..5944122 100644
--- a/hw.c
+++ b/hw.c
@@ -94,9 +94,10 @@ int morse_hw_reset(int reset_pin)
pr_info("Resetting Morse Chip\n");
gpio_direction_output(reset_pin, 0);
- mdelay(20);
+ mdelay(100);
/* setting gpio as float to avoid forcing 3.3V High */
gpio_direction_input(reset_pin);
+ mdelay(1000);
pr_info("Done\n");
gpio_free(reset_pin);
diff --git a/spi.c b/spi.c
index 085f2be..28b2947 100644
--- a/spi.c
+++ b/spi.c
@@ -1270,6 +1270,15 @@ static int morse_spi_probe(struct spi_device *spi)
return -ENOMEM;
}
+
+ mors->cfg = &mm6108_cfg;
+
+ /* setting gpio pin configs from device tree */
+ morse_of_probe(&spi->dev, mors->cfg, morse_spi_of_match);
+
+ /* try chip reset to get in a known state */
+ morse_spi_reset(mors->cfg->mm_reset_gpio, spi);
+
/* update chip configuration */
mors->bus_ops = &morse_spi_ops;
mors->bus_type = MORSE_HOST_BUS_TYPE_SPI;
--
2.25.1