From 01b4cd546a0267a567454ffae7921b761290e810 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 12 Sep 2019 15:20:29 +0100 Subject: bus: fsl-mc: add uapi interface for restool Add the uapi interface for restool, picked from the QoriQ kernel tree commit f2278d43b7ca ("bus: fsl-mc: add fsl-mc userspace support") by Ioana Ciornei . Signed-off-by: Ioana Ciornei Signed-off-by: Russell King --- drivers/bus/fsl-mc/fsl-mc-private.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'drivers/bus/fsl-mc/fsl-mc-private.h') diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h b/drivers/bus/fsl-mc/fsl-mc-private.h index c932387641fa..c9f7e7aca767 100644 --- a/drivers/bus/fsl-mc/fsl-mc-private.h +++ b/drivers/bus/fsl-mc/fsl-mc-private.h @@ -542,6 +542,24 @@ struct fsl_mc_resource_pool { struct fsl_mc_bus *mc_bus; }; +#include + +/** + * struct fsl_mc_uapi - information associated with a device file + * @misc: struct miscdevice linked to the root dprc + * @device: newly created device in /dev + * @mutex: mutex lock to serialize the open/release operations + * @local_instance_in_use: local MC I/O instance in use or not + * @static_mc_io: pointer to the static MC I/O object + */ +struct fsl_mc_uapi { + struct miscdevice misc; + struct device *device; + struct mutex mutex; /* serialize open/release operations */ + u32 local_instance_in_use; + struct fsl_mc_io *static_mc_io; +}; + /** * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC * @mc_dev: fsl-mc device for the bus device itself. @@ -558,6 +576,7 @@ struct fsl_mc_bus { struct fsl_mc_device_irq *irq_resources; struct mutex scan_mutex; /* serializes bus scanning */ struct dprc_attributes dprc_attr; + struct fsl_mc_uapi uapi_misc; }; #define to_fsl_mc_bus(_mc_dev) \ @@ -612,4 +631,17 @@ void fsl_mc_get_root_dprc(struct device *dev, struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_device *mc_bus_dev); +#ifdef CONFIG_FSL_MC_UAPI_SUPPORT +int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus); +void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus); +#else +static inline int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus) +{ + return 0; +} + +static inline void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus) +{ +} +#endif #endif /* _FSL_MC_PRIVATE_H_ */ -- cgit