diff options
Diffstat (limited to 'target/linux/layerscape/patches-4.14/708-mc-bus-support-layerscape.patch')
-rw-r--r-- | target/linux/layerscape/patches-4.14/708-mc-bus-support-layerscape.patch | 154 |
1 files changed, 83 insertions, 71 deletions
diff --git a/target/linux/layerscape/patches-4.14/708-mc-bus-support-layerscape.patch b/target/linux/layerscape/patches-4.14/708-mc-bus-support-layerscape.patch index 8d2ba1a193..129b8ecc64 100644 --- a/target/linux/layerscape/patches-4.14/708-mc-bus-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/708-mc-bus-support-layerscape.patch @@ -1,10 +1,15 @@ -From 2aaf8e8caef3ec4c2c155421f62f983892c49387 Mon Sep 17 00:00:00 2001 +From ab58c737bc723f52e787e1767bbbf0fcbe39a27b Mon Sep 17 00:00:00 2001 From: Biwen Li <biwen.li@nxp.com> -Date: Fri, 16 Nov 2018 12:20:04 +0800 -Subject: [PATCH 13/39] mc-bus: support layerscape +Date: Wed, 17 Apr 2019 18:58:43 +0800 +Subject: [PATCH] mc-bus: support layerscape +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + This is an integrated patch of mc-bus for layerscape Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com> +Signed-off-by: Biwen Li <biwen.li@nxp.com> Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Cristian Sovaiala <cristian.sovaiala@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> @@ -18,9 +23,8 @@ Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Signed-off-by: Radu Alexe <radu.alexe@nxp.com> Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com> +Signed-off-by: Roy Pledge <roy.pledge@nxp.com> Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com> -Signed-off-by: Stuart Yoder <stuyoder@gmail.com> -Signed-off-by: Biwen Li <biwen.li@nxp.com> --- drivers/bus/Kconfig | 2 + drivers/bus/Makefile | 4 + @@ -30,23 +34,21 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> .../fsl-mc/bus => bus/fsl-mc}/dpcon.c | 103 +- drivers/bus/fsl-mc/dpmcp.c | 99 ++ .../fsl-mc/bus => bus/fsl-mc}/dprc-driver.c | 96 +- - .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c | 288 +---- - .../bus => bus/fsl-mc}/fsl-mc-allocator.c | 112 +- - .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c | 305 ++++- + .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c | 289 +---- + .../bus => bus/fsl-mc}/fsl-mc-allocator.c | 123 +- + .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c | 322 +++++- .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c | 16 +- drivers/bus/fsl-mc/fsl-mc-private.h | 223 ++++ drivers/bus/fsl-mc/fsl-mc-restool.c | 219 ++++ - .../fsl-mc/bus => bus/fsl-mc}/mc-io.c | 36 +- + .../fsl-mc/bus => bus/fsl-mc}/mc-io.c | 51 +- .../fsl-mc/bus => bus/fsl-mc}/mc-sys.c | 33 +- drivers/irqchip/Kconfig | 6 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c | 98 ++ - drivers/staging/fsl-dpaa2/ethernet/README | 2 +- .../staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +- .../staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 3 +- drivers/staging/fsl-dpaa2/ethernet/dpni.c | 2 +- - drivers/staging/fsl-mc/TODO | 18 - - drivers/staging/fsl-mc/bus/Kconfig | 16 +- + drivers/staging/fsl-mc/bus/Kconfig | 15 +- drivers/staging/fsl-mc/bus/Makefile | 13 - drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 2 +- .../staging/fsl-mc/bus/dpio/dpio-service.c | 2 +- @@ -57,9 +59,9 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> drivers/staging/fsl-mc/bus/dprc-cmd.h | 451 -------- drivers/staging/fsl-mc/bus/dprc.h | 268 ----- .../fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 1 + - include/linux/fsl/mc.h | 1020 +++++++++++++++++ + include/linux/fsl/mc.h | 1029 +++++++++++++++++ include/uapi/linux/fsl_mc.h | 31 + - 37 files changed, 2255 insertions(+), 1546 deletions(-) + 35 files changed, 2302 insertions(+), 1531 deletions(-) create mode 100644 drivers/bus/fsl-mc/Kconfig create mode 100644 drivers/bus/fsl-mc/Makefile rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (67%) @@ -68,14 +70,13 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (93%) rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (68%) rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (84%) - rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (76%) + rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (75%) rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (96%) create mode 100644 drivers/bus/fsl-mc/fsl-mc-private.h create mode 100644 drivers/bus/fsl-mc/fsl-mc-restool.c rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (89%) rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (90%) create mode 100644 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c - delete mode 100644 drivers/staging/fsl-mc/TODO delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h @@ -3618,7 +3619,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> -} --- /dev/null +++ b/drivers/bus/fsl-mc/dprc.c -@@ -0,0 +1,575 @@ +@@ -0,0 +1,576 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. @@ -4123,10 +4124,11 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + + /* retrieve response parameters */ + rsp_params = (struct dprc_rsp_get_obj_region *)cmd.params; -+ region_desc->base_offset = le32_to_cpu(rsp_params->base_addr); ++ region_desc->base_offset = le32_to_cpu(rsp_params->base_offset); + region_desc->size = le32_to_cpu(rsp_params->size); + region_desc->type = rsp_params->type; + region_desc->flags = le32_to_cpu(rsp_params->flags); ++ region_desc->base_address = le64_to_cpu(rsp_params->base_addr); + + return 0; +} @@ -4862,7 +4864,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> -} --- /dev/null +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c -@@ -0,0 +1,655 @@ +@@ -0,0 +1,666 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * fsl-mc object allocator driver @@ -5160,6 +5162,14 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + if (!mc_adev) + goto error; + ++ mc_adev->consumer_link = device_link_add(&mc_dev->dev, ++ &mc_adev->dev, ++ DL_FLAG_AUTOREMOVE_CONSUMER); ++ if (!mc_adev->consumer_link) { ++ error = -EINVAL; ++ goto error; ++ } ++ + *new_mc_adev = mc_adev; + return 0; +error: @@ -5186,6 +5196,9 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + return; + + fsl_mc_resource_free(resource); ++ ++ device_link_del(mc_adev->consumer_link); ++ mc_adev->consumer_link = NULL; +} +EXPORT_SYMBOL_GPL(fsl_mc_object_free); + @@ -6423,7 +6436,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> -postcore_initcall(fsl_mc_bus_driver_init); --- /dev/null +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c -@@ -0,0 +1,1139 @@ +@@ -0,0 +1,1148 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Freescale Management Complex (MC) bus driver @@ -7054,10 +7067,17 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + "dprc_get_obj_region() failed: %d\n", error); + goto error_cleanup_regions; + } -+ -+ error = translate_mc_addr(mc_dev, mc_region_type, -+ region_desc.base_offset, -+ ®ions[i].start); ++ /* Older MC only returned region offset and no base address ++ * If base address is in the region_desc use it otherwise ++ * revert to old mechanism ++ */ ++ if (region_desc.base_address) ++ regions[i].start = region_desc.base_address + ++ region_desc.base_offset; ++ else ++ error = translate_mc_addr(mc_dev, mc_region_type, ++ region_desc.base_offset, ++ ®ions[i].start); + if (error < 0) { + dev_err(parent_dev, + "Invalid MC offset: %#x (for %s.%d\'s region %d)\n", @@ -7071,6 +7091,8 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + regions[i].flags = IORESOURCE_IO; + if (region_desc.flags & DPRC_REGION_CACHEABLE) + regions[i].flags |= IORESOURCE_CACHEABLE; ++ if (region_desc.flags & DPRC_REGION_SHAREABLE) ++ regions[i].flags |= IORESOURCE_MEM; + } + + mc_dev->regions = regions; @@ -8884,7 +8906,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> -EXPORT_SYMBOL_GPL(fsl_mc_portal_reset); --- /dev/null +++ b/drivers/bus/fsl-mc/mc-io.c -@@ -0,0 +1,268 @@ +@@ -0,0 +1,281 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * Copyright 2013-2016 Freescale Semiconductor Inc. @@ -9057,7 +9079,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + struct fsl_mc_resource *resource = NULL; + struct fsl_mc_io *mc_io = NULL; + -+ if (mc_dev->flags & FSL_MC_IS_DPRC) { ++ if (fsl_mc_is_root_dprc(&mc_dev->dev)) { + mc_bus_dev = mc_dev; + } else { + if (!dev_is_fsl_mc(mc_dev->dev.parent)) @@ -9096,9 +9118,19 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + if (error < 0) + goto error_cleanup_resource; + ++ dpmcp_dev->consumer_link = device_link_add(&mc_dev->dev, ++ &dpmcp_dev->dev, ++ DL_FLAG_AUTOREMOVE_CONSUMER); ++ if (!dpmcp_dev->consumer_link) { ++ error = -EINVAL; ++ goto error_cleanup_mc_io; ++ } ++ + *new_mc_io = mc_io; + return 0; + ++error_cleanup_mc_io: ++ fsl_destroy_mc_io(mc_io); +error_cleanup_resource: + fsl_mc_resource_free(resource); + return error; @@ -9131,6 +9163,9 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + + fsl_destroy_mc_io(mc_io); + fsl_mc_resource_free(resource); ++ ++ device_link_del(dpmcp_dev->consumer_link); ++ dpmcp_dev->consumer_link = NULL; +} +EXPORT_SYMBOL_GPL(fsl_mc_portal_free); + @@ -9878,20 +9913,9 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> +} + +early_initcall(its_fsl_mc_msi_init); ---- a/drivers/staging/fsl-dpaa2/ethernet/README -+++ b/drivers/staging/fsl-dpaa2/ethernet/README -@@ -36,7 +36,7 @@ are treated as internal resources of oth - - For a more detailed description of the DPAA2 architecture and its object - abstractions see: -- drivers/staging/fsl-mc/README.txt -+ Documentation/networking/dpaa2/overview.rst - - Each Linux net device is built on top of a Datapath Network Interface (DPNI) - object and uses Buffer Pools (DPBPs), I/O Portals (DPIOs) and Concentrators --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c -@@ -43,7 +43,7 @@ +@@ -16,7 +16,7 @@ #include <linux/filter.h> #include <linux/atomic.h> #include <net/sock.h> @@ -9902,11 +9926,12 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h -@@ -36,11 +36,10 @@ +@@ -9,12 +9,11 @@ #include <linux/dcbnl.h> #include <linux/netdevice.h> #include <linux/if_vlan.h> +#include <linux/fsl/mc.h> + #include <linux/filter.h> #include "../../fsl-mc/include/dpaa2-io.h" #include "../../fsl-mc/include/dpaa2-fd.h" @@ -9917,7 +9942,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c -@@ -32,7 +32,7 @@ +@@ -4,7 +4,7 @@ */ #include <linux/kernel.h> #include <linux/errno.h> @@ -9926,30 +9951,9 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> #include "dpni.h" #include "dpni-cmd.h" ---- a/drivers/staging/fsl-mc/TODO -+++ /dev/null -@@ -1,18 +0,0 @@ --* Add at least one device driver for a DPAA2 object (child device of the -- fsl-mc bus). Most likely candidate for this is adding DPAA2 Ethernet -- driver support, which depends on drivers for several objects: DPNI, -- DPIO, DPMAC. Other pre-requisites include: -- -- * MC firmware uprev. The MC firmware upon which the fsl-mc -- bus driver and DPAA2 object drivers are based is continuing -- to evolve, so minor updates are needed to keep in sync with binary -- interface changes to the MC. -- --* Cleanup -- --Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>, --german.rivera@freescale.com, devel@driverdev.osuosl.org, --linux-kernel@vger.kernel.org -- --[1] https://lkml.org/lkml/2015/7/9/93 --[2] https://lkml.org/lkml/2015/7/7/712 --- a/drivers/staging/fsl-mc/bus/Kconfig +++ b/drivers/staging/fsl-mc/bus/Kconfig -@@ -5,16 +5,6 @@ +@@ -5,15 +5,6 @@ # Copyright (C) 2014-2016 Freescale Semiconductor, Inc. # @@ -9962,11 +9966,10 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> - architecture. The fsl-mc bus driver handles discovery of - DPAA2 objects (which are represented as Linux devices) and - binding objects to drivers. -- + config FSL_MC_DPIO tristate "QorIQ DPAA2 DPIO driver" - depends on FSL_MC_BUS -@@ -24,3 +14,9 @@ config FSL_MC_DPIO +@@ -24,3 +15,9 @@ config FSL_MC_DPIO other DPAA2 objects. This driver does not expose the DPIO objects individually, but groups them under a service layer API. @@ -10000,9 +10003,9 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> obj-$(CONFIG_FSL_MC_DPIO) += dpio/ --- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c -@@ -14,7 +14,7 @@ - #include <linux/dma-mapping.h> +@@ -15,7 +15,7 @@ #include <linux/delay.h> + #include <linux/io.h> -#include "../../include/mc.h" +#include <linux/fsl/mc.h> @@ -11005,7 +11008,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> static struct irq_chip its_msi_irq_chip = { --- /dev/null +++ b/include/linux/fsl/mc.h -@@ -0,0 +1,1020 @@ +@@ -0,0 +1,1029 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Freescale Management Complex (MC) bus public interface @@ -11208,6 +11211,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + struct fsl_mc_device_irq **irqs; + struct fsl_mc_resource *resource; + const char *driver_override; ++ struct device_link *consumer_link; +}; + +#define to_fsl_mc_device(_dev) \ @@ -11519,9 +11523,11 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + +/* DPRC command versioning */ +#define DPRC_CMD_BASE_VERSION 1 ++#define DPRC_CMD_2ND_VERSION 2 +#define DPRC_CMD_ID_OFFSET 4 + +#define DPRC_CMD(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION) ++#define DPRC_CMD_V2(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION) + +/* DPRC command IDs */ +#define DPRC_CMDID_CLOSE DPRC_CMD(0x800) @@ -11540,7 +11546,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> +#define DPRC_CMDID_GET_CONT_ID DPRC_CMD(0x830) +#define DPRC_CMDID_GET_OBJ_COUNT DPRC_CMD(0x159) +#define DPRC_CMDID_GET_OBJ DPRC_CMD(0x15A) -+#define DPRC_CMDID_GET_OBJ_REG DPRC_CMD(0x15E) ++#define DPRC_CMDID_GET_OBJ_REG DPRC_CMD_V2(0x15E) +#define DPRC_CMDID_SET_OBJ_IRQ DPRC_CMD(0x15F) + +struct dprc_cmd_open { @@ -11643,7 +11649,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + /* response word 0 */ + __le64 pad0; + /* response word 1 */ -+ __le32 base_addr; ++ __le32 base_offset; + __le32 pad1; + /* response word 2 */ + __le32 size; @@ -11651,6 +11657,9 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + u8 pad2[3]; + /* response word 3 */ + __le32 flags; ++ __le32 pad3; ++ /* response word 4 */ ++ __le64 base_addr; +}; + +struct dprc_cmd_set_obj_irq { @@ -11783,6 +11792,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> +/* Region flags */ +/* Cacheable - Indicates that region should be mapped as cacheable */ +#define DPRC_REGION_CACHEABLE 0x00000001 ++#define DPRC_REGION_SHAREABLE 0x00000002 + +/** + * enum dprc_region_type - Region type @@ -11791,7 +11801,8 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + */ +enum dprc_region_type { + DPRC_REGION_TYPE_MC_PORTAL, -+ DPRC_REGION_TYPE_QBMAN_PORTAL ++ DPRC_REGION_TYPE_QBMAN_PORTAL, ++ DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL +}; + +/** @@ -11809,6 +11820,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com> + u32 size; + u32 flags; + enum dprc_region_type type; ++ u64 base_address; +}; + +int dprc_get_obj_region(struct fsl_mc_io *mc_io, |