enable spi (mars board )

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

enable spi (mars board )

606 Views
hamzadardour
Contributor II

Hi everyone,

I would like enable spi for user space, because I don't find spix.x in /dev.

I enter the command ( modprobe spidev ) and it works ( verefied with lsmod ).

I found in some forums that I have to change the code of the  file ( board-mx6q_marsboard.c )  to add spi for user space, but I don't know the gpio that I can use for the Cselect , this is the  part of the code that could enable the spi ,

( the code between starts is what I had added )

could you help me please ,

/* start

#define MX6Q_MARSBOARD_ECSPI1_CS0  IMX_GPIO_NR(2, 30)
#define MX6Q_MARSBOARD_ECSPI2_CS0  IMX_GPIO_NR(2, 27)
#define MX6Q_MARSBOARD_ECSPI3_CS0  IMX_GPIO_NR(**, **)   ( I don't know gpios number

static int mx6q_marsboard_spi0_cs[] = {

        MX6Q_MARSBOARD_ECSPI1_CS0,

};

static const struct spi_imx_master mx6q_marsboard_spi0_data __initconst = {

        .chipselect     = mx6q_marsboard_spi0_cs,

        .num_chipselect = ARRAY_SIZE(mx6q_marsboard_spi0_cs),

};

static int mx6q_marsboard_spi1_cs[] = {

        MX6Q_MARSBOARD_ECSPI2_CS0,

};

static const struct spi_imx_master mx6q_marsboard_spi1_data __initconst = {

        .chipselect     = mx6q_marsboard_spi1_cs,

        .num_chipselect = ARRAY_SIZE(mx6q_marsboard_spi1_cs),

};

//********************************** my code 1

static int mx6q_marsboard_spi2_cs[] = {

        MX6Q_MARSBOARD_ECSPI3_CS0,

};

static const struct spi_imx_master mx6q_marsboard_spi2_data __initconst = {

        .chipselect     = mx6q_marsboard_spi2_cs,

        .num_chipselect = ARRAY_SIZE(mx6q_marsboard_spi2_cs),

};

//***************************** end of my code 1

static struct spi_board_info imx6_marsboard_spi_devices[] __initdata = {

#if defined(CONFIG_MTD_M25P80)

    {

        .modalias = "m25p80",

        .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */

        .bus_num = 0,

        .chip_select = 0,

        .platform_data = &imx6_marsboard__spi_flash_data,

    },

#endif

        {

                .modalias = "ads7846",

                .bus_num = 1,

                .chip_select = 0,

                .max_speed_hz = 1500000,

                .irq = gpio_to_irq(MX6Q_MARSBOARD_RES_TCH_INT),

                .platform_data = &ads7846_config,

        },

//***************** my code 2

    {

        .modalias = "spidev",

        .max_speed_hz = 48000000, //48 Mbps

        .bus_num = 2,

        .chip_select = 0,

        .mode = 0,

    },

//****************** end of my code 2

};

*/ end

Labels (1)
0 Kudos
0 Replies