lkml.org 
[lkml]   [2015]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 04/18] spi-xilinx: Simplify spi_fill_tx_fifo
    On Fri, Jan 23, 2015 at 05:08:36PM +0100, Ricardo Ribalda Delgado wrote:
    > Instead of checking the TX_FULL flag for every transaction, find out the
    > size of the buffer at probe time and use it.

    So, I see what's going on here and the potential performance benefit
    from avoiding the MMIO access. However I can't help but worry that this
    makes things more fragile - the current code will transparently handle
    any races or anything which result in a misfilling of the FIFO for some
    reason either now or in the future as performance is improved and the
    driver gets more fancy.

    As things stand if I look at the code it's fairly clear it should be
    safe and unfortunately we only have an underrun interrupt which will be
    triggered normally (no overflow interrupt) so we can't really use that
    to add a bit of robustness. I'm tempted to suggest checking that we did
    trigger the FIFO full flag when we fill the FIFO but that feels like
    overengineering.

    Let me think about this, I'll probably apply it but if you can think
    about ways of making this more robust that'd be good.

    > @@ -413,6 +424,8 @@ static int xilinx_spi_probe(struct platform_device *pdev)
    > goto put_master;
    > }
    >
    > + xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
    > +
    > /* SPI controller initializations */
    > xspi_init_hw(xspi);

    It seems safer to reset the hardware, probe the FIFO size and then reset
    the hardware again in case something decided to leave some data in the
    FIFO (perhaps some bootloader wasn't as well programmed as one might
    desire for example). Not cricial now but it could again become
    important with future optimizations.
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2015-01-27 01:01    [W:4.163 / U:0.148 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site