Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <andrei.botila@nxp.com>
Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-imx@nxp.com
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Andrei Botila and committed by
Herbert Xu
0544cb75 551ce72a

+33 -16
+17 -16
drivers/bus/fsl-mc/fsl-mc-bus.c
··· 26 26 */ 27 27 #define FSL_MC_DEFAULT_DMA_MASK (~0ULL) 28 28 29 + static struct fsl_mc_version mc_version; 30 + 29 31 /** 30 32 * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device 31 33 * @root_mc_bus_dev: fsl-mc device representing the root DPRC ··· 54 52 u64 start_mc_offset; 55 53 u64 end_mc_offset; 56 54 phys_addr_t start_phys_addr; 57 - }; 58 - 59 - /** 60 - * struct mc_version 61 - * @major: Major version number: incremented on API compatibility changes 62 - * @minor: Minor version number: incremented on API additions (that are 63 - * backward compatible); reset when major version is incremented 64 - * @revision: Internal revision number: incremented on implementation changes 65 - * and/or bug fixes that have no impact on API 66 - */ 67 - struct mc_version { 68 - u32 major; 69 - u32 minor; 70 - u32 revision; 71 55 }; 72 56 73 57 /** ··· 326 338 */ 327 339 static int mc_get_version(struct fsl_mc_io *mc_io, 328 340 u32 cmd_flags, 329 - struct mc_version *mc_ver_info) 341 + struct fsl_mc_version *mc_ver_info) 330 342 { 331 343 struct fsl_mc_command cmd = { 0 }; 332 344 struct dpmng_rsp_get_version *rsp_params; ··· 350 362 351 363 return 0; 352 364 } 365 + 366 + /** 367 + * fsl_mc_get_version - function to retrieve the MC f/w version information 368 + * 369 + * Return: mc version when called after fsl-mc-bus probe; NULL otherwise. 370 + */ 371 + struct fsl_mc_version *fsl_mc_get_version(void) 372 + { 373 + if (mc_version.major) 374 + return &mc_version; 375 + 376 + return NULL; 377 + } 378 + EXPORT_SYMBOL_GPL(fsl_mc_get_version); 353 379 354 380 /** 355 381 * fsl_mc_get_root_dprc - function to traverse to the root dprc ··· 864 862 int container_id; 865 863 phys_addr_t mc_portal_phys_addr; 866 864 u32 mc_portal_size; 867 - struct mc_version mc_version; 868 865 struct resource res; 869 866 870 867 mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL);
+16
include/linux/fsl/mc.h
··· 381 381 382 382 void fsl_mc_driver_unregister(struct fsl_mc_driver *driver); 383 383 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 + 384 400 int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev, 385 401 u16 mc_io_flags, 386 402 struct fsl_mc_io **new_mc_io);