140b6f911SPeter Chubb /* 240b6f911SPeter Chubb * IMX31 UARTS 340b6f911SPeter Chubb * 440b6f911SPeter Chubb * Copyright (c) 2008 OKL 540b6f911SPeter Chubb * Originally Written by Hans Jiang 640b6f911SPeter Chubb * Copyright (c) 2011 NICTA Pty Ltd. 7cd0bda20SJean-Christophe Dubois * Updated by Jean-Christophe Dubois <jcd@tribudubois.net> 840b6f911SPeter Chubb * 940b6f911SPeter Chubb * This work is licensed under the terms of the GNU GPL, version 2 or later. 1040b6f911SPeter Chubb * See the COPYING file in the top-level directory. 1140b6f911SPeter Chubb * 1240b6f911SPeter Chubb * This is a `bare-bones' implementation of the IMX series serial ports. 1340b6f911SPeter Chubb * TODO: 1440b6f911SPeter Chubb * -- implement FIFOs. The real hardware has 32 word transmit 1540b6f911SPeter Chubb * and receive FIFOs; we currently use a 1-char buffer 1640b6f911SPeter Chubb * -- implement DMA 1740b6f911SPeter Chubb * -- implement BAUD-rate and modem lines, for when the backend 1840b6f911SPeter Chubb * is a real serial device. 1940b6f911SPeter Chubb */ 2040b6f911SPeter Chubb 218ef94f0bSPeter Maydell #include "qemu/osdep.h" 22cd0bda20SJean-Christophe Dubois #include "hw/char/imx_serial.h" 239c17d615SPaolo Bonzini #include "sysemu/sysemu.h" 2403dd024fSPaolo Bonzini #include "qemu/log.h" 2540b6f911SPeter Chubb 268ccce77cSJean-Christophe Dubois #ifndef DEBUG_IMX_UART 278ccce77cSJean-Christophe Dubois #define DEBUG_IMX_UART 0 2840b6f911SPeter Chubb #endif 2940b6f911SPeter Chubb 308ccce77cSJean-Christophe Dubois #define DPRINTF(fmt, args...) \ 318ccce77cSJean-Christophe Dubois do { \ 328ccce77cSJean-Christophe Dubois if (DEBUG_IMX_UART) { \ 338ccce77cSJean-Christophe Dubois fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_SERIAL, \ 348ccce77cSJean-Christophe Dubois __func__, ##args); \ 358ccce77cSJean-Christophe Dubois } \ 368ccce77cSJean-Christophe Dubois } while (0) 3740b6f911SPeter Chubb 3840b6f911SPeter Chubb static const VMStateDescription vmstate_imx_serial = { 39fa2650a3SJean-Christophe Dubois .name = TYPE_IMX_SERIAL, 4046d3fb63SAndrey Smirnov .version_id = 2, 4146d3fb63SAndrey Smirnov .minimum_version_id = 2, 4240b6f911SPeter Chubb .fields = (VMStateField[]) { 4340b6f911SPeter Chubb VMSTATE_INT32(readbuff, IMXSerialState), 4440b6f911SPeter Chubb VMSTATE_UINT32(usr1, IMXSerialState), 4540b6f911SPeter Chubb VMSTATE_UINT32(usr2, IMXSerialState), 4640b6f911SPeter Chubb VMSTATE_UINT32(ucr1, IMXSerialState), 4740b6f911SPeter Chubb VMSTATE_UINT32(uts1, IMXSerialState), 4840b6f911SPeter Chubb VMSTATE_UINT32(onems, IMXSerialState), 4940b6f911SPeter Chubb VMSTATE_UINT32(ufcr, IMXSerialState), 5040b6f911SPeter Chubb VMSTATE_UINT32(ubmr, IMXSerialState), 5140b6f911SPeter Chubb VMSTATE_UINT32(ubrc, IMXSerialState), 5240b6f911SPeter Chubb VMSTATE_UINT32(ucr3, IMXSerialState), 5346d3fb63SAndrey Smirnov VMSTATE_UINT32(ucr4, IMXSerialState), 5440b6f911SPeter Chubb VMSTATE_END_OF_LIST() 5540b6f911SPeter Chubb }, 5640b6f911SPeter Chubb }; 5740b6f911SPeter Chubb 5840b6f911SPeter Chubb static void imx_update(IMXSerialState *s) 5940b6f911SPeter Chubb { 60824e4a12SAndrey Smirnov uint32_t usr1; 61824e4a12SAndrey Smirnov uint32_t usr2; 62824e4a12SAndrey Smirnov uint32_t mask; 6340b6f911SPeter Chubb 64824e4a12SAndrey Smirnov /* 65824e4a12SAndrey Smirnov * Lucky for us TRDY and RRDY has the same offset in both USR1 and 66824e4a12SAndrey Smirnov * UCR1, so we can get away with something as simple as the 67824e4a12SAndrey Smirnov * following: 68824e4a12SAndrey Smirnov */ 69824e4a12SAndrey Smirnov usr1 = s->usr1 & s->ucr1 & (USR1_TRDY | USR1_RRDY); 70824e4a12SAndrey Smirnov /* 71824e4a12SAndrey Smirnov * Bits that we want in USR2 are not as conveniently laid out, 72824e4a12SAndrey Smirnov * unfortunately. 73824e4a12SAndrey Smirnov */ 74824e4a12SAndrey Smirnov mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0; 7546d3fb63SAndrey Smirnov /* 7646d3fb63SAndrey Smirnov * TCEN and TXDC are both bit 3 77*3c54cf77SHans-Erik Floryd * RDR and DREN are both bit 0 7846d3fb63SAndrey Smirnov */ 79*3c54cf77SHans-Erik Floryd mask |= s->ucr4 & (UCR4_TCEN | UCR4_DREN); 8046d3fb63SAndrey Smirnov 81824e4a12SAndrey Smirnov usr2 = s->usr2 & mask; 8240b6f911SPeter Chubb 83824e4a12SAndrey Smirnov qemu_set_irq(s->irq, usr1 || usr2); 8440b6f911SPeter Chubb } 8540b6f911SPeter Chubb 8640b6f911SPeter Chubb static void imx_serial_reset(IMXSerialState *s) 8740b6f911SPeter Chubb { 8840b6f911SPeter Chubb 8940b6f911SPeter Chubb s->usr1 = USR1_TRDY | USR1_RXDS; 9040b6f911SPeter Chubb /* 9140b6f911SPeter Chubb * Fake attachment of a terminal: assert RTS. 9240b6f911SPeter Chubb */ 9340b6f911SPeter Chubb s->usr1 |= USR1_RTSS; 9440b6f911SPeter Chubb s->usr2 = USR2_TXFE | USR2_TXDC | USR2_DCDIN; 9540b6f911SPeter Chubb s->uts1 = UTS1_RXEMPTY | UTS1_TXEMPTY; 9640b6f911SPeter Chubb s->ucr1 = 0; 9740b6f911SPeter Chubb s->ucr2 = UCR2_SRST; 9840b6f911SPeter Chubb s->ucr3 = 0x700; 9940b6f911SPeter Chubb s->ubmr = 0; 10040b6f911SPeter Chubb s->ubrc = 4; 10140b6f911SPeter Chubb s->readbuff = URXD_ERR; 10240b6f911SPeter Chubb } 10340b6f911SPeter Chubb 10440b6f911SPeter Chubb static void imx_serial_reset_at_boot(DeviceState *dev) 10540b6f911SPeter Chubb { 1068d8e3481SAndreas Färber IMXSerialState *s = IMX_SERIAL(dev); 10740b6f911SPeter Chubb 10840b6f911SPeter Chubb imx_serial_reset(s); 10940b6f911SPeter Chubb 11040b6f911SPeter Chubb /* 11140b6f911SPeter Chubb * enable the uart on boot, so messages from the linux decompresser 11240b6f911SPeter Chubb * are visible. On real hardware this is done by the boot rom 11340b6f911SPeter Chubb * before anything else is loaded. 11440b6f911SPeter Chubb */ 11540b6f911SPeter Chubb s->ucr1 = UCR1_UARTEN; 11640b6f911SPeter Chubb s->ucr2 = UCR2_TXEN; 11740b6f911SPeter Chubb 11840b6f911SPeter Chubb } 11940b6f911SPeter Chubb 120a8170e5eSAvi Kivity static uint64_t imx_serial_read(void *opaque, hwaddr offset, 12140b6f911SPeter Chubb unsigned size) 12240b6f911SPeter Chubb { 12340b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 12440b6f911SPeter Chubb uint32_t c; 12540b6f911SPeter Chubb 1268ccce77cSJean-Christophe Dubois DPRINTF("read(offset=0x%" HWADDR_PRIx ")\n", offset); 1278ccce77cSJean-Christophe Dubois 12840b6f911SPeter Chubb switch (offset >> 2) { 12940b6f911SPeter Chubb case 0x0: /* URXD */ 13040b6f911SPeter Chubb c = s->readbuff; 13140b6f911SPeter Chubb if (!(s->uts1 & UTS1_RXEMPTY)) { 13240b6f911SPeter Chubb /* Character is valid */ 13340b6f911SPeter Chubb c |= URXD_CHARRDY; 13440b6f911SPeter Chubb s->usr1 &= ~USR1_RRDY; 13540b6f911SPeter Chubb s->usr2 &= ~USR2_RDR; 13640b6f911SPeter Chubb s->uts1 |= UTS1_RXEMPTY; 13740b6f911SPeter Chubb imx_update(s); 1385345fdb4SMarc-André Lureau qemu_chr_fe_accept_input(&s->chr); 13940b6f911SPeter Chubb } 14040b6f911SPeter Chubb return c; 14140b6f911SPeter Chubb 14240b6f911SPeter Chubb case 0x20: /* UCR1 */ 14340b6f911SPeter Chubb return s->ucr1; 14440b6f911SPeter Chubb 14540b6f911SPeter Chubb case 0x21: /* UCR2 */ 14640b6f911SPeter Chubb return s->ucr2; 14740b6f911SPeter Chubb 14840b6f911SPeter Chubb case 0x25: /* USR1 */ 14940b6f911SPeter Chubb return s->usr1; 15040b6f911SPeter Chubb 15140b6f911SPeter Chubb case 0x26: /* USR2 */ 15240b6f911SPeter Chubb return s->usr2; 15340b6f911SPeter Chubb 15440b6f911SPeter Chubb case 0x2A: /* BRM Modulator */ 15540b6f911SPeter Chubb return s->ubmr; 15640b6f911SPeter Chubb 15740b6f911SPeter Chubb case 0x2B: /* Baud Rate Count */ 15840b6f911SPeter Chubb return s->ubrc; 15940b6f911SPeter Chubb 16040b6f911SPeter Chubb case 0x2d: /* Test register */ 16140b6f911SPeter Chubb return s->uts1; 16240b6f911SPeter Chubb 16340b6f911SPeter Chubb case 0x24: /* UFCR */ 16440b6f911SPeter Chubb return s->ufcr; 16540b6f911SPeter Chubb 16640b6f911SPeter Chubb case 0x2c: 16740b6f911SPeter Chubb return s->onems; 16840b6f911SPeter Chubb 16940b6f911SPeter Chubb case 0x22: /* UCR3 */ 17040b6f911SPeter Chubb return s->ucr3; 17140b6f911SPeter Chubb 17240b6f911SPeter Chubb case 0x23: /* UCR4 */ 17346d3fb63SAndrey Smirnov return s->ucr4; 17446d3fb63SAndrey Smirnov 17540b6f911SPeter Chubb case 0x29: /* BRM Incremental */ 17640b6f911SPeter Chubb return 0x0; /* TODO */ 17740b6f911SPeter Chubb 17840b6f911SPeter Chubb default: 1798ccce77cSJean-Christophe Dubois qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" 1808ccce77cSJean-Christophe Dubois HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset); 18140b6f911SPeter Chubb return 0; 18240b6f911SPeter Chubb } 18340b6f911SPeter Chubb } 18440b6f911SPeter Chubb 185a8170e5eSAvi Kivity static void imx_serial_write(void *opaque, hwaddr offset, 18640b6f911SPeter Chubb uint64_t value, unsigned size) 18740b6f911SPeter Chubb { 18840b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 1890ec7b3e7SMarc-André Lureau Chardev *chr = qemu_chr_fe_get_driver(&s->chr); 19040b6f911SPeter Chubb unsigned char ch; 19140b6f911SPeter Chubb 1928ccce77cSJean-Christophe Dubois DPRINTF("write(offset=0x%" HWADDR_PRIx ", value = 0x%x) to %s\n", 1935345fdb4SMarc-André Lureau offset, (unsigned int)value, chr ? chr->label : "NODEV"); 19440b6f911SPeter Chubb 19540b6f911SPeter Chubb switch (offset >> 2) { 19640b6f911SPeter Chubb case 0x10: /* UTXD */ 19740b6f911SPeter Chubb ch = value; 19840b6f911SPeter Chubb if (s->ucr2 & UCR2_TXEN) { 1996ab3fc32SDaniel P. Berrange /* XXX this blocks entire thread. Rewrite to use 2006ab3fc32SDaniel P. Berrange * qemu_chr_fe_write and background I/O callbacks */ 2015345fdb4SMarc-André Lureau qemu_chr_fe_write_all(&s->chr, &ch, 1); 20240b6f911SPeter Chubb s->usr1 &= ~USR1_TRDY; 20346d3fb63SAndrey Smirnov s->usr2 &= ~USR2_TXDC; 20440b6f911SPeter Chubb imx_update(s); 20540b6f911SPeter Chubb s->usr1 |= USR1_TRDY; 20646d3fb63SAndrey Smirnov s->usr2 |= USR2_TXDC; 20740b6f911SPeter Chubb imx_update(s); 20840b6f911SPeter Chubb } 20940b6f911SPeter Chubb break; 21040b6f911SPeter Chubb 21140b6f911SPeter Chubb case 0x20: /* UCR1 */ 21240b6f911SPeter Chubb s->ucr1 = value & 0xffff; 2138ccce77cSJean-Christophe Dubois 21440b6f911SPeter Chubb DPRINTF("write(ucr1=%x)\n", (unsigned int)value); 2158ccce77cSJean-Christophe Dubois 21640b6f911SPeter Chubb imx_update(s); 21740b6f911SPeter Chubb break; 21840b6f911SPeter Chubb 21940b6f911SPeter Chubb case 0x21: /* UCR2 */ 22040b6f911SPeter Chubb /* 22140b6f911SPeter Chubb * Only a few bits in control register 2 are implemented as yet. 22240b6f911SPeter Chubb * If it's intended to use a real serial device as a back-end, this 22340b6f911SPeter Chubb * register will have to be implemented more fully. 22440b6f911SPeter Chubb */ 22540b6f911SPeter Chubb if (!(value & UCR2_SRST)) { 22640b6f911SPeter Chubb imx_serial_reset(s); 22740b6f911SPeter Chubb imx_update(s); 22840b6f911SPeter Chubb value |= UCR2_SRST; 22940b6f911SPeter Chubb } 23040b6f911SPeter Chubb if (value & UCR2_RXEN) { 23140b6f911SPeter Chubb if (!(s->ucr2 & UCR2_RXEN)) { 2325345fdb4SMarc-André Lureau qemu_chr_fe_accept_input(&s->chr); 23340b6f911SPeter Chubb } 23440b6f911SPeter Chubb } 23540b6f911SPeter Chubb s->ucr2 = value & 0xffff; 23640b6f911SPeter Chubb break; 23740b6f911SPeter Chubb 23840b6f911SPeter Chubb case 0x25: /* USR1 */ 23940b6f911SPeter Chubb value &= USR1_AWAKE | USR1_AIRINT | USR1_DTRD | USR1_AGTIM | 24040b6f911SPeter Chubb USR1_FRAMERR | USR1_ESCF | USR1_RTSD | USR1_PARTYER; 24140b6f911SPeter Chubb s->usr1 &= ~value; 24240b6f911SPeter Chubb break; 24340b6f911SPeter Chubb 24440b6f911SPeter Chubb case 0x26: /* USR2 */ 24540b6f911SPeter Chubb /* 24640b6f911SPeter Chubb * Writing 1 to some bits clears them; all other 24740b6f911SPeter Chubb * values are ignored 24840b6f911SPeter Chubb */ 24940b6f911SPeter Chubb value &= USR2_ADET | USR2_DTRF | USR2_IDLE | USR2_ACST | 25040b6f911SPeter Chubb USR2_RIDELT | USR2_IRINT | USR2_WAKE | 25140b6f911SPeter Chubb USR2_DCDDELT | USR2_RTSF | USR2_BRCD | USR2_ORE; 25240b6f911SPeter Chubb s->usr2 &= ~value; 25340b6f911SPeter Chubb break; 25440b6f911SPeter Chubb 25540b6f911SPeter Chubb /* 25640b6f911SPeter Chubb * Linux expects to see what it writes to these registers 25740b6f911SPeter Chubb * We don't currently alter the baud rate 25840b6f911SPeter Chubb */ 25940b6f911SPeter Chubb case 0x29: /* UBIR */ 26040b6f911SPeter Chubb s->ubrc = value & 0xffff; 26140b6f911SPeter Chubb break; 26240b6f911SPeter Chubb 26340b6f911SPeter Chubb case 0x2a: /* UBMR */ 26440b6f911SPeter Chubb s->ubmr = value & 0xffff; 26540b6f911SPeter Chubb break; 26640b6f911SPeter Chubb 26740b6f911SPeter Chubb case 0x2c: /* One ms reg */ 26840b6f911SPeter Chubb s->onems = value & 0xffff; 26940b6f911SPeter Chubb break; 27040b6f911SPeter Chubb 27140b6f911SPeter Chubb case 0x24: /* FIFO control register */ 27240b6f911SPeter Chubb s->ufcr = value & 0xffff; 27340b6f911SPeter Chubb break; 27440b6f911SPeter Chubb 27540b6f911SPeter Chubb case 0x22: /* UCR3 */ 27640b6f911SPeter Chubb s->ucr3 = value & 0xffff; 27740b6f911SPeter Chubb break; 27840b6f911SPeter Chubb 27940b6f911SPeter Chubb case 0x23: /* UCR4 */ 28046d3fb63SAndrey Smirnov s->ucr4 = value & 0xffff; 28146d3fb63SAndrey Smirnov imx_update(s); 28246d3fb63SAndrey Smirnov break; 28346d3fb63SAndrey Smirnov 28446d3fb63SAndrey Smirnov case 0x2d: /* UTS1 */ 2858ccce77cSJean-Christophe Dubois qemu_log_mask(LOG_UNIMP, "[%s]%s: Unimplemented reg 0x%" 2868ccce77cSJean-Christophe Dubois HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset); 28740b6f911SPeter Chubb /* TODO */ 28840b6f911SPeter Chubb break; 28940b6f911SPeter Chubb 29040b6f911SPeter Chubb default: 2918ccce77cSJean-Christophe Dubois qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" 2928ccce77cSJean-Christophe Dubois HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset); 29340b6f911SPeter Chubb } 29440b6f911SPeter Chubb } 29540b6f911SPeter Chubb 29640b6f911SPeter Chubb static int imx_can_receive(void *opaque) 29740b6f911SPeter Chubb { 29840b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 29940b6f911SPeter Chubb return !(s->usr1 & USR1_RRDY); 30040b6f911SPeter Chubb } 30140b6f911SPeter Chubb 30240b6f911SPeter Chubb static void imx_put_data(void *opaque, uint32_t value) 30340b6f911SPeter Chubb { 30440b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 3058ccce77cSJean-Christophe Dubois 30640b6f911SPeter Chubb DPRINTF("received char\n"); 3078ccce77cSJean-Christophe Dubois 30840b6f911SPeter Chubb s->usr1 |= USR1_RRDY; 30940b6f911SPeter Chubb s->usr2 |= USR2_RDR; 31040b6f911SPeter Chubb s->uts1 &= ~UTS1_RXEMPTY; 31140b6f911SPeter Chubb s->readbuff = value; 312478a573aSTrent Piepho if (value & URXD_BRK) { 313478a573aSTrent Piepho s->usr2 |= USR2_BRCD; 314478a573aSTrent Piepho } 31540b6f911SPeter Chubb imx_update(s); 31640b6f911SPeter Chubb } 31740b6f911SPeter Chubb 31840b6f911SPeter Chubb static void imx_receive(void *opaque, const uint8_t *buf, int size) 31940b6f911SPeter Chubb { 32040b6f911SPeter Chubb imx_put_data(opaque, *buf); 32140b6f911SPeter Chubb } 32240b6f911SPeter Chubb 32340b6f911SPeter Chubb static void imx_event(void *opaque, int event) 32440b6f911SPeter Chubb { 32540b6f911SPeter Chubb if (event == CHR_EVENT_BREAK) { 326478a573aSTrent Piepho imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR); 32740b6f911SPeter Chubb } 32840b6f911SPeter Chubb } 32940b6f911SPeter Chubb 33040b6f911SPeter Chubb 33140b6f911SPeter Chubb static const struct MemoryRegionOps imx_serial_ops = { 33240b6f911SPeter Chubb .read = imx_serial_read, 33340b6f911SPeter Chubb .write = imx_serial_write, 33440b6f911SPeter Chubb .endianness = DEVICE_NATIVE_ENDIAN, 33540b6f911SPeter Chubb }; 33640b6f911SPeter Chubb 337f6c64000SJean-Christophe Dubois static void imx_serial_realize(DeviceState *dev, Error **errp) 33840b6f911SPeter Chubb { 3398d8e3481SAndreas Färber IMXSerialState *s = IMX_SERIAL(dev); 34040b6f911SPeter Chubb 341fa394ed6SMarc-André Lureau DPRINTF("char dev for uart: %p\n", qemu_chr_fe_get_driver(&s->chr)); 342fa394ed6SMarc-André Lureau 3435345fdb4SMarc-André Lureau qemu_chr_fe_set_handlers(&s->chr, imx_can_receive, imx_receive, 34481517ba3SAnton Nefedov imx_event, NULL, s, NULL, true); 345f6c64000SJean-Christophe Dubois } 34640b6f911SPeter Chubb 347f6c64000SJean-Christophe Dubois static void imx_serial_init(Object *obj) 348f6c64000SJean-Christophe Dubois { 349f6c64000SJean-Christophe Dubois SysBusDevice *sbd = SYS_BUS_DEVICE(obj); 350f6c64000SJean-Christophe Dubois IMXSerialState *s = IMX_SERIAL(obj); 351f6c64000SJean-Christophe Dubois 352f6c64000SJean-Christophe Dubois memory_region_init_io(&s->iomem, obj, &imx_serial_ops, s, 353f6c64000SJean-Christophe Dubois TYPE_IMX_SERIAL, 0x1000); 354f6c64000SJean-Christophe Dubois sysbus_init_mmio(sbd, &s->iomem); 355f6c64000SJean-Christophe Dubois sysbus_init_irq(sbd, &s->irq); 35640b6f911SPeter Chubb } 35740b6f911SPeter Chubb 358f6c64000SJean-Christophe Dubois static Property imx_serial_properties[] = { 35940b6f911SPeter Chubb DEFINE_PROP_CHR("chardev", IMXSerialState, chr), 36040b6f911SPeter Chubb DEFINE_PROP_END_OF_LIST(), 36140b6f911SPeter Chubb }; 36240b6f911SPeter Chubb 36340b6f911SPeter Chubb static void imx_serial_class_init(ObjectClass *klass, void *data) 36440b6f911SPeter Chubb { 36540b6f911SPeter Chubb DeviceClass *dc = DEVICE_CLASS(klass); 36640b6f911SPeter Chubb 367f6c64000SJean-Christophe Dubois dc->realize = imx_serial_realize; 36840b6f911SPeter Chubb dc->vmsd = &vmstate_imx_serial; 36940b6f911SPeter Chubb dc->reset = imx_serial_reset_at_boot; 370125ee0edSMarcel Apfelbaum set_bit(DEVICE_CATEGORY_INPUT, dc->categories); 37140b6f911SPeter Chubb dc->desc = "i.MX series UART"; 372f6c64000SJean-Christophe Dubois dc->props = imx_serial_properties; 37340b6f911SPeter Chubb } 37440b6f911SPeter Chubb 3758c43a6f0SAndreas Färber static const TypeInfo imx_serial_info = { 3768d8e3481SAndreas Färber .name = TYPE_IMX_SERIAL, 37740b6f911SPeter Chubb .parent = TYPE_SYS_BUS_DEVICE, 37840b6f911SPeter Chubb .instance_size = sizeof(IMXSerialState), 379f6c64000SJean-Christophe Dubois .instance_init = imx_serial_init, 38040b6f911SPeter Chubb .class_init = imx_serial_class_init, 38140b6f911SPeter Chubb }; 38240b6f911SPeter Chubb 38340b6f911SPeter Chubb static void imx_serial_register_types(void) 38440b6f911SPeter Chubb { 38540b6f911SPeter Chubb type_register_static(&imx_serial_info); 38640b6f911SPeter Chubb } 38740b6f911SPeter Chubb 38840b6f911SPeter Chubb type_init(imx_serial_register_types) 389