OpenWrt Forum Archive

Topic: SPI based radio interface with AR9331

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,

I would like to connect SPI based RF radio with AR9331.

I have gone through data sheet for AR9331 and it shows it has three different chip select for SPI.

The SPI_CS0 is used for SPI flash memory. I would like to use SPI_CS1 for interfacing my radio.

I have tried to disable the SPI_CS0 and try to use SPI_CS1, but i was not able to achieve this with the same.

I have try to read and write SPI register with different configuration but not able to achieve the same.

Regards,
Lalit Shah

(Last edited by lshah21 on 18 Sep 2014, 12:12)

For example, profile for device:

...
...
static struct ath79_spi_controller_data device_spi0_cdata = {
    .cs_type = ATH79_SPI_CS_TYPE_INTERNAL,
    .cs_line = 0,
    .is_flash = true,
};

static struct ath79_spi_controller_data device_spi1_cdata = {
    .cs_type = ATH79_SPI_CS_TYPE_INTERNAL,
    .cs_line = 1,
};

static struct spi_board_info device_spi_info[] = {
    {
        .bus_num    = 0,
        .chip_select    = 0,
        .max_speed_hz    = 25000000,
        .modalias    = "m25p80",
        .platform_data  = &device_spi_flash_data,
        .controller_data = &device_spi0_cdata
    }, {
        .bus_num    = 0,
        .chip_select    = 1,
        .max_speed_hz    = 25000000,
        .modalias    = "spidev",
        .platform_data  = &device_spi_flash_data,
        .controller_data = &device_spi1_cdata
    }
};

static struct ath79_spi_platform_data device_spi_data __initdata = {
            .bus_num = 0,
            .num_chipselect = 2,
    };

...
...

spi_register_board_info(device_spi_info,
            ARRAY_SIZE(device_spi_info));
...
...

(Last edited by Deoptim on 18 Sep 2014, 22:05)

Hi,

I have added two SPI interface (SPI Chip Select 0 and 1) based on above code in my plateform.c file for AR9331 Board.

Then, I have compiled linux kernel image and flashed it into my AR9331 Board.

But, I haven't found any entries of both SPI devices into /dev as well as /sys/class directory. Also, I couldn't found any debug message regarding SPI devices in bootup message of kernel.

Do you have any idea about this issue?

Regards,
Lalit Shah

The discussion might have continued from here.