video: support Rocktech RK050HR345-CT106A panel
Subsystems (3)
cover video: support Rocktech RK050HR345-CT106A panel
This series adds support for the Rocktech RK050HR345-CT106A panel. The initialization of this panel requires a 9-bit word length configuration. To support this, I have extended the STM32 SPI driver (including support for the STM32MP25 SoC) to implement the set_wordlen operation.
To properly validate these changes and ensure the SPI uclass correctly handles the word length propagation, I have also implemented the corresponding logic in the sandbox driver and added a dedicated unit test.
I have grouped these patches together to provide a complete overview of the implementation and its verification.
Dario Binacchi (8):
spi: add support for bits-per-word setting
spi: sandbox_spi: support wordlen setup
test: spi: add sandbox_spi_get_wordlen interface
test: dm: spi: add testcase for spi_set_wordlen()
spi: stm32: clean up buffer length assignment
spi: stm32: add support for bits-per-word setting
spi: stm32: extend support to STM32MP25
video: support Rocktech RK050HR345-CT106A panel
arch/sandbox/include/asm/test.h | 8 + drivers/spi/sandbox_spi.c | 21 ++ drivers/spi/spi-uclass.c | 19 ++ drivers/spi/stm32_spi.c | 67 +++++- drivers/video/Kconfig | 8 + drivers/video/Makefile | 1 + drivers/video/ilitek-ili9806e.c | 354 ++++++++++++++++++++++++++++++++ include/spi.h | 12 ++ test/dm/spi.c | 16 ++ 9 files changed, 499 insertions(+), 7 deletions(-) create mode 100644 drivers/video/ilitek-ili9806e.c
Signature · 4 lines
2.43.0 base-commit: 7dca54ef4c44c82bdc6716ac6cdc84c22c66e9ed branch: RK050HR345-CT106A-ON-SPI
PATCH 1/8 spi: add support for bits-per-word setting
Allow dynamic configuration of the SPI word length. This is required for controllers and slaves that need to operate with non-standard word lengths, such as 9-bit wide transfers.
---
drivers/spi/spi-uclass.c | 19 +++++++++++++++++++ include/spi.h | 12 ++++++++++++ 2 files changed, 31 insertions(+)
drivers/spi/spi-uclass.c +19 -0
@@ -91,6 +91,20 @@ void dm_spi_release_bus(struct udevice *dev) ops->release_bus (dev); } +int dm_spi_set_wordlen (struct udevice *dev,unsigned int wordlen) +{ +struct udevice *bus = dev->parent; +struct dm_spi_ops *ops =spi_get_ops (bus); + +if (bus->uclass->uc_drv->id !=UCLASS_SPI ) +return -EOPNOTSUPP ; + +if (!ops->set_wordlen) +return -ENOSYS ; + +return ops->set_wordlen (dev, wordlen); +} +int dm_spi_xfer (struct udevice *dev,unsigned int bitlen,const void *dout,void *din,unsigned long flags) {
@@ -144,6 +158,11 @@ int spi_set_speed(struct spi_slave *slave, uint hz)return ret; } +int spi_set_wordlen (struct spi_slave *slave,unsigned int wordlen) +{ +return dm_spi_set_wordlen (slave->dev, wordlen); +} +int spi_xfer (struct spi_slave *slave,unsigned int bitlen,const void *dout,void *din,unsigned long flags) {
include/spi.h +12 -0
@@ -729,6 +729,18 @@ int dm_spi_claim_bus(struct udevice *dev);*/ void dm_spi_release_bus (struct udevice *dev); +/** +* Set the word length for SPI transactions +* +* Set the word length (number of bits per word) for SPI transactions. +* +* @slave: The SPI slave +* @wordlen: The number of bits in a word +* +* Returns: 0 on success, -1 on failure. +*/ +int dm_spi_set_wordlen (struct udevice *dev,unsigned int wordlen); +/** * SPI transfer *
Signature · 1 line
2.43.0
PATCH 2/8 spi: sandbox_spi: support wordlen setup
In reply to Dario BinacchiThe driver currently ignores the word length configuration. Implement the set_wordlen operation to store and track the current word length.
---
drivers/spi/sandbox_spi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/spi/sandbox_spi.c +13 -0
@@ -34,10 +34,12 @@* * @speed: Current bus speed. * @mode: Current bus mode. +* @wordlen: Current wordlen. */ struct sandbox_spi_priv {uint speed;uint mode; +uint wordlen; }; __weak int sandbox_spi_get_emul(struct sandbox_state *state,
@@ -61,6 +63,16 @@ uint sandbox_spi_get_mode(struct udevice *dev)return priv->mode; } +static int sandbox_spi_set_wordlen (struct udevice *slave,unsigned int wordlen) +{ +struct udevice *bus = slave->parent; +struct sandbox_spi_priv *priv =dev_get_priv (bus); + + priv->wordlen = wordlen; + +return 0 ; +} +static int sandbox_spi_xfer (struct udevice *slave,unsigned int bitlen,const void *dout,void *din,unsigned long flags) {
@@ -158,6 +170,7 @@ static const struct dm_spi_ops sandbox_spi_ops = { .set_mode = sandbox_spi_set_mode, .cs_info = sandbox_cs_info, .get_mmap = sandbox_spi_get_mmap, + .set_wordlen = sandbox_spi_set_wordlen, };static const struct udevice_id sandbox_spi_ids[] = {
Signature · 1 line
2.43.0
PATCH 3/8 test: spi: add sandbox_spi_get_wordlen interface
In reply to Dario BinacchiAdd the sandbox_spi_get_wordlen() public interface to retrieve the internal word length state of the sandbox SPI device.
This is intended for use in sandbox SPI test cases to verify that the word length is correctly propagated from the SPI uclass to the driver.
---
arch/sandbox/include/asm/test.h | 8 ++++++++ drivers/spi/sandbox_spi.c | 8 ++++++++ 2 files changed, 16 insertions(+)
arch/sandbox/include/asm/test.h +8 -0
@@ -243,6 +243,14 @@ uint sandbox_spi_get_speed(struct udevice *dev);*/ uint sandbox_spi_get_mode (struct udevice *dev); +/** +* sandbox_spi_get_wordlen() - Get current wordlen setting of a sandbox spi slave +* +* @dev: Device to check +* Return: current wordlen +*/ +uint sandbox_spi_get_wordlen (struct udevice *dev); +/** * sandbox_get_pch_spi_protect() - Get the PCI SPI protection status *
drivers/spi/sandbox_spi.c +8 -0
@@ -63,6 +63,14 @@ uint sandbox_spi_get_mode(struct udevice *dev)return priv->mode; } +uint sandbox_spi_get_wordlen (struct udevice *slave) +{ +struct udevice *bus = slave->parent; +struct sandbox_spi_priv *priv =dev_get_priv (bus); + +return priv->wordlen; +} +static int sandbox_spi_set_wordlen (struct udevice *slave,unsigned int wordlen) {struct udevice *bus = slave->parent;
Signature · 1 line
2.43.0
PATCH 4/8 test: dm: spi: add testcase for spi_set_wordlen()
In reply to Dario BinacchiAdd a unit test to verify that the SPI word length configuration is correctly handled by the SPI uclass and successfully passed down to the sandbox driver.
---
test/dm/spi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
test/dm/spi.c +16 -0
@@ -170,6 +170,22 @@ static int dm_test_spi_claim_bus(struct unit_test_state *uts) }DM_TEST (dm_test_spi_claim_bus,UTF_SCAN_PDATA |UTF_SCAN_FDT ); +static int dm_test_spi_set_wordlen (struct unit_test_state *uts) +{ +struct spi_slave *slave; +struct udevice *bus; +const int busnum =0 , cs =0 ; + +ut_assertok (spi_get_bus_and_cs (busnum, cs, &bus, &slave)); +ut_assertok (spi_set_wordlen (slave,8 )); +ut_asserteq (8 ,sandbox_spi_get_wordlen (slave->dev)); +ut_assertok (spi_set_wordlen (slave,9 )); +ut_asserteq (9 ,sandbox_spi_get_wordlen (slave->dev)); + +return 0 ; +} +DM_TEST (dm_test_spi_set_wordlen,UTF_SCAN_PDATA |UTF_SCAN_FDT ); +/* Test that sandbox SPI works correctly */ static int dm_test_spi_xfer (struct unit_test_state *uts) {
Signature · 1 line
2.43.0
PATCH 5/8 spi: stm32: clean up buffer length assignment
In reply to Dario BinacchiRemove redundant divisions by using the already available xferlen variable for setting the rx/tx buffer lengths.
---
drivers/spi/stm32_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/stm32_spi.c +2 -2
@@ -404,8 +404,8 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen, priv->tx_buf = dout; priv->rx_buf = din; - priv->tx_len = priv->tx_buf ? bitlen /8 :0 ; - priv->rx_len = priv->rx_buf ? bitlen /8 :0 ; + priv->tx_len = priv->tx_buf ? xferlen :0 ; + priv->rx_len = priv->rx_buf ? xferlen :0 ; mode =SPI_FULL_DUPLEX ;if (!priv->tx_buf)
Signature · 1 line
2.43.0
PATCH 6/8 spi: stm32: add support for bits-per-word setting
In reply to Dario BinacchiImplement the set_wordlen operation to allow dynamic bus width configuration. This is required for peripherals with non-standard requirements, such as display panels that need 9-bit word transfers during the initialization and setup phase.
---
drivers/spi/stm32_spi.c | 62 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 5 deletions(-)
drivers/spi/stm32_spi.c +57 -5
@@ -192,6 +192,11 @@ static void stm32_spi_read_rxfifo(struct udevice *bus)log_debug ("%d bytes left\n" , priv->rx_len); } +static bool stm32_spi_is_enabled (void __iomem *base) +{ +return !!(readl (base +STM32_SPI_CR1 ) &SPI_CR1_SPE ); +} +static int stm32_spi_enable (void __iomem *base) {log_debug ("\n" );
@@ -381,6 +386,44 @@ static int stm32_spi_set_speed(struct udevice *bus, uint hz)return 0 ; } +static int _stm32_spi_set_wordlen (struct udevice *bus,unsigned int wordlen) +{ +struct stm32_spi_priv *priv =dev_get_priv (bus); +struct stm32_spi_plat *plat =dev_get_plat (bus); +void __iomem *base = plat->base; +bool spi_enabled; + +if ((wordlen -1 ) <SPI_CFG1_DSIZE_MIN || + (wordlen -1 ) >SPI_CFG1_DSIZE ) { +dev_err (bus,"Cannot set wordlen to %u [%d - %d]\n" , + wordlen,SPI_CFG1_DSIZE_MIN +1 , +SPI_CFG1_DSIZE +1 ); +return -EINVAL ; + } + + spi_enabled =stm32_spi_is_enabled (plat->base); +if (spi_enabled) +stm32_spi_disable (plat->base); + +dev_dbg (bus,"bits_per_word=%d\n" , wordlen); + + priv->cur_bpw = wordlen; +clrsetbits_le32 (base +STM32_SPI_CFG1 ,SPI_CFG1_DSIZE , + priv->cur_bpw -1 ); + +if (spi_enabled) +stm32_spi_enable (plat->base); + +return 0 ; +} + +static int stm32_spi_set_wordlen (struct udevice *slave,unsigned int wordlen) +{ +struct udevice *bus =dev_get_parent (slave); + +return _stm32_spi_set_wordlen (bus, wordlen); +} +static int stm32_spi_xfer (struct udevice *slave,unsigned int bitlen,const void *dout,void *din,unsigned long flags) {
@@ -394,11 +437,19 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen,u32 xferlen;u32 mode;int xfer_status =0 ; +int nb_words; xferlen = bitlen /8 ; -if (xferlen <=SPI_CR2_TSIZE ) -writel (xferlen, base +STM32_SPI_CR2 ); +if (priv->cur_bpw <=8 ) + nb_words = xferlen; +else if (priv->cur_bpw <=16 ) + nb_words =DIV_ROUND_UP (xferlen *8 ,16 ); +else + nb_words =DIV_ROUND_UP (xferlen *8 ,32 ); + +if (nb_words <=SPI_CR2_TSIZE ) +writel (nb_words, base +STM32_SPI_CR2 );else return -EMSGSIZE ;
@@ -406,6 +457,8 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen, priv->rx_buf = din; priv->tx_len = priv->tx_buf ? xferlen :0 ; priv->rx_len = priv->rx_buf ? xferlen :0 ; +dev_dbg (bus,"bitlen: %d, xferlen: %d, nb_words: %d\n" , + bitlen, xferlen, nb_words); mode =SPI_FULL_DUPLEX ;if (!priv->tx_buf)
@@ -567,9 +620,7 @@ static int stm32_spi_probe(struct udevice *dev) priv->fifo_size =stm32_spi_get_fifo_size (dev); priv->cur_mode =SPI_FULL_DUPLEX ; priv->cur_xferlen =0 ; - priv->cur_bpw =SPI_DEFAULT_WORDLEN ; -clrsetbits_le32 (base +STM32_SPI_CFG1 ,SPI_CFG1_DSIZE , - priv->cur_bpw -1 ); +_stm32_spi_set_wordlen (dev,SPI_DEFAULT_WORDLEN );for (i =0 ; i <ARRAY_SIZE (plat->cs_gpios); i++) {if (!dm_gpio_is_valid (&plat->cs_gpios[i]))
@@ -630,6 +681,7 @@ static const struct dm_spi_ops stm32_spi_ops = { .release_bus = stm32_spi_release_bus, .set_mode = stm32_spi_set_mode, .set_speed = stm32_spi_set_speed, + .set_wordlen = stm32_spi_set_wordlen, .xfer = stm32_spi_xfer, };
Signature · 1 line
2.43.0
PATCH 7/8 spi: stm32: extend support to STM32MP25
In reply to Dario BinacchiThe SPI IP in this platform is fully compatible with the current driver implementation, requiring only a new compatible string.
---
drivers/spi/stm32_spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/stm32_spi.c +1 -0
@@ -686,6 +686,7 @@ static const struct dm_spi_ops stm32_spi_ops = { };static const struct udevice_id stm32_spi_ids[] = { + { .compatible ="st,stm32mp25-spi" , }, { .compatible ="st,stm32h7-spi" , }, { } };
Signature · 1 line
2.43.0
PATCH 8/8 video: support Rocktech RK050HR345-CT106A panel
In reply to Dario BinacchiAdd support for the Rocktech RK050HR345-CT106A RGB panel. This model uses an Ilitek ILI9806E controller over the SPI bus for initialization and register configuration only.
The driver is designed to be easily extensible to support other panels with different sequences and timings by providing a specific descriptor structure for each model.
---
drivers/video/Kconfig | 8 + drivers/video/Makefile | 1 + drivers/video/ilitek-ili9806e.c | 354 ++++++++++++++++++++++++++++++++ 3 files changed, 363 insertions(+) create mode 100644 drivers/video/ilitek-ili9806e.c
drivers/video/Kconfig +8 -0
@@ -552,6 +552,14 @@ config VIDEO_LCD_HIMAX_HX8394 Say Y here if you want to enable support for Himax HX8394 dsi 4dl panel. +config VIDEO_LCD_ILITEK_ILI9806E + tristate "Ilitek ILI9806E-based panels" + depends on PANEL && BACKLIGHT + help + Say Y here if you want to enable support for panels base on + the Ilitek ILI9806E controller. Currently only the DBI panel + is implemented. + config VIDEO_LCD_MOT tristate "Atrix 4G and Droid X2 540x960 DSI video mode panel" depends on PANEL && BACKLIGHT
drivers/video/Makefile +1 -0
@@ -61,6 +61,7 @@ obj-$(CONFIG_VIDEO_LCD_ENDEAVORU) += endeavoru-panel.o obj-$(CONFIG_VIDEO_LCD_HIMAX_HX8394) += himax-hx8394.o obj-$(CONFIG_VIDEO_LCD_HITACHI_TX10D07VM0BAA) += hitachi-tx10d07vm0baa.o obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o +obj-$(CONFIG_VIDEO_LCD_ILITEK_ILI9806E) += ilitek-ili9806e.o obj-$(CONFIG_VIDEO_LCD_LG_LD070WX3) += lg-ld070wx3.o obj-$(CONFIG_VIDEO_LCD_LG_LH400WV3) += lg-lh400wv3-sd04.o obj-$(CONFIG_VIDEO_LCD_MOT) += mot-panel.o
drivers/video/ilitek-ili9806e.c new file +354 -0
354 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 22 lines · Dario Binacchi
Add support for the Rocktech RK050HR345-CT106A RGB panel. This model uses an Ilitek ILI9806E controller over the SPI bus for initialization and register configuration only.
The driver is designed to be easily extensible to support other panels with different sequences and timings by providing a specific descriptor structure for each model.
Signed-off-by Dario Binacchi <[email protected]>---
drivers/video/Kconfig | 8 + drivers/video/Makefile | 1 + drivers/video/ilitek-ili9806e.c | 354 ++++++++++++++++++++++++++++++++ 3 files changed, 363 insertions(+) create mode 100644 drivers/video/ilitek-ili9806e.cdrivers/video/Kconfig +0
-0
drivers/video/Kconfig config VIDEO_LCD_HIMAX_HX8394 · line 556
Quoted 5 lines
drivers/video/Kconfig +2
-0@@ -552,6 +552,14 @@ config VIDEO_LCD_HIMAX_HX8394 Say Y here if you want to enable support for Himax HX8394 dsi 4dl panel. +config VIDEO_LCD_ILITEK_ILI9806E + tristate "Ilitek ILI9806E-based panels"
"tristate" is wrong for U-Boot, it should be bool.
Signature · 1 line
Tom
чт, 19 лют. 2026 р. о 19:51 Dario Binacchi
<[email protected]> пише:
Quoted 16 lines
This series adds support for the Rocktech RK050HR345-CT106A panel. The initialization of this panel requires a 9-bit word length configuration. To support this, I have extended the STM32 SPI driver (including support for the STM32MP25 SoC) to implement the
set_wordlenoperation.To properly validate these changes and ensure the SPI uclass correctly handles the word length propagation, I have also implemented the corresponding logic in the sandbox driver and added a dedicated unit test.
I have grouped these patches together to provide a complete overview of the implementation and its verification.
Quoted 5 lines
Dario Binacchi (8):
spi: add support for bits-per-word setting
spi:sandbox_spi: support wordlen setup
test: spi: addsandbox_spi_get_wordleninterface
test: dm: spi: add testcase forspi_set_wordlen()
Hello Dario!
You should not need to modify spi framework to support 9 bit len xfer. dm_spi_xfer supports this already, you need only stm32 support for non-aligned xfers.
You can refer to ssd2825 bridge as an example of 9-bit spi communication for write and 16 bit reads.
Quoted 22 lines
spi: stm32: clean up buffer length assignment
spi: stm32: add support for bits-per-word setting
spi: stm32: extend support to STM32MP25
video: support Rocktech RK050HR345-CT106A panelarch/sandbox/include/asm/test.h | 8 + drivers/spi/sandbox_spi.c | 21 ++ drivers/spi/spi-uclass.c | 19 ++ drivers/spi/stm32_spi.c | 67 +++++- drivers/video/Kconfig | 8 + drivers/video/Makefile | 1 + drivers/video/ilitek-ili9806e.c | 354 ++++++++++++++++++++++++++++++++ include/spi.h | 12 ++ test/dm/spi.c | 16 ++ 9 files changed, 499 insertions(+), 7 deletions(-) create mode 100644 drivers/video/ilitek-ili9806e.c--
2.43.0base-commit:
7dca54ef4c44c82bdc6716ac6cdc84c22c66e9ed
branch: RK050HR345-CT106A-ON-SPI
Hello Svyatoslav,
Quoted 25 lines · Svyatoslav Ryhel
чт, 19 лют. 2026 р. о 19:51 Dario Binacchi
<[email protected]> пише:Quoted 16 lines
This series adds support for the Rocktech RK050HR345-CT106A panel. The initialization of this panel requires a 9-bit word length configuration. To support this, I have extended the STM32 SPI driver (including support for the STM32MP25 SoC) to implement the
set_wordlenoperation.To properly validate these changes and ensure the SPI uclass correctly handles the word length propagation, I have also implemented the corresponding logic in the sandbox driver and added a dedicated unit test.
I have grouped these patches together to provide a complete overview of the implementation and its verification.
Quoted 5 lines
Dario Binacchi (8):
spi: add support for bits-per-word setting
spi:sandbox_spi: support wordlen setup
test: spi: addsandbox_spi_get_wordleninterface
test: dm: spi: add testcase forspi_set_wordlen()
Quoted 5 lines
Hello Dario!
You should not need to modify spi framework to support 9 bit len xfer.
dm_spi_xfersupports this already, you need only stm32 support for non-aligned xfers.
Thank you for the feedback.
I initially explored the approach you suggested. However, following the STM32 driver
implementation in the Linux kernel, I found that explicitly managing the bits-per-word
parameter was necessary.
In the current STM32MP2 driver, the word length is effectively hardcoded to 8 bits. To
address this, I needed to implement the set_wordlen ops, which is already declared
among the available SPI framework ops but had not yet been implemented or used.
The proof of this approach is that the driver now correctly handles multi-word 16-bit
transfers of any buffer size, using 9-bit words as required. This is a significant improvement
over the common implementations that often only support single 16-bit data transfers.
I believe this provides the necessary flexibility that dm_spi_xfer alone couldn't achieve
without a way to redefine the word boundaries.
Thanks and regards,
Dario
Quoted 26 lines
You can refer to ssd2825 bridge as an example of 9-bit spi communication for write and 16 bit reads.
Quoted 22 lines
spi: stm32: clean up buffer length assignment
spi: stm32: add support for bits-per-word setting
spi: stm32: extend support to STM32MP25
video: support Rocktech RK050HR345-CT106A panelarch/sandbox/include/asm/test.h | 8 + drivers/spi/sandbox_spi.c | 21 ++ drivers/spi/spi-uclass.c | 19 ++ drivers/spi/stm32_spi.c | 67 +++++- drivers/video/Kconfig | 8 + drivers/video/Makefile | 1 + drivers/video/ilitek-ili9806e.c | 354 ++++++++++++++++++++++++++++++++ include/spi.h | 12 ++ test/dm/spi.c | 16 ++ 9 files changed, 499 insertions(+), 7 deletions(-) create mode 100644 drivers/video/ilitek-ili9806e.c--
2.43.0base-commit:
7dca54ef4c44c82bdc6716ac6cdc84c22c66e9ed
branch: RK050HR345-CT106A-ON-SPI
Signature · 17 lines
Dario Binacchi Senior Embedded Linux Developer [email protected] __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 [email protected] www.amarulasolutions.com