Yes, now with this patch, full duplex communication is possible. There is a
need to update the spidev sunxi wiki.

Regards
On 25 Oct 2014 17:15, "Henrik Nordström" <[email protected]> wrote:

> Ah, sorry! didn't notice the attachment. Thanks!
>
> Regards
> Henrik
>
> lör 2014-10-25 klockan 18:10 +0200 skrev Henrik Nordström:
> > Can you please resend the patch as a unified diff (diff -u oldfile
> > newfile). Patches in ed format is not can not be applied or reviewed.
> >
> >
> > lör 2014-10-25 klockan 09:51 +0100 skrev Gnichi Mohamed:
> > > This is the patch that i gathered from the discussion. I tested it
> > > with mcp3008 adc full duplex communication and it works as a charm.
> > >
> > >
> > >
> > > 2014-10-25 9:19 GMT+01:00 Henrik Nordström
> > > <[email protected]>:
> > >         Can you please resend this as a unified diff? (diff -u)
> > >
> > >
> > >         fre 2014-10-24 klockan 01:04 -0700 skrev Gnichi Mohamed:
> > >         > I made a cooking of patches in case any one needs it. Mo
> > >         >
> > >         >
> > >         > 513,519d512
> > >         > < /* keep unused burst */
> > >         > < void spi_clear_dhb(void *base_addr)
> > >         > < {
> > >         > <         u32 reg_val = readl(base_addr + SPI_CTL_REG);
> > >         > <         reg_val &= ~SPI_CTL_DHB;
> > >         > <         writel(reg_val, base_addr + SPI_CTL_REG);
> > >         > < }
> > >         > 591a585
> > >         > >     aw_spi_sel_dma_type(0, aw_spi->base_addr);
> > >         > 617c611,612
> > >         > <     spin_unlock_irqrestore(&aw_spi->lock, flags);
> > >         > ---
> > >         > >     aw_spi_sel_dma_type(0, aw_spi->base_addr);
> > >         > >     spin_unlock_irqrestore(&aw_spi->lock, flags);
> > >         > 958,960c953,956
> > >         > <     #else
> > >         > <                aw_spi_sel_dma_type(1, base_addr);
> > >         > <     #endif
> > >         > ---
> > >         > >         aw_spi_sel_dma_type(0, base_addr);
> > >         > >         #else
> > >         > >         aw_spi_sel_dma_type(1, base_addr);
> > >         > >         #endif
> > >         > 1008,1009c1004
> > >         > <         unsigned int poll_time_rx = 0x7ffff;
> > >         > <                 unsigned int poll_time_tx = 0xfffff;
> > >         > ---
> > >         > >         unsigned int poll_time = 0xfffff;
> > >         > 1016,1022c1011
> > >         > <         aw_spi_start_xfer(base_addr);
> > >         > <                 if (tx_len) {
> > >         > <                         while
> > >         ( aw_spi_query_txfifo(base_addr) &&
> > >         > (--poll_time_tx > 0) ); //txFIFO counter
> > >         > <                         if ( poll_time_tx <= 0 ) {
> > >         > <                                 spi_wrn("cpu tx data time
> > >         out!\n");
> > >         > <                         }
> > >         > <                 }
> > >         > ---
> > >         > >         aw_spi_start_xfer(base_addr);
> > >         > 1024c1013
> > >         > <             while(rx_len && (--poll_time_rx >0)) {
> > >         > ---
> > >         > >             while(rx_len && (--poll_time >0)) {
> > >         > 1026,1032c1015,1019
> > >         > <                    if (aw_spi_query_rxfifo(base_addr)) {
> > >         > <                                         *rx_buf++ =
> > >         readb(base_addr
> > >         > + SPI_RXDATA_REG); //fetch data
> > >         > <                                        --rx_len;
> > >         > <                                 }
> > >         > <                                 if ( poll_time_rx <= 0 ) {
> > >         > <                                         spi_wrn("cpu rx
> > >         data time
> > >         > out!\n");
> > >         > <                                }
> > >         > ---
> > >         > >                 if(aw_spi_query_rxfifo(base_addr)){
> > >         > >                     *rx_buf++ =  readb(base_addr +
> > >         > SPI_RXDATA_REG);//fetch data
> > >         > >                     --rx_len;
> > >         > >                     poll_time = 0xffff;
> > >         > >                 }
> > >         > 1034c1021,1025
> > >         > <
> > >         > ---
> > >         > >         } else {
> > >         > >
> > >          while(aw_spi_query_txfifo(base_addr)&&(--poll_time > 0)
> > >         > );/* txFIFO counter */
> > >         > >         }
> > >         > >         if(poll_time <= 0) {
> > >         > >             spi_wrn("cpu tx data time out!\n");
> > >         > 1093,1096d1083
> > >         > <                                     /* full duplex mode */
> > >         > <                         if (t->rx_buf && t->tx_buf)
> > >         > <                         spi_clear_dhb(aw_spi->base_addr);
> > >         > <
> > >         >
> > >         >
> > >         >
> > >         > --
> > >
> > >         > You received this message because you are subscribed to the
> > >         Google
> > >         > Groups "linux-sunxi" group.
> > >         > To unsubscribe from this group and stop receiving emails
> > >         from it, send
> > >         > an email to [email protected].
> > >         > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > >         --
> > >         You received this message because you are subscribed to a
> > >         topic in the Google Groups "linux-sunxi" group.
> > >         To unsubscribe from this topic, visit
> > >
> https://groups.google.com/d/topic/linux-sunxi/RpjSIJNJjTM/unsubscribe.
> > >         To unsubscribe from this group and all its topics, send an
> > >         email to [email protected].
> > >         For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "linux-sunxi" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> > > an email to [email protected].
> > > For more options, visit https://groups.google.com/d/optout.
> >
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "linux-sunxi" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/linux-sunxi/RpjSIJNJjTM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to