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; > > + 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; > > Will th
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 ___ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Re: [PATCH v9 3/9] ARM: edma: add AM33XX support to the private EDMA API
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. > + 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; Will this mean the DT portion of this driver cannot be used on SoCs where there are two CCs like DA850? If you are hard-coding this, will it make sense to set to to EDMA_MAX_CC instead? Okay I see a comment down below saying DT will support only one
Re: [PATCH v9 3/9] ARM: edma: add AM33XX support to the private EDMA API
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; > + offset = xbar_chans[i][1] >> 2; > + offset <<= 2; Is it offset = xbar_chans[i][1] & 0xfffc; ? > + 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 ___ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
[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), +GFP_KERNEL); + if (!rsv_chans) + return -ENOMEM; + pdata->rsv->rsv_chans = rsv_chan