fsl-mc-allocator.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * fsl-mc object allocator driver
  4. *
  5. * Copyright (C) 2013-2016 Freescale Semiconductor, Inc.
  6. *
  7. */
  8. #include <linux/module.h>
  9. #include <linux/msi.h>
  10. #include <linux/fsl/mc.h>
  11. #include "fsl-mc-private.h"
  12. static bool __must_check fsl_mc_is_allocatable(struct fsl_mc_device *mc_dev)
  13. {
  14. return is_fsl_mc_bus_dpbp(mc_dev) ||
  15. is_fsl_mc_bus_dpmcp(mc_dev) ||
  16. is_fsl_mc_bus_dpcon(mc_dev);
  17. }
  18. /**
  19. * fsl_mc_resource_pool_add_device - add allocatable object to a resource
  20. * pool of a given fsl-mc bus
  21. *
  22. * @mc_bus: pointer to the fsl-mc bus
  23. * @pool_type: pool type
  24. * @mc_dev: pointer to allocatable fsl-mc device
  25. */
  26. static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus
  27. *mc_bus,
  28. enum fsl_mc_pool_type
  29. pool_type,
  30. struct fsl_mc_device
  31. *mc_dev)
  32. {
  33. struct fsl_mc_resource_pool *res_pool;
  34. struct fsl_mc_resource *resource;
  35. struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
  36. int error = -EINVAL;
  37. if (pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)
  38. goto out;
  39. if (!fsl_mc_is_allocatable(mc_dev))
  40. goto out;
  41. if (mc_dev->resource)
  42. goto out;
  43. res_pool = &mc_bus->resource_pools[pool_type];
  44. if (res_pool->type != pool_type)
  45. goto out;
  46. if (res_pool->mc_bus != mc_bus)
  47. goto out;
  48. mutex_lock(&res_pool->mutex);
  49. if (res_pool->max_count < 0)
  50. goto out_unlock;
  51. if (res_pool->free_count < 0 ||
  52. res_pool->free_count > res_pool->max_count)
  53. goto out_unlock;
  54. resource = devm_kzalloc(&mc_bus_dev->dev, sizeof(*resource),
  55. GFP_KERNEL);
  56. if (!resource) {
  57. error = -ENOMEM;
  58. dev_err(&mc_bus_dev->dev,
  59. "Failed to allocate memory for fsl_mc_resource\n");
  60. goto out_unlock;
  61. }
  62. resource->type = pool_type;
  63. resource->id = mc_dev->obj_desc.id;
  64. resource->data = mc_dev;
  65. resource->parent_pool = res_pool;
  66. INIT_LIST_HEAD(&resource->node);
  67. list_add_tail(&resource->node, &res_pool->free_list);
  68. mc_dev->resource = resource;
  69. res_pool->free_count++;
  70. res_pool->max_count++;
  71. error = 0;
  72. out_unlock:
  73. mutex_unlock(&res_pool->mutex);
  74. out:
  75. return error;
  76. }
  77. /**
  78. * fsl_mc_resource_pool_remove_device - remove an allocatable device from a
  79. * resource pool
  80. *
  81. * @mc_dev: pointer to allocatable fsl-mc device
  82. *
  83. * It permanently removes an allocatable fsl-mc device from the resource
  84. * pool. It's an error if the device is in use.
  85. */
  86. static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
  87. *mc_dev)
  88. {
  89. struct fsl_mc_device *mc_bus_dev;
  90. struct fsl_mc_bus *mc_bus;
  91. struct fsl_mc_resource_pool *res_pool;
  92. struct fsl_mc_resource *resource;
  93. int error = -EINVAL;
  94. mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
  95. mc_bus = to_fsl_mc_bus(mc_bus_dev);
  96. resource = mc_dev->resource;
  97. if (!resource || resource->data != mc_dev) {
  98. dev_err(&mc_bus_dev->dev, "resource mismatch\n");
  99. goto out;
  100. }
  101. res_pool = resource->parent_pool;
  102. if (res_pool != &mc_bus->resource_pools[resource->type]) {
  103. dev_err(&mc_bus_dev->dev, "pool mismatch\n");
  104. goto out;
  105. }
  106. mutex_lock(&res_pool->mutex);
  107. if (res_pool->max_count <= 0) {
  108. dev_err(&mc_bus_dev->dev, "max_count underflow\n");
  109. goto out_unlock;
  110. }
  111. if (res_pool->free_count <= 0 ||
  112. res_pool->free_count > res_pool->max_count) {
  113. dev_err(&mc_bus_dev->dev, "free_count mismatch\n");
  114. goto out_unlock;
  115. }
  116. /*
  117. * If the device is currently allocated, its resource is not
  118. * in the free list and thus, the device cannot be removed.
  119. */
  120. if (list_empty(&resource->node)) {
  121. error = -EBUSY;
  122. dev_err(&mc_bus_dev->dev,
  123. "Device %s cannot be removed from resource pool\n",
  124. dev_name(&mc_dev->dev));
  125. goto out_unlock;
  126. }
  127. list_del_init(&resource->node);
  128. res_pool->free_count--;
  129. res_pool->max_count--;
  130. devm_kfree(&mc_bus_dev->dev, resource);
  131. mc_dev->resource = NULL;
  132. error = 0;
  133. out_unlock:
  134. mutex_unlock(&res_pool->mutex);
  135. out:
  136. return error;
  137. }
  138. static const char *const fsl_mc_pool_type_strings[] = {
  139. [FSL_MC_POOL_DPMCP] = "dpmcp",
  140. [FSL_MC_POOL_DPBP] = "dpbp",
  141. [FSL_MC_POOL_DPCON] = "dpcon",
  142. [FSL_MC_POOL_IRQ] = "irq",
  143. };
  144. static int __must_check object_type_to_pool_type(const char *object_type,
  145. enum fsl_mc_pool_type
  146. *pool_type)
  147. {
  148. unsigned int i;
  149. for (i = 0; i < ARRAY_SIZE(fsl_mc_pool_type_strings); i++) {
  150. if (strcmp(object_type, fsl_mc_pool_type_strings[i]) == 0) {
  151. *pool_type = i;
  152. return 0;
  153. }
  154. }
  155. return -EINVAL;
  156. }
  157. int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
  158. enum fsl_mc_pool_type pool_type,
  159. struct fsl_mc_resource **new_resource)
  160. {
  161. struct fsl_mc_resource_pool *res_pool;
  162. struct fsl_mc_resource *resource;
  163. struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
  164. int error = -EINVAL;
  165. BUILD_BUG_ON(ARRAY_SIZE(fsl_mc_pool_type_strings) !=
  166. FSL_MC_NUM_POOL_TYPES);
  167. *new_resource = NULL;
  168. if (pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)
  169. goto out;
  170. res_pool = &mc_bus->resource_pools[pool_type];
  171. if (res_pool->mc_bus != mc_bus)
  172. goto out;
  173. mutex_lock(&res_pool->mutex);
  174. resource = list_first_entry_or_null(&res_pool->free_list,
  175. struct fsl_mc_resource, node);
  176. if (!resource) {
  177. error = -ENXIO;
  178. dev_err(&mc_bus_dev->dev,
  179. "No more resources of type %s left\n",
  180. fsl_mc_pool_type_strings[pool_type]);
  181. goto out_unlock;
  182. }
  183. if (resource->type != pool_type)
  184. goto out_unlock;
  185. if (resource->parent_pool != res_pool)
  186. goto out_unlock;
  187. if (res_pool->free_count <= 0 ||
  188. res_pool->free_count > res_pool->max_count)
  189. goto out_unlock;
  190. list_del_init(&resource->node);
  191. res_pool->free_count--;
  192. error = 0;
  193. out_unlock:
  194. mutex_unlock(&res_pool->mutex);
  195. *new_resource = resource;
  196. out:
  197. return error;
  198. }
  199. EXPORT_SYMBOL_GPL(fsl_mc_resource_allocate);
  200. void fsl_mc_resource_free(struct fsl_mc_resource *resource)
  201. {
  202. struct fsl_mc_resource_pool *res_pool;
  203. res_pool = resource->parent_pool;
  204. if (resource->type != res_pool->type)
  205. return;
  206. mutex_lock(&res_pool->mutex);
  207. if (res_pool->free_count < 0 ||
  208. res_pool->free_count >= res_pool->max_count)
  209. goto out_unlock;
  210. if (!list_empty(&resource->node))
  211. goto out_unlock;
  212. list_add_tail(&resource->node, &res_pool->free_list);
  213. res_pool->free_count++;
  214. out_unlock:
  215. mutex_unlock(&res_pool->mutex);
  216. }
  217. EXPORT_SYMBOL_GPL(fsl_mc_resource_free);
  218. /**
  219. * fsl_mc_object_allocate - Allocates an fsl-mc object of the given
  220. * pool type from a given fsl-mc bus instance
  221. *
  222. * @mc_dev: fsl-mc device which is used in conjunction with the
  223. * allocated object
  224. * @pool_type: pool type
  225. * @new_mc_adev: pointer to area where the pointer to the allocated device
  226. * is to be returned
  227. *
  228. * Allocatable objects are always used in conjunction with some functional
  229. * device. This function allocates an object of the specified type from
  230. * the DPRC containing the functional device.
  231. *
  232. * NOTE: pool_type must be different from FSL_MC_POOL_MCP, since MC
  233. * portals are allocated using fsl_mc_portal_allocate(), instead of
  234. * this function.
  235. */
  236. int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev,
  237. enum fsl_mc_pool_type pool_type,
  238. struct fsl_mc_device **new_mc_adev)
  239. {
  240. struct fsl_mc_device *mc_bus_dev;
  241. struct fsl_mc_bus *mc_bus;
  242. struct fsl_mc_device *mc_adev;
  243. int error = -EINVAL;
  244. struct fsl_mc_resource *resource = NULL;
  245. *new_mc_adev = NULL;
  246. if (mc_dev->flags & FSL_MC_IS_DPRC)
  247. goto error;
  248. if (!dev_is_fsl_mc(mc_dev->dev.parent))
  249. goto error;
  250. if (pool_type == FSL_MC_POOL_DPMCP)
  251. goto error;
  252. mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
  253. mc_bus = to_fsl_mc_bus(mc_bus_dev);
  254. error = fsl_mc_resource_allocate(mc_bus, pool_type, &resource);
  255. if (error < 0)
  256. goto error;
  257. mc_adev = resource->data;
  258. if (!mc_adev) {
  259. error = -EINVAL;
  260. goto error;
  261. }
  262. mc_adev->consumer_link = device_link_add(&mc_dev->dev,
  263. &mc_adev->dev,
  264. DL_FLAG_AUTOREMOVE_CONSUMER);
  265. if (!mc_adev->consumer_link) {
  266. error = -EINVAL;
  267. goto error;
  268. }
  269. *new_mc_adev = mc_adev;
  270. return 0;
  271. error:
  272. if (resource)
  273. fsl_mc_resource_free(resource);
  274. return error;
  275. }
  276. EXPORT_SYMBOL_GPL(fsl_mc_object_allocate);
  277. /**
  278. * fsl_mc_object_free - Returns an fsl-mc object to the resource
  279. * pool where it came from.
  280. * @mc_adev: Pointer to the fsl-mc device
  281. */
  282. void fsl_mc_object_free(struct fsl_mc_device *mc_adev)
  283. {
  284. struct fsl_mc_resource *resource;
  285. resource = mc_adev->resource;
  286. if (resource->type == FSL_MC_POOL_DPMCP)
  287. return;
  288. if (resource->data != mc_adev)
  289. return;
  290. fsl_mc_resource_free(resource);
  291. mc_adev->consumer_link = NULL;
  292. }
  293. EXPORT_SYMBOL_GPL(fsl_mc_object_free);
  294. /*
  295. * A DPRC and the devices in the DPRC all share the same GIC-ITS device
  296. * ID. A block of IRQs is pre-allocated and maintained in a pool
  297. * from which devices can allocate them when needed.
  298. */
  299. /*
  300. * Initialize the interrupt pool associated with an fsl-mc bus.
  301. * It allocates a block of IRQs from the GIC-ITS.
  302. */
  303. int fsl_mc_populate_irq_pool(struct fsl_mc_device *mc_bus_dev,
  304. unsigned int irq_count)
  305. {
  306. unsigned int i;
  307. struct fsl_mc_device_irq *irq_resources;
  308. struct fsl_mc_device_irq *mc_dev_irq;
  309. int error;
  310. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  311. struct fsl_mc_resource_pool *res_pool =
  312. &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  313. /* do nothing if the IRQ pool is already populated */
  314. if (mc_bus->irq_resources)
  315. return 0;
  316. if (irq_count == 0 ||
  317. irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS)
  318. return -EINVAL;
  319. error = fsl_mc_msi_domain_alloc_irqs(&mc_bus_dev->dev, irq_count);
  320. if (error < 0)
  321. return error;
  322. irq_resources = devm_kcalloc(&mc_bus_dev->dev,
  323. irq_count, sizeof(*irq_resources),
  324. GFP_KERNEL);
  325. if (!irq_resources) {
  326. error = -ENOMEM;
  327. goto cleanup_msi_irqs;
  328. }
  329. for (i = 0; i < irq_count; i++) {
  330. mc_dev_irq = &irq_resources[i];
  331. /*
  332. * NOTE: This mc_dev_irq's MSI addr/value pair will be set
  333. * by the fsl_mc_msi_write_msg() callback
  334. */
  335. mc_dev_irq->resource.type = res_pool->type;
  336. mc_dev_irq->resource.data = mc_dev_irq;
  337. mc_dev_irq->resource.parent_pool = res_pool;
  338. mc_dev_irq->virq = msi_get_virq(&mc_bus_dev->dev, i);
  339. mc_dev_irq->resource.id = mc_dev_irq->virq;
  340. INIT_LIST_HEAD(&mc_dev_irq->resource.node);
  341. list_add_tail(&mc_dev_irq->resource.node, &res_pool->free_list);
  342. }
  343. res_pool->max_count = irq_count;
  344. res_pool->free_count = irq_count;
  345. mc_bus->irq_resources = irq_resources;
  346. return 0;
  347. cleanup_msi_irqs:
  348. fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
  349. return error;
  350. }
  351. EXPORT_SYMBOL_GPL(fsl_mc_populate_irq_pool);
  352. /*
  353. * Teardown the interrupt pool associated with an fsl-mc bus.
  354. * It frees the IRQs that were allocated to the pool, back to the GIC-ITS.
  355. */
  356. void fsl_mc_cleanup_irq_pool(struct fsl_mc_device *mc_bus_dev)
  357. {
  358. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  359. struct fsl_mc_resource_pool *res_pool =
  360. &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  361. if (!mc_bus->irq_resources)
  362. return;
  363. if (res_pool->max_count == 0)
  364. return;
  365. if (res_pool->free_count != res_pool->max_count)
  366. return;
  367. INIT_LIST_HEAD(&res_pool->free_list);
  368. res_pool->max_count = 0;
  369. res_pool->free_count = 0;
  370. mc_bus->irq_resources = NULL;
  371. fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
  372. }
  373. EXPORT_SYMBOL_GPL(fsl_mc_cleanup_irq_pool);
  374. /*
  375. * Allocate the IRQs required by a given fsl-mc device.
  376. */
  377. int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev)
  378. {
  379. int i;
  380. int irq_count;
  381. int res_allocated_count = 0;
  382. int error = -EINVAL;
  383. struct fsl_mc_device_irq **irqs = NULL;
  384. struct fsl_mc_bus *mc_bus;
  385. struct fsl_mc_resource_pool *res_pool;
  386. if (mc_dev->irqs)
  387. return -EINVAL;
  388. irq_count = mc_dev->obj_desc.irq_count;
  389. if (irq_count == 0)
  390. return -EINVAL;
  391. if (is_fsl_mc_bus_dprc(mc_dev))
  392. mc_bus = to_fsl_mc_bus(mc_dev);
  393. else
  394. mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent));
  395. if (!mc_bus->irq_resources)
  396. return -EINVAL;
  397. res_pool = &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  398. if (res_pool->free_count < irq_count) {
  399. dev_err(&mc_dev->dev,
  400. "Not able to allocate %u irqs for device\n", irq_count);
  401. return -ENOSPC;
  402. }
  403. irqs = devm_kcalloc(&mc_dev->dev, irq_count, sizeof(irqs[0]),
  404. GFP_KERNEL);
  405. if (!irqs)
  406. return -ENOMEM;
  407. for (i = 0; i < irq_count; i++) {
  408. struct fsl_mc_resource *resource;
  409. error = fsl_mc_resource_allocate(mc_bus, FSL_MC_POOL_IRQ,
  410. &resource);
  411. if (error < 0)
  412. goto error_resource_alloc;
  413. irqs[i] = to_fsl_mc_irq(resource);
  414. res_allocated_count++;
  415. irqs[i]->mc_dev = mc_dev;
  416. irqs[i]->dev_irq_index = i;
  417. }
  418. mc_dev->irqs = irqs;
  419. return 0;
  420. error_resource_alloc:
  421. for (i = 0; i < res_allocated_count; i++) {
  422. irqs[i]->mc_dev = NULL;
  423. fsl_mc_resource_free(&irqs[i]->resource);
  424. }
  425. return error;
  426. }
  427. EXPORT_SYMBOL_GPL(fsl_mc_allocate_irqs);
  428. /*
  429. * Frees the IRQs that were allocated for an fsl-mc device.
  430. */
  431. void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev)
  432. {
  433. int i;
  434. int irq_count;
  435. struct fsl_mc_bus *mc_bus;
  436. struct fsl_mc_device_irq **irqs = mc_dev->irqs;
  437. if (!irqs)
  438. return;
  439. irq_count = mc_dev->obj_desc.irq_count;
  440. if (is_fsl_mc_bus_dprc(mc_dev))
  441. mc_bus = to_fsl_mc_bus(mc_dev);
  442. else
  443. mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent));
  444. if (!mc_bus->irq_resources)
  445. return;
  446. for (i = 0; i < irq_count; i++) {
  447. irqs[i]->mc_dev = NULL;
  448. fsl_mc_resource_free(&irqs[i]->resource);
  449. }
  450. mc_dev->irqs = NULL;
  451. }
  452. EXPORT_SYMBOL_GPL(fsl_mc_free_irqs);
  453. void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
  454. {
  455. int pool_type;
  456. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  457. for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++) {
  458. struct fsl_mc_resource_pool *res_pool =
  459. &mc_bus->resource_pools[pool_type];
  460. res_pool->type = pool_type;
  461. res_pool->max_count = 0;
  462. res_pool->free_count = 0;
  463. res_pool->mc_bus = mc_bus;
  464. INIT_LIST_HEAD(&res_pool->free_list);
  465. mutex_init(&res_pool->mutex);
  466. }
  467. }
  468. /*
  469. * fsl_mc_allocator_probe - callback invoked when an allocatable device is
  470. * being added to the system
  471. */
  472. static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
  473. {
  474. enum fsl_mc_pool_type pool_type;
  475. struct fsl_mc_device *mc_bus_dev;
  476. struct fsl_mc_bus *mc_bus;
  477. int error;
  478. if (!fsl_mc_is_allocatable(mc_dev))
  479. return -EINVAL;
  480. mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
  481. if (!dev_is_fsl_mc(&mc_bus_dev->dev))
  482. return -EINVAL;
  483. mc_bus = to_fsl_mc_bus(mc_bus_dev);
  484. error = object_type_to_pool_type(mc_dev->obj_desc.type, &pool_type);
  485. if (error < 0)
  486. return error;
  487. error = fsl_mc_resource_pool_add_device(mc_bus, pool_type, mc_dev);
  488. if (error < 0)
  489. return error;
  490. dev_dbg(&mc_dev->dev,
  491. "Allocatable fsl-mc device bound to fsl_mc_allocator driver");
  492. return 0;
  493. }
  494. /*
  495. * fsl_mc_allocator_remove - callback invoked when an allocatable device is
  496. * being removed from the system
  497. */
  498. static void fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
  499. {
  500. int error;
  501. if (mc_dev->resource) {
  502. error = fsl_mc_resource_pool_remove_device(mc_dev);
  503. if (error < 0)
  504. return;
  505. }
  506. dev_dbg(&mc_dev->dev,
  507. "Allocatable fsl-mc device unbound from fsl_mc_allocator driver");
  508. }
  509. static const struct fsl_mc_device_id match_id_table[] = {
  510. {
  511. .vendor = FSL_MC_VENDOR_FREESCALE,
  512. .obj_type = "dpbp",
  513. },
  514. {
  515. .vendor = FSL_MC_VENDOR_FREESCALE,
  516. .obj_type = "dpmcp",
  517. },
  518. {
  519. .vendor = FSL_MC_VENDOR_FREESCALE,
  520. .obj_type = "dpcon",
  521. },
  522. {.vendor = 0x0},
  523. };
  524. static struct fsl_mc_driver fsl_mc_allocator_driver = {
  525. .driver = {
  526. .name = "fsl_mc_allocator",
  527. .pm = NULL,
  528. },
  529. .match_id_table = match_id_table,
  530. .probe = fsl_mc_allocator_probe,
  531. .remove = fsl_mc_allocator_remove,
  532. };
  533. int __init fsl_mc_allocator_driver_init(void)
  534. {
  535. return fsl_mc_driver_register(&fsl_mc_allocator_driver);
  536. }