Hi everyone,
I have a problem using the ECSPI2 on the i.MX 8M Nano Evaluation Kit and have already the idea, that the CONFIG_SPIO_GPIO has to be set in kernel configuration, but I can't find a way to do that.
This is my first question here, I hope that I give enough explanation what I did and what I want to archieve. If not, let me know and I will fix it :smileyhappy:
I am using yocto with following build configuration:
Build Configuration:
BB_VERSION = "1.44.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "ubuntu-18.04"
TARGET_SYS = "aarch64-poky-linux"
MACHINE = "imx8mnevk"
DISTRO = "fsl-imx-xwayland"
DISTRO_VERSION = "5.4-zeus"
TUNE_FEATURES = "aarch64"
TARGET_FPU = ""
Following the example ECSPI2 on i.MX8M Mini EVK
I created my own layer with "recipes-kernel/linux" in it and made a patch for the kernel with
bitbake -c devshell linux-imx
changing the ECSPI2 in the device-tree arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
according to the example and arch/arm64/boot/dts/freescale/imx8mn-pinfunc.h
But I changed the PAD Configure value for ECSPI2_SS0 to 0x82, disabeling the Pulldown-resistor due to
i.MX 8M Nano Applications Processor Reference Manual - 8.2.5.233 Pad Control Register (IOMUXC_SW_PAD_CTL_PAD_ECSPI2_SS0)
and
git format-patch -n HEAD^
putting the created patch in recipes-kernel/linux/files and calling it in recipes-kernel/linux/linux-imx_5.4.bbappend file:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://0001-adding-ecspi-and-spidev.patch"
On the board, the Configs for spi are already set as default in /proc/config.gz:
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
...
CONFIG_SPI_BITBANG=y
etc.
When I run
root@imx8mnevk:/unit_tests/ECSPI# ./mxc_spi_test1.out -D 0 -s 12000 -b 8 1337
I see MISO, MOSI, SCK and CS working as expected.
Now, I wanted to change the CS line to a gpio-configuration.
I repeated the former steps, creating an imx8mn-ddr4-evk.dts-patch looking like that:
@@ -282,6 +282,27 @@
>;
};
+ pinctrl_ecspi2: ecspi2grp {
+ fsl,pins = <
+ MX8MN_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x1916
+ MX8MN_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x116
+ MX8MN_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x116
+ >;
+ };
+
+ pinctrl_ecspi2_cs: ecspi2cs {
+ fsl,pins = <
+ MX8MN_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x82
+ >;
+ };
+
+ //Pin Configurations
+ //Pin Ctrl from imx8mn-pinfunc.h
+ //Pad Ctrl from i.MX 8M Nano Applications Processor Reference Manual
+ //8.2.5.247 Pad Control Register (IOMUX_SW_PAD_CTL_PAD_UART3_TXD)
+ // HYS = 1
+ // DSE = 0x01X
+
pinctrl_usdhc1_gpio: usdhc1grpgpio {
fsl,pins = <
MX8MN_IOMUXC_SD1_RESET_B_GPIO2_IO10 0x41
@@ -754,6 +775,21 @@
status = "okay";
};
+&ecspi2 {
+ fsl,spi-num-chipselects = <1>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;
+ cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
+ status = "okay";
+
+ it8951spi: it8951spi@0 {
+ compatible = "ite,it8951_spi_protocol";
+ reg = <0>;
+ spi-max-frequency = <12000000>;
+ spi-epaper-frequency = <24000000>;
+ };
+};
+
&usbotg1 {
picophy,pre-emp-curr-control = <3>;
picophy,dc-vol-level-adjust = <7>;
--
2.17.1
I made an out-of-tree-kernel module doing nothing but writing 0x04 0x04 to spi line, wich is automatically loaded at boot by defining
CORE_IMAGE_EXTRA_INSTALL = "spi-it8951"
KERNEL_MODULE_AUTOLOAD += "spi-it8951"
in <yocto_dir>/<build_dir>/conf/local.conf
I can see that the module is loaded by lsmod:
root@imx8mnevk:~# lsmod
Module Size Used by
crct10dif_ce 16384 1
brcmfmac 303104 0
brcmutil 20480 1 brcmfmac
spi_it8951 16384 0
galcore 512000 0
and I can see the data on the MISO line, as well as a Clock generated for it.
But what I am missing is the CS pin toggeling.
When I analyze the /proc/config.gz, theres a value CONFIG_SPI_GPIO which is not set.
Could that be the missing configuration? And If yes, how can I enable it?
I tried to make a spigpio.cfg in recipes-kernel/linux/files and adding it to linux-imx_5.4.bbappend, which includes:
CONFIG_SPI_GPIO=y
I can see the file popping up in
<yocto_dir>/<build_dir>/tmp/work/imx8mnevk-poky-linux/linux-imx/5.4-r0/spigpio.cfg
but nothing changed.
On the board, in /proc/config.gz CONFIG_SPI_GPIO is still not set.
The same happens when I patch the /arch/arm64/configs/imx_v8_defconfig file.
I can see that the change took place by having a look in
<yocto_dir>/<build_dir>/tmp/work-shared/imx8mnevk/kernel-source/arch/arm64/configs/imx_v8_defconfig
but the config.gz on the board still says "CONFIG_SPI_GPIO is not set" -.-
Is there a way to set this config? Or am I hunting the white rabbit anyway and the config does not change my CS Problem?
I am running out of ideas. Any help would be highly appreciated!
I know, this is a lot of infos around the problem, but I wanted to make it as clear as possible to follow.
Thanks,
Silke
Solved! Go to Solution.
After spending time in the spi-imx driver, I found the solution
https://community.nxp.com/message/1326698?commentID=1326698#comment-1326698
Best Regards,
Silke
After spending time in the spi-imx driver, I found the solution
https://community.nxp.com/message/1326698?commentID=1326698#comment-1326698
Best Regards,
Silke
Things are getting quite strange.
For testing purpose, I put two spi child nodes into the ecspi2 node, using different Chip Select lines, one as a gpio, the other one as native CS.
---
.../boot/dts/freescale/imx8mn-ddr4-evk.dts | 73 ++++++++++++++++++-
1 file changed, 71 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
index 039ece96b9b2..2e77926e7663 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
@@ -158,6 +158,36 @@
>;
};
+ pinctrl_ecspi2: ecspi2grp {
+ fsl,pins = <
+ MX8MN_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x156
+ MX8MN_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x156
+ MX8MN_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x156
+ MX8MN_IOMUXC_ECSPI2_SS0_ECSPI2_SS0 0x156
+ MX8MN_IOMUXC_SAI5_RXD2_GPIO3_IO23 0x156
+ >;
+ };
+
+ pinctrl_it8951_reset_pin: it8951_reset_grp {
+ fsl,pins = <
+ MX8MN_IOMUXC_SAI5_RXD0_GPIO3_IO21 0x156
+ >;
+ };
+
+ pinctrl_it8951_hrdy_pin: it8951_hrdy_grp {
+ fsl,pins = <
+ MX8MN_IOMUXC_SAI5_RXC_GPIO3_IO20 0x156
+ >;
+ };
+
+ //Pin Configurations
+ //Pin Ctrl from imx8mn-pinfunc.h
+ //Pad Ctrl from i.MX 8M Nano Applications Processor Reference Manual
+ //8.2.5.247 Pad Control Register (IOMUX_SW_PAD_CTL_PAD_UART3_TXD)
+ // HYS = 1
+ // DSE = 0x01X
+
+
pinctrl_pmic: pmicirq {
fsl,pins = <
MX8MN_IOMUXC_GPIO1_IO03_GPIO1_IO3 0x41
@@ -710,6 +740,45 @@
};
};
+&ecspi2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ fsl,spi-num-chipselects = <2>; //obsolete, this or num-cs?
+ num-cs = <2>; //not sure what imx-ler will use
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_ecspi2>;
+ cs-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>, <0>;
+ gpios = <&gpio3 23 GPIO_ACTIVE_LOW>, <0>; //not sure what imx-ler will use
+ status = "okay";
+
+ it8951spi: it8951spi@0 {
+ compatible = "ite,it8951_spi_protocol";
+ reg = <0>; //first cs, so gpio
+ spi-max-frequency = <12000000>;
+ spi-epaper-frequency = <24000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_it8951_reset_pin>, <&pinctrl_it8951_hrdy_pin>;
+ hrdy_gpio = <&gpio3 20 GPIO_ACTIVE_LOW>;
+ rst_gpio = <&gpio3 21 GPIO_ACTIVE_HIGH>;
+
+ preamble_read = /bits/ 16 <0x1000>;
+ preamble_write = /bits/ 16 <0x0000>;
+ preamble_command = /bits/ 16 <0x6000>;
+
+ vcom = /bits/ 16 <2040>; //e.g. -1.77 V = 1770
+ display_mode = /bits/ 8 <1>; //monochrome
+ display_mode_pictures = /bits/ 8 <2>; //pre gray
+ status = "okay";
+ };
+
+ spidev: spidev@0{
+ compatible = "spidev";
+ spi-max-frequency = <10000000>;
+ reg = <1>; //second cs, native
+ };
+};
+
+
&lcdif {
status = "okay";
};
@@ -736,7 +805,7 @@
assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_80M>;
fsl,uart-has-rtscts;
resets = <&modem_reset>;
- status = "okay";
+ status = "disabled";
};
&uart2 { /* console */
@@ -834,7 +903,7 @@
assigned-clocks = <&clk IMX8MN_CLK_PDM>;
assigned-clock-parents = <&clk IMX8MN_AUDIO_PLL1_OUT>;
assigned-clock-rates = <196608000>;
- status = "okay";
+ status = "disabled";
};
&sai3 {
--
2.17.1
Altough i put reg = <0> in spi child node for it8951spi and defining this as the gpio in ecspi2,
the natice CS line is toggled -.-
The other GPIOs, named RST and HRDY work as expected. As you already see in my device-tree-patch, I tried different names for cs-gpios and num-cs.
When I mux the native CS to a GPIO instead of another GPIO on the pin header, I just see nothing on this line.
I am confused, because everywhere in the internet, people are suggested to use GPIO instead of native CS and it seems to work for them, so I must do something stupid and wrong in my patch...
Using native CS is no option, because it toggles every 8 bit and my controller does not understand that.
Any suggestions how to move on?
Thanks,
Silke
This may help you.
Hi jimmychan,
thanks for the response and the link.
I tried it out, but it did not work in my case.
I also tried to debug in the spi-imx.c driver, making a lot of printks in it.
One, where I moved the gpio-requesting block of code in spi_imx_probe
to a spot before bitbang_start and one after.
See the one with the switch below:
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 91e32291c44e..4a9c27415009 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1553,7 +1553,7 @@ static int spi_imx_transfer(struct spi_device *spi,
static int spi_imx_setup(struct spi_device *spi)
{
- dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", __func__,
+ printk("spi-imx %s: mode %d, %u bpw, %d hz\n", __func__,
spi->mode, spi->bits_per_word, spi->max_speed_hz);
if (spi->mode & SPI_NO_CS)
@@ -1632,6 +1632,7 @@ static int spi_imx_probe(struct platform_device *pdev)
(struct spi_imx_devtype_data *)pdev->id_entry->driver_data;
bool slave_mode;
+ printk("spi-imx probe called\n");
if (!np && !mxc_platform_info) {
dev_err(&pdev->dev, "can't get the platform data\n");
return -EINVAL;
@@ -1663,11 +1664,14 @@ static int spi_imx_probe(struct platform_device *pdev)
spi_imx->bitbang.master = master;
spi_imx->dev = &pdev->dev;
spi_imx->slave_mode = slave_mode;
+ printk("spi-imx slave-mode=%d\n", slave_mode);
spi_imx->devtype_data = devtype_data;
+ printk("spi-imx getting chip select\n");
/* Get number of chip selects, either platform data or OF */
if (mxc_platform_info) {
+ printk("spi-imx mxc platform inf is valid, getting chipselect\n");
master->num_chipselect = mxc_platform_info->num_chipselect;
if (mxc_platform_info->chipselect) {
master->cs_gpios = devm_kcalloc(&master->dev,
@@ -1681,9 +1685,11 @@ static int spi_imx_probe(struct platform_device *pdev)
}
} else {
u32 num_cs;
-
- if (!of_property_read_u32(np, "num-cs", &num_cs))
+ printk("spi-imx mxc platform info is invalid, getting cs of dts\n");
+ if (!of_property_read_u32(np, "num-cs", &num_cs)){
+ printk("spi-imx num-cs=%d", num_cs);
master->num_chipselect = num_cs;
+ }
/* If not preset, default value of 1 is used */
}
@@ -1704,6 +1710,7 @@ static int spi_imx_probe(struct platform_device *pdev)
spi_imx->spi_drctl = spi_drctl;
init_completion(&spi_imx->xfer_done);
+ printk("spi-imx init_completion done\n");
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
spi_imx->base = devm_ioremap_resource(&pdev->dev, res);
@@ -1766,14 +1773,11 @@ static int spi_imx_probe(struct platform_device *pdev)
spi_imx->devtype_data->intctrl(spi_imx, 0);
master->dev.of_node = pdev->dev.of_node;
- ret = spi_bitbang_start(&spi_imx->bitbang);
- if (ret) {
- dev_err(&pdev->dev, "bitbang start failed with %d\n", ret);
- goto out_clk_put;
- }
/* Request GPIO CS lines, if any */
+ printk("spi-imx request gpio cs lines\n");
if (!spi_imx->slave_mode && master->cs_gpios) {
+ printk("spi-imx go through chip selects\n");
for (i = 0; i < master->num_chipselect; i++) {
if (!gpio_is_valid(master->cs_gpios[i]))
continue;
@@ -1788,6 +1792,26 @@ static int spi_imx_probe(struct platform_device *pdev)
}
}
}
+ else{
+ printk("spi-imx slave mode on or master cs gpios unvalid\n");
+ printk("master->num_chipselect=%d\n", master->num_chipselect);
+ if(!spi_imx->slave_mode)
+ printk("spi-imx slave mode is off");
+ else
+ printk("spi-imx slave mode is on");
+ if(master->cs_gpios)
+ printk("master-cs-gpios are valid");
+ else
+ printk("master cs-gpios are not valid");
+ }
+
+ printk("spi-imx starting bitbang\n");
+ ret = spi_bitbang_start(&spi_imx->bitbang);
+ if (ret) {
+ dev_err(&pdev->dev, "bitbang start failed with %d\n", ret);
+ goto out_clk_put;
+ }
+
dev_info(&pdev->dev, "probed\n");
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 26b91ee0855d..bc451b0ab265 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -775,6 +775,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n)
static void spi_set_cs(struct spi_device *spi, bool enable)
{
+ printk("spi_set_cs called\n");
if (spi->mode & SPI_CS_HIGH)
enable = !enable;
@@ -2245,10 +2246,12 @@ static int of_spi_get_gpio_numbers(struct spi_controller *ctlr)
int nb, i, *cs;
struct device_node *np = ctlr->dev.of_node;
+ printk("of_spi_get_gpio_numbers called\n");
if (!np)
return 0;
nb = of_gpio_named_count(np, "cs-gpios");
+ printk("of_spi_get_gpio_numbers nb=%d\n", nb);
ctlr->num_chipselect = max_t(int, nb, ctlr->num_chipselect);
/* Return error only for an incorrectly formed cs-gpios property */
@@ -2267,8 +2270,10 @@ static int of_spi_get_gpio_numbers(struct spi_controller *ctlr)
for (i = 0; i < ctlr->num_chipselect; i++)
cs[i] = -ENOENT;
- for (i = 0; i < nb; i++)
+ for (i = 0; i < nb; i++){
+ printk("of_spi getting named gpios\n");
cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+ }
return 0;
}
@@ -2385,6 +2390,7 @@ int spi_register_controller(struct spi_controller *ctlr)
int status;
int id, first_dynamic;
+ printk("spi register controller called\n");
if (!dev)
return -ENODEV;
--
2.17.1
When I start the Board and check the seriel output, I already see, that moving the gpio request to another place, is (if I understand that correctly) not the right option.
The output with the switch:
[ 0.964689] spi-imx probe called
[ 0.967935] spi-imx slave-mode=0
[ 0.971168] spi-imx getting chip select
[ 0.975008] spi-imx mxc platform info is invalid, getting cs of dts
[ 0.981279] spi-imx init_completion done
[ 0.985317] spi-imx request gpio cs lines
[ 0.989333] spi-imx slave mode on or master cs gpios unvalid
[ 0.994998] master->num_chipselect=1
[ 0.998577] spi-imx slave mode is off
[ 0.998579] master cs-gpios are not valid
[ 1.002244] spi-imx starting bitbang
[ 1.009835] spi register controller called
[ 1.013945] of_spi_get_gpio_numbers called
[ 1.018049] of_spi_get_gpio_numbers nb=1
[ 1.021976] of_spi getting named gpios
[ 1.025935] spi-imx spi_imx_setup: mode 4, 8 bpw, 10000000 hz
[ 1.031736] spi_set_cs called
[ 1.034843] ------------[ cut here ]------------
[ 1.039470] /soc@0/bus@30800000/spi@30830000/spidev@0x00: buggy DT: spidev listed directly in DT
[ 1.048300] WARNING: CPU: 0 PID: 1 at drivers/spi/spidev.c:723 spidev_probe+0x104/0x220
[ 1.056300] Modules linked in:
[ 1.059358] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.3-lts-lf-5.4.y+gf8118585ee3c #1
[ 1.067531] Hardware name: NXP i.MX8MNano DDR4 EVK board (DT)
[ 1.073275] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 1.078064] pc : spidev_probe+0x104/0x220
[ 1.082071] lr : spidev_probe+0x104/0x220
[ 1.086077] sp : ffff80001003b7d0
[ 1.089389] x29: ffff80001003b7d0 x28: 0000000000000001
[ 1.094700] x27: ffff000078aedb80 x26: ffff800011923330
[ 1.100010] x25: 0000000000000000 x24: 0000000000000000
[ 1.105320] x23: ffff800011932e60 x22: 0000000000000000
[ 1.110631] x21: ffff800011932e40 x20: ffff00007868c800
[ 1.115941] x19: 0000000000000000 x18: 0000000000000010
[ 1.121252] x17: 00000000fd12cf85 x16: ffff000078006510
[ 1.126562] x15: ffff000078090470 x14: 6c20766564697073
[ 1.131873] x13: 203a544420796767 x12: 7562203a30307830
[ 1.137183] x11: 407665646970732f x10: 3030303033383033
[ 1.142493] x9 : 406970732f303030 x8 : ffff8000119e3000
[ 1.147804] x7 : ffff80001067f5e8 x6 : 00000000000000d3
[ 1.153114] x5 : 0000000000000000 x4 : 0000000000000000
[ 1.158424] x3 : 00000000ffffffff x2 : ffff8000118d1520
[ 1.163734] x1 : 77bee9e389fa8f00 x0 : 0000000000000000
[ 1.169044] Call trace:
[ 1.171490] spidev_probe+0x104/0x220
[ 1.175152] spi_drv_probe+0x7c/0xd8
[ 1.178728] really_probe+0xd4/0x308
[ 1.182303] driver_probe_device+0x54/0xe8
[ 1.186399] __device_attach_driver+0x80/0xb8
[ 1.190755] bus_for_each_drv+0x74/0xc0
[ 1.194589] __device_attach+0xdc/0x138
[ 1.198424] device_initial_probe+0x10/0x18
[ 1.202605] bus_probe_device+0x90/0x98
[ 1.206440] device_add+0x378/0x648
[ 1.209927] spi_add_device+0xe4/0x1c8
[ 1.213675] of_register_spi_device+0x204/0x3c8
[ 1.218204] spi_register_controller+0x664/0x74c
[ 1.222819] spi_bitbang_start+0x34/0x80
[ 1.226741] spi_imx_probe+0x608/0x6f0
[ 1.230489] platform_drv_probe+0x50/0xa0
[ 1.234498] really_probe+0xd4/0x308
[ 1.238072] driver_probe_device+0x54/0xe8
[ 1.242167] device_driver_attach+0x6c/0x78
[ 1.246349] __driver_attach+0x54/0xd0
[ 1.250097] bus_for_each_dev+0x6c/0xc0
[ 1.253931] driver_attach+0x20/0x28
[ 1.257506] bus_add_driver+0x140/0x1e8
[ 1.261340] driver_register+0x60/0x110
[ 1.265174] __platform_driver_register+0x44/0x50
[ 1.269879] spi_imx_driver_init+0x1c/0x24
[ 1.273975] do_one_initcall+0x50/0x190
[ 1.277811] kernel_init_freeable+0x194/0x22c
[ 1.282168] kernel_init+0x10/0x100
[ 1.285655] ret_from_fork+0x10/0x18
[ 1.289232] ---[ end trace de09230545766b9c ]---
[ 1.293994] spi_imx 30830000.spi: probed
the output without it:
[ 0.965239] spi-imx probe called
[ 0.968486] spi-imx slave-mode=0
[ 0.971719] spi-imx getting chip select
[ 0.975558] spi-imx mxc platform info is invalid, getting cs of dts
[ 0.981829] spi-imx init_completion done
[ 0.985870] spi-imx spi bitbang start
[ 0.989540] spi register controller called
[ 0.993649] of_spi_get_gpio_numbers called
[ 0.997752] of_spi_get_gpio_numbers nb=1
[ 1.001682] of_spi getting named gpios
[ 1.005641] spi-imx spi_imx_setup: mode 0, 8 bpw, 10000000 hz
[ 1.011405] spi_set_cs called
[ 1.014504] ------------[ cut here ]------------
[ 1.019131] /soc@0/bus@30800000/spi@30830000/spidev@0x00: buggy DT: spidev listed directly in DT
[ 1.027963] WARNING: CPU: 3 PID: 1 at drivers/spi/spidev.c:723 spidev_probe+0x104/0x220
[ 1.035963] Modules linked in:
[ 1.039020] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.4.3-lts-lf-5.4.y+gf8118585ee3c #1
[ 1.047193] Hardware name: NXP i.MX8MNano DDR4 EVK board (DT)
[ 1.052937] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 1.057726] pc : spidev_probe+0x104/0x220
[ 1.061734] lr : spidev_probe+0x104/0x220
[ 1.065739] sp : ffff80001003b7d0
[ 1.069051] x29: ffff80001003b7d0 x28: 0000000000000001
[ 1.074362] x27: ffff000078b88080 x26: ffff800011923330
[ 1.079673] x25: 0000000000000000 x24: 0000000000000000
[ 1.084983] x23: ffff800011932e60 x22: 0000000000000000
[ 1.090294] x21: ffff800011932e40 x20: ffff000078385000
[ 1.095604] x19: 0000000000000000 x18: 0000000000000010
[ 1.100914] x17: 0000000000000001 x16: 0000000000000019
[ 1.106224] x15: ffff000078090470 x14: 6c20766564697073
[ 1.111534] x13: 203a544420796767 x12: 7562203a30307830
[ 1.116845] x11: 407665646970732f x10: 3030303033383033
[ 1.122155] x9 : 406970732f303030 x8 : ffff8000119e3000
[ 1.127465] x7 : ffff80001067f5e8 x6 : 00000000000000ce
[ 1.132776] x5 : 0000000000000000 x4 : 0000000000000000
[ 1.138086] x3 : 00000000ffffffff x2 : ffff8000118d1520
[ 1.143396] x1 : 9586de38223a3d00 x0 : 0000000000000000
[ 1.148706] Call trace:
[ 1.151152] spidev_probe+0x104/0x220
[ 1.154814] spi_drv_probe+0x7c/0xd8
[ 1.158390] really_probe+0xd4/0x308
[ 1.161965] driver_probe_device+0x54/0xe8
[ 1.166060] __device_attach_driver+0x80/0xb8
[ 1.170417] bus_for_each_drv+0x74/0xc0
[ 1.174252] __device_attach+0xdc/0x138
[ 1.178087] device_initial_probe+0x10/0x18
[ 1.182269] bus_probe_device+0x90/0x98
[ 1.186103] device_add+0x378/0x648
[ 1.189591] spi_add_device+0xe4/0x1c8
[ 1.193339] of_register_spi_device+0x204/0x3c8
[ 1.197869] spi_register_controller+0x664/0x74c
[ 1.202484] spi_bitbang_start+0x34/0x80
[ 1.206407] spi_imx_probe+0x500/0x6f8
[ 1.210155] platform_drv_probe+0x50/0xa0
[ 1.214163] really_probe+0xd4/0x308
[ 1.217737] driver_probe_device+0x54/0xe8
[ 1.221832] device_driver_attach+0x6c/0x78
[ 1.226014] __driver_attach+0x54/0xd0
[ 1.229762] bus_for_each_dev+0x6c/0xc0
[ 1.233597] driver_attach+0x20/0x28
[ 1.237171] bus_add_driver+0x140/0x1e8
[ 1.241005] driver_register+0x60/0x110
[ 1.244839] __platform_driver_register+0x44/0x50
[ 1.249544] spi_imx_driver_init+0x1c/0x24
[ 1.253640] do_one_initcall+0x50/0x190
[ 1.257476] kernel_init_freeable+0x194/0x22c
[ 1.261833] kernel_init+0x10/0x100
[ 1.265320] ret_from_fork+0x10/0x18
[ 1.268898] ---[ end trace b6ad49a34d072e58 ]---
[ 1.273651] spi-imx request gpio cs lines
[ 1.277667] spi-imx go through chip selects
[ 1.281860] spi_imx 30830000.spi: probed
sorry, it is not pretty and the english is bad.
the thing is, that when I switch the place for the gpio_request, there are no master->cs_gpios created and the function
if (!spi_imx->slave_mode && master->cs_gpios) {
will always be evaluated as "no"
In both cases, the CS is not toggled. It remains low infinitely.
I will try to reproduce the behaviour with another board and let you know, if I find out anything.