#include #include #include #include #include #if CONFIG_IS_ENABLED(AMLOGIC_MODIFY) #include #endif int st7789v3_spi_init(void) { #if CONFIG_IS_ENABLED(DM_SPI) int ret = 0; char name[30], *str; // struct udevice *dev; // unsigned int spi_mode = 0; // unsigned int spi_freq = 20000000; //10Mhz struct spi_slave *slave; unsigned int bus = 1; unsigned int cs = 0; struct udevice *bus1; printf("st7789v3_spi_init\n"); snprintf(name, sizeof(name), "st7789v3_spi_%d:%d", bus, cs); str = strdup(name); if (!str) return -1; // ret = _spi_get_bus_and_cs(bus, cs, spi_freq, spi_mode, "st7789v3", // str, &dev, &slave); ret = spi_get_bus_and_cs(bus, cs, &bus1, &slave); if (ret) return ret; return ret; #endif } int do_st7789v3_test(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { st7789v3_spi_init(); return 0; } U_BOOT_CMD( st7789v3_test, 5, 1, do_st7789v3_test, "st7789v3_test spi lcd test command", "[:][.][@] - Send and receive bits\n" " - Identifies the SPI bus\n" " - Identifies the chip select\n" " - Identifies the SPI mode to use\n" " - Identifies the SPI bus frequency in Hz\n" " - Number of bits to send (base 10)\n" " - Hexadecimal string that gets sent" );