H
I'm using IMX7D board and Freesacle Linux kernel 4.1.15 for development [using YOCTO to build]
I'm trying to insert NXP NFCRdLib Kernel BAL(Bus Abstraction Layer) Module. with reference of
GitHub - christianeisendle/nxprdlib-kernel-bal: NXP NFCRdLib Kernel BAL Module
successfully built "bal.ko" file and i did few changes in imx7d-sdb.dts file .
&ecspi3 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
cs-gpios = <&gpio6 22 0>;
status = "okay";
spidev0: spi@0 {
compatible = "nxp,bal";
reg = <0>;
spi-max-frequency = <500000>;
};
}
pinctrl_ecspi3_cs: ecspi3_cs_grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22 0x80000000
>;
};
pinctrl_ecspi3: ecspi3grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_SYNC__ECSPI3_MISO 0x2
MX7D_PAD_SAI2_TX_BCLK__ECSPI3_MOSI 0x2
MX7D_PAD_SAI2_RX_DATA__ECSPI3_SCLK 0x2
>;
};
built new kernel .
But after inserting module getting below messages.
$ insmod bal.ko
Registering character device /dev/bal. Status: 0
BAL_SPI_DRIVER spi2.0: Probing BAL driver
BAL_SPI_DRIVER spi2.0: BUSY pin mapped to an invalid GPIO!
I know . i need to modify kernel in order to assign one SPI device with BAL module instead of the spidev module. But i am not sure where i need to make changes.
Could anyone help me to track this ?
For more refernce attached bal.c .
Thanks in advance.
Chandini
Original Attachment has been moved to: bal.c.zip
Solved! Go to Solution.
I got it working . i am posting here because it may be useful for others.
1. Add below config to imx_v7_defconfig for spi
# MT Add
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_BITBANG=y
CONFIG_IMX_HAVE_PLATFORM_SPI_IMX=y
CONFIG_REGMAP_SPI=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_SPI_MC13XXX_SPI=y
CONFIG_SND_SPI=y
CONFIG_SND_SOC_I2C_AND_SPI=y
# MT end
2 For 4.1.15 kernel Modify imx7d-sdb.dts file is enough
&ecspi3 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
cs-gpios = <&gpio6 22 0>;
status = "okay";
bal: nxprdlib-bal@0 {
compatible = "nxp,bal";
reg = <0>;
busy-pin-gpio= <&gpio1 2 0>;
spi-max-frequency = <500000>;
status="okay";
};
}
pinctrl_ecspi3_cs: ecspi3_cs_grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22 0x80000000
>;
};
pinctrl_ecspi3: ecspi3grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_SYNC__ECSPI3_MISO 0x2
MX7D_PAD_SAI2_TX_BCLK__ECSPI3_MOSI 0x2
MX7D_PAD_SAI2_RX_DATA__ECSPI3_SCLK 0x2
>;
};
3 .Build zimage and imx7d-sdb.dtb outside of yocto , as soon so i insert module . i can see "bal" device under "dev"
Thank you
Chandini
we can use spi frequency 5Mhz or 7.5Mhz with bal driver
I tried up to 7.5 Mhz
Hi Chandini
please look at necessary changes on
How to enable spidev for all SPI (1-5) for MX6 | NXP Community
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks for replay igor.
They are few things.
1. in that link they specified one location "/arch/arm/mach-mx6/board-mx6q_sabrelite.c" . that is not exists in my kernel. [might be because of i am using new kernel 4.1.15 ]
2. I got working SPI already. by below changes in imx7d-sdb.dts
&ecspi3 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
cs-gpios = <&gpio6 22 0>;
status = "okay";
spidev0: spi@0 {
compatible = "spidev";
reg = <0>;
spi-max-frequency = <500000>;
};
}
pinctrl_ecspi3_cs: ecspi3_cs_grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22 0x80000000
>;
};
pinctrl_ecspi3: ecspi3grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_SYNC__ECSPI3_MISO 0x2
MX7D_PAD_SAI2_TX_BCLK__ECSPI3_MOSI 0x2
MX7D_PAD_SAI2_RX_DATA__ECSPI3_SCLK 0x2
>;
};
3. Problem is to link/configure spidev2.0 for bal driver. for that i need to add busy pin like how they did for raspberry pi,
because i am getting
$ insmod bal.ko
Registering character device /dev/bal. Status: 0
BAL_SPI_DRIVER spi2.0: Probing BAL driver
BAL_SPI_DRIVER spi2.0: BUSY pin mapped to an invalid GPIO!
BR
Chandini
I got it working . i am posting here because it may be useful for others.
1. Add below config to imx_v7_defconfig for spi
# MT Add
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_BITBANG=y
CONFIG_IMX_HAVE_PLATFORM_SPI_IMX=y
CONFIG_REGMAP_SPI=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_SPI_MC13XXX_SPI=y
CONFIG_SND_SPI=y
CONFIG_SND_SOC_I2C_AND_SPI=y
# MT end
2 For 4.1.15 kernel Modify imx7d-sdb.dts file is enough
&ecspi3 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
cs-gpios = <&gpio6 22 0>;
status = "okay";
bal: nxprdlib-bal@0 {
compatible = "nxp,bal";
reg = <0>;
busy-pin-gpio= <&gpio1 2 0>;
spi-max-frequency = <500000>;
status="okay";
};
}
pinctrl_ecspi3_cs: ecspi3_cs_grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22 0x80000000
>;
};
pinctrl_ecspi3: ecspi3grp {
fsl,pins = <
MX7D_PAD_SAI2_TX_SYNC__ECSPI3_MISO 0x2
MX7D_PAD_SAI2_TX_BCLK__ECSPI3_MOSI 0x2
MX7D_PAD_SAI2_RX_DATA__ECSPI3_SCLK 0x2
>;
};
3 .Build zimage and imx7d-sdb.dtb outside of yocto , as soon so i insert module . i can see "bal" device under "dev"
Thank you
Chandini