drivers/bus: Freescale Management Complex bus driver patch series
v2 cover drivers/bus: Freescale Management Complex bus driver patch series
This patch series introduces Linux support for the Freescale Management Complex (fsl-mc) hardware.
The fsl-mc is a hardware resource manager that manages specialized hardware objects used in network-oriented packet processing applications. After the fsl-mc block is enabled, pools of hardware resources are available, such as queues, buffer poools, I/O interfaces. These resources are building blocks that can be used to create functional hardware objects such as network interfaces, crypto accelerator instances, or L2 switches.
All the fsl-mc managed hardware resources/objects are represented in a physical grouping mechanism called a 'container' or DPRC (data path resource container).
Quoted 1 line
From the point of view of an OS, a DPRC functions similar to a plug
and play bus. Using fsl-mc commands software can enumerate the contents of the DPRC discovering the hardware objects present and binding them to drivers. Hardware objects can be created and removed dynamically, providing hot pluggability of the hardware objects.
Software contexts interact with the fsl-mc by sending commands through a memory mapped hardware interface called an "MC portal". Every fsl-mc object type has a command set to manage the objects. Key DPRC commands include:
-create/destroy a DPRC
-enumerate objects and resource pools in the DPRC, including
identifying mappable regions and the number of IRQs an object may have
-IRQ configuration
-move objects/resources between DPRCs
-connecting objects (e.g. connecting a network interface to
an L2 switch port)
-reset
Patch 1 contains a minimal set of low level functions to send an d receive commands to the fsl-mc. It includes support for basic management commands and commands to manipulate DPRC objects.
Patch 2 contains a platform device driver that sets up and registers the basic bus infrastructure including support for adding/removing devices, register/unregister of drivers, and bus match support to bind devices to drivers.
Patch 3 contains an driver that manages DPRC objects (the container that holds the hardware resources). This driver functions as a bus controller and handles enumeration of the objects in the container and hotplug events.
Patch 4 contains the update to the MAINTAINERS file.
RFC PATCH v2 1/4 drivers/bus: Added Freescale Management Complex APIs
From: "J. German Rivera" <[email protected]>
APIs to access the Management Complex (MC) hardware module of Freescale LS2 SoCs. This patch includes APIs to check the MC firmware version and to manipulate DPRC objects in the MC.
--- drivers/bus/fsl-mc/dpmng.c | 93 +++++ drivers/bus/fsl-mc/dprc.c | 504 +++++++++++++++++++++++ drivers/bus/fsl-mc/fsl_dpmng_cmd.h | 83 ++++ drivers/bus/fsl-mc/fsl_dprc_cmd.h | 545 +++++++++++++++++++++++++ drivers/bus/fsl-mc/mc_sys.c | 207 ++++++++++ include/linux/fsl_dpmng.h | 120 ++++++ include/linux/fsl_dprc.h | 790 ++++++++++++++++++++++++++++++++++++ include/linux/fsl_mc_cmd.h | 182 +++++++++ include/linux/fsl_mc_sys.h | 50 +++ 9 files changed, 2574 insertions(+) create mode 100644 drivers/bus/fsl-mc/dpmng.c create mode 100644 drivers/bus/fsl-mc/dprc.c create mode 100644 drivers/bus/fsl-mc/fsl_dpmng_cmd.h create mode 100644 drivers/bus/fsl-mc/fsl_dprc_cmd.h create mode 100644 drivers/bus/fsl-mc/mc_sys.c create mode 100644 include/linux/fsl_dpmng.h create mode 100644 include/linux/fsl_dprc.h create mode 100644 include/linux/fsl_mc_cmd.h create mode 100644 include/linux/fsl_mc_sys.h
drivers/bus/fsl-mc/dpmng.c new file +93 -0
@@ -0,0 +1,93 @@ +/* Copyright 2013-2014 Freescale Semiconductor Inc. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of Freescale Semiconductor nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* +* ALTERNATIVELY, this software may be distributed under the terms of the +* GNU General Public License ("GPL") as published by the Free Software +* Foundation, either version 2 of that License or (at your option) any +* later version. +* +* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <linux/fsl_mc_sys.h> +#include <linux/fsl_mc_cmd.h> +#include <linux/fsl_dpmng.h> +#include "fsl_dpmng_cmd.h" + +int mc_get_version (struct fsl_mc_io *mc_io,struct mc_version *mc_ver_info) +{ +struct mc_command cmd = {0 }; +int err; + + cmd.header =mc_encode_cmd_header (DPMNG_CMDID_GET_VERSION , +DPMNG_CMDSZ_GET_VERSION , +MC_CMD_PRI_LOW ,0 ); + + err =mc_send_command (mc_io, &cmd); +if (!err) +DPMNG_RSP_GET_VERSION (cmd, mc_ver_info); + +return err; +} + +int dpmng_reset_aiop (struct fsl_mc_io *mc_io,int aiop_tile_id) +{ +struct mc_command cmd = {0 }; + + cmd.header =mc_encode_cmd_header (DPMNG_CMDID_RESET_AIOP , +DPMNG_CMDSZ_RESET_AIOP , +MC_CMD_PRI_LOW ,0 ); + +DPMNG_CMD_RESET_AIOP (cmd, aiop_tile_id); + +return mc_send_command (mc_io, &cmd); +} + +int dpmng_load_aiop (struct fsl_mc_io *mc_io, +int aiop_tile_id,uint8_t *img_addr,int img_size) +{ +struct mc_command cmd = {0 }; +uint64_t img_paddr =virt_to_phys (img_addr); + + cmd.header =mc_encode_cmd_header (DPMNG_CMDID_LOAD_AIOP , +DPMNG_CMDSZ_LOAD_AIOP , +MC_CMD_PRI_LOW ,0 ); + +DPMNG_CMD_LOAD_AIOP (cmd, aiop_tile_id, img_size, img_paddr); + +return mc_send_command (mc_io, &cmd); +} + +int dpmng_run_aiop (struct fsl_mc_io *mc_io, +int aiop_tile_id,uint32_t cores_mask,uint64_t options) +{ +struct mc_command cmd = {0 }; + + cmd.header =mc_encode_cmd_header (DPMNG_CMDID_RUN_AIOP , +DPMNG_CMDSZ_RUN_AIOP , +MC_CMD_PRI_LOW ,0 ); + +DPMNG_CMD_RUN_AIOP (cmd, aiop_tile_id, cores_mask, options); + +return mc_send_command (mc_io, &cmd); +}
drivers/bus/fsl-mc/dprc.c new file +504 -0
504 lines not on this page · raw message
drivers/bus/fsl-mc/fsl_dpmng_cmd.h new file +83 -0
83 lines not on this page · raw message
drivers/bus/fsl-mc/fsl_dprc_cmd.h new file +545 -0
545 lines not on this page · raw message
drivers/bus/fsl-mc/mc_sys.c new file +207 -0
207 lines not on this page · raw message
include/linux/fsl_dpmng.h new file +120 -0
120 lines not on this page · raw message
include/linux/fsl_dprc.h new file +790 -0
790 lines not on this page · raw message
include/linux/fsl_mc_cmd.h new file +182 -0
182 lines not on this page · raw message
include/linux/fsl_mc_sys.h new file +50 -0
50 lines not on this page · raw message
--
1.7.9.7
Re: [RFC PATCH 1/4 v2] drivers/bus: Added Freescale Management Complex APIs
Quoted 4 lines · J. German Rivera
APIs to access the Management Complex (MC) hardware module of Freescale LS2 SoCs. This patch includes APIs to check the MC firmware version and to manipulate DPRC objects in the MC.
[]
Quoted 4 lines
include/linux/fsl_dpmng.h | 120 ++++++ include/linux/fsl_dprc.h | 790 ++++++++++++++++++++++++++++++++++++ include/linux/fsl_mc_cmd.h | 182 +++++++++ include/linux/fsl_mc_sys.h | 50 +++
Why should any of these files be put in include/linux?
Re: [RFC PATCH 1/4 v2] drivers/bus: Added Freescale Management Complex APIs
Quoted 5 lines · Joe Perches
Quoted 4 lines · J. German Rivera
APIs to access the Management Complex (MC) hardware module of Freescale LS2 SoCs. This patch includes APIs to check the MC firmware version and to manipulate DPRC objects in the MC.
Quoted 8 lines
[]
Quoted 4 lines
include/linux/fsl_dpmng.h | 120 ++++++ include/linux/fsl_dprc.h | 790 ++++++++++++++++++++++++++++++++++++ include/linux/fsl_mc_cmd.h | 182 +++++++++ include/linux/fsl_mc_sys.h | 50 +++Why should any of these files be put in
include/linux?
These header files are going to be shared by more than one of our drivers. Should they be in a new directory under include (such as include/fsl/) or under include/linux (such as include/linux/fsl/)?
Thanks,
German
Quoted 1 line
RFC PATCH v2 2/4 drivers/bus: Freescale Management Complex (fsl-mc) bus driver
In reply to J. German RiveraFrom: "J. German Rivera" <[email protected]>
Platform device driver that sets up the basic bus infrastructure for the fsl-mc bus type, including support for adding/removing fsl-mc devices, register/unregister of fsl-mc drivers, and bus match support to bind devices to drivers.
--- drivers/bus/Kconfig | 3 + drivers/bus/Makefile | 3 + drivers/bus/fsl-mc/Kconfig | 13 + drivers/bus/fsl-mc/Makefile | 14 + drivers/bus/fsl-mc/fsl_mc_bus.c | 637 +++++++++++++++++++++++++++++++++++++++ include/linux/fsl_mc.h | 142 +++++++++ include/linux/fsl_mc_private.h | 55 ++++ 7 files changed, 867 insertions(+) create mode 100644 drivers/bus/fsl-mc/Kconfig create mode 100644 drivers/bus/fsl-mc/Makefile create mode 100644 drivers/bus/fsl-mc/fsl_mc_bus.c create mode 100644 include/linux/fsl_mc.h create mode 100644 include/linux/fsl_mc_private.h
drivers/bus/Kconfig +3 -0
@@ -67,4 +67,7 @@ config VEXPRESS_CONFIG help Platform configuration infrastructure for the ARM Ltd. Versatile Express. + +source "drivers/bus/fsl-mc/Kconfig" + endmenu
drivers/bus/Makefile +3 -0
@@ -15,3 +15,6 @@ obj-$(CONFIG_ARM_CCI) += arm-cci.o obj-$(CONFIG_ARM_CCN) += arm-ccn.o obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o + +# Freescale Management Complex (MC) bus drivers +obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/
drivers/bus/fsl-mc/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# +# Freescale Management Complex (MC) bus drivers +# +# Copyright (C) 2014 Freescale Semiconductor, Inc. +# +# This file is released under the GPLv2 +# + +config FSL_MC_BUS + tristate "Freescale Management Complex (MC) bus driver" + help + Driver to enable the bus infrastructure for the Freescale + QorIQ Management Complex.
drivers/bus/fsl-mc/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +# +# Freescale Management Complex (MC) bus drivers +# +# Copyright (C) 2014 Freescale Semiconductor, Inc. +# +# This file is released under the GPLv2 +# +obj-$(CONFIG_FSL_MC_BUS) += fsl_mc_bus_driver.o + +fsl_mc_bus_driver-objs := fsl_mc_bus.o \ + mc_sys.o \ + dprc.o \ + dpmng.o +
drivers/bus/fsl-mc/fsl_mc_bus.c new file +637 -0
637 lines not on this page · raw message
include/linux/fsl_mc.h new file +142 -0
142 lines not on this page · raw message
include/linux/fsl_mc_private.h new file +55 -0
55 lines not on this page · raw message
--
1.7.9.7
Re: [RFC PATCH 2/4 v2] drivers/bus: Freescale Management Complex (fsl-mc) bus driver
Dne 20.8.2014 02:54, J. German Rivera napsal(a):
drivers/bus/fsl-mc/fsl_mc_bus.c line 601
Quoted 1 line
drivers/bus/fsl-mc/fsl_mc_bus.c new file +1
-0+pr_info ("MC bus (built " __DATE__" " __TIME__") registered\n" );
This won't build with gcc 4.9:
# Prohibit date/time macros, which would make the build non-deterministicKBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
Michal
RFC PATCH v2 3/4 drivers/bus: Device driver for FSL-MC DPRC devices
In reply to J. German RiveraFrom: "J. German Rivera" <[email protected]>
A DPRC (Data Path Resource Container) is an isolation device that contains a set of DPAA networking devices to be assigned to an isolation domain (e.g., a virtual machine).
--- drivers/bus/fsl-mc/Makefile | 3 +- drivers/bus/fsl-mc/fsl_mc_dprc.c | 396 ++++++++++++++++++++++++++++++++++++++ include/linux/fsl_mc_private.h | 6 + 3 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 drivers/bus/fsl-mc/fsl_mc_dprc.c
drivers/bus/fsl-mc/Makefile +2 -1
@@ -5,7 +5,8 @@ # # This file is released under the GPLv2 # -obj-$(CONFIG_FSL_MC_BUS) += fsl_mc_bus_driver.o +obj-$(CONFIG_FSL_MC_BUS) += fsl_mc_bus_driver.o \ + fsl_mc_dprc.o fsl_mc_bus_driver-objs := fsl_mc_bus.o \ mc_sys.o \
drivers/bus/fsl-mc/fsl_mc_dprc.c new file +396 -0
396 lines not on this page · raw message
include/linux/fsl_mc_private.h +6 -0
@@ -15,6 +15,8 @@#include <linux/mutex.h> #include <linux/stringify.h> +#define FSL_MC_DPRC_DRIVER_NAME "fsl_mc_dprc" +#define FSL_MC_DEVICE_MATCH (_mc_dev, _obj_desc) \ (strcmp((_mc_dev)->obj_desc.type, (_obj_desc)->type) == 0 && \ (_mc_dev)->obj_desc.id == (_obj_desc)->id)
@@ -52,4 +54,8 @@ struct fsl_mc_device *__must_check fsl_mc_device_lookup(struct dprc_obj_descstruct fsl_mc_bus *mc_bus); +int __must_check dprc_scan_container (struct fsl_mc_bus *mc_bus); + +int __must_check dprc_discover_objects (struct fsl_mc_bus *mc_bus); +#endif /* _FSL_MC_PRIVATE_H_ */
--
1.7.9.7
RFC PATCH v2 4/4 Update MAINTAINERS file
In reply to J. German RiveraFrom: "J. German Rivera" <[email protected]>
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -3841,6 +3841,14 @@ S: Maintained F: sound/soc/fsl/fsl* F: sound/soc/fsl/mpc8610_hpcd.c +FREESCALE QORIQ MANAGEMENT COMPLEX DRIVER +M: J. German Rivera <[email protected]> +L: [email protected] +S: Maintained +F: include/linux/fsl_mc* +F: include/linux/fsl_dp* +F: drivers/bus/fsl-mc/* + FREEVXFS FILESYSTEM M: Christoph Hellwig <[email protected]> W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
--
1.7.9.7