From 7b56cb1a1eeef645883d26783e8e8e2306a0e334 Mon Sep 17 00:00:00 2001 From: Alison Wang Date: Wed, 13 May 2015 09:46:13 +0800 Subject: arm: ls1021a: add platform notifier for dma-coherent requirement This patch adds platform notifier for dma-coherent requirement. Structure arm_coherent_dma_ops is used instead of arm_dma_ops. Signed-off-by: Alison Wang Change-Id: I55e755b5ead1cb50ff9ca2e6838588a04e5ea9e7 Reviewed-on: http://git.am.freescale.net:8181/36291 Tested-by: Review Code-CDREVIEW Reviewed-by: Claudiu Manoil Reviewed-by: Zhengxiong Jin diff --git a/arch/arm/mach-imx/mach-ls1021a.c b/arch/arm/mach-imx/mach-ls1021a.c index 3692dd0..dbb0256 100644 --- a/arch/arm/mach-imx/mach-ls1021a.c +++ b/arch/arm/mach-imx/mach-ls1021a.c @@ -10,13 +10,36 @@ #include #include #include +#include #include #include #include "common.h" +static int ls1021a_platform_notifier(struct notifier_block *nb, + unsigned long event, void *__dev) +{ + struct device *dev = __dev; + + if (event != BUS_NOTIFY_ADD_DEVICE) + return NOTIFY_DONE; + + if (of_device_is_compatible(dev->of_node, "fsl,etsec2")) + set_dma_ops(dev, &arm_coherent_dma_ops); + else if (of_property_read_bool(dev->of_node, "dma-coherent")) + set_dma_ops(dev, &arm_coherent_dma_ops); + + return NOTIFY_OK; +} + +static struct notifier_block ls1021a_platform_nb = { + .notifier_call = ls1021a_platform_notifier, +}; + static void __init ls1021a_init_machine(void) { + bus_register_notifier(&platform_bus_type, &ls1021a_platform_nb); + mxc_arch_reset_init_dt(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } -- cgit v0.10.2