Hi ALL:
I met a SPI device driver (Sitronix st7262) probing problem @ android 13(Kernel version: 5.15.71)
In our hardware design, st7262 (panel) is connected to imx8mm via ecspi2
Related DTS
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
dmas = <&sdma1 2 7 0>, <&sdma1 3 7 0>;
dma-names = "rx", "tx";
status = "okay";
panel@0 {
reg = <0>;
display-id = "840000";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcd_module>;
compatible = "sitronix,st7262";
spi-max-frequency = <4000000>;
spi-bits-per-word = <8>;
spi-working-mode = <0>;
spi-cs-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH>;
power-supply = <®_lcm_lcd_vdd>;
enable-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
backlight = <&backlight>;
pre-enable;
status = "okay";
In driver (panel-sitronix-st7262.c)
static int st7262_probe(struct spi_device *spi)
{
struct device *dev = &spi->dev;
struct device_node *np = dev->of_node;
struct st7262 *ctx;
struct device_node *timings = NULL;
int ret = 0;
dev_err(&spi->dev, "start st7262 probe\n");
ctx = devm_kzalloc(&spi->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
......
The driver is built with ko by CONFIG_DRM_PANEL_SITRONIX_ST7262=m
The driver is scheduled loaded by SharedBoardConfig.mk (i2c-imx.ko -->i2c-dev.ko -->spidev.ko ->spi-bitbang.ko ->spi-nxp-fspi.ko ->spi-imx.ko --> leds-lm3697.ko --> panel-sitronix-st7262.ko ...)
i
feq ($(IMX8MM_USES_GKI),true)
BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
....
$(KERNEL_OUT)/drivers/gpu/drm/panel/panel-sitronix-st7262.ko \
...
However , when system boot, I could see spi_imx is creating spi0, spi1 bus but I could not see driver is probed ( console should print "start st7262 probe")
2.987023] spi_imx 30820000.spi: registered master spi0
[ 2.988160] spi spi0.0: spi_imx_setup: mode 0, 8 bpw, 4000000 hz
[ 2.988170] spi spi0.0: setup mode 0, 8 bits/w, 4000000 Hz max --> 0
[ 2.988415] spi_imx 30820000.spi: registered child spi0.0
[ 2.989033] spi_imx 30830000.spi: registered master spi1
[ 2.989828] spi spi1.0: spi_imx_setup: mode 0, 8 bpw, 4000000 hz
[ 2.989847] spi spi1.0: setup mode 0, 8 bits/w, 4000000 Hz max --> 0
[ 2.990357] spi_imx 30830000.spi: registered child spi1.0
The same files and settings work in our previous OS (Android 12)
Anybody knows how to debug further ?
Thank you!
Regards/Bensonj
****** Latest Update ******
The problem SEEMED solved by our trials.
Debug history
1) We try to remove the followings in dtsi
port {
st7262_input: endpoint {
remote-endpoint = <&bridge_out_dsi>;
};
};
Then st7262 driver can be probed correctly .
However , in our platform, we need st7262 (panel , spi interface) and icn6211 (as a bridge between st7262 and imx8mm, mipi_dsi devices) driver which must function normally. we suspect the problem is caused by the remote-endpoint of st7262 port(bridge_out_dsi) cannot be retrieved correctly . (please refer to the following dts)
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
dmas = <&sdma1 2 7 0>, <&sdma1 3 7 0>;
dma-names = "rx", "tx";
status = "okay";
st7262: panel@0 {
reg = <0>;
display-id = "840000";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcd_module>;
compatible = "sitronix,st7262";
spi-max-frequency = <4000000>;
spi-bits-per-word = <8>;
spi-working-mode = <0>;
spi-cs-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH>;
power-supply = <®_lcm_lcd_vdd>;
enable-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
backlight = <&backlight>;
pre-enable;
status = "okay";
display-timings {
timing {
clock-frequency = <24600000>;
hactive = <800>;
vactive = <480>;
hfront-porch = <48>;
hsync-len = <8>;
hback-porch = <48>;
vfront-porch = <12>;
vsync-len = <8>;
vback-porch = <12>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <1>;
pixelclk-active = <0>;
};
};
port {
st7262_input: endpoint {
remote-endpoint = <&bridge_out_dsi>;
};
};
..........................
&mipi_dsi {
status = "okay";
fsl,clock-drop-level = <2>;
pre-enable;
#address-cells = <1>;
#size-cells = <0>;
icn6211: bridge@2 {
compatible = "chipone,icn6211";
reg = <2>;
vdd1-supply = <®_lcm_bridg_vdd>;
vdd2-supply = <®_lcm_bridg_vdd>;
vdd3-supply = <®_lcm_bridg_vdd>;
enable-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
video-mode = <2>; /* 0: burst mode */
rgb-data-seq = <5>;
pre-enable;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
bridge_in_dsi: endpoint {
remote-endpoint = <&mipi_dsi_out>;
};
};
port@1 {
reg = <1>;
bridge_out_dsi: endpoint {
remote-endpoint = <&st7262_input>;
};
};
..............
So we try to adjust loadable module sequence in Sharedboardconfig.mk : move mipi dsi bus driver and its related before st7262 & icn6211 driver , then everything seemed back to normal
My question , why the same SharedBoardConfig.mk work at Android 12 but failed at Android 13?
Hello @bensonwu
Attached is the related dmesg log.
It seemed that spi-imx has successfully create spi0(bus), spi1(bus), and its SPI device.
For SPI0 ,it is used for idg(our another device) , For SPI1, it is connected to st7262 panel.
idg driver is built as module(=m) and loaded by SharedBoardConfig.mk with very late sequence.
From kernel log, idg driver can be probed, but panel driver is not probed.
Our DTS related to spi is listed as below(some DTS entries for panel have been temporarily removed for trouble shooting):
&ecspi1 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
fsl,spi-num-chipselects = <1>;
dmas = <&sdma1 0 7 0>, <&sdma1 1 7 0>;
dma-names = "rx", "tx";
status = "okay";
/* for ttyIDG & ttyIDGV5 device entry */
idg_spi@0 {
reg = <0>;
compatible = "idtech,idg-spi";
interrupt-parent = <&gpio1>;
interrupts = <11 IRQ_TYPE_EDGE_RISING>;
spi-max-frequency = <4000000>; /* 4 MHz */
spi-bits-per-word = <8>; /* 8 bits */
spi-working-mode = <0>; /* SPI_MODE_0 */
spi-cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>; /* CS control */
spi-poweron-gpio = <&gpio5 12 GPIO_ACTIVE_HIGH>; /* power control */
idg-keep-sense;
status = "okay";
};
};
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
dmas = <&sdma1 2 7 0>, <&sdma1 3 7 0>;
dma-names = "rx", "tx";
status = "okay";
panel@0 {
compatible = "sitronix,st7262";
spi-max-frequency = <4000000>;
reg = <0>;
status = "okay";
port {
st7262_input: endpoint {
remote-endpoint = <&bridge_out_dsi>;
};
};
};
};
Hello @bensonwu ,
I hope you are doing well.
->Please make sure to check the DTS file to make sure that the correct device tree node is being used for the SPI device.
to check this, open the DTS file and look for the node that corresponds to your SPI device. The node name should be the same as the name of the device in the kernel logs.
->Please make sure to check the kernel logs to see if there are any errors related to the SPI driver.
It will show the exact problem related to the spi driver that causing the issue.
To view kernel logs please run the command "dmesg | grep -rin spi" or just dmesg.
It will help you!
Thanks & Regards,
Sanket Parekh