On Thu, Sep 9, 2010 at 2:07 PM, Grant Likely <[email protected]> wrote: > On Fri, Sep 03, 2010 at 10:36:54AM +0900, Jassi Brar wrote: >> We can't do without setting channel and bus width to >> same size. >> Inorder to do that, define a new callback to be used >> to do read/write of appropriate widths. >> >> Signed-off-by: Jassi Brar <[email protected]> >> --- >> drivers/spi/spi_s3c64xx.c | 78 >> +++++++++++++++++++++++++++++++++++++------- >> 1 files changed, 65 insertions(+), 13 deletions(-) >> >> diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c >> index 39816bb..8aa9f85 100644 >> --- a/drivers/spi/spi_s3c64xx.c >> +++ b/drivers/spi/spi_s3c64xx.c >> @@ -174,12 +174,59 @@ struct s3c64xx_spi_driver_data { >> unsigned state; >> unsigned cur_mode, cur_bpw; >> unsigned cur_speed; >> + void (*do_xfer)(void *ptr, void *fifo, unsigned sz, bool rd); > > Looking at the code; it appears that it would be better to have > separate read and write transfer hooks. > >> }; >> >> static struct s3c2410_dma_client s3c64xx_spi_dma_client = { >> .name = "samsung-spi-dma", >> }; >> >> +static void s3c64xx_spi_xfer8(void *ptr, void __iomem *fifo, >> + unsigned len, bool read) >> +{ >> + u8 *buf = (u8 *)ptr; > > ptr is already a void* which makes this an unnecessary cast. > >> + int i = 0; >> + >> + if (read) >> + while (i < len) >> + buf[i++] = readb(fifo); > > perhaps ioread8_rep() instead of open-coding? If so, then > ioread*_rep() and iowrite*_rep() can be used in all these cases. > > In fact, the 8, 16 and 32 versions have the same signature and so > could possibly be used directly without these hooks.
Great idea. I have rather avoided new callbacks and directly used the ioread*_rep calls. Also, I had missed setting appropriate bus width while in DMA mode. Resending this again. Thanks. ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ spi-devel-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spi-devel-general
