Enable ili9341 and l3gd20 on stm32f429-disco
Subsystems (8)
v4 cover Enable ili9341 and l3gd20 on stm32f429-disco
From: dillon min <[email protected]>
According to alexandre torgue's suggestion, combine ili9341 and l3gd20's modification on stm32f429-disco board to one patchset.
Changes:
ili9341:
V4:
1 update ili9341 panel driver according to Linus's suggestion 2 drop V1's No.5 patch, sumbit new changes for clk-stm32f4 3 merge l3gd20's change to this patchset
V3:
1 merge original tiny/ili9341.c driver to panel/panel-ilitek-ili9341.c
to support serial spi & parallel rgb interface in one driver.
2 update ilitek,ili9341.yaml dts binding documentation.
3 update stm32f429-disco dts binding
V2:
1 verify ilitek,ili9341.yaml with make O=../linux-stm32
dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/panel/ ilitek,ili9341.yaml
V1:
1 add ili9341 drm panel driver
2 add ltdc, spi5 controller for stm32f429-disco 3 add ltdc, spi5 pin map for stm32f429-disco 4 add docs about ili9341
5 fix ltdc driver loading hang in clk set rate bug
L3gd20:
V3:
1, merge stm32f429-disco dtbs binding with ili9341 part
V2:
1, insert blank line at stm32f420-disco.dts line 143 2, add more description for l3gd20 in commit message
V1:
1, enable spi5 controller on stm32f429-disco (dts) 2, add spi5 pinmap for stm32f429-disco (dts) 3, add SPI_SIMPLEX_RX, SPI_3WIRE_RX support for stm32f4
dillon min (8):
ARM: dts: stm32: Add dma config for spi5
ARM: dts: stm32: enable l3gd20 on stm32429-disco board
spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
ARM: dts: stm32: Add pin map for ltdc on stm32f429-disco board
dt-bindings: display: panel: Add ilitek ili9341 panel bindings
ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco
board
clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate. drm/panel: Add ilitek ili9341 panel driver
.../bindings/display/panel/ilitek,ili9341.yaml | 69 ++ arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 67 + arch/arm/boot/dts/stm32f429-disco.dts | 48 + arch/arm/boot/dts/stm32f429.dtsi | 3 + drivers/clk/clk-stm32f4.c | 7 +- drivers/gpu/drm/panel/Kconfig | 12 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 1301 ++++++++++++++++++++ drivers/spi/spi-stm32.c | 30 +- 9 files changed, 1530 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
Signature · 1 line
2.7.4
PATCH v4 1/8 ARM: dts: stm32: Add dma config for spi5
From: dillon min <[email protected]>
Enable spi5's dma configuration. for graphics data output to ilitek ili9341 panel via mipi dbi interface
--- arch/arm/boot/dts/stm32f429.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/stm32f429.dtsi +3 -0
@@ -660,6 +660,9 @@ reg = <0x40015000 0x400>; interrupts = <85>; clocks = <&rcc 0 STM32F4_APB2_CLOCK(SPI5)>; + dmas = <&dma2 3 2 0x400 0x0>, + <&dma2 4 2 0x400 0x0>; + dma-names = "rx", "tx"; status = "disabled"; };
Signature · 1 line
2.7.4
PATCH v4 2/8 ARM: dts: stm32: enable l3gd20 on stm32429-disco board
In reply to [email protected]From: dillon min <[email protected]>
L3gd20, st mems motion sensor, 3-axis digital output gyroscope, connect to stm32f429 via spi5
--- arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm/boot/dts/stm32f4-pinctrl.dtsi +17 -0
@@ -316,6 +316,23 @@ }; }; + spi5_pins: spi5-0 { + pins1 { + pinmux = <STM32_PINMUX('F', 7, AF5)>, + /* SPI5_CLK */ + <STM32_PINMUX('F', 9, AF5)>; + /* SPI5_MOSI */ + bias-disable; + drive-push-pull; + slew-rate = <0>; + }; + pins2 { + pinmux = <STM32_PINMUX('F', 8, AF5)>; + /* SPI5_MISO */ + bias-disable; + }; + }; + dcmi_pins: dcmi-0 { pins { pinmux = <STM32_PINMUX('A', 4, AF13)>, /* DCMI_HSYNC */
Signature · 1 line
2.7.4
PATCH v4 3/8 spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
In reply to [email protected]From: dillon min <[email protected]>
in l3gd20 driver startup, there is a setup failed error return from stm32 spi driver
"
[ 2.687630] st-gyro-spi spi0.0: supply vdd not found, using dummy
regulator
[ 2.696869] st-gyro-spi spi0.0: supply vddio not found, using dummy
regulator
[ 2.706707] spi_stm32 40015000.spi: SPI transfer setup failed
[ 2.713741] st-gyro-spi spi0.0: SPI transfer failed: -22
[ 2.721096] spi_master spi0: failed to transfer one message from queue
[ 2.729268] iio iio:device0: failed to read Who-Am-I register.
[ 2.737504] st-gyro-spi: probe of spi0.0 failed with error -22
"after debug into spi-stm32 driver, st-gyro-spi split two steps to read l3gd20 id
first: send command to l3gd20 with read id command in tx_buf, rx_buf is null.
second: read id with tx_buf is null, rx_buf not null.
so, for second step, stm32 driver recongise this process is 'SPI_SIMPLE_RX' from stm32_spi_communication_type(), but there is no related process for this type in stm32f4_spi_set_mode(), then we get error from stm32_spi_transfer_one_setup().
we can use two method to fix this bug.
1, use stm32 spi's "In unidirectional receive-only mode (BIDIMODE=0 and RXONLY=1)". but as our code running in sdram, the read latency is too large to get so many receive overrun error in interrupts handler.
2, use stm32 spi's "In full-duplex (BIDIMODE=0 and RXONLY=0)", as tx_buf is null, we must add dummy data sent out before read data.
so, add stm32f4_spi_tx_dummy() to handle this situation.
--- drivers/spi/spi-stm32.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
drivers/spi/spi-stm32.c +26 -4
@@ -388,6 +388,14 @@ static int stm32h7_spi_get_fifo_size(struct stm32_spi *spi)return count; } +static void stm32f4_spi_tx_dummy (struct stm32_spi *spi) +{ +if (spi->cur_bpw ==16 ) +writew_relaxed (0x5555 , spi->base +STM32F4_SPI_DR ); +else +writeb_relaxed (0x55 , spi->base +STM32F4_SPI_DR ); +} +/** * stm32f4_spi_get_bpw_mask - Return bits per word mask * @spi: pointer to the spi controller data structure
@@ -811,7 +819,9 @@ static irqreturn_t stm32f4_spi_irq_event(int irq, void *dev_id) mask |=STM32F4_SPI_SR_TXE ; } -if (!spi->cur_usedma && spi->cur_comm ==SPI_FULL_DUPLEX ) { +if (!spi->cur_usedma && (spi->cur_comm ==SPI_FULL_DUPLEX || + spi->cur_comm ==SPI_SIMPLEX_RX || + spi->cur_comm ==SPI_3WIRE_RX )) {/* TXE flag is set and is handled when RXNE flag occurs */ sr &= ~STM32F4_SPI_SR_TXE ; mask |=STM32F4_SPI_SR_RXNE |STM32F4_SPI_SR_OVR ;
@@ -850,8 +860,10 @@ static irqreturn_t stm32f4_spi_irq_event(int irq, void *dev_id)stm32f4_spi_read_rx (spi);if (spi->rx_len ==0 ) end = true; -else /* Load data for discontinuous mode */ +else if (spi->tx_buf)/* Load data for discontinuous mode */ stm32f4_spi_write_tx (spi); +else if (spi->cur_comm ==SPI_SIMPLEX_RX ) +stm32f4_spi_tx_dummy (spi); } end_irq:
@@ -1151,7 +1163,9 @@ static int stm32f4_spi_transfer_one_irq(struct stm32_spi *spi)/* Enable the interrupts relative to the current communication mode */ if (spi->cur_comm ==SPI_SIMPLEX_TX || spi->cur_comm ==SPI_3WIRE_TX ) { cr2 |=STM32F4_SPI_CR2_TXEIE ; - }else if (spi->cur_comm ==SPI_FULL_DUPLEX ) { + }else if (spi->cur_comm ==SPI_FULL_DUPLEX || + spi->cur_comm ==SPI_SIMPLEX_RX || + spi->cur_comm ==SPI_3WIRE_RX ) {/* In transmit-only mode, the OVR flag is set in the SR register * since the received data are never read. Therefore set OVR * interrupt only when rx buffer is available.
@@ -1170,6 +1184,8 @@ static int stm32f4_spi_transfer_one_irq(struct stm32_spi *spi)/* starting data transfer when buffer is loaded */ if (spi->tx_buf)stm32f4_spi_write_tx (spi); +else if (spi->cur_comm ==SPI_SIMPLEX_RX ) +stm32f4_spi_tx_dummy (spi);spin_unlock_irqrestore (&spi->lock, flags);
@@ -1462,10 +1478,16 @@ static int stm32f4_spi_set_mode(struct stm32_spi *spi, unsigned int comm_type)stm32_spi_set_bits (spi,STM32F4_SPI_CR1 ,STM32F4_SPI_CR1_BIDIMODE |STM32F4_SPI_CR1_BIDIOE ); - }else if (comm_type ==SPI_FULL_DUPLEX ) { + }else if (comm_type ==SPI_FULL_DUPLEX || + comm_type ==SPI_SIMPLEX_RX ) {stm32_spi_clr_bits (spi,STM32F4_SPI_CR1 ,STM32F4_SPI_CR1_BIDIMODE |STM32F4_SPI_CR1_BIDIOE ); + }else if (comm_type ==SPI_3WIRE_RX ) { +stm32_spi_set_bits (spi,STM32F4_SPI_CR1 , +STM32F4_SPI_CR1_BIDIMODE ); +stm32_spi_clr_bits (spi,STM32F4_SPI_CR1 , +STM32F4_SPI_CR1_BIDIOE ); }else {return -EINVAL ; }
Signature · 1 line
2.7.4
PATCH v4 4/8 ARM: dts: stm32: Add pin map for ltdc on stm32f429-disco board
In reply to [email protected]From: dillon min <[email protected]>
This patch adds the pin configuration for ltdc controller on stm32f429-disco board.
--- arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
arch/arm/boot/dts/stm32f4-pinctrl.dtsi +50 -0
@@ -316,6 +316,56 @@ }; }; + ltdc_pins_f429_disco: ltdc-1 { + pins { + pinmux = <STM32_PINMUX('C', 6, AF14)>, + /* LCD_HSYNC */ + <STM32_PINMUX('A', 4, AF14)>, + /* LCD_VSYNC */ + <STM32_PINMUX('G', 7, AF14)>, + /* LCD_CLK */ + <STM32_PINMUX('C', 10, AF14)>, + /* LCD_R2 */ + <STM32_PINMUX('B', 0, AF9)>, + /* LCD_R3 */ + <STM32_PINMUX('A', 11, AF14)>, + /* LCD_R4 */ + <STM32_PINMUX('A', 12, AF14)>, + /* LCD_R5 */ + <STM32_PINMUX('B', 1, AF9)>, + /* LCD_R6*/ + <STM32_PINMUX('G', 6, AF14)>, + /* LCD_R7 */ + <STM32_PINMUX('A', 6, AF14)>, + /* LCD_G2 */ + <STM32_PINMUX('G', 10, AF9)>, + /* LCD_G3 */ + <STM32_PINMUX('B', 10, AF14)>, + /* LCD_G4 */ + <STM32_PINMUX('D', 6, AF14)>, + /* LCD_B2 */ + <STM32_PINMUX('G', 11, AF14)>, + /* LCD_B3*/ + <STM32_PINMUX('B', 11, AF14)>, + /* LCD_G5 */ + <STM32_PINMUX('C', 7, AF14)>, + /* LCD_G6 */ + <STM32_PINMUX('D', 3, AF14)>, + /* LCD_G7 */ + <STM32_PINMUX('G', 12, AF9)>, + /* LCD_B4 */ + <STM32_PINMUX('A', 3, AF14)>, + /* LCD_B5 */ + <STM32_PINMUX('B', 8, AF14)>, + /* LCD_B6 */ + <STM32_PINMUX('B', 9, AF14)>, + /* LCD_B7 */ + <STM32_PINMUX('F', 10, AF14)>; + /* LCD_DE */ + slew-rate = <2>; + }; + }; + spi5_pins: spi5-0 { pins1 { pinmux = <STM32_PINMUX('F', 7, AF5)>,
Signature · 1 line
2.7.4
PATCH v4 5/8 dt-bindings: display: panel: Add ilitek ili9341 panel bindings
In reply to [email protected]From: dillon min <[email protected]>
Add documentation for "ilitek,ili9341" panel.
--- .../bindings/display/panel/ilitek,ili9341.yaml | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml new file +69 -0
@@ -0,0 +1,69 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/ilitek,ili9341.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ilitek-9341 Display Panel + +maintainers: + - Dillon Min <[email protected]> + +description: | + Ilitek ILI9341 TFT panel driver with SPI control bus + This is a driver for 320x240 TFT panels, accepting a rgb input + streams with 16 bits or 18 bits. + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + items: + - enum: + # ili9341 240*320 Color on stm32f429-disco board + - st,sf-tc240t-9370-t + - const: ilitek,ili9341 + + reg: true + + dc-gpios: + maxItems: 1 + description: Display data/command selection (D/CX) + + spi-3wire: true + + spi-max-frequency: + const: 10000000 + + port: true + +additionalProperties: false + +required: + - compatible + - reg + - dc-gpios + - port + +examples: + - |+ + spi { + #address-cells = <1>; + #size-cells = <0>; + panel: display@0 { + compatible = "st,sf-tc240t-9370-t", + "ilitek,ili9341"; + reg = <0>; + spi-3wire; + spi-max-frequency = <10000000>; + dc-gpios = <&gpiod 13 0>; + port { + panel_in: endpoint { + remote-endpoint = <&display_out>; + }; + }; + }; + }; +... +
Signature · 1 line
2.7.4
PATCH v4 6/8 ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco board
In reply to [email protected]From: dillon min <[email protected]>
Enable the ltdc & ili9341 on stm32429-disco board.
--- arch/arm/boot/dts/stm32f429-disco.dts | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
arch/arm/boot/dts/stm32f429-disco.dts +48 -0
@@ -49,6 +49,8 @@ #include "stm32f429.dtsi" #include "stm32f429-pinctrl.dtsi" #include <dt-bindings/input/input.h> +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/gpio/gpio.h> / { model = "STMicroelectronics STM32F429i-DISCO board";
@@ -127,3 +129,49 @@ pinctrl-names = "default"; status = "okay"; }; + +<dc { + status = "okay"; + pinctrl-0 = <<dc_pins_f429_disco>; + pinctrl-names = "default"; + + port { + ltdc_out_rgb: endpoint { + remote-endpoint = <&panel_in_rgb>; + }; + }; +}; + +&spi5 { + status = "okay"; + pinctrl-0 = <&spi5_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + cs-gpios = <&gpioc 1 GPIO_ACTIVE_LOW>, <&gpioc 2 GPIO_ACTIVE_LOW>; + + l3gd20: l3gd20@0 { + compatible = "st,l3gd20-gyro"; + spi-max-frequency = <10000000>; + st,drdy-int-pin = <2>; + interrupt-parent = <&gpioa>; + interrupts = <1 IRQ_TYPE_EDGE_RISING>, + <2 IRQ_TYPE_EDGE_RISING>; + reg = <0>; + status = "okay"; + }; + + display: display@1{ + /* Connect panel-ilitek-9341 to ltdc */ + compatible = "st,sf-tc240t-9370-t"; + reg = <1>; + spi-3wire; + spi-max-frequency = <10000000>; + dc-gpios = <&gpiod 13 0>; + port { + panel_in_rgb: endpoint { + remote-endpoint = <<dc_out_rgb>; + }; + }; + }; +};
Signature · 1 line
2.7.4
PATCH v4 7/8 clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate.
In reply to [email protected]From: dillon min <[email protected]>
fix duplicated ltdc clock register to 'clk_core' case ltdc's clock turn off by clk_disable_unused()
ltdc set clock rate crashed:
'post_div_data[]''s pll_num is PLL_I2S, PLL_SAI (number is 1,2). but,
as pll_num is offset of 'clks[]' input to clk_register_pll_div(), which is FCLK, CLK_LSI, defined in 'include/dt-bindings/clock/stm32fx-clock.h' so, this is a null object at the register time.
then, in ltdc's clock is_enabled(), enable(), will call to_clk_gate(). will return a null object, cause kernel crashed.
need change pll_num to PLL_VCO_I2S, PLL_VCO_SAI for 'post_div_data[]'
duplicated ltdc clock
'stm32f429_gates[]' has a member 'ltdc' register to 'clk_core', but no
upper driver use it, ltdc driver use the lcd-tft defined in
'stm32f429_aux_clk[]'. after system startup, as stm32f429_gates[]'s ltdc enable_count is zero, so turn off by clk_disable_unused()
---
Hi Stephen Boyd:
thanks for reviewing, this patch fix the wrong use of clk ignore unused.
thanks.
Changes since V3:
1 drop last wrong changes about 'CLK_IGNORE_UNUSED' patch 2 fix PLL_SAI mismatch with PLL_VCO_SAI
drivers/clk/clk-stm32f4.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/clk/clk-stm32f4.c +3 -4
@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -557,13 +556,13 @@ static const struct clk_div_table post_divr_table[] = {#define MAX_POST_DIV 3static const struct stm32f4_pll_post_div_data post_div_data[MAX_POST_DIV ] = { - {CLK_I2SQ_PDIV ,PLL_I2S ,"plli2s-q-div" ,"plli2s-q" , + {CLK_I2SQ_PDIV ,PLL_VCO_I2S ,"plli2s-q-div" ,"plli2s-q" ,CLK_SET_RATE_PARENT ,STM32F4_RCC_DCKCFGR ,0 ,5 ,0 ,NULL }, - {CLK_SAIQ_PDIV ,PLL_SAI ,"pllsai-q-div" ,"pllsai-q" , + {CLK_SAIQ_PDIV ,PLL_VCO_SAI ,"pllsai-q-div" ,"pllsai-q" ,CLK_SET_RATE_PARENT ,STM32F4_RCC_DCKCFGR ,8 ,5 ,0 ,NULL }, - {NO_IDX ,PLL_SAI ,"pllsai-r-div" ,"pllsai-r" ,CLK_SET_RATE_PARENT , + {NO_IDX ,PLL_VCO_SAI ,"pllsai-r-div" ,"pllsai-r" ,CLK_SET_RATE_PARENT ,STM32F4_RCC_DCKCFGR ,16 ,2 ,0 , post_divr_table }, };
Signature · 1 line
2.7.4
PATCH v4 8/8 drm/panel: Add ilitek ili9341 panel driver
In reply to [email protected]From: dillon min <[email protected]>
This driver combine tiny/ili9341.c mipi_dbi_interface driver with mipi_dpi_interface driver, can support ili9341 with serial mode or parallel rgb interface mode by register configuration.
---
Changes since V3:
accoding to Linus Walleij's suggestion.
1 add more comments to driver.
2 reduce magic number usage in the driver.
3 move panel configuration from common place to system configuration. 4 reuse MIPI_DCS_* as more as possible.
--- drivers/gpu/drm/panel/Kconfig | 12 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 1301 ++++++++++++++++++++++++++ 3 files changed, 1314 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
drivers/gpu/drm/panel/Kconfig +12 -0
@@ -95,6 +95,18 @@ config DRM_PANEL_ILITEK_IL9322 Say Y here if you want to enable support for Ilitek IL9322 QVGA (320x240) RGB, YUV and ITU-T BT.656 panels. +config DRM_PANEL_ILITEK_ILI9341 + tristate "Ilitek ILI9341 240x320 QVGA panels" + depends on OF && SPI + depends on DRM_KMS_HELPER + depends on DRM_KMS_CMA_HELPER + depends on BACKLIGHT_CLASS_DEVICE + select DRM_MIPI_DBI + help + Say Y here if you want to enable support for Ilitek IL9341 + QVGA (240x320) RGB panels. support serial & parallel rgb + interface. + config DRM_PANEL_ILITEK_ILI9881C tristate "Ilitek ILI9881C-based panels" depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o +obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
drivers/gpu/drm/panel/panel-ilitek-ili9341.c new file +1301 -0
1,301 lines not on this page · raw message
Signature · 1 line
2.7.4
Mark Brown
maintainerRe: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
In reply to [email protected]Quoted 3 lines · On Mon, May 18, 2020 at 07:09:20PM +0800, [email protected] wrote:
2, use stm32 spi's "In full-duplex (BIDIMODE=0 and RXONLY=0)", as
tx_bufis null, we must add dummy data sent out before read data.
so, addstm32f4_spi_tx_dummy()to handle this situation.
There are flags SPI_CONTROLLER_MUST_TX and SPI_CONTROLLER_MUST_RX flags that the driver can set if it needs to, no need to open code this in the driver.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
hi Mark,
Thanks for reviewing.
Quoted 10 lines · Mark Brown
Quoted 3 lines · On Mon, May 18, 2020 at 07:09:20PM +0800, [email protected] wrote:
2, use stm32 spi's "In full-duplex (BIDIMODE=0 and RXONLY=0)", as
tx_bufis null, we must add dummy data sent out before read data.
so, addstm32f4_spi_tx_dummy()to handle this situation.There are flags
SPI_CONTROLLER_MUST_TXandSPI_CONTROLLER_MUST_RXflags that the driver can set if it needs to, no need to open code this in the driver.
Yes, after check SPI_CONTROLLER_MUST_TX in drivers/spi/spi.c , it's indeed to meet
this situation, i will try it and sumbmit a new patch.
thanks.
best regards
Dillon
Re: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
Quoted 21 lines · dillon min
hi Mark,
Thanks for reviewing.
Quoted 10 lines · Mark Brown
Quoted 3 lines · On Mon, May 18, 2020 at 07:09:20PM +0800, [email protected] wrote:
2, use stm32 spi's "In full-duplex (BIDIMODE=0 and RXONLY=0)", as
tx_bufis null, we must add dummy data sent out before read data.
so, addstm32f4_spi_tx_dummy()to handle this situation.There are flags
SPI_CONTROLLER_MUST_TXandSPI_CONTROLLER_MUST_RXflags that the driver can set if it needs to, no need to open code this in the driver.Yes, after check
SPI_CONTROLLER_MUST_TXindrivers/spi/spi.c, it's indeed to meet
this situation, i will try it and sumbmit a new patch.
Quoted 5 lines
thanks.
best regards
Dillon
Hi Mark,
There might be a conflict with 'SPI_CONTROLLER_MUST_TX' and 'SPI_3WIRE' mode, i need to know the SPI_3WIRE direction, currently i get this information from 'struct spi_device'
and 'struct spi_transfer'
if ((spi_device->mode & SPI_3WIRE) && (spi_transfer->tx_buf == NULL) && (spi_transfer->rx_buf != NULL))
this is a SPI_3WIRE_RX transfer
if ((spi_device->mode & SPI_3WIRE) && (spi_transfer->tx_buf != NULL) && (spi_transfer->rx_buf == NULL))
this is a SPI_3WIRE_TX transfer
but, after spi-core create a dummy tx_buf or rx_buf, then i can't get the correct spi_3wire direction.
actually, this dummy tx_buf is useless for SPI_3WIRE. it's has meaning for SPI_SIMPLE_RX mode,
simulate SPI_FULL_DUMPLEX
how do you think?
thanks
best regards
Dillon
Mark Brown
maintainerRe: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
Quoted 5 lines · dillon min
but, after spi-core create a dummy
tx_buforrx_buf, then i can't get the correctspi_3wiredirection.
actually, this dummytx_bufis useless forSPI_3WIRE. it's has meaning forSPI_SIMPLE_RXmode,
simulateSPI_FULL_DUMPLEX
Oh, that's annoying. I think the fix here is in the core, it should ignore MUST_TX and MUST_RX in 3WIRE mode since they clearly make no sense there.
Re: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
Quoted 9 lines · Mark Brown
Quoted 5 lines · dillon min
but, after spi-core create a dummy
tx_buforrx_buf, then i can't get the correctspi_3wiredirection.
actually, this dummytx_bufis useless forSPI_3WIRE. it's has meaning forSPI_SIMPLE_RXmode,
simulateSPI_FULL_DUMPLEX
Quoted 3 lines
Oh, that's annoying. I think the fix here is in the core, it should ignore
MUST_TXandMUST_RXin 3WIRE mode since they clearly make no sense there.
How about add below changes to spi-core
drivers/spi/spi.c +0 -0
@@ -1022,7 +1022,8 @@ static int spi_map_msg(struct spi_controller
*ctlr, struct spi_message *msg)
void *tmp;
unsigned int max_tx, max_rx;- if (ctlr->flags & (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX)) {
+ if ((ctlr->flags & (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX)) &&
+ !(msg->spi->mode & SPI_3WIRE)) {
max_tx = 0;
max_rx = 0;for my board, lcd panel ilitek ill9341 use 3wire mode, gyro l3gd20 use simplex rx mode.
it's has benefits to l3gd20, no impact to ili9341.
if it's fine to spi-core, i will include it to my next submits.
thanks
best regards.
Dillon
Mark Brown
maintainerRe: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
Quoted 11 lines · dillon min
(quoted diff) +2
-1- if (ctlr->flags & (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX)) { + if ((ctlr->flags & (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX)) && + !(msg->spi->mode & SPI_3WIRE)) { max_tx = 0; max_rx = 0;for my board, lcd panel ilitek ill9341 use 3wire mode, gyro l3gd20 use simplex rx mode.
it's has benefits to l3gd20, no impact to ili9341.if it's fine to spi-core, i will include it to my next submits.
Yes, looks reasonable.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/8] dt-bindings: display: panel: Add ilitek ili9341 panel bindings
In reply to [email protected]Quoted 10 lines · On Mon, 18 May 2020 19:09:22 +0800, [email protected] wrote:
From: dillon min <[email protected]>
Add documentation for "ilitek,ili9341" panel.
Signed-off-by dillon min <[email protected]>--- .../bindings/display/panel/ilitek,ili9341.yaml | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel