Re: [PATCH] spi: QUP based bus driver for Qualcomm MSM chipsets
On 11/09/2011 05:07 PM, Harini Jayaraman wrote: > This bus driver supports the QUP SPI hardware controller in the Qualcomm > MSM SOCs. The Qualcomm Universal Peripheral Engine (QUP) is a general > purpose data path engine with input/output FIFOs and an embedded SPI > mini-core. The driver currently supports only FIFO mode. > > Signed-off-by: Harini Jayaraman > --- > drivers/spi/Kconfig | 10 + > drivers/spi/Makefile |1 + > drivers/spi/msm_spi_qsd.h | 436 + > drivers/spi/spi-qsd.c | 1144 > + > include/linux/platform_data/msm_spi.h | 19 + > 5 files changed, 1610 insertions(+), 0 deletions(-) > create mode 100644 drivers/spi/msm_spi_qsd.h > create mode 100644 drivers/spi/spi-qsd.c > create mode 100644 include/linux/platform_data/msm_spi.h A few high-level comments to start. Let's drop 'qsd' from all the names. We haven't used that naming convention for several years now. Better to just call this 'spi-qup.[ch]'. Also, please update the copyright dates. This driver existed before 2011. Thanks. - Bryan -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH] spi: QUP based bus driver for Qualcomm MSM chipsets
This bus driver supports the QUP SPI hardware controller in the Qualcomm MSM SOCs. The Qualcomm Universal Peripheral Engine (QUP) is a general purpose data path engine with input/output FIFOs and an embedded SPI mini-core. The driver currently supports only FIFO mode. Signed-off-by: Harini Jayaraman --- drivers/spi/Kconfig | 10 + drivers/spi/Makefile |1 + drivers/spi/msm_spi_qsd.h | 436 + drivers/spi/spi-qsd.c | 1144 + include/linux/platform_data/msm_spi.h | 19 + 5 files changed, 1610 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/msm_spi_qsd.h create mode 100644 drivers/spi/spi-qsd.c create mode 100644 include/linux/platform_data/msm_spi.h diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 52e2900..af55a0a 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -280,6 +280,16 @@ config SPI_PXA2XX config SPI_PXA2XX_PCI def_bool SPI_PXA2XX && X86_32 && PCI +config SPI_QUP + tristate "Qualcomm MSM SPI QUPe Support" + depends on ARCH_MSM + help + Support for Serial Peripheral Interface for Qualcomm Universal + Peripheral. + + This driver can also be built as a module. If so, the module + will be called spi-qsd. + config SPI_S3C24XX tristate "Samsung S3C24XX series SPI" depends on ARCH_S3C2410 && EXPERIMENTAL diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 61c3261..f426c89 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -44,6 +44,7 @@ obj-$(CONFIG_SPI_PL022) += spi-pl022.o obj-$(CONFIG_SPI_PPC4xx) += spi-ppc4xx.o obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx.o obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o +obj-$(CONFIG_SPI_QUP) += spi-qsd.o obj-$(CONFIG_SPI_S3C24XX) += spi-s3c24xx-hw.o spi-s3c24xx-hw-y := spi-s3c24xx.o spi-s3c24xx-hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi-s3c24xx-fiq.o diff --git a/drivers/spi/msm_spi_qsd.h b/drivers/spi/msm_spi_qsd.h new file mode 100644 index 000..d141d08 --- /dev/null +++ b/drivers/spi/msm_spi_qsd.h @@ -0,0 +1,436 @@ +/* Copyright (c) 2011, Code Aurora Forum. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _MSM_SPI_QSD_H +#define _MSM_SPI_QSD_H + +#define SPI_DRV_NAME "spi_qsd" + +#define QUP_CONFIG0x /* N & NO_INPUT/NO_OUPUT bits */ +#define QUP_ERROR_FLAGS 0x0308 +#define QUP_ERROR_FLAGS_EN0x030C +#define QUP_ERR_MASK 0x3 +#define SPI_OUTPUT_FIFO_WORD_CNT 0x010C +#define SPI_INPUT_FIFO_WORD_CNT 0x0214 +#define QUP_MX_WRITE_COUNT0x0150 +#define QUP_MX_WRITE_CNT_CURRENT 0x0154 + +#define QUP_CONFIG_SPI_MODE 0x0100 + +#define GSBI_CTRL_REG 0x0 +#define GSBI_SPI_CONFIG 0x30 + +#define SPI_CONFIG0x0300 +#define SPI_IO_CONTROL0x0304 +#define SPI_IO_MODES 0x0008 +#define SPI_SW_RESET 0x000C +#define SPI_TIME_OUT 0x0010 +#define SPI_TIME_OUT_CURRENT 0x0014 +#define SPI_MX_OUTPUT_COUNT 0x0100 +#define SPI_MX_OUTPUT_CNT_CURRENT 0x0104 +#define SPI_MX_INPUT_COUNT0x0200 +#define SPI_MX_INPUT_CNT_CURRENT 0x0204 +#define SPI_MX_READ_COUNT 0x0208 +#define SPI_MX_READ_CNT_CURRENT 0x020C +#define SPI_OPERATIONAL 0x0018 +#define SPI_ERROR_FLAGS 0x001C +#define SPI_ERROR_FLAGS_EN0x0020 +#define SPI_DEASSERT_WAIT 0x0310 +#define SPI_OUTPUT_DEBUG 0x0108 +#define SPI_INPUT_DEBUG 0x0210 +#define SPI_TEST_CTRL 0x0024 +#define SPI_OUTPUT_FIFO 0x0110 +#define SPI_INPUT_FIFO0x0218 +#define SPI_STATE 0x0004 + +/* SPI_CONFIG fields */ +#define SPI_CFG_INPUT_FIRST 0x0200 +#define SPI_NO_INPUT 0x0080 +#define SPI_NO_OUTPUT 0x0040 +#define SPI_CFG_LOOPBACK 0x0100 +#define SPI_CFG_N 0x001F + +/* SPI_IO_CONTROL fields */ +#define SPI_IO_C_CLK_IDLE_HIGH0x0400 +#define SPI_IO_C_MX_CS_MODE 0x0100 +#define SPI_IO_C_CS_N_POLARITY0x00F0 +#define SPI_IO_C_CS_N_POLARITY_0 0x0010 +#define SPI_IO_C_CS_SELECT0x0
une méthode naturelle pour retrouver ma ligne
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://mail.mc10.fr/mc10_m/YT0xMyZiPTI3MzImYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6NTA6MDEmZT0xJmY9MjczMiZnPTI3MzImaD0yNzMy Lien de désinscription : http://mail.mc10.fr/mc10_unsub/YT0xMyZiPTI3MzImYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6NTA6MDEmZT0xJmY9MjczMiZnPTI3MzImaD0yNzMy -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Comparez les offres de tous les assureurs et faites le bon choix
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://mail.mc10.fr/mc10_m/YT0xMyZiPTI2NDEmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6NTA6MDEmZT0xJmY9MjY0MSZnPTI2NDEmaD0yNjQx Lien de désinscription : http://mail.mc10.fr/mc10_unsub/YT0xMyZiPTI2NDEmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6NTA6MDEmZT0xJmY9MjY0MSZnPTI2NDEmaD0yNjQx -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Téléchargez le guide des radiateurs à inertie
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://mail.mc10.fr/mc10_m/YT0xMyZiPTI3MzEmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6MTA6MDEmZT0xJmY9MjczMSZnPTI3MzEmaD0yNzMx Lien de désinscription : http://mail.mc10.fr/mc10_unsub/YT0xMyZiPTI3MzEmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6MTA6MDEmZT0xJmY9MjczMSZnPTI3MzEmaD0yNzMx -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Brosse à dent electrique à 1 euro
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://mail.mc10.fr/mc10_m/YT0xMyZiPTI3NTgmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6MjA6MDEmZT0xJmY9Mjc1OCZnPTI3NTgmaD0yNzU4 Lien de désinscription : http://mail.mc10.fr/mc10_unsub/YT0xMyZiPTI3NTgmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6MjA6MDEmZT0xJmY9Mjc1OCZnPTI3NTgmaD0yNzU4 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Gganez 1 an de sport gratuit
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://mail.mc10.fr/mc10_m/YT0xMyZiPTI2OTMmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6MzA6MDEmZT0xJmY9MjY5MyZnPTI2OTMmaD0yNjkz Lien de désinscription : http://mail.mc10.fr/mc10_unsub/YT0xMyZiPTI2OTMmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6MzA6MDEmZT0xJmY9MjY5MyZnPTI2OTMmaD0yNjkz -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Votre devis mutuelle gratuit
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://mail.mc10.fr/mc10_m/YT0xMyZiPTIxNTEmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6NDA6MDEmZT0xJmY9MjE1MSZnPTIxNTEmaD0yMTUx Lien de désinscription : http://mail.mc10.fr/mc10_unsub/YT0xMyZiPTIxNTEmYz0yMTkwMDMwMyZkPTIwMTEtMTEtMDkgMTU6NDA6MDEmZT0xJmY9MjE1MSZnPTIxNTEmaD0yMTUx -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ 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/pl022: skip default configuration before suspending
On Wed, Nov 9, 2011 at 11:55 AM, Viresh Kumar wrote: > On 11/9/2011 4:09 PM, Linus WALLEIJ wrote: >> >> - amba_vcore_enable(pl022->adev); >> - amba_pclk_enable(pl022->adev); >> - load_ssp_default_config(pl022); >> - amba_pclk_disable(pl022->adev); >> - amba_vcore_disable(pl022->adev); >> - dev_dbg(dev, "suspended\n"); >> + dev_dbg(&adev->dev, "suspended\n"); > > why adev->dev instead of dev? Plain bug. It doesn't even compile with -DDEBUG :-/ I'll fix it up.. Linus -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ 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/pl022: add support for pm_runtime autosuspend
On 11/9/2011 4:09 PM, Linus WALLEIJ wrote: > From: Chris Blair > > Adds support for configuring the spi bus to use autosuspend for > runtime power management. This can reduce the latency in starting an > spi transfer by not suspending the device immediately following > completion of a transfer. If another transfer then takes place before > the autosuspend timeout, the call to resume the device can return > immediately rather than needing to risk sleeping in order to resume > the device. > > Signed-off-by: Chris Blair > Signed-off-by: Linus Walleij > --- > drivers/spi/spi-pl022.c| 20 ++-- > include/linux/amba/pl022.h |4 > 2 files changed, 22 insertions(+), 2 deletions(-) > > diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c > index 2e3522d..d3d6521 100644 > --- a/drivers/spi/spi-pl022.c > +++ b/drivers/spi/spi-pl022.c > @@ -1515,7 +1515,13 @@ static void pump_messages(struct work_struct *work) > /* nothing more to do - disable spi/ssp and power off */ > writew((readw(SSP_CR1(pl022->virtbase)) & > (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); > - pm_runtime_put(&pl022->adev->dev); > + > + if (pl022->master_info->autosuspend_delay > 0) { > + pm_runtime_mark_last_busy(&pl022->adev->dev); > + pm_runtime_put_autosuspend(&pl022->adev->dev); > + } else { > + pm_runtime_put(&pl022->adev->dev); > + } > } > pl022->busy = false; > spin_unlock_irqrestore(&pl022->queue_lock, flags); > @@ -2245,7 +2251,17 @@ pl022_probe(struct amba_device *adev, const struct > amba_id *id) > dev_dbg(dev, "probe succeeded\n"); > > /* let runtime pm put suspend */ > - pm_runtime_put(dev); > + if (platform_info->autosuspend_delay > 0) { > + dev_info(&adev->dev, > + "will use autosuspend for runtime pm, delay %dms\n", > + platform_info->autosuspend_delay); > + pm_runtime_set_autosuspend_delay(dev, > + platform_info->autosuspend_delay); > + pm_runtime_use_autosuspend(dev); > + pm_runtime_put_autosuspend(dev); > + } else { > + pm_runtime_put(dev); > + } > return 0; > > err_spi_register: > diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h > index 4ce98f5..572f637 100644 > --- a/include/linux/amba/pl022.h > +++ b/include/linux/amba/pl022.h > @@ -238,6 +238,9 @@ struct dma_chan; > * @enable_dma: if true enables DMA driven transfers. > * @dma_rx_param: parameter to locate an RX DMA channel. > * @dma_tx_param: parameter to locate a TX DMA channel. > + * @autosuspend_delay: delay in ms following transfer completion before the > + * runtime power management system suspends the device. A setting of 0 > + * indicates no delay and the device will be suspended immediately. > */ > struct pl022_ssp_controller { > u16 bus_id; > @@ -246,6 +249,7 @@ struct pl022_ssp_controller { > bool (*dma_filter)(struct dma_chan *chan, void *filter_param); > void *dma_rx_param; > void *dma_tx_param; > + int autosuspend_delay; > }; > > /** Reviewed-by: Viresh Kumar -- viresh -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 5/6] spi/pl022: move device disable to workqueue thread
On 11/9/2011 4:09 PM, Linus WALLEIJ wrote: > From: Chris Blair > diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c > index bffad2a..2e3522d 100644 > --- a/drivers/spi/spi-pl022.c > +++ b/drivers/spi/spi-pl022.c > @@ -512,13 +512,6 @@ static void giveback(struct pl022 *pl022) > msg->state = NULL; > if (msg->complete) > msg->complete(msg->context); > - > - /* disable the SPI/SSP operation */ > - writew((readw(SSP_CR1(pl022->virtbase)) & > - (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); > - We added this in an earlier patch in the same patchset. It would be better if we can shift that patch after this one. > - /* This message is completed, so let's turn off the clocks & power */ > - pm_runtime_put(&pl022->adev->dev); > } > > /** > @@ -1513,10 +1506,17 @@ static void pump_messages(struct work_struct *work) > struct pl022 *pl022 = > container_of(work, struct pl022, pump_messages); > unsigned long flags; > + bool was_busy = false; > > /* Lock queue and check for queue work */ > spin_lock_irqsave(&pl022->queue_lock, flags); > if (list_empty(&pl022->queue) || !pl022->running) { > + if (pl022->busy) { > + /* nothing more to do - disable spi/ssp and power off */ > + writew((readw(SSP_CR1(pl022->virtbase)) & > + (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); > + pm_runtime_put(&pl022->adev->dev); > + } Probably it will look better if we add a blank line here. -- viresh -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ 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/pl022: skip default configuration before suspending
On 11/9/2011 4:09 PM, Linus WALLEIJ wrote: > From: Virupax Sadashivpetimath > > The loading of the default configuration before suspending has > been in the driver since its inception, but it is not really > needed. Especially so since we take to all the trouble of > enabling and disabling power and clock just to do this. Let's > scrap this now. > > Signed-off-by: Virupax Sadashivpetimath > > Signed-off-by: Linus Walleij > --- > drivers/spi/spi-pl022.c |7 +-- > 1 files changed, 1 insertions(+), 6 deletions(-) > > diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c > index fa3eaae..bffad2a 100644 > --- a/drivers/spi/spi-pl022.c > +++ b/drivers/spi/spi-pl022.c > @@ -2314,12 +2314,7 @@ static int pl022_suspend(struct device *dev) > return status; > } > > - amba_vcore_enable(pl022->adev); > - amba_pclk_enable(pl022->adev); > - load_ssp_default_config(pl022); > - amba_pclk_disable(pl022->adev); > - amba_vcore_disable(pl022->adev); > - dev_dbg(dev, "suspended\n"); > + dev_dbg(&adev->dev, "suspended\n"); why adev->dev instead of dev? > return 0; > } > -- viresh -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ 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/pl022: disable the PL022 block when unused
On 11/9/2011 4:09 PM, Linus WALLEIJ wrote: > From: Virupax Sadashivpetimath > > Make sure we clear the enable bit when the block is not used. > This will save some energy in certain hardware versions. > > Signed-off-by: Virupax Sadashivpetimath > > Signed-off-by: Linus Walleij > --- > drivers/spi/spi-pl022.c |5 + > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c > index 305f2ba..fa3eaae 100644 > --- a/drivers/spi/spi-pl022.c > +++ b/drivers/spi/spi-pl022.c > @@ -512,6 +512,11 @@ static void giveback(struct pl022 *pl022) > msg->state = NULL; > if (msg->complete) > msg->complete(msg->context); > + > + /* disable the SPI/SSP operation */ > + writew((readw(SSP_CR1(pl022->virtbase)) & > + (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); > + > /* This message is completed, so let's turn off the clocks & power */ > pm_runtime_put(&pl022->adev->dev); > } Reviewed-by: Viresh Kumar -- viresh -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ 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/pl022: fix build warnings
On 11/9/2011 4:08 PM, Linus WALLEIJ wrote: > From: Jonas Aaberg > > The driver build complains with newer compilers unless you > initialize this struct properly. > > Signed-off-by: Jonas Aaberg > Signed-off-by: Linus Walleij > --- > drivers/spi/spi-pl022.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c > index b251926..305f2ba 100644 > --- a/drivers/spi/spi-pl022.c > +++ b/drivers/spi/spi-pl022.c > @@ -1885,7 +1885,7 @@ static int pl022_setup(struct spi_device *spi) > { > struct pl022_config_chip const *chip_info; > struct chip_data *chip; > - struct ssp_clock_params clk_freq = {0, }; > + struct ssp_clock_params clk_freq = { .cpsdvsr = 0, .scr = 0}; > int status = 0; > struct pl022 *pl022 = spi_master_get_devdata(spi->master); > unsigned int bits = spi->bits_per_word; Reviewed-by: Viresh Kumar -- viresh -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ 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/pl022: only enable RX interrupts when TX is complete
On 11/9/2011 4:08 PM, Linus WALLEIJ wrote: > + /* default is to enable all interrupts except RX - > + * this will be enabled once TX is complete > + */ Other than fixing this multiline comment, everything other looks fine. Reviewed-by: Viresh Kumar -- viresh -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 6/6] spi/pl022: add support for pm_runtime autosuspend
From: Chris Blair Adds support for configuring the spi bus to use autosuspend for runtime power management. This can reduce the latency in starting an spi transfer by not suspending the device immediately following completion of a transfer. If another transfer then takes place before the autosuspend timeout, the call to resume the device can return immediately rather than needing to risk sleeping in order to resume the device. Signed-off-by: Chris Blair Signed-off-by: Linus Walleij --- drivers/spi/spi-pl022.c| 20 ++-- include/linux/amba/pl022.h |4 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 2e3522d..d3d6521 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -1515,7 +1515,13 @@ static void pump_messages(struct work_struct *work) /* nothing more to do - disable spi/ssp and power off */ writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); - pm_runtime_put(&pl022->adev->dev); + + if (pl022->master_info->autosuspend_delay > 0) { + pm_runtime_mark_last_busy(&pl022->adev->dev); + pm_runtime_put_autosuspend(&pl022->adev->dev); + } else { + pm_runtime_put(&pl022->adev->dev); + } } pl022->busy = false; spin_unlock_irqrestore(&pl022->queue_lock, flags); @@ -2245,7 +2251,17 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) dev_dbg(dev, "probe succeeded\n"); /* let runtime pm put suspend */ - pm_runtime_put(dev); + if (platform_info->autosuspend_delay > 0) { + dev_info(&adev->dev, + "will use autosuspend for runtime pm, delay %dms\n", + platform_info->autosuspend_delay); + pm_runtime_set_autosuspend_delay(dev, + platform_info->autosuspend_delay); + pm_runtime_use_autosuspend(dev); + pm_runtime_put_autosuspend(dev); + } else { + pm_runtime_put(dev); + } return 0; err_spi_register: diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h index 4ce98f5..572f637 100644 --- a/include/linux/amba/pl022.h +++ b/include/linux/amba/pl022.h @@ -238,6 +238,9 @@ struct dma_chan; * @enable_dma: if true enables DMA driven transfers. * @dma_rx_param: parameter to locate an RX DMA channel. * @dma_tx_param: parameter to locate a TX DMA channel. + * @autosuspend_delay: delay in ms following transfer completion before the + * runtime power management system suspends the device. A setting of 0 + * indicates no delay and the device will be suspended immediately. */ struct pl022_ssp_controller { u16 bus_id; @@ -246,6 +249,7 @@ struct pl022_ssp_controller { bool (*dma_filter)(struct dma_chan *chan, void *filter_param); void *dma_rx_param; void *dma_tx_param; + int autosuspend_delay; }; /** -- 1.7.3.2 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 5/6] spi/pl022: move device disable to workqueue thread
From: Chris Blair Moves the disabling of the device and clocks to the same thread in which the device and clocks are enabled. This avoids SMP issues where the device can be enabled for a transfer by one thread and then disabled by the completion of the previous transfer in another thread. Signed-off-by: Chris Blair Signed-off-by: Linus Walleij --- drivers/spi/spi-pl022.c | 33 +++-- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index bffad2a..2e3522d 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -512,13 +512,6 @@ static void giveback(struct pl022 *pl022) msg->state = NULL; if (msg->complete) msg->complete(msg->context); - - /* disable the SPI/SSP operation */ - writew((readw(SSP_CR1(pl022->virtbase)) & - (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); - - /* This message is completed, so let's turn off the clocks & power */ - pm_runtime_put(&pl022->adev->dev); } /** @@ -1513,10 +1506,17 @@ static void pump_messages(struct work_struct *work) struct pl022 *pl022 = container_of(work, struct pl022, pump_messages); unsigned long flags; + bool was_busy = false; /* Lock queue and check for queue work */ spin_lock_irqsave(&pl022->queue_lock, flags); if (list_empty(&pl022->queue) || !pl022->running) { + if (pl022->busy) { + /* nothing more to do - disable spi/ssp and power off */ + writew((readw(SSP_CR1(pl022->virtbase)) & + (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); + pm_runtime_put(&pl022->adev->dev); + } pl022->busy = false; spin_unlock_irqrestore(&pl022->queue_lock, flags); return; @@ -1531,7 +1531,10 @@ static void pump_messages(struct work_struct *work) list_entry(pl022->queue.next, struct spi_message, queue); list_del_init(&pl022->cur_msg->queue); - pl022->busy = true; + if (pl022->busy) + was_busy = true; + else + pl022->busy = true; spin_unlock_irqrestore(&pl022->queue_lock, flags); /* Initial message state */ @@ -1541,12 +1544,14 @@ static void pump_messages(struct work_struct *work) /* Setup the SPI using the per chip configuration */ pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi); - /* -* We enable the core voltage and clocks here, then the clocks -* and core will be disabled when giveback() is called in each method -* (poll/interrupt/DMA) -*/ - pm_runtime_get_sync(&pl022->adev->dev); + if (!was_busy) + /* +* We enable the core voltage and clocks here, then the clocks +* and core will be disabled when this workqueue is run again +* and there is no more work to be done. +*/ + pm_runtime_get_sync(&pl022->adev->dev); + restore_state(pl022); flush(pl022); -- 1.7.3.2 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 3/6] spi/pl022: disable the PL022 block when unused
From: Virupax Sadashivpetimath Make sure we clear the enable bit when the block is not used. This will save some energy in certain hardware versions. Signed-off-by: Virupax Sadashivpetimath Signed-off-by: Linus Walleij --- drivers/spi/spi-pl022.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 305f2ba..fa3eaae 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -512,6 +512,11 @@ static void giveback(struct pl022 *pl022) msg->state = NULL; if (msg->complete) msg->complete(msg->context); + + /* disable the SPI/SSP operation */ + writew((readw(SSP_CR1(pl022->virtbase)) & + (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); + /* This message is completed, so let's turn off the clocks & power */ pm_runtime_put(&pl022->adev->dev); } -- 1.7.3.2 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 4/6] spi/pl022: skip default configuration before suspending
From: Virupax Sadashivpetimath The loading of the default configuration before suspending has been in the driver since its inception, but it is not really needed. Especially so since we take to all the trouble of enabling and disabling power and clock just to do this. Let's scrap this now. Signed-off-by: Virupax Sadashivpetimath Signed-off-by: Linus Walleij --- drivers/spi/spi-pl022.c |7 +-- 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index fa3eaae..bffad2a 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2314,12 +2314,7 @@ static int pl022_suspend(struct device *dev) return status; } - amba_vcore_enable(pl022->adev); - amba_pclk_enable(pl022->adev); - load_ssp_default_config(pl022); - amba_pclk_disable(pl022->adev); - amba_vcore_disable(pl022->adev); - dev_dbg(dev, "suspended\n"); + dev_dbg(&adev->dev, "suspended\n"); return 0; } -- 1.7.3.2 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 2/6] spi/pl022: fix build warnings
From: Jonas Aaberg The driver build complains with newer compilers unless you initialize this struct properly. Signed-off-by: Jonas Aaberg Signed-off-by: Linus Walleij --- drivers/spi/spi-pl022.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index b251926..305f2ba 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -1885,7 +1885,7 @@ static int pl022_setup(struct spi_device *spi) { struct pl022_config_chip const *chip_info; struct chip_data *chip; - struct ssp_clock_params clk_freq = {0, }; + struct ssp_clock_params clk_freq = { .cpsdvsr = 0, .scr = 0}; int status = 0; struct pl022 *pl022 = spi_master_get_devdata(spi->master); unsigned int bits = spi->bits_per_word; -- 1.7.3.2 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 0/6] PL022 updates
From: Linus Walleij This set consists of the previously submitted patches [1/6] thru [4/6] rebased on top of v3.2-rc1 and two new patches from Chris [5/6] and [6/6]. There is a pending clk_enable fix in Russell's tree but I don't think these patches collide with that fix. Chris Blair (3): spi/pl022: only enable RX interrupts when TX is complete spi/pl022: move device disable to workqueue thread spi/pl022: add support for pm_runtime autosuspend Jonas Aaberg (1): spi/pl022: fix build warnings Virupax Sadashivpetimath (2): spi/pl022: disable the PL022 block when unused spi/pl022: skip default configuration before suspending drivers/spi/spi-pl022.c| 69 ++-- include/linux/amba/pl022.h |4 ++ 2 files changed, 51 insertions(+), 22 deletions(-) -- 1.7.3.2 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/6] spi/pl022: only enable RX interrupts when TX is complete
From: Chris Blair For interrupt mode transfers, start with only TX interrupts enabled to reduce the overall number of interrupts received. Once TX is complete, enable RX interrupts to complete the transfer. Signed-off-by: Chris Blair Signed-off-by: Linus Walleij --- drivers/spi/spi-pl022.c | 14 +- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 5559b22..b251926 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -1244,9 +1244,9 @@ static irqreturn_t pl022_interrupt_handler(int irq, void *dev_id) if ((pl022->tx == pl022->tx_end) && (flag == 0)) { flag = 1; - /* Disable Transmit interrupt */ - writew(readw(SSP_IMSC(pl022->virtbase)) & - (~SSP_IMSC_MASK_TXIM), + /* Disable Transmit interrupt, enable receive interrupt */ + writew((readw(SSP_IMSC(pl022->virtbase)) & + ~SSP_IMSC_MASK_TXIM) | SSP_IMSC_MASK_RXIM, SSP_IMSC(pl022->virtbase)); } @@ -1379,12 +1379,16 @@ static void pump_transfers(unsigned long data) } err_config_dma: - writew(ENABLE_ALL_INTERRUPTS, SSP_IMSC(pl022->virtbase)); + /* enable all interrupts except RX */ + writew(ENABLE_ALL_INTERRUPTS & ~SSP_IMSC_MASK_RXIM, SSP_IMSC(pl022->virtbase)); } static void do_interrupt_dma_transfer(struct pl022 *pl022) { - u32 irqflags = ENABLE_ALL_INTERRUPTS; + /* default is to enable all interrupts except RX - +* this will be enabled once TX is complete +*/ + u32 irqflags = ENABLE_ALL_INTERRUPTS & ~SSP_IMSC_MASK_RXIM; /* Enable target chip */ pl022->cur_chip->cs_control(SSP_CHIP_SELECT); -- 1.7.3.2 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general