How to change default spi setting(ecspi1) to ecspi4 in uboot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change default spi setting(ecspi1) to ecspi4 in uboot

840 Views
baixiaodong_coo
Contributor I

EVB: Smart Device Evaluation Board

Uboot Version: 2017.03-00001-ga2fea67-dirty

Chip : i.MX6S

1. IOMUX setting
static iomux_v3_cfg_t const ecspi4_pads[] = {
      MX6_PAD_EIM_D21__ECSPI4_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
      MX6_PAD_EIM_D22__ECSPI4_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
      MX6_PAD_EIM_D28__ECSPI4_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
      MX6_PAD_EIM_D20__GPIO3_IO20 | MUX_PAD_CTRL(NO_PAD_CTRL),
};

2. CS signal

#define CONFIG_SF_DEFAULT_BUS 3    //include/configs/mx6sabre_common.h

static void setup_spi(void)
{
      imx_iomux_v3_setup_multiple_pads(ecspi4_pads, ARRAY_SIZE(ecspi4_pads));
      gpio_request(IMX_GPIO_NR(3, 20), "ECSPI4 CS");
}

int board_spi_cs_gpio(unsigned bus, unsigned cs)
{
      return (bus == 3 && cs == 0) ? (IMX_GPIO_NR(3, 20)) : -1;
}

3.  CCM enable

After these settings above, all signals(CS, CLK, MISO, MOSI) can be detected.

When execute 'sf probe' command in uboot, the terminal shows:

                     SF: unrecognized JEDEC id bytes: 00, 00, 00
                     Failed to initialize SPI flash at 3:0

Do I miss something?

How could I figure this out, hope you guys can give some advise, thanks in advance! 

Best

Labels (2)
0 Kudos
Reply
1 Reply

719 Views
igorpadykov
NXP Employee
NXP Employee

Hi jack

example of ecspi4 settings can be found in uboot for mx6sx_19x19_arm2.c

mx6sx_19x19_arm2.c\mx6sx_19x19_arm2\freescale\board - uboot-imx - i.MX U-Boot 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply