[PATCH] MAINTAINERS: Remove Grant Likely
Unfortunately, I'm no longer to spend the time needed on maintainership. It is time for me to step aside and pass maintainership to other engineers. I'm not disappearing from Linux development, but it would be irresponsible for me to hold onto a job that I am unable to do. GPIO and SPI are in good hands with Linus and Mark. Rob Herring has a really good grasp on the DT core code, and in the last week there have been several volunteers to create and maintain a DT bindings tree. You can expect to see an email about that hit the list shortly. Signed-off-by: Grant Likely grant.lik...@linaro.org --- MAINTAINERS | 8 1 file changed, 8 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 250dc97..339fcdd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3564,10 +3564,8 @@ F: drivers/isdn/gigaset/ F: include/uapi/linux/gigaset_dev.h GPIO SUBSYSTEM -M: Grant Likely grant.lik...@linaro.org M: Linus Walleij linus.wall...@linaro.org S: Maintained -T: git git://git.secretlab.ca/git/linux-2.6.git F: Documentation/gpio.txt F: drivers/gpio/ F: include/linux/gpio* @@ -4411,8 +4409,6 @@ F:drivers/irqchip/ IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) M: Benjamin Herrenschmidt b...@kernel.crashing.org -M: Grant Likely grant.lik...@linaro.org -T: git git://git.secretlab.ca/git/linux-2.6.git irqdomain/next S: Maintained F: Documentation/IRQ-domain.txt F: include/linux/irqdomain.h @@ -5945,11 +5941,8 @@ F: Documentation/i2c/busses/i2c-ocores F: drivers/i2c/busses/i2c-ocores.c OPEN FIRMWARE AND FLATTENED DEVICE TREE -M: Grant Likely grant.lik...@linaro.org M: Rob Herring rob.herr...@calxeda.com L: devicetree-disc...@lists.ozlabs.org (moderated for non-subscribers) -W: http://fdt.secretlab.ca -T: git git://git.secretlab.ca/git/linux-2.6.git S: Maintained F: Documentation/devicetree F: drivers/of @@ -7623,7 +7616,6 @@ F:drivers/clk/spear/ SPI SUBSYSTEM M: Mark Brown broo...@kernel.org -M: Grant Likely grant.lik...@linaro.org L: spi-devel-general@lists.sourceforge.net T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git Q: http://patchwork.kernel.org/project/spi-devel-general/list/ -- 1.8.1.2 -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 01/15] spi: altera: remove unnecessary platform_set_drvdata()
On Fri, May 3, 2013 at 7:48 AM, Jingoo Han jg1@samsung.com wrote: 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@samsung.com Hi Jingoo, Thanks for doing this. However, there is no need to have a separate patch for each and every spi driver. Can you please squash them all into a single patch and repost? Acked-by: Grant Likely grant.lik...@linaro.org --- drivers/spi/spi-altera.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index a537f8d..81b9adb 100644 --- a/drivers/spi/spi-altera.c +++ b/drivers/spi/spi-altera.c @@ -285,7 +285,6 @@ static int altera_spi_probe(struct platform_device *pdev) exit_busy: err = -EBUSY; exit: - platform_set_drvdata(pdev, NULL); spi_master_put(master); return err; } @@ -296,7 +295,6 @@ static int altera_spi_remove(struct platform_device *dev) struct spi_master *master = hw-bitbang.master; spi_bitbang_stop(hw-bitbang); - platform_set_drvdata(dev, NULL); spi_master_put(master); return 0; } -- 1.7.2.5 -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- Get 100% visibility into Java/.NET code with AppDynamics Lite It's a free troubleshooting tool designed for production Get down to code-level detail for bottlenecks, with 2% overhead. Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap2 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[git pull] SPI bug fixes
Hi Mark, Here are some commits that I picked up a while ago but for some reason never asked Linus to pull them. :( Can you pull this branch into your tree for your next pull request to Linus? Thanks, g. The following changes since commit fe6969094214350e586d56fbfa3ef97cdd74b270: Merge tag 'dm-3.9-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm (2013-04-05 19:30:14 -0700) are available in the git repository at: git://git.secretlab.ca/git/linux spi/merge for you to fetch changes up to 0d2d0cc5216db678070efc911ef47f4cb53b4aad: spi/davinci: fix module build error (2013-04-07 10:12:21 +0100) Andreas Larsson (2): spi: Initialize cs_gpio and cs_gpios with -ENOENT spi: Return error from of_spi_register_master on bad cs-gpios property Joachim Eastwood (1): spi/atmel: fix speed_hz check in atmel_spi_transfer() Manjunathappa, Prakash (1): spi/davinci: fix module build error drivers/spi/spi-atmel.c | 4 ++-- drivers/spi/spi-davinci.c | 2 +- drivers/spi/spi.c | 9 ++--- include/linux/spi/spi.h | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- Get 100% visibility into Java/.NET code with AppDynamics Lite It's a free troubleshooting tool designed for production Get down to code-level detail for bottlenecks, with 2% overhead. Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap2 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [REPOST PATCH] spi: s3c64xx: let device core setup the default pin configuration
On Mon, 15 Apr 2013 20:42:57 -0700, Doug Anderson diand...@chromium.org wrote: From: Thomas Abraham thomas.abra...@linaro.org With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed. Signed-off-by: Thomas Abraham thomas.abra...@linaro.org Signed-off-by: Doug Anderson diand...@chromium.org Acked-by: Linus Walleij linus.wall...@linaro.org Reviewed-by: Doug Anderson diand...@chromium.org Tested-by: Doug Anderson diand...@chromium.org Applied, thanks. g. -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: Quick questions regarding the SPI interface
On Fri, Apr 5, 2013 at 9:44 PM, Martin Sperl mar...@sperl.org wrote: Hi! I am trying to drive the spi driver of the raspberry-pi towards a fully DMA driven interface and have come a few open points that - as far as I can tell - are not specified detail in the documentation or header-files. 1) is the spi callback blocking further actions on the spi-bus until it is returns, or can other (asyncronously) scheduled spi transactions happen while the callback occurs (or is still pending)? 2) is a callback allowed to sleep (so it can not get run from a normal Irq-handler-context - i.e non-threaded IRQ)? Which callback? The mesg-complete() callback? or the .transfer or .transfer_one_message callbacks provided by the spi bus driver? The -complete() callback should not sleep because it may be running in an atomic context in the spi bus driver. The .transfer_one_message() callback can either sleep or return immediately. For DMA driven transfers, you'll probably want to return immediately and handle the message completion in the irq handler. A new transaction can indeed be initiated before the complete() callback on the preceeding transaction has actually been called. If a device needs to have exclusive access to the bus then there is a separate bus lock feature in the SPI infrastructure. The MMC subsystem uses this. If the driver is still using .transfer, then you really should move to .transfer_one_message(). It is much better and well documented in Documentation/spi/spi-summary (look to the end of the file). 3) are there any absolute requirements on the sequence of callbacks or could reordering occur? It is feasable for reordering of the completion callbacks to occur if multiple requests are queued, but the SPI transactions themselves must not be reordered. 4) does a spi_transfer require a payload(Len0) when a delay is set? (that way defined delays could get used for sampling with an ADC or similar) Hmmm, I don't think anyone has done that. Why wouldn't the delay be made part of the preceding spi_transfer? All these answers are needed to get the spi-driver working in a fully pipelined dma mode and stay compatible with existing device-drivers that make use of the asynchronous interface. My interpretation right now are: ad 1) no, as it is an asynchronous interface, so we have to assume that there can be bus activity. ad 2) there are advantages to both - in interrupt-context the callback could schedule other spi_async transaction with minimal overhead (no task-switching required). But on the other hand there may be existing drivers that would break with this in place (as they might sleep in the callback for example). Alternatively the driver would need to add a task to a work-queue or similar instead - this obviously means more latencies. Maybe an additional flag in spi_message signifying the callback is not sleeping (say callback_irqsafe), would be needed to get best of both worlds? Short-term this could get done via a module parameter. Use .transfer_one_message. All of the above is handled transparently and the spi_bus driver can choose to either sleep in transfer_one_message and handle all phases in that context, or return immediately and finalize the transaction in the interrupt handler. It also means the driver doesn't need to implement any of the workqueue stuff. ad 3) this essentially means if the callback needs to get implemented with a single global system queue or if per-CPU specific queues would be permissible. ad 4) I think that len may be 0 - if this is used in conjunction with an ADC, then a delay could get configured this way without a CS asserted. My thought for the DMA driver of the RPI (which can daisy-chain different kinds of DMA transfer) was actually to abuse a DMA transfer of a Memory-page to a null sink to get those exact delays implement without the need for the CPU to get involved at all - this way for example a sample-rate can get very well controlled getting close to real-time performance with regards to jitter and more... Can you please give me your thoughts on these before I start implementing the next revision of the DMA enabled driver for the RPI hardware? It may also be of interest to document (some of) the answers for the above in spi.h for further reference. Thanks, Martin -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 4/4] spi: remove unused Tegra platform data header
On Sat, Mar 9, 2013 at 1:10 AM, Rhyland Klein rkl...@nvidia.com wrote: On 3/2/2013 6:02 PM, Grant Likely wrote: On Fri, 15 Feb 2013 15:03:50 -0700, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com The platform data header is no longer used. Delete it. Signed-off-by: Stephen Warren swar...@nvidia.com I like the diffstat for this series. Applied! Thanks, g. -- To unsubscribe from this list: send the line unsubscribe linux-tegra in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Grant, I was looking to pull these patches. I don't see them in linux-next and I looked at your repo and didn't see them. Can you give me a pointer? That is because I haven't pushed them out yet. Initially it was because the merge window was still open, and then it was because I was in Hong Kong last week for Linaro Connect. I haven't wanted to push out my trees until I have a chance to do some build testing which I will do on Monday. g. -- Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2 3/5] spi: s3c64xx: Added provision for non-gpio i/o's
On Wed, 13 Feb 2013 12:03:46 -0800, Girish K S girishks2...@gmail.com wrote: Currently the drivers supports only the GPIO based i/o pins. But there are Exynos SoC's that use the same controller with dedicated i/o pins. This patch provides provision to support gpio/dedicated pins. The decision is made by parsing the gpios property in the spi node. Signed-off-by: Girish K S ks.g...@samsung.com --- changes in v2: Removed the gpio quirk. Parse the gpios property to decide whether gpio / dedicated i/o lines should be used. It is perfectly valid to support both at the same time. The gpios property can be 'sparse' in that when a gpio is specified, use that for the CS control, but use a dedicated line with it is not. Instead of doing this it would be better off to switch this driver to use the new cs_gpios parsing in driver/spi/spi.c g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v3 0/7] spi: spi-fsl-spi: Make spi-fsl-spi usable in cpu mode outside of FSL SOC environments and add a grlib variant normally running on sparc
On Fri, 15 Feb 2013 16:52:20 +0100, Andreas Larsson andr...@gaisler.com wrote: Changes since v3: - Patches 1-7: Added Acked-by: Anton Vorontsov an...@enomsg.org - Patch 1: Small style tweak lining up function arguments properly - Patch 7: Changed a style issue with two variables declared on same line - Patch 7: Removed usage of cs_gpio_flags variable to apply cleanly to spi/next - Patch 7: Changed get_named_gpio hole value to -ENOENT = Requries the spi: Initialize cs_gpio and cs_gpios with ENOENT patch for TYPE_GRLIB support Merged entire series for v3.10, thanks. g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi/atmel: fix speed_hz check in atmel_spi_transfer()
On Wed, 20 Feb 2013 08:51:48 +0100, Nicolas Ferre nicolas.fe...@atmel.com wrote: On 02/19/2013 10:44 PM, Joachim Eastwood : atmel_spi_transfer() would check speed_hz and fail if the speed was changed in the transfer. After commit spi: make sure all transfer has proper speed set this would happen on all transfers. Change speed_hz check to only fail if a lower speed than max is requested. Signed-off-by: Joachim Eastwood manab...@gmail.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Thanks for spotting this Joachim. Applied, thanks. g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
RE: [PATCH 0/4] Enable SPI flash support on da850-evm DT kernel
On Wed, 27 Feb 2013 11:32:39 +, Manjunathappa, Prakash prakash...@ti.com wrote: On Wed, Feb 27, 2013 at 14:09:57, Nori, Sekhar wrote: On 2/25/2013 4:14 PM, Manjunathappa, Prakash wrote: Patch enables support for m25p80 SPI flash support on da850-EVM. Testing information: da850-evm comes with partitions specified in DT blob. Able to mount/umount and create/delete files on filesystem partition. Depends on below patch in spi-next branch of git://git.secretlab.ca/git/linux-2.6.git. spi/davinci: add OF support for the spi controller Grant, I could not find binding documentation changes submitted with above patch. I checked in spi-next and linux-next. It must have been missed then. It happens sometimes. Can someone submit a fixup patch please? Thanks, g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 3/4] spi: s3c64xx: add dma maxburst size initialization
On Fri, 22 Feb 2013 17:09:18 +0900, Boojin Kim boojin@samsung.com wrote: This patch adds dma maxburst size initialization. The maxburst should be set by MODE_CFGn.DMA_TYPE, because the pl330 dma driver supports burst mode. Signed-off-by: Hyeonkook Kim hk619@samsung.com Applied, thanks. g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] of: spi: Return error from of_spi_register_master on bad cs-gpios property
On Wed, 13 Feb 2013 14:23:24 +0100, Andreas Larsson andr...@gaisler.com wrote: This makes sure that an error is returned on an incorrectly formed cs-gpios property, but reports success when the cs-gpios property is well formed or missing. When holes in the cs-gpios property phandle list is used to indicate that some other form of chipselect is to be used it is important that failure to read a broken cs-gpios property does not silently fail leading to the spi controller to use an unintended chipselect. Signed-off-by: Andreas Larsson andr...@gaisler.com Applied, thanks. g. --- Can only be applied to devicetree/next as it builds upon the of: Add helper for counting phandle refernces patch series. drivers/spi/spi.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 21c4748..9b5f024 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1068,8 +1068,11 @@ static int of_spi_register_master(struct spi_master *master) nb = of_gpio_named_count(np, cs-gpios); master-num_chipselect = max(nb, (int)master-num_chipselect); - if (nb 1) + /* Return error only for an incorrectly formed cs-gpios property */ + if (nb == 0 || nb == -ENOENT) return 0; + else if (nb 0) + return nb; cs = devm_kzalloc(master-dev, sizeof(int) * master-num_chipselect, -- 1.7.0.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 3/4] spi: s3c64xx: add dma maxburst size initialization
On Fri, 22 Feb 2013 17:09:18 +0900, Boojin Kim boojin@samsung.com wrote: This patch adds dma maxburst size initialization. The maxburst should be set by MODE_CFGn.DMA_TYPE, because the pl330 dma driver supports burst mode. Signed-off-by: Hyeonkook Kim hk619@samsung.com Hello Hyeonkook, I applied this patch but then discovered that it relys on the previous patches that you've posted. When patched depend on each other like this please post them as a series with [PATCH x/4] in the subject line. 'git send-email' will format this correctly for you. g. --- drivers/spi/spi-s3c64xx.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index e862ab8..5e6cafe 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -287,10 +287,20 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, struct s3c64xx_spi_driver_data *sdd; struct samsung_dma_prep info; struct samsung_dma_config config; + void __iomem *regs; + unsigned int mode_cfg; if (dma-direction == DMA_DEV_TO_MEM) { sdd = container_of((void *)dma, struct s3c64xx_spi_driver_data, rx_dma); + + regs = sdd-regs; + mode_cfg = readl(regs + S3C64XX_SPI_MODE_CFG); + if (mode_cfg S3C64XX_SPI_MODE_4BURST) + config.maxburst = 4; + else + config.maxburst = 1; + config.direction = sdd-rx_dma.direction; config.fifo = sdd-sfr_start + S3C64XX_SPI_RX_DATA; config.width = sdd-cur_bpw / 8; @@ -298,6 +308,14 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, } else { sdd = container_of((void *)dma, struct s3c64xx_spi_driver_data, tx_dma); + + regs = sdd-regs; + mode_cfg = readl(regs + S3C64XX_SPI_MODE_CFG); + if (mode_cfg S3C64XX_SPI_MODE_4BURST) + config.maxburst = 4; + else + config.maxburst = 1; + config.direction = sdd-tx_dma.direction; config.fifo = sdd-sfr_start + S3C64XX_SPI_TX_DATA; config.width = sdd-cur_bpw / 8; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: Initialize cs_gpio and cs_gpios with -ENOENT
On Wed, 13 Feb 2013 14:20:25 +0100, Andreas Larsson andr...@gaisler.com wrote: The return value from of_get_named_gpio is -ENOENT when the given index matches a hole in the cs-gpios property phandle list. However, the default value of cs_gpio in struct spi_device and entries of cs_gpios in struct spi_master is -EINVAL, which is documented to indicate that a GPIO line should not be used for the given spi_device. This sets the default value of cs_gpio in struct spi_device and entries of cs_gpios in struct spi_master to -ENOENT. Thus, -ENOENT is the only value used to indicate that no GPIO line should be used. Signed-off-by: Andreas Larsson andr...@gaisler.com Applied, thanks. g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 05/12] spi: mxs-spi: move to use generic DMA helper
On Wed, 27 Feb 2013 23:25:41 +0800, Shawn Guo shawn@linaro.org wrote: With the generic DMA device tree helper supported by mxs-dma driver, client devices only need to call dma_request_slave_channel() for requesting a DMA channel from dmaengine. Since mxs is a DT only platform now, along with the changes, the non-DT case handling in probe function also gets removed. Signed-off-by: Shawn Guo shawn@linaro.org Cc: Grant Likely grant.lik...@secretlab.ca Cc: spi-devel-general@lists.sourceforge.net Acked-by: Grant Likely grant.lik...@secretlab.ca -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v5 01/16] spi/spi-atmel: fix master-num_chipselect wrongly set.
On Tue, 26 Feb 2013 14:47:54 +0800, Wenyou Yang wenyou.y...@atmel.com wrote: if the spi property cs-gpios is set as below: cs-gpios = 0, pioC 11 0, 0, 0; the master-num_chipselect will wrongly be set to 0, and the spi fail to probe. Signed-off-by: Wenyou Yang wenyou.y...@atmel.com Cc: spi-devel-general@lists.sourceforge.net Cc: linux-ker...@vger.kernel.org I think I've got this bug fixed in the core spi code. Give it a couple of days and retest with linux-next. g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 3/4] spi: s3c64xx: add dma maxburst size initialization
On Fri, 22 Feb 2013 17:09:18 +0900, Boojin Kim boojin@samsung.com wrote: This patch adds dma maxburst size initialization. The maxburst should be set by MODE_CFGn.DMA_TYPE, because the pl330 dma driver supports burst mode. Signed-off-by: Hyeonkook Kim hk619@samsung.com Acked-by: Grant Likely grant.lik...@secretlab.ca This series probably needs to be merged together through the arm-soc tree. g. --- drivers/spi/spi-s3c64xx.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index e862ab8..5e6cafe 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -287,10 +287,20 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, struct s3c64xx_spi_driver_data *sdd; struct samsung_dma_prep info; struct samsung_dma_config config; + void __iomem *regs; + unsigned int mode_cfg; if (dma-direction == DMA_DEV_TO_MEM) { sdd = container_of((void *)dma, struct s3c64xx_spi_driver_data, rx_dma); + + regs = sdd-regs; + mode_cfg = readl(regs + S3C64XX_SPI_MODE_CFG); + if (mode_cfg S3C64XX_SPI_MODE_4BURST) + config.maxburst = 4; + else + config.maxburst = 1; + config.direction = sdd-rx_dma.direction; config.fifo = sdd-sfr_start + S3C64XX_SPI_RX_DATA; config.width = sdd-cur_bpw / 8; @@ -298,6 +308,14 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, } else { sdd = container_of((void *)dma, struct s3c64xx_spi_driver_data, tx_dma); + + regs = sdd-regs; + mode_cfg = readl(regs + S3C64XX_SPI_MODE_CFG); + if (mode_cfg S3C64XX_SPI_MODE_4BURST) + config.maxburst = 4; + else + config.maxburst = 1; + config.direction = sdd-tx_dma.direction; config.fifo = sdd-sfr_start + S3C64XX_SPI_TX_DATA; config.width = sdd-cur_bpw / 8; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 4/4] spi: remove unused Tegra platform data header
On Fri, 15 Feb 2013 15:03:50 -0700, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com The platform data header is no longer used. Delete it. Signed-off-by: Stephen Warren swar...@nvidia.com I like the diffstat for this series. Applied! Thanks, g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V3] spi: tegra114: add spi driver
On Fri, 22 Feb 2013 19:59:11 +0530, Manish Badarkhe badarkhe.man...@gmail.com wrote: On Fri, Feb 22, 2013 at 6:07 PM, Laxman Dewangan ldewan...@nvidia.com wrote: Add SPI driver for NVIDIA's Tegra114 SPI controller. This controller is different than the older SoCs SPI controller in internal design as well as register interface. This driver supports the: - non DMA based transfer for smaller transfer i.e. less than FIFO depth. - APB DMA based transfer for lager transfer i.e. more than FIFO depth. s/lager/larger Applied, thanks. And I fixed up the typo when I did. + spi_irq = platform_get_irq(pdev, 0); + tspi-irq = spi_irq; + ret = request_threaded_irq(tspi-irq, tegra_spi_isr, + tegra_spi_isr_thread, IRQF_ONESHOT, + dev_name(pdev-dev), tspi); Can we use devm_request_threaded_irq instead? to save some code. I don't have any quams about applying it as-is. That can be done as a follow on patch. g. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: Driver for GPIO controlled SPI multiplexer
On Sat, Mar 2, 2013 at 10:48 AM, Mark Brown broo...@opensource.wolfsonmicro.com wrote: On Sat, Mar 02, 2013 at 11:43:58AM +0100, Peter Korsgaard wrote: MB This looks wrong without a vendor name in it but I'm not sure what we're MB supposed to do for generic stuff like this. It's atleast in line with what we do elsewhere (spi-gpio, i2c-gpio, i2c-mux-gpio, ..) Yup, it just feels wrong. Not a problem though. Will you respin for the max speed thing? It's not quite the same though. spi-gpio and i2c-gpio are very well defined things. An SPI multiplexer on the other hand can be implemented in several different ways. I would still be more specific here. You can be specific to your specific hardware now, and a more generic value can be added later. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: Driver for GPIO controlled SPI multiplexer
On Wed, 27 Feb 2013 14:58:39 +0100, Peter Korsgaard peter.korsga...@barco.com wrote: From: Dries Van Puymbroeck dries.vanpuymbro...@barco.com This patch contains a driver for a gpio controlled multiplexer on an SPI bus. This can be useful if a board requires more SPI devices, and thus more chip selects, than the SPI controller on the processor has available. The mux device is added in the device tree as a child node of the SPI master. Then, devices can be added as children of the mux node. The mux will appear as if it was a SPI master device, and child nodes will appear as chip selects on the mux bus. A bindings file is provided for the device tree bindings. Since at least some SPI master drivers queue messages from the attached devices, the mux can only send 1 message at a time from its own queue to the master, because otherwise there would not be a guarantee that the mux settings will be correct when the real master does the transfer. Hi Peter, Nice, pass on thanks to Dries for looking at this please. I've got other hardware that wants to do what you've got here. It's a nice tightly written driver too. Well done! Comments below... Signed-off-by: Dries Van Puymbroeck dries.vanpuymbro...@barco.com Peter, you forgot to add your s-o-b line here. If you're passing on a patch, you are responsible to it meets the sign-off critiria in Documentation/SubmittingPatches which is what your s-o-b line is meant to assert. --- .../devicetree/bindings/spi/spi-mux-gpio.txt | 113 +++ drivers/spi/Kconfig|9 + drivers/spi/Makefile |1 + drivers/spi/spi-mux-gpio.c | 319 4 files changed, 442 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-mux-gpio.txt create mode 100644 drivers/spi/spi-mux-gpio.c diff --git a/Documentation/devicetree/bindings/spi/spi-mux-gpio.txt b/Documentation/devicetree/bindings/spi/spi-mux-gpio.txt new file mode 100644 index 000..534a667 --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi-mux-gpio.txt @@ -0,0 +1,113 @@ +GPIO-based SPI Chip Select Mux + +This binding describes a SPI bus multiplexer that uses GPIOs to route +the SPI chip select signals. This can be used when you need more +devices than the SPI controller has chip selects available. + + MOSI /---+++\ + MISO |/-+|---+|---+|---\| + SCL ||/---+||--+||--+||--\|| + ||| ||| ||| ||| ||| +++ ||| ||| ||| ||| +| SoC ||| | +-+++-+ +-+++-+ +-+++-+ +-+++-+ +| ||| | | dev | | dev | | dev | | dev | +| +--+++-+ | +--+\ +--+--+ +--+--+ +--+--+ +--+--+ +| | SPI +-|--| Mux |\\ CS-0 |||| +| +--+ | +--++--+\\\---/ CS-1 ||| +|| || \\\/ CS-2 || +| +--+ | ||\\-/ CS-3 | +| | GPIO |-|-/| \--/ +| | |-|--/ +| +--+ | +++ Other variants would be an second spi device with a register for the active CS to use instead of GPIOs. Something to keep in mind as to how it could be extended for other methods of setting the CS. I've got hardware exactly like that. + +Required properties: +- compatible: spi-mux-gpio As already commented on, please use a more specific compatible string here. +- #address-cells: 1 (as for any SPI master device) +- #size-cells: 0 (as for any SPI master device) +- reg: chip select of the mux on the parent SPI master +- spi-max-frequency: the maximum frequency allowed for any devices on + this mux +- mux-gpios: list of gpios used to control the muxer Simply 'gpios' is sufficient here I think +* SPI child nodes, as if the mux is a real spi master + +A new SPI bus will be created. Then for each child node, a SPI device +is created, with a virtual chip select on this bus according to the +reg property. + +Whenever an access is made to a child device, the value set in the +revelant node's reg property is interpreted as a bitmask defining the +state of the mux-gpios gpio pins, with the least significant bit +defining the state of first gpio, the next bit the state of the second +gpio and so forth. + +The property spi-max-frequency is conceptually not needed, as each +child node holds the maximum frequency specific to that +device. However, the SPI core code wants every device in the tree to +specify a maximum frequency. So because the mux is a device to a +parent SPI master, you need to set a maximum frequency. It's best to +set this high, as the
[GIT PULL] SPI for v3.9
The following changes since commit 88b62b915b0b7e25870eb0604ed9a92ba4bfc9f7: Linux 3.8-rc6 (2013-02-01 12:08:14 +1100) are available in the git repository at: git://git.secretlab.ca/git/linux tags/spi-for-linus for you to fetch changes up to 095c3752e673c0ba039a2f67fd867297fde75ae7: spi: Document cs_gpios and cs_gpio in kernel-doc (2013-02-11 00:05:31 +) SPI changes for v3.9 Changes to both core spi code and spi device drivers. The driver changes are the usual set of bug fixes and platform enablement. Core code changes include: - More intelligent assignment of SPI bus numbers when using DT - Fixes to initialization and documentation of chipselect gpio array. - Pull checks for bits_per_word and transfer speed out of drivers and into core code - Ensure temporary DMA buffers are DMA safe Anatolij Gustschin (2): spi/mpc512x-psc: don't use obsolet cell-index property spi/spi-mpc512x-psc: init mode bits supported by the driver Andreas Larsson (2): spi/of: Fix initialization of cs_gpios array spi: Document cs_gpios and cs_gpio in kernel-doc Barry Song (2): spi/sirf: use clk_prepare_enable and clk_disable_unprepare spi/sirf: add support for new SiRFmarco SMP SoC Bastian Hecht (1): spi/sh-msiof: Add device tree parsing to driver Ezequiel Garcia (1): spi/orion: Use module_platform_driver() Fabio Estevam (1): spi/imx: Add MODULE_ALIAS() Felipe Balbi (1): spi/omap2: disable DMA requests before complete() Gabor Juhos (6): spi/ath79: add delay between SCK changes spi/ath79: add missing HIGH-LOW SCK transition spi/ath79: remove superfluous chip select code spi/ath79: use gpio_request_one spi/ath79: avoid multiple initialization of the SPI controller spi/ath79: add shutdown handler Grant Likely (4): spi/of: Use DT aliases for assigning bus number Merge branch 'broonie/spi-next' of git://git.kernel.org/.../broonie/misc.git spi: Remove erroneous __init, __exit and __exit_p() references in drivers Merge branch spi-next from git://git.kernel.org/.../broonie/misc.git Guennadi Liakhovetski (1): spi: bitbang: simplify pointer arithmetics Jingoo Han (2): spi/s3c64xx: Use devm_clk_get() and devm_request_irq() spi/s3c64xx: fix checkpatch warnings and error John Crispin (2): spi/mips-lantiq: make use of spi_finalize_current_message spi/mips-lantiq: set SPI_MASTER_HALF_DUPLEX flag Jonas Gorski (2): spi/bcm63xx: reject transfers unable to transfer spi/bcm63xx: work around inability to keep CS up Juha Lumme (1): mxs/spi: clear XFER_COUNT in ctrl0 field in DMA descriptor Laxman Dewangan (3): spi: remove check for bits_per_word on transfer from low level driver spi: make sure all transfer has proper speed set spi/tegra: remove checks for valid speed Mark Brown (3): spi/s3c64xx: Complain if we fail to set a transfer speed MAINTAINERS: Add myself as a backup maintainer for SPI spi: Ensure memory used for spi_write_then_read() is DMA safe Matthias Brugger (2): spi: spi-omap2-mcspi.c: fix coding style spi: spi-omap2-mcspi.c: Toggle CS after each word Maxime Ripard (2): spi: spi-gpio: Add checks for the dt properties spi: spi-gpio: fix compilation warning on 64 bits systems Mika Westerberg (12): spi/pxa2xx-pci: switch to use pcim_* interfaces spi/pxa2xx: embed the ssp_device to platform data spi/pxa2xx: allow building on a 64-bit kernel spi/pxa2xx: fix warnings when compiling a 64-bit kernel spi/pxa2xx: convert to the pump message infrastructure spi/pxa2xx: convert to the common clk framework spi/pxa2xx: break out the private DMA API usage into a separate file spi/pxa2xx: add support for DMA engine spi/pxa2xx: add support for runtime PM spi/pxa2xx: add support for SPI_LOOP spi/pxa2xx: add support for Intel Low Power Subsystem SPI spi/pxa2xx: add support for Lynxpoint SPI controllers Murali Karicheri (2): spi/davinci: add OF support for the spi controller spi/davinci: use request_threaded_irq() to fix deadlock Documentation/devicetree/bindings/spi/sh-msiof.txt | 12 + MAINTAINERS|1 + drivers/spi/Kconfig| 15 +- drivers/spi/Makefile |5 +- drivers/spi/spi-altera.c |2 +- drivers/spi/spi-ath79.c| 115 +- drivers/spi/spi-atmel.c|2 +- drivers/spi/spi-au1550.c |8 +- drivers/spi/spi-bcm63xx.c | 179 +++- drivers/spi/spi-bfin-sport.c |3 +- drivers/spi/spi-bfin5xx.c
Re: spi-atmel broken in next
On Sun, Feb 17, 2013 at 11:15 AM, Joachim Eastwood manab...@gmail.com wrote: Hi, spi-atmel is now broken for all spi transfers in linux-next. This is caused by commit spi: make sure all transfer has proper speed set. The reason is the following code in atmel_spi_transfer(...) 849 /* FIXME implement these protocol options!! */ 850 if (xfer-speed_hz) { 851 dev_dbg(spi-dev, no protocol options yet\n); 852 return -ENOPROTOOPT; 853 } Now that xfer-speed_hz is always set all spi transfers will return with ENOPROTOOPT. Not quite sure how to best fix it. Just removing the whole test makes it work again but I guess we should do something better with speed_hz here. Probably the best fix is to check instead if xfer-speed_hz is less than the bus speed. If it is then you can fail. If it is not, then continue. g. -- The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials, tech docs, whitepapers, evaluation guides, and opinion stories. Check out the most recent posts - join the conversation now. http://goparallel.sourceforge.net/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 6/6] of_spi: Initialize cs_gpios and cs_gpio with -EEXIST
On Tue, 12 Feb 2013 10:46:27 +0100, Andreas Larsson andr...@gaisler.com wrote: On 2013-02-11 01:23, Grant Likely wrote: On Tue, 29 Jan 2013 15:53:43 +0100, Andreas Larsson andr...@gaisler.com wrote: Holes in the cs-gpios DT phandle list is supposed to mark that native chipselects is to be used. The value returned from of_get_named_gpio_flags in this case is -EEXIST. By initializing cs_gpios and cs_gpio with -EEXIST, this and only this errno will indicate to a spi controller driver that a native chipselect is to be used. Signed-off-by: Andreas Larsson andr...@gaisler.com I've left this one off for now. Take a look at the patch I posted and let me know if you think this one should still be applied. I think that of_spi_register_master should return an error when the cs-gpios property is broken (part of patch 2) and that cs_gpios and cs_gpio should be initialized to the same value as a hole in the plist. This patch does not work without 1 and 2, so I'll submit a modified patch once of: Create function for counting number of phandles in a property has stabilized. Would it have to go through the gpio branch then? I'll put it through the DT branch since that is where I'll put the of_count_phandle patch (assuming it is ready for the 3.9 merge window). g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 5/6] of_spi: Add fetching of of_gpio flags to of_spi_register_master
On Tue, 12 Feb 2013 10:39:02 +0100, Andreas Larsson andr...@gaisler.com wrote: On 2013-02-11 01:22, Grant Likely wrote: On Tue, 29 Jan 2013 15:53:42 +0100, Andreas Larsson andr...@gaisler.com wrote: When using a gpio chip select with a OF_GPIO_ACTIVE_LOW flag, this needs to be known to the controller driver. Signed-off-by: Andreas Larsson andr...@gaisler.com Out of curiosity, what do you need the flags for? Polarity of the CS signal? I think it is long past time to revisit baking polarity control into core of gpiolib. Would you mind investigating doing that instead of having to manage it manually in each and every driver? I don't even need it on my hardware. It seemed like a good thing to have via of_spi_register_master. I am OK with just dropping this. Hahaha. Okay, let's leave it for now until someone does need it. I can however see the need for the polarity flag, so the request still stands for someone to put that feature into the core. :-) g. -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 2/6] of: Return -ENXIO from of_parse_phandle_with_args for too large index and return errors from of_gpio_named_count
On Tue, 29 Jan 2013 15:53:39 +0100, Andreas Larsson andr...@gaisler.com wrote: This lets of_gpio_named_count return an errno on errors by being able to distinguish between reaching the end of the phandle list and getting some other error from of_parse_phandle_with_args. Return error from of_spi_register_master when there is an cs-gpios list for which gp_gpio_named_count fails. Adjust various drivers cope with error return from of_gpio_named_count, including via of_gpio_count. Signed-off-by: Andreas Larsson andr...@gaisler.com Actually, I'd been meaning to fix of_gpio_count for quite a while now. The current code uses a stupid algorithm to parse each specifier one at a time and count how many iterations it takes before getting an error. BLECH! A pox on me for being so lazy when I wrote it. Anyway, your patch here spurred me on to fix it. I've just done so and will post the patch in a few minutes. Please test and let me know if it works for you. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 3/6] of_spi: Initialize cs_gpios properly
On Tue, 29 Jan 2013 15:53:40 +0100, Andreas Larsson andr...@gaisler.com wrote: Using memset does not set an array of integers properly Signed-off-by: Andreas Larsson andr...@gaisler.com Applied, thanks. g. --- drivers/spi/spi.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9c2acf1..a4baa0a 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1083,7 +1083,8 @@ static int of_spi_register_master(struct spi_master *master) if (!master-cs_gpios) return -ENOMEM; - memset(cs, -EINVAL, master-num_chipselect); + for (i = 0; i master-num_chipselect; i++) + cs[i] = -EINVAL; for (i = 0; i nb; i++) cs[i] = of_get_named_gpio(np, cs-gpios, i); -- 1.7.0.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 4/6] of_spi: Document cs_gpios and cs_gpio in kernel-doc
On Tue, 29 Jan 2013 15:53:41 +0100, Andreas Larsson andr...@gaisler.com wrote: This adds missing kernel-doc entries for cs_gpios in struct spi_master and cs_gpio in struct spi_device. Signed-off-by: Andreas Larsson andr...@gaisler.com Applied, thanks. I did tweak the language a bit. g. --- include/linux/spi/spi.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index f629189..88a669c 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -57,6 +57,7 @@ extern struct bus_type spi_bus_type; * @modalias: Name of the driver to use with this device, or an alias * for that name. This appears in the sysfs modalias attribute * for driver coldplugging, and in uevents used for hotplugging + * @cs_gpio: Negative or gpio for chip select. * * A @spi_device is used to interchange data between an SPI slave * (usually a discrete chip) and CPU memory. @@ -258,6 +259,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * @unprepare_transfer_hardware: there are currently no more messages on the * queue so the subsystem notifies the driver that it may relax the * hardware by issuing this call + * @cs_gpios: possible array of negative values or gpios for chip selects * * Each SPI master controller can communicate with one or more @spi_device * children. These make a small bus, sharing MOSI, MISO and SCK signals -- 1.7.0.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 6/6] of_spi: Initialize cs_gpios and cs_gpio with -EEXIST
On Tue, 29 Jan 2013 15:53:43 +0100, Andreas Larsson andr...@gaisler.com wrote: Holes in the cs-gpios DT phandle list is supposed to mark that native chipselects is to be used. The value returned from of_get_named_gpio_flags in this case is -EEXIST. By initializing cs_gpios and cs_gpio with -EEXIST, this and only this errno will indicate to a spi controller driver that a native chipselect is to be used. Signed-off-by: Andreas Larsson andr...@gaisler.com I've left this one off for now. Take a look at the patch I posted and let me know if you think this one should still be applied. g. --- drivers/spi/spi.c |4 ++-- include/linux/spi/spi.h |7 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6f1b717..7494bad 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -334,7 +334,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master) spi-dev.parent = master-dev; spi-dev.bus = spi_bus_type; spi-dev.release = spidev_release; - spi-cs_gpio = -EINVAL; + spi-cs_gpio = -EEXIST; device_initialize(spi-dev); return spi; } @@ -1097,7 +1097,7 @@ static int of_spi_register_master(struct spi_master *master) } for (i = 0; i master-num_chipselect; i++) - cs[i] = -EINVAL; + cs[i] = -EEXIST; for (i = 0; i nb; i++) cs[i] = of_get_named_gpio_flags(np, cs-gpios, i, flags[i]); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 96b1055..0701882 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -58,7 +58,8 @@ extern struct bus_type spi_bus_type; * @modalias: Name of the driver to use with this device, or an alias * for that name. This appears in the sysfs modalias attribute * for driver coldplugging, and in uevents used for hotplugging - * @cs_gpio: Negative or gpio for chip select. + * @cs_gpio: Negative or gpio for chip select. Set to -EEXIST when chipselect + * should be handled natively by the controller driver * @cs_gpio_flags: of_gpio_flags corresponding to cs_gpio * * A @spi_device is used to interchange data between an SPI slave @@ -262,7 +263,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * @unprepare_transfer_hardware: there are currently no more messages on the * queue so the subsystem notifies the driver that it may relax the * hardware by issuing this call - * @cs_gpios: possible array of negative values or gpios for chip selects + * @cs_gpios: possible array of negative values or gpios for chip selects. A + * chipselect that should be handled natively by the controller driver is + * set to -EEXIST. * @cs_gpio_flags: possible array of of_gpio_flags corresponding to cs_gpios * * Each SPI master controller can communicate with one or more @spi_device -- 1.7.0.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH RFC 1/1] gpio: mcp23s08: convert driver to DT
On Wed, 6 Feb 2013 10:31:04 +0100, Lars Poeschel poesc...@lemonage.de wrote: On Tuesday 05 February 2013 at 15:29:09, Grant Likely wrote: On Thu, 31 Jan 2013 21:51:36 +0100, Linus Walleij linus.wall...@linaro.org wrote: On Thu, Jan 31, 2013 at 4:58 PM, Lars Poeschel la...@wh2.tu-dresden.de wrote: --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt @@ -0,0 +1,27 @@ +Microchip MCP2308/MCP23S08/MCP23017/MCP23S17 driver for +8-/16-bit I/O expander with serial interface (I2C/SPI) + +Required properties: +- compatible : Should be mcp,mcp23s08-gpio, mcp,mcp23s17-gpio, + mcp,mcp23008-gpio or mcp,mcp23017-gpio +- base : The first gpio number that should be assigned by this chip. No. We do not tie the global GPIO numbers into the device tree. In the DT GPIOs are referenced by ampersand gpio0 1 2 notation referring to the instance, so as you realize DT itself has no need for that number. Further it is not OS-neutral. You have to find another way to handle this in the driver code. In worst case: use AUXDATA. Hi Lars, The trick is to declare the io expander to be a gpio-controller and use the #gpio-cells property to declare how many cells (32-bit numbers) are need to specify a single gpio line. Most gpio controllers use gpio-cells=2; The first cell is the *controller local* gpio number, and the second cell is used for flags. That way your gpio controller can be referenced by other nodes in the tree with a gpios property. You can find lots of examples of this in the tree. Linus, Grant, thanks for the explanations. I think I have catched where it should go. The thing that confused me was, that the platform_data for the chip has a mandatory base member, that sets the linux global gpio number at which the chip should appear. A value of -1 for automatic assigning gpio number is not allowed, the chip will not probe. I have to change the driver to allow at least this -1 as an additional value. As Linus pointed out, it is not desirable to set the global gpio base number from device tree, right ? If I have 3 instances of this chips then, how can userspace sw distinguish then to which one it is talking ? You look in sysfs to find the chip you are interested in. That is the place to find out how dynamic numbers have been assigned. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/2] gpio: mcp23s08: Allow -1 as a legal value for global gpio base
On Wed, 6 Feb 2013 18:01:57 +0100, Lars Poeschel la...@wh2.tu-dresden.de wrote: From: Lars Poeschel poesc...@lemonage.de Explicitly allow -1 as a legal value for the mcp23s08_platform_data-base. This is the special value lets the kernel choose a valid global gpio base number. Signed-off-by: Lars Poeschel poesc...@lemonage.de --- drivers/gpio/gpio-mcp23s08.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index 3cea0ea..2afb828 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c @@ -483,7 +483,7 @@ static int mcp230xx_probe(struct i2c_client *client, int status; pdata = client-dev.platform_data; - if (!pdata || !gpio_is_valid(pdata-base)) { + if ((!pdata || !gpio_is_valid(pdata-base)) pdata-base != -1) { dev_dbg(client-dev, invalid or missing platform data\n); return -EINVAL; When used with the device tree you shouldn't have a platform data pointer at all. Instead you should modify the driver to not require it. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] gpio: mcp23s08: convert driver to DT
On Wed, 6 Feb 2013 18:01:58 +0100, Lars Poeschel la...@wh2.tu-dresden.de wrote: From: Lars Poeschel poesc...@lemonage.de This converts the mcp23s08 driver to be able to be used with device tree. There is a special mcp,chips property, that correspond to the chips member of the struct mcp23s08_platform_data. It can be used for multiple mcp23s08/mc23s17 on the same spi chipselect. Signed-off-by: Lars Poeschel poesc...@lemonage.de Ah, ignore my previous email. You did convert the driver. I've applied the two patches. Actually I squashed them together since they really were one logical change. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/4] spi: s3c64xx: modified error interrupt handling and init
On Tue, 5 Feb 2013 15:09:41 -0800, Girish K S girishks2...@gmail.com wrote: The status of the interrupt is available in the status register, so reading the clear pending register and writing back the same value will not actually clear the pending interrupts. This patch modifies the interrupt handler to read the status register and clear the corresponding pending bit in the clear pending register. Modified the hwInit function to clear all the pending interrupts. Signed-off-by: Girish K S ks.g...@samsung.com --- drivers/spi/spi-s3c64xx.c | 41 + 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index ad93231..b770f88 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -997,25 +997,30 @@ static irqreturn_t s3c64xx_spi_irq(int irq, void *data) { struct s3c64xx_spi_driver_data *sdd = data; struct spi_master *spi = sdd-master; - unsigned int val; + unsigned int val, clr = 0; - val = readl(sdd-regs + S3C64XX_SPI_PENDING_CLR); + val = readl(sdd-regs + S3C64XX_SPI_STATUS); - val = S3C64XX_SPI_PND_RX_OVERRUN_CLR | - S3C64XX_SPI_PND_RX_UNDERRUN_CLR | - S3C64XX_SPI_PND_TX_OVERRUN_CLR | - S3C64XX_SPI_PND_TX_UNDERRUN_CLR; - - writel(val, sdd-regs + S3C64XX_SPI_PENDING_CLR); - - if (val S3C64XX_SPI_PND_RX_OVERRUN_CLR) + if (val S3C64XX_SPI_ST_RX_OVERRUN_ERR) { + clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR; dev_err(spi-dev, RX overrun\n); - if (val S3C64XX_SPI_PND_RX_UNDERRUN_CLR) + } + if (val S3C64XX_SPI_ST_RX_UNDERRUN_ERR) { + clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR; dev_err(spi-dev, RX underrun\n); - if (val S3C64XX_SPI_PND_TX_OVERRUN_CLR) + } + if (val S3C64XX_SPI_ST_TX_OVERRUN_ERR) { + clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR; dev_err(spi-dev, TX overrun\n); - if (val S3C64XX_SPI_PND_TX_UNDERRUN_CLR) + } + if (val S3C64XX_SPI_ST_TX_UNDERRUN_ERR) { + clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR; dev_err(spi-dev, TX underrun\n); + } + + /* Clear the pending irq by setting and then clearing it */ + writel(clr, sdd-regs + S3C64XX_SPI_PENDING_CLR); + writel(clr ~clr, sdd-regs + S3C64XX_SPI_PENDING_CLR); Wait, what? clr ~clr == 0 Always. What are you actually trying to do here? return IRQ_HANDLED; } @@ -1039,9 +1044,13 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel) writel(0, regs + S3C64XX_SPI_MODE_CFG); writel(0, regs + S3C64XX_SPI_PACKET_CNT); - /* Clear any irq pending bits */ - writel(readl(regs + S3C64XX_SPI_PENDING_CLR), - regs + S3C64XX_SPI_PENDING_CLR); + /* Clear any irq pending bits, should set and clear the bits */ + val = S3C64XX_SPI_PND_RX_OVERRUN_CLR | + S3C64XX_SPI_PND_RX_UNDERRUN_CLR | + S3C64XX_SPI_PND_TX_OVERRUN_CLR | + S3C64XX_SPI_PND_TX_UNDERRUN_CLR; + writel(val, regs + S3C64XX_SPI_PENDING_CLR); + writel(val ~val, regs + S3C64XX_SPI_PENDING_CLR); Ditto. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/4] spi: s3c64xx: modified error interrupt handling and init
On Wed, Feb 6, 2013 at 8:12 PM, Girish KS girishks2...@gmail.com wrote: On Wed, Feb 6, 2013 at 2:26 AM, Grant Likely grant.lik...@secretlab.ca wrote: On Tue, 5 Feb 2013 15:09:41 -0800, Girish K S girishks2...@gmail.com wrote: The status of the interrupt is available in the status register, so reading the clear pending register and writing back the same value will not actually clear the pending interrupts. This patch modifies the interrupt handler to read the status register and clear the corresponding pending bit in the clear pending register. Modified the hwInit function to clear all the pending interrupts. Signed-off-by: Girish K S ks.g...@samsung.com --- drivers/spi/spi-s3c64xx.c | 41 + 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index ad93231..b770f88 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -997,25 +997,30 @@ static irqreturn_t s3c64xx_spi_irq(int irq, void *data) { struct s3c64xx_spi_driver_data *sdd = data; struct spi_master *spi = sdd-master; - unsigned int val; + unsigned int val, clr = 0; - val = readl(sdd-regs + S3C64XX_SPI_PENDING_CLR); + val = readl(sdd-regs + S3C64XX_SPI_STATUS); - val = S3C64XX_SPI_PND_RX_OVERRUN_CLR | - S3C64XX_SPI_PND_RX_UNDERRUN_CLR | - S3C64XX_SPI_PND_TX_OVERRUN_CLR | - S3C64XX_SPI_PND_TX_UNDERRUN_CLR; - - writel(val, sdd-regs + S3C64XX_SPI_PENDING_CLR); - - if (val S3C64XX_SPI_PND_RX_OVERRUN_CLR) + if (val S3C64XX_SPI_ST_RX_OVERRUN_ERR) { + clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR; dev_err(spi-dev, RX overrun\n); - if (val S3C64XX_SPI_PND_RX_UNDERRUN_CLR) + } + if (val S3C64XX_SPI_ST_RX_UNDERRUN_ERR) { + clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR; dev_err(spi-dev, RX underrun\n); - if (val S3C64XX_SPI_PND_TX_OVERRUN_CLR) + } + if (val S3C64XX_SPI_ST_TX_OVERRUN_ERR) { + clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR; dev_err(spi-dev, TX overrun\n); - if (val S3C64XX_SPI_PND_TX_UNDERRUN_CLR) + } + if (val S3C64XX_SPI_ST_TX_UNDERRUN_ERR) { + clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR; dev_err(spi-dev, TX underrun\n); + } + + /* Clear the pending irq by setting and then clearing it */ + writel(clr, sdd-regs + S3C64XX_SPI_PENDING_CLR); + writel(clr ~clr, sdd-regs + S3C64XX_SPI_PENDING_CLR); Wait, what? clr ~clr == 0 Always. What are you actually trying to do here? The user manual says, wirting 1 to the pending clear register clears the interrupt (its not auto clear to 0). so i need to explicitly reset those bits thats what the 2nd write does Then write 0. That's the result of what the code does anyway, but the code as-written is nonsensical. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/2] spi: sirf: use clk_prepare_enable and clk_disable_unprepare
On Wed, 26 Dec 2012 10:48:33 +0800, Barry Song barry.s...@csr.com wrote: From: Barry Song baohua.s...@csr.com Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare calls as required by common clock framework. Signed-off-by: Barry Song baohua.s...@csr.com Applied, thanks. g. --- drivers/spi/spi-sirf.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index e0f43a5..38a191c 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -570,7 +570,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) ret = -EINVAL; goto free_pin; } - clk_enable(sspi-clk); + clk_prepare_enable(sspi-clk); sspi-ctrl_freq = clk_get_rate(sspi-clk); init_completion(sspi-done); @@ -594,7 +594,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) return 0; free_clk: - clk_disable(sspi-clk); + clk_disable_unprepare(sspi-clk); clk_put(sspi-clk); free_pin: pinctrl_put(sspi-p); @@ -618,7 +618,7 @@ static int spi_sirfsoc_remove(struct platform_device *pdev) if (sspi-chipselect[i] 0) gpio_free(sspi-chipselect[i]); } - clk_disable(sspi-clk); + clk_disable_unprepare(sspi-clk); clk_put(sspi-clk); pinctrl_put(sspi-p); spi_master_put(master); -- 1.7.5.4 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2] mxs: spi: clear XFER_COUNT in ctrl0 field in DMA descriptor
On Wed, 26 Dec 2012 14:48:51 +0900, Juha Lumme juha.lu...@gmail.com wrote: On MX23 the XFER_COUNT part in ctrl0 field in DMA descriptor was improperly OR'd during the construction of DMA descriptor chain, instead of being freshly set. Because of that too many bytes were being expected from SPI during the last DMA cycle. This caused a timeout (SSP_TIMEOUT) to happen in the processing of the last DMA descriptor, and thus reads and writes were failing. This is a fix for the problem, by clearing XFER_COUNT bytes in ctrl0 before setting the new XFER_COUNT for DMA descriptor. Cc: Marek Vasut ma...@denx.de Cc: Fabio Estevam fabio.este...@freescale.com Cc: Shawn Guo shawn@linaro.org Applied, thanks. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/6] spi/ath79: add delay between SCK changes
On Thu, 27 Dec 2012 10:42:24 +0100, Gabor Juhos juh...@openwrt.org wrote: The driver uses the as fast as it can approach to drive the SCK signal. However this does not work with certain low speed SPI chips (e.g. the PCF2123 RTC chip). The patch adds per-bit slowdowns in order to be able to use the driver with such chips as well. Signed-off-by: Gabor Juhos juh...@openwrt.org I've applied this, but please take a second look to make sure you're not doing something unintended. The ndelay call will spin until it completes. If the current context is interrupted or scheduled out then it will still spin when it gets back. You may be wasting more time than is necessary. It would be better to check the wall time over a loop iteration. And if the delay required is large, then it should sleep. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/6] spi/ath79: add missing HIGH-LOW SCK transition
On Thu, 27 Dec 2012 10:42:25 +0100, Gabor Juhos juh...@openwrt.org wrote: The 'ath79_spi_txrx_mode0' function does not set the SCK signal to LOW at the end of a word transfer. This causes communications errors with certain devices (e.g. the PCF2123 RTC chip). The patch ensures that the SCK signal will be LOW. Signed-off-by: Gabor Juhos juh...@openwrt.org Applied, thanks. g. --- drivers/spi/spi-ath79.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index e025282..d4b8e12 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c @@ -200,6 +200,8 @@ static u32 ath79_spi_txrx_mode0(struct spi_device *spi, unsigned nsecs, ath79_spi_delay(sp, nsecs); ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out | AR71XX_SPI_IOC_CLK); ath79_spi_delay(sp, nsecs); + if (bits == 1) + ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out); word = 1; } -- 1.7.10 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 3/6] spi/ath79: remove superfluous chip select code
On Thu, 27 Dec 2012 10:42:26 +0100, Gabor Juhos juh...@openwrt.org wrote: The spi_bitbang driver calls the chipselect function of the driver from spi_bitbang_setup in order to deselect the given SPI chip, so we don't have to initialize the CS line here. Signed-off-by: Gabor Juhos juh...@openwrt.org Applied, thanks. g. --- drivers/spi/spi-ath79.c |6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index d4b8e12..a725e62 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c @@ -128,12 +128,6 @@ static int ath79_spi_setup_cs(struct spi_device *spi) gpio_free(cdata-gpio); return status; } - } else { - if (spi-mode SPI_CS_HIGH) - sp-ioc_base |= AR71XX_SPI_IOC_CS0; - else - sp-ioc_base = ~AR71XX_SPI_IOC_CS0; - ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp-ioc_base); } return 0; -- 1.7.10 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 4/6] spi/ath79: use gpio_request_one
On Thu, 27 Dec 2012 10:42:27 +0100, Gabor Juhos juh...@openwrt.org wrote: Use gpio_request_one() instead of multiple gpiolib calls. Signed-off-by: Gabor Juhos juh...@openwrt.org Applied, thanks. g. --- drivers/spi/spi-ath79.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index a725e62..19d539e 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c @@ -100,6 +100,7 @@ static int ath79_spi_setup_cs(struct spi_device *spi) { struct ath79_spi *sp = ath79_spidev_to_sp(spi); struct ath79_spi_controller_data *cdata; + int status; cdata = spi-controller_data; if (spi-chip_select !cdata) @@ -115,22 +116,21 @@ static int ath79_spi_setup_cs(struct spi_device *spi) /* TODO: setup speed? */ ath79_spi_wr(sp, AR71XX_SPI_REG_CTRL, 0x43); + status = 0; if (spi-chip_select) { - int status = 0; + unsigned long flags; - status = gpio_request(cdata-gpio, dev_name(spi-dev)); - if (status) - return status; + flags = GPIOF_DIR_OUT; + if (spi-mode SPI_CS_HIGH) + flags |= GPIOF_INIT_HIGH; + else + flags |= GPIOF_INIT_LOW; - status = gpio_direction_output(cdata-gpio, -spi-mode SPI_CS_HIGH); - if (status) { - gpio_free(cdata-gpio); - return status; - } + status = gpio_request_one(cdata-gpio, flags, + dev_name(spi-dev)); } - return 0; + return status; } static void ath79_spi_cleanup_cs(struct spi_device *spi) -- 1.7.10 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 6/6] spi/ath79: add shutdown handler
On Thu, 27 Dec 2012 10:42:29 +0100, Gabor Juhos juh...@openwrt.org wrote: The SPI controller of the AR7xxx/AR9xxx SoCs have a special mode which allows the SoC to directly read data from SPI flash chips. In this mode, the content of the SPI flash chip can be accessed via a memory mapped region. During early init time, the kernel expects that the flash chip is accessible through that memory region because it reads board specific values (e.g. MAC address, WiFi calibration data) from the flash on various boards. This is working if the kernel is loaded directly by the bootloader because that leaves the SPI controller in the special mode. However it is not working in a kexec'd kernel because the SPI driver does not restore the special mode during shutdown. The patch adds a shutdown handler to fix this issue. Signed-off-by: Gabor Juhos juh...@openwrt.org --- drivers/spi/spi-ath79.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index 842acd8..73e491e 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c @@ -293,7 +293,7 @@ err_put_master: return ret; } -static int ath79_spi_remove(struct platform_device *pdev) +static void __ath79_spi_remove(struct platform_device *pdev) { struct ath79_spi *sp = platform_get_drvdata(pdev); @@ -304,13 +304,23 @@ static int ath79_spi_remove(struct platform_device *pdev) iounmap(sp-base); platform_set_drvdata(pdev, NULL); spi_master_put(sp-bitbang.master); +} +static int ath79_spi_remove(struct platform_device *pdev) +{ + __ath79_spi_remove(pdev); return 0; } +static void ath79_spi_shutdown(struct platform_device *pdev) +{ + __ath79_spi_remove(pdev); +} Just call ath79_spi_remote(pdev) directly from ath79_spi_shutdown(). No need for the extra hook and __ version of the original function. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties
On Tue, 22 Jan 2013 16:50:30 +0100, Maxime Ripard maxime.rip...@free-electrons.com wrote: On 09/01/2013 09:37, Maxime Ripard wrote: On 27/12/2012 22:54, Maxime Ripard wrote: The bindings assumed that the gpios properties were always there, which made the NO_TX and NO_RX mode not usable from device tree. Add extra checks to make sure that the driver can work if either MOSI or MISO is not used. Can you give me your Acked-by on this, or do you have any comments on this? Ping? Mark has applied it and it is now in my tree. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/2] spi: make sure all transfer has proper speed set
On Sat, 5 Jan 2013 00:17:14 +0530, Laxman Dewangan ldewan...@nvidia.com wrote: When spi client does the spi transfer and if it does not set the speed for each transfer then set it as default of spi device in spi core before calling low level transfer. This will remove the extra check in low level driver for setting speed. Signed-off-by: Laxman Dewangan ldewan...@nvidia.com Applied, thanks. g. --- drivers/spi/spi.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 19ee901..9676a29 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1366,12 +1366,14 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message) } /** - * Set transfer bits_per_word as spi device default if it is not - * set for this transfer. + * Set transfer bits_per_word and max speed as spi device default if + * it is not set for this transfer. */ list_for_each_entry(xfer, message-transfers, transfer_list) { if (!xfer-bits_per_word) xfer-bits_per_word = spi-bits_per_word; + if (!xfer-speed_hz) + xfer-speed_hz = spi-max_speed_hz; } message-spi = spi; -- 1.7.1.1 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] spi: tegra: remove checks for valid speed
On Sat, 5 Jan 2013 00:17:15 +0530, Laxman Dewangan ldewan...@nvidia.com wrote: SPI core make sure that all transfer has proper speed set before calling low level spi transfer. Hence, it is not require to have check in spi driver. Remove the check for speed validity from transfer and use it directly. Signed-off-by: Laxman Dewangan ldewan...@nvidia.com Applied, thanks. g. --- drivers/spi/spi-tegra20-sflash.c | 14 +++--- drivers/spi/spi-tegra20-slink.c |6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 448a8cc..9a42c15 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c @@ -269,9 +269,7 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, u32 speed; unsigned long command; - speed = t-speed_hz ? t-speed_hz : spi-max_speed_hz; - if (!speed) - speed = tsd-spi_max_frequency; + speed = t-speed_hz; if (speed != tsd-cur_speed) { clk_set_rate(tsd-clk, speed); tsd-cur_speed = speed; @@ -319,6 +317,15 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi, return tegra_sflash_start_cpu_based_transfer(tsd, t); } +static int tegra_sflash_setup(struct spi_device *spi) +{ + struct tegra_sflash_data *tsd = spi_master_get_devdata(spi-master); + + /* Set speed to the spi max fequency if spi device has not set */ + spi-max_speed_hz = spi-max_speed_hz ? : tsd-spi_max_frequency; + return 0; +} + static int tegra_sflash_transfer_one_message(struct spi_master *master, struct spi_message *msg) { @@ -492,6 +499,7 @@ static int tegra_sflash_probe(struct platform_device *pdev) /* the spi-mode bits understood by this driver: */ master-mode_bits = SPI_CPOL | SPI_CPHA; + master-setup = tegra_sflash_setup; master-transfer_one_message = tegra_sflash_transfer_one_message; master-num_chipselect = MAX_CHIP_SELECT; master-bus_num = -1; diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index 651167f..29039f1 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -728,9 +728,7 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi, unsigned long command2; bits_per_word = t-bits_per_word; - speed = t-speed_hz ? t-speed_hz : spi-max_speed_hz; - if (!speed) - speed = tspi-spi_max_frequency; + speed = t-speed_hz; if (speed != tspi-cur_speed) { clk_set_rate(tspi-clk, speed * 4); tspi-cur_speed = speed; @@ -841,6 +839,8 @@ static int tegra_slink_setup(struct spi_device *spi) BUG_ON(spi-chip_select = MAX_CHIP_SELECT); + /* Set speed to the spi max fequency if spi device has not set */ + spi-max_speed_hz = spi-max_speed_hz ? : tspi-spi_max_frequency; ret = pm_runtime_get_sync(tspi-dev); if (ret 0) { dev_err(tspi-dev, pm runtime failed, e = %d\n, ret); -- 1.7.1.1 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: spi-imx: Add MODULE_ALIAS()
On Mon, 7 Jan 2013 20:42:55 -0200, Fabio Estevam feste...@gmail.com wrote: From: Fabio Estevam fabio.este...@freescale.com Add an entry for MODULE_ALIAS(). Signed-off-by: Fabio Estevam fabio.este...@freescale.com Applied, thanks. g. --- drivers/spi/spi-imx.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 9049132..0befeeb 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -949,3 +949,4 @@ module_platform_driver(spi_imx_driver); MODULE_DESCRIPTION(SPI Master Controller driver); MODULE_AUTHOR(Sascha Hauer, Pengutronix); MODULE_LICENSE(GPL); +MODULE_ALIAS(platform: DRIVER_NAME); -- 1.7.9.5 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2] spi: s3c64xx: Use devm_clk_get() and devm_request_irq()
On Thu, 10 Jan 2013 11:04:21 +0900, Jingoo Han jg1@samsung.com wrote: Use devm_clk_get() and devm_request_irq() rather than clk_get() and request_irq() to make cleanup paths more simple. Signed-off-by: Jingoo Han jg1@samsung.com Applied, thanks. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: s3c64xx: fix checkpatch warnings and error
(pdev-dev, failed to get alias id, errno %d\n, + ret); goto err0; } sdd-port_id = ret; @@ -1347,8 +1341,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) goto err8; } - dev_dbg(pdev-dev, Samsung SoC SPI Driver loaded for Bus SPI-%d - with %d Slaves attached\n, + dev_dbg(pdev-dev, Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n, sdd-port_id, master-num_chipselect); dev_dbg(pdev-dev, \tIOmem=[0x%x-0x%x]\tDMA=[Rx-%d, Tx-%d]\n, mem_res-end, mem_res-start, -- 1.7.2.5 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 14/19] spi/atmel: remove incorrect __exit_p()
On Fri, 25 Jan 2013 14:14:31 +, Arnd Bergmann a...@arndb.de wrote: Since we no longer allow building without hotplug, the atmel_spi_remove function is always present and we should not use __exit_p() to refer to it. Without this patch, building at91_dt_defconfig results in: drivers/spi/spi-atmel.c:1006:12: warning: 'atmel_spi_remove' defined but not used [-Wunused-function] Looks good, but I took a deeper look and it is incomplete. I found an whole bunch more references. I've crafted a new patch to get rid of them. I'll post and commit it to my tree. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] driver-core: constify data for class_find_device()
On Fri, 1 Feb 2013 20:40:17 +0100 (CET), Michał Mirosław mirq-li...@rere.qmqm.pl wrote: All in-kernel users of class_find_device() don't really need mutable data for match callback. In two places (kernel/power/suspend_test.c, drivers/scsi/osd/osd_uld.c) this patch changes match callbacks to use const search data. The const is propagated to rtc_class_open() and power_supply_get_by_name() parameters. Note that there's a dev reference leak in suspend_test.c that's not touched in this patch. Signed-off-by: Michał Mirosław mirq-li...@rere.qmqm.pl --- patch against https://github.com/torvalds/linux.git master Acked-by: Grant Likely grant.lik...@secretlab.ca for the GPIO and SPI bits. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH] spi: Remove erroneous __exit and __exit_p() references in drivers
Some of the spi driver module remove hooks were annotated with __exit and referenced with __exit_p(). Presumably these were supposed to be __devexit and __devexit_p() since __exit for a remove hook has never been correct. They also got missed during the big __devexit purge since they didn't match the pattern. Remove then now to be rid of it. Reported-by: Arnd Bergmann a...@arndb.de [Arnd set a patch cleaning up one, and then I found more] Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- drivers/spi/spi-atmel.c |2 +- drivers/spi/spi-au1550.c |4 ++-- drivers/spi/spi-omap-100k.c |4 ++-- drivers/spi/spi-omap-uwire.c |4 ++-- drivers/spi/spi-orion.c |4 ++-- drivers/spi/spi-ppc4xx.c |4 ++-- drivers/spi/spi-txx9.c |4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index ab34497..656d137 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1088,7 +1088,7 @@ static struct platform_driver atmel_spi_driver = { .suspend= atmel_spi_suspend, .resume = atmel_spi_resume, .probe = atmel_spi_probe, - .remove = __exit_p(atmel_spi_remove), + .remove = atmel_spi_remove, }; module_platform_driver(atmel_spi_driver); diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 4de66d1c..363ff6b 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c @@ -968,7 +968,7 @@ err_nomem: return err; } -static int __exit au1550_spi_remove(struct platform_device *pdev) +static int au1550_spi_remove(struct platform_device *pdev) { struct au1550_spi *hw = platform_get_drvdata(pdev); @@ -997,7 +997,7 @@ static int __exit au1550_spi_remove(struct platform_device *pdev) MODULE_ALIAS(platform:au1550-spi); static struct platform_driver au1550_spi_drv = { - .remove = __exit_p(au1550_spi_remove), + .remove = au1550_spi_remove, .driver = { .name = au1550-spi, .owner = THIS_MODULE, diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 3aef7fa..d31e203 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -560,7 +560,7 @@ err1: return status; } -static int __exit omap1_spi100k_remove(struct platform_device *pdev) +static int omap1_spi100k_remove(struct platform_device *pdev) { struct spi_master *master; struct omap1_spi100k*spi100k; @@ -604,7 +604,7 @@ static struct platform_driver omap1_spi100k_driver = { .name = omap1_spi100k, .owner = THIS_MODULE, }, - .remove = __exit_p(omap1_spi100k_remove), + .remove = omap1_spi100k_remove, }; diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index 0a94d9d..b8f2535 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c @@ -536,7 +536,7 @@ static int __init uwire_probe(struct platform_device *pdev) return status; } -static int __exit uwire_remove(struct platform_device *pdev) +static int uwire_remove(struct platform_device *pdev) { struct uwire_spi*uwire = dev_get_drvdata(pdev-dev); int status; @@ -557,7 +557,7 @@ static struct platform_driver uwire_driver = { .name = omap_uwire, .owner = THIS_MODULE, }, - .remove = __exit_p(uwire_remove), + .remove = uwire_remove, // suspend ... unuse ck // resume ... use ck }; diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index b7e7182..4a548e8 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -479,7 +479,7 @@ out: } -static int __exit orion_spi_remove(struct platform_device *pdev) +static int orion_spi_remove(struct platform_device *pdev) { struct spi_master *master; struct resource *r; @@ -513,7 +513,7 @@ static struct platform_driver orion_spi_driver = { .owner = THIS_MODULE, .of_match_table = of_match_ptr(orion_spi_of_match_table), }, - .remove = __exit_p(orion_spi_remove), + .remove = orion_spi_remove, }; static int __init orion_spi_init(void) diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index 7a85f22..027b474 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c @@ -560,7 +560,7 @@ free_master: return ret; } -static int __exit spi_ppc4xx_of_remove(struct platform_device *op) +static int spi_ppc4xx_of_remove(struct platform_device *op) { struct spi_master *master = dev_get_drvdata(op-dev); struct ppc4xx_spi *hw = spi_master_get_devdata(master); @@ -583,7 +583,7 @@ MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match); static struct platform_driver spi_ppc4xx_of_driver
Re: [PATCH 1/3] spi: Add helper functions for setting up transfers
On Sun, 27 Jan 2013 03:33:59 +, Mark Brown broo...@opensource.wolfsonmicro.com wrote: On Wed, Jan 09, 2013 at 06:31:09PM +0100, Lars-Peter Clausen wrote: The second function spi_sync_transfer() takes a SPI device and an array of spi_transfers. It will allocate a new spi_message (on the stack) and add all transfers in the array to the message. Finally it will call spi_sync() on the message. Reviewed-by: Mark Brown broo...@opensource.wolfsonmicro.com Looks good to me also. Go ahead and merge this series through the iio tree since it is the first user. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2] spi: spi-mpc512x-psc: don't use obsolet cell-index property
On Fri, 11 Jan 2013 01:05:48 +0100, Anatolij Gustschin ag...@denx.de wrote: Remove deprecated cell-index property and use spi alias to obtain the SPI PSC number used for SPI bus id. Signed-off-by: Anatolij Gustschin ag...@denx.de --- v2: - use of_alias_get_id() to get spi bus number Applied, thanks. g. drivers/spi/spi-mpc512x-psc.c | 16 +--- 1 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index cb3a310..88e5441 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c @@ -522,17 +522,11 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) regaddr64 = of_translate_address(op-dev.of_node, regaddr_p); /* get PSC id (0..11, used by port_config) */ - if (op-dev.platform_data == NULL) { - const u32 *psc_nump; - - psc_nump = of_get_property(op-dev.of_node, cell-index, NULL); - if (!psc_nump || *psc_nump 11) { - dev_err(op-dev, mpc512x_psc_spi: Device node %s - has invalid cell-index property\n, - op-dev.of_node-full_name); - return -EINVAL; - } - id = *psc_nump; + id = of_alias_get_id(op-dev.of_node, spi); + if (id 0) { + dev_err(op-dev, no alias id for %s\n, + op-dev.of_node-full_name); + return id; } return mpc512x_psc_spi_do_probe(op-dev, (u32) regaddr64, (u32) size64, -- 1.7.5.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/2] spi: spi-mpc512x-psc: init mode bits supported by the driver
On Mon, 14 Jan 2013 21:27:00 +0100, Anatolij Gustschin ag...@denx.de wrote: The driver should setup mode bits it supports, otherwise adding an SPI device might fail even if the driver supports the requested SPI mode. Signed-off-by: Anatolij Gustschin ag...@denx.de Applied, thanks. g. --- drivers/spi/spi-mpc512x-psc.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 88e5441..89480b2 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c @@ -438,6 +438,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, master-num_chipselect = pdata-max_chipselect; } + master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST; master-setup = mpc512x_psc_spi_setup; master-transfer = mpc512x_psc_spi_transfer; master-cleanup = mpc512x_psc_spi_cleanup; -- 1.7.5.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] spi: spi-mpc512x-psc: add support for gpio chip selects
); + if (ret) { + dev_err(dev, can't get CS gpio: %d\n, ret); + goto free_cs_gpios; + } + } + master-num_chipselect = max_cs_num; + mps-num_cs = num_cs; + } + master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST; master-setup = mpc512x_psc_spi_setup; master-transfer = mpc512x_psc_spi_transfer; @@ -485,6 +546,11 @@ unreg_master: destroy_workqueue(mps-workqueue); free_irq: free_irq(mps-irq, mps); +free_cs_gpios: + while (--i = 0) { + if (gpio_is_valid(mps-chipselects[i])) + gpio_free(mps-chipselects[i]); + } free_master: if (mps-psc) iounmap(mps-psc); @@ -497,6 +563,7 @@ static int mpc512x_psc_spi_do_remove(struct device *dev) { struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); + int i; flush_workqueue(mps-workqueue); destroy_workqueue(mps-workqueue); @@ -504,6 +571,9 @@ static int mpc512x_psc_spi_do_remove(struct device *dev) free_irq(mps-irq, mps); if (mps-psc) iounmap(mps-psc); + for (i = 0; i mps-num_cs; i++) + if (gpio_is_valid(mps-chipselects[i])) + gpio_free(mps-chipselects[i]); spi_master_put(master); return 0; -- 1.7.5.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 25/33] spi: Convert to devm_ioremap_resource()
On Mon, 21 Jan 2013 11:09:18 +0100, Thierry Reding thierry.red...@avionic-design.de wrote: 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 thierry.red...@avionic-design.de Cc: Grant Likely grant.lik...@secretlab.ca Cc: spi-devel-general@lists.sourceforge.net Looks fine by me. Go ahead and merge with the rest of the series. Acked-by: Grant Likely grant.lik...@secretlab.ca --- drivers/spi/spi-ep93xx.c | 7 +++ drivers/spi/spi-mxs.c| 6 +++--- drivers/spi/spi-omap2-mcspi.c| 7 +++ drivers/spi/spi-s3c64xx.c| 7 +++ drivers/spi/spi-sirf.c | 7 +++ drivers/spi/spi-tegra20-sflash.c | 8 +++- drivers/spi/spi-tegra20-slink.c | 8 +++- 7 files changed, 21 insertions(+), 29 deletions(-) diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index acb1e19..2e31f32 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c @@ -1085,10 +1085,9 @@ static int ep93xx_spi_probe(struct platform_device *pdev) espi-sspdr_phys = res-start + SSPDR; - espi-regs_base = devm_request_and_ioremap(pdev-dev, res); - if (!espi-regs_base) { - dev_err(pdev-dev, failed to map resources\n); - error = -ENODEV; + espi-regs_base = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(espi-regs_base)) { + error = PTR_ERR(espi-regs_base); goto fail_put_clock; } diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index a3ede24..b735988 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c @@ -538,9 +538,9 @@ static int mxs_spi_probe(struct platform_device *pdev) if (!iores || irq_err 0 || irq_dma 0) return -EINVAL; - base = devm_request_and_ioremap(pdev-dev, iores); - if (!base) - return -EADDRNOTAVAIL; + base = devm_ioremap_resource(pdev-dev, iores); + if (IS_ERR(base)) + return PTR_ERR(base); pinctrl = devm_pinctrl_get_select_default(pdev-dev); if (IS_ERR(pinctrl)) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b610f52..71a9482 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1204,10 +1204,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev) r-end += regs_offset; mcspi-phys = r-start; - mcspi-base = devm_request_and_ioremap(pdev-dev, r); - if (!mcspi-base) { - dev_dbg(pdev-dev, can't ioremap MCSPI\n); - status = -ENOMEM; + mcspi-base = devm_ioremap_resource(pdev-dev, r); + if (IS_ERR(mcspi-base)) { + status = PTR_ERR(mcspi-base); goto free_master; } diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index ad93231..3d4a7c4 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1276,10 +1276,9 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) /* the spi-mode bits understood by this driver: */ master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; - sdd-regs = devm_request_and_ioremap(pdev-dev, mem_res); - if (sdd-regs == NULL) { - dev_err(pdev-dev, Unable to remap IO\n); - ret = -ENXIO; + sdd-regs = devm_ioremap_resource(pdev-dev, mem_res); + if (IS_ERR(sdd-regs)) { + ret = PTR_ERR(sdd-regs); goto err1; } diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index e0f43a5..78c8842 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -535,10 +535,9 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) } } - sspi-base = devm_request_and_ioremap(pdev-dev, mem_res); - if (!sspi-base) { - dev_err(pdev-dev, IO remap failed!\n); - ret = -ENOMEM; + sspi-base = devm_ioremap_resource(pdev-dev, mem_res); + if (IS_ERR(sspi-base)) { + ret = PTR_ERR(sspi-base); goto free_master; } diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 448a8cc..69c9d23 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c @@ -508,11 +508,9 @@ static int tegra_sflash_probe(struct platform_device *pdev) ret = -ENODEV; goto exit_free_master; } - tsd-base = devm_request_and_ioremap(pdev-dev, r); - if (!tsd-base) { - dev_err(pdev-dev, - Cannot request memregion/iomap dma address\n); - ret = -EADDRNOTAVAIL; + tsd-base = devm_ioremap_resource(pdev-dev, r
Re: [PATCH] spi: Ensure memory used for spi_write_then_read() is DMA safe
On Sun, 27 Jan 2013 14:35:04 +0800, Mark Brown broo...@opensource.wolfsonmicro.com wrote: Use GFP_DMA in order to ensure that the memory we allocate for transfers in spi_write_then_read() can be DMAed. On most platforms this will have no effect. Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com Applied, thanks. g. --- drivers/spi/spi.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 19ee901..14d0fba 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1656,7 +1656,8 @@ int spi_write_then_read(struct spi_device *spi, * using the pre-allocated buffer or the transfer is too large. */ if ((n_tx + n_rx) SPI_BUFSIZ || !mutex_trylock(lock)) { - local_buf = kmalloc(max((unsigned)SPI_BUFSIZ, n_tx + n_rx), GFP_KERNEL); + local_buf = kmalloc(max((unsigned)SPI_BUFSIZ, n_tx + n_rx), + GFP_KERNEL | GFP_DMA); if (!local_buf) return -ENOMEM; } else { -- 1.7.10.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/5] spi: pl022: use generic DMA slave configuration if possible
On Mon, 28 Jan 2013 17:57:34 +, Arnd Bergmann a...@arndb.de wrote: With the new OF DMA binding, it is possible to completely avoid the need for platform_data for configuring a DMA channel. In cases where the platform has already been converted, calling dma_request_slave_channel should get all the necessary information from the device tree. Like the patch that converts the dw_dma controller, this is completely untested and is looking for someone to try it out. Signed-off-by: Arnd Bergmann a...@arndb.de Cc: Grant Likely grant.lik...@secretlab.ca Cc: Mark Brown broo...@opensource.wolfsonmicro.com Cc: spi-devel-general@lists.sourceforge.net Cc: Viresh Kumar viresh.ku...@linaro.org Cc: Andy Shevchenko andriy.shevche...@linux.intel.com Cc: Vinod Koul vinod.k...@linux.intel.com Cc: devicetree-disc...@lists.ozlabs.org Cc: linux-arm-ker...@vger.kernel.org --- drivers/spi/spi-pl022.c | 43 +-- 1 file changed, 41 insertions(+), 2 deletions(-) Acked-by: Grant Likely grant.lik...@secretlab.ca diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index b0fe393..371cc66f 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -1139,6 +1139,35 @@ err_no_rxchan: return -ENODEV; } +static int pl022_dma_autoprobe(struct pl022 *pl022) +{ + struct device *dev = pl022-adev-dev; + + /* automatically configure DMA channels from platform, normally using DT */ + pl022-dma_rx_channel = dma_request_slave_channel(dev, rx); + if (!pl022-dma_rx_channel) + goto err_no_rxchan; + + pl022-dma_tx_channel = dma_request_slave_channel(dev, tx); + if (!pl022-dma_tx_channel) + goto err_no_txchan; + + pl022-dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!pl022-dummypage) + goto err_no_dummypage; + + return 0; + +err_no_dummypage: + dma_release_channel(pl022-dma_tx_channel); + pl022-dma_tx_channel = NULL; +err_no_txchan: + dma_release_channel(pl022-dma_rx_channel); + pl022-dma_rx_channel = NULL; +err_no_rxchan: + return -ENODEV; +} + static void terminate_dma(struct pl022 *pl022) { struct dma_chan *rxchan = pl022-dma_rx_channel; @@ -1167,6 +1196,11 @@ static inline int configure_dma(struct pl022 *pl022) return -ENODEV; } +static inline int pl022_dma_autoprobe(struct pl022 *pl022) +{ + return 0; +} + static inline int pl022_dma_probe(struct pl022 *pl022) { return 0; @@ -2226,8 +2260,13 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) goto err_no_irq; } - /* Get DMA channels */ - if (platform_info-enable_dma) { + /* Get DMA channels, try autoconfiguration first */ + status = pl022_dma_autoprobe(pl022); + + /* If that failed, use channels from platform_info */ + if (status == 0) + platform_info-enable_dma = 1; + else if (platform_info-enable_dma) { status = pl022_dma_probe(pl022); if (status != 0) platform_info-enable_dma = 0; -- 1.8.0 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 3/5] serial: pl011: use generic DMA slave configuration if possible
On Mon, 28 Jan 2013 17:57:35 +, Arnd Bergmann a...@arndb.de wrote: With the new OF DMA binding, it is possible to completely avoid the need for platform_data for configuring a DMA channel. In cases where the platform has already been converted, calling dma_request_slave_channel should get all the necessary information from the device tree. Like the patch that converts the dw_dma controller, this is completely untested and is looking for someone to try it out. Signed-off-by: Arnd Bergmann a...@arndb.de Cc: Grant Likely grant.lik...@secretlab.ca Cc: Jiri Slaby jsl...@suse.cz Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Linus Walleij linus.wall...@linaro.org Cc: spi-devel-general@lists.sourceforge.net Cc: Viresh Kumar viresh.ku...@linaro.org Cc: Andy Shevchenko andriy.shevche...@linux.intel.com Cc: Vinod Koul vinod.k...@linux.intel.com Cc: devicetree-disc...@lists.ozlabs.org Cc: linux-arm-ker...@vger.kernel.org Acked-by: Grant Likely grant.lik...@secretlab.ca --- drivers/tty/serial/amba-pl011.c | 62 - 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 3ea5408..c25b00e 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -245,7 +245,7 @@ static void pl011_sgbuf_free(struct dma_chan *chan, struct pl011_sgbuf *sg, } } -static void pl011_dma_probe_initcall(struct uart_amba_port *uap) +static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *uap) { /* DMA is the sole user of the platform data right now */ struct amba_pl011_data *plat = uap-port.dev-platform_data; @@ -259,20 +259,25 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) struct dma_chan *chan; dma_cap_mask_t mask; - /* We need platform data */ - if (!plat || !plat-dma_filter) { - dev_info(uap-port.dev, no DMA platform data\n); - return; - } + chan = dma_request_slave_channel(dev, tx); - /* Try to acquire a generic DMA engine slave TX channel */ - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); - - chan = dma_request_channel(mask, plat-dma_filter, plat-dma_tx_param); if (!chan) { - dev_err(uap-port.dev, no TX DMA channel!\n); - return; + /* We need platform data */ + if (!plat || !plat-dma_filter) { + dev_info(uap-port.dev, no DMA platform data\n); + return; + } + + /* Try to acquire a generic DMA engine slave TX channel */ + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + + chan = dma_request_channel(mask, plat-dma_filter, + plat-dma_tx_param); + if (!chan) { + dev_err(uap-port.dev, no TX DMA channel!\n); + return; + } } dmaengine_slave_config(chan, tx_conf); @@ -282,7 +287,18 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) dma_chan_name(uap-dmatx.chan)); /* Optionally make use of an RX channel as well */ - if (plat-dma_rx_param) { + chan = dma_request_slave_channel(dev, rx); + + if (!chan plat-dma_rx_param) { + chan = dma_request_channel(mask, plat-dma_filter, plat-dma_rx_param); + + if (!chan) { + dev_err(uap-port.dev, no RX DMA channel!\n); + return; + } + } + + if (chan) { struct dma_slave_config rx_conf = { .src_addr = uap-port.mapbase + UART01x_DR, .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, @@ -291,12 +307,6 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) .device_fc = false, }; - chan = dma_request_channel(mask, plat-dma_filter, plat-dma_rx_param); - if (!chan) { - dev_err(uap-port.dev, no RX DMA channel!\n); - return; - } - dmaengine_slave_config(chan, rx_conf); uap-dmarx.chan = chan; @@ -315,6 +325,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) struct dma_uap { struct list_head node; struct uart_amba_port *uap; + struct device *dev; }; static LIST_HEAD(pl011_dma_uarts); @@ -325,7 +336,7 @@ static int __init pl011_dma_initcall(void) list_for_each_safe(node, tmp, pl011_dma_uarts) { struct dma_uap *dmau = list_entry(node, struct dma_uap, node); - pl011_dma_probe_initcall(dmau-uap); + pl011_dma_probe_initcall(dmau-dev, dmau-uap); list_del(node
Re: [PATCH V2 0/2] spi/bcm63xx: fix multi transfer messages
On Sun, 3 Feb 2013 15:15:11 +0100, Jonas Gorski j...@openwrt.org wrote: The bcm63xx SPI controller does not support keeping CS up after doing a transfer. Since this is problematic for most typical use cases, this patchset introduces a workaround by combining small enough messages to one transfer, rejecting anything that can't be fulfilled with the hardware. Patch one properly rejects anything impossible to transfer with these limitations. Patch two introduces logic for combining transfers to one to be able to use it for typical use cases (register accesses and flash access). Build and run tested on a BCM6368 with a SPI controlled switch attached requiring write-then-read with CS asserted. Changes V1 - V2: * split into two patches * fixed return type of bcm63xx_txrx_bufs() * slightly reworked bcm63xx_txrx_bufs, obsoleting one local variable * added a bit more comments in the code * added error messages indicated why transfers were rejected Another option is to allow longer transfers if a GPIO is used for the CS line. A lot of SPI controllers need to do that. That isn't a critique of this patch because it is essentially a bug fix, but rather a way you can work around the limitation. g. Jonas Gorski (2): spi/bcm63xx: reject transfers unable to transfer spi/bcm63xx: work around inability to keep CS up drivers/spi/spi-bcm63xx.c | 179 +++-- 1 file changed, 125 insertions(+), 54 deletions(-) -- 1.7.10.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2 1/2] spi/bcm63xx: reject transfers unable to transfer
On Sun, 3 Feb 2013 15:15:12 +0100, Jonas Gorski j...@openwrt.org wrote: The hardware does not support keeping CS asserted after sending one FIFO buffer worth of data, so reject transfers requiring CS being kept asserted, either between transers or for a certain time after it, or exceeding the FIFO size. Signed-off-by: Jonas Gorski j...@openwrt.org Applied, thanks. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2 2/2] spi/bcm63xx: work around inability to keep CS up
-transfer_list.next, struct spi_transfer, +transfer_list); + } return 0; } @@ -252,46 +300,76 @@ static int bcm63xx_spi_transfer_one(struct spi_master *master, struct spi_message *m) { struct bcm63xx_spi *bs = spi_master_get_devdata(master); - struct spi_transfer *t; + struct spi_transfer *t, *first = NULL; struct spi_device *spi = m-spi; int status = 0; - + unsigned int n_transfers = 0, total_len = 0; + bool can_use_prepend = false; + + /* + * This SPI controller does not support keeping CS active after a + * transfer. + * Work around this by merging as many transfers we can into one big + * full-duplex transfers. + */ list_for_each_entry(t, m-transfers, transfer_list) { status = bcm63xx_spi_check_transfer(spi, t); if (status 0) goto exit; + if (!first) + first = t; + + n_transfers++; + total_len += t-len; + + if (n_transfers == 2 !first-rx_buf !t-tx_buf + first-len = BCM63XX_SPI_MAX_PREPEND) + can_use_prepend = true; + else if (can_use_prepend t-tx_buf) + can_use_prepend = false; + /* we can only transfer one fifo worth of data */ - if (t-len bs-fifo_size) { + if ((can_use_prepend + total_len (bs-fifo_size + BCM63XX_SPI_MAX_PREPEND)) || + (!can_use_prepend total_len bs-fifo_size)) { dev_err(spi-dev, unable to do transfers larger than FIFO size (%i %i)\n, - t-len, bs-fifo_size); + total_len, bs-fifo_size); status = -EINVAL; goto exit; } - /* CS will be deasserted directly after transfer */ - if (t-delay_usecs) { - dev_err(spi-dev, unable to keep CS asserted after transfer\n); + /* all combined transfers have to have the same speed */ + if (t-speed_hz != first-speed_hz) { + dev_err(spi-dev, unable to change speed between transfers\n); status = -EINVAL; goto exit; } - if (!t-cs_change - !list_is_last(t-transfer_list, m-transfers)) { - dev_err(spi-dev, unable to keep CS asserted between transfers\n); + /* CS will be deasserted directly after transfer */ + if (t-delay_usecs) { + dev_err(spi-dev, unable to keep CS asserted after transfer\n); status = -EINVAL; goto exit; } - /* configure adapter for a new transfer */ - bcm63xx_spi_setup_transfer(spi, t); + if (t-cs_change || + list_is_last(t-transfer_list, m-transfers)) { + /* configure adapter for a new transfer */ + bcm63xx_spi_setup_transfer(spi, first); - /* send the data */ - status = bcm63xx_txrx_bufs(spi, t); - if (status) - goto exit; + /* send the data */ + status = bcm63xx_txrx_bufs(spi, first, n_transfers); + if (status) + goto exit; + + m-actual_length += total_len; - m-actual_length += t-len; + first = NULL; + n_transfers = 0; + total_len = 0; + can_use_prepend = false; + } } exit: m-status = status; -- 1.7.10.4 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: orion: Use module_platform_driver()
On Mon, 4 Feb 2013 09:26:26 -0300, Ezequiel Garcia ezequiel.gar...@free-electrons.com wrote: This patch reduces and simplifies initalization code by using module_platform_driver(). With this change it's necessary to remove the __init annotation to avoid section mismatch warnings. Signed-off-by: Ezequiel Garcia ezequiel.gar...@free-electrons.com Applied, thanks. g. --- drivers/spi/spi-orion.c | 15 +++ 1 files changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index b7e7182..d8cbf20 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -396,7 +396,7 @@ static int orion_spi_setup(struct spi_device *spi) return 0; } -static int __init orion_spi_probe(struct platform_device *pdev) +static int orion_spi_probe(struct platform_device *pdev) { struct spi_master *master; struct orion_spi *spi; @@ -513,20 +513,11 @@ static struct platform_driver orion_spi_driver = { .owner = THIS_MODULE, .of_match_table = of_match_ptr(orion_spi_of_match_table), }, + .probe = orion_spi_probe, .remove = __exit_p(orion_spi_remove), }; -static int __init orion_spi_init(void) -{ - return platform_driver_probe(orion_spi_driver, orion_spi_probe); -} -module_init(orion_spi_init); - -static void __exit orion_spi_exit(void) -{ - platform_driver_unregister(orion_spi_driver); -} -module_exit(orion_spi_exit); +module_platform_driver(orion_spi_driver); MODULE_DESCRIPTION(Orion SPI driver); MODULE_AUTHOR(Shadi Ammouri sh...@marvell.com); -- 1.7.8.6 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH V2] spi: Remove erroneous __init, __exit and __exit_p() references in drivers
Some of the spi driver module remove hooks were annotated with __exit and referenced with __exit_p(). Presumably these were supposed to be __devinit, __devexit and __devexit_p() since __init/__exit for a probe/remove hook has never been correct. They also got missed during the big __devinit/__devexit purge since they didn't match the pattern. Remove then now to be rid of it. v2: purge __init also Reported-by: Arnd Bergmann a...@arndb.de [Arnd set a patch cleaning up one, and then I found more] Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- drivers/spi/spi-atmel.c |2 +- drivers/spi/spi-au1550.c |8 drivers/spi/spi-bfin5xx.c|2 +- drivers/spi/spi-omap-100k.c |6 +++--- drivers/spi/spi-omap-uwire.c |6 +++--- drivers/spi/spi-orion.c |8 drivers/spi/spi-ppc4xx.c |6 +++--- drivers/spi/spi-s3c64xx.c|2 +- drivers/spi/spi-txx9.c |6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index ab34497..656d137 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1088,7 +1088,7 @@ static struct platform_driver atmel_spi_driver = { .suspend= atmel_spi_suspend, .resume = atmel_spi_resume, .probe = atmel_spi_probe, - .remove = __exit_p(atmel_spi_remove), + .remove = atmel_spi_remove, }; module_platform_driver(atmel_spi_driver); diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 4de66d1c..44dd34b 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c @@ -717,7 +717,7 @@ static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw) } } -static void __init au1550_spi_setup_psc_as_spi(struct au1550_spi *hw) +static void au1550_spi_setup_psc_as_spi(struct au1550_spi *hw) { u32 stat, cfg; @@ -766,7 +766,7 @@ static void __init au1550_spi_setup_psc_as_spi(struct au1550_spi *hw) } -static int __init au1550_spi_probe(struct platform_device *pdev) +static int au1550_spi_probe(struct platform_device *pdev) { struct au1550_spi *hw; struct spi_master *master; @@ -968,7 +968,7 @@ err_nomem: return err; } -static int __exit au1550_spi_remove(struct platform_device *pdev) +static int au1550_spi_remove(struct platform_device *pdev) { struct au1550_spi *hw = platform_get_drvdata(pdev); @@ -997,7 +997,7 @@ static int __exit au1550_spi_remove(struct platform_device *pdev) MODULE_ALIAS(platform:au1550-spi); static struct platform_driver au1550_spi_drv = { - .remove = __exit_p(au1550_spi_remove), + .remove = au1550_spi_remove, .driver = { .name = au1550-spi, .owner = THIS_MODULE, diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 7d7c991..317f564 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c @@ -1273,7 +1273,7 @@ static int bfin_spi_destroy_queue(struct bfin_spi_master_data *drv_data) return 0; } -static int __init bfin_spi_probe(struct platform_device *pdev) +static int bfin_spi_probe(struct platform_device *pdev) { struct device *dev = pdev-dev; struct bfin5xx_spi_master *platform_info; diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 3aef7fa..78d29a1 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -481,7 +481,7 @@ static int omap1_spi100k_transfer(struct spi_device *spi, struct spi_message *m) return 0; } -static int __init omap1_spi100k_reset(struct omap1_spi100k *spi100k) +static int omap1_spi100k_reset(struct omap1_spi100k *spi100k) { return 0; } @@ -560,7 +560,7 @@ err1: return status; } -static int __exit omap1_spi100k_remove(struct platform_device *pdev) +static int omap1_spi100k_remove(struct platform_device *pdev) { struct spi_master *master; struct omap1_spi100k*spi100k; @@ -604,7 +604,7 @@ static struct platform_driver omap1_spi100k_driver = { .name = omap1_spi100k, .owner = THIS_MODULE, }, - .remove = __exit_p(omap1_spi100k_remove), + .remove = omap1_spi100k_remove, }; diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index 0a94d9d..102b233 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c @@ -476,7 +476,7 @@ static void uwire_off(struct uwire_spi *uwire) spi_master_put(uwire-bitbang.master); } -static int __init uwire_probe(struct platform_device *pdev) +static int uwire_probe(struct platform_device *pdev) { struct spi_master *master; struct uwire_spi*uwire; @@ -536,7 +536,7 @@ static int __init uwire_probe(struct platform_device *pdev) return status; } -static int __exit uwire_remove(struct platform_device
Re: [PATCH 2/2] SPI: MIPS: lantiq: set SPI_MASTER_HALF_DUPLEX flag
On Wed, 30 Jan 2013 21:33:31 +0100, John Crispin blo...@openwrt.org wrote: Due to hardware limitations of the spi/flash frontend of the EBU we need to set the SPI_MASTER_HALF_DUPLEX flag. Signed-off-by: Thomas Langer thomas.lan...@lantiq.com Signed-off-by: John Crispin blo...@openwrt.org Applied, thanks. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: Fixing eSPI controller driver: some queries
On Fri, 18 Jan 2013 10:03:28 +0100, Thomas De Schampheleire patrickdepinguin+spide...@gmail.com wrote: Hi, The Freescale eSPI controller driver is broken in several ways. I already attempted to fix this with a patch many months back. The patch works for me, but never got feedback from the original author. (see https://patchwork.kernel.org/patch/988802/) The same problems are still present on the current 3.x version of the driver. I will now re-investigate the problem, and submit a revised patch later. I have some queries though: - When reading from memory devices, the first bytes received may not yet be the real contents of memory, but rather to-be-ignored bytes caused by the full-duplex nature of the transaction while sending the command and address bytes. Am I correct in understanding that these to-be-ignored bytes are to be transparently passed through to the requester of the transaction (i.e. a protocol driver or a userspace application through spidev) and that it's the requestor's responsability to know that these bytes are to be ignored? Yes - While investigating the various problems of the driver, I am adding print statements throughout the code, displaying certain variables and buffer contents. What should I do with these when the problems are fixed? Remove all such statements, or rather, use a mechanism like dev_dbg (or similar) and thus keep them in the code? What is your preference? It is common to use dev_dbg(). They are turned off by removing #define DEBUG from the top of the file. As long as they don't impair readability of the code I would keep them in. - One of the aspects that seems to be broken in the driver is accesses that do not have either 8-bits-per-word or 16-bits-per-word, e.g. 7 bpw or 12 bpw. The hardware defaults to sending least-significant-bits first, and the setting to change this is only allowed for 8 or 16 bpw: (datasheet) Reverse data mode. Determines the receive and transmit character bit order. 0 lsb of the character sent and received first 1 msb of the character sent and received first-for 8/16 bits data character only --- However, the driver sets this bit (CSMODE_REV) by default, except when the mode SPI_LSB_FIRST is explicitly set. This means that a protocol driver that requests a 12bpw transaction, will inadvertently cause an illegal mode setting in the hardware. It doesn't and shouldn't know of this hardware restriction. Is this analysis correct? Correct. The master driver needs to work around limitations of the hardware, or reject them as unsupported. What is the correct way of handling this? Clear the bit in case of a sub-8 or sub-16 bpw transaction, and do the bit swapping in software if SPI_LSB_FIRST is not explicitly set? Probably Or force SPI_LSB_FIRST in these cases, leaving the bit swapping to the protocol driver? No. it should be abstracted Or disable support for sub-8 and sub-16 bpw transactions? Only if the first option isn't feasable. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: davinci: use request_threaded_irq() to fix deadlock
On Wed, 2 Jan 2013 10:19:08 -0500, Murali Karicheri m-kariche...@ti.com wrote: On 12/22/2012 05:08 AM, Grant Likely wrote: On Fri, 21 Dec 2012 15:13:26 -0500, Murali Karicherim-kariche...@ti.com wrote: With RT pre-empt patch applied to Linux kernel, the irq handler will be force converted to an irq thread. spi driver can get back to back messages from the slave device. In such cases, IRQ thread doesn't get a chance to run to read the slave data. Hence the irq handler must be run in hard irq context to read/write data from slave device. Otherwise, the kernel goes into a deadlock. This patch fixes this issue when PREEMPT_RT_FULL is enabled in the kernel. A dummy thread function is provided to satisfy the request_threaded_irq() API. Passing a NULL for function also causes the irq handler to be executed in the thread context. Signed-off-by: Murali Karicherim-kariche...@ti.com Thomas, would you mind taking a look at this for me. My gut feel is that this is the wrong way to solve the problem that Murali is having and that it really just hacks something that works. Grant, Thanks for reviewing this. As per the RT patch, all of the IRQ handlers will be converted to thread by brute force. This breaks the SPI driver since the data is overwritten with back to back irq as thread is not getting a chance to read the word before next irq happens. What my patch does is to keep the functionality as before by using a new irq API. So though this is not the best solution, this solves the problem and give an opportunity for improvement by splitting this into two part to handle the irq. But I am not convinced if this is really needed. Okay. Applied, thanks. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2 0/2] spi/bcm63xx: fix multi transfer messages
On Tue, 5 Feb 2013 15:04:41 +, Mark Brown broo...@opensource.wolfsonmicro.com wrote: On Tue, Feb 05, 2013 at 02:30:40PM +, Grant Likely wrote: Another option is to allow longer transfers if a GPIO is used for the CS line. A lot of SPI controllers need to do that. That isn't a critique of this patch because it is essentially a bug fix, but rather a way you can work around the limitation. Yeah, I did suggest that to them originally but apparently the hardware is sufficient fail that the pins can't be put into GPIO mode for the affected boards. Hahaha. -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH RESEND] spi: spi-fsl-spi: Make spi-fsl-spi usable in cpu mode outside of FSL SOC environments and add a grlib variant normally running on sparc
On Wed, 30 Jan 2013 13:15:24 +0100, Andreas Larsson andr...@gaisler.com wrote: This makes the cpu mode of the driver available outside of an FSL SOC and even powerpc environment. This is accomplished by putting things regarding fsl specific code and to cpm specific code within ifdefs. Furthermore, this adds support for the mostly register-compatible SPICTRL core from the GRLIB VHDL IP core library normally running on sparc. A different entry in of_fsl_spi_match matches this core and indicates a different hardware type that is used to set up different function pointers and special cases. The fetching of irq is changed to work under sparc as well. The GRLIB core operates in cpu mode and from the driver's point of view the important differences are that the number of bits per word might be limited and that there might be native chipselects selected via the added slvsel register. These differences if present are indicated by an added capabilities register. Signed-off-by: Andreas Larsson andr...@gaisler.com --- [Resend to include more recipients] This patch relies upon parts of the of, of_gpio, of_spi: Fix and improve of_parse_phandle_with_args, of_gpio_named_count and of_spi_register_master patchset - https://lkml.org/lkml/2012/12/27/54 (v2 at https://lkml.org/lkml/2013/1/29/308). The grlib type has been tested under sparc, but the fsl type has only been compile tested, so it would be great if someone with an fsl board could test this out. One could argue that it would be better to add the grlib variant as a mode flag in of_mpc8xxx_spi_probe instead of using a new type field, but that would require to add a flag for this core in include/linux/fsl_devices.h which does not feel right given that this core is not part of an fsl device. Maybe the different out/in_be32 vs iowrite/read32be in spi-fsl-lib.h is over the top, but I'm not sure if there might be subtle differences between those on powerpc and I don't have any fsl hardware to try things out on. Changing to ioread/write globally should be fine. I would change it and get someone with an fsl board to try it out. That will reduce the diffstat a bit. As is, this is quite an invasive patch, so I'm not going to be comfortable merging it without at least one 3rd party tester. (Breaking things up into discrete patches will make me less nervous and possible to merge parts while still revising others. Comments below... diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index 8ade675..e3ea564 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c @@ -23,7 +23,9 @@ #include linux/mm.h #include linux/of_platform.h #include linux/spi/spi.h +#ifdef CONFIG_FSL_SOC #include sysdev/fsl_soc.h +#endif #include spi-fsl-lib.h @@ -208,6 +210,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) /* Allocate bus num dynamically. */ pdata-bus_num = -1; +#ifdef CONFIG_FSL_SOC /* SPI controller is either clocked from QE or SoC clock. */ pdata-sysclk = get_brgfreq(); if (pdata-sysclk == -1) { @@ -217,16 +220,23 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) goto err; } } +#else + ret = of_property_read_u32(np, clock-frequency, pdata-sysclk); + if (ret) + goto err; +#endif prop = of_get_property(np, mode, NULL); if (prop !strcmp(prop, cpu-qe)) pdata-flags = SPI_QE_CPU_MODE; +#ifdef CONFIG_FSL_SOC else if (prop !strcmp(prop, qe)) pdata-flags = SPI_CPM_MODE | SPI_QE; else if (of_device_is_compatible(np, fsl,cpm2-spi)) pdata-flags = SPI_CPM_MODE | SPI_CPM2; else if (of_device_is_compatible(np, fsl,cpm1-spi)) pdata-flags = SPI_CPM_MODE | SPI_CPM1; +#endif The ifdefs are ugly and these lines won't affect sparc. Just leave them in. return 0; diff --git a/drivers/spi/spi-fsl-lib.h b/drivers/spi/spi-fsl-lib.h index cbe881b..f66f736 100644 --- a/drivers/spi/spi-fsl-lib.h +++ b/drivers/spi/spi-fsl-lib.h @@ -34,8 +34,10 @@ struct mpc8xxx_spi { int subblock; struct spi_pram __iomem *pram; +#ifdef CONFIG_FSL_SOC struct cpm_buf_desc __iomem *tx_bd; struct cpm_buf_desc __iomem *rx_bd; +#endif struct spi_transfer *xfer_in_progress; @@ -67,6 +69,15 @@ struct mpc8xxx_spi { unsigned int flags; +#ifdef CONFIG_SPI_FSL_SPI + int type; + int native_chipselects; + u8 max_bits_per_word; + + void (*set_shifts)(u32 *rx_shift, u32 *tx_shift, +int bits_per_word, int msb_first); +#endif + struct workqueue_struct *workqueue; struct work_struct work; @@ -87,12 +98,20 @@ struct spi_mpc8xxx_cs { static inline void mpc8xxx_spi_write_reg(__be32 __iomem *reg, u32 val) { +#ifdef CONFIG_FSL_SOC out_be32(reg, val); +#else +
Re: [PATCH 1/2] SPI: MIPS: lantiq: make use of spi_finalize_current_message
On Wed, 30 Jan 2013 21:33:30 +0100, John Crispin blo...@openwrt.org wrote: Rather than calling m-complete() directly we choose the sane way and call spi_finalize_current_message instead. Signed-off-by: Thomas Langer thomas.lan...@lantiq.com Signed-off-by: John Crispin blo...@openwrt.org Applied, thanks. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 2/2] spi: bitbang: convert to using core message queue
On Thu, 10 Jan 2013 13:04:37 +0100 (CET), Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: On Thu, 10 Jan 2013, Linus Walleij wrote: On Wed, Jan 9, 2013 at 3:44 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: [ 79.968000] mmc0: new SD card on SPI [ 79.976000] mmcblk0: mmc0: SU02G 1.84 GiB [ 80.024000] mmcblk0: p1 [ 80.132000] mmcblk0: error -38 sending status command, retrying [ 80.136000] mmcblk0: error -38 sending status command, retrying [ 80.14] mmcblk0: error -38 sending status command, aborting [ 81.028000] mmc0: SPI card removed [ 81.572000] mmc0: error -110 whilst initialising SD card The queue mechanism has not changed. This *could* be the card itself. So it doesn't appear before the patch? No. It could merely be a result of timing changes by using the core message queue. I'll leave the patch for now until someone can properly investigate. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: Trying to use spidev to send an spi message, result from spidev_test.c Illegal argument . (i.mx23, kernel 3.7)
On Sun, 30 Dec 2012 18:14:55 +0900, Juha Lumme juha.lu...@gmail.com wrote: Hi, I am having issues communicating with a micro controller connected to SPI bus, using spidev. I would like to send messages to my MSP430 from user land, but so far no luck. At least I know that my SPI bus should be ok, since in the same bus I have a SPI flash chip that works. In my DTS I have added my 2 SPI devices as such: It looks to me like the SPI master doesn't know how to drive the CS line for the second device. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2 2/2] spi/bcm63xx: work around inability to keep CS up
On Tue, 5 Feb 2013 16:00:04 +0100, Jonas Gorski j...@openwrt.org wrote: On Tue, 05 Feb 2013 14:35:30 + Grant Likely grant.lik...@secretlab.ca wrote: On Sun, 3 Feb 2013 15:15:13 +0100, Jonas Gorski j...@openwrt.org wrote: This SPI controller does not support keeping CS asserted after sending a transfer. Since messages expected on this SPI controller are rather short, we can work around it for normal use cases by sending all transfers at once in a big full duplex stream. This means that we cannot change the speed between transfers if they require CS to be kept asserted, but these would have been rejected before anyway because of the inability of keeping CS asserted. Signed-off-by: Jonas Gorski j...@openwrt.org Are you checking the state of transfer-cs_change when merging transfers? If cs_change is set, then the transfers cannot be merged. Yes, I do; I flush on each cs_change and after the last transfer: Okay, applied. Thanks. g. -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] MAINTAINERS: Add myself as a backup maintainer for SPI
On Mon, Jan 14, 2013 at 2:32 AM, Mark Brown broo...@opensource.wolfsonmicro.com wrote: Grant said he would find it helpful for me to continue handling some of the legwork for SPI so add myself to MAINTAINERS so I get CCed on patches. Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com Acked-by: Grant Likely grant.lik...@secretlab.ca --- MAINTAINERS |1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index ae9f8b8..6332eff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7391,6 +7391,7 @@ F:drivers/clk/spear/ SPI SUBSYSTEM M: Grant Likely grant.lik...@secretlab.ca +M: Mark Brown broo...@opensource.wolfsonmicro.com L: spi-devel-general@lists.sourceforge.net Q: http://patchwork.kernel.org/project/spi-devel-general/list/ T: git git://git.secretlab.ca/git/linux-2.6.git -- 1.7.10.4 -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: erase pointer to drvdata on removal
On Mon, 14 Jan 2013 02:51:45 +, Mark Brown broo...@opensource.wolfsonmicro.com wrote: On Thu, Nov 01, 2012 at 02:05:36PM -0400, Vivien Didelot wrote: As for i2c-core, let the SPI core handle the removal of the device's drvdata, after a remove() or a probe() failure. Any driver that notices this change is buggy, the driver shouldn't use a drvdata value that it didn't set. I had thought this stuff had all been removed from I2C and either dropped or factored out into the driver core... Looks to me like __device_release_driver() in drivers/base/dd.c already does this. g. -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v2 01/10] spi: tegra: Do not use clock name to get clock
On Fri, 11 Jan 2013 13:58:28 -0700, Stephen Warren swar...@wwwdotorg.org wrote: On 01/11/2013 01:01 AM, Prashant Gaikwad wrote: Since Tegra spi devices do not have multiple clocks, no need to use clock name to get the clock. Cc'ing in the SPI maintainers as an FYI and for Acks; this patch needs to go through the Tegra tree due to dependencies. Acked-by: Grant Likely grant.lik...@secretlab.ca No problem merging it via the Tegra tree. g. -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: Add the flag indicate to registe new device as children of master or not.
On Mon, 24 Dec 2012 11:16:52 -0500, Jun Chen jun.d.c...@intel.com wrote: On Fri, 2012-12-21 at 19:06 +, Grant Likely wrote: The problem is that I don't understand why this change is necessary. spi_devices should always be children of an spi_master, not siblings. What is the problem you're trying to solve with this change? When spi drivers try to use the core function(spi_register_master),it will trigger error,because they use the function spi_match_master_to_boardinfo to create new spi device as the children of the master. In the old version of spi core, the new devices are registered as siblings of the spi_master. My spi driver based on the old version runs normal. But after applying for this patch: { spi: Fix device unregistration when unregistering the bus master Device are added as children of the bus master's parent device, but spi_unregister_master() looks for devices to unregister in the bus master's children. This results in the child devices not being unregistered. Fix this by registering devices as direct children of the bus master. - spi-dev.parent = dev; + spi-dev.parent = master-dev; } Then my driver will be crash. Maybe I have mistake on this issue, thank for your more explanation and detail replay. Sounds like you've got a driver bug. Make sure it isn't trying to use the spi_client parent pointer to find the device instance. g. -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 5/5] spi: fix return value check in hspi_probe().
On Thu, 3 Jan 2013 19:04:55 +0300, Dan Carpenter dan.carpen...@oracle.com wrote: On Sat, Dec 22, 2012 at 09:56:20AM +, Grant Likely wrote: On Wed, 19 Dec 2012 19:39:14 +0300, Dan Carpenter dan.carpen...@oracle.com wrote: On Wed, Dec 19, 2012 at 03:11:54PM +, Grant Likely wrote: On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto kuninori.morimoto...@renesas.com wrote: Hi According to its documentation, clk_get() returns a valid IS_ERR() condition containing errno, so we should call IS_ERR() rather than a NULL check. Signed-off-by: Cyril Roelandt tipec...@gmail.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Applied, thanks. In another thread, we were just talking about who clk_get() can return a NULL if !CONFIG_HAVE_CLK. That might change to match the documentation later... Not sure. So what is the solution here? Will the dummy clk_get() be changed, or is there more work needed on the drivers? This driver can't function without a clk. It should select that at build time instead of testing for it at probe. Just checking for IS_ERR() will NOT cause a NULL dereference so the patch is ok in that respect. I'm not sure if this can be build without CONFIG_HAVE_CLK. Your suggestion is to make this driver depend on CONFIG_HAVE_CLK? I'm fine with that, but it doesn't sort out the core infrastructure question about whether it is valid for the empty clk_get() to return NULL. Nor is it a particularly sustainable solution (ie. if a large number of drivers want to do the same thing). g. -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: spi-mpc512x-psc: don't use obsolet cell-index property
On Fri, 21 Dec 2012 14:48:38 +, Grant Likely grant.lik...@secretlab.ca wrote: On Fri, Dec 21, 2012 at 2:43 PM, Anatolij Gustschin ag...@denx.de wrote: Use unique PSCx register base offset to obtain the SPI PSC number used for SPI bus id. Signed-off-by: Anatolij Gustschin ag...@denx.de Don't do this. If you really want to assign a specific bus number, then use a property in /aliases. cell-index has been deprecated a very long time ago now. Ummm.. I really should read patches before I reply to them. I see you're removing cell-index, not adding it back in. It is fine. Aliases would be a more generic solution though. Would this following change work for you? Try it out and let me know. g. --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 84c2861..de9f6ee 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -983,6 +983,9 @@ int spi_register_master(struct spi_master *master) if (master-num_chipselect == 0) return -EINVAL; + if ((master-bus_num 0) master-dev.of_node) + master-bus_num = of_alias_get_id(master-dev.of_node, spi); + /* convention: dynamically assigned bus IDs count down from the max */ if (master-bus_num 0) { /* FIXME switch to an IDR based scheme, something like -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: Add the flag indicate to registe new device as children of master or not.
On Fri, 21 Dec 2012 12:39:52 -0500, Jun Chen jun.d.c...@intel.com wrote: On Wed, 2012-12-19 at 16:21 +, Grant Likely wrote: On Wed, 19 Dec 2012 09:04:16 +, Mark Brown broo...@opensource.wolfsonmicro.com wrote: On Wed, Dec 19, 2012 at 04:44:03AM -0500, Jun Chen wrote: This spi_alloc_device function will be called in the spi_new_device function to alloc new device as the master. But other way, it is called by the of_register_spi_devices function to register new device as the children of the master. I will update changlog to add it. But why is this a bad thing? You've said what's happening but not why it's a problem. spi_devices should always be children of the spi_master. If that is not the case then it is a bug to be fixed. When many boards initializing, boards will call function spi_register_board_info to create bi-board_info,Then spi driver probe to call spi_register_master to register the driver and in the function spi_match_master_to_boardinfo To create new spi device, and this cases the spi_devices are not children of the spi_master. Many drivers do these steps. If all spi_devices must be children of the spi_master, Do spi core have plan to delete this way? Or spi core can hold this way for many drivers. Let me make sure I understand what you're saying... Right now, every spi_device object is registered as a child of an spi_master object. With this proposed patch, spi_devices registered via spi_register_board_info will be siblings of the spi_master instead of children. Do I understand correctly so far? The problem is that I don't understand why this change is necessary. spi_devices should always be children of an spi_master, not siblings. What is the problem you're trying to solve with this change? g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2] spi: remove check for bits_per_word on transfer from low level driver
On Thu, 20 Dec 2012 11:33:47 +0530, Laxman Dewangan ldewan...@nvidia.com wrote: On Wednesday 19 December 2012 09:54 PM, Grant Likely wrote: On Tue, 18 Dec 2012 14:25:43 +0530, Laxman Dewanganldewan...@nvidia.com wrote: The spi core make sure that each transfer structure have the proper setting for bits_per_word before calling low level transfer APIs. Hence it is no more require to check again in low level driver for this field whether this is set correct or not. Removing such code from low level driver. Signed-off-by: Laxman Dewanganldewan...@nvidia.com [...] */ if (prev_speed_hz != speed_hz @@ -316,9 +315,8 @@ static int txx9spi_transfer(struct spi_device *spi, struct spi_message *m) /* check each transfer's parameters */ list_for_each_entry (t,m-transfers, transfer_list) { u32 speed_hz = t-speed_hz ? : spi-max_speed_hz; - u8 bits_per_word = t-bits_per_word ? : spi-bits_per_word; + u8 bits_per_word = t-bits_per_word; - bits_per_word = bits_per_word ? : 8; Have you verified here that bits_per_word can never be '0' here? What is the path that ensures spi-bits_per_word (and hence t-bits_per_word) is set to 8 here? Otherwise the patch looks good. Thanks for doing this work. When we do the spi_add_device(), the spi_setup() get called. In spi_setup, it make sure that spi-bits_per_word is not zero. in spi_setup(spi.c) if (!spi-bits_per_word) spi-bits_per_word = 8; Applied, thanks. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH RFC] spidev.c: add sysfs attributes for SPI configuration
On Thu, 20 Dec 2012 16:30:36 +0100, Federico Vaga federico.v...@gmail.com wrote: On Wednesday 19 December 2012 15:09:25 Grant Likely wrote: Not a good idea. sysfs is not a good place for operational interfaces. Please use the spi character devices for direct manipulation of the SPI configuration. Hello, Can you explain why it is not a good idea? I do not understand; what is the advantage of ioctl through char device? Or what it the issue with sysfs? Thank you very much I'm cautious about adding operational interfaces to sysfs because it can be quite difficult to get the locking right. To begin with it splits up a single interface into multiple files, any of which can be held open by a process. Then there is the question of ordering of operations when there are multiple users. For instance, if there were two users, each of which using different transfer parameters, a sysfs interface doesn't provide any mechanism to group setting up the device with the transfer. These are lessons learned the hard way with the gpio sysfs abi. I don't want to get caught in the same trap for spi. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 5/5] spi: fix return value check in hspi_probe().
On Wed, 19 Dec 2012 19:39:14 +0300, Dan Carpenter dan.carpen...@oracle.com wrote: On Wed, Dec 19, 2012 at 03:11:54PM +, Grant Likely wrote: On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto kuninori.morimoto...@renesas.com wrote: Hi According to its documentation, clk_get() returns a valid IS_ERR() condition containing errno, so we should call IS_ERR() rather than a NULL check. Signed-off-by: Cyril Roelandt tipec...@gmail.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Applied, thanks. In another thread, we were just talking about who clk_get() can return a NULL if !CONFIG_HAVE_CLK. That might change to match the documentation later... Not sure. So what is the solution here? Will the dummy clk_get() be changed, or is there more work needed on the drivers? /me stifles a rant about the PTR_ERR pattern g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: davinci: use request_threaded_irq() to fix deadlock
On Fri, 21 Dec 2012 15:13:26 -0500, Murali Karicheri m-kariche...@ti.com wrote: With RT pre-empt patch applied to Linux kernel, the irq handler will be force converted to an irq thread. spi driver can get back to back messages from the slave device. In such cases, IRQ thread doesn't get a chance to run to read the slave data. Hence the irq handler must be run in hard irq context to read/write data from slave device. Otherwise, the kernel goes into a deadlock. This patch fixes this issue when PREEMPT_RT_FULL is enabled in the kernel. A dummy thread function is provided to satisfy the request_threaded_irq() API. Passing a NULL for function also causes the irq handler to be executed in the thread context. Signed-off-by: Murali Karicheri m-kariche...@ti.com Thomas, would you mind taking a look at this for me. My gut feel is that this is the wrong way to solve the problem that Murali is having and that it really just hacks something that works. It seems to me that what the driver should do is disable the irq in the handler, and then perform the regular work in the thread. After all the pending data is processed, then it should reenable the interrupts. Passing in a dummy thread function just looks wrong. g. --- drivers/spi/spi-davinci.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 50bd2cd..8234d22 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -702,6 +702,19 @@ err_alloc_dummy_buf: } /** + * dummy_thread_fn - dummy thread function + * @irq: IRQ number for this SPI Master + * @context_data: structure for SPI Master controller davinci_spi + * + * This is to satisfy the request_threaded_irq() API so that the irq + * handler is called in interrupt context. + */ +static irqreturn_t dummy_thread_fn(s32 irq, void *data) +{ + return IRQ_HANDLED; +} + +/** * davinci_spi_irq - Interrupt handler for SPI Master Controller * @irq: IRQ number for this SPI Master * @context_data: structure for SPI Master controller davinci_spi @@ -899,8 +912,8 @@ static int davinci_spi_probe(struct platform_device *pdev) goto unmap_io; } - ret = request_irq(dspi-irq, davinci_spi_irq, 0, dev_name(pdev-dev), - dspi); + ret = request_threaded_irq(dspi-irq, davinci_spi_irq, dummy_thread_fn, + 0, dev_name(pdev-dev), dspi); if (ret) goto unmap_io; -- 1.7.9.5 -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: spi-mpc512x-psc: don't use obsolet cell-index property
On Fri, Dec 21, 2012 at 2:43 PM, Anatolij Gustschin ag...@denx.de wrote: Use unique PSCx register base offset to obtain the SPI PSC number used for SPI bus id. Signed-off-by: Anatolij Gustschin ag...@denx.de Don't do this. If you really want to assign a specific bus number, then use a property in /aliases. cell-index has been deprecated a very long time ago now. g. --- drivers/spi/spi-mpc512x-psc.c | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 0a1e39e..844d68f 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c @@ -523,16 +523,21 @@ static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op) /* get PSC id (0..11, used by port_config) */ if (op-dev.platform_data == NULL) { - const u32 *psc_nump; + u32 reg; + int err; - psc_nump = of_get_property(op-dev.of_node, cell-index, NULL); - if (!psc_nump || *psc_nump 11) { - dev_err(op-dev, mpc512x_psc_spi: Device node %s - has invalid cell-index property\n, + err = of_property_read_u32(op-dev.of_node, reg, reg); + if (err) { + dev_err(op-dev, Can't read reg property: %d\n, err); + return err; + } + + id = (reg 0xf00) 8; + if (id 11) { + dev_err(op-dev, node %s has invalid reg property\n, op-dev.of_node-full_name); return -EINVAL; } - id = *psc_nump; } return mpc512x_psc_spi_do_probe(op-dev, (u32) regaddr64, (u32) size64, -- 1.7.7.6 -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH - v2] spi: davinci: add OF support for the spi controller
On Sat, 15 Dec 2012 00:27:58 +, Grant Likely grant.lik...@secretlab.ca wrote: On Tue, 11 Dec 2012 16:20:39 -0500, Murali Karicheri m-kariche...@ti.com wrote: This adds OF support to DaVinci SPI controller to configure platform data through device bindings. Also replaces clk_enable() with of clk_prepare_enable() as well as clk_disable() with clk_disable_unprepare(). Signed-off-by: Murali Karicheri m-kariche...@ti.com Reviewed-by : Grant Likely grant.lik...@secretlab.ca Applied, thanks. I did remove the OF_ALIAS_N property though. I know the COMPATIBLE one uses it, but it is actually kind of redundant since it can also be determined by counting the number of OF_ALIAS_* entries, and having the _N one in there means extra work needs to be done to filter it out. Also, I had to add a #ifndef _LINUX_OF_PRIVATE_H wrapper around the whole header file. This is needed for all header files to protect against multiple includes. Ummm oops. I replied to the wrong email when applying another patch. Sorry for the noise. But I have applied your patch now. It will appear in linux-next after the merge window closes. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH RFC] spidev.c: add sysfs attributes for SPI configuration
On Sat, 24 Nov 2012 18:20:08 +0100, Federico Vaga federico.v...@gmail.com wrote: This patch introduce the use of the sysfs attribute for the spidev configuration. This avoid the user to have a specific program which does ioctl() on spidev. The user can easily does cat (to read) and echo (to write) on the sysfs file and configure SPI. The patch exports the following attributes: bits-per-word, lsb-first, mode and speed-hz. Example: # cat /sys/bus/spi/devices/spi1.0/speed-hz 50 # echo 45 /sys/bus/spi/devices/spi1.0/speed-hz # dmesg | tail -n 4 spidev spi1.0: DEactivate 60, mr 000f0011 spidev spi1.0: setup: 449447 Hz bpw 8 mode 0x0 - csr0 dd02 spidev spi1.0: setup mode 0, 8 bits/w, 45 Hz max -- 0 spidev spi1.0: 45 Hz (max) Signed-off-by: Federico Vaga federico.v...@gmail.com Not a good idea. sysfs is not a good place for operational interfaces. Please use the spi character devices for direct manipulation of the SPI configuration. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 5/5] spi: fix return value check in hspi_probe().
On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto kuninori.morimoto...@renesas.com wrote: Hi According to its documentation, clk_get() returns a valid IS_ERR() condition containing errno, so we should call IS_ERR() rather than a NULL check. Signed-off-by: Cyril Roelandt tipec...@gmail.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Applied, thanks. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: Add the flag indicate to registe new device as children of master or not.
On Wed, 19 Dec 2012 09:04:16 +, Mark Brown broo...@opensource.wolfsonmicro.com wrote: On Wed, Dec 19, 2012 at 04:44:03AM -0500, Jun Chen wrote: This spi_alloc_device function will be called in the spi_new_device function to alloc new device as the master. But other way, it is called by the of_register_spi_devices function to register new device as the children of the master. I will update changlog to add it. But why is this a bad thing? You've said what's happening but not why it's a problem. spi_devices should always be children of the spi_master. If that is not the case then it is a bug to be fixed. g. -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 3/4 v2] spi: sh-msiof: Add device tree parsing to driver
On Mon, 17 Dec 2012 12:25:26 +0100, Bastian Hecht hec...@gmail.com wrote: Hi Nobuhiro, 2012/12/17 Nobuhiro Iwamatsu iwama...@nigauri.org: Hi, Bastian. On Wed, Dec 12, 2012 at 8:54 PM, Bastian Hecht hec...@gmail.com wrote: From: Bastian Hecht hec...@gmail.com This adds the capability to retrieve setup data from the device tree node. The usage of platform data is still available. Signed-off-by: Bastian Hecht hechtb+rene...@gmail.com --- Applied, thanks. + .of_match_table = sh_msiof_match, You can use of_match_ptr(sh_msiof_match). Ok very nice, will do so. Please send a fixup patch for this change. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/4 v2] spi: Add SH Mobile series as dependency to MSIOF controller
On Wed, 12 Dec 2012 12:54:47 +0100, Bastian Hecht hec...@gmail.com wrote: From: Bastian Hecht hec...@gmail.com The MSIOF hardware block is used in the SH Mobile series as well, so we add it here. Signed-off-by: Bastian Hecht hechtb+rene...@gmail.com --- Also already applied. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/4 v2] spi: sh-msiof: Remove unneeded clock name
On Wed, 12 Dec 2012 12:54:46 +0100, Bastian Hecht hec...@gmail.com wrote: From: Bastian Hecht hec...@gmail.com clk_get() no longer needs a character string for associating the right clock as this is done via the device struct now. Signed-off-by: Bastian Hecht hechtb+rene...@gmail.com This change is already in mainline. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 4/4 v2] devicetree: Add Renesas SH Mobile MSIOF spi controller binding doc
On Wed, 12 Dec 2012 12:54:49 +0100, Bastian Hecht hec...@gmail.com wrote: From: Bastian Hecht hec...@gmail.com Add binding documentation for Renesas' MSIOF SPI controller. Signed-off-by: Bastian Hecht hechtb+rene...@gmail.com Applied, but squashed together with patch 3. I prefer to see documentation and code changes applied together. g. -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: tegra: sequence compatible strings as per preference
On Sat, 10 Nov 2012 18:07:42 +0100, Thierry Reding thierry.red...@avionic-design.de wrote: On Fri, Nov 09, 2012 at 10:28:38AM -0700, Stephen Warren wrote: On 11/09/2012 10:10 AM, Mark Brown wrote: On Fri, Nov 09, 2012 at 10:04:56AM -0700, Stephen Warren wrote: However just FYI, it should not be necessary for correctness; The DT matching order is supposed to be driven purely by the order of the compatible values in the DT now, and not affected by the order of values in the table. (This wasn't always the case, but was a bug that was fixed IIRC by Thierry Reding). I guess the driver is being used backported in older kernels which don't have that fix? That sounds likely. Laxman, it'd be a good idea to track down the fix to the DT matching code and backport it, so that hard-to debug issues aren't caused by the lack of that patch! Unfortunately the patch that was supposed to fixed this caused a regression and was therefore reverted. Rob (Cc'ed) said there was a patch to fix it properly and was supposed to go into 3.6 but it seems that never happened. Rob, what's the status on this? The revert is here: bc51b0c22cebf5c311a6f1895fcca9f78efd0478 Rob, ping on this. I think we talked about it on IRC, but I cannot remember what was said I must be getting old. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH V2] spi: remove check for bits_per_word on transfer from low level driver
On Tue, 18 Dec 2012 14:25:43 +0530, Laxman Dewangan ldewan...@nvidia.com wrote: The spi core make sure that each transfer structure have the proper setting for bits_per_word before calling low level transfer APIs. Hence it is no more require to check again in low level driver for this field whether this is set correct or not. Removing such code from low level driver. Signed-off-by: Laxman Dewangan ldewan...@nvidia.com [...] diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c index d5a3cbb..550b5f4 100644 --- a/drivers/spi/spi-txx9.c +++ b/drivers/spi/spi-txx9.c @@ -189,9 +189,8 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m) unsigned int len = t-len; unsigned int wsize; u32 speed_hz = t-speed_hz ? : spi-max_speed_hz; - u8 bits_per_word = t-bits_per_word ? : spi-bits_per_word; + u8 bits_per_word = t-bits_per_word; - bits_per_word = bits_per_word ? : 8; wsize = bits_per_word 3; /* in bytes */ if (prev_speed_hz != speed_hz @@ -316,9 +315,8 @@ static int txx9spi_transfer(struct spi_device *spi, struct spi_message *m) /* check each transfer's parameters */ list_for_each_entry (t, m-transfers, transfer_list) { u32 speed_hz = t-speed_hz ? : spi-max_speed_hz; - u8 bits_per_word = t-bits_per_word ? : spi-bits_per_word; + u8 bits_per_word = t-bits_per_word; - bits_per_word = bits_per_word ? : 8; Have you verified here that bits_per_word can never be '0' here? What is the path that ensures spi-bits_per_word (and hence t-bits_per_word) is set to 8 here? Otherwise the patch looks good. Thanks for doing this work. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[GIT PULL] SPI bug fixes for v3.8 merge window
Hi Linus, And finally, here are the bug fixes I've queued up for SPI. Very little in the way of excitement other than a device driver feature that should have been in my first pull req, but I missed it. It should be low risk, but if it bothers you then I can respin without it. And now I'm off to bed. g. The following changes since commit 4939e27d46fee2609f2112f85f7f7cbd952075dc: Merge tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux-2.6 (2012-12-14 15:37:46 -0800) are available in the git repository at: git://git.secretlab.ca/git/linux-2.6 tags/spi-for-linus for you to fetch changes up to d3601e56cf64a3f2df6f6380cccb3644274406e2: spi/sh-hspi: fix return value check in hspi_probe(). (2012-12-19 15:11:41 +) SPI device driver bug fixes branch for the v3.8 merge window. Most of this is bug fixes to the core code and the sh-hspi and s3c64xx device drivers. There is also a patch here to add DT support to the Atmel driver. This one should have been in the first round, but I missed it. It's a low risk change contained within a single driver and the Atmel maintainer has requested it. Allen Martin (1): spi: fix tegra SPI binding examples Cyril Roelandt (1): spi/sh-hspi: fix return value check in hspi_probe(). David Daney (1): of/spi: Fix SPI module loading by using proper spi: modalias prefixes. Jean-Christophe PLAGNIOL-VILLARD (1): spi/atmel: add DT support Kyoungil Kim (2): spi: Keep chipselect assertion during one message spi: Change FIFO flush operation and spi channel off .../bindings/spi/nvidia,tegra20-sflash.txt |2 +- .../bindings/spi/nvidia,tegra20-slink.txt |2 +- .../devicetree/bindings/spi/spi_atmel.txt | 26 drivers/spi/spi-atmel.c| 17 - drivers/spi/spi-s3c64xx.c | 10 +++- drivers/spi/spi-sh-hspi.c |2 +- drivers/spi/spi.c |5 +++- 7 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [GIT PULL] SPI bug fixes for v3.8 merge window
[Forgot to cc: lkml] On Thu, Dec 20, 2012 at 12:46 AM, Grant Likely grant.lik...@secretlab.ca wrote: Hi Linus, And finally, here are the bug fixes I've queued up for SPI. Very little in the way of excitement other than a device driver feature that should have been in my first pull req, but I missed it. It should be low risk, but if it bothers you then I can respin without it. And now I'm off to bed. g. The following changes since commit 4939e27d46fee2609f2112f85f7f7cbd952075dc: Merge tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux-2.6 (2012-12-14 15:37:46 -0800) are available in the git repository at: git://git.secretlab.ca/git/linux-2.6 tags/spi-for-linus for you to fetch changes up to d3601e56cf64a3f2df6f6380cccb3644274406e2: spi/sh-hspi: fix return value check in hspi_probe(). (2012-12-19 15:11:41 +) SPI device driver bug fixes branch for the v3.8 merge window. Most of this is bug fixes to the core code and the sh-hspi and s3c64xx device drivers. There is also a patch here to add DT support to the Atmel driver. This one should have been in the first round, but I missed it. It's a low risk change contained within a single driver and the Atmel maintainer has requested it. Allen Martin (1): spi: fix tegra SPI binding examples Cyril Roelandt (1): spi/sh-hspi: fix return value check in hspi_probe(). David Daney (1): of/spi: Fix SPI module loading by using proper spi: modalias prefixes. Jean-Christophe PLAGNIOL-VILLARD (1): spi/atmel: add DT support Kyoungil Kim (2): spi: Keep chipselect assertion during one message spi: Change FIFO flush operation and spi channel off .../bindings/spi/nvidia,tegra20-sflash.txt |2 +- .../bindings/spi/nvidia,tegra20-slink.txt |2 +- .../devicetree/bindings/spi/spi_atmel.txt | 26 drivers/spi/spi-atmel.c| 17 - drivers/spi/spi-s3c64xx.c | 10 +++- drivers/spi/spi-sh-hspi.c |2 +- drivers/spi/spi.c |5 +++- 7 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 1/1] spi/atmel: add DT support
On Mon, 17 Dec 2012 11:13:51 +0100, Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com wrote: On 01:03 Sat 15 Dec , Grant Likely wrote: On Wed, 12 Dec 2012 16:13:08 +0100, Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com wrote: On 14:37 Fri 23 Nov , Nicolas Ferre wrote: On 11/23/2012 01:44 PM, Jean-Christophe PLAGNIOL-VILLARD : the atmel_spi use only gpio for chip select Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Seems simple and nice: Acked-by: Nicolas Ferre nicolas.fe...@atmel.com grant is ok to have this for 3.8? Not sure how I missed this one. It's pretty straight forward and not risky, so no problem. However; the atmel_spi use only gpio for chip select I know you know how to write a proper commit message. I'll need something better than the above before I commit it. I won't make you resubmit the patch, but do send me a better description. ok replace with this please spi/atmel: add DT support Use the newly introduce cs-gpios dt support on atmel. We do not use the hardware cs as it's wired and have buges and limitations. As the the controller's belief that only active-low devices/systems exists. As done on non-dt system. Done, thanks. g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] SPI: SSP SPI Controller driver
On Thu, 13 Dec 2012 17:09:34 +0800, chao bi chao...@intel.com wrote: On Tue, 2012-12-11 at 16:46 +, Grant Likely wrote: On Tue, 11 Dec 2012 16:58:31 +0800, chao bi chao...@intel.com wrote: On Thu, 2012-12-06 at 12:38 +, Grant Likely wrote: On Wed, 21 Nov 2012 10:16:43 +0800, chao bi chao...@intel.com wrote: + master-mode_bits = SPI_CPOL | SPI_CPHA; + master-bus_num = SSP_CFG_GET_SPI_BUS_NB(ssp_cfg); + master-num_chipselect = 1; + master-cleanup = cleanup; + master-setup = setup; + master-transfer = transfer; + drv_context-dma_wq = create_workqueue(intel_mid_ssp_spi); + INIT_WORK(drv_context-complete_work, int_transfer_complete_work); Workqueue management is integrated into the core spi infrastructure now. SPI drivers should no longer be creating their own workqueues. Instead, replace the -transfer hook with prepare_transfer_hardware(), unprepare_transfer_hardware() and transfer_one_message(). See Documentation/spi/spi-summary for details. Hi Grant, I'd like to talk about my understanding here, please correct me if I was wrong: 1. I understand the workqueue in spi core is for driving message transfer, so SPI driver should not create new workqueue for this usage. However, the workqueue created here is not for this usage it's to call back to SPI protocol driver (ifx6x60.c) when DMA data transfer is finished, so it seems not conflict with spi core. Am I right? It appears to me like all the stuff in int_transfer_complete() can be performed at interrupt context, or gets removed in moving to the new system. Am I mistaken here? Yes, we can make use of new SPI core interface to callback to protocol driver (through spi_finalize_current_message()), but looks like it's better to call spi_finalize_current_message() inside workqueue than DMA interrupt context, because the callback function for protocol driver would cost much time, it's better to move this part out of interrupt context. Therefore, I prefer to keep the workqueue here if you agree, what's your opinion? It would be better to work within the context of the kthread that is already managing transfers. Otherwise you've got multiple contexts that could be competing. Plus the kthread may be running in realtime context, but that would be useless since the workqueue would never have the same priority. It currently isn't documented whether or not protocol drivers can sleep in the complete callback. I think it is assumed that it cannot, but that should be verified. If it is a problem for the complete callback to requre atomicity, then maybe we should have a separate .complete_atomic hook for those that can handle it, and call .complete() in the kthread context. Linusw, you did a bunch of work on this. What do you think? g. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH - v2] spi: davinci: add OF support for the spi controller
On Tue, 11 Dec 2012 16:20:39 -0500, Murali Karicheri m-kariche...@ti.com wrote: This adds OF support to DaVinci SPI controller to configure platform data through device bindings. Also replaces clk_enable() with of clk_prepare_enable() as well as clk_disable() with clk_disable_unprepare(). Signed-off-by: Murali Karicheri m-kariche...@ti.com Reviewed-by : Grant Likely grant.lik...@secretlab.ca Applied, thanks. I did remove the OF_ALIAS_N property though. I know the COMPATIBLE one uses it, but it is actually kind of redundant since it can also be determined by counting the number of OF_ALIAS_* entries, and having the _N one in there means extra work needs to be done to filter it out. Also, I had to add a #ifndef _LINUX_OF_PRIVATE_H wrapper around the whole header file. This is needed for all header files to protect against multiple includes. g. --- - Change log - v2 - changed the compatibility strings to include soc name - changed ti,davinci-num-cs to num-cs v1 - removed attribute for spi version. instead, compatibility string is modified to include version info. - pdata ptr in davinci_spi_platform_data is replaced with struct itself. - spi_davinci_get_pdata() now populates the pdata in the above structure with parsed values from DT bindings. - rebased to v3.7 rc7 of linux-next - replaces clk_* APIs with their prepare/unprepare version .../devicetree/bindings/spi/spi-davinci.txt| 51 ++ drivers/spi/spi-davinci.c | 102 +--- 2 files changed, 139 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt diff --git a/Documentation/devicetree/bindings/spi/spi-davinci.txt b/Documentation/devicetree/bindings/spi/spi-davinci.txt new file mode 100644 index 000..8cb3fee --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi-davinci.txt @@ -0,0 +1,51 @@ +Davinci SPI controller device bindings + +Required properties: +- #address-cells: number of cells required to define a chip select + address on the SPI bus. Should be set to 1. +- #size-cells: should be zero. +- compatible: + - ti,dm644x-spi for SPI used similar to that on DM644x SoC family + - ti,da8xx-spi for SPI used similar to that on DA8xx SoC family +- reg: Offset and length of SPI controller register space +- num-cs: Number of chip selects +- ti,davinci-spi-intr-line: interrupt line used to connect the SPI + IP to the interrupt controller withn the SoC. Possible values + are 0 and 1. Manual says one of the two possible interrupt + lines can be tied to the interrupt controller. Set this + based on a specifc SoC configuration. +- interrupts: interrupt number offset at the irq parent +- clocks: spi clk phandle + +Example of a NOR flash slave device (n25q032) connected to DaVinci +SPI controller device over the SPI bus. + +spi0:spi@20BF { + #address-cells = 1; + #size-cells = 0; + compatible = ti,dm644x-spi; + reg = 0x20BF 0x1000; + num-cs = 4; + ti,davinci-spi-intr-line= 0; + interrupts = 338; + clocks = clkspi; + + flash: n25q032@0 { + #address-cells = 1; + #size-cells = 1; + compatible = st,m25p32; + spi-max-frequency = 2500; + reg = 0; + + partition@0 { + label = u-boot-spl; + reg = 0x0 0x8; + read-only; + }; + + partition@1 { + label = test; + reg = 0x8 0x38; + }; + }; +}; diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 147dfa8..e5d8489 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -28,6 +28,8 @@ #include linux/dmaengine.h #include linux/dma-mapping.h #include linux/edma.h +#include linux/of.h +#include linux/of_device.h #include linux/spi/spi.h #include linux/spi/spi_bitbang.h #include linux/slab.h @@ -135,7 +137,7 @@ struct davinci_spi { int dma_rx_chnum; int dma_tx_chnum; - struct davinci_spi_platform_data *pdata; + struct davinci_spi_platform_data pdata; void(*get_rx)(u32 rx_data, struct davinci_spi *); u32 (*get_tx)(struct davinci_spi *); @@ -213,7 +215,7 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) bool gpio_chipsel = false; dspi = spi_master_get_devdata(spi-master); - pdata = dspi-pdata; + pdata = dspi-pdata; if (pdata-chip_sel chip_sel pdata-num_chipselect
Re: [PATCH 1/2] spi: omap2: disable DMA requests before complete()
On Wed, 12 Dec 2012 10:45:59 +0200, Felipe Balbi ba...@ti.com wrote: No actual errors have been found for completing before disabling DMA request lines, but it just looks more semantically correct that on our DMA callback we quiesce the whole thing before stating transfer is finished. Signed-off-by: Felipe Balbi ba...@ti.com Applied, thanks. g. --- drivers/spi/spi-omap2-mcspi.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b610f52..68446db 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -298,10 +298,10 @@ static void omap2_mcspi_rx_callback(void *data) struct omap2_mcspi *mcspi = spi_master_get_devdata(spi-master); struct omap2_mcspi_dma *mcspi_dma = mcspi-dma_channels[spi-chip_select]; - complete(mcspi_dma-dma_rx_completion); - /* We must disable the DMA RX request */ omap2_mcspi_set_dma_req(spi, 1, 0); + + complete(mcspi_dma-dma_rx_completion); } static void omap2_mcspi_tx_callback(void *data) @@ -310,10 +310,10 @@ static void omap2_mcspi_tx_callback(void *data) struct omap2_mcspi *mcspi = spi_master_get_devdata(spi-master); struct omap2_mcspi_dma *mcspi_dma = mcspi-dma_channels[spi-chip_select]; - complete(mcspi_dma-dma_tx_completion); - /* We must disable the DMA TX request */ omap2_mcspi_set_dma_req(spi, 0, 0); + + complete(mcspi_dma-dma_tx_completion); } static void omap2_mcspi_tx_dma(struct spi_device *spi, -- 1.8.1.rc1.5.g7e0651a -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general