[PATCH] spi: omap2-mcspi: Cleanup the omap2_mcspi_txrx_dma function
Currently in omap2_mcspi_txrx_dma the tx and the rx support is interleaved. Make the rx related code in omap2_mcspi_rx_dma and the tx related code omap2_mcspi_tx_dma and call the functions. While at it remove the braces in the if statements which has only one line. Also fix [foo * bar to foo *bar] warn for the rx and tx variables. Only a cleanup no functional change. Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/spi/spi-omap2-mcspi.c | 256 +++-- 1 files changed, 144 insertions(+), 112 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 1c1dd34..dd8fc88 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -315,49 +315,27 @@ static void omap2_mcspi_tx_callback(void *data) omap2_mcspi_set_dma_req(spi, 0, 0); } -static unsigned -omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) +static void omap2_mcspi_tx_dma(struct spi_device *spi, + struct spi_transfer *xfer, + struct dma_slave_config cfg) { struct omap2_mcspi *mcspi; - struct omap2_mcspi_cs *cs = spi-controller_state; struct omap2_mcspi_dma *mcspi_dma; unsigned intcount; - int word_len, element_count; - int elements = 0; - u32 l; u8 * rx; const u8* tx; void __iomem*chstat_reg; - struct dma_slave_config cfg; - enum dma_slave_buswidth width; - unsigned es; + struct omap2_mcspi_cs *cs = spi-controller_state; mcspi = spi_master_get_devdata(spi-master); mcspi_dma = mcspi-dma_channels[spi-chip_select]; - l = mcspi_cached_chconf0(spi); + count = xfer-len; + rx = xfer-rx_buf; + tx = xfer-tx_buf; chstat_reg = cs-base + OMAP2_MCSPI_CHSTAT0; - if (cs-word_len = 8) { - width = DMA_SLAVE_BUSWIDTH_1_BYTE; - es = 1; - } else if (cs-word_len = 16) { - width = DMA_SLAVE_BUSWIDTH_2_BYTES; - es = 2; - } else { - width = DMA_SLAVE_BUSWIDTH_4_BYTES; - es = 4; - } - - memset(cfg, 0, sizeof(cfg)); - cfg.src_addr = cs-phys + OMAP2_MCSPI_RX0; - cfg.dst_addr = cs-phys + OMAP2_MCSPI_TX0; - cfg.src_addr_width = width; - cfg.dst_addr_width = width; - cfg.src_maxburst = 1; - cfg.dst_maxburst = 1; - - if (xfer-tx_buf mcspi_dma-dma_tx) { + if (mcspi_dma-dma_tx) { struct dma_async_tx_descriptor *tx; struct scatterlist sg; @@ -368,7 +346,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) sg_dma_len(sg) = xfer-len; tx = dmaengine_prep_slave_sg(mcspi_dma-dma_tx, sg, 1, - DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (tx) { tx-callback = omap2_mcspi_tx_callback; tx-callback_param = spi; @@ -377,8 +355,50 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) /* FIXME: fall back to PIO? */ } } + dma_async_issue_pending(mcspi_dma-dma_tx); + omap2_mcspi_set_dma_req(spi, 0, 1); - if (xfer-rx_buf mcspi_dma-dma_rx) { + wait_for_completion(mcspi_dma-dma_tx_completion); + dma_unmap_single(mcspi-dev, xfer-tx_dma, count, +DMA_TO_DEVICE); + + /* for TX_ONLY mode, be sure all words have shifted out */ + if (rx == NULL) { + if (mcspi_wait_for_reg_bit(chstat_reg, + OMAP2_MCSPI_CHSTAT_TXS) 0) + dev_err(spi-dev, TXS timed out\n); + else if (mcspi_wait_for_reg_bit(chstat_reg, + OMAP2_MCSPI_CHSTAT_EOT) 0) + dev_err(spi-dev, EOT timed out\n); + } +} + +static unsigned +omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer, + struct dma_slave_config cfg, + unsigned es) +{ + struct omap2_mcspi *mcspi; + struct omap2_mcspi_dma *mcspi_dma; + unsigned intcount; + u32 l; + int elements = 0; + int word_len, element_count; + struct omap2_mcspi_cs *cs = spi-controller_state; + mcspi = spi_master_get_devdata(spi-master); + mcspi_dma = mcspi-dma_channels[spi-chip_select]; + count = xfer-len; + word_len = cs-word_len; + l = mcspi_cached_chconf0(spi); + + if (word_len = 8) +
NISSAN Micra a partir de 99 euros /mois
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://email-mach10.com/mc10_m/YT04JmI9MTk3NTcmYz0xOTYxNjQxJmQ9MjAxMi0wOS0xMSAxMzowMDowMSZlPTEmaD0xOTc1NiZmPTE5NzU3Jmc9MTk3NTc= Lien de désinscription : http://email-mach10.com/mc10_unsub/YT04JmI9MTk3NTcmYz0xOTYxNjQxJmQ9MjAxMi0wOS0xMSAxMzowMDowMSZlPTEmaD0xOTc1NiZmPTE5NzU3Jmc9MTk3NTc= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
10,99 euros /mois - 3h et SMS ILLIMITES
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://email-mach10.com/mc10_m/YT04JmI9MTk2MzQmYz0xOTYxNjQxJmQ9MjAxMi0wOS0xMSAxNzowMDowMSZlPTEmaD0xOTYzMyZmPTE5NjM0Jmc9MTk2MzQ= Lien de désinscription : http://email-mach10.com/mc10_unsub/YT04JmI9MTk2MzQmYz0xOTYxNjQxJmQ9MjAxMi0wOS0xMSAxNzowMDowMSZlPTEmaD0xOTYzMyZmPTE5NjM0Jmc9MTk2MzQ= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 2/2] ARM: OMAP2+: Enable pinctrl dummy states
Enable pinctrl dummy states for all OMAP platforms. This allows drivers to be converted to pinctrl while still running on platforms that do not provide pinctrl data. Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/mach-omap2/devices.c |4 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index c00c689..577cd04 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -17,6 +17,7 @@ #include linux/err.h #include linux/slab.h #include linux/of.h +#include linux/pinctrl/machine.h #include linux/platform_data/omap4-keypad.h #include mach/hardware.h @@ -631,6 +632,9 @@ static inline void omap_init_vout(void) {} static int __init omap2_init_devices(void) { + /* Enable dummy states for those platforms without pinctrl support */ + pinctrl_provide_dummies(); + /* * please keep these calls, and their implementations above, * in alphabetical order so they're easier to sort through. -- 1.7.9.5 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/2] spi: omap2-mcspi: add pinctrl support
Adds pinctrl support to support OMAP platforms that boot from DT and rely on pinctrl support to set pinmuxes. Signed-off-by: Matt Porter mpor...@ti.com --- drivers/spi/spi-omap2-mcspi.c |9 + 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b2fb141..6c67cdb 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -38,6 +38,8 @@ #include linux/pm_runtime.h #include linux/of.h #include linux/of_device.h +#include linux/pinctrl/consumer.h +#include linux/err.h #include linux/spi/spi.h @@ -1124,6 +1126,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) static int bus_num = 1; struct device_node *node = pdev-dev.of_node; const struct of_device_id *match; + struct pinctrl *pinctrl; master = spi_alloc_master(pdev-dev, sizeof *mcspi); if (master == NULL) { @@ -1219,6 +1222,12 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) if (status 0) goto dma_chnl_free; + pinctrl = devm_pinctrl_get_select_default(pdev-dev); + if (IS_ERR(pinctrl)) { + status = PTR_ERR(pinctrl); + goto dma_chnl_free; + } + pm_runtime_use_autosuspend(pdev-dev); pm_runtime_set_autosuspend_delay(pdev-dev, SPI_AUTOSUSPEND_TIMEOUT); pm_runtime_enable(pdev-dev); -- 1.7.9.5 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 0/2] Add pinctrl support to omap2-mcspi
This series enables pinctrl support for McSPI. Platforms that boot only from DT and rely on pinctrl to set pinmuxes appropriately require this for omap2-mcspi operation. It has been tested on AM335x BeagleBone with an Adafruit SPI LCD attached and regression tested on Beagleboard xM booting in the !DT case, using board-omap3evm.c. There is a dependency on the patch to enable PINCTRL support (https://patchwork.kernel.org/patch/1376331/) for ARCH_OMAP2PLUS_TYPICAL. Matt Porter (2): spi: omap2-mcspi: add pinctrl support ARM: OMAP2+: Enable pinctrl dummy states arch/arm/mach-omap2/devices.c |4 drivers/spi/spi-omap2-mcspi.c |9 + 2 files changed, 13 insertions(+) -- 1.7.9.5 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ 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: omap2-mcspi: add pinctrl support
* Matt Porter mpor...@ti.com [120911 10:46]: Adds pinctrl support to support OMAP platforms that boot from DT and rely on pinctrl support to set pinmuxes. Signed-off-by: Matt Porter mpor...@ti.com --- drivers/spi/spi-omap2-mcspi.c |9 + 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b2fb141..6c67cdb 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -38,6 +38,8 @@ #include linux/pm_runtime.h #include linux/of.h #include linux/of_device.h +#include linux/pinctrl/consumer.h +#include linux/err.h #include linux/spi/spi.h @@ -1124,6 +1126,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) static int bus_num = 1; struct device_node *node = pdev-dev.of_node; const struct of_device_id *match; + struct pinctrl *pinctrl; master = spi_alloc_master(pdev-dev, sizeof *mcspi); if (master == NULL) { @@ -1219,6 +1222,12 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) if (status 0) goto dma_chnl_free; + pinctrl = devm_pinctrl_get_select_default(pdev-dev); + if (IS_ERR(pinctrl)) { + status = PTR_ERR(pinctrl); + goto dma_chnl_free; + } + pm_runtime_use_autosuspend(pdev-dev); pm_runtime_set_autosuspend_delay(pdev-dev, SPI_AUTOSUSPEND_TIMEOUT); pm_runtime_enable(pdev-dev); You should just print out a warning here as most boards don't have pinctrl implemented at this point, or may never have. Regards, Tony -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] ARM: OMAP2+: Enable pinctrl dummy states
* Matt Porter mpor...@ti.com [120911 10:46]: Enable pinctrl dummy states for all OMAP platforms. This allows drivers to be converted to pinctrl while still running on platforms that do not provide pinctrl data. Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/mach-omap2/devices.c |4 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index c00c689..577cd04 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -17,6 +17,7 @@ #include linux/err.h #include linux/slab.h #include linux/of.h +#include linux/pinctrl/machine.h #include linux/platform_data/omap4-keypad.h #include mach/hardware.h @@ -631,6 +632,9 @@ static inline void omap_init_vout(void) {} static int __init omap2_init_devices(void) { + /* Enable dummy states for those platforms without pinctrl support */ + pinctrl_provide_dummies(); + /* * please keep these calls, and their implementations above, * in alphabetical order so they're easier to sort through. Hmm I think this may need to be board specific. And may need to be board specific and depend on unpopulated device tree? For board-generic.c we always want to see the warnings. And some boards insist on doing all the muxing only in the bootloader. Regards, Tony -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ 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: omap2-mcspi: add pinctrl support
On Tue, Sep 11, 2012 at 11:00:41AM -0700, Tony Lindgren wrote: * Matt Porter mpor...@ti.com [120911 10:46]: Adds pinctrl support to support OMAP platforms that boot from DT and rely on pinctrl support to set pinmuxes. Signed-off-by: Matt Porter mpor...@ti.com --- drivers/spi/spi-omap2-mcspi.c |9 + 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b2fb141..6c67cdb 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -38,6 +38,8 @@ #include linux/pm_runtime.h #include linux/of.h #include linux/of_device.h +#include linux/pinctrl/consumer.h +#include linux/err.h #include linux/spi/spi.h @@ -1124,6 +1126,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) static int bus_num = 1; struct device_node *node = pdev-dev.of_node; const struct of_device_id *match; + struct pinctrl *pinctrl; master = spi_alloc_master(pdev-dev, sizeof *mcspi); if (master == NULL) { @@ -1219,6 +1222,12 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) if (status 0) goto dma_chnl_free; + pinctrl = devm_pinctrl_get_select_default(pdev-dev); + if (IS_ERR(pinctrl)) { + status = PTR_ERR(pinctrl); + goto dma_chnl_free; + } + pm_runtime_use_autosuspend(pdev-dev); pm_runtime_set_autosuspend_delay(pdev-dev, SPI_AUTOSUSPEND_TIMEOUT); pm_runtime_enable(pdev-dev); You should just print out a warning here as most boards don't have pinctrl implemented at this point, or may never have. It will not hit this error path on the boards without pinctrl due to the second part of the series. The error check is for some really unexpected failure in the pinctrl core and parsing functionality where we want it to bail out. -Matt -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] ARM: OMAP2+: Enable pinctrl dummy states
On Tue, Sep 11, 2012 at 11:03:06AM -0700, Tony Lindgren wrote: * Matt Porter mpor...@ti.com [120911 10:46]: Enable pinctrl dummy states for all OMAP platforms. This allows drivers to be converted to pinctrl while still running on platforms that do not provide pinctrl data. Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/mach-omap2/devices.c |4 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index c00c689..577cd04 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -17,6 +17,7 @@ #include linux/err.h #include linux/slab.h #include linux/of.h +#include linux/pinctrl/machine.h #include linux/platform_data/omap4-keypad.h #include mach/hardware.h @@ -631,6 +632,9 @@ static inline void omap_init_vout(void) {} static int __init omap2_init_devices(void) { + /* Enable dummy states for those platforms without pinctrl support */ + pinctrl_provide_dummies(); + /* * please keep these calls, and their implementations above, * in alphabetical order so they're easier to sort through. Hmm I think this may need to be board specific. And may need to be board specific and depend on unpopulated device tree? If I run this on AM33xx with dummy states enabled, I'm able to override that dummy state just fine with an appropriate pinctl/pinmux entry in my DT data for spi. Meanwhile on xM booting from board-omap3evm.c/!DT and debug enabled I get the following: [1.837829] omap2_mcspi omap2_mcspi.1: no of_node; not parsing pinctrl DT [1.845214] omap2_mcspi omap2_mcspi.1: using pinctrl dummy state (default) [1.854278] omap2_mcspi omap2_mcspi.2: no of_node; not parsing pinctrl DT [1.861572] omap2_mcspi omap2_mcspi.2: using pinctrl dummy state (default) [1.870025] omap2_mcspi omap2_mcspi.3: no of_node; not parsing pinctrl DT [1.877288] omap2_mcspi omap2_mcspi.3: using pinctrl dummy state (default) [1.885681] omap2_mcspi omap2_mcspi.4: no of_node; not parsing pinctrl DT [1.892913] omap2_mcspi omap2_mcspi.4: using pinctrl dummy state (default) which seems to cover things being informative enough about what is going on. Are you wanting to see an explicit warning that the pinctrl dummy state is in use when pinctrl data is not available? For board-generic.c we always want to see the warnings. And some boards insist on doing all the muxing only in the bootloader. Which warnings are you saying we should see in the board-generic.c case? Sure, there's plenty of cases where this will be unused due to somebody setting all the muxes in the bootloader and then not using pinctrl data. I'll have to doublecheck but I believe that case is also fine as the -single driver can't override the dummy state if the DT has no pinctrl data for the spi driver. -Matt -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] ARM: OMAP2+: Enable pinctrl dummy states
Added Linus Walleij to Cc as well. * Matt Porter mpor...@ti.com [120911 11:24]: On Tue, Sep 11, 2012 at 11:03:06AM -0700, Tony Lindgren wrote: * Matt Porter mpor...@ti.com [120911 10:46]: Enable pinctrl dummy states for all OMAP platforms. This allows drivers to be converted to pinctrl while still running on platforms that do not provide pinctrl data. Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/mach-omap2/devices.c |4 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index c00c689..577cd04 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -17,6 +17,7 @@ #include linux/err.h #include linux/slab.h #include linux/of.h +#include linux/pinctrl/machine.h #include linux/platform_data/omap4-keypad.h #include mach/hardware.h @@ -631,6 +632,9 @@ static inline void omap_init_vout(void) {} static int __init omap2_init_devices(void) { + /* Enable dummy states for those platforms without pinctrl support */ + pinctrl_provide_dummies(); + /* * please keep these calls, and their implementations above, * in alphabetical order so they're easier to sort through. Hmm I think this may need to be board specific. And may need to be board specific and depend on unpopulated device tree? If I run this on AM33xx with dummy states enabled, I'm able to override that dummy state just fine with an appropriate pinctl/pinmux entry in my DT data for spi. But do you get an error then if the desired pins are not found? If you do get an error, then sounds like it's OK to do. Meanwhile on xM booting from board-omap3evm.c/!DT and debug enabled I get the following: [1.837829] omap2_mcspi omap2_mcspi.1: no of_node; not parsing pinctrl DT [1.845214] omap2_mcspi omap2_mcspi.1: using pinctrl dummy state (default) [1.854278] omap2_mcspi omap2_mcspi.2: no of_node; not parsing pinctrl DT [1.861572] omap2_mcspi omap2_mcspi.2: using pinctrl dummy state (default) [1.870025] omap2_mcspi omap2_mcspi.3: no of_node; not parsing pinctrl DT [1.877288] omap2_mcspi omap2_mcspi.3: using pinctrl dummy state (default) [1.885681] omap2_mcspi omap2_mcspi.4: no of_node; not parsing pinctrl DT [1.892913] omap2_mcspi omap2_mcspi.4: using pinctrl dummy state (default) which seems to cover things being informative enough about what is going on. Are you wanting to see an explicit warning that the pinctrl dummy state is in use when pinctrl data is not available? Well I think we should consider at least the following: 1. Always see warnings when device tree is populated with board-generic. If somebody wants to use bootloader only muxing with DT, they can patch in pinctrl_provide_dummies() somewhere. But let's assume we always want to see the warnings with board-generic.c and DT. 2. For legacy booting without DT, we should not see any warnings from pinctrl-single.c as it's DT based. 3. There may be other non-pinctrl drivers too that are not DT based, and in those cases we should see the warnings as well for in the non-DT case. For board-generic.c we always want to see the warnings. And some boards insist on doing all the muxing only in the bootloader. Which warnings are you saying we should see in the board-generic.c case? Sure, there's plenty of cases where this will be unused due to somebody setting all the muxes in the bootloader and then not using pinctrl data. I'll have to doublecheck but I believe that case is also fine as the -single driver can't override the dummy state if the DT has no pinctrl data for the spi driver. Yeah I guess it's the case #1 above for board-generic.c. Regards, Tony -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] ARM: OMAP2+: Enable pinctrl dummy states
On Tue, Sep 11, 2012 at 11:35:22AM -0700, Tony Lindgren wrote: Added Linus Walleij to Cc as well. * Matt Porter mpor...@ti.com [120911 11:24]: On Tue, Sep 11, 2012 at 11:03:06AM -0700, Tony Lindgren wrote: * Matt Porter mpor...@ti.com [120911 10:46]: Enable pinctrl dummy states for all OMAP platforms. This allows drivers to be converted to pinctrl while still running on platforms that do not provide pinctrl data. Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/mach-omap2/devices.c |4 1 file changed, 4 insertions(+) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index c00c689..577cd04 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -17,6 +17,7 @@ #include linux/err.h #include linux/slab.h #include linux/of.h +#include linux/pinctrl/machine.h #include linux/platform_data/omap4-keypad.h #include mach/hardware.h @@ -631,6 +632,9 @@ static inline void omap_init_vout(void) {} static int __init omap2_init_devices(void) { + /* Enable dummy states for those platforms without pinctrl support */ + pinctrl_provide_dummies(); + /* * please keep these calls, and their implementations above, * in alphabetical order so they're easier to sort through. Hmm I think this may need to be board specific. And may need to be board specific and depend on unpopulated device tree? If I run this on AM33xx with dummy states enabled, I'm able to override that dummy state just fine with an appropriate pinctl/pinmux entry in my DT data for spi. But do you get an error then if the desired pins are not found? If you do get an error, then sounds like it's OK to do. Hrm, no. In that case, it will be completely silent (assuming we took care of the pinmuxing in the bootloader) as it uses the dummy state. Only with debug on will you see the information that mcspi has used the dummy state as is the case with !DT. Meanwhile on xM booting from board-omap3evm.c/!DT and debug enabled I get the following: [1.837829] omap2_mcspi omap2_mcspi.1: no of_node; not parsing pinctrl DT [1.845214] omap2_mcspi omap2_mcspi.1: using pinctrl dummy state (default) [1.854278] omap2_mcspi omap2_mcspi.2: no of_node; not parsing pinctrl DT [1.861572] omap2_mcspi omap2_mcspi.2: using pinctrl dummy state (default) [1.870025] omap2_mcspi omap2_mcspi.3: no of_node; not parsing pinctrl DT [1.877288] omap2_mcspi omap2_mcspi.3: using pinctrl dummy state (default) [1.885681] omap2_mcspi omap2_mcspi.4: no of_node; not parsing pinctrl DT [1.892913] omap2_mcspi omap2_mcspi.4: using pinctrl dummy state (default) which seems to cover things being informative enough about what is going on. Are you wanting to see an explicit warning that the pinctrl dummy state is in use when pinctrl data is not available? Well I think we should consider at least the following: 1. Always see warnings when device tree is populated with board-generic. If somebody wants to use bootloader only muxing with DT, they can patch in pinctrl_provide_dummies() somewhere. But let's assume we always want to see the warnings with board-generic.c and DT. Ok, this is clear. 2. For legacy booting without DT, we should not see any warnings from pinctrl-single.c as it's DT based. Right, except anything legacy booting without DT will require that dummy states be present otherwise it will fail probe. 3. There may be other non-pinctrl drivers too that are not DT based, and in those cases we should see the warnings as well for in the non-DT case. I'm not sure what you mean here. non-pinctrl drivers means any driver that is not yet pinctrl or DT enabled? It's unclear to me how this case has a bearing on mcspi and pinctrl enablement across legacy board-foo.c !DT booting platforms. However, I think if the approach was modified by only calling pinctrl_provide_dummies() when we are booting with DT populated and using board-generic.c then it will satisfy all of your concerns. Thoughts? i.e. the legacy !DT booting will have dummy states and continue along through mcspi the way it does today, relying on board-foo level pinmux calls (or bootloader pinmuxing). Meanwhile DT booting will now require that a mcspi instance also require pinctrl entry in this dts. The only worrisome thing is the pinctrl requirement on DT booting is now an implicit requirement. For board-generic.c we always want to see the warnings. And some boards insist on doing all the muxing only in the bootloader. Which warnings are you saying we should see in the board-generic.c case? Sure, there's plenty of cases where this will be unused due to somebody setting all the muxes in the bootloader and then not using pinctrl data. I'll have
Ack possibility for '[PATCH] SPI: OMAP: remove unnecessary includes of plat/clock.h' ?
Hi Grant, was wondering if you might be willing to ack this patch so we can merge it via OMAP: http://marc.info/?l=linux-omapm=134740630311140w=2 Just noticed we have a dependency on that patch for some common clock framework conversion patches also... - Paul -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH] spi/designware: Add device tree bindings
From: Dinh Nguyen dingu...@altera.com Add device tree bindings for designware spi modules, specifically, spi-dw-mmio and spi-dw-pci. Signed-off-by: Dinh Nguyen dingu...@altera.com --- Documentation/devicetree/bindings/spi/spi-dw.txt | 20 +++ drivers/spi/spi-dw-mmio.c| 24 +++--- drivers/spi/spi-dw-pci.c | 29 +++--- 3 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi-dw.txt diff --git a/Documentation/devicetree/bindings/spi/spi-dw.txt b/Documentation/devicetree/bindings/spi/spi-dw.txt new file mode 100644 index 000..10a6e9d --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi-dw.txt @@ -0,0 +1,20 @@ +DesignWare SPI device + +Required properties: +- compatible : should be snps,dw-spi-mmio or snps,dw-spi-pci +- reg : offset and length of the register set for the device +- interrupts: The interrupt number to the cpu. The interrupt specifier format + depends on the interrupt controller. +- num-chipselect: Contains the number of the chipselect +- bus-num: Bus number + +Example: + spi: spi@fff0 { + compatible = snps,dw-spi-mmio; + #address-cells = 1; + #size-cells = 0; + reg = 0xfff0 0x1000; + interrupts = 0 154 4; + num-chipselect = 4; + bus-num = 0; + }; diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index db2f1ba..555c47a 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -16,6 +16,7 @@ #include linux/spi/spi.h #include linux/scatterlist.h #include linux/module.h +#include linux/of.h #include spi-dw.h @@ -31,7 +32,7 @@ static int __devinit dw_spi_mmio_probe(struct platform_device *pdev) struct dw_spi_mmio *dwsmmio; struct dw_spi *dws; struct resource *mem, *ioarea; - int ret; + int ret, num_cs, bus_num; dwsmmio = kzalloc(sizeof(struct dw_spi_mmio), GFP_KERNEL); if (!dwsmmio) { @@ -78,9 +79,19 @@ static int __devinit dw_spi_mmio_probe(struct platform_device *pdev) } clk_enable(dwsmmio-clk); + ret = of_property_read_u32(pdev-dev.of_node, num-chipselect, num_cs); + if (ret 0) + dws-num_cs = 4; + else + dws-num_cs = num_cs; + + ret = of_property_read_u32(pdev-dev.of_node, bus-num, bus_num); + if (ret 0) + dws-bus_num = 0; + else + dws-bus_num = bus_num; + dws-parent_dev = pdev-dev; - dws-bus_num = 0; - dws-num_cs = 4; dws-max_freq = clk_get_rate(dwsmmio-clk); ret = dw_spi_add_host(dws); @@ -127,12 +138,19 @@ static int __devexit dw_spi_mmio_remove(struct platform_device *pdev) return 0; } +static struct of_device_id dw_spi_mmio_of_match[] __devinitdata = { + { .compatible = snps,dw-spi-mmio, }, + { /* sentinel */} +}; +MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match); + static struct platform_driver dw_spi_mmio_driver = { .probe = dw_spi_mmio_probe, .remove = __devexit_p(dw_spi_mmio_remove), .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, + .of_match_table = dw_spi_mmio_of_match, }, }; module_platform_driver(dw_spi_mmio_driver); diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index ff81abb..d6d9d77 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c @@ -22,6 +22,7 @@ #include linux/slab.h #include linux/spi/spi.h #include linux/module.h +#include linux/of.h #include spi-dw.h @@ -38,7 +39,7 @@ static int __devinit spi_pci_probe(struct pci_dev *pdev, struct dw_spi_pci *dwpci; struct dw_spi *dws; int pci_bar = 0; - int ret; + int ret, num_cs, bus_num; printk(KERN_INFO DW: found PCI SPI controller(ID: %04x:%04x)\n, pdev-vendor, pdev-device); @@ -71,9 +72,19 @@ static int __devinit spi_pci_probe(struct pci_dev *pdev, goto err_release_reg; } + ret = of_property_read_u32(pdev-dev.of_node, num-chipselect, num_cs); + if (ret 0) + dws-num_cs = 4; + else + dws-num_cs = num_cs; + + ret = of_property_read_u32(pdev-dev.of_node, bus-num, bus_num); + if (ret 0) + dws-bus_num = 0; + else + dws-bus_num = bus_num; + dws-parent_dev = pdev-dev; - dws-bus_num = 0; - dws-num_cs = 4; dws-irq = pdev-irq; /* @@ -155,13 +166,23 @@ static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { {}, }; +static struct of_device_id dw_spi_pci_of_match[] __devinitdata = { +
Re: Ack possibility for '[PATCH] SPI: OMAP: remove unnecessary includes of plat/clock.h' ?
I'm still under water on patch review due to moving to the uk. Mark Brown is covering for me on spi. It is a trivial change though. go ahead and merge it. g. On Wed, Sep 12, 2012 at 12:44 AM, Paul Walmsley p...@pwsan.com wrote: Hi Grant, was wondering if you might be willing to ack this patch so we can merge it via OMAP: http://marc.info/?l=linux-omapm=134740630311140w=2 Just noticed we have a dependency on that patch for some common clock framework conversion patches also... - Paul -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 2/2] ARM: OMAP2+: Enable pinctrl dummy states
* Matt Porter mpor...@ti.com [120911 12:05]: On Tue, Sep 11, 2012 at 11:35:22AM -0700, Tony Lindgren wrote: Added Linus Walleij to Cc as well. Now I think I really managed to add Linus W to Cc, sent too fast earlier. ... But do you get an error then if the desired pins are not found? If you do get an error, then sounds like it's OK to do. Hrm, no. In that case, it will be completely silent (assuming we took care of the pinmuxing in the bootloader) as it uses the dummy state. Only with debug on will you see the information that mcspi has used the dummy state as is the case with !DT. ... Well I think we should consider at least the following: 1. Always see warnings when device tree is populated with board-generic. If somebody wants to use bootloader only muxing with DT, they can patch in pinctrl_provide_dummies() somewhere. But let's assume we always want to see the warnings with board-generic.c and DT. Ok, this is clear. 2. For legacy booting without DT, we should not see any warnings from pinctrl-single.c as it's DT based. Right, except anything legacy booting without DT will require that dummy states be present otherwise it will fail probe. But I guess we should enable the dummy states only for other board-*.c files, not board-generic.c? 3. There may be other non-pinctrl drivers too that are not DT based, and in those cases we should see the warnings as well for in the non-DT case. I'm not sure what you mean here. non-pinctrl drivers means any driver that is not yet pinctrl or DT enabled? It's unclear to me how this case has a bearing on mcspi and pinctrl enablement across legacy board-foo.c !DT booting platforms. Right, sorry I meant non DT pinctrl drivers.. However, I think if the approach was modified by only calling pinctrl_provide_dummies() when we are booting with DT populated and using board-generic.c then it will satisfy all of your concerns. Thoughts? Hmm but shouldn't it be call pinctrl_provide_dummies() only for other boards except board-generic.c? And that is assuming we don't have any other non DT pinctrl drivers around. i.e. the legacy !DT booting will have dummy states and continue along through mcspi the way it does today, relying on board-foo level pinmux calls (or bootloader pinmuxing). Meanwhile DT booting will now require that a mcspi instance also require pinctrl entry in this dts. Yes agreed, except let's just produce a warning for the pinctrl errors.. The only worrisome thing is the pinctrl requirement on DT booting is now an implicit requirement. ..as otherwise not much will work at this point :) For board-generic.c we always want to see the warnings. And some boards insist on doing all the muxing only in the bootloader. Which warnings are you saying we should see in the board-generic.c case? Sure, there's plenty of cases where this will be unused due to somebody setting all the muxes in the bootloader and then not using pinctrl data. I'll have to doublecheck but I believe that case is also fine as the -single driver can't override the dummy state if the DT has no pinctrl data for the spi driver. I suggest all pinctrl errors should show up as warnings with board-generic.c, but we should not exit out of the driver probe on errors. Regards, Tony -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi: omap2-mcspi: Cleanup the omap2_mcspi_txrx_dma function
On Tue, Sep 11, 2012 at 12:13:20PM +0530, Shubhrajyoti D wrote: Currently in omap2_mcspi_txrx_dma the tx and the rx support is interleaved. Make the rx related code in omap2_mcspi_rx_dma and the tx related code omap2_mcspi_tx_dma and call the functions. I'd ideally like some testing from the OMAP side before applying this - is there someone who can give a Tested-by? -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] SPI: OMAP: remove unnecessary includes of plat/clock.h
On Wednesday 12 September 2012 05:01 AM, Paul Walmsley wrote: Remove unnecessary includes of plat/clock.h from the OMAP SPI controller drivers. These need to be removed to build multi-subarch ARM kernels which include these drivers. Looks good to me Acked-by: Shubhrajyoti D shubhrajy...@ti.com Signed-off-by: Paul Walmsley p...@pwsan.com Cc: Grant Likely grant.lik...@secretlab.ca --- drivers/spi/spi-omap-100k.c |2 -- drivers/spi/spi-omap2-mcspi.c |1 - 2 files changed, 3 deletions(-) diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 9bd1c92..dfb4b7f 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -37,8 +37,6 @@ #include linux/spi/spi.h -#include plat/clock.h - #define OMAP1_SPI100K_MAX_FREQ 4800 #define ICR_SPITAS (OMAP7XX_ICR_BASE + 0x12) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b2fb141..b5d6994 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -41,7 +41,6 @@ #include linux/spi/spi.h -#include plat/clock.h #include plat/mcspi.h #define OMAP2_MCSPI_MAX_FREQ 4800 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general