fsl-mc-allocator.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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. error = -EINVAL;
  254. goto error;
  255. }
  256. mc_adev->consumer_link = device_link_add(&mc_dev->dev,
  257. &mc_adev->dev,
  258. DL_FLAG_AUTOREMOVE_CONSUMER);
  259. if (!mc_adev->consumer_link) {
  260. error = -EINVAL;
  261. goto error;
  262. }
  263. *new_mc_adev = mc_adev;
  264. return 0;
  265. error:
  266. if (resource)
  267. fsl_mc_resource_free(resource);
  268. return error;
  269. }
  270. EXPORT_SYMBOL_GPL(fsl_mc_object_allocate);
  271. /**
  272. * fsl_mc_object_free - Returns an fsl-mc object to the resource
  273. * pool where it came from.
  274. * @mc_adev: Pointer to the fsl-mc device
  275. */
  276. void fsl_mc_object_free(struct fsl_mc_device *mc_adev)
  277. {
  278. struct fsl_mc_resource *resource;
  279. resource = mc_adev->resource;
  280. if (resource->type == FSL_MC_POOL_DPMCP)
  281. return;
  282. if (resource->data != mc_adev)
  283. return;
  284. fsl_mc_resource_free(resource);
  285. mc_adev->consumer_link = NULL;
  286. }
  287. EXPORT_SYMBOL_GPL(fsl_mc_object_free);
  288. /*
  289. * A DPRC and the devices in the DPRC all share the same GIC-ITS device
  290. * ID. A block of IRQs is pre-allocated and maintained in a pool
  291. * from which devices can allocate them when needed.
  292. */
  293. /*
  294. * Initialize the interrupt pool associated with an fsl-mc bus.
  295. * It allocates a block of IRQs from the GIC-ITS.
  296. */
  297. int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
  298. unsigned int irq_count)
  299. {
  300. unsigned int i;
  301. struct msi_desc *msi_desc;
  302. struct fsl_mc_device_irq *irq_resources;
  303. struct fsl_mc_device_irq *mc_dev_irq;
  304. int error;
  305. struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
  306. struct fsl_mc_resource_pool *res_pool =
  307. &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  308. if (irq_count == 0 ||
  309. irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS)
  310. return -EINVAL;
  311. error = fsl_mc_msi_domain_alloc_irqs(&mc_bus_dev->dev, irq_count);
  312. if (error < 0)
  313. return error;
  314. irq_resources = devm_kcalloc(&mc_bus_dev->dev,
  315. irq_count, sizeof(*irq_resources),
  316. GFP_KERNEL);
  317. if (!irq_resources) {
  318. error = -ENOMEM;
  319. goto cleanup_msi_irqs;
  320. }
  321. for (i = 0; i < irq_count; i++) {
  322. mc_dev_irq = &irq_resources[i];
  323. /*
  324. * NOTE: This mc_dev_irq's MSI addr/value pair will be set
  325. * by the fsl_mc_msi_write_msg() callback
  326. */
  327. mc_dev_irq->resource.type = res_pool->type;
  328. mc_dev_irq->resource.data = mc_dev_irq;
  329. mc_dev_irq->resource.parent_pool = res_pool;
  330. INIT_LIST_HEAD(&mc_dev_irq->resource.node);
  331. list_add_tail(&mc_dev_irq->resource.node, &res_pool->free_list);
  332. }
  333. for_each_msi_entry(msi_desc, &mc_bus_dev->dev) {
  334. mc_dev_irq = &irq_resources[msi_desc->fsl_mc.msi_index];
  335. mc_dev_irq->msi_desc = msi_desc;
  336. mc_dev_irq->resource.id = msi_desc->irq;
  337. }
  338. res_pool->max_count = irq_count;
  339. res_pool->free_count = irq_count;
  340. mc_bus->irq_resources = irq_resources;
  341. return 0;
  342. cleanup_msi_irqs:
  343. fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
  344. return error;
  345. }
  346. EXPORT_SYMBOL_GPL(fsl_mc_populate_irq_pool);
  347. /**
  348. * Teardown the interrupt pool associated with an fsl-mc bus.
  349. * It frees the IRQs that were allocated to the pool, back to the GIC-ITS.
  350. */
  351. void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus)
  352. {
  353. struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev;
  354. struct fsl_mc_resource_pool *res_pool =
  355. &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  356. if (!mc_bus->irq_resources)
  357. return;
  358. if (res_pool->max_count == 0)
  359. return;
  360. if (res_pool->free_count != res_pool->max_count)
  361. return;
  362. INIT_LIST_HEAD(&res_pool->free_list);
  363. res_pool->max_count = 0;
  364. res_pool->free_count = 0;
  365. mc_bus->irq_resources = NULL;
  366. fsl_mc_msi_domain_free_irqs(&mc_bus_dev->dev);
  367. }
  368. EXPORT_SYMBOL_GPL(fsl_mc_cleanup_irq_pool);
  369. /**
  370. * Allocate the IRQs required by a given fsl-mc device.
  371. */
  372. int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev)
  373. {
  374. int i;
  375. int irq_count;
  376. int res_allocated_count = 0;
  377. int error = -EINVAL;
  378. struct fsl_mc_device_irq **irqs = NULL;
  379. struct fsl_mc_bus *mc_bus;
  380. struct fsl_mc_resource_pool *res_pool;
  381. if (mc_dev->irqs)
  382. return -EINVAL;
  383. irq_count = mc_dev->obj_desc.irq_count;
  384. if (irq_count == 0)
  385. return -EINVAL;
  386. if (is_fsl_mc_bus_dprc(mc_dev))
  387. mc_bus = to_fsl_mc_bus(mc_dev);
  388. else
  389. mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent));
  390. if (!mc_bus->irq_resources)
  391. return -EINVAL;
  392. res_pool = &mc_bus->resource_pools[FSL_MC_POOL_IRQ];
  393. if (res_pool->free_count < irq_count) {
  394. dev_err(&mc_dev->dev,
  395. "Not able to allocate %u irqs for device\n", irq_count);
  396. return -ENOSPC;
  397. }
  398. irqs = devm_kcalloc(&mc_dev->dev, irq_count, sizeof(irqs[0]),
  399. GFP_KERNEL);
  400. if (!irqs)
  401. return -ENOMEM;
  402. for (i = 0; i < irq_count; i++) {
  403. struct fsl_mc_resource *resource;
  404. error = fsl_mc_resource_allocate(mc_bus, FSL_MC_POOL_IRQ,
  405. &resource);
  406. if (error < 0)
  407. goto error_resource_alloc;
  408. irqs[i] = to_fsl_mc_irq(resource);
  409. res_allocated_count++;
  410. irqs[i]->mc_dev = mc_dev;
  411. irqs[i]->dev_irq_index = i;
  412. }
  413. mc_dev->irqs = irqs;
  414. return 0;
  415. error_resource_alloc:
  416. for (i = 0; i < res_allocated_count; i++) {
  417. irqs[i]->mc_dev = NULL;
  418. fsl_mc_resource_free(&irqs[i]->resource);
  419. }
  420. return error;
  421. }
  422. EXPORT_SYMBOL_GPL(fsl_mc_allocate_irqs);
  423. /*
  424. * Frees the IRQs that were allocated for an fsl-mc device.
  425. */
  426. void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev)
  427. {
  428. int i;
  429. int irq_count;
  430. struct fsl_mc_bus *mc_bus;
  431. struct fsl_mc_device_irq **irqs = mc_dev->irqs;
  432. if (!irqs)
  433. return;
  434. irq_count = mc_dev->obj_desc.irq_count;
  435. if (is_fsl_mc_bus_dprc(mc_dev))
  436. mc_bus = to_fsl_mc_bus(mc_dev);
  437. else
  438. mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent));
  439. if (!mc_bus->irq_resources)
  440. return;
  441. for (i = 0; i < irq_count; i++) {
  442. irqs[i]->mc_dev = NULL;
  443. fsl_mc_resource_free(&irqs[i]->resource);
  444. }
  445. mc_dev->irqs = NULL;
  446. }
  447. EXPORT_SYMBOL_GPL(fsl_mc_free_irqs);
  448. void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
  449. {
  450. int pool_type;
  451. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  452. for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++) {
  453. struct fsl_mc_resource_pool *res_pool =
  454. &mc_bus->resource_pools[pool_type];
  455. res_pool->type = pool_type;
  456. res_pool->max_count = 0;
  457. res_pool->free_count = 0;
  458. res_pool->mc_bus = mc_bus;
  459. INIT_LIST_HEAD(&res_pool->free_list);
  460. mutex_init(&res_pool->mutex);
  461. }
  462. }
  463. static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
  464. enum fsl_mc_pool_type pool_type)
  465. {
  466. struct fsl_mc_resource *resource;
  467. struct fsl_mc_resource *next;
  468. struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
  469. struct fsl_mc_resource_pool *res_pool =
  470. &mc_bus->resource_pools[pool_type];
  471. int free_count = 0;
  472. list_for_each_entry_safe(resource, next, &res_pool->free_list, node) {
  473. free_count++;
  474. devm_kfree(&mc_bus_dev->dev, resource);
  475. }
  476. }
  477. void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
  478. {
  479. int pool_type;
  480. for (pool_type = 0; pool_type < FSL_MC_NUM_POOL_TYPES; pool_type++)
  481. fsl_mc_cleanup_resource_pool(mc_bus_dev, pool_type);
  482. }
  483. /**
  484. * fsl_mc_allocator_probe - callback invoked when an allocatable device is
  485. * being added to the system
  486. */
  487. static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
  488. {
  489. enum fsl_mc_pool_type pool_type;
  490. struct fsl_mc_device *mc_bus_dev;
  491. struct fsl_mc_bus *mc_bus;
  492. int error;
  493. if (!fsl_mc_is_allocatable(mc_dev))
  494. return -EINVAL;
  495. mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
  496. if (!dev_is_fsl_mc(&mc_bus_dev->dev))
  497. return -EINVAL;
  498. mc_bus = to_fsl_mc_bus(mc_bus_dev);
  499. error = object_type_to_pool_type(mc_dev->obj_desc.type, &pool_type);
  500. if (error < 0)
  501. return error;
  502. error = fsl_mc_resource_pool_add_device(mc_bus, pool_type, mc_dev);
  503. if (error < 0)
  504. return error;
  505. dev_dbg(&mc_dev->dev,
  506. "Allocatable fsl-mc device bound to fsl_mc_allocator driver");
  507. return 0;
  508. }
  509. /**
  510. * fsl_mc_allocator_remove - callback invoked when an allocatable device is
  511. * being removed from the system
  512. */
  513. static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
  514. {
  515. int error;
  516. if (!fsl_mc_is_allocatable(mc_dev))
  517. return -EINVAL;
  518. if (mc_dev->resource) {
  519. error = fsl_mc_resource_pool_remove_device(mc_dev);
  520. if (error < 0)
  521. return error;
  522. }
  523. dev_dbg(&mc_dev->dev,
  524. "Allocatable fsl-mc device unbound from fsl_mc_allocator driver");
  525. return 0;
  526. }
  527. static const struct fsl_mc_device_id match_id_table[] = {
  528. {
  529. .vendor = FSL_MC_VENDOR_FREESCALE,
  530. .obj_type = "dpbp",
  531. },
  532. {
  533. .vendor = FSL_MC_VENDOR_FREESCALE,
  534. .obj_type = "dpmcp",
  535. },
  536. {
  537. .vendor = FSL_MC_VENDOR_FREESCALE,
  538. .obj_type = "dpcon",
  539. },
  540. {.vendor = 0x0},
  541. };
  542. static struct fsl_mc_driver fsl_mc_allocator_driver = {
  543. .driver = {
  544. .name = "fsl_mc_allocator",
  545. .pm = NULL,
  546. },
  547. .match_id_table = match_id_table,
  548. .probe = fsl_mc_allocator_probe,
  549. .remove = fsl_mc_allocator_remove,
  550. };
  551. int __init fsl_mc_allocator_driver_init(void)
  552. {
  553. return fsl_mc_driver_register(&fsl_mc_allocator_driver);
  554. }
  555. void fsl_mc_allocator_driver_exit(void)
  556. {
  557. fsl_mc_driver_unregister(&fsl_mc_allocator_driver);
  558. }