Skip to content

Commit 0544cb7

Browse files
andreibotilaherbertx
authored andcommitted
bus: fsl-mc: add api to retrieve mc version
Add a new api that returns Management Complex firmware version and make the required structure public. The api's first user will be the caam driver for setting prediction resistance bits. Signed-off-by: Andrei Botila <[email protected]> Acked-by: Laurentiu Tudor <[email protected]> Reviewed-by: Horia Geantă <[email protected]> Cc: Chris Healy <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Horia Geantă <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Iuliana Prodan <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Herbert Xu <[email protected]>
1 parent 551ce72 commit 0544cb7

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

drivers/bus/fsl-mc/fsl-mc-bus.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
*/
2727
#define FSL_MC_DEFAULT_DMA_MASK (~0ULL)
2828

29+
static struct fsl_mc_version mc_version;
30+
2931
/**
3032
* struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device
3133
* @root_mc_bus_dev: fsl-mc device representing the root DPRC
@@ -54,20 +56,6 @@ struct fsl_mc_addr_translation_range {
5456
phys_addr_t start_phys_addr;
5557
};
5658

57-
/**
58-
* struct mc_version
59-
* @major: Major version number: incremented on API compatibility changes
60-
* @minor: Minor version number: incremented on API additions (that are
61-
* backward compatible); reset when major version is incremented
62-
* @revision: Internal revision number: incremented on implementation changes
63-
* and/or bug fixes that have no impact on API
64-
*/
65-
struct mc_version {
66-
u32 major;
67-
u32 minor;
68-
u32 revision;
69-
};
70-
7159
/**
7260
* fsl_mc_bus_match - device to driver matching callback
7361
* @dev: the fsl-mc device to match against
@@ -338,7 +326,7 @@ EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
338326
*/
339327
static int mc_get_version(struct fsl_mc_io *mc_io,
340328
u32 cmd_flags,
341-
struct mc_version *mc_ver_info)
329+
struct fsl_mc_version *mc_ver_info)
342330
{
343331
struct fsl_mc_command cmd = { 0 };
344332
struct dpmng_rsp_get_version *rsp_params;
@@ -363,6 +351,20 @@ static int mc_get_version(struct fsl_mc_io *mc_io,
363351
return 0;
364352
}
365353

354+
/**
355+
* fsl_mc_get_version - function to retrieve the MC f/w version information
356+
*
357+
* Return: mc version when called after fsl-mc-bus probe; NULL otherwise.
358+
*/
359+
struct fsl_mc_version *fsl_mc_get_version(void)
360+
{
361+
if (mc_version.major)
362+
return &mc_version;
363+
364+
return NULL;
365+
}
366+
EXPORT_SYMBOL_GPL(fsl_mc_get_version);
367+
366368
/**
367369
* fsl_mc_get_root_dprc - function to traverse to the root dprc
368370
*/
@@ -862,7 +864,6 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
862864
int container_id;
863865
phys_addr_t mc_portal_phys_addr;
864866
u32 mc_portal_size;
865-
struct mc_version mc_version;
866867
struct resource res;
867868

868869
mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL);

include/linux/fsl/mc.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,22 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver,
381381

382382
void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
383383

384+
/**
385+
* struct fsl_mc_version
386+
* @major: Major version number: incremented on API compatibility changes
387+
* @minor: Minor version number: incremented on API additions (that are
388+
* backward compatible); reset when major version is incremented
389+
* @revision: Internal revision number: incremented on implementation changes
390+
* and/or bug fixes that have no impact on API
391+
*/
392+
struct fsl_mc_version {
393+
u32 major;
394+
u32 minor;
395+
u32 revision;
396+
};
397+
398+
struct fsl_mc_version *fsl_mc_get_version(void);
399+
384400
int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
385401
u16 mc_io_flags,
386402
struct fsl_mc_io **new_mc_io);

0 commit comments

Comments
 (0)