30 Oct, 2013

9 commits

  • Current code keeps the clocks enabled all the time, it wastes the power
    when there is no operaiton on the spi controller.

    In order to save the power, this patch adds the two hooks:
    spi_imx_prepare_message: enable the clocks for this message
    spi_imx_unprepare_message: disable the clocks.

    This patch also disables the clocks in the end of the probe.

    Signed-off-by: Huang Shijie
    Signed-off-by: Mark Brown

    Huang Shijie
     
  • 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
    Signed-off-by: Huang Shijie

    Axel Lin
     
  • Enable auto loading by udev when spi-imx is compiled as a module.

    Signed-off-by: Niels de Vos
    Signed-off-by: Mark Brown
    Signed-off-by: Huang Shijie

    Niels de Vos
     
  • clk_prepare_enable() may fail, so let's check its return value and propagate it
    in the case of error.

    While at it, fix the order of clk_disable_unprepare calls: clk_ipg should be
    disabled first, followed by clk_per.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Mark Brown
    Signed-off-by: Huang Shijie

    Fabio Estevam
     
  • Using devm functions can make the code smaller and cleaner.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Mark Brown
    Signed-off-by: Huang Shijie

    Fabio Estevam
     
  • Fix compilation error due to a typo introduced by commit 24778be20f
    ("spi: convert drivers to use bits_per_word_mask"). Without this patch
    we get the following build errors:

    drivers/spi/spi-imx.c: In function ‘spi_imx_setupxfer’:
    drivers/spi/spi-imx.c:703:2: warning: no return statement in function returning non-void [-Wreturn-type]
    drivers/spi/spi-imx.c: At top level:
    drivers/spi/spi-imx.c:705:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘->’ token
    drivers/spi/spi-imx.c:707:2: error: expected identifier or ‘(’ before ‘return’
    drivers/spi/spi-imx.c:708:1: error: expected identifier or ‘(’ before ‘}’ token

    Signed-off-by: Sachin Kamat
    Cc: Stephen Warren
    Signed-off-by: Mark Brown
    Signed-off-by: Huang Shijie

    Sachin Kamat
     
  • Fill in the recently added spi_master.bits_per_word_mask field in as
    many drivers as possible. Make related cleanups, such as removing any
    redundant error-checking, or empty setup callbacks.

    Signed-off-by: Stephen Warren
    Acked-by: H Hartley Sweeten
    Signed-off-by: Mark Brown
    Signed-off-by: Huang Shijie

    Stephen Warren
     
  • Since commit ab78029 (drivers/pinctrl: grab default handles from device core),
    we can rely on device core for handling pinctrl.

    So remove devm_pinctrl_get_select_default() from the driver.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Mark Brown
    Signed-off-by: Huang Shijie

    Fabio Estevam
     
  • The driver core clears the driver data to NULL after device_release
    or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d
    (device-core: Ensure drvdata = NULL when no driver is bound).
    Thus, it is not needed to manually clear the device driver data to NULL.

    Signed-off-by: Jingoo Han
    Acked-by: Grant Likely
    Signed-off-by: Mark Brown
    Signed-off-by: Huang Shijie

    Jingoo Han
     

05 Feb, 2013

1 commit


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
     

03 Oct, 2012

1 commit

  • Pull spi updates from Mark Brown:
    "No framework work here, only a bunch of driver updates of varying
    sizes:

    - Factoring out of the core hardware support from the MXS MMC driver
    by Marek Vasut to allow the hardware to also be used for SPI.
    - Lots of error handling cleanups from Guenter Roeck
    - Removal of the existing Tegra driver which is quite comprehensively
    broken as detailed in the changelog for the removal.
    - DT suppport for the PL022 and GPIO drivers.
    - pinctrl support for OMAP and PL022."

    Pulling from Mark Brown as Grant Likely is still busy moving.

    * tag 'spi-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc: (53 commits)
    spi: remove completely broken Tegra driver
    spi/imx: set the inactive state of the clock according to the clock polarity
    spi/pl022: get/put resources on suspend/resume
    spi/pl022: use more managed resources
    spi/pl022: Devicetree support w/o platform data
    spi/s3c64xx: Don't free controller_data on non-dt platforms
    spi: omap2-mcspi: add pinctrl support
    spi/pl022: adopt pinctrl support
    spi: omap2-mcspi: Cleanup the omap2_mcspi_txrx_dma function
    spi/gpio: Fix stub for spi_gpio_probe_dt()
    spi/mxs: Make the SPI block clock speed configurable via DT
    spi: spi-sh-hspi: drop frees of devm_ alloc'd data
    spi/pl022: Fix chipselects pointer computation
    spi: spi-tle62x0: Use module_spi_driver macro
    mxs/spi: Rework the mxs_ssp_timeout to be more readable
    mxs/spi: Decrement the DMA/PIO border
    mxs/spi: Increment the transfer length only if transfer succeeded
    mxs/spi: Fix issues when doing long continuous transfer
    spi: spi-gpio: Add DT bindings
    spi: spi-gpio: store chipselect information in private structure
    ...

    Linus Torvalds
     

02 Oct, 2012

1 commit

  • Pull ARM soc multiplatform enablement from Olof Johansson:
    "This is a pretty significant branch. It's the introduction of the
    first multiplatform support on ARM, and with this (and the later
    branch) merged, it is now possible to build one kernel that contains
    support for highbank, vexpress, mvebu, socfpga, and picoxcell. More
    platforms will be convered over in the next few releases.

    Two critical last things had to be done for this to be practical and
    possible:
    * Today each platform has its own include directory under
    mach-/include/mach/*, and traditionally that is where a lot
    of driver/platform shared definitions have gone, such as platform
    data structures. They now need to move out to a common location
    instead, and this branch moves a large number of those out to
    include/linux/platform_data.
    * Each platform used to list the device trees to compile for its
    boards in mach-/Makefile.boot.

    Both of the above changes will mean that there are some merge
    conflicts to come (and some to resolve here). It's a one-time move
    and once it settles in, we should be good for quite a while. Sorry
    for the overhead."

    Fix conflicts as per Olof.

    * tag 'multiplatform' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (51 commits)
    ARM: add v7 multi-platform defconfig
    ARM: msm: Move core.h contents into common.h
    ARM: highbank: call highbank_pm_init from .init_machine
    ARM: dtb: move all dtb targets to common Makefile
    ARM: spear: move platform_data definitions
    ARM: samsung: move platform_data definitions
    ARM: orion: move platform_data definitions
    ARM: vexpress: convert to multi-platform
    ARM: initial multiplatform support
    ARM: mvebu: move armada-370-xp.h in mach dir
    ARM: vexpress: remove dependency on mach/* headers
    ARM: picoxcell: remove dependency on mach/* headers
    ARM: move all dtb targets out of Makefile.boot
    ARM: picoxcell: move debug macros to include/debug
    ARM: socfpga: move debug macros to include/debug
    ARM: mvebu: move debug macros to include/debug
    ARM: vexpress: move debug macros to include/debug
    ARM: highbank: move debug macros to include/debug
    ARM: move debug macros to common location
    ARM: make mach/gpio.h headers optional
    ...

    Linus Torvalds
     

28 Sep, 2012

1 commit

  • There are SPI devices which need a SPI clock with active low polarity and
    high inactive state.

    Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
    according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

    DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
    DT with "spi-cpol" = 1 = clock active low polarity = inactive state high

    Signed-off-by: Knut Wohlrab
    Signed-off-by: Dirk Behme
    Acked-by: Shawn Guo
    Signed-off-by: Mark Brown

    Knut Wohlrab
     

14 Sep, 2012

1 commit

  • Platform data for device drivers should be defined in
    include/linux/platform_data/*.h, not in the architecture
    and platform specific directories.

    This moves such data out of the imx include directories

    Signed-off-by: Arnd Bergmann
    Acked-by: Mark Brown
    Acked-by: Greg Kroah-Hartman
    Acked-by: Nicolas Pitre
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Sascha Hauer
    Acked-by: Vinod Koul
    Cc: Russell King
    Cc: Dan Williams
    Cc: "Ben Dooks (embedded platforms)"
    Cc: "Wolfram Sang (embedded platforms)"
    Cc: Chris Ball
    Cc: David Woodhouse
    Cc: Grant Likely
    Cc: Alan Cox
    Cc: Felipe Balbi
    Cc: Alan Stern
    Cc: Florian Tobias Schandinat
    Cc: Liam Girdwood
    Cc: Javier Martin
    Cc: Shawn Guo
    Cc: Guennadi Liakhovetski

    Arnd Bergmann
     

03 Aug, 2012

1 commit


13 Jul, 2012

2 commits


14 May, 2012

1 commit


12 May, 2012

1 commit


25 Apr, 2012

1 commit

  • the current i.MX clock support groups together unrelated clocks
    to a single clock which is then used by the driver. This can't
    be accomplished with the generic clock framework so we instead
    request the individual clocks in the driver. For i.MX there are
    generally three different clocks:

    ipg: bus clock (needed to access registers)
    ahb: dma relevant clock, sometimes referred to as hclk in the datasheet
    per: bit clock, pixel clock

    This patch changes the driver to request the individual clocks.
    Currently all clk_get will get the same clock until the SoCs
    are converted to the generic clock framework

    Signed-off-by: Sascha Hauer

    Sascha Hauer
     

11 Apr, 2012

1 commit


31 Mar, 2012

1 commit


10 Mar, 2012

1 commit


25 Oct, 2011

1 commit

  • For simple modules that contain a single platform_driver without any
    additional setup code then ends up being a block of duplicated
    boilerplate. This patch adds a new macro, module_platform_driver(),
    which replaces the module_init()/module_exit() registrations with
    template functions.

    Signed-off-by: Grant Likely
    Acked-by: Greg Kroah-Hartman
    Reviewed-by: Magnus Damm
    Reviewed-by: Mark Brown
    Reviewed-by: Stephen Boyd

    Grant Likely
     

16 Sep, 2011

1 commit

  • commit 22a85e4cd51 (spi/imx: add device tree probe support) broke spi-imx usage
    when the SPI chipselect is the one internal to the controller.

    On a mx31pdk board the following error is seen:

    Registering mxc_nand as whole device
    ------------[ cut here ]------------
    WARNING: at drivers/gpio/gpiolib.c:101 gpio_ensure_requested+0x4c/0xf4()
    autorequest GPIO-0
    Modules linked in:
    [] (unwind_backtrace+0x0/0xf4) from [] (warn_slowpath_common+0x4c/0x64)
    [] (warn_slowpath_common+0x4c/0x64) from [] (warn_slowpath_fmt+0x30/0x40)
    [] (warn_slowpath_fmt+0x30/0x40) from [] (gpio_ensure_requested+0x4c/0xf4)
    [] (gpio_ensure_requested+0x4c/0xf4) from [] (gpio_direction_output+0xa0/0x138)
    [] (gpio_direction_output+0xa0/0x138) from [] (spi_imx_setup+0x38/0x4c)
    [] (spi_imx_setup+0x38/0x4c) from [] (spi_setup+0x38/0x50)
    [] (spi_setup+0x38/0x50) from [] (spi_add_device+0x94/0x124)
    [] (spi_add_device+0x94/0x124) from [] (spi_new_device+0x74/0xac)
    [] (spi_new_device+0x74/0xac) from [] (spi_match_master_to_boardinfo+0x20/0x40)
    [] (spi_match_master_to_boardinfo+0x20/0x40) from [] (spi_register_master+0xb0/0x104)
    [] (spi_register_master+0xb0/0x104) from [] (spi_bitbang_start+0x104/0x17c)
    [] (spi_bitbang_start+0x104/0x17c) from [] (spi_imx_probe+0x2fc/0x404)
    [] (spi_imx_probe+0x2fc/0x404) from [] (platform_drv_probe+0x18/0x1c)
    [] (platform_drv_probe+0x18/0x1c) from [] (driver_probe_device+0x78/0x174)
    [] (driver_probe_device+0x78/0x174) from [] (__driver_attach+0x8c/0x90)
    [] (__driver_attach+0x8c/0x90) from [] (bus_for_each_dev+0x60/0x8c)
    [] (bus_for_each_dev+0x60/0x8c) from [] (bus_add_driver+0xa0/0x288)
    [] (bus_add_driver+0xa0/0x288) from [] (driver_register+0x78/0x18c)
    [] (driver_register+0x78/0x18c) from [] (do_one_initcall+0x34/0x178)
    [] (do_one_initcall+0x34/0x178) from [] (kernel_init+0x74/0x118)
    [] (kernel_init+0x74/0x118) from [] (kernel_thread_exit+0x0/0x8)
    ---[ end trace 759f924b30fd5a44 ]---

    Fix this issue by using the original chip select logic and make spi-imx to work again.

    Tested on a mx31pdk that uses the hardware SPI chipselect pins and also
    on a mx27pdk that uses GPIO as SPI chipselect.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Grant Likely

    Fabio Estevam
     

15 Jul, 2011

7 commits

  • It adds device tree probe support for spi-imx driver.

    Signed-off-by: Shawn Guo
    Cc: Grant Likely
    Signed-off-by: Grant Likely

    Shawn Guo
     
  • It copies gpio number passed via platform data embedded pointer into
    driver private data, so that we do not need to refer to this embedded
    pointer passed by platform data after probe function exits.

    Signed-off-by: Shawn Guo
    Cc: Uwe Kleine-König
    Cc: Sascha Hauer
    Cc: Grant Likely
    Signed-off-by: Grant Likely

    Shawn Guo
     
  • Software defined version number is not stable enough to be used
    in device type naming scheme. The patch changes it to use implicit
    soc name for spi device type definition. In this way, we can easily
    align the naming scheme with device tree binding, which comes later.

    It removes fifosize from spi_imx_data and adds devtype there, so that
    fifosize can be set in an inline function according to devtype.
    Also, cpu_is_mx can be replaced by inline functions checking devtype.

    Signed-off-by: Shawn Guo
    Cc: Uwe Kleine-König
    Cc: Sascha Hauer
    Cc: Grant Likely
    Signed-off-by: Grant Likely

    Shawn Guo
     
  • The only difference between SPI_IMX_VER_0_7 and SPI_IMX_VER_0_4 is
    .config function. The patch uses cpu_is_mx35 (to be removed) as the
    temporary solution to consolidate functions spi_imx0_4_config and
    spi_imx0_7_config into mx31_config. As a result, type SPI_IMX_VER_0_7
    can be merged into SPI_IMX_VER_0_4.

    It also renames function spi_imx0_4_reset to mx31_reset to keep
    consistency with other function naming.

    A couple of redundant macros, MX3_CSPISTAT and MX3_CSPISTAT_RR,
    together with the useless type SPI_IMX_VER_0_5 also get cleaned up.

    Signed-off-by: Shawn Guo
    Cc: Uwe Kleine-König
    Cc: Sascha Hauer
    Cc: Grant Likely
    Signed-off-by: Grant Likely

    Shawn Guo
     
  • It's confusing to use spi_imx2_3 to name SPI_IMX_VER_2_3 function
    and macro, as it easily make people think of imx2 and imx3. It's
    better to use specific soc name just like what other SPI_IMX_VER
    do. For SPI_IMX_VER_2_3 case, it will be mx51. To distinguish it
    from CSPI on mx51, mx51_ecspi might be a good choice.

    Signed-off-by: Shawn Guo
    Cc: Uwe Kleine-König
    Cc: Sascha Hauer
    Cc: Grant Likely
    Signed-off-by: Grant Likely

    Shawn Guo
     
  • SPI_IMX_VER_0_0 covers i.mx21 and i.mx27. It makes more sense to
    use mx21 rather than mx27 to name SPI_IMX_VER_0_0 function and
    macro, since i.mx21 comes out ealier than i.mx27.

    Signed-off-by: Shawn Guo
    Cc: Uwe Kleine-König
    Cc: Sascha Hauer
    Cc: Grant Likely
    Signed-off-by: Grant Likely

    Shawn Guo
     
  • spi_imx_devtype_data has already been driver private data. There is
    really no need to make a copy in spi_imx_data. Instead, a reference
    pointer works perfectly fine.

    Signed-off-by: Shawn Guo
    Signed-off-by: Grant Likely

    Shawn Guo
     

06 Jun, 2011

1 commit

  • Sort the SPI makefile and enforce the naming convention spi_*.c for
    spi drivers.

    This change also rolls the contents of atmel_spi.h into the .c file
    since there is only one user of that particular include file.

    v2: - Use 'spi-' prefix instead of 'spi_' to match what seems to be
    be the predominant pattern for subsystem prefixes.
    - Clean up filenames in Kconfig and header comment blocks

    Signed-off-by: Grant Likely
    Acked-by: Wolfram Sang
    Acked-by: Linus Walleij

    Grant Likely