13 Mar, 2014

1 commit


03 Mar, 2014

1 commit

  • there are many SPI clients which use the following protocal:
    step 1: send command bytes to clients(rx buffer is empty)
    step 2: send data bytes to clients or receive data bytes from
    clients.
    SiRFprimaII provides a shortcut for this kind of SPI transfer.
    when tx buf is less or equal than 4 bytes and rx buf is null
    in a transfer, we think it as 'command' data and use hardware
    command register for the transfer.
    here we can save some CPU loading than doing both tx and rx
    for a normal transfer.

    Signed-off-by: Qipan Li
    Signed-off-by: Barry Song
    Signed-off-by: Mark Brown

    Qipan Li
     

27 Feb, 2014

1 commit


24 Feb, 2014

2 commits


03 Feb, 2014

1 commit


17 Jan, 2014

1 commit


15 Nov, 2013

1 commit


17 Sep, 2013

1 commit

  • Many drivers that use bitbang library have a leak on probe error paths.
    This is because once a spi_master_get() call succeeds, we need an additional
    spi_master_put() call to free the memory.

    Fix this issue by moving the code taking a reference to master to
    spi_bitbang_start(), so spi_bitbang_start() will take a reference to master on
    success. With this change, the caller is responsible for calling
    spi_bitbang_stop() to decrement the reference and spi_master_put() as
    counterpart of spi_alloc_master() to prevent a memory leak.

    So now we have below patten for drivers using bitbang library:

    probe:
    spi_alloc_master -> Init reference count to 1
    spi_bitbang_start -> Increment reference count
    remove:
    spi_bitbang_stop -> Decrement reference count
    spi_master_put -> Decrement reference count (reference count reaches 0)

    Fixup all users accordingly.

    Signed-off-by: Axel Lin
    Suggested-by: Uwe Kleine-Koenig
    Acked-by: Uwe Kleine-Koenig
    Signed-off-by: Mark Brown

    Axel Lin
     

01 Sep, 2013

1 commit


29 Aug, 2013

1 commit


26 Aug, 2013

1 commit

  • the unit of len of spi_transfer is in bytes, not in spi words. the
    old codes misunderstood that and thought the len is the amount of
    spi words. but it is actually how many bytes existing in the spi
    buffer.

    this patch fixes that and also rename left_tx_cnt and left_rx_cnt
    to left_tx_word and left_rx_word to highlight they are in words.

    Signed-off-by: Qipan Li
    Signed-off-by: Barry Song
    Signed-off-by: Mark Brown

    Qipan Li
     

23 Aug, 2013

1 commit


15 Aug, 2013

1 commit

  • Remove unneeded error handling on the result of a call to
    platform_get_resource when the value is passed to devm_ioremap_resource.

    Move the call to platform_get_resource adjacent to the call to
    devm_ioremap_resource to make the connection between them more clear.

    A simplified version of the semantic patch that makes this change is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @@
    expression pdev,res,n,e,e1;
    expression ret != 0;
    identifier l;
    @@

    - res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    ... when != res
    - if (res == NULL) { ... \(goto l;\|return ret;\) }
    ... when != res
    + res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    e = devm_ioremap_resource(e1, res);
    //

    Signed-off-by: Julia Lawall
    Acked-by: Barry Song
    Signed-off-by: Mark Brown

    Julia Lawall
     

06 Aug, 2013

1 commit

  • this patch enables DMA support for SiRFSoC SPI driver, if both
    buffers and length are aligned with DMA controller's hardware
    limitation, use generic SiRF generic dmaengine driver.

    for PIO, SiRF SPI controller actually is using rx to trigger rx,
    that means if we write any word to tx fifo, we will get a word
    from rx fifo. for DMA, we use two different channel for tx and
    rx, and issue them both for every transfer.

    Signed-off-by: Barry Song
    Signed-off-by: Mark Brown

    Barry Song
     

15 Jul, 2013

1 commit


26 Jun, 2013

1 commit


03 Jun, 2013

