From: shawnguo@kernel.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: ls1021a: add platform notifier for dma-coherent requirement
Date: Sun, 6 Sep 2015 15:22:45 +0800 [thread overview]
Message-ID: <20150906072245.GG30746@tiger> (raw)
In-Reply-To: <1438941719-38350-1-git-send-email-b18965@freescale.com>
On Fri, Aug 07, 2015 at 06:01:59PM +0800, Alison Wang wrote:
> 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 <alison.wang@freescale.com>
> ---
> arch/arm/mach-imx/mach-ls1021a.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/arch/arm/mach-imx/mach-ls1021a.c b/arch/arm/mach-imx/mach-ls1021a.c
> index b89c858..6bfc71b 100644
> --- a/arch/arm/mach-imx/mach-ls1021a.c
> +++ b/arch/arm/mach-imx/mach-ls1021a.c
> @@ -7,10 +7,39 @@
> * (at your option) any later version.
> */
>
> +#include <linux/dma-mapping.h>
> +#include <linux/of_platform.h>
> #include <asm/mach/arch.h>
>
> #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);
Why cannot you simply add property dma-coherent for etsec2 node in
device tree? In that case, of_dma_configure() will just do the job from
of_platform_device_create_pdata().
Shawn
> + 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);
> +
> + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> +}
> +
> static const char * const ls1021a_dt_compat[] __initconst = {
> "fsl,ls1021a",
> NULL,
> @@ -18,5 +47,6 @@ static const char * const ls1021a_dt_compat[] __initconst = {
>
> DT_MACHINE_START(LS1021A, "Freescale LS1021A")
> .smp = smp_ops(ls1021a_smp_ops),
> + .init_machine = ls1021a_init_machine,
> .dt_compat = ls1021a_dt_compat,
> MACHINE_END
> --
> 2.1.0.27.g96db324
>
WARNING: multiple messages have this Message-ID (diff)
From: Shawn Guo <shawnguo@kernel.org>
To: Alison Wang <b18965@freescale.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, jason.jin@freescale.com
Subject: Re: [PATCH] ARM: ls1021a: add platform notifier for dma-coherent requirement
Date: Sun, 6 Sep 2015 15:22:45 +0800 [thread overview]
Message-ID: <20150906072245.GG30746@tiger> (raw)
In-Reply-To: <1438941719-38350-1-git-send-email-b18965@freescale.com>
On Fri, Aug 07, 2015 at 06:01:59PM +0800, Alison Wang wrote:
> 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 <alison.wang@freescale.com>
> ---
> arch/arm/mach-imx/mach-ls1021a.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/arch/arm/mach-imx/mach-ls1021a.c b/arch/arm/mach-imx/mach-ls1021a.c
> index b89c858..6bfc71b 100644
> --- a/arch/arm/mach-imx/mach-ls1021a.c
> +++ b/arch/arm/mach-imx/mach-ls1021a.c
> @@ -7,10 +7,39 @@
> * (at your option) any later version.
> */
>
> +#include <linux/dma-mapping.h>
> +#include <linux/of_platform.h>
> #include <asm/mach/arch.h>
>
> #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);
Why cannot you simply add property dma-coherent for etsec2 node in
device tree? In that case, of_dma_configure() will just do the job from
of_platform_device_create_pdata().
Shawn
> + 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);
> +
> + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> +}
> +
> static const char * const ls1021a_dt_compat[] __initconst = {
> "fsl,ls1021a",
> NULL,
> @@ -18,5 +47,6 @@ static const char * const ls1021a_dt_compat[] __initconst = {
>
> DT_MACHINE_START(LS1021A, "Freescale LS1021A")
> .smp = smp_ops(ls1021a_smp_ops),
> + .init_machine = ls1021a_init_machine,
> .dt_compat = ls1021a_dt_compat,
> MACHINE_END
> --
> 2.1.0.27.g96db324
>
next prev parent reply other threads:[~2015-09-06 7:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-07 10:01 [PATCH] ARM: ls1021a: add platform notifier for dma-coherent requirement Alison Wang
2015-08-07 10:01 ` Alison Wang
2015-09-06 7:22 ` Shawn Guo [this message]
2015-09-06 7:22 ` Shawn Guo
2015-09-07 9:45 ` Huan Wang
2015-09-07 9:45 ` Huan Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150906072245.GG30746@tiger \
--to=shawnguo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.