Hello, Happy New Year!
The platform I use is TX1 and the SDK is 28.1. I want to make SPI2 work in uboot. My operation is as follows:
- Enable SPI in u-boot\arch\arm\dts\tegra210-p2371-2180.dts.
/{
...
aliases {
i2c0 = "/i2c@0,7000d000";
i2c2 = "/i2c@0,7000c400";
i2c3 = "/i2c@0,7000c500";
i2c5 = "/i2c@0,546c0c00";
sdhci0 = "/sdhci@0,700b0600";
sdhci1 = "/sdhci@0,700b0000";
usb0 = "/usb@0,7d000000";
spi1 = "/spi@0,7000d400";
spi2 = "/spi@0,7000d600";
spi3 = "/spi@0,7000d800";
spi4 = "/spi@0,7000da00";
};
...
spi@0,7000d400 {
status = "okay";
spi-max-frequency = <25000000>;
};
spi@0,7000d600 {
status = "okay";
spi-max-frequency = <25000000>;
};
spi@0,7000d800 {
status = "okay";
spi-max-frequency = <25000000>;
};
spi@0,7000da00 {
status = "okay";
spi-max-frequency = <25000000>;
};
};
- In u-boot\board\nvidia\p2371-2180\pinmux-config-p2371-2180.h, I removed portB and portC from the p2371_2180_gpio_inits array, And configured in the p2371_2180_pingrps array.
static const struct pmux_pingrp_config p2371_2180_pingrps[] = {
/* pingrp, mux, pull, tri, e_input, od, e_io_hv */
...
PINCFG(SPI2_MOSI_PB4, SPI2, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI2_MISO_PB5, SPI2, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI2_SCK_PB6, SPI2, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI2_CS0_PB7, SPI2, UP, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI2_CS1_PDD0, SPI2, UP, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI1_MOSI_PC0, SPI1, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI1_MISO_PC1, SPI1, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI1_SCK_PC2, SPI1, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI1_CS0_PC3, SPI1, UP, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI1_CS1_PC4, SPI1, UP, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI4_SCK_PC5, SPI4, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI4_CS0_PC6, SPI4, UP, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI4_MOSI_PC7, SPI4, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
PINCFG(SPI4_MISO_PD0, SPI4, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
...
};
- I modified u-boot\cmd\spi.c to make the data write to the SPI without interruption.
static int do_spi_xfer(int bus, int cs)
{
...
int flg = 0;
while(1)
{
if (flg++ == 0)
{
ret = spi_xfer(slave, bitlen, dout, din, SPI_XFER_BEGIN);
}
else
{
ret = spi_xfer(slave, bitlen, dout, din, 0);
}
}
...
}
4.Stop booting at uboot,
Input: sspi 1:0.0 8 1, I can measure the SCK signal to SPI1 (0x7000d400);
Input: sspi 4:0.0 8 1, I can measure the SCK signal to SPI4 (0x7000da00);
However, enter: sspi 2:0.0 8 1, I cannot measure the SCK signal to SPI2 (0x7000d600);
Input: sspi 2:1.0 8 1, I can measure the change of the SPI2 (0x7000d600) CS signal.
I checked the documentation and debugged it, and I didn’t find the reason. I need to get SPI2 to work, I need your help.
Thank you very much!