Re: spi: spi-davinci: Fix direction in dma_map_single()
On 04/18/2013 03:31 PM, Christian Eggers wrote: > Commit 048177ce3b3962852fd34a7e04938959271c7e70 (spi: spi-davinci: > > convert to DMA engine API) introduced a regression: dma_map_single() > > is called with direction DMA_FROM_DEVICE for rx and for tx. > > Signed-off-by: Christian Eggers > > Cc: sta...@vger.kernel.org Cc: sta...@vger.kernel.org # v3.7.x+ will get this applied to the correct stable kernels. I'm wearing the brown bag for this one so other than fixing the Cc: it looks good. Acked-by: Matt Porter > --- drivers/spi/spi-davinci.c.orig 2013-04-18 20:54:02.728719412 +0200 > > +++ drivers/spi/spi-davinci.c 2013-04-18 20:54:51.900623956 +0200 > > @@ -608,7 +608,7 @@ static int davinci_spi_bufs(struct spi_d > > else > > buf = (void *)t->tx_buf; > > t->tx_dma = dma_map_single(&spi->dev, buf, > > - t->len, DMA_FROM_DEVICE); > > + t->len, DMA_TO_DEVICE); > > if (!t->tx_dma) { > > ret = -EFAULT; > > goto err_tx_map; > -- 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: [PATCH v9 5/9] dmaengine: edma: Add TI EDMA device tree binding
On Tue, Mar 12, 2013 at 06:53:03AM +, Sekhar Nori wrote: > On 3/6/2013 9:45 PM, Matt Porter wrote: > > The binding definition is based on the generic DMA controller > > binding. > > > > Signed-off-by: Matt Porter > > Okay the bindings the documented after they are used leading to some > confusion. This patch should be moved up the series. As I noted in my > other e-mail, some of these bindings are not really hardware description > and need to be re-looked. Sure, I'll reorder it. -Matt > > --- > > Documentation/devicetree/bindings/dma/ti-edma.txt | 49 > > + > > 1 file changed, 49 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt > > > > diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt > > b/Documentation/devicetree/bindings/dma/ti-edma.txt > > new file mode 100644 > > index 000..075a60e3 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt > > @@ -0,0 +1,49 @@ > > +TI EDMA > > + > > +Required properties: > > +- compatible : "ti,edma3" > > +- ti,hwmods: Name of the hwmods associated to the EDMA > > +- ti,edma-regions: Number of regions > > +- ti,edma-slots: Number of slots > > +- ti,edma-queue-tc-map: List of transfer control to queue mappings > > +- ti,edma-queue-priority-map: List of queue priority mappings > > +- ti,edma-default-queue: Default queue value > > + > > +Optional properties: > > +- ti,edma-reserved-channels: List of reserved channel regions > > +- ti,edma-reserved-slots: List of reserved slot regions > > +- ti,edma-xbar-event-map: Crossbar event to channel map > > + > > +Example: > > + > > +edma: edma@4900 { > > + reg = <0x4900 0x1>; > > + interrupt-parent = <&intc>; > > + interrupts = <12 13 14>; > > + compatible = "ti,edma3"; > > + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; > > + #dma-cells = <1>; > > + dma-channels = <64>; > > + ti,edma-regions = <4>; > > + ti,edma-slots = <256>; > > + ti,edma-reserved-channels = <0 2 > > +14 2 > > +26 6 > > +48 4 > > +56 8>; > > + ti,edma-reserved-slots = <0 2 > > + 14 2 > > + 26 6 > > + 48 4 > > + 56 8 > > + 64 127>; > > + ti,edma-queue-tc-map = <0 0 > > + 1 1 > > + 2 2>; > > + ti,edma-queue-priority-map = <0 0 > > + 1 1 > > + 2 2>; > > + ti,edma-default-queue = <0>; > > + ti,edma-xbar-event-map = <1 12 > > + 2 13>; > > +}; > > -- 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 v9 3/9] ARM: edma: add AM33XX support to the private EDMA API
On Tue, Mar 12, 2013 at 06:45:46AM +, Sekhar Nori wrote: > > > On 3/6/2013 9:45 PM, Matt Porter wrote: > > Adds support for parsing the TI EDMA DT data into the > > required EDMA private API platform data. Enables runtime > > PM support to initialize the EDMA hwmod. Adds AM33XX EDMA > > crossbar event mux support. Enables build on OMAP. > > > > Signed-off-by: Matt Porter > > Acked-by: Sekhar Nori > > --- > > arch/arm/common/edma.c | 300 > > ++-- > > arch/arm/mach-omap2/Kconfig|1 + > > include/linux/platform_data/edma.h |1 + > > 3 files changed, 292 insertions(+), 10 deletions(-) > > > > diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c > > index a1db6cd..e68ac38 100644 > > --- a/arch/arm/common/edma.c > > +++ b/arch/arm/common/edma.c > > @@ -24,6 +24,13 @@ > > #include > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > > > #include > > > > @@ -1369,31 +1376,278 @@ void edma_clear_event(unsigned channel) > > EXPORT_SYMBOL(edma_clear_event); > > > > /*---*/ > > +static int edma_of_read_u32_to_s8_array(const struct device_node *np, > > +const char *propname, s8 *out_values, > > +size_t sz) > > +{ > > + int ret; > > + > > + ret = of_property_read_u8_array(np, propname, out_values, sz); > > + if (ret) > > + return ret; > > + > > + /* Terminate it */ > > + *out_values++ = -1; > > + *out_values++ = -1; > > + > > + return 0; > > +} > > + > > +static int edma_of_read_u32_to_s16_array(const struct device_node *np, > > +const char *propname, s16 *out_values, > > +size_t sz) > > +{ > > + int ret; > > + > > + ret = of_property_read_u16_array(np, propname, out_values, sz); > > + if (ret) > > + return ret; > > + > > + /* Terminate it */ > > + *out_values++ = -1; > > + *out_values++ = -1; > > + > > + return 0; > > +} > > + > > +static int edma_xbar_event_map(struct device *dev, > > + struct device_node *node, > > + struct edma_soc_info *pdata, int len) > > +{ > > It will be nice to separate the xbar feature from DT'fication of the > existing driver. Right now because of the mix the patch has become > pretty big and its becoming tough to review in isolation. Sure, I'll do that on v10. > > + int ret = 0; > > + int i; > > + struct resource res; > > + void *xbar; > > + const s16 (*xbar_chans)[2]; > > + u32 shift, offset, mux; > > + > > + xbar_chans = devm_kzalloc(dev, > > + len/sizeof(s16) + 2*sizeof(s16), > > + GFP_KERNEL); > > + if (!xbar_chans) > > + return -ENOMEM; > > + > > + ret = of_address_to_resource(node, 1, &res); > > + if (ret) > > + return -EIO; > > + > > + xbar = devm_ioremap(dev, res.start, resource_size(&res)); > > + if (!xbar) > > + return -ENOMEM; > > + > > + ret = edma_of_read_u32_to_s16_array(node, > > + "ti,edma-xbar-event-map", > > + (s16 *)xbar_chans, > > + len/sizeof(u32)); > > + if (ret) > > + return -EIO; > > + > > + for (i = 0; xbar_chans[i][0] != -1; i++) { > > + shift = (xbar_chans[i][1] % 4) * 8; > > + offset = xbar_chans[i][1] >> 2; > > + offset <<= 2; > > + mux = readl((void *)((u32)xbar + offset)); > > + mux &= ~(0xff << shift); > > + mux |= xbar_chans[i][0] << shift; > > + writel(mux, (void *)((u32)xbar + offset)); > > + } > > + > > + pdata->xbar_chans = xbar_chans; > > + > > + return 0; > > +} > > + > > +static int edma_of_parse_dt(struct device *dev, > > + struct device_node *node, > > + struct edma_soc_info *pdata) > > +{ > > + int ret = 0; >
Re: [PATCH v9 5/9] dmaengine: edma: Add TI EDMA device tree binding
On Wed, Mar 06, 2013 at 08:24:06PM +, Peter Korsgaard wrote: > >>>>> "Matt" == Matt Porter writes: > > Matt> The binding definition is based on the generic DMA controller > Matt> binding. > > Matt> Signed-off-by: Matt Porter > Matt> --- > Matt> Documentation/devicetree/bindings/dma/ti-edma.txt | 49 > + > Matt> 1 file changed, 49 insertions(+) > Matt> create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt > > Matt> diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt > b/Documentation/devicetree/bindings/dma/ti-edma.txt > Matt> new file mode 100644 > Matt> index 000..075a60e3 > Matt> --- /dev/null > Matt> +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt > Matt> @@ -0,0 +1,49 @@ > Matt> +TI EDMA > Matt> + > Matt> +Required properties: > Matt> +- compatible : "ti,edma3" > Matt> +- ti,hwmods: Name of the hwmods associated to the EDMA > Matt> +- ti,edma-regions: Number of regions > Matt> +- ti,edma-slots: Number of slots > Matt> +- ti,edma-queue-tc-map: List of transfer control to queue mappings > Matt> +- ti,edma-queue-priority-map: List of queue priority mappings > Matt> +- ti,edma-default-queue: Default queue value > Matt> + > Matt> +Optional properties: > Matt> +- ti,edma-reserved-channels: List of reserved channel regions > Matt> +- ti,edma-reserved-slots: List of reserved slot regions > Matt> +- ti,edma-xbar-event-map: Crossbar event to channel map > Matt> + > Matt> +Example: > Matt> + > Matt> +edma: edma@4900 { > Matt> + reg = <0x4900 0x1>; > Matt> + interrupt-parent = <&intc>; > Matt> + interrupts = <12 13 14>; > > Probably interrupt-parent should be removed from the example as well to > match am33xx.dtsi On second thought, I'm not sure we're going to get any direction on this one so let's just do what feels right and make it reflect common usage like you suggested. Thanks, Matt -- 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 v9 3/9] ARM: edma: add AM33XX support to the private EDMA API
On Thu, Mar 07, 2013 at 08:42:18AM +0200, Andy Shevchenko wrote: > On Wed, Mar 6, 2013 at 6:15 PM, Matt Porter wrote: > > Adds support for parsing the TI EDMA DT data into the > > required EDMA private API platform data. Enables runtime > > PM support to initialize the EDMA hwmod. Adds AM33XX EDMA > > crossbar event mux support. Enables build on OMAP. > > > --- a/arch/arm/common/edma.c > > +++ b/arch/arm/common/edma.c > > > +static int edma_xbar_event_map(struct device *dev, > > + struct device_node *node, > > + struct edma_soc_info *pdata, int len) > > +{ > > + int ret = 0; > > + int i; > > + struct resource res; > > + void *xbar; > > + const s16 (*xbar_chans)[2]; > > + u32 shift, offset, mux; > > + > > + xbar_chans = devm_kzalloc(dev, > > + len/sizeof(s16) + 2*sizeof(s16), > > + GFP_KERNEL); > > + if (!xbar_chans) > > + return -ENOMEM; > > + > > + ret = of_address_to_resource(node, 1, &res); > > + if (ret) > > + return -EIO; > > + > > + xbar = devm_ioremap(dev, res.start, resource_size(&res)); > > + if (!xbar) > > + return -ENOMEM; > > + > > + ret = edma_of_read_u32_to_s16_array(node, > > + "ti,edma-xbar-event-map", > > + (s16 *)xbar_chans, > > + len/sizeof(u32)); > > + if (ret) > > + return -EIO; > > + > > + for (i = 0; xbar_chans[i][0] != -1; i++) { > > + shift = (xbar_chans[i][1] % 4) * 8; > > Looks like shift = (xbar_chans[i][1] & 0x03) << 3; Yes, will update. > > + offset = xbar_chans[i][1] >> 2; > > + offset <<= 2; > > Is it offset = xbar_chans[i][1] & 0xfffc; ? Yes, will update > > + mux = readl((void *)((u32)xbar + offset)); > > + mux &= ~(0xff << shift); > > + mux |= xbar_chans[i][0] << shift; > > + writel(mux, (void *)((u32)xbar + offset)); > > + } > > > -- > With Best Regards, > Andy Shevchenko > ___ > devicetree-discuss mailing list > devicetree-disc...@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/devicetree-discuss -- 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 v9 5/9] dmaengine: edma: Add TI EDMA device tree binding
On Wed, Mar 06, 2013 at 08:24:06PM +, Peter Korsgaard wrote: > >>>>> "Matt" == Matt Porter writes: > > Matt> The binding definition is based on the generic DMA controller > Matt> binding. > > Matt> Signed-off-by: Matt Porter > Matt> --- > Matt> Documentation/devicetree/bindings/dma/ti-edma.txt | 49 > + > Matt> 1 file changed, 49 insertions(+) > Matt> create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt > > Matt> diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt > b/Documentation/devicetree/bindings/dma/ti-edma.txt > Matt> new file mode 100644 > Matt> index 000..075a60e3 > Matt> --- /dev/null > Matt> +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt > Matt> @@ -0,0 +1,49 @@ > Matt> +TI EDMA > Matt> + > Matt> +Required properties: > Matt> +- compatible : "ti,edma3" > Matt> +- ti,hwmods: Name of the hwmods associated to the EDMA > Matt> +- ti,edma-regions: Number of regions > Matt> +- ti,edma-slots: Number of slots > Matt> +- ti,edma-queue-tc-map: List of transfer control to queue mappings > Matt> +- ti,edma-queue-priority-map: List of queue priority mappings > Matt> +- ti,edma-default-queue: Default queue value > Matt> + > Matt> +Optional properties: > Matt> +- ti,edma-reserved-channels: List of reserved channel regions > Matt> +- ti,edma-reserved-slots: List of reserved slot regions > Matt> +- ti,edma-xbar-event-map: Crossbar event to channel map > Matt> + > Matt> +Example: > Matt> + > Matt> +edma: edma@4900 { > Matt> + reg = <0x4900 0x1>; > Matt> + interrupt-parent = <&intc>; > Matt> + interrupts = <12 13 14>; > > Probably interrupt-parent should be removed from the example as well to > match am33xx.dtsi I'm not sure what the DT maintainers want here. Full context within the example or the actual real usage where it's typically inherited. Grant or Rob, any thoughts? -Matt -- 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
[PATCH v9 3/9] ARM: edma: add AM33XX support to the private EDMA API
Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data. Enables runtime PM support to initialize the EDMA hwmod. Adds AM33XX EDMA crossbar event mux support. Enables build on OMAP. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 300 ++-- arch/arm/mach-omap2/Kconfig|1 + include/linux/platform_data/edma.h |1 + 3 files changed, 292 insertions(+), 10 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index a1db6cd..e68ac38 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -24,6 +24,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -1369,31 +1376,278 @@ void edma_clear_event(unsigned channel) EXPORT_SYMBOL(edma_clear_event); /*---*/ +static int edma_of_read_u32_to_s8_array(const struct device_node *np, +const char *propname, s8 *out_values, +size_t sz) +{ + int ret; + + ret = of_property_read_u8_array(np, propname, out_values, sz); + if (ret) + return ret; + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_of_read_u32_to_s16_array(const struct device_node *np, +const char *propname, s16 *out_values, +size_t sz) +{ + int ret; + + ret = of_property_read_u16_array(np, propname, out_values, sz); + if (ret) + return ret; + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_xbar_event_map(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata, int len) +{ + int ret = 0; + int i; + struct resource res; + void *xbar; + const s16 (*xbar_chans)[2]; + u32 shift, offset, mux; + + xbar_chans = devm_kzalloc(dev, + len/sizeof(s16) + 2*sizeof(s16), + GFP_KERNEL); + if (!xbar_chans) + return -ENOMEM; + + ret = of_address_to_resource(node, 1, &res); + if (ret) + return -EIO; + + xbar = devm_ioremap(dev, res.start, resource_size(&res)); + if (!xbar) + return -ENOMEM; + + ret = edma_of_read_u32_to_s16_array(node, + "ti,edma-xbar-event-map", + (s16 *)xbar_chans, + len/sizeof(u32)); + if (ret) + return -EIO; + + for (i = 0; xbar_chans[i][0] != -1; i++) { + shift = (xbar_chans[i][1] % 4) * 8; + offset = xbar_chans[i][1] >> 2; + offset <<= 2; + mux = readl((void *)((u32)xbar + offset)); + mux &= ~(0xff << shift); + mux |= xbar_chans[i][0] << shift; + writel(mux, (void *)((u32)xbar + offset)); + } + + pdata->xbar_chans = xbar_chans; + + return 0; +} + +static int edma_of_parse_dt(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata) +{ + int ret = 0; + u32 value; + struct property *prop; + size_t sz; + struct edma_rsv_info *rsv_info; + const s16 (*rsv_chans)[2], (*rsv_slots)[2]; + const s8 (*queue_tc_map)[2], (*queue_priority_map)[2]; + + memset(pdata, 0, sizeof(struct edma_soc_info)); + + ret = of_property_read_u32(node, "dma-channels", &value); + if (ret < 0) + return ret; + pdata->n_channel = value; + + ret = of_property_read_u32(node, "ti,edma-regions", &value); + if (ret < 0) + return ret; + pdata->n_region = value; + + ret = of_property_read_u32(node, "ti,edma-slots", &value); + if (ret < 0) + return ret; + pdata->n_slot = value; + + pdata->n_cc = 1; + pdata->n_tc = 3; + + rsv_info = + devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL); + if (!rsv_info) + return -ENOMEM; + pdata->rsv = rsv_info; + + /* Build the reserved channel/slots arrays */ + prop = of_find_property(node, "ti,edma-reserved-channels", &sz); + if (prop) { + rsv_chans = devm_kzalloc(dev, +sz/sizeof(s16) + 2*sizeof(s16), +
[PATCH v9 1/9] ARM: davinci: move private EDMA API to arm/common
Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx) as well. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/Kconfig |1 + arch/arm/common/Kconfig|3 + arch/arm/common/Makefile |1 + arch/arm/{mach-davinci/dma.c => common/edma.c} |2 +- arch/arm/mach-davinci/Makefile |2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- arch/arm/mach-davinci/davinci.h|2 +- arch/arm/mach-davinci/devices-tnetv107x.c |2 +- arch/arm/mach-davinci/devices.c|6 +- arch/arm/mach-davinci/dm355.c |2 +- arch/arm/mach-davinci/dm365.c |2 +- arch/arm/mach-davinci/dm644x.c |2 +- arch/arm/mach-davinci/dm646x.c |2 +- arch/arm/mach-davinci/include/mach/da8xx.h |2 +- drivers/dma/edma.c |2 +- drivers/mmc/host/davinci_mmc.c |1 + include/linux/mfd/davinci_voicecodec.h |3 +- .../mach => include/linux/platform_data}/edma.h| 89 +--- include/linux/platform_data/spi-davinci.h |2 +- sound/soc/davinci/davinci-evm.c|1 + sound/soc/davinci/davinci-pcm.c|1 + sound/soc/davinci/davinci-pcm.h|2 +- sound/soc/davinci/davinci-sffsdr.c |5 +- 23 files changed, 33 insertions(+), 104 deletions(-) rename arch/arm/{mach-davinci/dma.c => common/edma.c} (99%) rename {arch/arm/mach-davinci/include/mach => include/linux/platform_data}/edma.h (59%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5b71469..cb80a4d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -956,6 +956,7 @@ config ARCH_DAVINCI select GENERIC_IRQ_CHIP select HAVE_IDE select NEED_MACH_GPIO_H + select TI_PRIV_EDMA select USE_OF select ZONE_DMA help diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 9353184..c3a4e9c 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -17,3 +17,6 @@ config SHARP_PARAM config SHARP_SCOOP bool + +config TI_PRIV_EDMA + bool diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index dc8dd0d..9643c50 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile @@ -11,3 +11,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o +obj-$(CONFIG_TI_PRIV_EDMA) += edma.o diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c similarity index 99% rename from arch/arm/mach-davinci/dma.c rename to arch/arm/common/edma.c index 45b7c71..dcaeb8e 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/common/edma.c @@ -25,7 +25,7 @@ #include #include -#include +#include /* Offsets matching "struct edmacc_param" */ #define PARM_OPT 0x00 diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index fb5c1aa..493a36b 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -5,7 +5,7 @@ # Common objects obj-y := time.o clock.o serial.o psc.o \ - dma.o usb.o common.o sram.o aemif.o + usb.o common.o sram.o aemif.o obj-$(CONFIG_DAVINCI_MUX) += mux.o diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c index 4f41602..10c9efd 100644 --- a/arch/arm/mach-davinci/board-tnetv107x-evm.c +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c @@ -26,12 +26,12 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h index 12d544b..d26a6bc 100644 --- a/arch/arm/mach-davinci/davinci.h +++ b/arch/arm/mach-davinci/davinci.h @@ -23,9 +23,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c index 773ab07..ba37760 100644 --- a/arch/arm/mach-davinci/devices-tnetv107x.c +++ b/arch/arm/mach-davinci/devices-tnetv107x.c @@ -18,10 +18,10 @@ #include #include #include +#include #include #include -#include #include #include "clock.h" diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c index 4c48a36..ca0c7b3 100644 --- a/arch/arm/mach-davinci/devices.c +++ b/arch/arm/mach-davinci/devices.c @@ -19,9 +19,10 @@ #include #include #include -#include #include #include +#i
[PATCH v9 9/9] ARM: dts: add AM33XX SPI DMA support
Adds DMA resources to the AM33XX SPI nodes. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index cbea5ab..c3c781a 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -327,6 +327,11 @@ interrupt = <65>; ti,spi-num-cs = <2>; ti,hwmods = "spi0"; + dmas = <&edma 16 + &edma 17 + &edma 18 + &edma 19>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; @@ -338,6 +343,11 @@ interrupt = <125>; ti,spi-num-cs = <2>; ti,hwmods = "spi1"; + dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; -- 1.7.9.5 -- 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
[PATCH v9 0/9] DMA Engine support for AM33XX
Changes since v8: - Removed edma node interrupt-parent property, it is inherited Changes since v7: - Dropped dmaengine compat() patch. It is upstream. - Submitted edma_alloc_slot() error checking bug fix separately, now a dependency - Fixed bisect issues due to 3/10 hunks that went into 1/10 - Fixed incorrect IS_ERRVALUE() use in 3/10 Changes since v6: - Converted edma_of_read_*() to wrappers around of_property_read_*() - Fixed wording on the omap-spi generic DMA properties - Added comment/check to clarify that the driver only supports a single EDMA instance when booting from DT Changes since v5: - Dropped mmc portion and moved it to a separate series - Incorporate corrected version of dma_request_slave_channel_compat() - Fix #defines and enablement of TI_PRIV_EDMA option Changes since v4: - Fixed debug section mismatch in private edma api [01/14] - Respun format-patch to catch the platform_data/edma.h rename [01/14] - Removed address/size-cells from the EDMA binding [05/14] Changes since v3: - Rebased on 3.8-rc3 - No longer an RFC - Fixed bugs in DT/pdata parsing reported by Vaibhav Bedia - Restored all the Davinci pdata to const - Removed max_segs hack in favor of using dma_get_channel_caps() - Fixed extra parens, __raw_* accessors and, ioremap error checks in xbar handling - Removed excess license info in platform_data/edma.h - Removed unneeded reserved channels data for AM33xx - Removed test-specific pinmuxing from dts files - Adjusted mmc1 node to be disabled by default in the dtsi Changes since v2: - Rebased on 3.7-rc1 - Fixed bug in DT/pdata parsing first found by Gururaja that turned out to be masked by some toolchains - Dropped unused mach-omap2/devices.c hsmmc patch - Added AM33XX crossbar DMA event mux support - Added am335x-evm support Changes since v1: - Rebased on top of mainline from 12250d8 - Dropped the feature removal schedule patch - Implemented dma_request_slave_channel_compat() and converted the mmc and spi drivers to use it - Dropped unneeded #address-cells and #size-cells from EDMA DT support - Moved private EDMA header to linux/platform_data/ and removed some unneeded definitions - Fixed parsing of optional properties This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs. The series applies on top of 3.9-rc1 and the following patches: - edma private api error check fix from http://www.spinics.net/lists/arm-kernel/msg227886.html The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so the upstream generic DT DMA helpers are leveraged to register EDMA DMAC with the of_dma framework. SPI (and MMC in a separate series) are supported using the upstream dma_request_slave_channel_compat() dmaengine call that allows compatibility with !DT platforms. With this series both BeagleBone and the AM335x EVM have working SPI DMA support (and MMC support with the separate MMC series). This is tested on BeagleBone with a SPI framebuffer driver and MMC rootfs. A trivial gpio DMA event misc driver was used to test the crossbar DMA event support. It is also tested on the AM335x EVM with the onboard SPI flash and MMC rootfs. Note that MMC can only be tested with a separate MMC dmaengine/DT series applied. Regression testing was done on AM180x-EVM (which also makes use of the EDMA dmaengine driver and the EDMA private API) using SD, SPI flash, and the onboard audio supported by the ASoC Davinci driver. Regression testing was also done on a BeagleBoard xM booting from the legacy board file using MMC rootfs. Matt Porter (9): ARM: davinci: move private EDMA API to arm/common ARM: edma: remove unused transfer controller handlers ARM: edma: add AM33XX support to the private EDMA API dmaengine: edma: enable build for AM33XX dmaengine: edma: Add TI EDMA device tree binding ARM: dts: add AM33XX EDMA support spi: omap2-mcspi: convert to dma_request_slave_channel_compat() spi: omap2-mcspi: add generic DMA request support to the DT binding ARM: dts: add AM33XX SPI DMA support Documentation/devicetree/bindings/dma/ti-edma.txt | 49 +++ Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +- arch/arm/Kconfig
[PATCH v9 8/9] spi: omap2-mcspi: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/omap-spi.txt b/Documentation/devicetree/bindings/spi/omap-spi.txt index 938809c..4c85c4c 100644 --- a/Documentation/devicetree/bindings/spi/omap-spi.txt +++ b/Documentation/devicetree/bindings/spi/omap-spi.txt @@ -10,7 +10,18 @@ Required properties: input. The default is D0 as input and D1 as output. -Example: +Optional properties: +- dmas: List of DMA specifiers with the controller specific format + as described in the generic DMA client binding. A tx and rx + specifier is required for each chip select. +- dma-names: List of DMA request names. These strings correspond + 1:1 with the DMA specifiers listed in dmas. The string naming + is to be "rxN" and "txN" for RX and TX requests, + respectively, where N equals the chip select number. + +Examples: + +[hwmod populated DMA resources] mcspi1: mcspi@1 { #address-cells = <1>; @@ -20,3 +31,17 @@ mcspi1: mcspi@1 { ti,spi-num-cs = <4>; }; +[generic DMA request binding] + +mcspi1: mcspi@1 { +#address-cells = <1>; +#size-cells = <0>; +compatible = "ti,omap4-mcspi"; +ti,hwmods = "mcspi1"; +ti,spi-num-cs = <2>; +dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; +dma-names = "tx0", "rx0", "tx1", "rx1"; +}; -- 1.7.9.5 -- 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
[PATCH v9 7/9] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter Acked-by: Mark Brown --- drivers/spi/spi-omap2-mcspi.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 893c3d7..38d0915 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -102,6 +102,9 @@ struct omap2_mcspi_dma { struct completion dma_tx_completion; struct completion dma_rx_completion; + + char dma_rx_ch_name[14]; + char dma_tx_ch_name[14]; }; /* use PIO for small transfers, avoiding DMA setup/teardown overhead and @@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); sig = mcspi_dma->dma_rx_sync_dev; - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + + mcspi_dma->dma_rx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_rx_ch_name); + if (!mcspi_dma->dma_rx) { dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n"); return -EAGAIN; } sig = mcspi_dma->dma_tx_sync_dev; - mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + mcspi_dma->dma_tx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_tx_ch_name); + if (!mcspi_dma->dma_tx) { dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n"); dma_release_channel(mcspi_dma->dma_rx); @@ -1240,12 +1252,13 @@ static int omap2_mcspi_probe(struct platform_device *pdev) goto free_master; for (i = 0; i < master->num_chipselect; i++) { - char dma_ch_name[14]; + char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; + char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name; struct resource *dma_res; - sprintf(dma_ch_name, "rx%d", i); + sprintf(dma_rx_ch_name, "rx%d", i); dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); + dma_rx_ch_name); if (!dma_res) { dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); status = -ENODEV; @@ -1253,9 +1266,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev) } mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; - sprintf(dma_ch_name, "tx%d", i); + sprintf(dma_tx_ch_name, "tx%d", i); dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); + dma_tx_ch_name); if (!dma_res) { dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); status = -ENODEV; -- 1.7.9.5 -- 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
[PATCH v9 4/9] dmaengine: edma: enable build for AM33XX
Enable TI EDMA option on OMAP. Signed-off-by: Matt Porter --- drivers/dma/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 80b6997..3b7ea20 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -222,7 +222,7 @@ config SIRF_DMA config TI_EDMA tristate "TI EDMA support" - depends on ARCH_DAVINCI + depends on ARCH_DAVINCI || ARCH_OMAP select DMA_ENGINE select DMA_VIRTUAL_CHANNELS default n -- 1.7.9.5 -- 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
[PATCH v9 6/9] ARM: dts: add AM33XX EDMA support
Adds AM33XX EDMA support to the am33xx.dtsi as documented in Documentation/devicetree/bindings/dma/ti-edma.txt Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 19 +++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 0957645..cbea5ab 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -87,6 +87,25 @@ reg = <0x4820 0x1000>; }; + edma: edma@4900 { + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + reg = <0x4900 0x1>, + <0x44e10f90 0x10>; + interrupts = <12 13 14>; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + }; + gpio1: gpio@44e07000 { compatible = "ti,omap4-gpio"; ti,hwmods = "gpio1"; -- 1.7.9.5 -- 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
[PATCH v9 5/9] dmaengine: edma: Add TI EDMA device tree binding
The binding definition is based on the generic DMA controller binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/dma/ti-edma.txt | 49 + 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt b/Documentation/devicetree/bindings/dma/ti-edma.txt new file mode 100644 index 000..075a60e3 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt @@ -0,0 +1,49 @@ +TI EDMA + +Required properties: +- compatible : "ti,edma3" +- ti,hwmods: Name of the hwmods associated to the EDMA +- ti,edma-regions: Number of regions +- ti,edma-slots: Number of slots +- ti,edma-queue-tc-map: List of transfer control to queue mappings +- ti,edma-queue-priority-map: List of queue priority mappings +- ti,edma-default-queue: Default queue value + +Optional properties: +- ti,edma-reserved-channels: List of reserved channel regions +- ti,edma-reserved-slots: List of reserved slot regions +- ti,edma-xbar-event-map: Crossbar event to channel map + +Example: + +edma: edma@4900 { + reg = <0x4900 0x1>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-reserved-channels = <0 2 +14 2 +26 6 +48 4 +56 8>; + ti,edma-reserved-slots = <0 2 + 14 2 + 26 6 + 48 4 + 56 8 + 64 127>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + ti,edma-xbar-event-map = <1 12 + 2 13>; +}; -- 1.7.9.5 -- 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
[PATCH v9 2/9] ARM: edma: remove unused transfer controller handlers
Fix build on OMAP, the irqs are undefined on AM33xx. These error interrupt handlers were hardcoded as disabled so since they are unused code, simply remove them. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 37 - 1 file changed, 37 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index dcaeb8e..a1db6cd 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -494,26 +494,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) return IRQ_HANDLED; } -/** - * - * Transfer controller error interrupt handlers - * - */ - -#define tc_errs_handledfalse /* disabled as long as they're NOPs */ - -static irqreturn_t dma_tc0err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc0err_handler\n"); - return IRQ_HANDLED; -} - -static irqreturn_t dma_tc1err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc1err_handler\n"); - return IRQ_HANDLED; -} - static int reserve_contiguous_slots(int ctlr, unsigned int id, unsigned int num_slots, unsigned int start_slot) @@ -1541,23 +1521,6 @@ static int __init edma_probe(struct platform_device *pdev) arch_num_cc++; } - if (tc_errs_handled) { - status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0, - "edma_tc0", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n", - IRQ_TCERRINT0, status); - return status; - } - status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0, - "edma_tc1", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d --> %d\n", - IRQ_TCERRINT, status); - return status; - } - } - return 0; fail: -- 1.7.9.5 -- 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 v8 6/9] ARM: dts: add AM33XX EDMA support
On Wed, Mar 06, 2013 at 04:19:58AM +, Kumar, Anil wrote: > Hi, > > On Wed, Mar 06, 2013 at 02:23:12, Porter, Matt wrote: > > Adds AM33XX EDMA support to the am33xx.dtsi as documented in > > Documentation/devicetree/bindings/dma/ti-edma.txt > > > > Signed-off-by: Matt Porter > > --- > > arch/arm/boot/dts/am33xx.dtsi | 20 > > 1 file changed, 20 insertions(+) > > > > diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi > > index 0957645..aaf44122 100644 > > --- a/arch/arm/boot/dts/am33xx.dtsi > > +++ b/arch/arm/boot/dts/am33xx.dtsi > > @@ -87,6 +87,26 @@ > > reg = <0x4820 0x1000>; > > }; > > > > + edma: edma@4900 { > > + compatible = "ti,edma3"; > > + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; > > + reg = <0x4900 0x1>, > > + <0x44e10f90 0x10>; > > + interrupt-parent = <&intc>; > > Is it really need of "interrupt-parent = <&intc>" here ? > as this property is already with root node. > I am taking reference of 3.9-rc1 You're correct. It's inherited from the parent node so I'll drop it out. I also noted that the cpsw node has this wrong so I'll send a patch to address that separately. -Matt -- 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
[PATCH v8 8/9] spi: omap2-mcspi: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/omap-spi.txt b/Documentation/devicetree/bindings/spi/omap-spi.txt index 938809c..4c85c4c 100644 --- a/Documentation/devicetree/bindings/spi/omap-spi.txt +++ b/Documentation/devicetree/bindings/spi/omap-spi.txt @@ -10,7 +10,18 @@ Required properties: input. The default is D0 as input and D1 as output. -Example: +Optional properties: +- dmas: List of DMA specifiers with the controller specific format + as described in the generic DMA client binding. A tx and rx + specifier is required for each chip select. +- dma-names: List of DMA request names. These strings correspond + 1:1 with the DMA specifiers listed in dmas. The string naming + is to be "rxN" and "txN" for RX and TX requests, + respectively, where N equals the chip select number. + +Examples: + +[hwmod populated DMA resources] mcspi1: mcspi@1 { #address-cells = <1>; @@ -20,3 +31,17 @@ mcspi1: mcspi@1 { ti,spi-num-cs = <4>; }; +[generic DMA request binding] + +mcspi1: mcspi@1 { +#address-cells = <1>; +#size-cells = <0>; +compatible = "ti,omap4-mcspi"; +ti,hwmods = "mcspi1"; +ti,spi-num-cs = <2>; +dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; +dma-names = "tx0", "rx0", "tx1", "rx1"; +}; -- 1.7.9.5 -- 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
[PATCH v8 3/9] ARM: edma: add AM33XX support to the private EDMA API
Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data. Enables runtime PM support to initialize the EDMA hwmod. Adds AM33XX EDMA crossbar event mux support. Enables build on OMAP. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 300 ++-- arch/arm/mach-omap2/Kconfig|1 + include/linux/platform_data/edma.h |1 + 3 files changed, 292 insertions(+), 10 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index a1db6cd..e68ac38 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -24,6 +24,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -1369,31 +1376,278 @@ void edma_clear_event(unsigned channel) EXPORT_SYMBOL(edma_clear_event); /*---*/ +static int edma_of_read_u32_to_s8_array(const struct device_node *np, +const char *propname, s8 *out_values, +size_t sz) +{ + int ret; + + ret = of_property_read_u8_array(np, propname, out_values, sz); + if (ret) + return ret; + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_of_read_u32_to_s16_array(const struct device_node *np, +const char *propname, s16 *out_values, +size_t sz) +{ + int ret; + + ret = of_property_read_u16_array(np, propname, out_values, sz); + if (ret) + return ret; + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_xbar_event_map(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata, int len) +{ + int ret = 0; + int i; + struct resource res; + void *xbar; + const s16 (*xbar_chans)[2]; + u32 shift, offset, mux; + + xbar_chans = devm_kzalloc(dev, + len/sizeof(s16) + 2*sizeof(s16), + GFP_KERNEL); + if (!xbar_chans) + return -ENOMEM; + + ret = of_address_to_resource(node, 1, &res); + if (ret) + return -EIO; + + xbar = devm_ioremap(dev, res.start, resource_size(&res)); + if (!xbar) + return -ENOMEM; + + ret = edma_of_read_u32_to_s16_array(node, + "ti,edma-xbar-event-map", + (s16 *)xbar_chans, + len/sizeof(u32)); + if (ret) + return -EIO; + + for (i = 0; xbar_chans[i][0] != -1; i++) { + shift = (xbar_chans[i][1] % 4) * 8; + offset = xbar_chans[i][1] >> 2; + offset <<= 2; + mux = readl((void *)((u32)xbar + offset)); + mux &= ~(0xff << shift); + mux |= xbar_chans[i][0] << shift; + writel(mux, (void *)((u32)xbar + offset)); + } + + pdata->xbar_chans = xbar_chans; + + return 0; +} + +static int edma_of_parse_dt(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata) +{ + int ret = 0; + u32 value; + struct property *prop; + size_t sz; + struct edma_rsv_info *rsv_info; + const s16 (*rsv_chans)[2], (*rsv_slots)[2]; + const s8 (*queue_tc_map)[2], (*queue_priority_map)[2]; + + memset(pdata, 0, sizeof(struct edma_soc_info)); + + ret = of_property_read_u32(node, "dma-channels", &value); + if (ret < 0) + return ret; + pdata->n_channel = value; + + ret = of_property_read_u32(node, "ti,edma-regions", &value); + if (ret < 0) + return ret; + pdata->n_region = value; + + ret = of_property_read_u32(node, "ti,edma-slots", &value); + if (ret < 0) + return ret; + pdata->n_slot = value; + + pdata->n_cc = 1; + pdata->n_tc = 3; + + rsv_info = + devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL); + if (!rsv_info) + return -ENOMEM; + pdata->rsv = rsv_info; + + /* Build the reserved channel/slots arrays */ + prop = of_find_property(node, "ti,edma-reserved-channels", &sz); + if (prop) { + rsv_chans = devm_kzalloc(dev, +sz/sizeof(s16) + 2*sizeof(s16), +
[PATCH v8 4/9] dmaengine: edma: enable build for AM33XX
Enable TI EDMA option on OMAP. Signed-off-by: Matt Porter --- drivers/dma/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 80b6997..3b7ea20 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -222,7 +222,7 @@ config SIRF_DMA config TI_EDMA tristate "TI EDMA support" - depends on ARCH_DAVINCI + depends on ARCH_DAVINCI || ARCH_OMAP select DMA_ENGINE select DMA_VIRTUAL_CHANNELS default n -- 1.7.9.5 -- 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
[PATCH v8 1/9] ARM: davinci: move private EDMA API to arm/common
Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx) as well. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/Kconfig |1 + arch/arm/common/Kconfig|3 + arch/arm/common/Makefile |1 + arch/arm/{mach-davinci/dma.c => common/edma.c} |2 +- arch/arm/mach-davinci/Makefile |2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- arch/arm/mach-davinci/davinci.h|2 +- arch/arm/mach-davinci/devices-tnetv107x.c |2 +- arch/arm/mach-davinci/devices.c|6 +- arch/arm/mach-davinci/dm355.c |2 +- arch/arm/mach-davinci/dm365.c |2 +- arch/arm/mach-davinci/dm644x.c |2 +- arch/arm/mach-davinci/dm646x.c |2 +- arch/arm/mach-davinci/include/mach/da8xx.h |2 +- drivers/dma/edma.c |2 +- drivers/mmc/host/davinci_mmc.c |1 + include/linux/mfd/davinci_voicecodec.h |3 +- .../mach => include/linux/platform_data}/edma.h| 89 +--- include/linux/platform_data/spi-davinci.h |2 +- sound/soc/davinci/davinci-evm.c|1 + sound/soc/davinci/davinci-pcm.c|1 + sound/soc/davinci/davinci-pcm.h|2 +- sound/soc/davinci/davinci-sffsdr.c |5 +- 23 files changed, 33 insertions(+), 104 deletions(-) rename arch/arm/{mach-davinci/dma.c => common/edma.c} (99%) rename {arch/arm/mach-davinci/include/mach => include/linux/platform_data}/edma.h (59%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5b71469..cb80a4d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -956,6 +956,7 @@ config ARCH_DAVINCI select GENERIC_IRQ_CHIP select HAVE_IDE select NEED_MACH_GPIO_H + select TI_PRIV_EDMA select USE_OF select ZONE_DMA help diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 9353184..c3a4e9c 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -17,3 +17,6 @@ config SHARP_PARAM config SHARP_SCOOP bool + +config TI_PRIV_EDMA + bool diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index dc8dd0d..9643c50 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile @@ -11,3 +11,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o +obj-$(CONFIG_TI_PRIV_EDMA) += edma.o diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c similarity index 99% rename from arch/arm/mach-davinci/dma.c rename to arch/arm/common/edma.c index 45b7c71..dcaeb8e 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/common/edma.c @@ -25,7 +25,7 @@ #include #include -#include +#include /* Offsets matching "struct edmacc_param" */ #define PARM_OPT 0x00 diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index fb5c1aa..493a36b 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -5,7 +5,7 @@ # Common objects obj-y := time.o clock.o serial.o psc.o \ - dma.o usb.o common.o sram.o aemif.o + usb.o common.o sram.o aemif.o obj-$(CONFIG_DAVINCI_MUX) += mux.o diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c index 4f41602..10c9efd 100644 --- a/arch/arm/mach-davinci/board-tnetv107x-evm.c +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c @@ -26,12 +26,12 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h index 12d544b..d26a6bc 100644 --- a/arch/arm/mach-davinci/davinci.h +++ b/arch/arm/mach-davinci/davinci.h @@ -23,9 +23,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c index 773ab07..ba37760 100644 --- a/arch/arm/mach-davinci/devices-tnetv107x.c +++ b/arch/arm/mach-davinci/devices-tnetv107x.c @@ -18,10 +18,10 @@ #include #include #include +#include #include #include -#include #include #include "clock.h" diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c index 4c48a36..ca0c7b3 100644 --- a/arch/arm/mach-davinci/devices.c +++ b/arch/arm/mach-davinci/devices.c @@ -19,9 +19,10 @@ #include #include #include -#include #include #include +#i
[PATCH v8 9/9] ARM: dts: add AM33XX SPI DMA support
Adds DMA resources to the AM33XX SPI nodes. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index aaf44122..a13d710 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -328,6 +328,11 @@ interrupt = <65>; ti,spi-num-cs = <2>; ti,hwmods = "spi0"; + dmas = <&edma 16 + &edma 17 + &edma 18 + &edma 19>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; @@ -339,6 +344,11 @@ interrupt = <125>; ti,spi-num-cs = <2>; ti,hwmods = "spi1"; + dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; -- 1.7.9.5 -- 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
[PATCH v8 7/9] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter Acked-by: Mark Brown --- drivers/spi/spi-omap2-mcspi.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 893c3d7..38d0915 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -102,6 +102,9 @@ struct omap2_mcspi_dma { struct completion dma_tx_completion; struct completion dma_rx_completion; + + char dma_rx_ch_name[14]; + char dma_tx_ch_name[14]; }; /* use PIO for small transfers, avoiding DMA setup/teardown overhead and @@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); sig = mcspi_dma->dma_rx_sync_dev; - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + + mcspi_dma->dma_rx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_rx_ch_name); + if (!mcspi_dma->dma_rx) { dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n"); return -EAGAIN; } sig = mcspi_dma->dma_tx_sync_dev; - mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + mcspi_dma->dma_tx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_tx_ch_name); + if (!mcspi_dma->dma_tx) { dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n"); dma_release_channel(mcspi_dma->dma_rx); @@ -1240,12 +1252,13 @@ static int omap2_mcspi_probe(struct platform_device *pdev) goto free_master; for (i = 0; i < master->num_chipselect; i++) { - char dma_ch_name[14]; + char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; + char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name; struct resource *dma_res; - sprintf(dma_ch_name, "rx%d", i); + sprintf(dma_rx_ch_name, "rx%d", i); dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); + dma_rx_ch_name); if (!dma_res) { dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); status = -ENODEV; @@ -1253,9 +1266,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev) } mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; - sprintf(dma_ch_name, "tx%d", i); + sprintf(dma_tx_ch_name, "tx%d", i); dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); + dma_tx_ch_name); if (!dma_res) { dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); status = -ENODEV; -- 1.7.9.5 -- 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
[PATCH v8 6/9] ARM: dts: add AM33XX EDMA support
Adds AM33XX EDMA support to the am33xx.dtsi as documented in Documentation/devicetree/bindings/dma/ti-edma.txt Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 0957645..aaf44122 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -87,6 +87,26 @@ reg = <0x4820 0x1000>; }; + edma: edma@4900 { + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + reg = <0x4900 0x1>, + <0x44e10f90 0x10>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + }; + gpio1: gpio@44e07000 { compatible = "ti,omap4-gpio"; ti,hwmods = "gpio1"; -- 1.7.9.5 -- 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
[PATCH v8 5/9] dmaengine: edma: Add TI EDMA device tree binding
The binding definition is based on the generic DMA controller binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/dma/ti-edma.txt | 49 + 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt b/Documentation/devicetree/bindings/dma/ti-edma.txt new file mode 100644 index 000..075a60e3 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt @@ -0,0 +1,49 @@ +TI EDMA + +Required properties: +- compatible : "ti,edma3" +- ti,hwmods: Name of the hwmods associated to the EDMA +- ti,edma-regions: Number of regions +- ti,edma-slots: Number of slots +- ti,edma-queue-tc-map: List of transfer control to queue mappings +- ti,edma-queue-priority-map: List of queue priority mappings +- ti,edma-default-queue: Default queue value + +Optional properties: +- ti,edma-reserved-channels: List of reserved channel regions +- ti,edma-reserved-slots: List of reserved slot regions +- ti,edma-xbar-event-map: Crossbar event to channel map + +Example: + +edma: edma@4900 { + reg = <0x4900 0x1>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-reserved-channels = <0 2 +14 2 +26 6 +48 4 +56 8>; + ti,edma-reserved-slots = <0 2 + 14 2 + 26 6 + 48 4 + 56 8 + 64 127>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + ti,edma-xbar-event-map = <1 12 + 2 13>; +}; -- 1.7.9.5 -- 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
[PATCH v8 0/9] DMA Engine support for AM33XX
Changes since v7: - Dropped dmaengine compat() patch. It is upstream. - Submitted edma_alloc_slot() error checking bug fix separately, now a dependency - Fixed bisect issues due to 3/10 hunks that went into 1/10 - Fixed incorrect IS_ERRVALUE() use in 3/10 Changes since v6: - Converted edma_of_read_*() to wrappers around of_property_read_*() - Fixed wording on the omap-spi generic DMA properties - Added comment/check to clarify that the driver only supports a single EDMA instance when booting from DT Changes since v5: - Dropped mmc portion and moved it to a separate series - Incorporate corrected version of dma_request_slave_channel_compat() - Fix #defines and enablement of TI_PRIV_EDMA option Changes since v4: - Fixed debug section mismatch in private edma api [01/14] - Respun format-patch to catch the platform_data/edma.h rename [01/14] - Removed address/size-cells from the EDMA binding [05/14] Changes since v3: - Rebased on 3.8-rc3 - No longer an RFC - Fixed bugs in DT/pdata parsing reported by Vaibhav Bedia - Restored all the Davinci pdata to const - Removed max_segs hack in favor of using dma_get_channel_caps() - Fixed extra parens, __raw_* accessors and, ioremap error checks in xbar handling - Removed excess license info in platform_data/edma.h - Removed unneeded reserved channels data for AM33xx - Removed test-specific pinmuxing from dts files - Adjusted mmc1 node to be disabled by default in the dtsi Changes since v2: - Rebased on 3.7-rc1 - Fixed bug in DT/pdata parsing first found by Gururaja that turned out to be masked by some toolchains - Dropped unused mach-omap2/devices.c hsmmc patch - Added AM33XX crossbar DMA event mux support - Added am335x-evm support Changes since v1: - Rebased on top of mainline from 12250d8 - Dropped the feature removal schedule patch - Implemented dma_request_slave_channel_compat() and converted the mmc and spi drivers to use it - Dropped unneeded #address-cells and #size-cells from EDMA DT support - Moved private EDMA header to linux/platform_data/ and removed some unneeded definitions - Fixed parsing of optional properties This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs. The series applies on top of 3.9-rc1 and the following patches: - edma private api error check fix from http://www.spinics.net/lists/arm-kernel/msg227886.html The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers. With this series both BeagleBone and the AM335x EVM have working SPI DMA support (and MMC support with the separate MMC series). This is tested on BeagleBone with a SPI framebuffer driver and MMC rootfs. A trivial gpio DMA event misc driver was used to test the crossbar DMA event support. It is also tested on the AM335x EVM with the onboard SPI flash and MMC rootfs. The branch at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-v7 has the complete series, dependencies, and some test drivers/defconfigs. Note that MMC can only be tested with a separate MMC dmaengine/DT series applied. Regression testing was done on AM180x-EVM (which also makes use of the EDMA dmaengine driver and the EDMA private API) using SD, SPI flash, and the onboard audio supported by the ASoC Davinci driver. Regression testing was also done on a BeagleBoard xM booting from the legacy board file using MMC rootfs. Matt Porter (9): ARM: davinci: move private EDMA API to arm/common ARM: edma: remove unused transfer controller handlers ARM: edma: add AM33XX support to the private EDMA API dmaengine: edma: enable build for AM33XX dmaengine: edma: Add TI EDMA device tree binding ARM: dts: add AM33XX EDMA support spi: omap2-mcspi: convert to dma_request_slave_channel_compat() spi: omap2-mcspi: add generic DMA request support to the DT binding ARM: dts: add AM33XX SPI DMA support Documentation/devicetree/bindings/dma/ti-edma.txt | 49 +++ Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +- arch/arm/Kconfig |
[PATCH v8 2/9] ARM: edma: remove unused transfer controller handlers
Fix build on OMAP, the irqs are undefined on AM33xx. These error interrupt handlers were hardcoded as disabled so since they are unused code, simply remove them. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 37 - 1 file changed, 37 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index dcaeb8e..a1db6cd 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -494,26 +494,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) return IRQ_HANDLED; } -/** - * - * Transfer controller error interrupt handlers - * - */ - -#define tc_errs_handledfalse /* disabled as long as they're NOPs */ - -static irqreturn_t dma_tc0err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc0err_handler\n"); - return IRQ_HANDLED; -} - -static irqreturn_t dma_tc1err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc1err_handler\n"); - return IRQ_HANDLED; -} - static int reserve_contiguous_slots(int ctlr, unsigned int id, unsigned int num_slots, unsigned int start_slot) @@ -1541,23 +1521,6 @@ static int __init edma_probe(struct platform_device *pdev) arch_num_cc++; } - if (tc_errs_handled) { - status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0, - "edma_tc0", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n", - IRQ_TCERRINT0, status); - return status; - } - status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0, - "edma_tc1", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d --> %d\n", - IRQ_TCERRINT, status); - return status; - } - } - return 0; fail: -- 1.7.9.5 -- 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 v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Sat, Feb 09, 2013 at 08:08:50PM +, Russell King wrote: > On Sat, Feb 09, 2013 at 09:35:53PM +0530, Sekhar Nori wrote: > > On 2/1/2013 11:52 PM, Matt Porter wrote: > > > + ret = of_address_to_resource(node, 1, &res); > > > > of_address_to_resource() needs > > > > > + if (IS_ERR_VALUE(ret)) > > > > This needs > > More importantly, is this the correct way to check for errors from > of_address_to_resource() ? Grepping the source shows that either less > than 0 or non-zero are the commonly used conditions here. Yes, it's not correct. Fixed to check for non-zero/zero in the two cases where of_address_to_resource() is used. -Matt -- 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 v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Sat, Feb 09, 2013 at 09:35:53PM +0530, Sekhar Nori wrote: > Hi Matt, > > This version introduces build/bisect issues. Ok, see later comment which addresses this... > On 2/1/2013 11:52 PM, Matt Porter wrote: > > Move mach-davinci/dma.c to common/edma.c so it can be used > > by OMAP (specifically AM33xx) as well. > > > > Signed-off-by: Matt Porter > > Acked-by: Sekhar Nori > > > diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c > > > @@ -25,7 +25,7 @@ > > #include > > #include > > > > -#include > > +#include > > > /*---*/ > > +static int edma_of_read_u32_to_s8_array(const struct device_node *np, > > +const char *propname, s8 *out_values, > > +size_t sz) > > +{ > > + int ret; > > + > > + ret = of_property_read_u8_array(np, propname, out_values, sz); > > This needs to be included in this file. > > > +static int edma_xbar_event_map(struct device *dev, > > + struct device_node *node, > > + struct edma_soc_info *pdata, int len) > > +{ > > + int ret = 0; > > + int i; > > + struct resource res; > > + void *xbar; > > + const s16 (*xbar_chans)[2]; > > + u32 shift, offset, mux; > > + > > + xbar_chans = devm_kzalloc(dev, > > + len/sizeof(s16) + 2*sizeof(s16), > > + GFP_KERNEL); > > + if (!xbar_chans) > > + return -ENOMEM; > > + > > + ret = of_address_to_resource(node, 1, &res); > > of_address_to_resource() needs > > > + if (IS_ERR_VALUE(ret)) > > This needs > > > + return -EIO; > > + > > + xbar = devm_ioremap(dev, res.start, resource_size(&res)); > > + if (!xbar) > > + return -ENOMEM; > > + > > + ret = edma_of_read_u32_to_s16_array(node, > > + "ti,edma-xbar-event-map", > > + (s16 *)xbar_chans, > > + len/sizeof(u32)); > > + if (IS_ERR_VALUE(ret)) > > + return -EIO; > > + > > + for (i = 0; xbar_chans[i][0] != -1; i++) { > > + shift = (xbar_chans[i][1] % 4) * 8; > > + offset = xbar_chans[i][1] >> 2; > > + offset <<= 2; > > + mux = readl((void *)((u32)xbar + offset)); > > + mux &= ~(0xff << shift); > > + mux |= xbar_chans[i][0] << shift; > > + writel(mux, (void *)((u32)xbar + offset)); > > + } > > + > > + pdata->xbar_chans = xbar_chans; > > There is no member xbar_chans ATM. It seems to be introduced in 03/10. > > > + > > +static struct of_dma_filter_info edma_filter_info = { > > of_dma_filter_info needs . > > > + .filter_fn = edma_filter_fn, > > edma_filter_fn needs > > BTW, I am not sure if you really intended to introduce EDMA DT support > in this patch. I thought 1/10 was supposed to just move EDMA private API > to a common place. If you really want to introduce DT support as well, > that should be noted in the description. I think it is better done in a > later patch. This was a complete fubared rebase for this patch. As you noticed, I got hunks from 3/10 in there and the bisect test didn't run so it was missed. I've got this fixed up for v8 which address all these comments that stem from that issue. > > diff --git a/sound/soc/davinci/davinci-sffsdr.c > > b/sound/soc/davinci/davinci-sffsdr.c > > > @@ -17,6 +17,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -28,12 +29,14 @@ > > #include > > #endif > > > > -#include > > > > #include "../codecs/pcm3008.h" > > #include "davinci-pcm.h" > > #include "davinci-i2s.h" > > > > +#define DAVINCI_DMA_MCBSP_TX 2 > > +#define DAVINCI_DMA_MCBSP_RX 3 > > + > > /* > > * CLKX and CLKR are the inputs for the Sample Rate Generator. > > * FSX and FSR are outputs, driven by the sample Rate Generator. > > @@ -124,7 +127,7 @@ static struct resource sffsdr_snd_resources[] = { > > > > static struct evm_snd_platform_data sffsdr_snd_data = { > > .tx_dma_ch = DAVINCI_DMA_MCBSP_TX, > > - .rx_dma_ch = DAVINCI_DMA_MCBSP_RX, > > > + .rx_dma_ch = DAVINCI_DMA_MCBAP_RX, > > Typo here. Should be DAVINCI_DMA_MCBSP_RX. Unfortunately > davinci-sffsdr.c seems to be broken already. Ok, fixed..definitely shouldn't break it more. -Matt -- 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 v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Sat, Feb 02, 2013 at 07:06:06PM +, Sergei Shtylyov wrote: > Hello. > > On 02-02-2013 22:07, Matt Porter wrote: > > >>>>>>> Move mach-davinci/dma.c to common/edma.c so it can be used > >>>>>>> by OMAP (specifically AM33xx) as well. > > >>>>>> I think this should rather go to drivers/dma/? > > >>>>> No, this is the private EDMA API. It's the analogous thing to > >>>>> the private OMAP dma API that is in plat-omap/dma.c. The actual > >>>>> dmaengine driver is in drivers/dma/edma.c as a wrapper around > >>>>> this...same way OMAP DMA engine conversion is being done. > > >>>> Keeps me wondering why we couldn't have the same with CPPI 4.1 when > >>>> I proposed > >>>> that, instead of waiting indefinitely for TI to convert it to > >>>> drivers/dma/ > >>>> directly. We could have working MUSB DMA on OMAP-L1x/Sitara all this > >>>> time... Sigh. > > >>> That is a shame. Yeah, I've pointed out that I was doing this exactly > >>> the same way as was acceptable for the OMAP DMA conversion since it was > >>> in RFC. The reasons are sound since in both cases, we have many drivers > >>> to convert that need to continue using the private DMA APIs. > > >> In case of CPPI 4.1, we'd only have to convert MUSB DMA driver. Other > >> in-tree CPPI 4.1 having SoCs don't use it for anything but MUSB -- it even > >> is > >> sub-block of their MUSB device, AFAIK (I maybe wrong about Sitaras -- I > >> don't > >> know them well). > > > Well, it's pretty clear to me now that there's good reason for it not > > landing in arch/arm/ so the obvious path is to do the dmaengine > > conversion and put it in drivers/dma/ if it's really a generic dma engine. > > I'm not sure why you express concern over the dma engine api not fitting > > with CPPI 4.1? > > It's not a DMA controller only, it's 3 distinct devices, with the DMA > controller being one among them and using another one, the queue manager, as > some sort of proxy. The third device doesn't exist on OMAP-L1x SoCs -- it's > the buffer manager. Interesting, and you don't see a way to have this split between dmaengine and the musb driver? This all assumes there's even a match as RMK did raise concerns elsewhere in this thread. > > If it doesn't work, work with Vinod to fix the api. It's > > expected, I'm working on dmaengine API changes right now to deal with a > > limitation of EDMA that needs to be abstracted. > > Sorry, now it's TI's task. I no longer have time to work on this (my > internal project to push OMAP-L1x support upstream has expired at Sep 2010) > and my future in MV is very uncertain at this moment. Most probably I'll > leave > it (or be forced to leave). Too bad, it's certainly "somebody's task". The people employed by TI have names too. ;) I suspect it falls to Felipe or Kishon these days, but I try to avoid USB as it's generally a source of pain. > > As pointed out, edma.c is already here in arch/arm/, so moving it doesn't > > add something new. It does let us regression test all platforms that use it > > (both Davinci and AM33xx) as I go through the conversion process. > > Could have been the same with CPPI 4.1 in theory if it was added to > mach-davinci/ back in 2009... we'd then only have to move it. EDMA code is > much older of course, so it's probably more justified. Absolutely, timing is everything. I can assure you I've flamed enough people "internally" about leaving this EDMA dmaengine conversion for so long. As you might have guessed, AM33xx is a bit of a driver for it, but all of this would have been quite a bit simpler had somebody taken a little effort and moved edma to dmaengine years ago when slave dma support was added to dmaengine. ;) -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Sat, Feb 02, 2013 at 10:16:43AM -0800, Tony Lindgren wrote: > * Matt Porter [130202 10:10]: > > If it doesn't work, work with Vinod to fix the api. It's expected, > > I'm working on dmaengine API changes right now to deal with a > > limitation of EDMA that needs to be abstracted. > > Regarding the DMA API limitations, I'm only aware of lack of capability > to configure autoincrement at the device end. And that keeps us from > converting all GPMC related devices using omap SDMA to use the DMA API. > > Are there other limitations currently known with the DMA API? Yes, I called one out when this was first posted as an RFC and was working it in parallel with this support. This one blocks AM33XX support in mmc and is the reason I split all of the mmc support out of the base edma dmaengine for am33xx series. Independent of the blockage, whatever we finally settle on to address this API need will also cleanup the use of magic values in the davinci mmc driver (that's part of the second thread below). RFC posting: https://patchwork.kernel.org/patch/1583531/ Posting with initial attempt at a caps api: http://www.spinics.net/lists/linux-mmc/msg18351.html Also, I haven't fully vetted the situation with cyclic transfers and EDMA, however, I'm pretty sure that we'll need some API changes there. The reason is that some Davinci platforms have no FIFO on their McASP implementation (that was a new feature added on DA8xx and also AM33xx). As such they have audio support implemented using ping-pong buffering via an SRAM buffer. There's been a number of patches ahead of all this that myself and others have worked upstream to get the SRAM stuff to be Davinci-independent (genalloc). But, at the end of all of this, there's no notion in a cyclic transfer of doing synchronized ping-pong buffering using two chain channels. This is how it is implemented (and documented in EDMA docs going back to the DSPs this IP first showed up on) using the private API. I'll be looking at this soon, but, I'm more interested in 1) getting the base support in 2) then the mmc stuff blocking DT populated platforms using omap_hsmmc (split out and posted) 3) v3 of the caps api w/ vinod's concerns address (working it not) Normally, I'm not going to bring up the cyclic transfer issue until I have some code to show or reference for discussion...but it's worth being aware. But, in any case, I'm confident that will gate having the mcasp driver that am33xx also uses converted to dmaengine. Except for the gpmc limitation you menationed, that's the last in kernel user of the privat edma api needed to be converted such that we can kill off arch/arm/common/edma.c once it's taken in. -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Sat, Feb 02, 2013 at 12:01:37AM +, Sergei Shtylyov wrote: > Hello. > > On 01-02-2013 22:59, Matt Porter wrote: > > >>>>> Move mach-davinci/dma.c to common/edma.c so it can be used > >>>>> by OMAP (specifically AM33xx) as well. > > >>>> I think this should rather go to drivers/dma/? > > >>> No, this is the private EDMA API. It's the analogous thing to > >>> the private OMAP dma API that is in plat-omap/dma.c. The actual > >>> dmaengine driver is in drivers/dma/edma.c as a wrapper around > >>> this...same way OMAP DMA engine conversion is being done. > > >>Keeps me wondering why we couldn't have the same with CPPI 4.1 when I > >> proposed > >> that, instead of waiting indefinitely for TI to convert it to drivers/dma/ > >> directly. We could have working MUSB DMA on OMAP-L1x/Sitara all this > >> time... Sigh. > > > That is a shame. Yeah, I've pointed out that I was doing this exactly > > the same way as was acceptable for the OMAP DMA conversion since it was > > in RFC. The reasons are sound since in both cases, we have many drivers > > to convert that need to continue using the private DMA APIs. > > In case of CPPI 4.1, we'd only have to convert MUSB DMA driver. Other > in-tree CPPI 4.1 having SoCs don't use it for anything but MUSB -- it even is > sub-block of their MUSB device, AFAIK (I maybe wrong about Sitaras -- I don't > know them well). Well, it's pretty clear to me now that there's good reason for it not landing in arch/arm/ so the obvious path is to do the dmaengine conversion and put it in drivers/dma/ if it's really a generic dma engine. I'm not sure why you express concern over the dma engine api not fitting with CPPI 4.1? If it doesn't work, work with Vinod to fix the api. It's expected, I'm working on dmaengine API changes right now to deal with a limitation of EDMA that needs to be abstracted. As pointed out, edma.c is already here in arch/arm/, so moving it doesn't add something new. It does let us regression test all platforms that use it (both Davinci and AM33xx) as I go through the conversion process. -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Sat, Feb 02, 2013 at 12:49:06PM +, Russell King wrote: > On Fri, Feb 01, 2013 at 10:41:08AM -0800, Tony Lindgren wrote: > > * Matt Porter [130201 10:25]: > > > Move mach-davinci/dma.c to common/edma.c so it can be used > > > by OMAP (specifically AM33xx) as well. > > > > I think this should rather go to drivers/dma/? > > Yes, it should, but just like OMAP, there's a conversion effort that needs > to be gone through. It has one point - and only one point - which allows > its continued existence under arch/arm, and that is it already exists > there. > > If it was new code, the answer would be a definite NACK, but it isn't. > It's pre-existing code which is already in mainline. It's merely being > moved. > > Another plus point for it is that there does seem to be a DMA engine > driver for it, so hopefully we'll see it killed off in arch/arm soon. That's definitely the plan. I was able to start this effort independently by converting the Davinci mmc and spi drivers to dmaengine before I took this step. I've got the next micro-step of addressing omap_hsmmc in process (pending on agreement on a dmaengine api change with Vinod), cleaning up the mcasp driver is also pending this series so that it can also be converted to dmaengine. Once mcasp (or "davinci audio") is converted, we're rid of all the in-kernel users of the private API and can get rid of this...which also is helping clean up mach-davinci, of course. If I can get your ack on this patch that should move things along to these next steps. Thanks, Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Fri, Feb 01, 2013 at 07:52:46PM +, Sergei Shtylyov wrote: > Hello. > > On 02/01/2013 09:49 PM, Matt Porter wrote: > > >>> Move mach-davinci/dma.c to common/edma.c so it can be used > >>> by OMAP (specifically AM33xx) as well. > > >> I think this should rather go to drivers/dma/? > > > No, this is the private EDMA API. It's the analogous thing to > > the private OMAP dma API that is in plat-omap/dma.c. The actual > > dmaengine driver is in drivers/dma/edma.c as a wrapper around > > this...same way OMAP DMA engine conversion is being done. > > Keeps me wondering why we couldn't have the same with CPPI 4.1 when I > proposed > that, instead of waiting indefinitely for TI to convert it to drivers/dma/ > directly. We could have working MUSB DMA on OMAP-L1x/Sitara all this time... > Sigh. That is a shame. Yeah, I've pointed out that I was doing this exactly the same way as was acceptable for the OMAP DMA conversion since it was in RFC. The reasons are sound since in both cases, we have many drivers to convert that need to continue using the private DMA APIs. -Matt > -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common
On Fri, Feb 01, 2013 at 06:41:08PM +, Tony Lindgren wrote: > * Matt Porter [130201 10:25]: > > Move mach-davinci/dma.c to common/edma.c so it can be used > > by OMAP (specifically AM33xx) as well. > > I think this should rather go to drivers/dma/? No, this is the private EDMA API. It's the analogous thing to the private OMAP dma API that is in plat-omap/dma.c. The actual dmaengine driver is in drivers/dma/edma.c as a wrapper around this...same way OMAP DMA engine conversion is being done. -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v7 00/10] DMA Engine support for AM33XX
On Fri, Feb 01, 2013 at 01:22:45PM -0500, Matt Porter wrote: > This series adds DMA Engine support for AM33xx, which uses > an EDMA DMAC. The EDMA DMAC has been previously supported by only > a private API implementation (much like the situation with OMAP > DMA) found on the DaVinci family of SoCs. Tony, Will you be able to take this series in through your tree? It appears we just need acks on the new bindings and the compat api change. I haven't heard from you or Benoit on the dts patches so it seems those are ready as well. Thanks, Matt > > The series applies on top of 3.8-rc5 and the following patches: > > - dmaengine DT support and edma dmaengine driver fix from > the git://git.infradead.org/users/vkoul/slave-dma.git next > branch > > The approach taken is similar to how OMAP DMA is being converted to > DMA Engine support. With the functional EDMA private API already > existing in mach-davinci/dma.c, we first move that to an ARM common > area so it can be shared. Adding DT and runtime PM support to the > private EDMA API implementation allows it to run on AM33xx. AM33xx > *only* boots using DT so we leverage Jon's generic DT DMA helpers to > register EDMA DMAC with the of_dma framework and then add support > for calling the dma_request_slave_channel() API to both the mmc > and spi drivers. > > With this series both BeagleBone and the AM335x EVM have working > SPI DMA support (and MMC support with the separate MMC series). > > This is tested on BeagleBone with a SPI framebuffer driver and MMC > rootfs. A trivial gpio DMA event misc driver was used to test the > crossbar DMA event support. It is also tested on the AM335x EVM > with the onboard SPI flash and MMC rootfs. The branch at > https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-v7 > has the complete series, dependencies, and some test > drivers/defconfigs. Note that MMC can only be tested with a > separate MMC dmaengine/DT series applied. > > Regression testing was done on AM180x-EVM (which also makes use > of the EDMA dmaengine driver and the EDMA private API) using SD, > SPI flash, and the onboard audio supported by the ASoC Davinci > driver. Regression testing was also done on a BeagleBoard xM > booting from the legacy board file using MMC rootfs. > > > Matt Porter (10): > ARM: davinci: move private EDMA API to arm/common > ARM: edma: remove unused transfer controller handlers > ARM: edma: add AM33XX support to the private EDMA API > dmaengine: edma: enable build for AM33XX > dmaengine: edma: Add TI EDMA device tree binding > ARM: dts: add AM33XX EDMA support > dmaengine: add dma_request_slave_channel_compat() > spi: omap2-mcspi: convert to dma_request_slave_channel_compat() > spi: omap2-mcspi: add generic DMA request support to the DT binding > ARM: dts: add AM33XX SPI DMA support > > Documentation/devicetree/bindings/dma/ti-edma.txt | 49 +++ > Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +- > arch/arm/Kconfig |1 + > arch/arm/boot/dts/am33xx.dtsi | 30 ++ > arch/arm/common/Kconfig|3 + > arch/arm/common/Makefile |1 + > arch/arm/{mach-davinci/dma.c => common/edma.c} | 342 > +--- > arch/arm/mach-davinci/Makefile |2 +- > arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- > arch/arm/mach-davinci/davinci.h|2 +- > arch/arm/mach-davinci/devices-tnetv107x.c |2 +- > arch/arm/mach-davinci/devices.c|6 +- > arch/arm/mach-davinci/dm355.c |2 +- > arch/arm/mach-davinci/dm365.c |2 +- > arch/arm/mach-davinci/dm644x.c |2 +- > arch/arm/mach-davinci/dm646x.c |2 +- > arch/arm/mach-davinci/include/mach/da8xx.h |2 +- > arch/arm/plat-omap/Kconfig |1 + > drivers/dma/Kconfig|2 +- > drivers/dma/edma.c |2 +- > drivers/mmc/host/davinci_mmc.c |1 + > drivers/spi/spi-omap2-mcspi.c | 65 ++-- > include/linux/dmaengine.h | 16 + > include/linux/mfd/davinci_voicecodec.h |3 +- > .../mach => include/linux/platform_data}/edma.h| 90 +- > include/linux/platform_data/spi-davinci.h |2 +- > sound/soc/davinci/davinci-evm.c|1 + > sound/soc/davinci/davinci-pcm.c|1 + > sound/soc/davinci/davinci-pcm.h|
Re: [PATCH v7 07/10] dmaengine: add dma_request_slave_channel_compat()
On Fri, Feb 01, 2013 at 01:22:52PM -0500, Matt Porter wrote: > Adds a dma_request_slave_channel_compat() wrapper which accepts > both the arguments from dma_request_channel() and > dma_request_slave_channel(). Based on whether the driver is > instantiated via DT, the appropriate channel request call will be > made. > > This allows for a much cleaner migration of drivers to the > dmaengine DT API as platforms continue to be mixed between those > that boot using DT and those that do not. > > Suggested-by: Tony Lindgren > Signed-off-by: Matt Porter > Acked-by: Tony Lindgren > Acked-by: Arnd Bergmann Vinod, can I get an ack on this one? -Matt > --- > include/linux/dmaengine.h | 16 > 1 file changed, 16 insertions(+) > > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index bfcdecb..17d8ffd 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -1001,6 +1001,22 @@ void dma_run_dependencies(struct > dma_async_tx_descriptor *tx); > struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); > struct dma_chan *net_dma_find_channel(void); > #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) > +#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ > + __dma_request_slave_channel_compat(&(mask), x, y, dev, name) > + > +static inline struct dma_chan > +*__dma_request_slave_channel_compat(dma_cap_mask_t *mask, dma_filter_fn fn, > + void *fn_param, struct device *dev, > + char *name) > +{ > + struct dma_chan *chan; > + > + chan = dma_request_slave_channel(dev, name); > + if (chan) > + return chan; > + > + return __dma_request_channel(mask, fn, fn_param); > +} > > /* --- Helper iov-locking functions --- */ > > -- > 1.7.9.5 > -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v7 05/10] dmaengine: edma: Add TI EDMA device tree binding
On Fri, Feb 01, 2013 at 01:22:50PM -0500, Matt Porter wrote: > The binding definition is based on the generic DMA controller > binding. > > Signed-off-by: Matt Porter Grant or Rob, can I get an ack on this binding and others in this series? > --- > Documentation/devicetree/bindings/dma/ti-edma.txt | 49 > + > 1 file changed, 49 insertions(+) > create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt > > diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt > b/Documentation/devicetree/bindings/dma/ti-edma.txt > new file mode 100644 > index 000..075a60e3 > --- /dev/null > +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt > @@ -0,0 +1,49 @@ > +TI EDMA > + > +Required properties: > +- compatible : "ti,edma3" > +- ti,hwmods: Name of the hwmods associated to the EDMA > +- ti,edma-regions: Number of regions > +- ti,edma-slots: Number of slots > +- ti,edma-queue-tc-map: List of transfer control to queue mappings > +- ti,edma-queue-priority-map: List of queue priority mappings > +- ti,edma-default-queue: Default queue value > + > +Optional properties: > +- ti,edma-reserved-channels: List of reserved channel regions > +- ti,edma-reserved-slots: List of reserved slot regions > +- ti,edma-xbar-event-map: Crossbar event to channel map > + > +Example: > + > +edma: edma@4900 { > + reg = <0x4900 0x1>; > + interrupt-parent = <&intc>; > + interrupts = <12 13 14>; > + compatible = "ti,edma3"; > + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; > + #dma-cells = <1>; > + dma-channels = <64>; > + ti,edma-regions = <4>; > + ti,edma-slots = <256>; > + ti,edma-reserved-channels = <0 2 > + 14 2 > + 26 6 > + 48 4 > + 56 8>; > + ti,edma-reserved-slots = <0 2 > + 14 2 > + 26 6 > + 48 4 > + 56 8 > + 64 127>; > + ti,edma-queue-tc-map = <0 0 > + 1 1 > + 2 2>; > + ti,edma-queue-priority-map = <0 0 > + 1 1 > + 2 2>; > + ti,edma-default-queue = <0>; > + ti,edma-xbar-event-map = <1 12 > + 2 13>; > +}; > -- > 1.7.9.5 > -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v7 07/10] dmaengine: add dma_request_slave_channel_compat()
Adds a dma_request_slave_channel_compat() wrapper which accepts both the arguments from dma_request_channel() and dma_request_slave_channel(). Based on whether the driver is instantiated via DT, the appropriate channel request call will be made. This allows for a much cleaner migration of drivers to the dmaengine DT API as platforms continue to be mixed between those that boot using DT and those that do not. Suggested-by: Tony Lindgren Signed-off-by: Matt Porter Acked-by: Tony Lindgren Acked-by: Arnd Bergmann --- include/linux/dmaengine.h | 16 1 file changed, 16 insertions(+) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index bfcdecb..17d8ffd 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1001,6 +1001,22 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx); struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); struct dma_chan *net_dma_find_channel(void); #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) +#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ + __dma_request_slave_channel_compat(&(mask), x, y, dev, name) + +static inline struct dma_chan +*__dma_request_slave_channel_compat(dma_cap_mask_t *mask, dma_filter_fn fn, + void *fn_param, struct device *dev, + char *name) +{ + struct dma_chan *chan; + + chan = dma_request_slave_channel(dev, name); + if (chan) + return chan; + + return __dma_request_channel(mask, fn, fn_param); +} /* --- Helper iov-locking functions --- */ -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v7 10/10] ARM: dts: add AM33XX SPI DMA support
Adds DMA resources to the AM33XX SPI nodes. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index e711ffb..ddf702a 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -328,6 +328,11 @@ interrupt = <65>; ti,spi-num-cs = <2>; ti,hwmods = "spi0"; + dmas = <&edma 16 + &edma 17 + &edma 18 + &edma 19>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; @@ -339,6 +344,11 @@ interrupt = <125>; ti,spi-num-cs = <2>; ti,hwmods = "spi1"; + dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v7 00/10] DMA Engine support for AM33XX
Changes since v6: - Converted edma_of_read_*() to wrappers around of_property_read_*() - Fixed wording on the omap-spi generic DMA properties - Added comment/check to clarify that the driver only supports a single EDMA instance when booting from DT Changes since v5: - Dropped mmc portion and moved it to a separate series - Incorporate corrected version of dma_request_slave_channel_compat() - Fix #defines and enablement of TI_PRIV_EDMA option Changes since v4: - Fixed debug section mismatch in private edma api [01/14] - Respun format-patch to catch the platform_data/edma.h rename [01/14] - Removed address/size-cells from the EDMA binding [05/14] Changes since v3: - Rebased on 3.8-rc3 - No longer an RFC - Fixed bugs in DT/pdata parsing reported by Vaibhav Bedia - Restored all the Davinci pdata to const - Removed max_segs hack in favor of using dma_get_channel_caps() - Fixed extra parens, __raw_* accessors and, ioremap error checks in xbar handling - Removed excess license info in platform_data/edma.h - Removed unneeded reserved channels data for AM33xx - Removed test-specific pinmuxing from dts files - Adjusted mmc1 node to be disabled by default in the dtsi Changes since v2: - Rebased on 3.7-rc1 - Fixed bug in DT/pdata parsing first found by Gururaja that turned out to be masked by some toolchains - Dropped unused mach-omap2/devices.c hsmmc patch - Added AM33XX crossbar DMA event mux support - Added am335x-evm support Changes since v1: - Rebased on top of mainline from 12250d8 - Dropped the feature removal schedule patch - Implemented dma_request_slave_channel_compat() and converted the mmc and spi drivers to use it - Dropped unneeded #address-cells and #size-cells from EDMA DT support - Moved private EDMA header to linux/platform_data/ and removed some unneeded definitions - Fixed parsing of optional properties This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs. The series applies on top of 3.8-rc5 and the following patches: - dmaengine DT support and edma dmaengine driver fix from the git://git.infradead.org/users/vkoul/slave-dma.git next branch The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers. With this series both BeagleBone and the AM335x EVM have working SPI DMA support (and MMC support with the separate MMC series). This is tested on BeagleBone with a SPI framebuffer driver and MMC rootfs. A trivial gpio DMA event misc driver was used to test the crossbar DMA event support. It is also tested on the AM335x EVM with the onboard SPI flash and MMC rootfs. The branch at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-v7 has the complete series, dependencies, and some test drivers/defconfigs. Note that MMC can only be tested with a separate MMC dmaengine/DT series applied. Regression testing was done on AM180x-EVM (which also makes use of the EDMA dmaengine driver and the EDMA private API) using SD, SPI flash, and the onboard audio supported by the ASoC Davinci driver. Regression testing was also done on a BeagleBoard xM booting from the legacy board file using MMC rootfs. Matt Porter (10): ARM: davinci: move private EDMA API to arm/common ARM: edma: remove unused transfer controller handlers ARM: edma: add AM33XX support to the private EDMA API dmaengine: edma: enable build for AM33XX dmaengine: edma: Add TI EDMA device tree binding ARM: dts: add AM33XX EDMA support dmaengine: add dma_request_slave_channel_compat() spi: omap2-mcspi: convert to dma_request_slave_channel_compat() spi: omap2-mcspi: add generic DMA request support to the DT binding ARM: dts: add AM33XX SPI DMA support Documentation/devicetree/bindings/dma/ti-edma.txt | 49 +++ Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +- arch/arm/Kconfig |1 + arch/arm/boot/dts/am33xx.dtsi | 30 ++ arch/arm/common/Kconfig|3 + arch/arm/common/Makefile |1 + arch/arm/{mach-da
[PATCH v7 05/10] dmaengine: edma: Add TI EDMA device tree binding
The binding definition is based on the generic DMA controller binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/dma/ti-edma.txt | 49 + 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt b/Documentation/devicetree/bindings/dma/ti-edma.txt new file mode 100644 index 000..075a60e3 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt @@ -0,0 +1,49 @@ +TI EDMA + +Required properties: +- compatible : "ti,edma3" +- ti,hwmods: Name of the hwmods associated to the EDMA +- ti,edma-regions: Number of regions +- ti,edma-slots: Number of slots +- ti,edma-queue-tc-map: List of transfer control to queue mappings +- ti,edma-queue-priority-map: List of queue priority mappings +- ti,edma-default-queue: Default queue value + +Optional properties: +- ti,edma-reserved-channels: List of reserved channel regions +- ti,edma-reserved-slots: List of reserved slot regions +- ti,edma-xbar-event-map: Crossbar event to channel map + +Example: + +edma: edma@4900 { + reg = <0x4900 0x1>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-reserved-channels = <0 2 +14 2 +26 6 +48 4 +56 8>; + ti,edma-reserved-slots = <0 2 + 14 2 + 26 6 + 48 4 + 56 8 + 64 127>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + ti,edma-xbar-event-map = <1 12 + 2 13>; +}; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common
Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx) as well. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/Kconfig |1 + arch/arm/common/Kconfig|3 + arch/arm/common/Makefile |1 + arch/arm/{mach-davinci/dma.c => common/edma.c} | 209 +++- arch/arm/mach-davinci/Makefile |2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- arch/arm/mach-davinci/davinci.h|2 +- arch/arm/mach-davinci/devices-tnetv107x.c |2 +- arch/arm/mach-davinci/devices.c|6 +- arch/arm/mach-davinci/dm355.c |2 +- arch/arm/mach-davinci/dm365.c |2 +- arch/arm/mach-davinci/dm644x.c |2 +- arch/arm/mach-davinci/dm646x.c |2 +- arch/arm/mach-davinci/include/mach/da8xx.h |2 +- drivers/dma/edma.c |2 +- drivers/mmc/host/davinci_mmc.c |1 + include/linux/mfd/davinci_voicecodec.h |3 +- .../mach => include/linux/platform_data}/edma.h| 89 + include/linux/platform_data/spi-davinci.h |2 +- sound/soc/davinci/davinci-evm.c|1 + sound/soc/davinci/davinci-pcm.c|1 + sound/soc/davinci/davinci-pcm.h|2 +- sound/soc/davinci/davinci-sffsdr.c |7 +- 23 files changed, 240 insertions(+), 106 deletions(-) rename arch/arm/{mach-davinci/dma.c => common/edma.c} (90%) rename {arch/arm/mach-davinci/include/mach => include/linux/platform_data}/edma.h (59%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 67874b8..7637d31 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -932,6 +932,7 @@ config ARCH_DAVINCI select GENERIC_IRQ_CHIP select HAVE_IDE select NEED_MACH_GPIO_H + select TI_PRIV_EDMA select USE_OF select ZONE_DMA help diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 45ceeb0..9e32d0d 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -40,3 +40,6 @@ config SHARP_PARAM config SHARP_SCOOP bool + +config TI_PRIV_EDMA + bool diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index e8a4e58..d09a39b 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o +obj-$(CONFIG_TI_PRIV_EDMA) += edma.o diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c similarity index 90% rename from arch/arm/mach-davinci/dma.c rename to arch/arm/common/edma.c index a685e97..aa4a49a 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/common/edma.c @@ -25,7 +25,7 @@ #include #include -#include +#include /* Offsets matching "struct edmacc_param" */ #define PARM_OPT 0x00 @@ -1386,8 +1386,213 @@ void edma_clear_event(unsigned channel) EXPORT_SYMBOL(edma_clear_event); /*---*/ +static int edma_of_read_u32_to_s8_array(const struct device_node *np, +const char *propname, s8 *out_values, +size_t sz) +{ + int ret; + + ret = of_property_read_u8_array(np, propname, out_values, sz); + if (ret) + return ret; + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_of_read_u32_to_s16_array(const struct device_node *np, +const char *propname, s16 *out_values, +size_t sz) +{ + int ret; + + ret = of_property_read_u16_array(np, propname, out_values, sz); + if (ret) + return ret; + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_xbar_event_map(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata, int len) +{ + int ret = 0; + int i; + struct resource res; + void *xbar; + const s16 (*xbar_chans)[2]; + u32 shift, offset, mux; + + xbar_chans = devm_kzalloc(dev, + len/sizeof(s16) + 2*sizeof(s16), + GFP_KERNEL); + if (!xbar_chans) + return -ENOMEM; + + ret = of_address_to_resource(node, 1, &res); + if (IS_ERR_VALUE(ret)) + return -EIO; + + xbar = d
[PATCH v7 09/10] spi: omap2-mcspi: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/omap-spi.txt b/Documentation/devicetree/bindings/spi/omap-spi.txt index 938809c..4c85c4c 100644 --- a/Documentation/devicetree/bindings/spi/omap-spi.txt +++ b/Documentation/devicetree/bindings/spi/omap-spi.txt @@ -10,7 +10,18 @@ Required properties: input. The default is D0 as input and D1 as output. -Example: +Optional properties: +- dmas: List of DMA specifiers with the controller specific format + as described in the generic DMA client binding. A tx and rx + specifier is required for each chip select. +- dma-names: List of DMA request names. These strings correspond + 1:1 with the DMA specifiers listed in dmas. The string naming + is to be "rxN" and "txN" for RX and TX requests, + respectively, where N equals the chip select number. + +Examples: + +[hwmod populated DMA resources] mcspi1: mcspi@1 { #address-cells = <1>; @@ -20,3 +31,17 @@ mcspi1: mcspi@1 { ti,spi-num-cs = <4>; }; +[generic DMA request binding] + +mcspi1: mcspi@1 { +#address-cells = <1>; +#size-cells = <0>; +compatible = "ti,omap4-mcspi"; +ti,hwmods = "mcspi1"; +ti,spi-num-cs = <2>; +dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; +dma-names = "tx0", "rx0", "tx1", "rx1"; +}; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v7 08/10] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter Acked-by: Mark Brown --- drivers/spi/spi-omap2-mcspi.c | 65 - 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b610f52..2c02c02 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -102,6 +102,9 @@ struct omap2_mcspi_dma { struct completion dma_tx_completion; struct completion dma_rx_completion; + + char dma_rx_ch_name[14]; + char dma_tx_ch_name[14]; }; /* use PIO for small transfers, avoiding DMA setup/teardown overhead and @@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); sig = mcspi_dma->dma_rx_sync_dev; - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + + mcspi_dma->dma_rx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_rx_ch_name); + if (!mcspi_dma->dma_rx) { dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n"); return -EAGAIN; } sig = mcspi_dma->dma_tx_sync_dev; - mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + mcspi_dma->dma_tx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_tx_ch_name); + if (!mcspi_dma->dma_tx) { dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n"); dma_release_channel(mcspi_dma->dma_rx); @@ -1223,29 +1235,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev) goto free_master; for (i = 0; i < master->num_chipselect; i++) { - char dma_ch_name[14]; + char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; + char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name; struct resource *dma_res; - sprintf(dma_ch_name, "rx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); - status = -ENODEV; - break; - } + sprintf(dma_rx_ch_name, "rx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_rx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA RX channel\n"); + status = -ENODEV; + break; + } - mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; - sprintf(dma_ch_name, "tx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); - status = -ENODEV; - break; + mcspi->dma_channels[i].dma_rx_sync_dev = + dma_res->start; } + sprintf(dma_tx_ch_name, "tx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_tx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA TX channel\n"); +
[PATCH v7 03/10] ARM: edma: add AM33XX support to the private EDMA API
Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data. Enables runtime PM support to initialize the EDMA hwmod. Adds AM33XX EDMA crossbar event mux support. Enables build on OMAP. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 96 arch/arm/plat-omap/Kconfig |1 + include/linux/platform_data/edma.h |1 + 3 files changed, 89 insertions(+), 9 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 3440d16..bd2416a 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -24,6 +24,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -723,6 +730,9 @@ EXPORT_SYMBOL(edma_free_channel); */ int edma_alloc_slot(unsigned ctlr, int slot) { + if (!edma_cc[ctlr]) + return -EINVAL; + if (slot >= 0) slot = EDMA_CHAN_SLOT(slot); @@ -1575,27 +1585,69 @@ static struct of_dma_filter_info edma_filter_info = { static int edma_probe(struct platform_device *pdev) { struct edma_soc_info**info = pdev->dev.platform_data; + struct edma_soc_info*ninfo[EDMA_MAX_CC] = {NULL, NULL}; + struct edma_soc_infotmpinfo; const s8(*queue_priority_mapping)[2]; const s8(*queue_tc_mapping)[2]; int i, j, off, ln, found = 0; int status = -1; const s16 (*rsv_chans)[2]; const s16 (*rsv_slots)[2]; + const s16 (*xbar_chans)[2]; int irq[EDMA_MAX_CC] = {0, 0}; int err_irq[EDMA_MAX_CC] = {0, 0}; - struct resource *r[EDMA_MAX_CC] = {NULL}; + struct resource *r[EDMA_MAX_CC] = {NULL, NULL}; + struct resource res[EDMA_MAX_CC]; resource_size_t len[EDMA_MAX_CC]; charres_name[10]; charirq_name[10]; + struct device_node *node = pdev->dev.of_node; + struct device *dev = &pdev->dev; + int ret; + + if (node) { + /* Check if this is a second instance registered */ + if (arch_num_cc) { + dev_err(dev, "only one EDMA instance is supported via DT\n"); + return -ENODEV; + } + info = ninfo; + edma_of_parse_dt(dev, node, &tmpinfo); + info[0] = &tmpinfo; + + dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap); + of_dma_controller_register(dev->of_node, + of_dma_simple_xlate, + &edma_filter_info); + } if (!info) return -ENODEV; + pm_runtime_enable(dev); + ret = pm_runtime_get_sync(dev); + if (IS_ERR_VALUE(ret)) { + dev_err(dev, "pm_runtime_get_sync() failed\n"); + return ret; + } + for (j = 0; j < EDMA_MAX_CC; j++) { - sprintf(res_name, "edma_cc%d", j); - r[j] = platform_get_resource_byname(pdev, IORESOURCE_MEM, + if (!info[j]) { + if (!found) + return -ENODEV; + break; + } + if (node) { + ret = of_address_to_resource(node, j, &res[j]); + if (!IS_ERR_VALUE(ret)) + r[j] = &res[j]; + } else { + sprintf(res_name, "edma_cc%d", j); + r[j] = platform_get_resource_byname(pdev, + IORESOURCE_MEM, res_name); - if (!r[j] || !info[j]) { + } + if (!r[j]) { if (found) break; else @@ -1670,8 +1722,22 @@ static int edma_probe(struct platform_device *pdev) } } - sprintf(irq_name, "edma%d", j); - irq[j] = platform_get_irq_byname(pdev, irq_name); + /* Clear the xbar mapped channels in unused list */ + xbar_chans = info[j]->xbar_chans; + if (xbar_chans) { + for (i = 0; xbar_chans[i][1] != -1; i++) { + off = xbar_chans[i][1]; + clear_bits(off, 1, + edma_cc[j]->edma_unused); + } + } + +
[PATCH v7 06/10] ARM: dts: add AM33XX EDMA support
Adds AM33XX EDMA support to the am33xx.dtsi as documented in Documentation/devicetree/bindings/dma/ti-edma.txt Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index c2f14e8..e711ffb 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -87,6 +87,26 @@ reg = <0x4820 0x1000>; }; + edma: edma@4900 { + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + reg = <0x4900 0x1>, + <0x44e10f90 0x10>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + }; + gpio1: gpio@44e07000 { compatible = "ti,omap4-gpio"; ti,hwmods = "gpio1"; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v7 02/10] ARM: edma: remove unused transfer controller handlers
Fix build on OMAP, the irqs are undefined on AM33xx. These error interrupt handlers were hardcoded as disabled so since they are unused code, simply remove them. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 37 - 1 file changed, 37 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index aa4a49a..3440d16 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -494,26 +494,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) return IRQ_HANDLED; } -/** - * - * Transfer controller error interrupt handlers - * - */ - -#define tc_errs_handledfalse /* disabled as long as they're NOPs */ - -static irqreturn_t dma_tc0err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc0err_handler\n"); - return IRQ_HANDLED; -} - -static irqreturn_t dma_tc1err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc1err_handler\n"); - return IRQ_HANDLED; -} - static int reserve_contiguous_slots(int ctlr, unsigned int id, unsigned int num_slots, unsigned int start_slot) @@ -1743,23 +1723,6 @@ static int edma_probe(struct platform_device *pdev) arch_num_cc++; } - if (tc_errs_handled) { - status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0, - "edma_tc0", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n", - IRQ_TCERRINT0, status); - return status; - } - status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0, - "edma_tc1", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d --> %d\n", - IRQ_TCERRINT, status); - return status; - } - } - return 0; fail: -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v7 04/10] dmaengine: edma: enable build for AM33XX
Enable TI EDMA option on OMAP. Signed-off-by: Matt Porter --- drivers/dma/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 0b408bb..239020b 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -220,7 +220,7 @@ config SIRF_DMA config TI_EDMA tristate "TI EDMA support" - depends on ARCH_DAVINCI + depends on ARCH_DAVINCI || ARCH_OMAP select DMA_ENGINE select DMA_VIRTUAL_CHANNELS default n -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v6 03/10] ARM: edma: add AM33XX support to the private EDMA API
On Fri, Feb 01, 2013 at 08:01:41AM +0200, Luciano Coelho wrote: > On Thu, 2013-01-31 at 16:42 -0500, Matt Porter wrote: > > On Thu, Jan 31, 2013 at 08:58:39PM +, Arnd Bergmann wrote: > > > On Thursday 31 January 2013, Matt Porter wrote: > > > > On Wed, Jan 30, 2013 at 09:32:58AM +, Arnd Bergmann wrote: > > > > > On Wednesday 30 January 2013, Matt Porter wrote: > > > > > > + dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap); > > > > > > + of_dma_controller_register(dev->of_node, > > > > > > + of_dma_simple_xlate, > > > > > > + &edma_filter_info); > > > > > > + } > > > > > > > > > > How do you actually deal with the problem mentioned by Padma, that > > > > > the filter function does not know which edma instance it is looking > > > > > at? If you assume that there can only be a single edma instance in > > > > > the system, that is probably a limitation that should be documented > > > > > somewhere, and ideally the probe() function should check for that. > > > > > > > > I make an assumption of one edma instance in the system in the case of > > > > DT being populated. This is always true right now as the only SoC with > > > > two EDMA controllers in existence is Davinci DA850. Until recently, > > > > Davinci had no DT support. Given the steady work being done today on DT > > > > support for DA850, it'll probably be something needed in 3.10. > > > > > > > > I will add a comment and check in probe() to capture this assumption > > > > and then plan to update separately to support DA850 booting from DT. > > > > > > Ok, sounds good. Hopefully by then we will already have a nicer > > > way to write an xlate function that does not rely on a filter > > > function. > > > > Yes, it would be nice to avoid what Padma had to do. I should have > > mentioned also that the second EDMA on DA850 has no DMA events of > > immediate use on it anyway. All the in-kernel users use events on the > > first controller, except for the second MMC instance. That's only used > > for a wl12xx module on the EVM and that driver has no DT support so it > > doesn't matter yet in the DT case. Because of this, DA850 can actually > > add EDMA DT support immediately (on top of this series) and add DMA > > support to the DT support already posted for the Davinci SPI and MMC > > client drivers. > > I haven't followed this whole discussion in details, but please notice > that I'm aiming to get DT support for the WiLink modules (wlcore, > wl12xx...) for 3.10. ;) Great, looks like we'll all be synced then. ;) -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v6 03/10] ARM: edma: add AM33XX support to the private EDMA API
On Thu, Jan 31, 2013 at 08:58:39PM +, Arnd Bergmann wrote: > On Thursday 31 January 2013, Matt Porter wrote: > > On Wed, Jan 30, 2013 at 09:32:58AM +, Arnd Bergmann wrote: > > > On Wednesday 30 January 2013, Matt Porter wrote: > > > > + dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap); > > > > + of_dma_controller_register(dev->of_node, > > > > + of_dma_simple_xlate, > > > > + &edma_filter_info); > > > > + } > > > > > > How do you actually deal with the problem mentioned by Padma, that > > > the filter function does not know which edma instance it is looking > > > at? If you assume that there can only be a single edma instance in > > > the system, that is probably a limitation that should be documented > > > somewhere, and ideally the probe() function should check for that. > > > > I make an assumption of one edma instance in the system in the case of > > DT being populated. This is always true right now as the only SoC with > > two EDMA controllers in existence is Davinci DA850. Until recently, > > Davinci had no DT support. Given the steady work being done today on DT > > support for DA850, it'll probably be something needed in 3.10. > > > > I will add a comment and check in probe() to capture this assumption > > and then plan to update separately to support DA850 booting from DT. > > Ok, sounds good. Hopefully by then we will already have a nicer > way to write an xlate function that does not rely on a filter > function. Yes, it would be nice to avoid what Padma had to do. I should have mentioned also that the second EDMA on DA850 has no DMA events of immediate use on it anyway. All the in-kernel users use events on the first controller, except for the second MMC instance. That's only used for a wl12xx module on the EVM and that driver has no DT support so it doesn't matter yet in the DT case. Because of this, DA850 can actually add EDMA DT support immediately (on top of this series) and add DMA support to the DT support already posted for the Davinci SPI and MMC client drivers. -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v6 03/10] ARM: edma: add AM33XX support to the private EDMA API
On Wed, Jan 30, 2013 at 09:32:58AM +, Arnd Bergmann wrote: > On Wednesday 30 January 2013, Matt Porter wrote: > > + dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap); > > + of_dma_controller_register(dev->of_node, > > + of_dma_simple_xlate, > > + &edma_filter_info); > > + } > > How do you actually deal with the problem mentioned by Padma, that > the filter function does not know which edma instance it is looking > at? If you assume that there can only be a single edma instance in > the system, that is probably a limitation that should be documented > somewhere, and ideally the probe() function should check for that. I make an assumption of one edma instance in the system in the case of DT being populated. This is always true right now as the only SoC with two EDMA controllers in existence is Davinci DA850. Until recently, Davinci had no DT support. Given the steady work being done today on DT support for DA850, it'll probably be something needed in 3.10. I will add a comment and check in probe() to capture this assumption and then plan to update separately to support DA850 booting from DT. -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v6 07/10] dmaengine: add dma_request_slave_channel_compat()
On Wed, Jan 30, 2013 at 09:27:18AM +, Arnd Bergmann wrote: > On Wednesday 30 January 2013, Matt Porter wrote: > > Adds a dma_request_slave_channel_compat() wrapper which accepts > > both the arguments from dma_request_channel() and > > dma_request_slave_channel(). Based on whether the driver is > > instantiated via DT, the appropriate channel request call will be > > made. > > > > This allows for a much cleaner migration of drivers to the > > dmaengine DT API as platforms continue to be mixed between those > > that boot using DT and those that do not. > > > > Suggested-by: Tony Lindgren > > Signed-off-by: Matt Porter > > Acked-by: Tony Lindgren > > Acked-by: Arnd Bergmann > > > @@ -1001,6 +1001,22 @@ void dma_run_dependencies(struct > > dma_async_tx_descriptor *tx); > > struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); > > struct dma_chan *net_dma_find_channel(void); > > #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, > > y) > > +#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ > > + __dma_request_slave_channel_compat(&(mask), x, y, dev, name) > > + > > +static inline struct dma_chan > > +*__dma_request_slave_channel_compat(dma_cap_mask_t *mask, dma_filter_fn fn, > > + void *fn_param, struct device *dev, > > + char *name) > > +{ > > + struct dma_chan *chan; > > + > > + chan = dma_request_slave_channel(dev, name); > > + if (chan) > > + return chan; > > + > > + return __dma_request_channel(mask, fn, fn_param); > > +} > > After I have spent some more time with implementing the code for dw_dma, > I think the mask is actually unnecessary here, the helper could just > always set it to DMA_SLAVE before calling __dma_request_channel. > > It's not a bug to do it this way though, and it may help convert drivers > a little easier if there is less to change. Agreed. -Matt > > Arnd -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v6 09/10] spi: omap2-mcspi: add generic DMA request support to the DT binding
On Wed, Jan 30, 2013 at 09:24:00AM +, Arnd Bergmann wrote: > On Wednesday 30 January 2013, Matt Porter wrote: > > +Optional properties: > > +- dmas: List of DMA controller phandle and DMA request ordered > > + pairs. One tx and one rx pair is required for each chip > > + select. > > The binding looks ok, but the wording is slightly incorrect here: > strictly speaking, it's not a pair of controller phandle and request > line number, but a DMA descriptor as specified in bindings/dma/dma.txt > with a format specific to the dma engine being used. That can > require more than just a single integer request number. Correct. I will update accordingly. -Matt -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v5 03/14] ARM: edma: add AM33XX support to the private EDMA API
On Wed, Jan 30, 2013 at 09:40:52AM +0200, Andy Shevchenko wrote: > On Wed, Jan 30, 2013 at 8:41 AM, Matt Porter wrote: > > On Mon, Jan 28, 2013 at 09:27:24PM +0200, Andy Shevchenko wrote: > >> On Tue, Jan 15, 2013 at 10:32 PM, Matt Porter wrote: > >> > Adds support for parsing the TI EDMA DT data into the required > >> > EDMA private API platform data. Enables runtime PM support to > >> > initialize the EDMA hwmod. Adds AM33XX EMDA crossbar event mux > >> > support. > >> > > >> > Signed-off-by: Matt Porter > >> > --- > >> > arch/arm/common/edma.c | 314 > >> > ++-- > >> > include/linux/platform_data/edma.h |1 + > >> > 2 files changed, 306 insertions(+), 9 deletions(-) > >> > > >> > diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c > >> > index 2dce245..beeb1d2 100644 > >> > --- a/arch/arm/common/edma.c > >> > +++ b/arch/arm/common/edma.c > >> > @@ -24,6 +24,13 @@ > >> > #include > >> > #include > >> > #include > >> > +#include > >> > +#include > >> > +#include > >> > +#include > >> > +#include > >> > +#include > >> > +#include > >> > > >> > #include > >> > > >> > @@ -723,6 +730,9 @@ EXPORT_SYMBOL(edma_free_channel); > >> > */ > >> > int edma_alloc_slot(unsigned ctlr, int slot) > >> > { > >> > + if (!edma_cc[ctlr]) > >> > + return -EINVAL; > >> > + > >> > if (slot >= 0) > >> > slot = EDMA_CHAN_SLOT(slot); > >> > > >> > @@ -1366,31 +1376,291 @@ void edma_clear_event(unsigned channel) > >> > EXPORT_SYMBOL(edma_clear_event); > >> > > >> > > >> > /*---*/ > >> > +static int edma_of_read_u32_to_s8_array(const struct device_node *np, > >> > +const char *propname, s8 > >> > *out_values, > >> > +size_t sz) > >> > >> I'm sorry I didn't get why you couldn't use of_property_read_u8_array() ? > >> The similar comment to u16 and so on. > > > > There's some manipulation of the legacy Davinci platform data > > structures going on here. The driving reason was to not change any of > > the davinci platforms pdata which uses s8/s16 tables of mapping values > > with signed values as terminators. These versions below add the > > convert to the signed value and terminate the array as needed by the > > existing driver. This will all go away when the driver is rewritten and > > merged into drivers/dma/edma.c. At that point I want to throwaway all > > these legacy data structures. First, there's some more drivers to > > convert to dmaengine api. > > > > I mean instead of custom functions you could use existing ones. > And sign here will be implicitly applied. Yes, sorry, wasn't following you at first. The is definitely much better and does work fine. I will update this...thanks! -Matt > So, what I propose is to do something like this > > static int edma_of_read_u32_to_s8_array(const struct device_node *np, > const char *propname, s8 *out_values, > size_t sz) > { > > int ret; > ret = of_property_read_u8_array(np, propname, out_values, sz); > if (ret) > return ret; > >/* Terminate it */ >*out_values++ = -1; >*out_values++ = -1; > } > > > -Matt > >> > >> > +{ > >> > + struct property *prop = of_find_property(np, propname, NULL); > >> > + const __be32 *val; > >> > + > >> > + if (!prop) > >> > + return -EINVAL; > >> > + if (!prop->value) > >> > + return -ENODATA; > >> > + if ((sz * sizeof(u32)) > prop->length) > >> > + return -EOVERFLOW; > >> > + > >> > + val = prop->value; > >> > + > >> > + while (sz--) > >> > + *out_values++ = (s8)(be32_to_cpup(val++) & 0xff); > >> > + > >> > + /* Terminate it */ > >> > + *out_v
[PATCH v6 08/10] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter --- drivers/spi/spi-omap2-mcspi.c | 65 - 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b610f52..2c02c02 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -102,6 +102,9 @@ struct omap2_mcspi_dma { struct completion dma_tx_completion; struct completion dma_rx_completion; + + char dma_rx_ch_name[14]; + char dma_tx_ch_name[14]; }; /* use PIO for small transfers, avoiding DMA setup/teardown overhead and @@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); sig = mcspi_dma->dma_rx_sync_dev; - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + + mcspi_dma->dma_rx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_rx_ch_name); + if (!mcspi_dma->dma_rx) { dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n"); return -EAGAIN; } sig = mcspi_dma->dma_tx_sync_dev; - mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + mcspi_dma->dma_tx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_tx_ch_name); + if (!mcspi_dma->dma_tx) { dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n"); dma_release_channel(mcspi_dma->dma_rx); @@ -1223,29 +1235,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev) goto free_master; for (i = 0; i < master->num_chipselect; i++) { - char dma_ch_name[14]; + char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; + char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name; struct resource *dma_res; - sprintf(dma_ch_name, "rx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); - status = -ENODEV; - break; - } + sprintf(dma_rx_ch_name, "rx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_rx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA RX channel\n"); + status = -ENODEV; + break; + } - mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; - sprintf(dma_ch_name, "tx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); - status = -ENODEV; - break; + mcspi->dma_channels[i].dma_rx_sync_dev = + dma_res->start; } + sprintf(dma_tx_ch_name, "tx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_tx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA TX channel\n"); + status = -ENODEV; +
[PATCH v6 09/10] spi: omap2-mcspi: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/omap-spi.txt b/Documentation/devicetree/bindings/spi/omap-spi.txt index 938809c..68cb28e 100644 --- a/Documentation/devicetree/bindings/spi/omap-spi.txt +++ b/Documentation/devicetree/bindings/spi/omap-spi.txt @@ -10,7 +10,18 @@ Required properties: input. The default is D0 as input and D1 as output. -Example: +Optional properties: +- dmas: List of DMA controller phandle and DMA request ordered + pairs. One tx and one rx pair is required for each chip + select. +- dma-names: List of DMA request names. These strings correspond + 1:1 with the ordered pairs in dmas. The string naming is + to be "rxN" and "txN" for RX and TX requests, + respectively, where N equals the chip select number. + +Examples: + +[hwmod populated DMA resources] mcspi1: mcspi@1 { #address-cells = <1>; @@ -20,3 +31,17 @@ mcspi1: mcspi@1 { ti,spi-num-cs = <4>; }; +[generic DMA request binding] + +mcspi1: mcspi@1 { +#address-cells = <1>; +#size-cells = <0>; +compatible = "ti,omap4-mcspi"; +ti,hwmods = "mcspi1"; +ti,spi-num-cs = <2>; +dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; +dma-names = "tx0", "rx0", "tx1", "rx1"; +}; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v6 07/10] dmaengine: add dma_request_slave_channel_compat()
Adds a dma_request_slave_channel_compat() wrapper which accepts both the arguments from dma_request_channel() and dma_request_slave_channel(). Based on whether the driver is instantiated via DT, the appropriate channel request call will be made. This allows for a much cleaner migration of drivers to the dmaengine DT API as platforms continue to be mixed between those that boot using DT and those that do not. Suggested-by: Tony Lindgren Signed-off-by: Matt Porter Acked-by: Tony Lindgren --- include/linux/dmaengine.h | 16 1 file changed, 16 insertions(+) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index bfcdecb..17d8ffd 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1001,6 +1001,22 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx); struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); struct dma_chan *net_dma_find_channel(void); #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) +#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ + __dma_request_slave_channel_compat(&(mask), x, y, dev, name) + +static inline struct dma_chan +*__dma_request_slave_channel_compat(dma_cap_mask_t *mask, dma_filter_fn fn, + void *fn_param, struct device *dev, + char *name) +{ + struct dma_chan *chan; + + chan = dma_request_slave_channel(dev, name); + if (chan) + return chan; + + return __dma_request_channel(mask, fn, fn_param); +} /* --- Helper iov-locking functions --- */ -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v6 10/10] ARM: dts: add AM33XX SPI DMA support
Adds DMA resources to the AM33XX SPI nodes. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index e711ffb..ddf702a 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -328,6 +328,11 @@ interrupt = <65>; ti,spi-num-cs = <2>; ti,hwmods = "spi0"; + dmas = <&edma 16 + &edma 17 + &edma 18 + &edma 19>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; @@ -339,6 +344,11 @@ interrupt = <125>; ti,spi-num-cs = <2>; ti,hwmods = "spi1"; + dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v6 00/10] DMA Engine support for AM33XX
Changes since v5: - Dropped mmc portion and moved it to a separate series - Incorporate corrected version of dma_request_slave_channel_compat() - Fix #defines and enablement of TI_PRIV_EDMA option Changes since v4: - Fixed debug section mismatch in private edma api [01/14] - Respun format-patch to catch the platform_data/edma.h rename [01/14] - Removed address/size-cells from the EDMA binding [05/14] Changes since v3: - Rebased on 3.8-rc3 - No longer an RFC - Fixed bugs in DT/pdata parsing reported by Vaibhav Bedia - Restored all the Davinci pdata to const - Removed max_segs hack in favor of using dma_get_channel_caps() - Fixed extra parens, __raw_* accessors and, ioremap error checks in xbar handling - Removed excess license info in platform_data/edma.h - Removed unneeded reserved channels data for AM33xx - Removed test-specific pinmuxing from dts files - Adjusted mmc1 node to be disabled by default in the dtsi Changes since v2: - Rebased on 3.7-rc1 - Fixed bug in DT/pdata parsing first found by Gururaja that turned out to be masked by some toolchains - Dropped unused mach-omap2/devices.c hsmmc patch - Added AM33XX crossbar DMA event mux support - Added am335x-evm support Changes since v1: - Rebased on top of mainline from 12250d8 - Dropped the feature removal schedule patch - Implemented dma_request_slave_channel_compat() and converted the mmc and spi drivers to use it - Dropped unneeded #address-cells and #size-cells from EDMA DT support - Moved private EDMA header to linux/platform_data/ and removed some unneeded definitions - Fixed parsing of optional properties This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs. The series applies on top of 3.8-rc5 and the following patches: - dmaengine DT support and edma dmaengine driver fix from the git://git.infradead.org/users/vkoul/slave-dma.git next branch The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers. With this series both BeagleBone and the AM335x EVM have working SPI DMA support (and MMC support with the separate MMC series). This is tested on BeagleBone with a SPI framebuffer driver and MMC rootfs. A trivial gpio DMA event misc driver was used to test the crossbar DMA event support. It is also tested on the AM335x EVM with the onboard SPI flash and MMC rootfs. The branch at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-v6 has the complete series, dependencies, and some test drivers/defconfigs. Note that MMC can only be tested with a separate MMC dmaengine/DT series applied. Regression testing was done on AM180x-EVM (which also makes use of the EDMA dmaengine driver and the EDMA private API) using SD, SPI flash, and the onboard audio supported by the ASoC Davinci driver. Regression testing was also done on a BeagleBoard xM booting from the legacy board file using MMC rootfs. Matt Porter (10): ARM: davinci: move private EDMA API to arm/common ARM: edma: remove unused transfer controller handlers ARM: edma: add AM33XX support to the private EDMA API dmaengine: edma: enable build for AM33XX dmaengine: edma: Add TI EDMA device tree binding ARM: dts: add AM33XX EDMA support dmaengine: add dma_request_slave_channel_compat() spi: omap2-mcspi: convert to dma_request_slave_channel_compat() spi: omap2-mcspi: add generic DMA request support to the DT binding ARM: dts: add AM33XX SPI DMA support Documentation/devicetree/bindings/dma/ti-edma.txt | 49 +++ Documentation/devicetree/bindings/spi/omap-spi.txt | 27 +- arch/arm/Kconfig |1 + arch/arm/boot/dts/am33xx.dtsi | 30 ++ arch/arm/common/Kconfig|3 + arch/arm/common/Makefile |1 + arch/arm/{mach-davinci/dma.c => common/edma.c} | 355 +--- arch/arm/mach-davinci/Makefile |2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- arch/arm/mach-davinci/davinci.h|2 +- arch/arm/mach-davinci/devices-tne
[PATCH v6 06/10] ARM: dts: add AM33XX EDMA support
Adds AM33XX EDMA support to the am33xx.dtsi as documented in Documentation/devicetree/bindings/dma/ti-edma.txt Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index c2f14e8..e711ffb 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -87,6 +87,26 @@ reg = <0x4820 0x1000>; }; + edma: edma@4900 { + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + reg = <0x4900 0x1>, + <0x44e10f90 0x10>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + }; + gpio1: gpio@44e07000 { compatible = "ti,omap4-gpio"; ti,hwmods = "gpio1"; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v6 05/10] dmaengine: edma: Add TI EDMA device tree binding
The binding definition is based on the generic DMA controller binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/dma/ti-edma.txt | 49 + 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt b/Documentation/devicetree/bindings/dma/ti-edma.txt new file mode 100644 index 000..075a60e3 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt @@ -0,0 +1,49 @@ +TI EDMA + +Required properties: +- compatible : "ti,edma3" +- ti,hwmods: Name of the hwmods associated to the EDMA +- ti,edma-regions: Number of regions +- ti,edma-slots: Number of slots +- ti,edma-queue-tc-map: List of transfer control to queue mappings +- ti,edma-queue-priority-map: List of queue priority mappings +- ti,edma-default-queue: Default queue value + +Optional properties: +- ti,edma-reserved-channels: List of reserved channel regions +- ti,edma-reserved-slots: List of reserved slot regions +- ti,edma-xbar-event-map: Crossbar event to channel map + +Example: + +edma: edma@4900 { + reg = <0x4900 0x1>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-reserved-channels = <0 2 +14 2 +26 6 +48 4 +56 8>; + ti,edma-reserved-slots = <0 2 + 14 2 + 26 6 + 48 4 + 56 8 + 64 127>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + ti,edma-xbar-event-map = <1 12 + 2 13>; +}; -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v6 02/10] ARM: edma: remove unused transfer controller handlers
Fix build on OMAP, the irqs are undefined on AM33xx. These error interrupt handlers were hardcoded as disabled so since they are unused code, simply remove them. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 37 - 1 file changed, 37 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index be3c04a..2dce245 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -494,26 +494,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) return IRQ_HANDLED; } -/** - * - * Transfer controller error interrupt handlers - * - */ - -#define tc_errs_handledfalse /* disabled as long as they're NOPs */ - -static irqreturn_t dma_tc0err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc0err_handler\n"); - return IRQ_HANDLED; -} - -static irqreturn_t dma_tc1err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc1err_handler\n"); - return IRQ_HANDLED; -} - static int reserve_contiguous_slots(int ctlr, unsigned int id, unsigned int num_slots, unsigned int start_slot) @@ -1538,23 +1518,6 @@ static int edma_probe(struct platform_device *pdev) arch_num_cc++; } - if (tc_errs_handled) { - status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0, - "edma_tc0", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n", - IRQ_TCERRINT0, status); - return status; - } - status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0, - "edma_tc1", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d --> %d\n", - IRQ_TCERRINT, status); - return status; - } - } - return 0; fail: -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v6 01/10] ARM: davinci: move private EDMA API to arm/common
Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx) as well. This just moves the private EDMA API and enables it to build on OMAP. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/Kconfig |1 + arch/arm/common/Kconfig|3 + arch/arm/common/Makefile |1 + arch/arm/{mach-davinci/dma.c => common/edma.c} |4 +- arch/arm/mach-davinci/Makefile |2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- arch/arm/mach-davinci/davinci.h|2 +- arch/arm/mach-davinci/devices-tnetv107x.c |2 +- arch/arm/mach-davinci/devices.c|6 +- arch/arm/mach-davinci/dm355.c |2 +- arch/arm/mach-davinci/dm365.c |2 +- arch/arm/mach-davinci/dm644x.c |2 +- arch/arm/mach-davinci/dm646x.c |2 +- arch/arm/mach-davinci/include/mach/da8xx.h |2 +- drivers/dma/edma.c |2 +- drivers/mmc/host/davinci_mmc.c |1 + include/linux/mfd/davinci_voicecodec.h |3 +- .../mach => include/linux/platform_data}/edma.h| 89 +--- include/linux/platform_data/spi-davinci.h |2 +- sound/soc/davinci/davinci-evm.c|1 + sound/soc/davinci/davinci-pcm.c|1 + sound/soc/davinci/davinci-pcm.h|2 +- sound/soc/davinci/davinci-sffsdr.c |7 +- 23 files changed, 35 insertions(+), 106 deletions(-) rename arch/arm/{mach-davinci/dma.c => common/edma.c} (99%) rename {arch/arm/mach-davinci/include/mach => include/linux/platform_data}/edma.h (59%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 67874b8..7637d31 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -932,6 +932,7 @@ config ARCH_DAVINCI select GENERIC_IRQ_CHIP select HAVE_IDE select NEED_MACH_GPIO_H + select TI_PRIV_EDMA select USE_OF select ZONE_DMA help diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 45ceeb0..9e32d0d 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -40,3 +40,6 @@ config SHARP_PARAM config SHARP_SCOOP bool + +config TI_PRIV_EDMA + bool diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index e8a4e58..d09a39b 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o +obj-$(CONFIG_TI_PRIV_EDMA) += edma.o diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c similarity index 99% rename from arch/arm/mach-davinci/dma.c rename to arch/arm/common/edma.c index a685e97..be3c04a 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/common/edma.c @@ -25,7 +25,7 @@ #include #include -#include +#include /* Offsets matching "struct edmacc_param" */ #define PARM_OPT 0x00 @@ -1387,7 +1387,7 @@ EXPORT_SYMBOL(edma_clear_event); /*---*/ -static int __init edma_probe(struct platform_device *pdev) +static int edma_probe(struct platform_device *pdev) { struct edma_soc_info**info = pdev->dev.platform_data; const s8(*queue_priority_mapping)[2]; diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index fb5c1aa..493a36b 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -5,7 +5,7 @@ # Common objects obj-y := time.o clock.o serial.o psc.o \ - dma.o usb.o common.o sram.o aemif.o + usb.o common.o sram.o aemif.o obj-$(CONFIG_DAVINCI_MUX) += mux.o diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c index be30997..86f55ba 100644 --- a/arch/arm/mach-davinci/board-tnetv107x-evm.c +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c @@ -26,12 +26,12 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h index 12d544b..d26a6bc 100644 --- a/arch/arm/mach-davinci/davinci.h +++ b/arch/arm/mach-davinci/davinci.h @@ -23,9 +23,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c index 773ab07..ba37760 100644 --- a/arch/arm/mach-davinci/devices-tnetv107x.c +++ b/arch
[PATCH v6 04/10] dmaengine: edma: enable build for AM33XX
Enable TI EDMA option on OMAP. Signed-off-by: Matt Porter --- drivers/dma/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 0b408bb..239020b 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -220,7 +220,7 @@ config SIRF_DMA config TI_EDMA tristate "TI EDMA support" - depends on ARCH_DAVINCI + depends on ARCH_DAVINCI || ARCH_OMAP select DMA_ENGINE select DMA_VIRTUAL_CHANNELS default n -- 1.7.9.5 -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v6 03/10] ARM: edma: add AM33XX support to the private EDMA API
Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data. Enables runtime PM support to initialize the EDMA hwmod. Adds AM33XX EMDA crossbar event mux support. Signed-off-by: Matt Porter Acked-by: Sekhar Nori --- arch/arm/common/edma.c | 314 ++-- arch/arm/plat-omap/Kconfig |1 + include/linux/platform_data/edma.h |1 + 3 files changed, 307 insertions(+), 9 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 2dce245..beeb1d2 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -24,6 +24,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -723,6 +730,9 @@ EXPORT_SYMBOL(edma_free_channel); */ int edma_alloc_slot(unsigned ctlr, int slot) { + if (!edma_cc[ctlr]) + return -EINVAL; + if (slot >= 0) slot = EDMA_CHAN_SLOT(slot); @@ -1366,31 +1376,291 @@ void edma_clear_event(unsigned channel) EXPORT_SYMBOL(edma_clear_event); /*---*/ +static int edma_of_read_u32_to_s8_array(const struct device_node *np, +const char *propname, s8 *out_values, +size_t sz) +{ + struct property *prop = of_find_property(np, propname, NULL); + const __be32 *val; + + if (!prop) + return -EINVAL; + if (!prop->value) + return -ENODATA; + if ((sz * sizeof(u32)) > prop->length) + return -EOVERFLOW; + + val = prop->value; + + while (sz--) + *out_values++ = (s8)(be32_to_cpup(val++) & 0xff); + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_of_read_u32_to_s16_array(const struct device_node *np, +const char *propname, s16 *out_values, +size_t sz) +{ + struct property *prop = of_find_property(np, propname, NULL); + const __be32 *val; + + if (!prop) + return -EINVAL; + if (!prop->value) + return -ENODATA; + if ((sz * sizeof(u32)) > prop->length) + return -EOVERFLOW; + + val = prop->value; + + while (sz--) + *out_values++ = (s16)(be32_to_cpup(val++) & 0x); + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_xbar_event_map(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata, int len) +{ + int ret = 0; + int i; + struct resource res; + void *xbar; + const s16 (*xbar_chans)[2]; + u32 shift, offset, mux; + + xbar_chans = devm_kzalloc(dev, + len/sizeof(s16) + 2*sizeof(s16), + GFP_KERNEL); + if (!xbar_chans) + return -ENOMEM; + + ret = of_address_to_resource(node, 1, &res); + if (IS_ERR_VALUE(ret)) + return -EIO; + + xbar = devm_ioremap(dev, res.start, resource_size(&res)); + if (!xbar) + return -ENOMEM; + + ret = edma_of_read_u32_to_s16_array(node, + "ti,edma-xbar-event-map", + (s16 *)xbar_chans, + len/sizeof(u32)); + if (IS_ERR_VALUE(ret)) + return -EIO; + + for (i = 0; xbar_chans[i][0] != -1; i++) { + shift = (xbar_chans[i][1] % 4) * 8; + offset = xbar_chans[i][1] >> 2; + offset <<= 2; + mux = readl((void *)((u32)xbar + offset)); + mux &= ~(0xff << shift); + mux |= xbar_chans[i][0] << shift; + writel(mux, (void *)((u32)xbar + offset)); + } + + pdata->xbar_chans = xbar_chans; + + return 0; +} + +static int edma_of_parse_dt(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata) +{ + int ret = 0; + u32 value; + struct property *prop; + size_t sz; + struct edma_rsv_info *rsv_info; + const s16 (*rsv_chans)[2], (*rsv_slots)[2]; + const s8 (*queue_tc_map)[2], (*queue_priority_map)[2]; + + memset(pdata, 0, sizeof(struct edma_soc_info)); + + ret = of_property_read_u32(node, "dma-channels", &value); + if (ret < 0) + return ret; + pdata->n_channel = value; + + ret = of_property_read_u32(node, "ti,edma-regio
Re: [PATCH v5 03/14] ARM: edma: add AM33XX support to the private EDMA API
On Mon, Jan 28, 2013 at 09:27:24PM +0200, Andy Shevchenko wrote: > On Tue, Jan 15, 2013 at 10:32 PM, Matt Porter wrote: > > Adds support for parsing the TI EDMA DT data into the required > > EDMA private API platform data. Enables runtime PM support to > > initialize the EDMA hwmod. Adds AM33XX EMDA crossbar event mux > > support. > > > > Signed-off-by: Matt Porter > > --- > > arch/arm/common/edma.c | 314 > > ++-- > > include/linux/platform_data/edma.h |1 + > > 2 files changed, 306 insertions(+), 9 deletions(-) > > > > diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c > > index 2dce245..beeb1d2 100644 > > --- a/arch/arm/common/edma.c > > +++ b/arch/arm/common/edma.c > > @@ -24,6 +24,13 @@ > > #include > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > > > #include > > > > @@ -723,6 +730,9 @@ EXPORT_SYMBOL(edma_free_channel); > > */ > > int edma_alloc_slot(unsigned ctlr, int slot) > > { > > + if (!edma_cc[ctlr]) > > + return -EINVAL; > > + > > if (slot >= 0) > > slot = EDMA_CHAN_SLOT(slot); > > > > @@ -1366,31 +1376,291 @@ void edma_clear_event(unsigned channel) > > EXPORT_SYMBOL(edma_clear_event); > > > > /*---*/ > > +static int edma_of_read_u32_to_s8_array(const struct device_node *np, > > +const char *propname, s8 > > *out_values, > > +size_t sz) > > I'm sorry I didn't get why you couldn't use of_property_read_u8_array() ? > The similar comment to u16 and so on. There's some manipulation of the legacy Davinci platform data structures going on here. The driving reason was to not change any of the davinci platforms pdata which uses s8/s16 tables of mapping values with signed values as terminators. These versions below add the convert to the signed value and terminate the array as needed by the existing driver. This will all go away when the driver is rewritten and merged into drivers/dma/edma.c. At that point I want to throwaway all these legacy data structures. First, there's some more drivers to convert to dmaengine api. -Matt > > > +{ > > + struct property *prop = of_find_property(np, propname, NULL); > > + const __be32 *val; > > + > > + if (!prop) > > + return -EINVAL; > > + if (!prop->value) > > + return -ENODATA; > > + if ((sz * sizeof(u32)) > prop->length) > > + return -EOVERFLOW; > > + > > + val = prop->value; > > + > > + while (sz--) > > + *out_values++ = (s8)(be32_to_cpup(val++) & 0xff); > > + > > + /* Terminate it */ > > + *out_values++ = -1; > > + *out_values++ = -1; > > + > > + return 0; > > +} > > + > > +static int edma_of_read_u32_to_s16_array(const struct device_node *np, > > +const char *propname, s16 > > *out_values, > > +size_t sz) > > +{ > > + struct property *prop = of_find_property(np, propname, NULL); > > + const __be32 *val; > > + > > + if (!prop) > > + return -EINVAL; > > + if (!prop->value) > > + return -ENODATA; > > + if ((sz * sizeof(u32)) > prop->length) > > + return -EOVERFLOW; > > + > > + val = prop->value; > > + > > + while (sz--) > > + *out_values++ = (s16)(be32_to_cpup(val++) & 0x); > > + > > + /* Terminate it */ > > + *out_values++ = -1; > > + *out_values++ = -1; > > + > > + return 0; > > +} > > + > > +static int edma_xbar_event_map(struct device *dev, > > + struct device_node *node, > > + struct edma_soc_info *pdata, int len) > > +{ > > + int ret = 0; > > + int i; > > + struct resource res; > > + void *xbar; > > + const s16 (*xbar_chans)[2]; > > + u32 shift, offset, mux; > > + > > + xbar_chans = devm_kzalloc(dev, > > + len/siz
Re: [PATCH v5 07/14] dmaengine: add dma_request_slave_channel_compat()
On Wed, Jan 23, 2013 at 10:28:46PM +, Arnd Bergmann wrote: > On Tuesday 15 January 2013, Matt Porter wrote: > > Adds a dma_request_slave_channel_compat() wrapper which accepts > > both the arguments from dma_request_channel() and > > dma_request_slave_channel(). Based on whether the driver is > > instantiated via DT, the appropriate channel request call will be > > made. > > > > This allows for a much cleaner migration of drivers to the > > dmaengine DT API as platforms continue to be mixed between those > > that boot using DT and those that do not. > > I noticed today some drivers in linux-next that rely on this patch, > but the patch itself still missing from -next. > > > --- a/include/linux/dmaengine.h > > +++ b/include/linux/dmaengine.h > > @@ -1047,6 +1047,16 @@ void dma_run_dependencies(struct > > dma_async_tx_descriptor *tx); > > struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); > > struct dma_chan *net_dma_find_channel(void); > > #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, > > y) > > +static inline struct dma_chan > > +*dma_request_slave_channel_compat(dma_cap_mask_t mask, dma_filter_fn fn, > > + void *fn_param, struct device *dev, > > + char *name) > > +{ > > + if (dev->of_node) > > + return dma_request_slave_channel(dev, name); > > + else > > + return dma_request_channel(mask, fn, fn_param); > > +} > > Hmm, dma_request_channel is actually a macro that passes mask by reference, > presumably because it can get modified by the filter function. Also, there > may be cases where we do have an of_node but don't use the dma binding > yet, or where dma_request_slave_channel doesn't actually use DT information > but rather one of the other methods that Vinod was talking about adding. > > I think what it should look like instead is the below. Yes, looks correct now, thanks. I've incorporated it into v6. -Matt > > Arnd > > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index bfcdecb..b6ffd7d 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -993,6 +993,19 @@ static inline void dma_release_channel(struct dma_chan > *chan) > } > #endif > > +static inline struct dma_chan > *__dma_request_slave_channel_compat(dma_cap_mask_t *mask, > + dma_filter_fn fn, void *fn_param, struct device > *dev, > + char *name) > +{ > + struct dma_chan *chan; > + > + chan = dma_request_slave_channel(dev, name); > + if (chan) > + return chan; > + > + return __dma_request_channel(mask, fn, fn_param); > +} > + > /* --- DMA device --- */ > > int dma_async_device_register(struct dma_device *device); > @@ -1001,6 +1014,8 @@ void dma_run_dependencies(struct > dma_async_tx_descriptor *tx); > struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); > struct dma_chan *net_dma_find_channel(void); > #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) > +#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ > + __dma_request_slave_channel_compat(&(mask), x, y, dev, name) > > /* --- Helper iov-locking functions --- */ > > ___ > Davinci-linux-open-source mailing list > davinci-linux-open-sou...@linux.davincidsp.com > http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source -- 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_jan ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH 3/3] spi: spi-omap2-mcspi.c: Toggle CS after each word
On Wed, Jan 23, 2013 at 07:08:49PM +0100, Matthias Brugger wrote: > This patch allows the board code to define SPI devices which needs to > toggle the chip select after every word send. This is needed to get a > better resolution reading e.g. an ADC data stream. > Apart from that, as in the normal code CS is controlled by software, > a transfer is done much faster. > > Signed-off-by: Matthias Brugger > --- > drivers/spi/spi-omap2-mcspi.c | 34 > --- > include/linux/platform_data/spi-omap2-mcspi.h | 3 +++ > 2 files changed, 29 insertions(+), 8 deletions(-) > > diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c > index b610f52..12789fc 100644 > --- a/drivers/spi/spi-omap2-mcspi.c > +++ b/drivers/spi/spi-omap2-mcspi.c > @@ -927,6 +927,7 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, > struct spi_message *m) > > struct spi_device *spi; > struct spi_transfer *t = NULL; > + struct spi_master *master; > int cs_active = 0; > struct omap2_mcspi_cs *cs; > struct omap2_mcspi_device_config *cd; > @@ -935,6 +936,7 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, > struct spi_message *m) > u32 chconf; > > spi = m->spi; > + master = spi->master; > cs = spi->controller_state; > cd = spi->controller_data; > > @@ -952,6 +954,14 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, > struct spi_message *m) > if (!t->speed_hz && !t->bits_per_word) > par_override = 0; > } > + if (cd && cd->cs_per_word) { > + chconf = mcspi->ctx.modulctrl; > + chconf &= ~OMAP2_MCSPI_MODULCTRL_SINGLE; > + mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, chconf); > + mcspi->ctx.modulctrl = > + mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL); > + } > + > > if (!cs_active) { > omap2_mcspi_force_cs(spi, 1); > @@ -1013,6 +1023,14 @@ static void omap2_mcspi_work(struct omap2_mcspi > *mcspi, struct spi_message *m) > if (cs_active) > omap2_mcspi_force_cs(spi, 0); > > + if (cd && cd->cs_per_word) { > + chconf = mcspi->ctx.modulctrl; > + chconf |= OMAP2_MCSPI_MODULCTRL_SINGLE; > + mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, chconf); > + mcspi->ctx.modulctrl = > + mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL); > + } > + > omap2_mcspi_set_enable(spi, 0); > > m->status = status; > @@ -1020,7 +1038,7 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, > struct spi_message *m) > } > > static int omap2_mcspi_transfer_one_message(struct spi_master *master, > - struct spi_message *m) > + struct spi_message *m) > { > struct omap2_mcspi *mcspi; > struct spi_transfer *t; > @@ -1041,7 +1059,7 @@ static int omap2_mcspi_transfer_one_message(struct > spi_master *master, > || (len && !(rx_buf || tx_buf)) > || (t->bits_per_word && > ( t->bits_per_word < 4 > - || t->bits_per_word > 32))) { > +|| t->bits_per_word > 32))) { > dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d > bpw\n", > t->speed_hz, > len, > @@ -1052,8 +1070,8 @@ static int omap2_mcspi_transfer_one_message(struct > spi_master *master, > } > if (t->speed_hz && t->speed_hz < (OMAP2_MCSPI_MAX_FREQ >> 15)) { > dev_dbg(mcspi->dev, "speed_hz %d below minimum %d Hz\n", > - t->speed_hz, > - OMAP2_MCSPI_MAX_FREQ >> 15); > + t->speed_hz, > + OMAP2_MCSPI_MAX_FREQ >> 15); > return -EINVAL; > } > > @@ -1099,7 +1117,7 @@ static int omap2_mcspi_master_setup(struct omap2_mcspi > *mcspi) > return ret; > > mcspi_write_reg(master, OMAP2_MCSPI_WAKEUPENABLE, > - OMAP2_MCSPI_WAKEUPENABLE_WKEN); > + OMAP2_MCSPI_WAKEUPENABLE_WKEN); > ctx->wakeupenable = OMAP2_MCSPI_WAKEUPENABLE_WKEN; > > omap2_mcspi_set_master_mode(master); > @@ -1228,7 +1246,7 @@ static int omap2_mcspi_probe(struct platform_device > *pdev) > > sprintf(dma_ch_name, "rx%d", i); > dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, > -
Re: [PATCH v5 00/14] DMA Engine support for AM33XX
On Thu, Jan 24, 2013 at 05:12:05AM +, Shilimkar, Santosh wrote: > On Thursday 24 January 2013 02:19 AM, Matt Porter wrote: > > On Wed, Jan 23, 2013 at 04:37:55PM +0530, Santosh Shilimkar wrote: > >> Matt, > >> > >> On Wednesday 16 January 2013 02:02 AM, Matt Porter wrote: > >> > >> [..] > >> > >>> This series adds DMA Engine support for AM33xx, which uses > >>> an EDMA DMAC. The EDMA DMAC has been previously supported by only > >>> a private API implementation (much like the situation with OMAP > >>> DMA) found on the DaVinci family of SoCs. > >>> > >>> The series applies on top of 3.8-rc3 and the following patches: > >>> > >>> - TPS65910 REGMAP_IRQ build fix: > >>> https://patchwork.kernel.org/patch/1857701/ > >>> - dmaengine DT support from Vinod's dmaengine_dt branch in > >>> git://git.infradead.org/users/vkoul/slave-dma.git since > >>> 027478851791df751176398be02a3b1c5f6aa824 > >>> - edma dmaengine driver fix: > >>> https://patchwork.kernel.org/patch/1961521/ > >>> - dmaengine dma_get_channel_caps v2: > >>> https://patchwork.kernel.org/patch/1961601/ > >>> - dmaengine edma driver channel caps support v2: > >>> https://patchwork.kernel.org/patch/1961591/ > >>> > >>> The approach taken is similar to how OMAP DMA is being converted to > >>> DMA Engine support. With the functional EDMA private API already > >>> existing in mach-davinci/dma.c, we first move that to an ARM common > >>> area so it can be shared. Adding DT and runtime PM support to the > >>> private EDMA API implementation allows it to run on AM33xx. AM33xx > >>> *only* boots using DT so we leverage Jon's generic DT DMA helpers to > >>> register EDMA DMAC with the of_dma framework and then add support > >>> for calling the dma_request_slave_channel() API to both the mmc > >>> and spi drivers. > >>> > >>> With this series both BeagleBone and the AM335x EVM have working > >>> MMC and SPI support. > >>> > >>> This is tested on BeagleBone with a SPI framebuffer driver and MMC > >>> rootfs. A trivial gpio DMA event misc driver was used to test the > >>> crossbar DMA event support. It is also tested on the AM335x EVM > >>> with the onboard SPI flash and MMC rootfs. The branch at > >>> https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-v4 > >>> has the complete series, dependencies, and some test > >>> drivers/defconfigs. > >>> > >>> Regression testing was done on AM180x-EVM (which also makes use > >>> of the EDMA dmaengine driver and the EDMA private API) using SD, > >>> SPI flash, and the onboard audio supported by the ASoC Davinci > >>> driver. Regression testing was also done on a BeagleBoard xM > >>> booting from the legacy board file using MMC rootfs. > >>> > >>> Matt Porter (14): > >>>ARM: davinci: move private EDMA API to arm/common > >>>ARM: edma: remove unused transfer controller handlers > >>>ARM: edma: add AM33XX support to the private EDMA API > >>>dmaengine: edma: enable build for AM33XX > >>>dmaengine: edma: Add TI EDMA device tree binding > >>>ARM: dts: add AM33XX EDMA support > >>>dmaengine: add dma_request_slave_channel_compat() > >>>mmc: omap_hsmmc: convert to dma_request_slave_channel_compat() > >>>mmc: omap_hsmmc: set max_segs based on dma engine limitations > >>>mmc: omap_hsmmc: add generic DMA request support to the DT binding > >>>ARM: dts: add AM33XX MMC support > >>>spi: omap2-mcspi: convert to dma_request_slave_channel_compat() > >>>spi: omap2-mcspi: add generic DMA request support to the DT binding > >>>ARM: dts: add AM33XX SPI DMA support > >>> > >> While going through the series and testing it out, I observed an issue > >> with MMC driver. You need patch in the end of the email to avoid the > >> issue. Same is attached in case mailer damages it. Can you please > >> add it with your series if you agree ? > > > > Yes, by inspection this makes sense. As you noticed, we've been relying > > on the fact that DMA resources still don't come from DT, we only use our > > DT data in conjunction with the DMA OF helpers to do channel filtering. > > I w
Re: [PATCH v5 00/14] DMA Engine support for AM33XX
On Thu, Jan 24, 2013 at 05:14:13AM +, Sekhar Nori wrote: > Matt, > > On 1/24/2013 3:07 AM, Matt Porter wrote: > > On Wed, Jan 23, 2013 at 10:21:42AM +0800, Mark Brown wrote: > >> On Tue, Jan 22, 2013 at 09:26:34PM +0530, Sekhar Nori wrote: > >>> On 1/16/2013 2:02 AM, Matt Porter wrote: > >> > >>>> This series adds DMA Engine support for AM33xx, which uses > >>>> an EDMA DMAC. The EDMA DMAC has been previously supported by only > >>>> a private API implementation (much like the situation with OMAP > >>>> DMA) found on the DaVinci family of SoCs. > >> > >>> Will you take this series through the OMAP tree? Only 1/14 touches > >>> mach-davinci and I am mostly okay with it except some changes I just > >>> requested Matt to make in another thread. > >> > >> Is this series somewhere near actually getting merged then? It seemed > >> like there was lots of stuff going on. > > > > The issues raised by Sekhar and Santosh were reasonably minor and will > > be addressed. My major concern is that the dependency on some api to > > fetch dmaengine driver SG limitations is not resolved. That's being > > discussed in https://lkml.org/lkml/2013/1/10/432 > > It might be worth posting the patches which don't have dependencies and > are ready for acceptance as a separate series. That way at least some of > these patches have a good chance of getting into v3.9 if not the entire > series. Yes a good idea and seems to be the best option. I've dropped the mmc support from the series for the next version. I'll repost the separately when we have an api to support it. -Matt -- 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. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v5 00/14] DMA Engine support for AM33XX
On Wed, Jan 23, 2013 at 10:21:42AM +0800, Mark Brown wrote: > On Tue, Jan 22, 2013 at 09:26:34PM +0530, Sekhar Nori wrote: > > On 1/16/2013 2:02 AM, Matt Porter wrote: > > > > This series adds DMA Engine support for AM33xx, which uses > > > an EDMA DMAC. The EDMA DMAC has been previously supported by only > > > a private API implementation (much like the situation with OMAP > > > DMA) found on the DaVinci family of SoCs. > > > Will you take this series through the OMAP tree? Only 1/14 touches > > mach-davinci and I am mostly okay with it except some changes I just > > requested Matt to make in another thread. > > Is this series somewhere near actually getting merged then? It seemed > like there was lots of stuff going on. The issues raised by Sekhar and Santosh were reasonably minor and will be addressed. My major concern is that the dependency on some api to fetch dmaengine driver SG limitations is not resolved. That's being discussed in https://lkml.org/lkml/2013/1/10/432 If I don't get confirmation from Vinod soon, I'll just take a stab at implementing the callbacks he mentioned in that thread. Static per-channel caps don't provide the information needed by a client driver the uses the EDMA DMAC. Alternatively, we can go back to the hack that looks at the edma phandle and hardcodes the mmc SG limits to magic values, but that's just plain ugly. I could live with it temporarily if we can't get the dmaengine api resolved until 3.10...dunno if others can though. ;) -Matt -- 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. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [RFC PATCH v3 02/16] ARM: davinci: move private EDMA API to arm/common
On Tue, Jan 22, 2013 at 03:40:06PM +, Sekhar Nori wrote: > Matt, > > Sorry about the late reply. I noticed this mail only after I started to > look at v5 of your series :( Any time is fine! :) > On 1/11/2013 5:21 AM, Matt Porter wrote: > > On Sun, Oct 28, 2012 at 01:47:09PM +0530, Sekhar Nori wrote: > >> On 10/18/2012 6:56 PM, Matt Porter wrote: > >>> Move mach-davinci/dma.c to common/edma.c so it can be used > >>> by OMAP (specifically AM33xx) as well. This just moves the > >>> private EDMA API but does not support OMAP. > >>> > >>> Signed-off-by: Matt Porter > >>> --- > >> > >>> diff --git a/arch/arm/mach-davinci/devices.c > >>> b/arch/arm/mach-davinci/devices.c > >>> index 4c48a36..f45d591 100644 > >>> --- a/arch/arm/mach-davinci/devices.c > >>> +++ b/arch/arm/mach-davinci/devices.c > >>> @@ -19,9 +19,10 @@ > >>> #include > >>> #include > >>> #include > >>> -#include > >>> #include > >>> #include > >>> +#include > >> > >> Can you please introduce a patch to clean this mixture of linux/ and > >> mach/ includes? > > > > Yeah, are you ok with a follow on series to clean all these files? I > > don't want to make this series longer with something not dma related > > that's purely cleanup from the great header reorg of 2012. > > Okay. I agree doing this sort of change now will cause merge issues. Ok. > > > > >>> + > >>> > >>> #include "davinci.h" > >>> #include "clock.h" > >>> @@ -141,10 +142,10 @@ static struct resource mmcsd0_resources[] = { > >>> }, > >>> /* DMA channels: RX, then TX */ > >>> { > >>> - .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT), > >>> + .start = EDMA_CTLR_CHAN(0, 26), > >> > >> Instead of just replacing the event #defines with plain numbers, can you > >> introduce a mach-davinci local edma.h which can then be included in the > >> davinci platform files which refer to edma channel numbers? > > > > Ok, so when I removed the old edma.h it was full of unused defines and > > we are left with just this one. If I introduced something like that it > > would be used in just one place here. and only for these two values. > > How about we just add a comment? > > I prefer adding a local #define in this file. This will keep it > consistent with what is done in arch/arm/mach-davinci/dm365.c for > example. Same for the change in sound/soc/davinci/davinci-sffsdr.c Ok, will do. > > > >> > >>> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig > >>> index 7cd56ed..153fab8 100644 > >>> --- a/arch/arm/plat-omap/Kconfig > >>> +++ b/arch/arm/plat-omap/Kconfig > >>> @@ -28,6 +28,7 @@ config ARCH_OMAP2PLUS > >>> select OMAP_DM_TIMER > >>> select PROC_DEVICETREE if PROC_FS > >>> select SPARSE_IRQ > >>> + select TI_PRIV_EDMA > >> > >> This hunk does not seem to belong to subject of this patch. > > > > Let me reword the subject/description. The idea of this logical > > chunk was to put everything in place to make it build on OMAP, > > with the expectation that the build fails without the next patch > > in the series. > > But this will break bisect. With just this patch applied, omap build > breaks. Looks like it will be more logical to merge this hunk with 3/14 > since that's when you really start using the private DMA support on OMAP > platforms. Ahh, yes,. thanks for pointing that out. I will address it and add your ack. Thanks. > This issue is a must fix IMO. Ok. > I am ok with the patch otherwise. With these changes done, you can add: > > Acked-by: Sekhar Nori > > Thanks, > Sekhar -- 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. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH v5 00/14] DMA Engine support for AM33XX
On Wed, Jan 23, 2013 at 04:37:55PM +0530, Santosh Shilimkar wrote: > Matt, > > On Wednesday 16 January 2013 02:02 AM, Matt Porter wrote: > > [..] > > >This series adds DMA Engine support for AM33xx, which uses > >an EDMA DMAC. The EDMA DMAC has been previously supported by only > >a private API implementation (much like the situation with OMAP > >DMA) found on the DaVinci family of SoCs. > > > >The series applies on top of 3.8-rc3 and the following patches: > > > > - TPS65910 REGMAP_IRQ build fix: > > https://patchwork.kernel.org/patch/1857701/ > > - dmaengine DT support from Vinod's dmaengine_dt branch in > > git://git.infradead.org/users/vkoul/slave-dma.git since > > 027478851791df751176398be02a3b1c5f6aa824 > > - edma dmaengine driver fix: > > https://patchwork.kernel.org/patch/1961521/ > > - dmaengine dma_get_channel_caps v2: > > https://patchwork.kernel.org/patch/1961601/ > > - dmaengine edma driver channel caps support v2: > > https://patchwork.kernel.org/patch/1961591/ > > > >The approach taken is similar to how OMAP DMA is being converted to > >DMA Engine support. With the functional EDMA private API already > >existing in mach-davinci/dma.c, we first move that to an ARM common > >area so it can be shared. Adding DT and runtime PM support to the > >private EDMA API implementation allows it to run on AM33xx. AM33xx > >*only* boots using DT so we leverage Jon's generic DT DMA helpers to > >register EDMA DMAC with the of_dma framework and then add support > >for calling the dma_request_slave_channel() API to both the mmc > >and spi drivers. > > > >With this series both BeagleBone and the AM335x EVM have working > >MMC and SPI support. > > > >This is tested on BeagleBone with a SPI framebuffer driver and MMC > >rootfs. A trivial gpio DMA event misc driver was used to test the > >crossbar DMA event support. It is also tested on the AM335x EVM > >with the onboard SPI flash and MMC rootfs. The branch at > >https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-v4 > >has the complete series, dependencies, and some test > >drivers/defconfigs. > > > >Regression testing was done on AM180x-EVM (which also makes use > >of the EDMA dmaengine driver and the EDMA private API) using SD, > >SPI flash, and the onboard audio supported by the ASoC Davinci > >driver. Regression testing was also done on a BeagleBoard xM > >booting from the legacy board file using MMC rootfs. > > > >Matt Porter (14): > > ARM: davinci: move private EDMA API to arm/common > > ARM: edma: remove unused transfer controller handlers > > ARM: edma: add AM33XX support to the private EDMA API > > dmaengine: edma: enable build for AM33XX > > dmaengine: edma: Add TI EDMA device tree binding > > ARM: dts: add AM33XX EDMA support > > dmaengine: add dma_request_slave_channel_compat() > > mmc: omap_hsmmc: convert to dma_request_slave_channel_compat() > > mmc: omap_hsmmc: set max_segs based on dma engine limitations > > mmc: omap_hsmmc: add generic DMA request support to the DT binding > > ARM: dts: add AM33XX MMC support > > spi: omap2-mcspi: convert to dma_request_slave_channel_compat() > > spi: omap2-mcspi: add generic DMA request support to the DT binding > > ARM: dts: add AM33XX SPI DMA support > > > While going through the series and testing it out, I observed an issue > with MMC driver. You need patch in the end of the email to avoid the > issue. Same is attached in case mailer damages it. Can you please > add it with your series if you agree ? Yes, by inspection this makes sense. As you noticed, we've been relying on the fact that DMA resources still don't come from DT, we only use our DT data in conjunction with the DMA OF helpers to do channel filtering. I was figuring we would address that separately later, but I see how even omap4 has this issue with DMA resources named with "tx1", for example. A good followup once this series is taken will be to only use hwmod resources on a !populated-dt platform like we do for other resources now. Baby steps. :) Thanks for the catch, I'll add this in with your tested line as well for the series. -Matt > > Overall the series looks good to my eyes. > Acked-tested-by: Santosh Shilimkar > > Regards, > Santosh > > From 2dcc90b7a4b2dcdb52ddd052ca7f3e88a78e83e4 Mon Sep 17 00:00:00 2001 > From: Santosh Shilimkar > Date: Wed, 23 Jan 2013 16:04:32 +0530 > Subject: [PATCH] mmc: omap_hsmmc: Skip platform_get_resource_byname() for dt > case > > M
[PATCH v5 13/14] spi: omap2-mcspi: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/spi/omap-spi.txt | 28 +++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/omap-spi.txt b/Documentation/devicetree/bindings/spi/omap-spi.txt index 938809c..3bd8eed 100644 --- a/Documentation/devicetree/bindings/spi/omap-spi.txt +++ b/Documentation/devicetree/bindings/spi/omap-spi.txt @@ -10,7 +10,18 @@ Required properties: input. The default is D0 as input and D1 as output. -Example: +Optional properties: +- dmas: List of DMA controller phandle and DMA request ordered + pairs. One tx and one rx pair is required for each chip + select. +- dma-names: List of DMA request names. These strings correspond + 1:1 with the ordered pairs in dmas. The string naming is + to be "rxN" and "txN" for RX and TX requests, + respectively, where N equals the chip select number. + +Examples: + +[hwmod populated DMA resources] mcspi1: mcspi@1 { #address-cells = <1>; @@ -20,3 +31,18 @@ mcspi1: mcspi@1 { ti,spi-num-cs = <4>; }; +[generic DMA request binding] + +mcspi1: mcspi@1 { +#address-cells = <1>; +#size-cells = <0>; +compatible = "ti,omap4-mcspi"; +ti,hwmods = "mcspi1"; +ti,spi-num-cs = <2>; +dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; +dma-names = "tx0", "rx0", "tx1", "rx1"; +}; + -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 14/14] ARM: dts: add AM33XX SPI DMA support
Adds DMA resources to the AM33XX SPI nodes. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 278b75d..8fd3648 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -356,6 +356,11 @@ interrupt = <65>; ti,spi-num-cs = <2>; ti,hwmods = "spi0"; + dmas = <&edma 16 + &edma 17 + &edma 18 + &edma 19>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; @@ -367,6 +372,11 @@ interrupt = <125>; ti,spi-num-cs = <2>; ti,hwmods = "spi1"; + dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 12/14] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter --- drivers/spi/spi-omap2-mcspi.c | 65 - 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b610f52..2c02c02 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -102,6 +102,9 @@ struct omap2_mcspi_dma { struct completion dma_tx_completion; struct completion dma_rx_completion; + + char dma_rx_ch_name[14]; + char dma_tx_ch_name[14]; }; /* use PIO for small transfers, avoiding DMA setup/teardown overhead and @@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); sig = mcspi_dma->dma_rx_sync_dev; - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + + mcspi_dma->dma_rx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_rx_ch_name); + if (!mcspi_dma->dma_rx) { dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n"); return -EAGAIN; } sig = mcspi_dma->dma_tx_sync_dev; - mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + mcspi_dma->dma_tx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_tx_ch_name); + if (!mcspi_dma->dma_tx) { dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n"); dma_release_channel(mcspi_dma->dma_rx); @@ -1223,29 +1235,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev) goto free_master; for (i = 0; i < master->num_chipselect; i++) { - char dma_ch_name[14]; + char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; + char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name; struct resource *dma_res; - sprintf(dma_ch_name, "rx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); - status = -ENODEV; - break; - } + sprintf(dma_rx_ch_name, "rx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_rx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA RX channel\n"); + status = -ENODEV; + break; + } - mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; - sprintf(dma_ch_name, "tx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); - status = -ENODEV; - break; + mcspi->dma_channels[i].dma_rx_sync_dev = + dma_res->start; } + sprintf(dma_tx_ch_name, "tx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_tx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA TX channel\n"); + status = -ENODEV; +
[PATCH v5 11/14] ARM: dts: add AM33XX MMC support
Adds AM33XX MMC support for am335x-bone, am335x-evm, and am335x-evmsk. Signed-off-by: Matt Porter Acked-by: Tony Lindgren --- arch/arm/boot/dts/am335x-bone.dts |7 +++ arch/arm/boot/dts/am335x-evm.dts |7 +++ arch/arm/boot/dts/am335x-evmsk.dts |7 +++ arch/arm/boot/dts/am33xx.dtsi | 28 4 files changed, 49 insertions(+) diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts index 11b240c..a154ce0 100644 --- a/arch/arm/boot/dts/am335x-bone.dts +++ b/arch/arm/boot/dts/am335x-bone.dts @@ -120,6 +120,8 @@ }; ldo3_reg: regulator@5 { + regulator-min-microvolt = <180>; + regulator-max-microvolt = <330>; regulator-always-on; }; @@ -136,3 +138,8 @@ &cpsw_emac1 { phy_id = <&davinci_mdio>, <1>; }; + +&mmc1 { + status = "okay"; + vmmc-supply = <&ldo3_reg>; +}; diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index d649644..2907da6 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -232,6 +232,8 @@ }; vmmc_reg: regulator@12 { + regulator-min-microvolt = <180>; + regulator-max-microvolt = <330>; regulator-always-on; }; }; @@ -244,3 +246,8 @@ &cpsw_emac1 { phy_id = <&davinci_mdio>, <1>; }; + +&mmc1 { + status = "okay"; + vmmc-supply = <&vmmc_reg>; +}; diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index f5a6162..f050c46 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts @@ -244,7 +244,14 @@ }; vmmc_reg: regulator@12 { + regulator-min-microvolt = <180>; + regulator-max-microvolt = <330>; regulator-always-on; }; }; }; + +&mmc1 { + status = "okay"; + vmmc-supply = <&vmmc_reg>; +}; diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index e711ffb..278b75d 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -235,6 +235,34 @@ status = "disabled"; }; + mmc1: mmc@4806 { + compatible = "ti,omap3-hsmmc"; + ti,hwmods = "mmc1"; + ti,dual-volt; + ti,needs-special-reset; + dmas = <&edma 24 + &edma 25>; + dma-names = "tx", "rx"; + status = "disabled"; + }; + + mmc2: mmc@481d8000 { + compatible = "ti,omap3-hsmmc"; + ti,hwmods = "mmc2"; + ti,needs-special-reset; + dmas = <&edma 2 + &edma 3>; + dma-names = "tx", "rx"; + status = "disabled"; + }; + + mmc3: mmc@4781 { + compatible = "ti,omap3-hsmmc"; + ti,hwmods = "mmc3"; + ti,needs-special-reset; + status = "disabled"; + }; + wdt2: wdt@44e35000 { compatible = "ti,omap3-wdt"; ti,hwmods = "wd_timer2"; -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 10/14] mmc: omap_hsmmc: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding. Signed-off-by: Matt Porter Acked-by: Tony Lindgren --- .../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 25 +++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt index ed271fc..826cc51 100644 --- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt @@ -20,8 +20,28 @@ ti,dual-volt: boolean, supports dual voltage cards ti,non-removable: non-removable slot (like eMMC) ti,needs-special-reset: Requires a special softreset sequence ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High Speed +dmas: DMA controller phandle and DMA request value ordered pair +One tx and one rx pair is required. +dma-names: DMA request names. These strings correspond 1:1 with +the ordered pairs in dmas. The RX request must be "rx" and the +TX request must be "tx". + +Examples: + +[hwmod populated DMA resources] + + mmc1: mmc@0x4809c000 { + compatible = "ti,omap4-hsmmc"; + reg = <0x4809c000 0x400>; + ti,hwmods = "mmc1"; + ti,dual-volt; + bus-width = <4>; + vmmc-supply = <&vmmc>; /* phandle to regulator node */ + ti,non-removable; + }; + +[generic DMA request binding] -Example: mmc1: mmc@0x4809c000 { compatible = "ti,omap4-hsmmc"; reg = <0x4809c000 0x400>; @@ -30,4 +50,7 @@ Example: bus-width = <4>; vmmc-supply = <&vmmc>; /* phandle to regulator node */ ti,non-removable; + dmas = <&edma 24 + &edma 25>; + dma-names = "tx", "rx"; }; -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 08/14] mmc: omap_hsmmc: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter Acked-by: Tony Lindgren --- drivers/mmc/host/omap_hsmmc.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index bc58078..e79b12d 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1915,14 +1915,20 @@ static int omap_hsmmc_probe(struct platform_device *pdev) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - host->rx_chan = dma_request_channel(mask, omap_dma_filter_fn, &rx_req); + host->rx_chan = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&rx_req, &pdev->dev, "rx"); + if (!host->rx_chan) { dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req); ret = -ENXIO; goto err_irq; } - host->tx_chan = dma_request_channel(mask, omap_dma_filter_fn, &tx_req); + host->tx_chan = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&tx_req, &pdev->dev, "tx"); + if (!host->tx_chan) { dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req); ret = -ENXIO; -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 05/14] dmaengine: edma: Add TI EDMA device tree binding
The binding definition is based on the generic DMA controller binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/dma/ti-edma.txt | 49 + 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt b/Documentation/devicetree/bindings/dma/ti-edma.txt new file mode 100644 index 000..075a60e3 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt @@ -0,0 +1,49 @@ +TI EDMA + +Required properties: +- compatible : "ti,edma3" +- ti,hwmods: Name of the hwmods associated to the EDMA +- ti,edma-regions: Number of regions +- ti,edma-slots: Number of slots +- ti,edma-queue-tc-map: List of transfer control to queue mappings +- ti,edma-queue-priority-map: List of queue priority mappings +- ti,edma-default-queue: Default queue value + +Optional properties: +- ti,edma-reserved-channels: List of reserved channel regions +- ti,edma-reserved-slots: List of reserved slot regions +- ti,edma-xbar-event-map: Crossbar event to channel map + +Example: + +edma: edma@4900 { + reg = <0x4900 0x1>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-reserved-channels = <0 2 +14 2 +26 6 +48 4 +56 8>; + ti,edma-reserved-slots = <0 2 + 14 2 + 26 6 + 48 4 + 56 8 + 64 127>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + ti,edma-xbar-event-map = <1 12 + 2 13>; +}; -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 02/14] ARM: edma: remove unused transfer controller handlers
Fix build on OMAP, the irqs are undefined on AM33xx. These error interrupt handlers were hardcoded as disabled so since they are unused code, simply remove them. Signed-off-by: Matt Porter --- arch/arm/common/edma.c | 37 - 1 file changed, 37 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index be3c04a..2dce245 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -494,26 +494,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) return IRQ_HANDLED; } -/** - * - * Transfer controller error interrupt handlers - * - */ - -#define tc_errs_handledfalse /* disabled as long as they're NOPs */ - -static irqreturn_t dma_tc0err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc0err_handler\n"); - return IRQ_HANDLED; -} - -static irqreturn_t dma_tc1err_handler(int irq, void *data) -{ - dev_dbg(data, "dma_tc1err_handler\n"); - return IRQ_HANDLED; -} - static int reserve_contiguous_slots(int ctlr, unsigned int id, unsigned int num_slots, unsigned int start_slot) @@ -1538,23 +1518,6 @@ static int edma_probe(struct platform_device *pdev) arch_num_cc++; } - if (tc_errs_handled) { - status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0, - "edma_tc0", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n", - IRQ_TCERRINT0, status); - return status; - } - status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0, - "edma_tc1", &pdev->dev); - if (status < 0) { - dev_dbg(&pdev->dev, "request_irq %d --> %d\n", - IRQ_TCERRINT, status); - return status; - } - } - return 0; fail: -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 07/14] dmaengine: add dma_request_slave_channel_compat()
Adds a dma_request_slave_channel_compat() wrapper which accepts both the arguments from dma_request_channel() and dma_request_slave_channel(). Based on whether the driver is instantiated via DT, the appropriate channel request call will be made. This allows for a much cleaner migration of drivers to the dmaengine DT API as platforms continue to be mixed between those that boot using DT and those that do not. Suggested-by: Tony Lindgren Signed-off-by: Matt Porter Acked-by: Tony Lindgren --- include/linux/dmaengine.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 9fd0c5b..64f9f69 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1047,6 +1047,16 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx); struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); struct dma_chan *net_dma_find_channel(void); #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) +static inline struct dma_chan +*dma_request_slave_channel_compat(dma_cap_mask_t mask, dma_filter_fn fn, + void *fn_param, struct device *dev, + char *name) +{ + if (dev->of_node) + return dma_request_slave_channel(dev, name); + else + return dma_request_channel(mask, fn, fn_param); +} /* --- Helper iov-locking functions --- */ -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 09/14] mmc: omap_hsmmc: set max_segs based on dma engine limitations
The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. The DMA Engine API reports the maximum number of segments a channel can support via the optional dma_get_channel_caps() API. If the nr_segs capability is present, the value is used to configure mmc->max_segs appropriately. Signed-off-by: Matt Porter Acked-by: Tony Lindgren --- drivers/mmc/host/omap_hsmmc.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index e79b12d..f74bd69 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1769,6 +1769,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) const struct of_device_id *match; dma_cap_mask_t mask; unsigned tx_req, rx_req; + struct dmaengine_chan_caps *dma_chan_caps; struct pinctrl *pinctrl; match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev); @@ -1935,6 +1936,11 @@ static int omap_hsmmc_probe(struct platform_device *pdev) goto err_irq; } + /* Some DMA Engines only handle a limited number of SG segments */ + dma_chan_caps = dma_get_channel_caps(host->rx_chan, DMA_DEV_TO_MEM); + if (dma_chan_caps && dma_chan_caps->seg_nr) + mmc->max_segs = dma_chan_caps->seg_nr; + /* Request IRQ for MMC operations */ ret = request_irq(host->irq, omap_hsmmc_irq, 0, mmc_hostname(mmc), host); -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 04/14] dmaengine: edma: enable build for AM33XX
Enable TI EDMA option on OMAP. Signed-off-by: Matt Porter --- drivers/dma/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index d4c1218..20ef955 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -221,7 +221,7 @@ config SIRF_DMA config TI_EDMA tristate "TI EDMA support" - depends on ARCH_DAVINCI + depends on ARCH_DAVINCI || ARCH_OMAP select DMA_ENGINE select DMA_VIRTUAL_CHANNELS default n -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 06/14] ARM: dts: add AM33XX EDMA support
Adds AM33XX EDMA support to the am33xx.dtsi as documented in Documentation/devicetree/bindings/dma/ti-edma.txt Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index c2f14e8..e711ffb 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -87,6 +87,26 @@ reg = <0x4820 0x1000>; }; + edma: edma@4900 { + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + reg = <0x4900 0x1>, + <0x44e10f90 0x10>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + }; + gpio1: gpio@44e07000 { compatible = "ti,omap4-gpio"; ti,hwmods = "gpio1"; -- 1.7.9.5 -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ 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_122512 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH v5 01/14] ARM: davinci: move private EDMA API to arm/common
Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx) as well. This just moves the private EDMA API and enables it to build on OMAP. Signed-off-by: Matt Porter --- arch/arm/Kconfig |1 + arch/arm/common/Kconfig|3 + arch/arm/common/Makefile |1 + arch/arm/{mach-davinci/dma.c => common/edma.c} |4 +- arch/arm/mach-davinci/Makefile |2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- arch/arm/mach-davinci/davinci.h|2 +- arch/arm/mach-davinci/devices-tnetv107x.c |2 +- arch/arm/mach-davinci/devices.c|7 +- arch/arm/mach-davinci/dm355.c |2 +- arch/arm/mach-davinci/dm365.c |2 +- arch/arm/mach-davinci/dm644x.c |2 +- arch/arm/mach-davinci/dm646x.c |2 +- arch/arm/mach-davinci/include/mach/da8xx.h |2 +- arch/arm/plat-omap/Kconfig |1 + drivers/dma/edma.c |2 +- drivers/mmc/host/davinci_mmc.c |1 + include/linux/mfd/davinci_voicecodec.h |3 +- .../mach => include/linux/platform_data}/edma.h| 89 +--- include/linux/platform_data/spi-davinci.h |2 +- sound/soc/davinci/davinci-evm.c|1 + sound/soc/davinci/davinci-pcm.c|1 + sound/soc/davinci/davinci-pcm.h|2 +- sound/soc/davinci/davinci-sffsdr.c |6 +- 24 files changed, 33 insertions(+), 109 deletions(-) rename arch/arm/{mach-davinci/dma.c => common/edma.c} (99%) rename {arch/arm/mach-davinci/include/mach => include/linux/platform_data}/edma.h (59%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 67874b8..7637d31 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -932,6 +932,7 @@ config ARCH_DAVINCI select GENERIC_IRQ_CHIP select HAVE_IDE select NEED_MACH_GPIO_H + select TI_PRIV_EDMA select USE_OF select ZONE_DMA help diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 45ceeb0..9e32d0d 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -40,3 +40,6 @@ config SHARP_PARAM config SHARP_SCOOP bool + +config TI_PRIV_EDMA + bool diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index e8a4e58..d09a39b 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o +obj-$(CONFIG_TI_PRIV_EDMA) += edma.o diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c similarity index 99% rename from arch/arm/mach-davinci/dma.c rename to arch/arm/common/edma.c index a685e97..be3c04a 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/common/edma.c @@ -25,7 +25,7 @@ #include #include -#include +#include /* Offsets matching "struct edmacc_param" */ #define PARM_OPT 0x00 @@ -1387,7 +1387,7 @@ EXPORT_SYMBOL(edma_clear_event); /*---*/ -static int __init edma_probe(struct platform_device *pdev) +static int edma_probe(struct platform_device *pdev) { struct edma_soc_info**info = pdev->dev.platform_data; const s8(*queue_priority_mapping)[2]; diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index fb5c1aa..493a36b 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -5,7 +5,7 @@ # Common objects obj-y := time.o clock.o serial.o psc.o \ - dma.o usb.o common.o sram.o aemif.o + usb.o common.o sram.o aemif.o obj-$(CONFIG_DAVINCI_MUX) += mux.o diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c index be30997..86f55ba 100644 --- a/arch/arm/mach-davinci/board-tnetv107x-evm.c +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c @@ -26,12 +26,12 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h index 12d544b..d26a6bc 100644 --- a/arch/arm/mach-davinci/davinci.h +++ b/arch/arm/mach-davinci/davinci.h @@ -23,9 +23,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c index 773ab07..ba37760 100644 --- a/arch/arm/mach-da
[PATCH v5 03/14] ARM: edma: add AM33XX support to the private EDMA API
Adds support for parsing the TI EDMA DT data into the required EDMA private API platform data. Enables runtime PM support to initialize the EDMA hwmod. Adds AM33XX EMDA crossbar event mux support. Signed-off-by: Matt Porter --- arch/arm/common/edma.c | 314 ++-- include/linux/platform_data/edma.h |1 + 2 files changed, 306 insertions(+), 9 deletions(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 2dce245..beeb1d2 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -24,6 +24,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include @@ -723,6 +730,9 @@ EXPORT_SYMBOL(edma_free_channel); */ int edma_alloc_slot(unsigned ctlr, int slot) { + if (!edma_cc[ctlr]) + return -EINVAL; + if (slot >= 0) slot = EDMA_CHAN_SLOT(slot); @@ -1366,31 +1376,291 @@ void edma_clear_event(unsigned channel) EXPORT_SYMBOL(edma_clear_event); /*---*/ +static int edma_of_read_u32_to_s8_array(const struct device_node *np, +const char *propname, s8 *out_values, +size_t sz) +{ + struct property *prop = of_find_property(np, propname, NULL); + const __be32 *val; + + if (!prop) + return -EINVAL; + if (!prop->value) + return -ENODATA; + if ((sz * sizeof(u32)) > prop->length) + return -EOVERFLOW; + + val = prop->value; + + while (sz--) + *out_values++ = (s8)(be32_to_cpup(val++) & 0xff); + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_of_read_u32_to_s16_array(const struct device_node *np, +const char *propname, s16 *out_values, +size_t sz) +{ + struct property *prop = of_find_property(np, propname, NULL); + const __be32 *val; + + if (!prop) + return -EINVAL; + if (!prop->value) + return -ENODATA; + if ((sz * sizeof(u32)) > prop->length) + return -EOVERFLOW; + + val = prop->value; + + while (sz--) + *out_values++ = (s16)(be32_to_cpup(val++) & 0x); + + /* Terminate it */ + *out_values++ = -1; + *out_values++ = -1; + + return 0; +} + +static int edma_xbar_event_map(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata, int len) +{ + int ret = 0; + int i; + struct resource res; + void *xbar; + const s16 (*xbar_chans)[2]; + u32 shift, offset, mux; + + xbar_chans = devm_kzalloc(dev, + len/sizeof(s16) + 2*sizeof(s16), + GFP_KERNEL); + if (!xbar_chans) + return -ENOMEM; + + ret = of_address_to_resource(node, 1, &res); + if (IS_ERR_VALUE(ret)) + return -EIO; + + xbar = devm_ioremap(dev, res.start, resource_size(&res)); + if (!xbar) + return -ENOMEM; + + ret = edma_of_read_u32_to_s16_array(node, + "ti,edma-xbar-event-map", + (s16 *)xbar_chans, + len/sizeof(u32)); + if (IS_ERR_VALUE(ret)) + return -EIO; + + for (i = 0; xbar_chans[i][0] != -1; i++) { + shift = (xbar_chans[i][1] % 4) * 8; + offset = xbar_chans[i][1] >> 2; + offset <<= 2; + mux = readl((void *)((u32)xbar + offset)); + mux &= ~(0xff << shift); + mux |= xbar_chans[i][0] << shift; + writel(mux, (void *)((u32)xbar + offset)); + } + + pdata->xbar_chans = xbar_chans; + + return 0; +} + +static int edma_of_parse_dt(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata) +{ + int ret = 0; + u32 value; + struct property *prop; + size_t sz; + struct edma_rsv_info *rsv_info; + const s16 (*rsv_chans)[2], (*rsv_slots)[2]; + const s8 (*queue_tc_map)[2], (*queue_priority_map)[2]; + + memset(pdata, 0, sizeof(struct edma_soc_info)); + + ret = of_property_read_u32(node, "dma-channels", &value); + if (ret < 0) + return ret; + pdata->n_channel = value; + + ret = of_property_read_u32(node, "ti,edma-regions", &value); + if (ret < 0) + return ret;
[PATCH v5 00/14] DMA Engine support for AM33XX
Changes since v4: - Fixed debug section mismatch in private edma api [01/14] - Respun format-patch to catch the platform_data/edma.h rename [01/14] - Removed address/size-cells from the EDMA binding [05/14] Changes since v3: - Rebased on 3.8-rc3 - No longer an RFC - Fixed bugs in DT/pdata parsing reported by Vaibhav Bedia - Restored all the Davinci pdata to const - Removed max_segs hack in favor of using dma_get_channel_caps() - Fixed extra parens, __raw_* accessors and, ioremap error checks in xbar handling - Removed excess license info in platform_data/edma.h - Removed unneeded reserved channels data for AM33xx - Removed test-specific pinmuxing from dts files - Adjusted mmc1 node to be disabled by default in the dtsi Changes since v2: - Rebased on 3.7-rc1 - Fixed bug in DT/pdata parsing first found by Gururaja that turned out to be masked by some toolchains - Dropped unused mach-omap2/devices.c hsmmc patch - Added AM33XX crossbar DMA event mux support - Added am335x-evm support Changes since v1: - Rebased on top of mainline from 12250d8 - Dropped the feature removal schedule patch - Implemented dma_request_slave_channel_compat() and converted the mmc and spi drivers to use it - Dropped unneeded #address-cells and #size-cells from EDMA DT support - Moved private EDMA header to linux/platform_data/ and removed some unneeded definitions - Fixed parsing of optional properties This series adds DMA Engine support for AM33xx, which uses an EDMA DMAC. The EDMA DMAC has been previously supported by only a private API implementation (much like the situation with OMAP DMA) found on the DaVinci family of SoCs. The series applies on top of 3.8-rc3 and the following patches: - TPS65910 REGMAP_IRQ build fix: https://patchwork.kernel.org/patch/1857701/ - dmaengine DT support from Vinod's dmaengine_dt branch in git://git.infradead.org/users/vkoul/slave-dma.git since 027478851791df751176398be02a3b1c5f6aa824 - edma dmaengine driver fix: https://patchwork.kernel.org/patch/1961521/ - dmaengine dma_get_channel_caps v2: https://patchwork.kernel.org/patch/1961601/ - dmaengine edma driver channel caps support v2: https://patchwork.kernel.org/patch/1961591/ The approach taken is similar to how OMAP DMA is being converted to DMA Engine support. With the functional EDMA private API already existing in mach-davinci/dma.c, we first move that to an ARM common area so it can be shared. Adding DT and runtime PM support to the private EDMA API implementation allows it to run on AM33xx. AM33xx *only* boots using DT so we leverage Jon's generic DT DMA helpers to register EDMA DMAC with the of_dma framework and then add support for calling the dma_request_slave_channel() API to both the mmc and spi drivers. With this series both BeagleBone and the AM335x EVM have working MMC and SPI support. This is tested on BeagleBone with a SPI framebuffer driver and MMC rootfs. A trivial gpio DMA event misc driver was used to test the crossbar DMA event support. It is also tested on the AM335x EVM with the onboard SPI flash and MMC rootfs. The branch at https://github.com/ohporter/linux/tree/edma-dmaengine-am33xx-v4 has the complete series, dependencies, and some test drivers/defconfigs. Regression testing was done on AM180x-EVM (which also makes use of the EDMA dmaengine driver and the EDMA private API) using SD, SPI flash, and the onboard audio supported by the ASoC Davinci driver. Regression testing was also done on a BeagleBoard xM booting from the legacy board file using MMC rootfs. Matt Porter (14): ARM: davinci: move private EDMA API to arm/common ARM: edma: remove unused transfer controller handlers ARM: edma: add AM33XX support to the private EDMA API dmaengine: edma: enable build for AM33XX dmaengine: edma: Add TI EDMA device tree binding ARM: dts: add AM33XX EDMA support dmaengine: add dma_request_slave_channel_compat() mmc: omap_hsmmc: convert to dma_request_slave_channel_compat() mmc: omap_hsmmc: set max_segs based on dma engine limitations mmc: omap_hsmmc: add generic DMA request support to the DT binding ARM: dts: add AM33XX MMC support spi: omap2-mcspi: convert to dma_request_slave_channel_compat() spi: omap2-mcspi: add generic DMA request support to the DT binding ARM: dts: add AM33XX SPI DMA support Documentation/devicetree/bindings/dma/ti-edma.txt | 49 +++ .../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 25 +- Documentation/devicetree/bindings/spi/omap-spi.txt | 28 +- arch/arm/Kconfig |1 + arch/arm/boot/dts/am335x-bone.dts |7 + arch/arm/boot/dts/am335x-evm.dts
Re: [PATCH v4 00/14] DMA Engine support for AM33XX
On Fri, Jan 11, 2013 at 11:40:41AM +, Arnd Bergmann wrote: > On Friday 11 January 2013, Matt Porter wrote: > > The approach taken is similar to how OMAP DMA is being converted to > > DMA Engine support. With the functional EDMA private API already > > existing in mach-davinci/dma.c, we first move that to an ARM common > > area so it can be shared. Adding DT and runtime PM support to the > > private EDMA API implementation allows it to run on AM33xx. AM33xx > > only boots using DT so we leverage Jon's generic DT DMA helpers to > > register EDMA DMAC with the of_dma framework and then add support > > for calling the dma_request_slave_channel() API to both the mmc > > and spi drivers. > > I think this looks very good. What I wonder is whether we should > make the non-DT parts of the dmaengine driver compile-time > conditional on CONFIG_ATAGS though, so the slave drivers don't > have a link-time dependency on the dmaengine driver's > omap_dma_filter_fn symbol when building without ATAGS support. We have tightly coupled the link-time dependency for omap_dma_filter_fn by going down the path of using dma_request_slave_channel_compat() as Tony suggested to avoid extra ifdefry. That dependency will go away naturally if all the "legacy" OMAP platforms were required to only boot from DT...just as a newly added SoCs are. Are you suggesting unwinding the _compat() approach? -Matt -- 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 v4,03/14] ARM: edma: add AM33XX support to the private EDMA API
On Fri, Jan 11, 2013 at 06:14:27PM +, Lars Poeschel wrote: > Hi Matt, > > On Friday 11 January 2013 at 06:48:39, Matt Porter wrote: > > > diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c > > index a3d189d..1951d63 100644 > > --- a/arch/arm/common/edma.c > > +++ b/arch/arm/common/edma.c > > @@ -24,6 +24,13 @@ > > #include > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > You add the include linux/of_dma.h here, but maybe you missed to add the file > itself. It is not in Linus v3.8-rc3 tree, not in the patches yours depend on > listed and not in your patchset. of_dma.h comes in with the dependencies listed in the cover letter. Particularly, Vinod's dt_dmaengine branch in slave-dma.git contains Jon Hunter's OF DMA helpers series. -Matt -- 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 v4 05/14] dmaengine: edma: Add TI EDMA device tree binding
On Fri, Jan 11, 2013 at 07:54:05AM +, Hebbar, Gururaja wrote: > On Fri, Jan 11, 2013 at 11:18:41, Porter, Matt wrote: > > The binding definition is based on the generic DMA controller > > binding. > > > > Signed-off-by: Matt Porter > > --- > > Documentation/devicetree/bindings/dma/ti-edma.txt | 51 > > + > > 1 file changed, 51 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt > > > > diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt > > b/Documentation/devicetree/bindings/dma/ti-edma.txt > > new file mode 100644 > > index 000..3344345 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt > > @@ -0,0 +1,51 @@ > > +TI EDMA > > + > > +Required properties: > > +- compatible : "ti,edma3" > > +- ti,hwmods: Name of the hwmods associated to the EDMA > > +- ti,edma-regions: Number of regions > > +- ti,edma-slots: Number of slots > > +- ti,edma-queue-tc-map: List of transfer control to queue mappings > > +- ti,edma-queue-priority-map: List of queue priority mappings > > +- ti,edma-default-queue: Default queue value > > + > > +Optional properties: > > +- ti,edma-reserved-channels: List of reserved channel regions > > +- ti,edma-reserved-slots: List of reserved slot regions > > +- ti,edma-xbar-event-map: Crossbar event to channel map > > + > > +Example: > > + > > +edma: edma@4900 { > > + #address-cells = <1>; > > + #size-cells = <0>; > > address-cells & size-cells are only required when current node is a parent > node & it has sibling/child nodes (that too if the child node uses "reg" > property). Yes, agreed. I addressed this in the actual dts but failed to update the binding itself. Will update. > > > + reg = <0x4900 0x1>; > > + interrupt-parent = <&intc>; > > + interrupts = <12 13 14>; > > + compatible = "ti,edma3"; > > + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; > > + #dma-cells = <1>; > > + dma-channels = <64>; > > + ti,edma-regions = <4>; > > + ti,edma-slots = <256>; > > + ti,edma-reserved-channels = <0 2 > > +14 2 > > +26 6 > > +48 4 > > +56 8>; > > + ti,edma-reserved-slots = <0 2 > > + 14 2 > > + 26 6 > > + 48 4 > > + 56 8 > > + 64 127>; > > + ti,edma-queue-tc-map = <0 0 > > + 1 1 > > + 2 2>; > > + ti,edma-queue-priority-map = <0 0 > > + 1 1 > > + 2 2>; > > + ti,edma-default-queue = <0>; > > + ti,edma-xbar-event-map = <1 12 > > + 2 13>; > > +}; > > -- > > 1.7.9.5 > > > > ___ > > Davinci-linux-open-source mailing list > > davinci-linux-open-sou...@linux.davincidsp.com > > http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source > > > > > Regards, > Gururaja -- 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 v4 01/14] ARM: davinci: move private EDMA API to arm/common
On Fri, Jan 11, 2013 at 06:15:06AM +, Hebbar, Gururaja wrote: > On Fri, Jan 11, 2013 at 11:18:37, Porter, Matt wrote: > > Move mach-davinci/dma.c to common/edma.c so it can be used > > by OMAP (specifically AM33xx) as well. This just moves the > > private EDMA API and enables it to build on OMAP. > > > > Signed-off-by: Matt Porter > > --- > > arch/arm/Kconfig |1 + > > arch/arm/common/Kconfig|3 + > > arch/arm/common/Makefile |1 + > > arch/arm/{mach-davinci/dma.c => common/edma.c} |2 +- > > arch/arm/mach-davinci/Makefile |2 +- > > arch/arm/mach-davinci/board-tnetv107x-evm.c|2 +- > > arch/arm/mach-davinci/davinci.h|2 +- > > arch/arm/mach-davinci/devices-tnetv107x.c |2 +- > > arch/arm/mach-davinci/devices.c|7 +- > > arch/arm/mach-davinci/dm355.c |2 +- > > arch/arm/mach-davinci/dm365.c |2 +- > > arch/arm/mach-davinci/dm644x.c |2 +- > > arch/arm/mach-davinci/dm646x.c |2 +- > > arch/arm/mach-davinci/include/mach/da8xx.h |2 +- > > arch/arm/mach-davinci/include/mach/edma.h | 267 > > > > arch/arm/plat-omap/Kconfig |1 + > > drivers/dma/edma.c |2 +- > > drivers/mmc/host/davinci_mmc.c |1 + > > include/linux/mfd/davinci_voicecodec.h |3 +- > > include/linux/platform_data/edma.h | 182 > > Headers file are just moved here. So "git mv file1 flie2; and the git > format-patch -C" on commit should just generate few lines of patch. Ok, good catch. > > > include/linux/platform_data/spi-davinci.h |2 +- > > sound/soc/davinci/davinci-evm.c|1 + > > sound/soc/davinci/davinci-pcm.c|1 + > > sound/soc/davinci/davinci-pcm.h|2 +- > > sound/soc/davinci/davinci-sffsdr.c |6 +- > > 25 files changed, 212 insertions(+), 288 deletions(-) > > rename arch/arm/{mach-davinci/dma.c => common/edma.c} (99%) > > delete mode 100644 arch/arm/mach-davinci/include/mach/edma.h > > create mode 100644 include/linux/platform_data/edma.h > > > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > > index 67874b8..7637d31 100644 > > --- a/arch/arm/Kconfig > > +++ b/arch/arm/Kconfig > > @@ -932,6 +932,7 @@ config ARCH_DAVINCI > > select GENERIC_IRQ_CHIP > > select HAVE_IDE > > select NEED_MACH_GPIO_H > > + select TI_PRIV_EDMA > > select USE_OF > > select ZONE_DMA > > help > > diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig > > index 45ceeb0..9e32d0d 100644 > > --- a/arch/arm/common/Kconfig > > +++ b/arch/arm/common/Kconfig > > @@ -40,3 +40,6 @@ config SHARP_PARAM > > > > config SHARP_SCOOP > > bool > > + > > +config TI_PRIV_EDMA > > + bool > > diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile > > index e8a4e58..d09a39b 100644 > > --- a/arch/arm/common/Makefile > > +++ b/arch/arm/common/Makefile > > @@ -13,3 +13,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o > > obj-$(CONFIG_SHARP_SCOOP) += scoop.o > > obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o > > obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o > > +obj-$(CONFIG_TI_PRIV_EDMA) += edma.o > > diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c > > similarity index 99% > > rename from arch/arm/mach-davinci/dma.c > > rename to arch/arm/common/edma.c > > index a685e97..4411087 100644 > > --- a/arch/arm/mach-davinci/dma.c > > +++ b/arch/arm/common/edma.c > > @@ -25,7 +25,7 @@ > > #include > > #include > > > > -#include > > +#include > > > > /* Offsets matching "struct edmacc_param" */ > > #define PARM_OPT 0x00 > > diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile > > index fb5c1aa..493a36b 100644 > > --- a/arch/arm/mach-davinci/Makefile > > +++ b/arch/arm/mach-davinci/Makefile > > @@ -5,7 +5,7 @@ > > > > # Common objects > > obj-y := time.o clock.o serial.o psc.o \ > > - dma.o usb.o common.o sram.o aemif.o > > + usb.o common.o sram.o aemif.o > > > > obj-$(CONFIG_DAVINCI_MUX)
[PATCH v4 13/14] spi: omap2-mcspi: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/spi/omap-spi.txt | 28 +++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/omap-spi.txt b/Documentation/devicetree/bindings/spi/omap-spi.txt index 938809c..3bd8eed 100644 --- a/Documentation/devicetree/bindings/spi/omap-spi.txt +++ b/Documentation/devicetree/bindings/spi/omap-spi.txt @@ -10,7 +10,18 @@ Required properties: input. The default is D0 as input and D1 as output. -Example: +Optional properties: +- dmas: List of DMA controller phandle and DMA request ordered + pairs. One tx and one rx pair is required for each chip + select. +- dma-names: List of DMA request names. These strings correspond + 1:1 with the ordered pairs in dmas. The string naming is + to be "rxN" and "txN" for RX and TX requests, + respectively, where N equals the chip select number. + +Examples: + +[hwmod populated DMA resources] mcspi1: mcspi@1 { #address-cells = <1>; @@ -20,3 +31,18 @@ mcspi1: mcspi@1 { ti,spi-num-cs = <4>; }; +[generic DMA request binding] + +mcspi1: mcspi@1 { +#address-cells = <1>; +#size-cells = <0>; +compatible = "ti,omap4-mcspi"; +ti,hwmods = "mcspi1"; +ti,spi-num-cs = <2>; +dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; +dma-names = "tx0", "rx0", "tx1", "rx1"; +}; + -- 1.7.9.5 -- 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
[PATCH v4 12/14] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use dma_request_slave_channel_compat(). This supports the DT case of platforms requiring channel selection from either the OMAP DMA or the EDMA engine. AM33xx only boots from DT and is the only user implementing EDMA so in the !DT case we can default to the OMAP DMA filter. Signed-off-by: Matt Porter --- drivers/spi/spi-omap2-mcspi.c | 65 - 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b610f52..2c02c02 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -102,6 +102,9 @@ struct omap2_mcspi_dma { struct completion dma_tx_completion; struct completion dma_rx_completion; + + char dma_rx_ch_name[14]; + char dma_tx_ch_name[14]; }; /* use PIO for small transfers, avoiding DMA setup/teardown overhead and @@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); sig = mcspi_dma->dma_rx_sync_dev; - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + + mcspi_dma->dma_rx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_rx_ch_name); + if (!mcspi_dma->dma_rx) { dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n"); return -EAGAIN; } sig = mcspi_dma->dma_tx_sync_dev; - mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); + mcspi_dma->dma_tx = + dma_request_slave_channel_compat(mask, omap_dma_filter_fn, +&sig, &master->dev, +mcspi_dma->dma_tx_ch_name); + if (!mcspi_dma->dma_tx) { dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n"); dma_release_channel(mcspi_dma->dma_rx); @@ -1223,29 +1235,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev) goto free_master; for (i = 0; i < master->num_chipselect; i++) { - char dma_ch_name[14]; + char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; + char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name; struct resource *dma_res; - sprintf(dma_ch_name, "rx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); - status = -ENODEV; - break; - } + sprintf(dma_rx_ch_name, "rx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_rx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA RX channel\n"); + status = -ENODEV; + break; + } - mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; - sprintf(dma_ch_name, "tx%d", i); - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, - dma_ch_name); - if (!dma_res) { - dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); - status = -ENODEV; - break; + mcspi->dma_channels[i].dma_rx_sync_dev = + dma_res->start; } + sprintf(dma_tx_ch_name, "tx%d", i); + if (!pdev->dev.of_node) { + dma_res = + platform_get_resource_byname(pdev, +IORESOURCE_DMA, +dma_tx_ch_name); + if (!dma_res) { + dev_dbg(&pdev->dev, + "cannot get DMA TX channel\n"); + status = -ENODEV; +
[PATCH v4 14/14] ARM: dts: add AM33XX SPI DMA support
Adds DMA resources to the AM33XX SPI nodes. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am33xx.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 278b75d..8fd3648 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -356,6 +356,11 @@ interrupt = <65>; ti,spi-num-cs = <2>; ti,hwmods = "spi0"; + dmas = <&edma 16 + &edma 17 + &edma 18 + &edma 19>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; @@ -367,6 +372,11 @@ interrupt = <125>; ti,spi-num-cs = <2>; ti,hwmods = "spi1"; + dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; + dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; }; -- 1.7.9.5 -- 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
[PATCH v4 05/14] dmaengine: edma: Add TI EDMA device tree binding
The binding definition is based on the generic DMA controller binding. Signed-off-by: Matt Porter --- Documentation/devicetree/bindings/dma/ti-edma.txt | 51 + 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ti-edma.txt diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt b/Documentation/devicetree/bindings/dma/ti-edma.txt new file mode 100644 index 000..3344345 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/ti-edma.txt @@ -0,0 +1,51 @@ +TI EDMA + +Required properties: +- compatible : "ti,edma3" +- ti,hwmods: Name of the hwmods associated to the EDMA +- ti,edma-regions: Number of regions +- ti,edma-slots: Number of slots +- ti,edma-queue-tc-map: List of transfer control to queue mappings +- ti,edma-queue-priority-map: List of queue priority mappings +- ti,edma-default-queue: Default queue value + +Optional properties: +- ti,edma-reserved-channels: List of reserved channel regions +- ti,edma-reserved-slots: List of reserved slot regions +- ti,edma-xbar-event-map: Crossbar event to channel map + +Example: + +edma: edma@4900 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4900 0x1>; + interrupt-parent = <&intc>; + interrupts = <12 13 14>; + compatible = "ti,edma3"; + ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; + #dma-cells = <1>; + dma-channels = <64>; + ti,edma-regions = <4>; + ti,edma-slots = <256>; + ti,edma-reserved-channels = <0 2 +14 2 +26 6 +48 4 +56 8>; + ti,edma-reserved-slots = <0 2 + 14 2 + 26 6 + 48 4 + 56 8 + 64 127>; + ti,edma-queue-tc-map = <0 0 + 1 1 + 2 2>; + ti,edma-queue-priority-map = <0 0 + 1 1 + 2 2>; + ti,edma-default-queue = <0>; + ti,edma-xbar-event-map = <1 12 + 2 13>; +}; -- 1.7.9.5 -- 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
[PATCH v4 09/14] mmc: omap_hsmmc: set max_segs based on dma engine limitations
The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. The DMA Engine API reports the maximum number of segments a channel can support via the optional dma_get_channel_caps() API. If the nr_segs capability is present, the value is used to configure mmc->max_segs appropriately. Signed-off-by: Matt Porter --- drivers/mmc/host/omap_hsmmc.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index e79b12d..f74bd69 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1769,6 +1769,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) const struct of_device_id *match; dma_cap_mask_t mask; unsigned tx_req, rx_req; + struct dmaengine_chan_caps *dma_chan_caps; struct pinctrl *pinctrl; match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev); @@ -1935,6 +1936,11 @@ static int omap_hsmmc_probe(struct platform_device *pdev) goto err_irq; } + /* Some DMA Engines only handle a limited number of SG segments */ + dma_chan_caps = dma_get_channel_caps(host->rx_chan, DMA_DEV_TO_MEM); + if (dma_chan_caps && dma_chan_caps->seg_nr) + mmc->max_segs = dma_chan_caps->seg_nr; + /* Request IRQ for MMC operations */ ret = request_irq(host->irq, omap_hsmmc_irq, 0, mmc_hostname(mmc), host); -- 1.7.9.5 -- 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
[PATCH v4 11/14] ARM: dts: add AM33XX MMC support
Adds AM33XX MMC support for am335x-bone, am335x-evm, and am335x-evmsk.. Signed-off-by: Matt Porter --- arch/arm/boot/dts/am335x-bone.dts |7 +++ arch/arm/boot/dts/am335x-evm.dts |7 +++ arch/arm/boot/dts/am335x-evmsk.dts |7 +++ arch/arm/boot/dts/am33xx.dtsi | 28 4 files changed, 49 insertions(+) diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts index 11b240c..a154ce0 100644 --- a/arch/arm/boot/dts/am335x-bone.dts +++ b/arch/arm/boot/dts/am335x-bone.dts @@ -120,6 +120,8 @@ }; ldo3_reg: regulator@5 { + regulator-min-microvolt = <180>; + regulator-max-microvolt = <330>; regulator-always-on; }; @@ -136,3 +138,8 @@ &cpsw_emac1 { phy_id = <&davinci_mdio>, <1>; }; + +&mmc1 { + status = "okay"; + vmmc-supply = <&ldo3_reg>; +}; diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index d649644..2907da6 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -232,6 +232,8 @@ }; vmmc_reg: regulator@12 { + regulator-min-microvolt = <180>; + regulator-max-microvolt = <330>; regulator-always-on; }; }; @@ -244,3 +246,8 @@ &cpsw_emac1 { phy_id = <&davinci_mdio>, <1>; }; + +&mmc1 { + status = "okay"; + vmmc-supply = <&vmmc_reg>; +}; diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index f5a6162..f050c46 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts @@ -244,7 +244,14 @@ }; vmmc_reg: regulator@12 { + regulator-min-microvolt = <180>; + regulator-max-microvolt = <330>; regulator-always-on; }; }; }; + +&mmc1 { + status = "okay"; + vmmc-supply = <&vmmc_reg>; +}; diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index e711ffb..278b75d 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -235,6 +235,34 @@ status = "disabled"; }; + mmc1: mmc@4806 { + compatible = "ti,omap3-hsmmc"; + ti,hwmods = "mmc1"; + ti,dual-volt; + ti,needs-special-reset; + dmas = <&edma 24 + &edma 25>; + dma-names = "tx", "rx"; + status = "disabled"; + }; + + mmc2: mmc@481d8000 { + compatible = "ti,omap3-hsmmc"; + ti,hwmods = "mmc2"; + ti,needs-special-reset; + dmas = <&edma 2 + &edma 3>; + dma-names = "tx", "rx"; + status = "disabled"; + }; + + mmc3: mmc@4781 { + compatible = "ti,omap3-hsmmc"; + ti,hwmods = "mmc3"; + ti,needs-special-reset; + status = "disabled"; + }; + wdt2: wdt@44e35000 { compatible = "ti,omap3-wdt"; ti,hwmods = "wd_timer2"; -- 1.7.9.5 -- 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
[PATCH v4 10/14] mmc: omap_hsmmc: add generic DMA request support to the DT binding
The binding definition is based on the generic DMA request binding. Signed-off-by: Matt Porter --- .../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 25 +++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt index ed271fc..826cc51 100644 --- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt @@ -20,8 +20,28 @@ ti,dual-volt: boolean, supports dual voltage cards ti,non-removable: non-removable slot (like eMMC) ti,needs-special-reset: Requires a special softreset sequence ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High Speed +dmas: DMA controller phandle and DMA request value ordered pair +One tx and one rx pair is required. +dma-names: DMA request names. These strings correspond 1:1 with +the ordered pairs in dmas. The RX request must be "rx" and the +TX request must be "tx". + +Examples: + +[hwmod populated DMA resources] + + mmc1: mmc@0x4809c000 { + compatible = "ti,omap4-hsmmc"; + reg = <0x4809c000 0x400>; + ti,hwmods = "mmc1"; + ti,dual-volt; + bus-width = <4>; + vmmc-supply = <&vmmc>; /* phandle to regulator node */ + ti,non-removable; + }; + +[generic DMA request binding] -Example: mmc1: mmc@0x4809c000 { compatible = "ti,omap4-hsmmc"; reg = <0x4809c000 0x400>; @@ -30,4 +50,7 @@ Example: bus-width = <4>; vmmc-supply = <&vmmc>; /* phandle to regulator node */ ti,non-removable; + dmas = <&edma 24 + &edma 25>; + dma-names = "tx", "rx"; }; -- 1.7.9.5 -- 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