I configured the ECSPI1 channel by the follow modify:
--- a/arch/arm/mach-mx6/board-mx6dl_sabresd.h
+++ b/arch/arm/mach-mx6/board-mx6dl_sabresd.h
@@ -32,10 +32,28 @@ static iomux_v3_cfg_t mx6dl_sabresd_pads[] = {
MX6DL_PAD_SD2_DAT0__AUDMUX_AUD4_RXD,
MX6DL_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS,
MX6DL_PAD_SD2_DAT2__AUDMUX_AUD4_TXD,
- /* CSPI */
+ /* ECSPI1 */
+ //WWJ changed for SPI1
+ MX6DL_PAD_EIM_D16__ECSPI1_SCLK,
+ MX6DL_PAD_EIM_D17__ECSPI1_MISO,
+ MX6DL_PAD_EIM_D18__ECSPI1_MOSI,
+ MX6DL_PAD_EIM_D19__GPIO_3_19, /*CS1*/
+ MX6DL_PAD_EIM_D24__GPIO_3_24, /*CS2*/
+ MX6DL_PAD_EIM_D25__GPIO_3_25, /*CS3*/
+ MX6DL_PAD_GPIO_3__GPIO_1_3, /*SPI_INT*/
+ //WWJ and end
--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c
@@ -215,6 +215,12 @@
// Frank Lee #define SABRESD_ELAN_RST IMX_GPIO_NR(3, 8)
// Frank Lee #define SABRESD_ELAN_INT IMX_GPIO_NR(3, 28)
+//WWJ changed for SPI1
+#define VK3234_ECSPI1_CS0 IMX_GPIO_NR(3, 19)
+#define VK3234_ECSPI1_CS1 IMX_GPIO_NR(3, 24)
+#define VK3234_ECSPI1_CS2 IMX_GPIO_NR(3, 25)
+
+
--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c
@@ -215,6 +215,12 @@
// Frank Lee #define SABRESD_ELAN_RST IMX_GPIO_NR(3, 8)
// Frank Lee #define SABRESD_ELAN_INT IMX_GPIO_NR(3, 28)
+//WWJ changed for SPI1
+#define VK3234_ECSPI1_CS0 IMX_GPIO_NR(3, 19)
+#define VK3234_ECSPI1_CS1 IMX_GPIO_NR(3, 24)
+#define VK3234_ECSPI1_CS2 IMX_GPIO_NR(3, 25)
+
+
static const struct spi_imx_master mx6q_sabresd_spi_data __initconst = {
@@ -375,6 +384,26 @@ static struct spi_board_info imx6_sabresd_spi_nor_device[] __initdata = {
.platform_data = &imx6_sabresd__spi_flash_data,
},
#endif
+ //WWJ changed for SPI1
+ /*
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 20000000, // max spi clock (SCK) speed in HZ
+ .bus_num = 1,
+ .chip_select = 0,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },*/
+
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 200000, /* max spi clock (SCK) speed in HZ */
+ .bus_num = 1,
+ .chip_select = 1,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },
+
};
+ imx6q_add_ecspi(1, &mx6q_sabresd_spi_data);
+ spi_device_init();
and when i using the SPI (CS1) to read/write the VK3234, CS1 is pulled down, but the SCLK is always hight( have no clk signal), has anyone can help me ?
Solved! Go to Solution.
I changed the bus_num to 0 and imx6q_add_ecspi(0, &mx6q_sabresd_spi_data), the clk is appared:
//WWJ changed for SPI1
+ /*
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 20000000, // max spi clock (SCK) speed in HZ
+ .bus_num = 1,
+ .chip_select = 0,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },*/
+
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 200000, /* max spi clock (SCK) speed in HZ */
+ .bus_num = 0,
+ .chip_select = 1,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },
+
};
+ imx6q_add_ecspi(0, &mx6q_sabresd_spi_data);
please send us the schematic for check.
I have also changed the macro MX6DL_PAD_EIM_D16__ECSPI1_SCLK like this:
//WWJ changed for ISPI1
/*
#define MX6DL_PAD_EIM_D16__ECSPI1_SCLK \
IOMUX_PAD(0x0514, 0x0144, 1, 0x07D8, 2, MX6DL_ECSPI_PAD_CTRL)
*/
#define MX6DL_PAD_EIM_D16__ECSPI1_SCLK \
IOMUX_PAD(0x0514, 0x0144, 1, 0x07D8, 0 , MX6DL_ECSPI_PAD_CTRL)
Hi wenjing,
You are using ECSPI1, so bus_num should be 0, see following and try it again:
+ //WWJ changed for SPI1
+ /*
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 20000000, // max spi clock (SCK) speed in HZ
+ .bus_num = 0,
+ .chip_select = 0,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },*/
+
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 200000, /* max spi clock (SCK) speed in HZ */
+ .bus_num = 0,
+ .chip_select = 1,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },
Hope suggestion is useful for you !
-----------------------------
If my advice can help you resolve the issue, please help to close the post !
thanks!
-----------------------------
Regards,
Weidong
I changed the bus_num to 0 and imx6q_add_ecspi(0, &mx6q_sabresd_spi_data), the clk is appared:
//WWJ changed for SPI1
+ /*
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 20000000, // max spi clock (SCK) speed in HZ
+ .bus_num = 1,
+ .chip_select = 0,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },*/
+
+ {
+ .modalias = "vk3234",
+ .max_speed_hz = 200000, /* max spi clock (SCK) speed in HZ */
+ .bus_num = 0,
+ .chip_select = 1,
+ .platform_data = NULL,
+ .mode = SPI_MODE_0,
+ },
+
};
+ imx6q_add_ecspi(0, &mx6q_sabresd_spi_data);