diff options
author | Bogdan Purcareata <bogdan.purcareata@nxp.com> | 2018-02-05 08:07:42 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-22 15:10:50 +0100 |
commit | 6bd067c48efed50ac0200c4a83a415bd524254e0 (patch) | |
tree | 5c89f752c11aff0a51fccbd36098e939800c3f2b /drivers | |
parent | 281377cc66137febf3051bf70c506aca99bbc508 (diff) |
staging: fsl-mc: Move core bus out of staging
Move the source files out of staging into their final locations:
-mc.h include file in drivers/staging/fsl-mc/include go to include/linux/fsl
-source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
-overview.rst, providing an overview of DPAA2, goes to
Documentation/networking/dpaa2/overview.rst
Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.
Add integration bits for the documentation build system.
Signed-off-by: Stuart Yoder <stuyoder@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
27 files changed, 59 insertions, 915 deletions
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index 57e011d36a79..769599bc1bab 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -199,4 +199,6 @@ config DA8XX_MSTPRI configuration. Allows to adjust the priorities of all master peripherals. +source "drivers/bus/fsl-mc/Kconfig" + endmenu diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index 9bcd0bf3954b..b666c49f249e 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -8,6 +8,10 @@ obj-$(CONFIG_ARM_CCI) += arm-cci.o obj-$(CONFIG_ARM_CCN) += arm-ccn.o obj-$(CONFIG_BRCMSTB_GISB_ARB) += brcmstb_gisb.o + +# DPAA2 fsl-mc bus +obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/ + obj-$(CONFIG_IMX_WEIM) += imx-weim.o obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o obj-$(CONFIG_MVEBU_MBUS) += mvebu-mbus.o diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig new file mode 100644 index 000000000000..bcca64486fd3 --- /dev/null +++ b/drivers/bus/fsl-mc/Kconfig @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# DPAA2 fsl-mc bus +# +# Copyright (C) 2014-2016 Freescale Semiconductor, Inc. +# + +config FSL_MC_BUS + bool "QorIQ DPAA2 fsl-mc bus driver" + depends on OF && (ARCH_LAYERSCAPE || (COMPILE_TEST && (ARM || ARM64 || X86 || PPC))) + select GENERIC_MSI_IRQ_DOMAIN + help + Driver to enable the bus infrastructure for the QorIQ DPAA2 + architecture. The fsl-mc bus driver handles discovery of + DPAA2 objects (which are represented as Linux devices) and + binding objects to drivers. diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile new file mode 100644 index 000000000000..6a97f2c3a065 --- /dev/null +++ b/drivers/bus/fsl-mc/Makefile @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Freescale Management Complex (MC) bus drivers +# +# Copyright (C) 2014 Freescale Semiconductor, Inc. +# +obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o + +mc-bus-driver-objs := fsl-mc-bus.o \ + mc-sys.o \ + mc-io.o \ + dprc.o \ + dprc-driver.o \ + fsl-mc-allocator.o \ + fsl-mc-msi.o \ + dpmcp.o diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c b/drivers/bus/fsl-mc/dpmcp.c index be07c77520af..8d997b0f6ba3 100644 --- a/drivers/staging/fsl-mc/bus/dpmcp.c +++ b/drivers/bus/fsl-mc/dpmcp.c @@ -4,7 +4,7 @@ * */ #include <linux/kernel.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c index b09075731e62..52c7e15143d6 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/bus/fsl-mc/dprc-driver.c @@ -11,7 +11,7 @@ #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/msi.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/dprc.c b/drivers/bus/fsl-mc/dprc.c index 97f51726fa7e..5c23e8d4ddb3 100644 --- a/drivers/staging/fsl-mc/bus/dprc.c +++ b/drivers/bus/fsl-mc/dprc.c @@ -4,7 +4,8 @@ * */ #include <linux/kernel.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> + #include "fsl-mc-private.h" /** diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c index 8f313a41240b..452c5d7a12e9 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c @@ -8,7 +8,7 @@ #include <linux/module.h> #include <linux/msi.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index 1b333c43aae9..1b333c43aae9 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/bus/fsl-mc/fsl-mc-msi.c index 971ad87c584c..ec35e255b496 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/bus/fsl-mc/fsl-mc-msi.c @@ -13,6 +13,7 @@ #include <linux/irq.h> #include <linux/irqdomain.h> #include <linux/msi.h> + #include "fsl-mc-private.h" #ifdef GENERIC_MSI_DOMAIN_OPS diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h b/drivers/bus/fsl-mc/fsl-mc-private.h index 83b89d6241f2..bed990c517f3 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h +++ b/drivers/bus/fsl-mc/fsl-mc-private.h @@ -8,7 +8,7 @@ #ifndef _FSL_MC_PRIVATE_H_ #define _FSL_MC_PRIVATE_H_ -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include <linux/mutex.h> /* diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/bus/fsl-mc/mc-io.c index 7e6fb360ef12..7226cfc49b6f 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/bus/fsl-mc/mc-io.c @@ -5,7 +5,7 @@ */ #include <linux/io.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/bus/fsl-mc/mc-sys.c index f09d75d9a976..bd03f1524ecb 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/bus/fsl-mc/mc-sys.c @@ -12,7 +12,7 @@ #include <linux/device.h> #include <linux/io.h> #include <linux/io-64-nonatomic-hi-lo.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include "fsl-mc-private.h" diff --git a/drivers/staging/fsl-dpaa2/ethernet/README b/drivers/staging/fsl-dpaa2/ethernet/README index 410952ecf657..e3b5c90197e4 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/README +++ b/drivers/staging/fsl-dpaa2/ethernet/README @@ -36,7 +36,7 @@ are treated as internal resources of other objects. 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 diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 1ea5747b5f22..dc7be5388430 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -39,7 +39,7 @@ #include <linux/kthread.h> #include <linux/iommu.h> -#include "../../fsl-mc/include/mc.h" +#include <linux/fsl/mc.h> #include "dpaa2-eth.h" /* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c index e8be76181c36..b16ff5c2f8c1 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c @@ -32,7 +32,7 @@ */ #include <linux/kernel.h> #include <linux/errno.h> -#include "../../fsl-mc/include/mc.h" +#include <linux/fsl/mc.h> #include "dpni.h" #include "dpni-cmd.h" diff --git a/drivers/staging/fsl-mc/TODO b/drivers/staging/fsl-mc/TODO deleted file mode 100644 index 54a8bc69222e..000000000000 --- 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 diff --git a/drivers/staging/fsl-mc/bus/Kconfig b/drivers/staging/fsl-mc/bus/Kconfig index 1f9100049176..5f4115d76c06 100644 --- a/drivers/staging/fsl-mc/bus/Kconfig +++ b/drivers/staging/fsl-mc/bus/Kconfig @@ -5,16 +5,6 @@ # Copyright (C) 2014-2016 Freescale Semiconductor, Inc. # -config FSL_MC_BUS - bool "QorIQ DPAA2 fsl-mc bus driver" - depends on OF && (ARCH_LAYERSCAPE || (COMPILE_TEST && (ARM || ARM64 || X86 || PPC))) - select GENERIC_MSI_IRQ_DOMAIN - help - Driver to enable the bus infrastructure for the QorIQ DPAA2 - 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 && ARCH_LAYERSCAPE diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile index 29059db95ecc..18b1b5fdaf76 100644 --- a/drivers/staging/fsl-mc/bus/Makefile +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -4,19 +4,9 @@ # # Copyright (C) 2014 Freescale Semiconductor, Inc. # -obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o - -mc-bus-driver-objs := fsl-mc-bus.o \ - mc-sys.o \ - mc-io.o \ - dprc.o \ - dprc-driver.o \ - fsl-mc-allocator.o \ - fsl-mc-msi.o \ - irq-gic-v3-its-fsl-mc-msi.o \ - dpmcp.o \ - dpbp.o \ - dpcon.o +obj-$(CONFIG_FSL_MC_BUS) += irq-gic-v3-its-fsl-mc-msi.o \ + dpbp.o \ + dpcon.o # MC DPIO driver obj-$(CONFIG_FSL_MC_DPIO) += dpio/ diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/staging/fsl-mc/bus/dpbp.c index a4df84668d5b..c0addaa37f61 100644 --- a/drivers/staging/fsl-mc/bus/dpbp.c +++ b/drivers/staging/fsl-mc/bus/dpbp.c @@ -4,7 +4,7 @@ * */ #include <linux/kernel.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include "../include/dpbp.h" #include "dpbp-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/staging/fsl-mc/bus/dpcon.c index 8f84d7b5465c..021b4252eba0 100644 --- a/drivers/staging/fsl-mc/bus/dpcon.c +++ b/drivers/staging/fsl-mc/bus/dpcon.c @@ -4,7 +4,7 @@ * */ #include <linux/kernel.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> #include "../include/dpcon.h" #include "dpcon-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c index b8479ef64c71..182b38412a82 100644 --- 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> #include <linux/delay.h> -#include "../../include/mc.h" +#include <linux/fsl/mc.h> #include "../../include/dpaa2-io.h" #include "qbman-portal.h" diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c index d3c8462d43e8..1acff7ee7bb9 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c @@ -5,7 +5,7 @@ * */ #include <linux/types.h> -#include "../../include/mc.h" +#include <linux/fsl/mc.h> #include "../../include/dpaa2-io.h" #include <linux/init.h> #include <linux/module.h> diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c index 20cdeae54a74..3175057e0265 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c @@ -5,7 +5,7 @@ * */ #include <linux/kernel.h> -#include "../../include/mc.h" +#include <linux/fsl/mc.h> #include "dpio.h" #include "dpio-cmd.h" diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c index 5064d5ddf581..b365fbb00fd3 100644 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c @@ -13,7 +13,7 @@ #include <linux/msi.h> #include <linux/of.h> #include <linux/of_irq.h> -#include "../include/mc.h" +#include <linux/fsl/mc.h> static struct irq_chip its_msi_irq_chip = { .name = "ITS-fMSI", diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h deleted file mode 100644 index 765ba41f5987..000000000000 --- a/drivers/staging/fsl-mc/include/mc.h +++ /dev/null @@ -1,454 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Freescale Management Complex (MC) bus public interface - * - * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. - * Author: German Rivera <German.Rivera@freescale.com> - * - */ -#ifndef _FSL_MC_H_ -#define _FSL_MC_H_ - -#include <linux/device.h> -#include <linux/mod_devicetable.h> -#include <linux/interrupt.h> - -#define FSL_MC_VENDOR_FREESCALE 0x1957 - -struct irq_domain; -struct msi_domain_info; - -struct fsl_mc_device; -struct fsl_mc_io; - -/** - * struct fsl_mc_driver - MC object device driver object - * @driver: Generic device driver - * @match_id_table: table of supported device matching Ids - * @probe: Function called when a device is added - * @remove: Function called when a device is removed - * @shutdown: Function called at shutdown time to quiesce the device - * @suspend: Function called when a device is stopped - * @resume: Function called when a device is resumed - * - * Generic DPAA device driver object for device drivers that are registered - * with a DPRC bus. This structure is to be embedded in each device-specific - * driver structure. - */ -struct fsl_mc_driver { - struct device_driver driver; - const struct fsl_mc_device_id *match_id_table; - int (*probe)(struct fsl_mc_device *dev); - int (*remove)(struct fsl_mc_device *dev); - void (*shutdown)(struct fsl_mc_device *dev); - int (*suspend)(struct fsl_mc_device *dev, pm_message_t state); - int (*resume)(struct fsl_mc_device *dev); -}; - -#define to_fsl_mc_driver(_drv) \ - container_of(_drv, struct fsl_mc_driver, driver) - -/** - * enum fsl_mc_pool_type - Types of allocatable MC bus resources - * - * Entries in these enum are used as indices in the array of resource - * pools of an fsl_mc_bus object. - */ -enum fsl_mc_pool_type { - FSL_MC_POOL_DPMCP = 0x0, /* corresponds to "dpmcp" in the MC */ - FSL_MC_POOL_DPBP, /* corresponds to "dpbp" in the MC */ - FSL_MC_POOL_DPCON, /* corresponds to "dpcon" in the MC */ - FSL_MC_POOL_IRQ, - - /* - * NOTE: New resource pool types must be added before this entry - */ - FSL_MC_NUM_POOL_TYPES -}; - -/** - * struct fsl_mc_resource - MC generic resource - * @type: type of resource - * @id: unique MC resource Id within the resources of the same type - * @data: pointer to resource-specific data if the resource is currently - * allocated, or NULL if the resource is not currently allocated. - * @parent_pool: pointer to the parent resource pool from which this - * resource is allocated from. - * @node: Node in the free list of the corresponding resource pool - * - * NOTE: This structure is to be embedded as a field of specific - * MC resource structures. - */ -struct fsl_mc_resource { - enum fsl_mc_pool_type type; - s32 id; - void *data; - struct fsl_mc_resource_pool *parent_pool; - struct list_head node; -}; - -/** - * struct fsl_mc_device_irq - MC object device message-based interrupt - * @msi_desc: pointer to MSI descriptor allocated by fsl_mc_msi_alloc_descs() - * @mc_dev: MC object device that owns this interrupt - * @dev_irq_index: device-relative IRQ index - * @resource: MC generic resource associated with the interrupt - */ -struct fsl_mc_device_irq { - struct msi_desc *msi_desc; - struct fsl_mc_device *mc_dev; - u8 dev_irq_index; - struct fsl_mc_resource resource; -}; - -#define to_fsl_mc_irq(_mc_resource) \ - container_of(_mc_resource, struct fsl_mc_device_irq, resource) - -/* Opened state - Indicates that an object is open by at least one owner */ -#define FSL_MC_OBJ_STATE_OPEN 0x00000001 -/* Plugged state - Indicates that the object is plugged */ -#define FSL_MC_OBJ_STATE_PLUGGED 0x00000002 - -/** - * Shareability flag - Object flag indicating no memory shareability. - * the object generates memory accesses that are non coherent with other - * masters; - * user is responsible for proper memory handling through IOMMU configuration. - */ -#define FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 - -/** - * struct fsl_mc_obj_desc - Object descriptor - * @type: Type of object: NULL terminated string - * @id: ID of logical object resource - * @vendor: Object vendor identifier - * @ver_major: Major version number - * @ver_minor: Minor version number - * @irq_count: Number of interrupts supported by the object - * @region_count: Number of mappable regions supported by the object - * @state: Object state: combination of FSL_MC_OBJ_STATE_ states - * @label: Object label: NULL terminated string - * @flags: Object's flags - */ -struct fsl_mc_obj_desc { - char type[16]; - int id; - u16 vendor; - u16 ver_major; - u16 ver_minor; - u8 irq_count; - u8 region_count; - u32 state; - char label[16]; - u16 flags; -}; - -/** - * Bit masks for a MC object device (struct fsl_mc_device) flags - */ -#define FSL_MC_IS_DPRC 0x0001 - -/** - * struct fsl_mc_device - MC object device object - * @dev: Linux driver model device object - * @dma_mask: Default DMA mask - * @flags: MC object device flags - * @icid: Isolation context ID for the device - * @mc_handle: MC handle for the corresponding MC object opened - * @mc_io: Pointer to MC IO object assigned to this device or - * NULL if none. - * @obj_desc: MC description of the DPAA device - * @regions: pointer to array of MMIO region entries - * @irqs: pointer to array of pointers to interrupts allocated to this device - * @resource: generic resource associated with this MC object device, if any. - * - * Generic device object for MC object devices that are "attached" to a - * MC bus. - * - * NOTES: - * - For a non-DPRC object its icid is the same as its parent DPRC's icid. - * - The SMMU notifier callback gets invoked after device_add() has been - * called for an MC object device, but before the device-specific probe - * callback gets called. - * - DP_OBJ_DPRC objects are the only MC objects that have built-in MC - * portals. For all other MC objects, their device drivers are responsible for - * allocating MC portals for them by calling fsl_mc_portal_allocate(). - * - Some types of MC objects (e.g., DP_OBJ_DPBP, DP_OBJ_DPCON) are - * treated as resources that can be allocated/deallocated from the - * corresponding resource pool in the object's parent DPRC, using the - * fsl_mc_object_allocate()/fsl_mc_object_free() functions. These MC objects - * are known as "allocatable" objects. For them, the corresponding - * fsl_mc_device's 'resource' points to the associated resource object. - * For MC objects that are not allocatable (e.g., DP_OBJ_DPRC, DP_OBJ_DPNI), - * 'resource' is NULL. - */ -struct fsl_mc_device { - struct device dev; - u64 dma_mask; - u16 flags; - u16 icid; - u16 mc_handle; - struct fsl_mc_io *mc_io; - struct fsl_mc_obj_desc obj_desc; - struct resource *regions; - struct fsl_mc_device_irq **irqs; - struct fsl_mc_resource *resource; -}; - -#define to_fsl_mc_device(_dev) \ - container_of(_dev, struct fsl_mc_device, dev) - -#define MC_CMD_NUM_OF_PARAMS 7 - -struct mc_cmd_header { - u8 src_id; - u8 flags_hw; - u8 status; - u8 flags_sw; - __le16 token; - __le16 cmd_id; -}; - -struct mc_command { - u64 header; - u64 params[MC_CMD_NUM_OF_PARAMS]; -}; - -enum mc_cmd_status { - MC_CMD_STATUS_OK = 0x0, /* Completed successfully */ - MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */ - MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */ - MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */ - MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */ - MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */ - MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */ - MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */ - MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */ - MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */ - MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */ - MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ -}; - -/* - * MC command flags - */ - -/* High priority flag */ -#define MC_CMD_FLAG_PRI 0x80 -/* Command completion flag */ -#define MC_CMD_FLAG_INTR_DIS 0x01 - -static inline u64 mc_encode_cmd_header(u16 cmd_id, - u32 cmd_flags, - u16 token) -{ - u64 header = 0; - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header; - - hdr->cmd_id = cpu_to_le16(cmd_id); - hdr->token = cpu_to_le16(token); - hdr->status = MC_CMD_STATUS_READY; - if (cmd_flags & MC_CMD_FLAG_PRI) - hdr->flags_hw = MC_CMD_FLAG_PRI; - if (cmd_flags & MC_CMD_FLAG_INTR_DIS) - hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; - - return header; -} - -static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd) -{ - struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; - u16 token = le16_to_cpu(hdr->token); - - return token; -} - -struct mc_rsp_create { - __le32 object_id; -}; - -struct mc_rsp_api_ver { - __le16 major_ver; - __le16 minor_ver; -}; - -static inline u32 mc_cmd_read_object_id(struct mc_command *cmd) -{ - struct mc_rsp_create *rsp_params; - - rsp_params = (struct mc_rsp_create *)cmd->params; - return le32_to_cpu(rsp_params->object_id); -} - -static inline void mc_cmd_read_api_version(struct mc_command *cmd, - u16 *major_ver, - u16 *minor_ver) -{ - struct mc_rsp_api_ver *rsp_params; - - rsp_params = (struct mc_rsp_api_ver *)cmd->params; - *major_ver = le16_to_cpu(rsp_params->major_ver); - *minor_ver = le16_to_cpu(rsp_params->minor_ver); -} - -/** - * Bit masks for a MC I/O object (struct fsl_mc_io) flags - */ -#define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001 - -/** - * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command() - * @dev: device associated with this Mc I/O object - * @flags: flags for mc_send_command() - * @portal_size: MC command portal size in bytes - * @portal_phys_addr: MC command portal physical address - * @portal_virt_addr: MC command portal virtual address - * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not - * set: - * @mutex: Mutex to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this - * fsl_mc_io object must be made only from non-atomic context. - * - * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is - * set: - * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC - * portal, if the fsl_mc_io object was created with the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this - * fsl_mc_io object can be made from atomic or non-atomic context. - */ -struct fsl_mc_io { - struct device *dev; - u16 flags; - u32 portal_size; - phys_addr_t portal_phys_addr; - void __iomem *portal_virt_addr; - struct fsl_mc_device *dpmcp_dev; - union { - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set - */ - struct mutex mutex; /* serializes mc_send_command() */ - - /* - * This field is only meaningful if the - * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set - */ - spinlock_t spinlock; /* serializes mc_send_command() */ - }; -}; - -int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); - -#ifdef CONFIG_FSL_MC_BUS -#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type) -#else -/* If fsl-mc bus is not present device cannot belong to fsl-mc bus */ -#define dev_is_fsl_mc(_dev) (0) -#endif - -/* - * module_fsl_mc_driver() - Helper macro for drivers that don't do - * anything special in module init/exit. This eliminates a lot of - * boilerplate. Each module may only use this macro once, and - * calling it replaces module_init() and module_exit() - */ -#define module_fsl_mc_driver(__fsl_mc_driver) \ - module_driver(__fsl_mc_driver, fsl_mc_driver_register, \ - fsl_mc_driver_unregister) - -/* - * Macro to avoid include chaining to get THIS_MODULE - */ -#define fsl_mc_driver_register(drv) \ - __fsl_mc_driver_register(drv, THIS_MODULE) - -int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver, - struct module *owner); - -void fsl_mc_driver_unregister(struct fsl_mc_driver *driver); - -int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev, - u16 mc_io_flags, - struct fsl_mc_io **new_mc_io); - -void fsl_mc_portal_free(struct fsl_mc_io *mc_io); - -int fsl_mc_portal_reset(struct fsl_mc_io *mc_io); - -int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, - enum fsl_mc_pool_type pool_type, - struct fsl_mc_device **new_mc_adev); - -void fsl_mc_object_free(struct fsl_mc_device *mc_adev); - -struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, - struct msi_domain_info *info, - struct irq_domain *parent); - -int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); - -void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); - -extern struct bus_type fsl_mc_bus_type; - -extern struct device_type fsl_mc_bus_dprc_type; -extern struct device_type fsl_mc_bus_dpni_type; -extern struct device_type fsl_mc_bus_dpio_type; -extern struct device_type fsl_mc_bus_dpsw_type; -extern struct device_type fsl_mc_bus_dpbp_type; -extern struct device_type fsl_mc_bus_dpcon_type; -extern struct device_type fsl_mc_bus_dpmcp_type; -extern struct device_type fsl_mc_bus_dpmac_type; -extern struct device_type fsl_mc_bus_dprtc_type; - -static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dprc_type; -} - -static inline bool is_fsl_mc_bus_dpni(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dpni_type; -} - -static inline bool is_fsl_mc_bus_dpio(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dpio_type; -} - -static inline bool is_fsl_mc_bus_dpsw(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dpsw_type; -} - -static inline bool is_fsl_mc_bus_dpbp(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dpbp_type; -} - -static inline bool is_fsl_mc_bus_dpcon(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dpcon_type; -} - -static inline bool is_fsl_mc_bus_dpmcp(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dpmcp_type; -} - -static inline bool is_fsl_mc_bus_dpmac(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dpmac_type; -} - -static inline bool is_fsl_mc_bus_dprtc(const struct fsl_mc_device *mc_dev) -{ - return mc_dev->dev.type == &fsl_mc_bus_dprtc_type; -} - -#endif /* _FSL_MC_H_ */ diff --git a/drivers/staging/fsl-mc/overview.rst b/drivers/staging/fsl-mc/overview.rst deleted file mode 100644 index 79fede4447d6..000000000000 --- a/drivers/staging/fsl-mc/overview.rst +++ /dev/null @@ -1,404 +0,0 @@ -.. include:: <isonum.txt> - -DPAA2 (Data Path Acceleration Architecture Gen2) Overview -========================================================= - -:Copyright: |copy| 2015 Freescale Semiconductor Inc. -:Copyright: |copy| 2018 NXP - -This document provides an overview of the Freescale DPAA2 architecture -and how it is integrated into the Linux kernel. - -Introduction -============ - -DPAA2 is a hardware architecture designed for high-speeed network -packet processing. DPAA2 consists of sophisticated mechanisms for -processing Ethernet packets, queue management, buffer management, -autonomous L2 switching, virtual Ethernet bridging, and accelerator -(e.g. crypto) sharing. - -A DPAA2 hardware component called the Management Complex (or MC) manages the -DPAA2 hardware resources. The MC provides an object-based abstraction for -software drivers to use the DPAA2 hardware. -The MC uses DPAA2 hardware resources such as queues, buffer pools, and -network ports to create functional objects/devices such as network -interfaces, an L2 switch, or accelerator instances. -The MC provides memory-mapped I/O command interfaces (MC portals) -which DPAA2 software drivers use to operate on DPAA2 objects. - -The diagram below shows an overview of the DPAA2 resource management -architecture:: - - +--------------------------------------+ - | OS | - | DPAA2 drivers | - | | | - +-----------------------------|--------+ - | - | (create,discover,connect - | config,use,destroy) - | - DPAA2 | - +------------------------| mc portal |-+ - | | | - | +- - - - - - - - - - - - -V- - -+ | - | | | | - | | Management Complex (MC) | | - | | | | - | +- - - - - - - - - - - - - - - -+ | - | | - | Hardware Hardware | - | Resources Objects | - | --------- ------- | - | -queues -DPRC | - | -buffer pools -DPMCP | - | -Eth MACs/ports -DPIO | - | -network interface -DPNI | - | profiles -DPMAC | - | -queue portals -DPBP | - | -MC portals ... | - | ... | - | | - +--------------------------------------+ - - -The MC mediates operations such as create, discover, -connect, configuration, and destroy. Fast-path operations -on data, such as packet transmit/receive, are not mediated by -the MC and are done directly using memory mapped regions in -DPIO objects. - -Overview of DPAA2 Objects -========================= - -The section provides a brief overview of some key DPAA2 objects. -A simple scenario is described illustrating the objects involved -in creating a network interfaces. - -DPRC (Datapath Resource Container) ----------------------------------- - -A DPRC is a container object that holds all the other -types of DPAA2 objects. In the example diagram below there -are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC) -in the container. - -:: - - +---------------------------------------------------------+ - | DPRC | - | | - | +-------+ +-------+ +-------+ +-------+ +-------+ | - | | DPMCP | | DPIO | | DPBP | | DPNI | | DPMAC | | - | +-------+ +-------+ +-------+ +---+---+ +---+---+ | - | | DPMCP | | DPIO | | - | +-------+ +-------+ | - | | DPMCP | | - | +-------+ | - | | - +---------------------------------------------------------+ - -From the point of view of an OS, a DPRC behaves similar to a plug and -play bus, like PCI. DPRC commands can be used to enumerate the contents -of the DPRC, discover the hardware objects present (including mappable -regions and interrupts). - -:: - - DPRC.1 (bus) - | - +--+--------+-------+-------+-------+ - | | | | | - DPMCP.1 DPIO.1 DPBP.1 DPNI.1 DPMAC.1 - DPMCP.2 DPIO.2 - DPMCP.3 - -Hardware objects can be created and destroyed dynamically, providing -the ability to hot plug/unplug objects in and out of the DPRC. - -A DPRC has a mappable MMIO region (an MC portal) that can be used -to send MC commands. It has an interrupt for status events (like -hotplug). -All objects in a container share the same hardware "isolation context". -This means that with respect to an IOMMU the isolation granularity -is at the DPRC (container) level, not at the individual object -level. - -DPRCs can be defined statically and populated with objects -via a config file passed to the MC when firmware starts it. - -DPAA2 Objects for an Ethernet Network Interface ------------------------------------------------ - -A typical Ethernet NIC is monolithic-- the NIC device contains TX/RX -queuing mechanisms, configuration mechanisms, buffer management, -physical ports, and interrupts. DPAA2 uses a more granular approach -utilizing multiple hardware objects. Each object provides specialized -functions. Groups of these objects are used by software to provide -Ethernet network interface functionality. This approach provides -efficient use of finite hardware resources, flexibility, and -performance advantages. - -The diagram below shows the objects needed for a simple -network interface configuration on a system with 2 CPUs. - -:: - - +---+---+ +---+---+ - CPU0 CPU1 - +---+---+ +---+---+ - | | - +---+---+ +---+---+ - DPIO DPIO - +---+---+ +---+---+ - \ / - \ / - \ / - +---+---+ - DPNI --- DPBP,DPMCP - +---+---+ - | - | - +---+---+ - DPMAC - +---+---+ - | - port/PHY - -Below the objects are described. For each object a brief description -is provided along with a summary of the kinds of operations the object -supports and a summary of key resources of the object (MMIO regions -and IRQs). - -DPMAC (Datapath Ethernet MAC) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Represents an Ethernet MAC, a hardware device that connects to an Ethernet -PHY and allows physical transmission and reception of Ethernet frames. - -- MMIO regions: none -- IRQs: DPNI link change -- commands: set link up/down, link config, get stats, - IRQ config, enable, reset - -DPNI (Datapath Network Interface) -Contains TX/RX queues, network interface configuration, and RX buffer pool -configuration mechanisms. The TX/RX queues are in memory and are identified -by queue number. - -- MMIO regions: none -- IRQs: link state -- commands: port config, offload config, queue config, - parse/classify config, IRQ config, enable, reset - -DPIO (Datapath I/O) -~~~~~~~~~~~~~~~~~~~ -Provides interfaces to enqueue and dequeue -packets and do hardware buffer pool management operations. The DPAA2 -architecture separates the mechanism to access queues (the DPIO object) -from the queues themselves. The DPIO provides an MMIO interface to -enqueue/dequeue packets. To enqueue something a descriptor is written -to the DPIO MMIO region, which includes the target queue number. -There will typically be one DPIO assigned to each CPU. This allows all -CPUs to simultaneously perform enqueue/dequeued operations. DPIOs are -expected to be shared by different DPAA2 drivers. - -- MMIO regions: queue operations, buffer management -- IRQs: data availability, congestion notification, buffer - pool depletion -- commands: IRQ config, enable, reset - -DPBP (Datapath Buffer Pool) -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Represents a hardware buffer pool. - -- MMIO regions: none -- IRQs: none -- commands: enable, reset - -DPMCP (Datapath MC Portal) -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Provides an MC command portal. -Used by drivers to send commands to the MC to manage -objects. - -- MMIO regions: MC command portal -- IRQs: command completion -- commands: IRQ config, enable, reset - -Object Connections -================== -Some objects have explicit relationships that must -be configured: - -- DPNI <--> DPMAC -- DPNI <--> DPNI -- DPNI <--> L2-switch-port - - A DPNI must be connected to something such as a DPMAC, - another DPNI, or L2 switch port. The DPNI connection - is made via a DPRC command. - -:: - - +-------+ +-------+ - | DPNI | | DPMAC | - +---+---+ +---+---+ - | | - +==========+ - -- DPNI <--> DPBP - - A network interface requires a 'buffer pool' (DPBP - object) which provides a list of pointers to memory - where received Ethernet data is to be copied. The - Ethernet driver configures the DPBPs associated with - the network interface. - -Interrupts -========== -All interrupts generated by DPAA2 objects are message -interrupts. At the hardware level message interrupts -generated by devices will normally have 3 components-- -1) a non-spoofable 'device-id' expressed on the hardware -bus, 2) an address, 3) a data value. - -In the case of DPAA2 devices/objects, all objects in the -same container/DPRC share the same 'device-id'. -For ARM-based SoC this is the same as the stream ID. - - -DPAA2 Linux Drivers Overview -============================ - -This section provides an overview of the Linux kernel drivers for -DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure" -drivers and 2) functional object drivers (such as Ethernet). - -As described previously, a DPRC is a container that holds the other -types of DPAA2 objects. It is functionally similar to a plug-and-play -bus controller. -Each object in the DPRC is a Linux "device" and is bound to a driver. -The diagram below shows the Linux drivers involved in a networking -scenario and the objects bound to each driver. A brief description -of each driver follows. - -:: - - +------------+ - | OS Network | - | Stack | - +------------+ +------------+ - | Allocator |. . . . . . . | Ethernet | - |(DPMCP,DPBP)| | (DPNI) | - +-.----------+ +---+---+----+ - . . ^ | - . . <data avail, | | <enqueue, - . . tx confirm> | | dequeue> - +-------------+ . | | - | DPRC driver | . +---+---V----+ +---------+ - | (DPRC) | . . . . . .| DPIO driver| | MAC | - +----------+--+ | (DPIO) | | (DPMAC) | - | +------+-----+ +-----+---+ - |<dev add/remove> | | - | | | - +--------+----------+ | +--+---+ - | MC-bus driver | | | PHY | - | | | |driver| - | /bus/fsl-mc | | +--+---+ - +-------------------+ | | - | | - ========================= HARDWARE =========|=================|====== - DPIO | - | | - DPNI---DPBP | - | | - DPMAC | - | | - PHY ---------------+ - ============================================|======================== - -A brief description of each driver is provided below. - -MC-bus driver -------------- -The MC-bus driver is a platform driver and is probed from a -node in the device tree (compatible "fsl,qoriq-mc") passed in by boot -firmware. It is responsible for bootstrapping the DPAA2 kernel -infrastructure. -Key functions include: - -- registering a new bus type named "fsl-mc" with the kernel, - and implementing bus call-backs (e.g. match/uevent/dev_groups) -- implementing APIs for DPAA2 driver registration and for device - add/remove -- creates an MSI IRQ domain -- doing a 'device add' to expose the 'root' DPRC, in turn triggering - a bind of the root DPRC to the DPRC driver - -The binding for the MC-bus device-tree node can be consulted at -*Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt*. -The sysfs bind/unbind interfaces for the MC-bus can be consulted at -*Documentation/ABI/testing/sysfs-bus-fsl-mc*. - -DPRC driver ------------ -The DPRC driver is bound to DPRC objects and does runtime management -of a bus instance. It performs the initial bus scan of the DPRC -and handles interrupts for container events such as hot plug by -re-scanning the DPRC. - -Allocator ---------- -Certain objects such as DPMCP and DPBP are generic and fungible, -and are intended to be used by other drivers. For example, -the DPAA2 Ethernet driver needs: - -- DPMCPs to send MC commands, to configure network interfaces -- DPBPs for network buffer pools - -The allocator driver registers for these allocatable object types -and those objects are bound to the allocator when the bus is probed. -The allocator maintains a pool of objects that are available for -allocation by other DPAA2 drivers. - -DPIO driver ------------ -The DPIO driver is bound to DPIO objects and provides services that allow -other drivers such as the Ethernet driver to enqueue and dequeue data for -their respective objects. -Key services include: - -- data availability notifications -- hardware queuing operations (enqueue and dequeue of data) -- hardware buffer pool management - -To transmit a packet the Ethernet driver puts data on a queue and -invokes a DPIO API. For receive, the Ethernet driver registers -a data availability notification callback. To dequeue a packet -a DPIO API is used. -There is typically one DPIO object per physical CPU for optimum -performance, allowing different CPUs to simultaneously enqueue -and dequeue data. - -The DPIO driver operates on behalf of all DPAA2 drivers -active in the kernel-- Ethernet, crypto, compression, -etc. - -Ethernet driver ---------------- -The Ethernet driver is bound to a DPNI and implements the kernel -interfaces needed to connect the DPAA2 network interface to -the network stack. -Each DPNI corresponds to a Linux network interface. - -MAC driver ----------- -An Ethernet PHY is an off-chip, board specific component and is managed -by the appropriate PHY driver via an mdio bus. The MAC driver -plays a role of being a proxy between the PHY driver and the -MC. It does this proxy via the MC commands to a DPMAC object. -If the PHY driver signals a link change, the MAC driver notifies -the MC via a DPMAC command. If a network interface is brought -up or down, the MC notifies the DPMAC driver via an interrupt and -the driver can take appropriate action. |