Skip to content

Commit 82f12e6

Browse files
committed
ARM: OMAP2+: Drop legacy init for sdma
We can now drop legacy init for sdma as we pass the quirks in auxdata to the dmaengine driver. Cc: Aaro Koskinen <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Peter Ujfalusi <[email protected]> Cc: Russell King <[email protected]> Cc: Vinod Koul <[email protected]> Acked-by: Peter Ujfalusi <[email protected]> Tested-by: Peter Ujfalusi <[email protected]> Signed-off-by: Tony Lindgren <[email protected]>
1 parent f4cfa36 commit 82f12e6

File tree

3 files changed

+1
-264
lines changed

3 files changed

+1
-264
lines changed

arch/arm/mach-omap2/dma.c

Lines changed: 1 addition & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
#include <linux/omap-dma.h>
3131

3232
#include "soc.h"
33-
#include "omap_hwmod.h"
34-
#include "omap_device.h"
35-
36-
static enum omap_reg_offsets dma_common_ch_end;
3733

3834
static const struct omap_dma_reg reg_map[] = {
3935
[REVISION] = { 0x0000, 0x00, OMAP_DMA_REG_32BIT },
@@ -81,42 +77,6 @@ static const struct omap_dma_reg reg_map[] = {
8177
[CCDN] = { 0x00d8, 0x60, OMAP_DMA_REG_32BIT },
8278
};
8379

84-
static void __iomem *dma_base;
85-
static inline void dma_write(u32 val, int reg, int lch)
86-
{
87-
void __iomem *addr = dma_base;
88-
89-
addr += reg_map[reg].offset;
90-
addr += reg_map[reg].stride * lch;
91-
92-
writel_relaxed(val, addr);
93-
}
94-
95-
static inline u32 dma_read(int reg, int lch)
96-
{
97-
void __iomem *addr = dma_base;
98-
99-
addr += reg_map[reg].offset;
100-
addr += reg_map[reg].stride * lch;
101-
102-
return readl_relaxed(addr);
103-
}
104-
105-
static void omap2_clear_dma(int lch)
106-
{
107-
int i;
108-
109-
for (i = CSDP; i <= dma_common_ch_end; i += 1)
110-
dma_write(0, i, lch);
111-
}
112-
113-
static void omap2_show_dma_caps(void)
114-
{
115-
u8 revision = dma_read(REVISION, 0) & 0xff;
116-
printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
117-
revision >> 4, revision & 0xf);
118-
}
119-
12080
static unsigned configure_dma_errata(void)
12181
{
12282
unsigned errata = 0;
@@ -221,25 +181,11 @@ struct omap_system_dma_plat_info dma_plat_info = {
221181
.reg_map = reg_map,
222182
.channel_stride = 0x60,
223183
.dma_attr = &dma_attr,
224-
.show_dma_caps = omap2_show_dma_caps,
225-
.clear_dma = omap2_clear_dma,
226-
.dma_write = dma_write,
227-
.dma_read = dma_read,
228-
};
229-
230-
static struct platform_device_info omap_dma_dev_info __initdata = {
231-
.name = "omap-dma-engine",
232-
.id = -1,
233-
.dma_mask = DMA_BIT_MASK(32),
234184
};
235185

236186
/* One time initializations */
237-
static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
187+
static int __init omap2_system_dma_init(void)
238188
{
239-
struct platform_device *pdev;
240-
struct resource *mem;
241-
char *name = "omap_dma_system";
242-
243189
dma_plat_info.errata = configure_dma_errata();
244190

245191
if (soc_is_omap24xx()) {
@@ -254,41 +200,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
254200
if (soc_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
255201
dma_attr.dev_caps |= HS_CHANNELS_RESERVED;
256202

257-
pdev = omap_device_build(name, 0, oh, &dma_plat_info,
258-
sizeof(dma_plat_info));
259-
if (IS_ERR(pdev)) {
260-
pr_err("%s: Can't build omap_device for %s:%s.\n",
261-
__func__, name, oh->name);
262-
return PTR_ERR(pdev);
263-
}
264-
265-
omap_dma_dev_info.res = pdev->resource;
266-
omap_dma_dev_info.num_res = pdev->num_resources;
267-
268-
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
269-
if (!mem) {
270-
dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
271-
return -EINVAL;
272-
}
273-
274-
dma_base = ioremap(mem->start, resource_size(mem));
275-
if (!dma_base) {
276-
dev_err(&pdev->dev, "%s: ioremap fail\n", __func__);
277-
return -ENOMEM;
278-
}
279-
280-
/* Check the capabilities register for descriptor loading feature */
281-
if (soc_is_omap24xx() || soc_is_omap34xx() || soc_is_am35xx())
282-
dma_common_ch_end = CCFN;
283-
else
284-
dma_common_ch_end = CCDN;
285-
286203
return 0;
287204
}
288-
289-
static int __init omap2_system_dma_init(void)
290-
{
291-
return omap_hwmod_for_each_by_class("dma",
292-
omap2_system_dma_init_dev, NULL);
293-
}
294205
omap_arch_initcall(omap2_system_dma_init);

arch/arm/mach-omap2/omap_device.c

Lines changed: 0 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -373,176 +373,6 @@ void omap_device_delete(struct omap_device *od)
373373
kfree(od);
374374
}
375375

376-
/**
377-
* omap_device_copy_resources - Add legacy IO and IRQ resources
378-
* @oh: interconnect target module
379-
* @pdev: platform device to copy resources to
380-
*
381-
* We still have legacy DMA and smartreflex needing resources.
382-
* Let's populate what they need until we can eventually just
383-
* remove this function. Note that there should be no need to
384-
* call this from omap_device_build_from_dt(), nor should there
385-
* be any need to call it for other devices.
386-
*/
387-
static int
388-
omap_device_copy_resources(struct omap_hwmod *oh,
389-
struct platform_device *pdev)
390-
{
391-
struct device_node *np, *child;
392-
struct property *prop;
393-
struct resource *res;
394-
const char *name;
395-
int error, irq = 0;
396-
397-
if (!oh || !oh->od || !oh->od->pdev)
398-
return -EINVAL;
399-
400-
np = oh->od->pdev->dev.of_node;
401-
if (!np) {
402-
error = -ENODEV;
403-
goto error;
404-
}
405-
406-
res = kcalloc(2, sizeof(*res), GFP_KERNEL);
407-
if (!res)
408-
return -ENOMEM;
409-
410-
/* Do we have a dts range for the interconnect target module? */
411-
error = omap_hwmod_parse_module_range(oh, np, res);
412-
413-
/* No ranges, rely on device reg entry */
414-
if (error)
415-
error = of_address_to_resource(np, 0, res);
416-
if (error)
417-
goto free;
418-
419-
/* SmartReflex needs first IO resource name to be "mpu" */
420-
res[0].name = "mpu";
421-
422-
/*
423-
* We may have a configured "ti,sysc" interconnect target with a
424-
* dts child with the interrupt. If so use the first child's
425-
* first interrupt for "ti-hwmods" legacy support.
426-
*/
427-
of_property_for_each_string(np, "compatible", prop, name)
428-
if (!strncmp("ti,sysc-", name, 8))
429-
break;
430-
431-
child = of_get_next_available_child(np, NULL);
432-
433-
if (name)
434-
irq = irq_of_parse_and_map(child, 0);
435-
if (!irq)
436-
irq = irq_of_parse_and_map(np, 0);
437-
if (!irq) {
438-
error = -EINVAL;
439-
goto free;
440-
}
441-
442-
/* Legacy DMA code needs interrupt name to be "0" */
443-
res[1].start = irq;
444-
res[1].end = irq;
445-
res[1].flags = IORESOURCE_IRQ;
446-
res[1].name = "0";
447-
448-
error = platform_device_add_resources(pdev, res, 2);
449-
450-
free:
451-
kfree(res);
452-
453-
error:
454-
WARN(error, "%s: %s device %s failed: %i\n",
455-
__func__, oh->name, dev_name(&pdev->dev),
456-
error);
457-
458-
return error;
459-
}
460-
461-
/**
462-
* omap_device_build - build and register an omap_device with one omap_hwmod
463-
* @pdev_name: name of the platform_device driver to use
464-
* @pdev_id: this platform_device's connection ID
465-
* @oh: ptr to the single omap_hwmod that backs this omap_device
466-
* @pdata: platform_data ptr to associate with the platform_device
467-
* @pdata_len: amount of memory pointed to by @pdata
468-
*
469-
* Convenience function for building and registering a single
470-
* omap_device record, which in turn builds and registers a
471-
* platform_device record. See omap_device_build_ss() for more
472-
* information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
473-
* passes along the return value of omap_device_build_ss().
474-
*/
475-
struct platform_device __init *omap_device_build(const char *pdev_name,
476-
int pdev_id,
477-
struct omap_hwmod *oh,
478-
void *pdata, int pdata_len)
479-
{
480-
int ret = -ENOMEM;
481-
struct platform_device *pdev;
482-
struct omap_device *od;
483-
484-
if (!oh || !pdev_name)
485-
return ERR_PTR(-EINVAL);
486-
487-
if (!pdata && pdata_len > 0)
488-
return ERR_PTR(-EINVAL);
489-
490-
if (strncmp(oh->name, "smartreflex", 11) &&
491-
strncmp(oh->name, "dma", 3)) {
492-
pr_warn("%s need to update %s to probe with dt\na",
493-
__func__, pdev_name);
494-
ret = -ENODEV;
495-
goto odbs_exit;
496-
}
497-
498-
pdev = platform_device_alloc(pdev_name, pdev_id);
499-
if (!pdev) {
500-
ret = -ENOMEM;
501-
goto odbs_exit;
502-
}
503-
504-
/* Set the dev_name early to allow dev_xxx in omap_device_alloc */
505-
if (pdev->id != -1)
506-
dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
507-
else
508-
dev_set_name(&pdev->dev, "%s", pdev->name);
509-
510-
/*
511-
* Must be called before omap_device_alloc() as oh->od
512-
* only contains the currently registered omap_device
513-
* and will get overwritten by omap_device_alloc().
514-
*/
515-
ret = omap_device_copy_resources(oh, pdev);
516-
if (ret)
517-
goto odbs_exit1;
518-
519-
od = omap_device_alloc(pdev, &oh, 1);
520-
if (IS_ERR(od)) {
521-
ret = PTR_ERR(od);
522-
goto odbs_exit1;
523-
}
524-
525-
ret = platform_device_add_data(pdev, pdata, pdata_len);
526-
if (ret)
527-
goto odbs_exit2;
528-
529-
ret = omap_device_register(pdev);
530-
if (ret)
531-
goto odbs_exit2;
532-
533-
return pdev;
534-
535-
odbs_exit2:
536-
omap_device_delete(od);
537-
odbs_exit1:
538-
platform_device_put(pdev);
539-
odbs_exit:
540-
541-
pr_err("omap_device: %s: build failed (%d)\n", pdev_name, ret);
542-
543-
return ERR_PTR(ret);
544-
}
545-
546376
#ifdef CONFIG_PM
547377
static int _od_runtime_suspend(struct device *dev)
548378
{

arch/arm/mach-omap2/omap_device.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ int omap_device_idle(struct platform_device *pdev);
6868

6969
/* Core code interface */
7070

71-
struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
72-
struct omap_hwmod *oh, void *pdata,
73-
int pdata_len);
74-
7571
struct omap_device *omap_device_alloc(struct platform_device *pdev,
7672
struct omap_hwmod **ohs, int oh_cnt);
7773
void omap_device_delete(struct omap_device *od);

0 commit comments

Comments
 (0)