[PATCH 2/3 v6] drivers/bus: Freescale Management Complex (fsl-mc) bus driver
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. Signed-off-by: J. German Rivera Signed-off-by: Stuart Yoder --- Changes addressed in v6: - Fixed new checkpatch warnings Changes addressed in v5: - Addressed comments from Alex Graf: * Renamed dprc_get_container_id() call as dpmng_get_container_id(). * Added TODO comment to use the 'ranges' property of the fsl-mc DT node. Changes addressed in v4: - Addressed comments from Alex Graf: * Added missing scope limitations and more descriptive help text for the FSL_MC_BUS config option. - Fixed bug related to setting fsl_mc_bus_type.dev_root too late. Changes in v3: - Addressed changes from Kim Phillips: * Renamed files: drivers/bus/fsl-mc/fsl_mc_bus.c -> drivers/bus/fsl-mc/mc-bus.c include/linux/fsl_mc.h -> include/linux/fsl/mc.h include/linux/fsl_mc_private.h -> include/linux/fsl/mc-private.h - Addressed comments from Timur Tabi: * Changed all functions that had goto out/error when no common cleanup was done, to just have multiple return points. * Replaced error cleanup boolean flags with multiple exit points. Changes in v2: - Addressed comment from Joe Perches: * Changed pr_debug to dev_dbg in fsl_mc_bus_match - Addressed comments from Kim Phillips and Alex Graf: * Changed version check to allow the driver to run with MC firmware that has major version number greater than or equal to the driver's major version number. * Removed minor version check - Removed unused variable parent_dev in fsl_mc_device_remove drivers/bus/Kconfig| 3 + drivers/bus/Makefile | 3 + drivers/bus/fsl-mc/Kconfig | 24 ++ drivers/bus/fsl-mc/Makefile| 14 + drivers/bus/fsl-mc/mc-bus.c| 585 + include/linux/fsl/mc-private.h | 33 +++ include/linux/fsl/mc.h | 137 ++ 7 files changed, 799 insertions(+) create mode 100644 drivers/bus/fsl-mc/Kconfig create mode 100644 drivers/bus/fsl-mc/Makefile create mode 100644 drivers/bus/fsl-mc/mc-bus.c create mode 100644 include/linux/fsl/mc-private.h create mode 100644 include/linux/fsl/mc.h diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index b99729e..dde3ec2 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -67,4 +67,7 @@ config VEXPRESS_CONFIG help Platform configuration infrastructure for the ARM Ltd. Versatile Express. + +source "drivers/bus/fsl-mc/Kconfig" + endmenu diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index 2973c18..6abcab1 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -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/ diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig new file mode 100644 index 000..0d779d9 --- /dev/null +++ b/drivers/bus/fsl-mc/Kconfig @@ -0,0 +1,24 @@ +# +# 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" + depends on OF && ARM64 + help + Driver to enable the bus infrastructure for the Freescale + QorIQ Management Complex (fsl-mc). The fsl-mc is a hardware + module of the QorIQ LS2 SoCs, that does resource management + for hardware building-blocks in the SoC that can be used + to dynamically create networking hardware objects such as + network interfaces (NICs), crypto accelerator instances, + or L2 switches. + + Only enable this option when building the kernel for + Freescale QorQIQ LS2 SoCs. + + diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile new file mode 100644 index 000..decd339 --- /dev/null +++ b/drivers/bus/fsl-mc/Makefile @@ -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) += mc-bus-driver.o + +mc-bus-driver-objs := mc-bus.o \ + mc-sys.o \ + dprc.o \ + dpmng.o + diff --git a/drivers/bus/fsl-mc/mc-bus.c b/drivers/bus/fsl-mc/mc-bus.c new file mode 100644 index 000..e6f3d62 --- /dev/null +++ b/drivers/bus/fsl-mc/mc-bus.c @@ -0,0 +1,585 @@ +/* + * Freescale Management Complex (MC) bus driver + * + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version
[PATCH 2/3 v6] drivers/bus: Freescale Management Complex (fsl-mc) bus driver
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. Signed-off-by: J. German Rivera german.riv...@freescale.com Signed-off-by: Stuart Yoder stuart.yo...@freescale.com --- Changes addressed in v6: - Fixed new checkpatch warnings Changes addressed in v5: - Addressed comments from Alex Graf: * Renamed dprc_get_container_id() call as dpmng_get_container_id(). * Added TODO comment to use the 'ranges' property of the fsl-mc DT node. Changes addressed in v4: - Addressed comments from Alex Graf: * Added missing scope limitations and more descriptive help text for the FSL_MC_BUS config option. - Fixed bug related to setting fsl_mc_bus_type.dev_root too late. Changes in v3: - Addressed changes from Kim Phillips: * Renamed files: drivers/bus/fsl-mc/fsl_mc_bus.c - drivers/bus/fsl-mc/mc-bus.c include/linux/fsl_mc.h - include/linux/fsl/mc.h include/linux/fsl_mc_private.h - include/linux/fsl/mc-private.h - Addressed comments from Timur Tabi: * Changed all functions that had goto out/error when no common cleanup was done, to just have multiple return points. * Replaced error cleanup boolean flags with multiple exit points. Changes in v2: - Addressed comment from Joe Perches: * Changed pr_debug to dev_dbg in fsl_mc_bus_match - Addressed comments from Kim Phillips and Alex Graf: * Changed version check to allow the driver to run with MC firmware that has major version number greater than or equal to the driver's major version number. * Removed minor version check - Removed unused variable parent_dev in fsl_mc_device_remove drivers/bus/Kconfig| 3 + drivers/bus/Makefile | 3 + drivers/bus/fsl-mc/Kconfig | 24 ++ drivers/bus/fsl-mc/Makefile| 14 + drivers/bus/fsl-mc/mc-bus.c| 585 + include/linux/fsl/mc-private.h | 33 +++ include/linux/fsl/mc.h | 137 ++ 7 files changed, 799 insertions(+) create mode 100644 drivers/bus/fsl-mc/Kconfig create mode 100644 drivers/bus/fsl-mc/Makefile create mode 100644 drivers/bus/fsl-mc/mc-bus.c create mode 100644 include/linux/fsl/mc-private.h create mode 100644 include/linux/fsl/mc.h diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index b99729e..dde3ec2 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -67,4 +67,7 @@ config VEXPRESS_CONFIG help Platform configuration infrastructure for the ARM Ltd. Versatile Express. + +source drivers/bus/fsl-mc/Kconfig + endmenu diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index 2973c18..6abcab1 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -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/ diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig new file mode 100644 index 000..0d779d9 --- /dev/null +++ b/drivers/bus/fsl-mc/Kconfig @@ -0,0 +1,24 @@ +# +# 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 + depends on OF ARM64 + help + Driver to enable the bus infrastructure for the Freescale + QorIQ Management Complex (fsl-mc). The fsl-mc is a hardware + module of the QorIQ LS2 SoCs, that does resource management + for hardware building-blocks in the SoC that can be used + to dynamically create networking hardware objects such as + network interfaces (NICs), crypto accelerator instances, + or L2 switches. + + Only enable this option when building the kernel for + Freescale QorQIQ LS2 SoCs. + + diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile new file mode 100644 index 000..decd339 --- /dev/null +++ b/drivers/bus/fsl-mc/Makefile @@ -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) += mc-bus-driver.o + +mc-bus-driver-objs := mc-bus.o \ + mc-sys.o \ + dprc.o \ + dpmng.o + diff --git a/drivers/bus/fsl-mc/mc-bus.c b/drivers/bus/fsl-mc/mc-bus.c new file mode 100644 index 000..e6f3d62 --- /dev/null +++ b/drivers/bus/fsl-mc/mc-bus.c @@ -0,0 +1,585 @@ +/* + * Freescale Management Complex (MC) bus driver + * + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Author: German Rivera german.riv...@freescale.com + * + * This file is