fsl-mc-allocator.c 16 KB

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