summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-bcm63xx.c
Commit message (Collapse)AuthorAgeFilesLines
* spi/bcm63xx: fix error return code in bcm63xx_spi_probe()Gustavo A. R. Silva2017-08-081-2/+2
| | | | | | | | | | | | | | | | platform_get_irq() returns an error code, but the spi-bcm63xx driver ignores it and always returns -ENXIO. This is not correct and, prevents -EPROBE_DEFER from being propagated properly. Notice that platform_get_irq() no longer returns 0 on error: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af Print and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: Fix checkpatch warningsAravind Thokala2017-06-211-2/+2
| | | | | | | | | This patch fixes the checkpatch.pl warnings on the driver file. Signed-off-by: Aravind Thokala <aravind.thk@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: fix typo in bcm63xx_spi_max_length breaking compilationJonas Gorski2017-02-211-1/+1
| | | | | | | | | | | | | | | Fix compilation by renaming argument dev to spi as expected by the code. Fixes the following error: drivers/spi/spi-bcm63xx.c: In function ‘bcm63xx_spi_max_length’: drivers/spi/spi-bcm63xx.c:434:50: error: ‘spi’ undeclared (first use in this function) struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); ^~~ Fixes: 0135c03df914 ("spi/bcm63xx: make spi subsystem aware of message size limits") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: allow for probing through devicetreeJonas Gorski2017-02-211-6/+36
| | | | | | | | | | Add required binding support to probe through device tree. Use the compatible instead of the resource size for identifiying the block type, and allow reducing the number of cs lines through OF. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: make spi subsystem aware of message size limitsJonas Gorski2017-02-211-0/+9
| | | | | | | | | | | The bcm63xx SPI controller does not allow manual control of the CS lines and will toggle it automatically before and after sending data, so we are limited to messages that fit in the FIFO buffer. Since the CS lines aren't available as GPIOs either, we will need to make slave drivers aware of this limitation so they can handle them accordingly. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'spi/topic/bcm63xx', 'spi/topic/butterfly', ↵Mark Brown2016-01-111-4/+3
|\ \ | | | | | | | | | 'spi/topic/cadence' and 'spi/topic/davinci' into spi-next
| * | spi/bcm63xx: Move default clock configuration to kill compiler warningGeert Uytterhoeven2015-11-161-4/+3
| |/ | | | | | | | | | | | | | | | | | | | | drivers/spi/spi-bcm63xx.c: In function ‘bcm63xx_spi_setup_transfer’: drivers/spi/spi-bcm63xx.c:207: warning: ‘clk_cfg’ may be used uninitialized in this function While this is a false positive, it can easily be avoided by selecting the default clock configuration first. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: bcm63xx: use correct format string for printing a resourceArnd Bergmann2015-11-161-2/+2
|/ | | | | | | | | | | | | With a 64-bit resource_size_t, we get a build warning on bcm63xx_spi_probe: drivers/spi/spi-bcm63xx.c:565:16: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=] As we are printing a resource, we can just use the %pr format specifier that pretty-prints the address and avoids the warning. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: move register definitions into the driverJonas Gorski2015-10-231-23/+174
| | | | | | | | | | | | | | | | | Move all register definitions and structs into the driver. This allows us dropping the platform_data struct and drop any arch specific includes. Make use of different device names to identify the version of the block we have. Since we now have full control over the message width, we can drop the size check, which was broken anyway, since it never set ret to any error code. Also since we now have no arch depedendent resources, we can now allow compiling it for any arch, hidden behind COMPILE_TEST. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: move message control word description to register offsetsJonas Gorski2015-10-121-4/+3
| | | | | | | | Make the message control word parameters part of the register offsets array so we have them all in one struct. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: fix standard accessors and compile guardJonas Gorski2015-10-121-4/+4
| | | | | | | | Use the correct guard CONFIG_CPU_BIG_ENDIAN and the *be accessors to follow native endianness on big endian systems. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: replace custom io accessors with standard onesJonas Gorski2015-09-141-4/+12
| | | | | | | | Replace all bcm_read* with (io)read. Due to this block following system endianness, make sure we match that. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: hardcode busnum to 0Jonas Gorski2015-09-141-1/+2
| | | | | | | | We always pass 0 as the spi bus number, so we might as well hard code it. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: always use a fixed number of CSJonas Gorski2015-09-141-1/+3
| | | | | | | | We always pass 8 for the number of chip selects, so we can as well hardcode it to this number. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi/bcm63xx: remove unused rx_tail variableJonas Gorski2015-09-141-1/+0
| | | | | | | | | | Fixes the following warning: drivers/spi/spi-bcm63xx.c:125:5: warning: unused variable 'rx_tail' [-Wunused-variable] u8 rx_tail; ^ Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi: Remove FSF mailing addressesJarkko Nikula2014-12-221-4/+0
| | | | | Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* spi: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0
| | | | | | | A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* spi: Remove unneeded include of linux/workqueue.hAxel Lin2014-04-141-1/+0
| | | | | Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
*-. Merge remote-tracking branches 'spi/topic/imx', 'spi/topic/init', ↵Mark Brown2014-03-301-1/+0
|\ \ | | | | | | | | | 'spi/topic/mpc512x-psc', 'spi/topic/mpc52xx', 'spi/topic/mxs', 'spi/topic/nuc900', 'spi/topic/oc-tiny' and 'spi/topic/octeon' into spi-next
| | * spi: delete non-required instances of include <linux/init.h>Paul Gortmaker2014-02-031-1/+0
| |/ | | | | | | | | | | | | | | | | | | None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| |
| \
*-. \ Merge remote-tracking branches 'spi/topic/bus-num', 'spi/topic/cleanup', ↵Mark Brown2014-03-301-1/+2
|\ \ \ | | |/ | |/| | | | 'spi/topic/clps711x', 'spi/topic/coldfire', 'spi/topic/completion' and 'spi/topic/davinci' into spi-next
| | * spi: Use reinit_completion at appropriate placesAxel Lin2014-02-101-1/+2
| |/ | | | | | | | | | | | | | | Calling init_completion() once is enough. For the rest of the iterations, call reinit_completion() instead. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | spi: bcm63xx: Remove unused define for PFXAxel Lin2014-03-251-2/+0
|/ | | | | Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
*---. Merge remote-tracking branches 'spi/topic/bcm2835', 'spi/topic/bcm63xx', ↵Mark Brown2014-01-231-29/+17
|\ \ \ | | | | | | | | | | | | 'spi/topic/bcm63xx-hsspi', 'spi/topic/bitbang', 'spi/topic/bpw', 'spi/topic/clps711x', 'spi/topic/coldfire', 'spi/topic/davinci', 'spi/topic/dw' and 'spi/topic/falcon' into spi-linus
| | * | spi/bcm63xx: fix pm sleep supportJonas Gorski2013-12-171-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the correct symbol to guard the callbacks and use appropriate defines for setting up the ops struct. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | spi/bcm63xx: check return value of clk_prepare_enableJonas Gorski2013-12-171-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure we notice if the clock cannot be enabled for any reason and pass the error down. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | spi/bcm63xx: don't reject reads >= 256 bytesJonas Gorski2013-12-171-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rx_tail register is only 8 bit wide, so it will wrap around after 256 read bytes. This makes it rather meaningless, so drop any usage of it to not treat reads over 256 as failed. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | spi: bcm63xx: Use devm_clk_get()Jingoo Han2013-12-171-11/+4
| | |/ | | | | | | | | | | | | | | | | | | | | | Use devm_clk_get() to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | spi: bcm63xx: fix reference leak to master in bcm63xx_spi_remove()Wei Yongjun2013-11-151-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | Once a spi_master_get() call succeeds, we need an additional spi_master_put() call to free the memory, otherwise we will leak a reference to master. Fix by removing the unnecessary spi_master_get() call. Fixes: 247263dba208 ('spi: bcm63xx: use devm_spi_register_master()') Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@linaro.org>
* | spi: bcm63xx: fix reference leak to master in bcm63xx_spi_remove()Wei Yongjun2013-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | Once a spi_master_get() call succeeds, we need an additional spi_master_put() call to free the memory, otherwise we will leak a reference to master. Fix by removing the unnecessary spi_master_get() call. Fixes: 247263dba208 ('spi: bcm63xx: use devm_spi_register_master()') Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@linaro.org>
* | spi/bcm63xx: don't substract prepend length from total lengthJonas Gorski2013-12-171-2/+0
|/ | | | | | | | | | | The spi command must include the full message length including any prepended writes, else transfers larger than 256 bytes will be incomplete. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
* spi: bcm63xx: use devm_spi_register_master()Jingoo Han2013-09-261-5/+1
| | | | | | | | Use devm_spi_register_master() to make cleanup paths simpler, and remove a duplicate put. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge remote-tracking branch 'spi/topic/qspi' into spi-nextMark Brown2013-09-011-20/+1
|\
| * spi/bcm63xx: Convert to core runtime PMMark Brown2013-07-291-20/+1
| | | | | | | | Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'spi/topic/pdata' into spi-nextMark Brown2013-09-011-5/+3
|\ \
| * | spi: Use dev_get_drvdata at appropriate placesAxel Lin2013-08-291-4/+2
| | | | | | | | | | | | | | | | | | | | | Use dev_get_drvdata() instead of platform_get_drvdata(to_platform_device(dev)). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | spi: use dev_get_platdata()Jingoo Han2013-08-291-1/+1
| |/ | | | | | | | | | | | | | | Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | spi/spi-{bcm63xx.c,bfin-v3.c}: simplify use of devm_ioremap_resourceJulia Lawall2013-08-141-7/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/) // <smpl> @@ 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); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown2013-06-261-3/+0
|\
| * spi: remove unnecessary platform_set_drvdata()Jingoo Han2013-05-131-3/+0
| | | | | | | | | | | | | | | | | | | | | | 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 <jg1.han@samsung.com> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | spi: convert drivers to use bits_per_word_maskStephen Warren2013-05-291-19/+1
|/ | | | | | | | | | 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 <swarren@wwwdotorg.org> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: remove unused speed_hz variableJonas Gorski2013-04-081-2/+0
| | | | | | | | | speed_hz is a write only member, so we can safely remove it and its generation. Also fixes the missing clk_put after getting the periph clock. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: use devm_ioremap_resource()Jonas Gorski2013-03-121-12/+3
| | | | | | | | Use devm_ioremap_resource() which provides its own error messages. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: inline hz usage in bcm63xx_spi_setup_transferJonas Gorski2013-03-121-5/+2
| | | | | | | | | | bcm63xx_spi_setup_transfer is called from only one place, and that has t always set, to hz will always be t->speed_hz - just use it directly in the two places instead of moving it in a local variable. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: inline bcm63xx_spi_check_transferJonas Gorski2013-03-121-14/+5
| | | | | | | | It only does one check, so just do the check directly in the caller. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: remove spi chip select validity checkJonas Gorski2013-03-121-6/+0
| | | | | | | | | The check would belong in bcm63xx_spi_setup if the spi subsystem weren't already doing the check for us, so just drop it. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: simplify bcm63xx_spi_check_transferJonas Gorski2013-03-121-5/+2
| | | | | | | | | bcm63xx_spi_check_transfer is only called from one place that has t always set, so directly check the transfer's bits_per_word. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: check spi bits_per_word in spi_setupJonas Gorski2013-03-121-2/+5
| | | | | | | | | Instead of fixing up the bits_per_word (which the spi subsystem already does for us), check it for supported values. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: remove unused variable bs from bcm63xx_spi_setupJonas Gorski2013-03-121-4/+0
| | | | | | | | It is only written, but never read. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* spi/bcm63xx: remove unneeded debug messageJonas Gorski2013-03-121-3/+0
| | | | | | | | | | The spi subsystem already provides this info in a more extensive debug print except for the nsecs/bit - which wasn't calculated anyway and fixed to 0. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
OpenPOWER on IntegriCloud