[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/22] hw/arm: sabrelite: Connect SPI flash CS line to GPIO3_19
From: |
Peter Maydell |
Subject: |
[PULL 22/22] hw/arm: sabrelite: Connect SPI flash CS line to GPIO3_19 |
Date: |
Thu, 30 Sep 2021 16:12:01 +0100 |
From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
The Linux spi-imx driver does not work on QEMU. The reason is that the
state of m25p80 loops in STATE_READING_DATA state after receiving
RDSR command, the new command is ignored. Before sending a new command,
CS line should be pulled high to make the state of m25p80 back to IDLE.
Currently the SPI flash CS line is connected to the SPI controller, but
on the real board, it's connected to GPIO3_19. This matches the ecspi1
device node in the board dts.
ecspi1 node in imx6qdl-sabrelite.dtsi:
&ecspi1 {
cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
status = "okay";
flash: m25p80@0 {
compatible = "sst,sst25vf016b", "jedec,spi-nor";
spi-max-frequency = <20000000>;
reg = <0>;
};
};
Should connect the SSI_GPIO_CS to GPIO3_19 when adding a spi-nor to
spi1 on sabrelite machine.
Verified this patch on Linux v5.14.
Logs:
# echo "01234567899876543210" > test
# mtd_debug erase /dev/mtd0 0x0 0x1000
Erased 4096 bytes from address 0x00000000 in flash
# mtd_debug write /dev/mtdblock0 0x0 20 test
Copied 20 bytes from test to address 0x00000000 in flash
# mtd_debug read /dev/mtdblock0 0x0 20 test_out
Copied 20 bytes from address 0x00000000 in flash to test_out
# cat test_out
01234567899876543210#
Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20210927142825.491-1-xchengl.cn@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/sabrelite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c
index 29fc777b613..553608e5835 100644
--- a/hw/arm/sabrelite.c
+++ b/hw/arm/sabrelite.c
@@ -87,7 +87,7 @@ static void sabrelite_init(MachineState *machine)
qdev_realize_and_unref(flash_dev, BUS(spi_bus), &error_fatal);
cs_line = qdev_get_gpio_in_named(flash_dev, SSI_GPIO_CS, 0);
- sysbus_connect_irq(SYS_BUS_DEVICE(spi_dev), 1, cs_line);
+ qdev_connect_gpio_out(DEVICE(&s->gpio[2]), 19, cs_line);
}
}
}
--
2.20.1
- [PULL 09/22] hw/arm: xlnx-zcu102: Add Xilinx BBRAM device, (continued)
- [PULL 09/22] hw/arm: xlnx-zcu102: Add Xilinx BBRAM device, Peter Maydell, 2021/09/30
- [PULL 06/22] hw/nvram: Introduce Xilinx battery-backed ram, Peter Maydell, 2021/09/30
- [PULL 07/22] hw/arm: xlnx-versal-virt: Add Xilinx BBRAM device, Peter Maydell, 2021/09/30
- [PULL 08/22] hw/arm: xlnx-versal-virt: Add Xilinx eFUSE device, Peter Maydell, 2021/09/30
- [PULL 11/22] docs/system/arm: xlnx-versal-virt: BBRAM and eFUSE Usage, Peter Maydell, 2021/09/30
- [PULL 13/22] target/arm: Fix coding style issues in gdbstub code in helper.c, Peter Maydell, 2021/09/30
- [PULL 17/22] ipack: Rename ipack_bus_new_inplace() to ipack_bus_init(), Peter Maydell, 2021/09/30
- [PULL 14/22] target/arm: Move gdbstub related code out of helper.c, Peter Maydell, 2021/09/30
- [PULL 18/22] pci: Rename pci_root_bus_new_inplace() to pci_root_bus_init(), Peter Maydell, 2021/09/30
- [PULL 19/22] qbus: Rename qbus_create_inplace() to qbus_init(), Peter Maydell, 2021/09/30
- [PULL 22/22] hw/arm: sabrelite: Connect SPI flash CS line to GPIO3_19,
Peter Maydell <=
- [PULL 21/22] ide: Rename ide_bus_new() to ide_bus_init(), Peter Maydell, 2021/09/30
- [PULL 15/22] target/arm: Don't put FPEXC and FPSID in org.gnu.gdb.arm.vfp XML, Peter Maydell, 2021/09/30
- [PULL 16/22] scsi: Replace scsi_bus_new() with scsi_bus_init(), scsi_bus_init_named(), Peter Maydell, 2021/09/30
- [PULL 20/22] qbus: Rename qbus_create() to qbus_new(), Peter Maydell, 2021/09/30