1 commit

  • 24778be20 "spi: convert drivers to use bits_per_word_mask"
    removed the "default" statement in the spi_sirfsoc_setup_transfer
    switch, causing a new warning:

    drivers/spi/spi-sirf.c: In function 'spi_sirfsoc_setup_transfer':
    arch/arm/include/asm/io.h:90:2: warning: 'rxfifo_ctrl' may be used uninitialized in this function [-Wmaybe-uninitialized]
    asm volatile("str %1, %0"
    ^
    drivers/spi/spi-sirf.c:364:19: note: 'rxfifo_ctrl' was declared here
    u32 txfifo_ctrl, rxfifo_ctrl;
    ^

    The compiler has correctly identified that this case may happen,
    but since we know that things are horribly broken if bits_per_word
    is ever something other than the values we tested, calling BUG()
    is an appropriate action and tells the compiler that execution
    will not continue afterwards.

    Signed-off-by: Arnd Bergmann
    Cc: Stephen Warren
    Cc: Mark Brown
    Signed-off-by: Mark Brown

    Arnd Bergmann
     

30 May, 2013

1 commit


21 May, 2013

1 commit

  • currently, spi irq handler only does rx processing and fetching data from rx
    fifo when "FRM_END" irq happens. FRM_END indicates one transfer completes. if
    rx size is less than 256, it works well.
    but the problem is that spi rx fifo size is only 256 bytes, then if data size
    of one frame is more than 256, before FRM_END comes, rx fifo will be filled with
    RXFIFO_OFLOW overflow interrupt, it will make us lose some data due to fifo
    overflow.
    Explicitly we need do fetch work from device rx fifo in irq handler not only in
    "FRM_END" irq but also in "THD_REACH" irq. THD_REACH means rx fifo has come to
    its threshold and will come to overflow if we don't take data from it in time.

    In this patch, we fix this issue. we take data from rx fifo when either FRM_END
    or RX_THD_REACH irq comes, we put data into tx fifo when either TX_FIFO_EMPTY
    or TX_THD_REACH irq comes.

    Signed-off-by: Qipan Li
    Signed-off-by: Zhiwu Song
    Signed-off-by: Barry Song
    Signed-off-by: Mark Brown

    Qipan Li
     

13 May, 2013

1 commit


24 Apr, 2013

1 commit


22 Feb, 2013

1 commit

  • Pull driver core patches from Greg Kroah-Hartman:
    "Here is the big driver core merge for 3.9-rc1

    There are two major series here, both of which touch lots of drivers
    all over the kernel, and will cause you some merge conflicts:

    - add a new function called devm_ioremap_resource() to properly be
    able to check return values.

    - remove CONFIG_EXPERIMENTAL

    Other than those patches, there's not much here, some minor fixes and
    updates"

    Fix up trivial conflicts

    * tag 'driver-core-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (221 commits)
    base: memory: fix soft/hard_offline_page permissions
    drivercore: Fix ordering between deferred_probe and exiting initcalls
    backlight: fix class_find_device() arguments
    TTY: mark tty_get_device call with the proper const values
    driver-core: constify data for class_find_device()
    firmware: Ignore abort check when no user-helper is used
    firmware: Reduce ifdef CONFIG_FW_LOADER_USER_HELPER
    firmware: Make user-mode helper optional
    firmware: Refactoring for splitting user-mode helper code
    Driver core: treat unregistered bus_types as having no devices
    watchdog: Convert to devm_ioremap_resource()
    thermal: Convert to devm_ioremap_resource()
    spi: Convert to devm_ioremap_resource()
    power: Convert to devm_ioremap_resource()
    mtd: Convert to devm_ioremap_resource()
    mmc: Convert to devm_ioremap_resource()
    mfd: Convert to devm_ioremap_resource()
    media: Convert to devm_ioremap_resource()
    iommu: Convert to devm_ioremap_resource()
    drm: Convert to devm_ioremap_resource()
    ...

    Linus Torvalds
     

05 Feb, 2013

3 commits


26 Jan, 2013

1 commit

  • Convert all uses of devm_request_and_ioremap() to the newly introduced
    devm_ioremap_resource() which provides more consistent error handling.

    devm_ioremap_resource() provides its own error messages so all explicit
    error messages can be removed from the failure code paths.

    Signed-off-by: Thierry Reding
    Cc: Grant Likely
    Signed-off-by: Greg Kroah-Hartman

    Thierry Reding
     

08 Dec, 2012

1 commit

  • CONFIG_HOTPLUG is going away as an option. As result the __dev*
    markings will be going away.

    Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
    and __devexit.

    Bill Pemberton has done most of the legwork on this series. I've used
    his script to purge the attributes from the drivers/gpio tree.

    Reported-by: Bill Pemberton
    Signed-off-by: Grant Likely

    Grant Likely
     

20 May, 2012

1 commit

  • Fix the compiling errors:
    drivers/spi/spi-sirf.c: In function 'spi_sirfsoc_probe':
    drivers/spi/spi-sirf.c:563: error: implicit declaration of function 'pinmux_get'
    drivers/spi/spi-sirf.c:563: warning: assignment makes pointer from integer without a cast
    drivers/spi/spi-sirf.c:568: error: implicit declaration of function 'pinmux_enable'
    drivers/spi/spi-sirf.c:602: error: implicit declaration of function 'pinmux_disable'
    drivers/spi/spi-sirf.c:603: error: implicit declaration of function 'pinmux_put'
    make[3]: *** [drivers/spi/spi-sirf.o] Error 1

    Signed-off-by: Barry Song
    Cc: Guennadi Liakhovetski
    Acked-by: Linus Walleij
    Signed-off-by: Grant Likely

    Barry Song
     

10 Mar, 2012

1 commit

  • CSR SiRFprimaII has two SPIs (SPI0 and SPI1). Features:
    * Master and slave modes
    * 8-/12-/16-/32-bit data unit
    * 256 bytes receive data FIFO and 256 bytes transmit data FIFO
    * Multi-unit frame
    * Configurable SPI_EN (chip select pin) active state
    * Configurable SPI_CLK polarity
    * Configurable SPI_CLK phase
    * Configurable MSB/LSB first

    Signed-off-by: Zhiwu Song
    Signed-off-by: Barry Song
    Signed-off-by: Grant Likely

    Zhiwu Song