Issue solved if anyone interested
Just add following code into appropriate files:
!ADD file “ath79_spi_platform.h”
struct ath79_spi_platform_data {
.......
unsigned miso_line;
};
!ADD file “spi-ath79.c”
.......
struct ath79_spi {
.......
unsigned miso_line;
.......
}
.......
static u32 ath79_spi_txrx_mode1(struct spi_device *spi, unsigned nsecs,
u32 word, u8 bits)
{
u32 readword = 0;
struct ath79_spi *sp = ath79_spidev_to_sp(spi);
u32 ioc = sp->ioc_base;
/* clock starts at inactive polarity */
for (word <<= (32 - bits); likely(bits); bits--) {
u32 out;
if (word & (1 << 31))
out = ioc | AR71XX_SPI_IOC_DO;
else
out = ioc & ~AR71XX_SPI_IOC_DO;
/* setup MSB (to slave) on trailing edge */
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out | AR71XX_SPI_IOC_CLK);
ath79_spi_delay(sp, nsecs);
readword <<= 1;
readword |= gpio_get_value(sp->miso_line);
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out);
ath79_spi_delay(sp, nsecs);
word <<= 1;
}
return readword;
}
static u32 ath79_spi_txrx_mode2(struct spi_device *spi, unsigned nsecs,
u32 word, u8 bits)
{
u32 readword = 0;
struct ath79_spi *sp = ath79_spidev_to_sp(spi);
u32 ioc = sp->ioc_base;
/* clock starts at inactive polarity */
for (word <<= (32 - bits); likely(bits); bits--) {
u32 out;
if (word & (1 << 31))
out = ioc | AR71XX_SPI_IOC_DO;
else
out = ioc & ~AR71XX_SPI_IOC_DO;
/* setup MSB (to slave) on trailing edge */
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out);
ath79_spi_delay(sp, nsecs);
readword <<= 1;
readword |= gpio_get_value(sp->miso_line);
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out & ~AR71XX_SPI_IOC_CLK);
ath79_spi_delay(sp, nsecs);
if (bits == 1)
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out);
word <<= 1;
}
return readword;
}
static u32 ath79_spi_txrx_mode3(struct spi_device *spi, unsigned nsecs,
u32 word, u8 bits)
{
u32 readword = 0;
struct ath79_spi *sp = ath79_spidev_to_sp(spi);
u32 ioc = sp->ioc_base;
/* clock starts at inactive polarity */
for (word <<= (32 - bits); likely(bits); bits--) {
u32 out;
if (word & (1 << 31))
out = ioc | AR71XX_SPI_IOC_DO;
else
out = ioc & ~AR71XX_SPI_IOC_DO;
/* setup MSB (to slave) on trailing edge */
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out & ~AR71XX_SPI_IOC_CLK);
ath79_spi_delay(sp, nsecs);
readword <<= 1;
readword |= gpio_get_value(sp->miso_line);
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out);
ath79_spi_delay(sp, nsecs);
word <<= 1;
}
return readword;
}
.......
sp->miso_line = pdata->miso_line;
.......
sp->bitbang.txrx_word[SPI_MODE_1] = ath79_spi_txrx_mode1;
sp->bitbang.txrx_word[SPI_MODE_2] = ath79_spi_txrx_mode2;
sp->bitbang.txrx_word[SPI_MODE_3] = ath79_spi_txrx_mode3;
.......