omap-iommu.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327
  1. /*
  2. * omap iommu: tlb and pagetable primitives
  3. *
  4. * Copyright (C) 2008-2010 Nokia Corporation
  5. *
  6. * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
  7. * Paul Mundt and Toshihiro Kobayashi
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/err.h>
  14. #include <linux/module.h>
  15. #include <linux/slab.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/ioport.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/iommu.h>
  20. #include <linux/omap-iommu.h>
  21. #include <linux/mutex.h>
  22. #include <linux/spinlock.h>
  23. #include <linux/io.h>
  24. #include <linux/pm_runtime.h>
  25. #include <linux/of.h>
  26. #include <linux/of_iommu.h>
  27. #include <linux/of_irq.h>
  28. #include <linux/of_platform.h>
  29. #include <asm/cacheflush.h>
  30. #include <linux/platform_data/iommu-omap.h>
  31. #include "omap-iopgtable.h"
  32. #include "omap-iommu.h"
  33. #define to_iommu(dev) \
  34. ((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
  35. #define for_each_iotlb_cr(obj, n, __i, cr) \
  36. for (__i = 0; \
  37. (__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true); \
  38. __i++)
  39. /* bitmap of the page sizes currently supported */
  40. #define OMAP_IOMMU_PGSIZES (SZ_4K | SZ_64K | SZ_1M | SZ_16M)
  41. /**
  42. * struct omap_iommu_domain - omap iommu domain
  43. * @pgtable: the page table
  44. * @iommu_dev: an omap iommu device attached to this domain. only a single
  45. * iommu device can be attached for now.
  46. * @dev: Device using this domain.
  47. * @lock: domain lock, should be taken when attaching/detaching
  48. */
  49. struct omap_iommu_domain {
  50. u32 *pgtable;
  51. struct omap_iommu *iommu_dev;
  52. struct device *dev;
  53. spinlock_t lock;
  54. };
  55. #define MMU_LOCK_BASE_SHIFT 10
  56. #define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT)
  57. #define MMU_LOCK_BASE(x) \
  58. ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
  59. #define MMU_LOCK_VICT_SHIFT 4
  60. #define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT)
  61. #define MMU_LOCK_VICT(x) \
  62. ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
  63. struct iotlb_lock {
  64. short base;
  65. short vict;
  66. };
  67. /* accommodate the difference between omap1 and omap2/3 */
  68. static const struct iommu_functions *arch_iommu;
  69. static struct platform_driver omap_iommu_driver;
  70. static struct kmem_cache *iopte_cachep;
  71. /**
  72. * omap_install_iommu_arch - Install archtecure specific iommu functions
  73. * @ops: a pointer to architecture specific iommu functions
  74. *
  75. * There are several kind of iommu algorithm(tlb, pagetable) among
  76. * omap series. This interface installs such an iommu algorighm.
  77. **/
  78. int omap_install_iommu_arch(const struct iommu_functions *ops)
  79. {
  80. if (arch_iommu)
  81. return -EBUSY;
  82. arch_iommu = ops;
  83. return 0;
  84. }
  85. EXPORT_SYMBOL_GPL(omap_install_iommu_arch);
  86. /**
  87. * omap_uninstall_iommu_arch - Uninstall archtecure specific iommu functions
  88. * @ops: a pointer to architecture specific iommu functions
  89. *
  90. * This interface uninstalls the iommu algorighm installed previously.
  91. **/
  92. void omap_uninstall_iommu_arch(const struct iommu_functions *ops)
  93. {
  94. if (arch_iommu != ops)
  95. pr_err("%s: not your arch\n", __func__);
  96. arch_iommu = NULL;
  97. }
  98. EXPORT_SYMBOL_GPL(omap_uninstall_iommu_arch);
  99. /**
  100. * omap_iommu_save_ctx - Save registers for pm off-mode support
  101. * @dev: client device
  102. **/
  103. void omap_iommu_save_ctx(struct device *dev)
  104. {
  105. struct omap_iommu *obj = dev_to_omap_iommu(dev);
  106. arch_iommu->save_ctx(obj);
  107. }
  108. EXPORT_SYMBOL_GPL(omap_iommu_save_ctx);
  109. /**
  110. * omap_iommu_restore_ctx - Restore registers for pm off-mode support
  111. * @dev: client device
  112. **/
  113. void omap_iommu_restore_ctx(struct device *dev)
  114. {
  115. struct omap_iommu *obj = dev_to_omap_iommu(dev);
  116. arch_iommu->restore_ctx(obj);
  117. }
  118. EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx);
  119. /**
  120. * omap_iommu_arch_version - Return running iommu arch version
  121. **/
  122. u32 omap_iommu_arch_version(void)
  123. {
  124. return arch_iommu->version;
  125. }
  126. EXPORT_SYMBOL_GPL(omap_iommu_arch_version);
  127. static int iommu_enable(struct omap_iommu *obj)
  128. {
  129. int err;
  130. struct platform_device *pdev = to_platform_device(obj->dev);
  131. struct iommu_platform_data *pdata = pdev->dev.platform_data;
  132. if (!arch_iommu)
  133. return -ENODEV;
  134. if (pdata && pdata->deassert_reset) {
  135. err = pdata->deassert_reset(pdev, pdata->reset_name);
  136. if (err) {
  137. dev_err(obj->dev, "deassert_reset failed: %d\n", err);
  138. return err;
  139. }
  140. }
  141. pm_runtime_get_sync(obj->dev);
  142. err = arch_iommu->enable(obj);
  143. return err;
  144. }
  145. static void iommu_disable(struct omap_iommu *obj)
  146. {
  147. struct platform_device *pdev = to_platform_device(obj->dev);
  148. struct iommu_platform_data *pdata = pdev->dev.platform_data;
  149. arch_iommu->disable(obj);
  150. pm_runtime_put_sync(obj->dev);
  151. if (pdata && pdata->assert_reset)
  152. pdata->assert_reset(pdev, pdata->reset_name);
  153. }
  154. /*
  155. * TLB operations
  156. */
  157. void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e)
  158. {
  159. BUG_ON(!cr || !e);
  160. arch_iommu->cr_to_e(cr, e);
  161. }
  162. EXPORT_SYMBOL_GPL(omap_iotlb_cr_to_e);
  163. static inline int iotlb_cr_valid(struct cr_regs *cr)
  164. {
  165. if (!cr)
  166. return -EINVAL;
  167. return arch_iommu->cr_valid(cr);
  168. }
  169. static inline struct cr_regs *iotlb_alloc_cr(struct omap_iommu *obj,
  170. struct iotlb_entry *e)
  171. {
  172. if (!e)
  173. return NULL;
  174. return arch_iommu->alloc_cr(obj, e);
  175. }
  176. static u32 iotlb_cr_to_virt(struct cr_regs *cr)
  177. {
  178. return arch_iommu->cr_to_virt(cr);
  179. }
  180. static u32 get_iopte_attr(struct iotlb_entry *e)
  181. {
  182. return arch_iommu->get_pte_attr(e);
  183. }
  184. static u32 iommu_report_fault(struct omap_iommu *obj, u32 *da)
  185. {
  186. return arch_iommu->fault_isr(obj, da);
  187. }
  188. static void iotlb_lock_get(struct omap_iommu *obj, struct iotlb_lock *l)
  189. {
  190. u32 val;
  191. val = iommu_read_reg(obj, MMU_LOCK);
  192. l->base = MMU_LOCK_BASE(val);
  193. l->vict = MMU_LOCK_VICT(val);
  194. }
  195. static void iotlb_lock_set(struct omap_iommu *obj, struct iotlb_lock *l)
  196. {
  197. u32 val;
  198. val = (l->base << MMU_LOCK_BASE_SHIFT);
  199. val |= (l->vict << MMU_LOCK_VICT_SHIFT);
  200. iommu_write_reg(obj, val, MMU_LOCK);
  201. }
  202. static void iotlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr)
  203. {
  204. arch_iommu->tlb_read_cr(obj, cr);
  205. }
  206. static void iotlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr)
  207. {
  208. arch_iommu->tlb_load_cr(obj, cr);
  209. iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
  210. iommu_write_reg(obj, 1, MMU_LD_TLB);
  211. }
  212. /**
  213. * iotlb_dump_cr - Dump an iommu tlb entry into buf
  214. * @obj: target iommu
  215. * @cr: contents of cam and ram register
  216. * @buf: output buffer
  217. **/
  218. static inline ssize_t iotlb_dump_cr(struct omap_iommu *obj, struct cr_regs *cr,
  219. char *buf)
  220. {
  221. BUG_ON(!cr || !buf);
  222. return arch_iommu->dump_cr(obj, cr, buf);
  223. }
  224. /* only used in iotlb iteration for-loop */
  225. static struct cr_regs __iotlb_read_cr(struct omap_iommu *obj, int n)
  226. {
  227. struct cr_regs cr;
  228. struct iotlb_lock l;
  229. iotlb_lock_get(obj, &l);
  230. l.vict = n;
  231. iotlb_lock_set(obj, &l);
  232. iotlb_read_cr(obj, &cr);
  233. return cr;
  234. }
  235. /**
  236. * load_iotlb_entry - Set an iommu tlb entry
  237. * @obj: target iommu
  238. * @e: an iommu tlb entry info
  239. **/
  240. #ifdef PREFETCH_IOTLB
  241. static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
  242. {
  243. int err = 0;
  244. struct iotlb_lock l;
  245. struct cr_regs *cr;
  246. if (!obj || !obj->nr_tlb_entries || !e)
  247. return -EINVAL;
  248. pm_runtime_get_sync(obj->dev);
  249. iotlb_lock_get(obj, &l);
  250. if (l.base == obj->nr_tlb_entries) {
  251. dev_warn(obj->dev, "%s: preserve entries full\n", __func__);
  252. err = -EBUSY;
  253. goto out;
  254. }
  255. if (!e->prsvd) {
  256. int i;
  257. struct cr_regs tmp;
  258. for_each_iotlb_cr(obj, obj->nr_tlb_entries, i, tmp)
  259. if (!iotlb_cr_valid(&tmp))
  260. break;
  261. if (i == obj->nr_tlb_entries) {
  262. dev_dbg(obj->dev, "%s: full: no entry\n", __func__);
  263. err = -EBUSY;
  264. goto out;
  265. }
  266. iotlb_lock_get(obj, &l);
  267. } else {
  268. l.vict = l.base;
  269. iotlb_lock_set(obj, &l);
  270. }
  271. cr = iotlb_alloc_cr(obj, e);
  272. if (IS_ERR(cr)) {
  273. pm_runtime_put_sync(obj->dev);
  274. return PTR_ERR(cr);
  275. }
  276. iotlb_load_cr(obj, cr);
  277. kfree(cr);
  278. if (e->prsvd)
  279. l.base++;
  280. /* increment victim for next tlb load */
  281. if (++l.vict == obj->nr_tlb_entries)
  282. l.vict = l.base;
  283. iotlb_lock_set(obj, &l);
  284. out:
  285. pm_runtime_put_sync(obj->dev);
  286. return err;
  287. }
  288. #else /* !PREFETCH_IOTLB */
  289. static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
  290. {
  291. return 0;
  292. }
  293. #endif /* !PREFETCH_IOTLB */
  294. static int prefetch_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
  295. {
  296. return load_iotlb_entry(obj, e);
  297. }
  298. /**
  299. * flush_iotlb_page - Clear an iommu tlb entry
  300. * @obj: target iommu
  301. * @da: iommu device virtual address
  302. *
  303. * Clear an iommu tlb entry which includes 'da' address.
  304. **/
  305. static void flush_iotlb_page(struct omap_iommu *obj, u32 da)
  306. {
  307. int i;
  308. struct cr_regs cr;
  309. pm_runtime_get_sync(obj->dev);
  310. for_each_iotlb_cr(obj, obj->nr_tlb_entries, i, cr) {
  311. u32 start;
  312. size_t bytes;
  313. if (!iotlb_cr_valid(&cr))
  314. continue;
  315. start = iotlb_cr_to_virt(&cr);
  316. bytes = iopgsz_to_bytes(cr.cam & 3);
  317. if ((start <= da) && (da < start + bytes)) {
  318. dev_dbg(obj->dev, "%s: %08x<=%08x(%x)\n",
  319. __func__, start, da, bytes);
  320. iotlb_load_cr(obj, &cr);
  321. iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
  322. break;
  323. }
  324. }
  325. pm_runtime_put_sync(obj->dev);
  326. if (i == obj->nr_tlb_entries)
  327. dev_dbg(obj->dev, "%s: no page for %08x\n", __func__, da);
  328. }
  329. /**
  330. * flush_iotlb_all - Clear all iommu tlb entries
  331. * @obj: target iommu
  332. **/
  333. static void flush_iotlb_all(struct omap_iommu *obj)
  334. {
  335. struct iotlb_lock l;
  336. pm_runtime_get_sync(obj->dev);
  337. l.base = 0;
  338. l.vict = 0;
  339. iotlb_lock_set(obj, &l);
  340. iommu_write_reg(obj, 1, MMU_GFLUSH);
  341. pm_runtime_put_sync(obj->dev);
  342. }
  343. #if defined(CONFIG_OMAP_IOMMU_DEBUG) || defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE)
  344. ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t bytes)
  345. {
  346. if (!obj || !buf)
  347. return -EINVAL;
  348. pm_runtime_get_sync(obj->dev);
  349. bytes = arch_iommu->dump_ctx(obj, buf, bytes);
  350. pm_runtime_put_sync(obj->dev);
  351. return bytes;
  352. }
  353. EXPORT_SYMBOL_GPL(omap_iommu_dump_ctx);
  354. static int
  355. __dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num)
  356. {
  357. int i;
  358. struct iotlb_lock saved;
  359. struct cr_regs tmp;
  360. struct cr_regs *p = crs;
  361. pm_runtime_get_sync(obj->dev);
  362. iotlb_lock_get(obj, &saved);
  363. for_each_iotlb_cr(obj, num, i, tmp) {
  364. if (!iotlb_cr_valid(&tmp))
  365. continue;
  366. *p++ = tmp;
  367. }
  368. iotlb_lock_set(obj, &saved);
  369. pm_runtime_put_sync(obj->dev);
  370. return p - crs;
  371. }
  372. /**
  373. * omap_dump_tlb_entries - dump cr arrays to given buffer
  374. * @obj: target iommu
  375. * @buf: output buffer
  376. **/
  377. size_t omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t bytes)
  378. {
  379. int i, num;
  380. struct cr_regs *cr;
  381. char *p = buf;
  382. num = bytes / sizeof(*cr);
  383. num = min(obj->nr_tlb_entries, num);
  384. cr = kcalloc(num, sizeof(*cr), GFP_KERNEL);
  385. if (!cr)
  386. return 0;
  387. num = __dump_tlb_entries(obj, cr, num);
  388. for (i = 0; i < num; i++)
  389. p += iotlb_dump_cr(obj, cr + i, p);
  390. kfree(cr);
  391. return p - buf;
  392. }
  393. EXPORT_SYMBOL_GPL(omap_dump_tlb_entries);
  394. int omap_foreach_iommu_device(void *data, int (*fn)(struct device *, void *))
  395. {
  396. return driver_for_each_device(&omap_iommu_driver.driver,
  397. NULL, data, fn);
  398. }
  399. EXPORT_SYMBOL_GPL(omap_foreach_iommu_device);
  400. #endif /* CONFIG_OMAP_IOMMU_DEBUG_MODULE */
  401. /*
  402. * H/W pagetable operations
  403. */
  404. static void flush_iopgd_range(u32 *first, u32 *last)
  405. {
  406. /* FIXME: L2 cache should be taken care of if it exists */
  407. do {
  408. asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pgd"
  409. : : "r" (first));
  410. first += L1_CACHE_BYTES / sizeof(*first);
  411. } while (first <= last);
  412. }
  413. static void flush_iopte_range(u32 *first, u32 *last)
  414. {
  415. /* FIXME: L2 cache should be taken care of if it exists */
  416. do {
  417. asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pte"
  418. : : "r" (first));
  419. first += L1_CACHE_BYTES / sizeof(*first);
  420. } while (first <= last);
  421. }
  422. static void iopte_free(u32 *iopte)
  423. {
  424. /* Note: freed iopte's must be clean ready for re-use */
  425. if (iopte)
  426. kmem_cache_free(iopte_cachep, iopte);
  427. }
  428. static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd, u32 da)
  429. {
  430. u32 *iopte;
  431. /* a table has already existed */
  432. if (*iopgd)
  433. goto pte_ready;
  434. /*
  435. * do the allocation outside the page table lock
  436. */
  437. spin_unlock(&obj->page_table_lock);
  438. iopte = kmem_cache_zalloc(iopte_cachep, GFP_KERNEL);
  439. spin_lock(&obj->page_table_lock);
  440. if (!*iopgd) {
  441. if (!iopte)
  442. return ERR_PTR(-ENOMEM);
  443. *iopgd = virt_to_phys(iopte) | IOPGD_TABLE;
  444. flush_iopgd_range(iopgd, iopgd);
  445. dev_vdbg(obj->dev, "%s: a new pte:%p\n", __func__, iopte);
  446. } else {
  447. /* We raced, free the reduniovant table */
  448. iopte_free(iopte);
  449. }
  450. pte_ready:
  451. iopte = iopte_offset(iopgd, da);
  452. dev_vdbg(obj->dev,
  453. "%s: da:%08x pgd:%p *pgd:%08x pte:%p *pte:%08x\n",
  454. __func__, da, iopgd, *iopgd, iopte, *iopte);
  455. return iopte;
  456. }
  457. static int iopgd_alloc_section(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
  458. {
  459. u32 *iopgd = iopgd_offset(obj, da);
  460. if ((da | pa) & ~IOSECTION_MASK) {
  461. dev_err(obj->dev, "%s: %08x:%08x should aligned on %08lx\n",
  462. __func__, da, pa, IOSECTION_SIZE);
  463. return -EINVAL;
  464. }
  465. *iopgd = (pa & IOSECTION_MASK) | prot | IOPGD_SECTION;
  466. flush_iopgd_range(iopgd, iopgd);
  467. return 0;
  468. }
  469. static int iopgd_alloc_super(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
  470. {
  471. u32 *iopgd = iopgd_offset(obj, da);
  472. int i;
  473. if ((da | pa) & ~IOSUPER_MASK) {
  474. dev_err(obj->dev, "%s: %08x:%08x should aligned on %08lx\n",
  475. __func__, da, pa, IOSUPER_SIZE);
  476. return -EINVAL;
  477. }
  478. for (i = 0; i < 16; i++)
  479. *(iopgd + i) = (pa & IOSUPER_MASK) | prot | IOPGD_SUPER;
  480. flush_iopgd_range(iopgd, iopgd + 15);
  481. return 0;
  482. }
  483. static int iopte_alloc_page(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
  484. {
  485. u32 *iopgd = iopgd_offset(obj, da);
  486. u32 *iopte = iopte_alloc(obj, iopgd, da);
  487. if (IS_ERR(iopte))
  488. return PTR_ERR(iopte);
  489. *iopte = (pa & IOPAGE_MASK) | prot | IOPTE_SMALL;
  490. flush_iopte_range(iopte, iopte);
  491. dev_vdbg(obj->dev, "%s: da:%08x pa:%08x pte:%p *pte:%08x\n",
  492. __func__, da, pa, iopte, *iopte);
  493. return 0;
  494. }
  495. static int iopte_alloc_large(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
  496. {
  497. u32 *iopgd = iopgd_offset(obj, da);
  498. u32 *iopte = iopte_alloc(obj, iopgd, da);
  499. int i;
  500. if ((da | pa) & ~IOLARGE_MASK) {
  501. dev_err(obj->dev, "%s: %08x:%08x should aligned on %08lx\n",
  502. __func__, da, pa, IOLARGE_SIZE);
  503. return -EINVAL;
  504. }
  505. if (IS_ERR(iopte))
  506. return PTR_ERR(iopte);
  507. for (i = 0; i < 16; i++)
  508. *(iopte + i) = (pa & IOLARGE_MASK) | prot | IOPTE_LARGE;
  509. flush_iopte_range(iopte, iopte + 15);
  510. return 0;
  511. }
  512. static int
  513. iopgtable_store_entry_core(struct omap_iommu *obj, struct iotlb_entry *e)
  514. {
  515. int (*fn)(struct omap_iommu *, u32, u32, u32);
  516. u32 prot;
  517. int err;
  518. if (!obj || !e)
  519. return -EINVAL;
  520. switch (e->pgsz) {
  521. case MMU_CAM_PGSZ_16M:
  522. fn = iopgd_alloc_super;
  523. break;
  524. case MMU_CAM_PGSZ_1M:
  525. fn = iopgd_alloc_section;
  526. break;
  527. case MMU_CAM_PGSZ_64K:
  528. fn = iopte_alloc_large;
  529. break;
  530. case MMU_CAM_PGSZ_4K:
  531. fn = iopte_alloc_page;
  532. break;
  533. default:
  534. fn = NULL;
  535. BUG();
  536. break;
  537. }
  538. prot = get_iopte_attr(e);
  539. spin_lock(&obj->page_table_lock);
  540. err = fn(obj, e->da, e->pa, prot);
  541. spin_unlock(&obj->page_table_lock);
  542. return err;
  543. }
  544. /**
  545. * omap_iopgtable_store_entry - Make an iommu pte entry
  546. * @obj: target iommu
  547. * @e: an iommu tlb entry info
  548. **/
  549. int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e)
  550. {
  551. int err;
  552. flush_iotlb_page(obj, e->da);
  553. err = iopgtable_store_entry_core(obj, e);
  554. if (!err)
  555. prefetch_iotlb_entry(obj, e);
  556. return err;
  557. }
  558. EXPORT_SYMBOL_GPL(omap_iopgtable_store_entry);
  559. /**
  560. * iopgtable_lookup_entry - Lookup an iommu pte entry
  561. * @obj: target iommu
  562. * @da: iommu device virtual address
  563. * @ppgd: iommu pgd entry pointer to be returned
  564. * @ppte: iommu pte entry pointer to be returned
  565. **/
  566. static void
  567. iopgtable_lookup_entry(struct omap_iommu *obj, u32 da, u32 **ppgd, u32 **ppte)
  568. {
  569. u32 *iopgd, *iopte = NULL;
  570. iopgd = iopgd_offset(obj, da);
  571. if (!*iopgd)
  572. goto out;
  573. if (iopgd_is_table(*iopgd))
  574. iopte = iopte_offset(iopgd, da);
  575. out:
  576. *ppgd = iopgd;
  577. *ppte = iopte;
  578. }
  579. static size_t iopgtable_clear_entry_core(struct omap_iommu *obj, u32 da)
  580. {
  581. size_t bytes;
  582. u32 *iopgd = iopgd_offset(obj, da);
  583. int nent = 1;
  584. if (!*iopgd)
  585. return 0;
  586. if (iopgd_is_table(*iopgd)) {
  587. int i;
  588. u32 *iopte = iopte_offset(iopgd, da);
  589. bytes = IOPTE_SIZE;
  590. if (*iopte & IOPTE_LARGE) {
  591. nent *= 16;
  592. /* rewind to the 1st entry */
  593. iopte = iopte_offset(iopgd, (da & IOLARGE_MASK));
  594. }
  595. bytes *= nent;
  596. memset(iopte, 0, nent * sizeof(*iopte));
  597. flush_iopte_range(iopte, iopte + (nent - 1) * sizeof(*iopte));
  598. /*
  599. * do table walk to check if this table is necessary or not
  600. */
  601. iopte = iopte_offset(iopgd, 0);
  602. for (i = 0; i < PTRS_PER_IOPTE; i++)
  603. if (iopte[i])
  604. goto out;
  605. iopte_free(iopte);
  606. nent = 1; /* for the next L1 entry */
  607. } else {
  608. bytes = IOPGD_SIZE;
  609. if ((*iopgd & IOPGD_SUPER) == IOPGD_SUPER) {
  610. nent *= 16;
  611. /* rewind to the 1st entry */
  612. iopgd = iopgd_offset(obj, (da & IOSUPER_MASK));
  613. }
  614. bytes *= nent;
  615. }
  616. memset(iopgd, 0, nent * sizeof(*iopgd));
  617. flush_iopgd_range(iopgd, iopgd + (nent - 1) * sizeof(*iopgd));
  618. out:
  619. return bytes;
  620. }
  621. /**
  622. * iopgtable_clear_entry - Remove an iommu pte entry
  623. * @obj: target iommu
  624. * @da: iommu device virtual address
  625. **/
  626. static size_t iopgtable_clear_entry(struct omap_iommu *obj, u32 da)
  627. {
  628. size_t bytes;
  629. spin_lock(&obj->page_table_lock);
  630. bytes = iopgtable_clear_entry_core(obj, da);
  631. flush_iotlb_page(obj, da);
  632. spin_unlock(&obj->page_table_lock);
  633. return bytes;
  634. }
  635. static void iopgtable_clear_entry_all(struct omap_iommu *obj)
  636. {
  637. int i;
  638. spin_lock(&obj->page_table_lock);
  639. for (i = 0; i < PTRS_PER_IOPGD; i++) {
  640. u32 da;
  641. u32 *iopgd;
  642. da = i << IOPGD_SHIFT;
  643. iopgd = iopgd_offset(obj, da);
  644. if (!*iopgd)
  645. continue;
  646. if (iopgd_is_table(*iopgd))
  647. iopte_free(iopte_offset(iopgd, 0));
  648. *iopgd = 0;
  649. flush_iopgd_range(iopgd, iopgd);
  650. }
  651. flush_iotlb_all(obj);
  652. spin_unlock(&obj->page_table_lock);
  653. }
  654. /*
  655. * Device IOMMU generic operations
  656. */
  657. static irqreturn_t iommu_fault_handler(int irq, void *data)
  658. {
  659. u32 da, errs;
  660. u32 *iopgd, *iopte;
  661. struct omap_iommu *obj = data;
  662. struct iommu_domain *domain = obj->domain;
  663. if (!obj->refcount)
  664. return IRQ_NONE;
  665. errs = iommu_report_fault(obj, &da);
  666. if (errs == 0)
  667. return IRQ_HANDLED;
  668. /* Fault callback or TLB/PTE Dynamic loading */
  669. if (!report_iommu_fault(domain, obj->dev, da, 0))
  670. return IRQ_HANDLED;
  671. iommu_disable(obj);
  672. iopgd = iopgd_offset(obj, da);
  673. if (!iopgd_is_table(*iopgd)) {
  674. dev_err(obj->dev, "%s: errs:0x%08x da:0x%08x pgd:0x%p *pgd:px%08x\n",
  675. obj->name, errs, da, iopgd, *iopgd);
  676. return IRQ_NONE;
  677. }
  678. iopte = iopte_offset(iopgd, da);
  679. dev_err(obj->dev, "%s: errs:0x%08x da:0x%08x pgd:0x%p *pgd:0x%08x pte:0x%p *pte:0x%08x\n",
  680. obj->name, errs, da, iopgd, *iopgd, iopte, *iopte);
  681. return IRQ_NONE;
  682. }
  683. static int device_match_by_alias(struct device *dev, void *data)
  684. {
  685. struct omap_iommu *obj = to_iommu(dev);
  686. const char *name = data;
  687. pr_debug("%s: %s %s\n", __func__, obj->name, name);
  688. return strcmp(obj->name, name) == 0;
  689. }
  690. /**
  691. * omap_iommu_attach() - attach iommu device to an iommu domain
  692. * @name: name of target omap iommu device
  693. * @iopgd: page table
  694. **/
  695. static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd)
  696. {
  697. int err;
  698. struct device *dev;
  699. struct omap_iommu *obj;
  700. dev = driver_find_device(&omap_iommu_driver.driver, NULL,
  701. (void *)name,
  702. device_match_by_alias);
  703. if (!dev)
  704. return ERR_PTR(-ENODEV);
  705. obj = to_iommu(dev);
  706. spin_lock(&obj->iommu_lock);
  707. /* an iommu device can only be attached once */
  708. if (++obj->refcount > 1) {
  709. dev_err(dev, "%s: already attached!\n", obj->name);
  710. err = -EBUSY;
  711. goto err_enable;
  712. }
  713. obj->iopgd = iopgd;
  714. err = iommu_enable(obj);
  715. if (err)
  716. goto err_enable;
  717. flush_iotlb_all(obj);
  718. spin_unlock(&obj->iommu_lock);
  719. dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name);
  720. return obj;
  721. err_enable:
  722. obj->refcount--;
  723. spin_unlock(&obj->iommu_lock);
  724. return ERR_PTR(err);
  725. }
  726. /**
  727. * omap_iommu_detach - release iommu device
  728. * @obj: target iommu
  729. **/
  730. static void omap_iommu_detach(struct omap_iommu *obj)
  731. {
  732. if (!obj || IS_ERR(obj))
  733. return;
  734. spin_lock(&obj->iommu_lock);
  735. if (--obj->refcount == 0)
  736. iommu_disable(obj);
  737. obj->iopgd = NULL;
  738. spin_unlock(&obj->iommu_lock);
  739. dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name);
  740. }
  741. /*
  742. * OMAP Device MMU(IOMMU) detection
  743. */
  744. static int omap_iommu_probe(struct platform_device *pdev)
  745. {
  746. int err = -ENODEV;
  747. int irq;
  748. struct omap_iommu *obj;
  749. struct resource *res;
  750. struct iommu_platform_data *pdata = pdev->dev.platform_data;
  751. struct device_node *of = pdev->dev.of_node;
  752. obj = devm_kzalloc(&pdev->dev, sizeof(*obj) + MMU_REG_SIZE, GFP_KERNEL);
  753. if (!obj)
  754. return -ENOMEM;
  755. if (of) {
  756. obj->name = dev_name(&pdev->dev);
  757. obj->nr_tlb_entries = 32;
  758. err = of_property_read_u32(of, "ti,#tlb-entries",
  759. &obj->nr_tlb_entries);
  760. if (err && err != -EINVAL)
  761. return err;
  762. if (obj->nr_tlb_entries != 32 && obj->nr_tlb_entries != 8)
  763. return -EINVAL;
  764. if (of_find_property(of, "ti,iommu-bus-err-back", NULL))
  765. obj->has_bus_err_back = MMU_GP_REG_BUS_ERR_BACK_EN;
  766. } else {
  767. obj->nr_tlb_entries = pdata->nr_tlb_entries;
  768. obj->name = pdata->name;
  769. }
  770. obj->dev = &pdev->dev;
  771. obj->ctx = (void *)obj + sizeof(*obj);
  772. spin_lock_init(&obj->iommu_lock);
  773. spin_lock_init(&obj->page_table_lock);
  774. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  775. obj->regbase = devm_ioremap_resource(obj->dev, res);
  776. if (IS_ERR(obj->regbase))
  777. return PTR_ERR(obj->regbase);
  778. irq = platform_get_irq(pdev, 0);
  779. if (irq < 0)
  780. return -ENODEV;
  781. err = devm_request_irq(obj->dev, irq, iommu_fault_handler, IRQF_SHARED,
  782. dev_name(obj->dev), obj);
  783. if (err < 0)
  784. return err;
  785. platform_set_drvdata(pdev, obj);
  786. pm_runtime_irq_safe(obj->dev);
  787. pm_runtime_enable(obj->dev);
  788. dev_info(&pdev->dev, "%s registered\n", obj->name);
  789. return 0;
  790. }
  791. static int omap_iommu_remove(struct platform_device *pdev)
  792. {
  793. struct omap_iommu *obj = platform_get_drvdata(pdev);
  794. iopgtable_clear_entry_all(obj);
  795. pm_runtime_disable(obj->dev);
  796. dev_info(&pdev->dev, "%s removed\n", obj->name);
  797. return 0;
  798. }
  799. static const struct of_device_id omap_iommu_of_match[] = {
  800. { .compatible = "ti,omap2-iommu" },
  801. { .compatible = "ti,omap4-iommu" },
  802. { .compatible = "ti,dra7-iommu" },
  803. {},
  804. };
  805. MODULE_DEVICE_TABLE(of, omap_iommu_of_match);
  806. static struct platform_driver omap_iommu_driver = {
  807. .probe = omap_iommu_probe,
  808. .remove = omap_iommu_remove,
  809. .driver = {
  810. .name = "omap-iommu",
  811. .of_match_table = of_match_ptr(omap_iommu_of_match),
  812. },
  813. };
  814. static void iopte_cachep_ctor(void *iopte)
  815. {
  816. clean_dcache_area(iopte, IOPTE_TABLE_SIZE);
  817. }
  818. static u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, int pgsz)
  819. {
  820. memset(e, 0, sizeof(*e));
  821. e->da = da;
  822. e->pa = pa;
  823. e->valid = MMU_CAM_V;
  824. /* FIXME: add OMAP1 support */
  825. e->pgsz = pgsz;
  826. e->endian = MMU_RAM_ENDIAN_LITTLE;
  827. e->elsz = MMU_RAM_ELSZ_8;
  828. e->mixed = 0;
  829. return iopgsz_to_bytes(e->pgsz);
  830. }
  831. static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
  832. phys_addr_t pa, size_t bytes, int prot)
  833. {
  834. struct omap_iommu_domain *omap_domain = domain->priv;
  835. struct omap_iommu *oiommu = omap_domain->iommu_dev;
  836. struct device *dev = oiommu->dev;
  837. struct iotlb_entry e;
  838. int omap_pgsz;
  839. u32 ret;
  840. omap_pgsz = bytes_to_iopgsz(bytes);
  841. if (omap_pgsz < 0) {
  842. dev_err(dev, "invalid size to map: %d\n", bytes);
  843. return -EINVAL;
  844. }
  845. dev_dbg(dev, "mapping da 0x%lx to pa 0x%x size 0x%x\n", da, pa, bytes);
  846. iotlb_init_entry(&e, da, pa, omap_pgsz);
  847. ret = omap_iopgtable_store_entry(oiommu, &e);
  848. if (ret)
  849. dev_err(dev, "omap_iopgtable_store_entry failed: %d\n", ret);
  850. return ret;
  851. }
  852. static size_t omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
  853. size_t size)
  854. {
  855. struct omap_iommu_domain *omap_domain = domain->priv;
  856. struct omap_iommu *oiommu = omap_domain->iommu_dev;
  857. struct device *dev = oiommu->dev;
  858. dev_dbg(dev, "unmapping da 0x%lx size %u\n", da, size);
  859. return iopgtable_clear_entry(oiommu, da);
  860. }
  861. static int
  862. omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
  863. {
  864. struct omap_iommu_domain *omap_domain = domain->priv;
  865. struct omap_iommu *oiommu;
  866. struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
  867. int ret = 0;
  868. if (!arch_data || !arch_data->name) {
  869. dev_err(dev, "device doesn't have an associated iommu\n");
  870. return -EINVAL;
  871. }
  872. spin_lock(&omap_domain->lock);
  873. /* only a single device is supported per domain for now */
  874. if (omap_domain->iommu_dev) {
  875. dev_err(dev, "iommu domain is already attached\n");
  876. ret = -EBUSY;
  877. goto out;
  878. }
  879. /* get a handle to and enable the omap iommu */
  880. oiommu = omap_iommu_attach(arch_data->name, omap_domain->pgtable);
  881. if (IS_ERR(oiommu)) {
  882. ret = PTR_ERR(oiommu);
  883. dev_err(dev, "can't get omap iommu: %d\n", ret);
  884. goto out;
  885. }
  886. omap_domain->iommu_dev = arch_data->iommu_dev = oiommu;
  887. omap_domain->dev = dev;
  888. oiommu->domain = domain;
  889. out:
  890. spin_unlock(&omap_domain->lock);
  891. return ret;
  892. }
  893. static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain,
  894. struct device *dev)
  895. {
  896. struct omap_iommu *oiommu = dev_to_omap_iommu(dev);
  897. struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
  898. /* only a single device is supported per domain for now */
  899. if (omap_domain->iommu_dev != oiommu) {
  900. dev_err(dev, "invalid iommu device\n");
  901. return;
  902. }
  903. iopgtable_clear_entry_all(oiommu);
  904. omap_iommu_detach(oiommu);
  905. omap_domain->iommu_dev = arch_data->iommu_dev = NULL;
  906. omap_domain->dev = NULL;
  907. }
  908. static void omap_iommu_detach_dev(struct iommu_domain *domain,
  909. struct device *dev)
  910. {
  911. struct omap_iommu_domain *omap_domain = domain->priv;
  912. spin_lock(&omap_domain->lock);
  913. _omap_iommu_detach_dev(omap_domain, dev);
  914. spin_unlock(&omap_domain->lock);
  915. }
  916. static int omap_iommu_domain_init(struct iommu_domain *domain)
  917. {
  918. struct omap_iommu_domain *omap_domain;
  919. omap_domain = kzalloc(sizeof(*omap_domain), GFP_KERNEL);
  920. if (!omap_domain) {
  921. pr_err("kzalloc failed\n");
  922. goto out;
  923. }
  924. omap_domain->pgtable = kzalloc(IOPGD_TABLE_SIZE, GFP_KERNEL);
  925. if (!omap_domain->pgtable) {
  926. pr_err("kzalloc failed\n");
  927. goto fail_nomem;
  928. }
  929. /*
  930. * should never fail, but please keep this around to ensure
  931. * we keep the hardware happy
  932. */
  933. BUG_ON(!IS_ALIGNED((long)omap_domain->pgtable, IOPGD_TABLE_SIZE));
  934. clean_dcache_area(omap_domain->pgtable, IOPGD_TABLE_SIZE);
  935. spin_lock_init(&omap_domain->lock);
  936. domain->priv = omap_domain;
  937. domain->geometry.aperture_start = 0;
  938. domain->geometry.aperture_end = (1ULL << 32) - 1;
  939. domain->geometry.force_aperture = true;
  940. return 0;
  941. fail_nomem:
  942. kfree(omap_domain);
  943. out:
  944. return -ENOMEM;
  945. }
  946. static void omap_iommu_domain_destroy(struct iommu_domain *domain)
  947. {
  948. struct omap_iommu_domain *omap_domain = domain->priv;
  949. domain->priv = NULL;
  950. /*
  951. * An iommu device is still attached
  952. * (currently, only one device can be attached) ?
  953. */
  954. if (omap_domain->iommu_dev)
  955. _omap_iommu_detach_dev(omap_domain, omap_domain->dev);
  956. kfree(omap_domain->pgtable);
  957. kfree(omap_domain);
  958. }
  959. static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain,
  960. dma_addr_t da)
  961. {
  962. struct omap_iommu_domain *omap_domain = domain->priv;
  963. struct omap_iommu *oiommu = omap_domain->iommu_dev;
  964. struct device *dev = oiommu->dev;
  965. u32 *pgd, *pte;
  966. phys_addr_t ret = 0;
  967. iopgtable_lookup_entry(oiommu, da, &pgd, &pte);
  968. if (pte) {
  969. if (iopte_is_small(*pte))
  970. ret = omap_iommu_translate(*pte, da, IOPTE_MASK);
  971. else if (iopte_is_large(*pte))
  972. ret = omap_iommu_translate(*pte, da, IOLARGE_MASK);
  973. else
  974. dev_err(dev, "bogus pte 0x%x, da 0x%llx", *pte,
  975. (unsigned long long)da);
  976. } else {
  977. if (iopgd_is_section(*pgd))
  978. ret = omap_iommu_translate(*pgd, da, IOSECTION_MASK);
  979. else if (iopgd_is_super(*pgd))
  980. ret = omap_iommu_translate(*pgd, da, IOSUPER_MASK);
  981. else
  982. dev_err(dev, "bogus pgd 0x%x, da 0x%llx", *pgd,
  983. (unsigned long long)da);
  984. }
  985. return ret;
  986. }
  987. static int omap_iommu_add_device(struct device *dev)
  988. {
  989. struct omap_iommu_arch_data *arch_data;
  990. struct device_node *np;
  991. struct platform_device *pdev;
  992. /*
  993. * Allocate the archdata iommu structure for DT-based devices.
  994. *
  995. * TODO: Simplify this when removing non-DT support completely from the
  996. * IOMMU users.
  997. */
  998. if (!dev->of_node)
  999. return 0;
  1000. np = of_parse_phandle(dev->of_node, "iommus", 0);
  1001. if (!np)
  1002. return 0;
  1003. pdev = of_find_device_by_node(np);
  1004. if (WARN_ON(!pdev)) {
  1005. of_node_put(np);
  1006. return -EINVAL;
  1007. }
  1008. arch_data = kzalloc(sizeof(*arch_data), GFP_KERNEL);
  1009. if (!arch_data) {
  1010. of_node_put(np);
  1011. return -ENOMEM;
  1012. }
  1013. arch_data->name = kstrdup(dev_name(&pdev->dev), GFP_KERNEL);
  1014. dev->archdata.iommu = arch_data;
  1015. of_node_put(np);
  1016. return 0;
  1017. }
  1018. static void omap_iommu_remove_device(struct device *dev)
  1019. {
  1020. struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
  1021. if (!dev->of_node || !arch_data)
  1022. return;
  1023. kfree(arch_data->name);
  1024. kfree(arch_data);
  1025. }
  1026. static const struct iommu_ops omap_iommu_ops = {
  1027. .domain_init = omap_iommu_domain_init,
  1028. .domain_destroy = omap_iommu_domain_destroy,
  1029. .attach_dev = omap_iommu_attach_dev,
  1030. .detach_dev = omap_iommu_detach_dev,
  1031. .map = omap_iommu_map,
  1032. .unmap = omap_iommu_unmap,
  1033. .iova_to_phys = omap_iommu_iova_to_phys,
  1034. .add_device = omap_iommu_add_device,
  1035. .remove_device = omap_iommu_remove_device,
  1036. .pgsize_bitmap = OMAP_IOMMU_PGSIZES,
  1037. };
  1038. static int __init omap_iommu_init(void)
  1039. {
  1040. struct kmem_cache *p;
  1041. const unsigned long flags = SLAB_HWCACHE_ALIGN;
  1042. size_t align = 1 << 10; /* L2 pagetable alignement */
  1043. p = kmem_cache_create("iopte_cache", IOPTE_TABLE_SIZE, align, flags,
  1044. iopte_cachep_ctor);
  1045. if (!p)
  1046. return -ENOMEM;
  1047. iopte_cachep = p;
  1048. bus_set_iommu(&platform_bus_type, &omap_iommu_ops);
  1049. return platform_driver_register(&omap_iommu_driver);
  1050. }
  1051. /* must be ready before omap3isp is probed */
  1052. subsys_initcall(omap_iommu_init);
  1053. static void __exit omap_iommu_exit(void)
  1054. {
  1055. kmem_cache_destroy(iopte_cachep);
  1056. platform_driver_unregister(&omap_iommu_driver);
  1057. }
  1058. module_exit(omap_iommu_exit);
  1059. MODULE_DESCRIPTION("omap iommu: tlb and pagetable primitives");
  1060. MODULE_ALIAS("platform:omap-iommu");
  1061. MODULE_AUTHOR("Hiroshi DOYU, Paul Mundt and Toshihiro Kobayashi");
  1062. MODULE_LICENSE("GPL v2");