SPI devices

Vanalme Filip F.Vanalme at TELEVIC.com
Fri Feb 18 07:48:07 EST 2011


My i.MX27PDK board has the PHY chip on CSPI2 and the LCD on CSPI1. The PHY uses SS0 of CSPI2, the LCD uses SS2 of CSPI1.
I'm not sure if I'm doing it right when I implement it like this :

static int imx27pdk_spi_phy_cs[] = {GPIO_PORTD + 21};

static struct spi_imx_master imx27pdk_spi_1_data = {
    .chipselect = imx27pdk_spi_phy_cs,
    .num_chipselect = ARRAY_SIZE(imx27pdk_spi_phy_cs),
};

static int imx27pdk_spi_lcd_cs[] = {GPIO_PORTD + 26};

static struct spi_imx_master imx27pdk_spi_0_data = {
    .chipselect = imx27pdk_spi_lcd_cs,
    .num_chipselect = ARRAY_SIZE(imx27pdk_spi_lcd_cs),
};

static struct spi_board_info imx27pdk_spi_board_info[] = {
    {
      .name = "LCD",
      .max_speed_hz = 3000000,
      .bus_num = 0,
      .chip_select = 2,
    },
    {
      .name = "mc13783",
      .max_speed_hz = 3000000,
      .bus_num = 1,
      .chip_select = 0,
    },
};

spi_register_board_info(imx27pdk_spi_board_info, ARRAY_SIZE(imx27pdk_spi_board_info));
imx27_add_spi0(&imx27pdk_spi_0_data);
imx27_add_spi1(&imx27pdk_spi_1_data);


Is this OK ? I.e. I'm not sure how to use bus_num and chip_select


Filip 




More information about the barebox mailing list