pxa2xx_timer.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /*
  2. * Intel XScale PXA255/270 OS Timers.
  3. *
  4. * Copyright (c) 2006 Openedhand Ltd.
  5. * Copyright (c) 2006 Thorsten Zitterell
  6. *
  7. * This code is licensed under the GPL.
  8. */
  9. #include "hw/hw.h"
  10. #include "qemu/timer.h"
  11. #include "sysemu/sysemu.h"
  12. #include "hw/arm/pxa.h"
  13. #include "hw/sysbus.h"
  14. #define OSMR0 0x00
  15. #define OSMR1 0x04
  16. #define OSMR2 0x08
  17. #define OSMR3 0x0c
  18. #define OSMR4 0x80
  19. #define OSMR5 0x84
  20. #define OSMR6 0x88
  21. #define OSMR7 0x8c
  22. #define OSMR8 0x90
  23. #define OSMR9 0x94
  24. #define OSMR10 0x98
  25. #define OSMR11 0x9c
  26. #define OSCR 0x10 /* OS Timer Count */
  27. #define OSCR4 0x40
  28. #define OSCR5 0x44
  29. #define OSCR6 0x48
  30. #define OSCR7 0x4c
  31. #define OSCR8 0x50
  32. #define OSCR9 0x54
  33. #define OSCR10 0x58
  34. #define OSCR11 0x5c
  35. #define OSSR 0x14 /* Timer status register */
  36. #define OWER 0x18
  37. #define OIER 0x1c /* Interrupt enable register 3-0 to E3-E0 */
  38. #define OMCR4 0xc0 /* OS Match Control registers */
  39. #define OMCR5 0xc4
  40. #define OMCR6 0xc8
  41. #define OMCR7 0xcc
  42. #define OMCR8 0xd0
  43. #define OMCR9 0xd4
  44. #define OMCR10 0xd8
  45. #define OMCR11 0xdc
  46. #define OSNR 0x20
  47. #define PXA25X_FREQ 3686400 /* 3.6864 MHz */
  48. #define PXA27X_FREQ 3250000 /* 3.25 MHz */
  49. static int pxa2xx_timer4_freq[8] = {
  50. [0] = 0,
  51. [1] = 32768,
  52. [2] = 1000,
  53. [3] = 1,
  54. [4] = 1000000,
  55. /* [5] is the "Externally supplied clock". Assign if necessary. */
  56. [5 ... 7] = 0,
  57. };
  58. #define TYPE_PXA2XX_TIMER "pxa2xx-timer"
  59. #define PXA2XX_TIMER(obj) \
  60. OBJECT_CHECK(PXA2xxTimerInfo, (obj), TYPE_PXA2XX_TIMER)
  61. typedef struct PXA2xxTimerInfo PXA2xxTimerInfo;
  62. typedef struct {
  63. uint32_t value;
  64. qemu_irq irq;
  65. QEMUTimer *qtimer;
  66. int num;
  67. PXA2xxTimerInfo *info;
  68. } PXA2xxTimer0;
  69. typedef struct {
  70. PXA2xxTimer0 tm;
  71. int32_t oldclock;
  72. int32_t clock;
  73. uint64_t lastload;
  74. uint32_t freq;
  75. uint32_t control;
  76. } PXA2xxTimer4;
  77. struct PXA2xxTimerInfo {
  78. SysBusDevice parent_obj;
  79. MemoryRegion iomem;
  80. uint32_t flags;
  81. int32_t clock;
  82. int32_t oldclock;
  83. uint64_t lastload;
  84. uint32_t freq;
  85. PXA2xxTimer0 timer[4];
  86. uint32_t events;
  87. uint32_t irq_enabled;
  88. uint32_t reset3;
  89. uint32_t snapshot;
  90. qemu_irq irq4;
  91. PXA2xxTimer4 tm4[8];
  92. };
  93. #define PXA2XX_TIMER_HAVE_TM4 0
  94. static inline int pxa2xx_timer_has_tm4(PXA2xxTimerInfo *s)
  95. {
  96. return s->flags & (1 << PXA2XX_TIMER_HAVE_TM4);
  97. }
  98. static void pxa2xx_timer_update(void *opaque, uint64_t now_qemu)
  99. {
  100. PXA2xxTimerInfo *s = (PXA2xxTimerInfo *) opaque;
  101. int i;
  102. uint32_t now_vm;
  103. uint64_t new_qemu;
  104. now_vm = s->clock +
  105. muldiv64(now_qemu - s->lastload, s->freq, get_ticks_per_sec());
  106. for (i = 0; i < 4; i ++) {
  107. new_qemu = now_qemu + muldiv64((uint32_t) (s->timer[i].value - now_vm),
  108. get_ticks_per_sec(), s->freq);
  109. timer_mod(s->timer[i].qtimer, new_qemu);
  110. }
  111. }
  112. static void pxa2xx_timer_update4(void *opaque, uint64_t now_qemu, int n)
  113. {
  114. PXA2xxTimerInfo *s = (PXA2xxTimerInfo *) opaque;
  115. uint32_t now_vm;
  116. uint64_t new_qemu;
  117. static const int counters[8] = { 0, 0, 0, 0, 4, 4, 6, 6 };
  118. int counter;
  119. if (s->tm4[n].control & (1 << 7))
  120. counter = n;
  121. else
  122. counter = counters[n];
  123. if (!s->tm4[counter].freq) {
  124. timer_del(s->tm4[n].tm.qtimer);
  125. return;
  126. }
  127. now_vm = s->tm4[counter].clock + muldiv64(now_qemu -
  128. s->tm4[counter].lastload,
  129. s->tm4[counter].freq, get_ticks_per_sec());
  130. new_qemu = now_qemu + muldiv64((uint32_t) (s->tm4[n].tm.value - now_vm),
  131. get_ticks_per_sec(), s->tm4[counter].freq);
  132. timer_mod(s->tm4[n].tm.qtimer, new_qemu);
  133. }
  134. static uint64_t pxa2xx_timer_read(void *opaque, hwaddr offset,
  135. unsigned size)
  136. {
  137. PXA2xxTimerInfo *s = (PXA2xxTimerInfo *) opaque;
  138. int tm = 0;
  139. switch (offset) {
  140. case OSMR3: tm ++;
  141. /* fall through */
  142. case OSMR2: tm ++;
  143. /* fall through */
  144. case OSMR1: tm ++;
  145. /* fall through */
  146. case OSMR0:
  147. return s->timer[tm].value;
  148. case OSMR11: tm ++;
  149. /* fall through */
  150. case OSMR10: tm ++;
  151. /* fall through */
  152. case OSMR9: tm ++;
  153. /* fall through */
  154. case OSMR8: tm ++;
  155. /* fall through */
  156. case OSMR7: tm ++;
  157. /* fall through */
  158. case OSMR6: tm ++;
  159. /* fall through */
  160. case OSMR5: tm ++;
  161. /* fall through */
  162. case OSMR4:
  163. if (!pxa2xx_timer_has_tm4(s))
  164. goto badreg;
  165. return s->tm4[tm].tm.value;
  166. case OSCR:
  167. return s->clock + muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) -
  168. s->lastload, s->freq, get_ticks_per_sec());
  169. case OSCR11: tm ++;
  170. /* fall through */
  171. case OSCR10: tm ++;
  172. /* fall through */
  173. case OSCR9: tm ++;
  174. /* fall through */
  175. case OSCR8: tm ++;
  176. /* fall through */
  177. case OSCR7: tm ++;
  178. /* fall through */
  179. case OSCR6: tm ++;
  180. /* fall through */
  181. case OSCR5: tm ++;
  182. /* fall through */
  183. case OSCR4:
  184. if (!pxa2xx_timer_has_tm4(s))
  185. goto badreg;
  186. if ((tm == 9 - 4 || tm == 11 - 4) && (s->tm4[tm].control & (1 << 9))) {
  187. if (s->tm4[tm - 1].freq)
  188. s->snapshot = s->tm4[tm - 1].clock + muldiv64(
  189. qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) -
  190. s->tm4[tm - 1].lastload,
  191. s->tm4[tm - 1].freq, get_ticks_per_sec());
  192. else
  193. s->snapshot = s->tm4[tm - 1].clock;
  194. }
  195. if (!s->tm4[tm].freq)
  196. return s->tm4[tm].clock;
  197. return s->tm4[tm].clock + muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) -
  198. s->tm4[tm].lastload, s->tm4[tm].freq, get_ticks_per_sec());
  199. case OIER:
  200. return s->irq_enabled;
  201. case OSSR: /* Status register */
  202. return s->events;
  203. case OWER:
  204. return s->reset3;
  205. case OMCR11: tm ++;
  206. /* fall through */
  207. case OMCR10: tm ++;
  208. /* fall through */
  209. case OMCR9: tm ++;
  210. /* fall through */
  211. case OMCR8: tm ++;
  212. /* fall through */
  213. case OMCR7: tm ++;
  214. /* fall through */
  215. case OMCR6: tm ++;
  216. /* fall through */
  217. case OMCR5: tm ++;
  218. /* fall through */
  219. case OMCR4:
  220. if (!pxa2xx_timer_has_tm4(s))
  221. goto badreg;
  222. return s->tm4[tm].control;
  223. case OSNR:
  224. return s->snapshot;
  225. default:
  226. badreg:
  227. hw_error("pxa2xx_timer_read: Bad offset " REG_FMT "\n", offset);
  228. }
  229. return 0;
  230. }
  231. static void pxa2xx_timer_write(void *opaque, hwaddr offset,
  232. uint64_t value, unsigned size)
  233. {
  234. int i, tm = 0;
  235. PXA2xxTimerInfo *s = (PXA2xxTimerInfo *) opaque;
  236. switch (offset) {
  237. case OSMR3: tm ++;
  238. /* fall through */
  239. case OSMR2: tm ++;
  240. /* fall through */
  241. case OSMR1: tm ++;
  242. /* fall through */
  243. case OSMR0:
  244. s->timer[tm].value = value;
  245. pxa2xx_timer_update(s, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
  246. break;
  247. case OSMR11: tm ++;
  248. /* fall through */
  249. case OSMR10: tm ++;
  250. /* fall through */
  251. case OSMR9: tm ++;
  252. /* fall through */
  253. case OSMR8: tm ++;
  254. /* fall through */
  255. case OSMR7: tm ++;
  256. /* fall through */
  257. case OSMR6: tm ++;
  258. /* fall through */
  259. case OSMR5: tm ++;
  260. /* fall through */
  261. case OSMR4:
  262. if (!pxa2xx_timer_has_tm4(s))
  263. goto badreg;
  264. s->tm4[tm].tm.value = value;
  265. pxa2xx_timer_update4(s, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), tm);
  266. break;
  267. case OSCR:
  268. s->oldclock = s->clock;
  269. s->lastload = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
  270. s->clock = value;
  271. pxa2xx_timer_update(s, s->lastload);
  272. break;
  273. case OSCR11: tm ++;
  274. /* fall through */
  275. case OSCR10: tm ++;
  276. /* fall through */
  277. case OSCR9: tm ++;
  278. /* fall through */
  279. case OSCR8: tm ++;
  280. /* fall through */
  281. case OSCR7: tm ++;
  282. /* fall through */
  283. case OSCR6: tm ++;
  284. /* fall through */
  285. case OSCR5: tm ++;
  286. /* fall through */
  287. case OSCR4:
  288. if (!pxa2xx_timer_has_tm4(s))
  289. goto badreg;
  290. s->tm4[tm].oldclock = s->tm4[tm].clock;
  291. s->tm4[tm].lastload = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
  292. s->tm4[tm].clock = value;
  293. pxa2xx_timer_update4(s, s->tm4[tm].lastload, tm);
  294. break;
  295. case OIER:
  296. s->irq_enabled = value & 0xfff;
  297. break;
  298. case OSSR: /* Status register */
  299. value &= s->events;
  300. s->events &= ~value;
  301. for (i = 0; i < 4; i ++, value >>= 1)
  302. if (value & 1)
  303. qemu_irq_lower(s->timer[i].irq);
  304. if (pxa2xx_timer_has_tm4(s) && !(s->events & 0xff0) && value)
  305. qemu_irq_lower(s->irq4);
  306. break;
  307. case OWER: /* XXX: Reset on OSMR3 match? */
  308. s->reset3 = value;
  309. break;
  310. case OMCR7: tm ++;
  311. /* fall through */
  312. case OMCR6: tm ++;
  313. /* fall through */
  314. case OMCR5: tm ++;
  315. /* fall through */
  316. case OMCR4:
  317. if (!pxa2xx_timer_has_tm4(s))
  318. goto badreg;
  319. s->tm4[tm].control = value & 0x0ff;
  320. /* XXX Stop if running (shouldn't happen) */
  321. if ((value & (1 << 7)) || tm == 0)
  322. s->tm4[tm].freq = pxa2xx_timer4_freq[value & 7];
  323. else {
  324. s->tm4[tm].freq = 0;
  325. pxa2xx_timer_update4(s, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), tm);
  326. }
  327. break;
  328. case OMCR11: tm ++;
  329. /* fall through */
  330. case OMCR10: tm ++;
  331. /* fall through */
  332. case OMCR9: tm ++;
  333. /* fall through */
  334. case OMCR8: tm += 4;
  335. if (!pxa2xx_timer_has_tm4(s))
  336. goto badreg;
  337. s->tm4[tm].control = value & 0x3ff;
  338. /* XXX Stop if running (shouldn't happen) */
  339. if ((value & (1 << 7)) || !(tm & 1))
  340. s->tm4[tm].freq =
  341. pxa2xx_timer4_freq[(value & (1 << 8)) ? 0 : (value & 7)];
  342. else {
  343. s->tm4[tm].freq = 0;
  344. pxa2xx_timer_update4(s, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), tm);
  345. }
  346. break;
  347. default:
  348. badreg:
  349. hw_error("pxa2xx_timer_write: Bad offset " REG_FMT "\n", offset);
  350. }
  351. }
  352. static const MemoryRegionOps pxa2xx_timer_ops = {
  353. .read = pxa2xx_timer_read,
  354. .write = pxa2xx_timer_write,
  355. .endianness = DEVICE_NATIVE_ENDIAN,
  356. };
  357. static void pxa2xx_timer_tick(void *opaque)
  358. {
  359. PXA2xxTimer0 *t = (PXA2xxTimer0 *) opaque;
  360. PXA2xxTimerInfo *i = t->info;
  361. if (i->irq_enabled & (1 << t->num)) {
  362. i->events |= 1 << t->num;
  363. qemu_irq_raise(t->irq);
  364. }
  365. if (t->num == 3)
  366. if (i->reset3 & 1) {
  367. i->reset3 = 0;
  368. qemu_system_reset_request();
  369. }
  370. }
  371. static void pxa2xx_timer_tick4(void *opaque)
  372. {
  373. PXA2xxTimer4 *t = (PXA2xxTimer4 *) opaque;
  374. PXA2xxTimerInfo *i = (PXA2xxTimerInfo *) t->tm.info;
  375. pxa2xx_timer_tick(&t->tm);
  376. if (t->control & (1 << 3))
  377. t->clock = 0;
  378. if (t->control & (1 << 6))
  379. pxa2xx_timer_update4(i, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), t->tm.num - 4);
  380. if (i->events & 0xff0)
  381. qemu_irq_raise(i->irq4);
  382. }
  383. static int pxa25x_timer_post_load(void *opaque, int version_id)
  384. {
  385. PXA2xxTimerInfo *s = (PXA2xxTimerInfo *) opaque;
  386. int64_t now;
  387. int i;
  388. now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
  389. pxa2xx_timer_update(s, now);
  390. if (pxa2xx_timer_has_tm4(s))
  391. for (i = 0; i < 8; i ++)
  392. pxa2xx_timer_update4(s, now, i);
  393. return 0;
  394. }
  395. static int pxa2xx_timer_init(SysBusDevice *dev)
  396. {
  397. PXA2xxTimerInfo *s = PXA2XX_TIMER(dev);
  398. int i;
  399. s->irq_enabled = 0;
  400. s->oldclock = 0;
  401. s->clock = 0;
  402. s->lastload = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
  403. s->reset3 = 0;
  404. for (i = 0; i < 4; i ++) {
  405. s->timer[i].value = 0;
  406. sysbus_init_irq(dev, &s->timer[i].irq);
  407. s->timer[i].info = s;
  408. s->timer[i].num = i;
  409. s->timer[i].qtimer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
  410. pxa2xx_timer_tick, &s->timer[i]);
  411. }
  412. if (s->flags & (1 << PXA2XX_TIMER_HAVE_TM4)) {
  413. sysbus_init_irq(dev, &s->irq4);
  414. for (i = 0; i < 8; i ++) {
  415. s->tm4[i].tm.value = 0;
  416. s->tm4[i].tm.info = s;
  417. s->tm4[i].tm.num = i + 4;
  418. s->tm4[i].freq = 0;
  419. s->tm4[i].control = 0x0;
  420. s->tm4[i].tm.qtimer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
  421. pxa2xx_timer_tick4, &s->tm4[i]);
  422. }
  423. }
  424. memory_region_init_io(&s->iomem, OBJECT(s), &pxa2xx_timer_ops, s,
  425. "pxa2xx-timer", 0x00001000);
  426. sysbus_init_mmio(dev, &s->iomem);
  427. return 0;
  428. }
  429. static const VMStateDescription vmstate_pxa2xx_timer0_regs = {
  430. .name = "pxa2xx_timer0",
  431. .version_id = 2,
  432. .minimum_version_id = 2,
  433. .fields = (VMStateField[]) {
  434. VMSTATE_UINT32(value, PXA2xxTimer0),
  435. VMSTATE_END_OF_LIST(),
  436. },
  437. };
  438. static const VMStateDescription vmstate_pxa2xx_timer4_regs = {
  439. .name = "pxa2xx_timer4",
  440. .version_id = 1,
  441. .minimum_version_id = 1,
  442. .fields = (VMStateField[]) {
  443. VMSTATE_STRUCT(tm, PXA2xxTimer4, 1,
  444. vmstate_pxa2xx_timer0_regs, PXA2xxTimer0),
  445. VMSTATE_INT32(oldclock, PXA2xxTimer4),
  446. VMSTATE_INT32(clock, PXA2xxTimer4),
  447. VMSTATE_UINT64(lastload, PXA2xxTimer4),
  448. VMSTATE_UINT32(freq, PXA2xxTimer4),
  449. VMSTATE_UINT32(control, PXA2xxTimer4),
  450. VMSTATE_END_OF_LIST(),
  451. },
  452. };
  453. static bool pxa2xx_timer_has_tm4_test(void *opaque, int version_id)
  454. {
  455. return pxa2xx_timer_has_tm4(opaque);
  456. }
  457. static const VMStateDescription vmstate_pxa2xx_timer_regs = {
  458. .name = "pxa2xx_timer",
  459. .version_id = 1,
  460. .minimum_version_id = 1,
  461. .post_load = pxa25x_timer_post_load,
  462. .fields = (VMStateField[]) {
  463. VMSTATE_INT32(clock, PXA2xxTimerInfo),
  464. VMSTATE_INT32(oldclock, PXA2xxTimerInfo),
  465. VMSTATE_UINT64(lastload, PXA2xxTimerInfo),
  466. VMSTATE_STRUCT_ARRAY(timer, PXA2xxTimerInfo, 4, 1,
  467. vmstate_pxa2xx_timer0_regs, PXA2xxTimer0),
  468. VMSTATE_UINT32(events, PXA2xxTimerInfo),
  469. VMSTATE_UINT32(irq_enabled, PXA2xxTimerInfo),
  470. VMSTATE_UINT32(reset3, PXA2xxTimerInfo),
  471. VMSTATE_UINT32(snapshot, PXA2xxTimerInfo),
  472. VMSTATE_STRUCT_ARRAY_TEST(tm4, PXA2xxTimerInfo, 8,
  473. pxa2xx_timer_has_tm4_test, 0,
  474. vmstate_pxa2xx_timer4_regs, PXA2xxTimer4),
  475. VMSTATE_END_OF_LIST(),
  476. }
  477. };
  478. static Property pxa25x_timer_dev_properties[] = {
  479. DEFINE_PROP_UINT32("freq", PXA2xxTimerInfo, freq, PXA25X_FREQ),
  480. DEFINE_PROP_BIT("tm4", PXA2xxTimerInfo, flags,
  481. PXA2XX_TIMER_HAVE_TM4, false),
  482. DEFINE_PROP_END_OF_LIST(),
  483. };
  484. static void pxa25x_timer_dev_class_init(ObjectClass *klass, void *data)
  485. {
  486. DeviceClass *dc = DEVICE_CLASS(klass);
  487. dc->desc = "PXA25x timer";
  488. dc->props = pxa25x_timer_dev_properties;
  489. }
  490. static const TypeInfo pxa25x_timer_dev_info = {
  491. .name = "pxa25x-timer",
  492. .parent = TYPE_PXA2XX_TIMER,
  493. .instance_size = sizeof(PXA2xxTimerInfo),
  494. .class_init = pxa25x_timer_dev_class_init,
  495. };
  496. static Property pxa27x_timer_dev_properties[] = {
  497. DEFINE_PROP_UINT32("freq", PXA2xxTimerInfo, freq, PXA27X_FREQ),
  498. DEFINE_PROP_BIT("tm4", PXA2xxTimerInfo, flags,
  499. PXA2XX_TIMER_HAVE_TM4, true),
  500. DEFINE_PROP_END_OF_LIST(),
  501. };
  502. static void pxa27x_timer_dev_class_init(ObjectClass *klass, void *data)
  503. {
  504. DeviceClass *dc = DEVICE_CLASS(klass);
  505. dc->desc = "PXA27x timer";
  506. dc->props = pxa27x_timer_dev_properties;
  507. }
  508. static const TypeInfo pxa27x_timer_dev_info = {
  509. .name = "pxa27x-timer",
  510. .parent = TYPE_PXA2XX_TIMER,
  511. .instance_size = sizeof(PXA2xxTimerInfo),
  512. .class_init = pxa27x_timer_dev_class_init,
  513. };
  514. static void pxa2xx_timer_class_init(ObjectClass *oc, void *data)
  515. {
  516. DeviceClass *dc = DEVICE_CLASS(oc);
  517. SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(oc);
  518. sdc->init = pxa2xx_timer_init;
  519. dc->vmsd = &vmstate_pxa2xx_timer_regs;
  520. }
  521. static const TypeInfo pxa2xx_timer_type_info = {
  522. .name = TYPE_PXA2XX_TIMER,
  523. .parent = TYPE_SYS_BUS_DEVICE,
  524. .instance_size = sizeof(PXA2xxTimerInfo),
  525. .abstract = true,
  526. .class_init = pxa2xx_timer_class_init,
  527. };
  528. static void pxa2xx_timer_register_types(void)
  529. {
  530. type_register_static(&pxa2xx_timer_type_info);
  531. type_register_static(&pxa25x_timer_dev_info);
  532. type_register_static(&pxa27x_timer_dev_info);
  533. }
  534. type_init(pxa2xx_timer_register_types)