powerpc: implement arch_setup_pdev_archdata
We have a long standing issues with platform devices not have a valid dma_mask pointer. This hasn't been an issue to date as no platform device has tried to set its dma_mask value to a non-default value. Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
This commit is contained in:
parent
a77ce8167c
commit
314b02f503
2 changed files with 6 additions and 26 deletions
|
@ -709,29 +709,9 @@ void ppc_printk_progress(char *s, unsigned short hex)
|
||||||
pr_info("%s\n", s);
|
pr_info("%s\n", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ppc_dflt_bus_notify(struct notifier_block *nb,
|
void arch_setup_pdev_archdata(struct platform_device *pdev)
|
||||||
unsigned long action, void *data)
|
|
||||||
{
|
{
|
||||||
struct device *dev = data;
|
pdev->archdata.dma_mask = DMA_BIT_MASK(32);
|
||||||
|
pdev->dev.dma_mask = &pdev->archdata.dma_mask;
|
||||||
/* We are only intereted in device addition */
|
set_dma_ops(&pdev->dev, &dma_direct_ops);
|
||||||
if (action != BUS_NOTIFY_ADD_DEVICE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
set_dma_ops(dev, &dma_direct_ops);
|
|
||||||
|
|
||||||
return NOTIFY_DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct notifier_block ppc_dflt_plat_bus_notifier = {
|
|
||||||
.notifier_call = ppc_dflt_bus_notify,
|
|
||||||
.priority = INT_MAX,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init setup_bus_notifier(void)
|
|
||||||
{
|
|
||||||
bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arch_initcall(setup_bus_notifier);
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->dev.of_node = of_node_get(np);
|
dev->dev.of_node = of_node_get(np);
|
||||||
#if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
|
#if defined(CONFIG_MICROBLAZE)
|
||||||
dev->dev.dma_mask = &dev->archdata.dma_mask;
|
dev->dev.dma_mask = &dev->archdata.dma_mask;
|
||||||
#endif
|
#endif
|
||||||
dev->dev.parent = parent;
|
dev->dev.parent = parent;
|
||||||
|
@ -189,7 +189,7 @@ struct platform_device *of_platform_device_create(struct device_node *np,
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
|
#if defined(CONFIG_MICROBLAZE)
|
||||||
dev->archdata.dma_mask = 0xffffffffUL;
|
dev->archdata.dma_mask = 0xffffffffUL;
|
||||||
#endif
|
#endif
|
||||||
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
||||||
|
|
Loading…
Reference in a new issue