lkml.org 
[lkml]   [2023]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 6/7] of/platform: Skip coresight etm4x devices from AMBA bus
    Date
    Allow other drivers to claim a device, disregarding the "priority" of
    "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO
    (AMBA Bus) or via CPU system instructions. The CoreSight ETM4x platform
    driver can now handle both types of devices. In order to make sure the
    driver gets to handle the "MMIO based" devices, which always had the
    "arm,primecell" compatible, we have two options :

    1) Remove the "arm,primecell" from the DTS. But this may be problematic
    for an older kernel without the support.

    2) The other option is to allow OF code to "ignore" the arm,primecell
    priority for a selected list of compatibles. This would make sure that
    both older kernels and the new kernels work fine without breaking
    the functionality. The new DTS could always have the "arm,primecell"
    removed.

    This patch implements Option (2).

    Cc: Rob Herring <robh+dt@kernel.org>
    Cc: Frank Rowand <frowand.list@gmail.com>
    Cc: Russell King (Oracle) <linux@armlinux.org.uk>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: devicetree@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Co-developed-by: Suzuki Poulose <suzuki.poulose@arm.com>
    Signed-off-by: Suzuki Poulose <suzuki.poulose@arm.com>
    Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
    ---
    drivers/of/platform.c | 10 +++++++++-
    1 file changed, 9 insertions(+), 1 deletion(-)

    diff --git a/drivers/of/platform.c b/drivers/of/platform.c
    index b2bd2e783445..59ff1a38ccaa 100644
    --- a/drivers/of/platform.c
    +++ b/drivers/of/platform.c
    @@ -325,6 +325,13 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
    return NULL;
    }

    +static const struct of_device_id of_ignore_amba_table[] = {
    +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X
    + { .compatible = "arm,coresight-etm4x" },
    +#endif
    + {} /* NULL terminated */
    +};
    +
    /**
    * of_platform_bus_create() - Create a device for a node and its children.
    * @bus: device node of the bus to instantiate
    @@ -373,7 +380,8 @@ static int of_platform_bus_create(struct device_node *bus,
    platform_data = auxdata->platform_data;
    }

    - if (of_device_is_compatible(bus, "arm,primecell")) {
    + if (of_device_is_compatible(bus, "arm,primecell") &&
    + unlikely(!of_match_node(of_ignore_amba_table, bus))) {
    /*
    * Don't return an error here to keep compatibility with older
    * device tree files.
    --
    2.25.1
    \
     
     \ /
      Last update: 2023-03-27 01:04    [W:4.188 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site