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" 2364552b6bSMarkus Armbruster #include "hw/irq.h" 24*d6454270SMarkus Armbruster #include "migration/vmstate.h" 259c17d615SPaolo Bonzini #include "sysemu/sysemu.h" 2603dd024fSPaolo Bonzini #include "qemu/log.h" 270b8fa32fSMarkus Armbruster #include "qemu/module.h" 2840b6f911SPeter Chubb 298ccce77cSJean-Christophe Dubois #ifndef DEBUG_IMX_UART 308ccce77cSJean-Christophe Dubois #define DEBUG_IMX_UART 0 3140b6f911SPeter Chubb #endif 3240b6f911SPeter Chubb 338ccce77cSJean-Christophe Dubois #define DPRINTF(fmt, args...) \ 348ccce77cSJean-Christophe Dubois do { \ 358ccce77cSJean-Christophe Dubois if (DEBUG_IMX_UART) { \ 368ccce77cSJean-Christophe Dubois fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_SERIAL, \ 378ccce77cSJean-Christophe Dubois __func__, ##args); \ 388ccce77cSJean-Christophe Dubois } \ 398ccce77cSJean-Christophe Dubois } while (0) 4040b6f911SPeter Chubb 4140b6f911SPeter Chubb static const VMStateDescription vmstate_imx_serial = { 42fa2650a3SJean-Christophe Dubois .name = TYPE_IMX_SERIAL, 4346d3fb63SAndrey Smirnov .version_id = 2, 4446d3fb63SAndrey Smirnov .minimum_version_id = 2, 4540b6f911SPeter Chubb .fields = (VMStateField[]) { 4640b6f911SPeter Chubb VMSTATE_INT32(readbuff, IMXSerialState), 4740b6f911SPeter Chubb VMSTATE_UINT32(usr1, IMXSerialState), 4840b6f911SPeter Chubb VMSTATE_UINT32(usr2, IMXSerialState), 4940b6f911SPeter Chubb VMSTATE_UINT32(ucr1, IMXSerialState), 5040b6f911SPeter Chubb VMSTATE_UINT32(uts1, IMXSerialState), 5140b6f911SPeter Chubb VMSTATE_UINT32(onems, IMXSerialState), 5240b6f911SPeter Chubb VMSTATE_UINT32(ufcr, IMXSerialState), 5340b6f911SPeter Chubb VMSTATE_UINT32(ubmr, IMXSerialState), 5440b6f911SPeter Chubb VMSTATE_UINT32(ubrc, IMXSerialState), 5540b6f911SPeter Chubb VMSTATE_UINT32(ucr3, IMXSerialState), 5646d3fb63SAndrey Smirnov VMSTATE_UINT32(ucr4, IMXSerialState), 5740b6f911SPeter Chubb VMSTATE_END_OF_LIST() 5840b6f911SPeter Chubb }, 5940b6f911SPeter Chubb }; 6040b6f911SPeter Chubb 6140b6f911SPeter Chubb static void imx_update(IMXSerialState *s) 6240b6f911SPeter Chubb { 63824e4a12SAndrey Smirnov uint32_t usr1; 64824e4a12SAndrey Smirnov uint32_t usr2; 65824e4a12SAndrey Smirnov uint32_t mask; 6640b6f911SPeter Chubb 67824e4a12SAndrey Smirnov /* 68824e4a12SAndrey Smirnov * Lucky for us TRDY and RRDY has the same offset in both USR1 and 69824e4a12SAndrey Smirnov * UCR1, so we can get away with something as simple as the 70824e4a12SAndrey Smirnov * following: 71824e4a12SAndrey Smirnov */ 72824e4a12SAndrey Smirnov usr1 = s->usr1 & s->ucr1 & (USR1_TRDY | USR1_RRDY); 73824e4a12SAndrey Smirnov /* 74824e4a12SAndrey Smirnov * Bits that we want in USR2 are not as conveniently laid out, 75824e4a12SAndrey Smirnov * unfortunately. 76824e4a12SAndrey Smirnov */ 77824e4a12SAndrey Smirnov mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0; 7846d3fb63SAndrey Smirnov /* 7946d3fb63SAndrey Smirnov * TCEN and TXDC are both bit 3 803c54cf77SHans-Erik Floryd * RDR and DREN are both bit 0 8146d3fb63SAndrey Smirnov */ 823c54cf77SHans-Erik Floryd mask |= s->ucr4 & (UCR4_TCEN | UCR4_DREN); 8346d3fb63SAndrey Smirnov 84824e4a12SAndrey Smirnov usr2 = s->usr2 & mask; 8540b6f911SPeter Chubb 86824e4a12SAndrey Smirnov qemu_set_irq(s->irq, usr1 || usr2); 8740b6f911SPeter Chubb } 8840b6f911SPeter Chubb 8940b6f911SPeter Chubb static void imx_serial_reset(IMXSerialState *s) 9040b6f911SPeter Chubb { 9140b6f911SPeter Chubb 9240b6f911SPeter Chubb s->usr1 = USR1_TRDY | USR1_RXDS; 9340b6f911SPeter Chubb /* 9440b6f911SPeter Chubb * Fake attachment of a terminal: assert RTS. 9540b6f911SPeter Chubb */ 9640b6f911SPeter Chubb s->usr1 |= USR1_RTSS; 9740b6f911SPeter Chubb s->usr2 = USR2_TXFE | USR2_TXDC | USR2_DCDIN; 9840b6f911SPeter Chubb s->uts1 = UTS1_RXEMPTY | UTS1_TXEMPTY; 9940b6f911SPeter Chubb s->ucr1 = 0; 10040b6f911SPeter Chubb s->ucr2 = UCR2_SRST; 10140b6f911SPeter Chubb s->ucr3 = 0x700; 10240b6f911SPeter Chubb s->ubmr = 0; 10340b6f911SPeter Chubb s->ubrc = 4; 10440b6f911SPeter Chubb s->readbuff = URXD_ERR; 10540b6f911SPeter Chubb } 10640b6f911SPeter Chubb 10740b6f911SPeter Chubb static void imx_serial_reset_at_boot(DeviceState *dev) 10840b6f911SPeter Chubb { 1098d8e3481SAndreas Färber IMXSerialState *s = IMX_SERIAL(dev); 11040b6f911SPeter Chubb 11140b6f911SPeter Chubb imx_serial_reset(s); 11240b6f911SPeter Chubb 11340b6f911SPeter Chubb /* 11440b6f911SPeter Chubb * enable the uart on boot, so messages from the linux decompresser 11540b6f911SPeter Chubb * are visible. On real hardware this is done by the boot rom 11640b6f911SPeter Chubb * before anything else is loaded. 11740b6f911SPeter Chubb */ 11840b6f911SPeter Chubb s->ucr1 = UCR1_UARTEN; 11940b6f911SPeter Chubb s->ucr2 = UCR2_TXEN; 12040b6f911SPeter Chubb 12140b6f911SPeter Chubb } 12240b6f911SPeter Chubb 123a8170e5eSAvi Kivity static uint64_t imx_serial_read(void *opaque, hwaddr offset, 12440b6f911SPeter Chubb unsigned size) 12540b6f911SPeter Chubb { 12640b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 12740b6f911SPeter Chubb uint32_t c; 12840b6f911SPeter Chubb 1298ccce77cSJean-Christophe Dubois DPRINTF("read(offset=0x%" HWADDR_PRIx ")\n", offset); 1308ccce77cSJean-Christophe Dubois 13140b6f911SPeter Chubb switch (offset >> 2) { 13240b6f911SPeter Chubb case 0x0: /* URXD */ 13340b6f911SPeter Chubb c = s->readbuff; 13440b6f911SPeter Chubb if (!(s->uts1 & UTS1_RXEMPTY)) { 13540b6f911SPeter Chubb /* Character is valid */ 13640b6f911SPeter Chubb c |= URXD_CHARRDY; 13740b6f911SPeter Chubb s->usr1 &= ~USR1_RRDY; 13840b6f911SPeter Chubb s->usr2 &= ~USR2_RDR; 13940b6f911SPeter Chubb s->uts1 |= UTS1_RXEMPTY; 14040b6f911SPeter Chubb imx_update(s); 1415345fdb4SMarc-André Lureau qemu_chr_fe_accept_input(&s->chr); 14240b6f911SPeter Chubb } 14340b6f911SPeter Chubb return c; 14440b6f911SPeter Chubb 14540b6f911SPeter Chubb case 0x20: /* UCR1 */ 14640b6f911SPeter Chubb return s->ucr1; 14740b6f911SPeter Chubb 14840b6f911SPeter Chubb case 0x21: /* UCR2 */ 14940b6f911SPeter Chubb return s->ucr2; 15040b6f911SPeter Chubb 15140b6f911SPeter Chubb case 0x25: /* USR1 */ 15240b6f911SPeter Chubb return s->usr1; 15340b6f911SPeter Chubb 15440b6f911SPeter Chubb case 0x26: /* USR2 */ 15540b6f911SPeter Chubb return s->usr2; 15640b6f911SPeter Chubb 15740b6f911SPeter Chubb case 0x2A: /* BRM Modulator */ 15840b6f911SPeter Chubb return s->ubmr; 15940b6f911SPeter Chubb 16040b6f911SPeter Chubb case 0x2B: /* Baud Rate Count */ 16140b6f911SPeter Chubb return s->ubrc; 16240b6f911SPeter Chubb 16340b6f911SPeter Chubb case 0x2d: /* Test register */ 16440b6f911SPeter Chubb return s->uts1; 16540b6f911SPeter Chubb 16640b6f911SPeter Chubb case 0x24: /* UFCR */ 16740b6f911SPeter Chubb return s->ufcr; 16840b6f911SPeter Chubb 16940b6f911SPeter Chubb case 0x2c: 17040b6f911SPeter Chubb return s->onems; 17140b6f911SPeter Chubb 17240b6f911SPeter Chubb case 0x22: /* UCR3 */ 17340b6f911SPeter Chubb return s->ucr3; 17440b6f911SPeter Chubb 17540b6f911SPeter Chubb case 0x23: /* UCR4 */ 17646d3fb63SAndrey Smirnov return s->ucr4; 17746d3fb63SAndrey Smirnov 17840b6f911SPeter Chubb case 0x29: /* BRM Incremental */ 17940b6f911SPeter Chubb return 0x0; /* TODO */ 18040b6f911SPeter Chubb 18140b6f911SPeter Chubb default: 1828ccce77cSJean-Christophe Dubois qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" 1838ccce77cSJean-Christophe Dubois HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset); 18440b6f911SPeter Chubb return 0; 18540b6f911SPeter Chubb } 18640b6f911SPeter Chubb } 18740b6f911SPeter Chubb 188a8170e5eSAvi Kivity static void imx_serial_write(void *opaque, hwaddr offset, 18940b6f911SPeter Chubb uint64_t value, unsigned size) 19040b6f911SPeter Chubb { 19140b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 1920ec7b3e7SMarc-André Lureau Chardev *chr = qemu_chr_fe_get_driver(&s->chr); 19340b6f911SPeter Chubb unsigned char ch; 19440b6f911SPeter Chubb 1958ccce77cSJean-Christophe Dubois DPRINTF("write(offset=0x%" HWADDR_PRIx ", value = 0x%x) to %s\n", 1965345fdb4SMarc-André Lureau offset, (unsigned int)value, chr ? chr->label : "NODEV"); 19740b6f911SPeter Chubb 19840b6f911SPeter Chubb switch (offset >> 2) { 19940b6f911SPeter Chubb case 0x10: /* UTXD */ 20040b6f911SPeter Chubb ch = value; 20140b6f911SPeter Chubb if (s->ucr2 & UCR2_TXEN) { 2026ab3fc32SDaniel P. Berrange /* XXX this blocks entire thread. Rewrite to use 2036ab3fc32SDaniel P. Berrange * qemu_chr_fe_write and background I/O callbacks */ 2045345fdb4SMarc-André Lureau qemu_chr_fe_write_all(&s->chr, &ch, 1); 20540b6f911SPeter Chubb s->usr1 &= ~USR1_TRDY; 20646d3fb63SAndrey Smirnov s->usr2 &= ~USR2_TXDC; 20740b6f911SPeter Chubb imx_update(s); 20840b6f911SPeter Chubb s->usr1 |= USR1_TRDY; 20946d3fb63SAndrey Smirnov s->usr2 |= USR2_TXDC; 21040b6f911SPeter Chubb imx_update(s); 21140b6f911SPeter Chubb } 21240b6f911SPeter Chubb break; 21340b6f911SPeter Chubb 21440b6f911SPeter Chubb case 0x20: /* UCR1 */ 21540b6f911SPeter Chubb s->ucr1 = value & 0xffff; 2168ccce77cSJean-Christophe Dubois 21740b6f911SPeter Chubb DPRINTF("write(ucr1=%x)\n", (unsigned int)value); 2188ccce77cSJean-Christophe Dubois 21940b6f911SPeter Chubb imx_update(s); 22040b6f911SPeter Chubb break; 22140b6f911SPeter Chubb 22240b6f911SPeter Chubb case 0x21: /* UCR2 */ 22340b6f911SPeter Chubb /* 22440b6f911SPeter Chubb * Only a few bits in control register 2 are implemented as yet. 22540b6f911SPeter Chubb * If it's intended to use a real serial device as a back-end, this 22640b6f911SPeter Chubb * register will have to be implemented more fully. 22740b6f911SPeter Chubb */ 22840b6f911SPeter Chubb if (!(value & UCR2_SRST)) { 22940b6f911SPeter Chubb imx_serial_reset(s); 23040b6f911SPeter Chubb imx_update(s); 23140b6f911SPeter Chubb value |= UCR2_SRST; 23240b6f911SPeter Chubb } 23340b6f911SPeter Chubb if (value & UCR2_RXEN) { 23440b6f911SPeter Chubb if (!(s->ucr2 & UCR2_RXEN)) { 2355345fdb4SMarc-André Lureau qemu_chr_fe_accept_input(&s->chr); 23640b6f911SPeter Chubb } 23740b6f911SPeter Chubb } 23840b6f911SPeter Chubb s->ucr2 = value & 0xffff; 23940b6f911SPeter Chubb break; 24040b6f911SPeter Chubb 24140b6f911SPeter Chubb case 0x25: /* USR1 */ 24240b6f911SPeter Chubb value &= USR1_AWAKE | USR1_AIRINT | USR1_DTRD | USR1_AGTIM | 24340b6f911SPeter Chubb USR1_FRAMERR | USR1_ESCF | USR1_RTSD | USR1_PARTYER; 24440b6f911SPeter Chubb s->usr1 &= ~value; 24540b6f911SPeter Chubb break; 24640b6f911SPeter Chubb 24740b6f911SPeter Chubb case 0x26: /* USR2 */ 24840b6f911SPeter Chubb /* 24940b6f911SPeter Chubb * Writing 1 to some bits clears them; all other 25040b6f911SPeter Chubb * values are ignored 25140b6f911SPeter Chubb */ 25240b6f911SPeter Chubb value &= USR2_ADET | USR2_DTRF | USR2_IDLE | USR2_ACST | 25340b6f911SPeter Chubb USR2_RIDELT | USR2_IRINT | USR2_WAKE | 25440b6f911SPeter Chubb USR2_DCDDELT | USR2_RTSF | USR2_BRCD | USR2_ORE; 25540b6f911SPeter Chubb s->usr2 &= ~value; 25640b6f911SPeter Chubb break; 25740b6f911SPeter Chubb 25840b6f911SPeter Chubb /* 25940b6f911SPeter Chubb * Linux expects to see what it writes to these registers 26040b6f911SPeter Chubb * We don't currently alter the baud rate 26140b6f911SPeter Chubb */ 26240b6f911SPeter Chubb case 0x29: /* UBIR */ 26340b6f911SPeter Chubb s->ubrc = value & 0xffff; 26440b6f911SPeter Chubb break; 26540b6f911SPeter Chubb 26640b6f911SPeter Chubb case 0x2a: /* UBMR */ 26740b6f911SPeter Chubb s->ubmr = value & 0xffff; 26840b6f911SPeter Chubb break; 26940b6f911SPeter Chubb 27040b6f911SPeter Chubb case 0x2c: /* One ms reg */ 27140b6f911SPeter Chubb s->onems = value & 0xffff; 27240b6f911SPeter Chubb break; 27340b6f911SPeter Chubb 27440b6f911SPeter Chubb case 0x24: /* FIFO control register */ 27540b6f911SPeter Chubb s->ufcr = value & 0xffff; 27640b6f911SPeter Chubb break; 27740b6f911SPeter Chubb 27840b6f911SPeter Chubb case 0x22: /* UCR3 */ 27940b6f911SPeter Chubb s->ucr3 = value & 0xffff; 28040b6f911SPeter Chubb break; 28140b6f911SPeter Chubb 28240b6f911SPeter Chubb case 0x23: /* UCR4 */ 28346d3fb63SAndrey Smirnov s->ucr4 = value & 0xffff; 28446d3fb63SAndrey Smirnov imx_update(s); 28546d3fb63SAndrey Smirnov break; 28646d3fb63SAndrey Smirnov 28746d3fb63SAndrey Smirnov case 0x2d: /* UTS1 */ 2888ccce77cSJean-Christophe Dubois qemu_log_mask(LOG_UNIMP, "[%s]%s: Unimplemented reg 0x%" 2898ccce77cSJean-Christophe Dubois HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset); 29040b6f911SPeter Chubb /* TODO */ 29140b6f911SPeter Chubb break; 29240b6f911SPeter Chubb 29340b6f911SPeter Chubb default: 2948ccce77cSJean-Christophe Dubois qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" 2958ccce77cSJean-Christophe Dubois HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset); 29640b6f911SPeter Chubb } 29740b6f911SPeter Chubb } 29840b6f911SPeter Chubb 29940b6f911SPeter Chubb static int imx_can_receive(void *opaque) 30040b6f911SPeter Chubb { 30140b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 30240b6f911SPeter Chubb return !(s->usr1 & USR1_RRDY); 30340b6f911SPeter Chubb } 30440b6f911SPeter Chubb 30540b6f911SPeter Chubb static void imx_put_data(void *opaque, uint32_t value) 30640b6f911SPeter Chubb { 30740b6f911SPeter Chubb IMXSerialState *s = (IMXSerialState *)opaque; 3088ccce77cSJean-Christophe Dubois 30940b6f911SPeter Chubb DPRINTF("received char\n"); 3108ccce77cSJean-Christophe Dubois 31140b6f911SPeter Chubb s->usr1 |= USR1_RRDY; 31240b6f911SPeter Chubb s->usr2 |= USR2_RDR; 31340b6f911SPeter Chubb s->uts1 &= ~UTS1_RXEMPTY; 31440b6f911SPeter Chubb s->readbuff = value; 315478a573aSTrent Piepho if (value & URXD_BRK) { 316478a573aSTrent Piepho s->usr2 |= USR2_BRCD; 317478a573aSTrent Piepho } 31840b6f911SPeter Chubb imx_update(s); 31940b6f911SPeter Chubb } 32040b6f911SPeter Chubb 32140b6f911SPeter Chubb static void imx_receive(void *opaque, const uint8_t *buf, int size) 32240b6f911SPeter Chubb { 32340b6f911SPeter Chubb imx_put_data(opaque, *buf); 32440b6f911SPeter Chubb } 32540b6f911SPeter Chubb 32640b6f911SPeter Chubb static void imx_event(void *opaque, int event) 32740b6f911SPeter Chubb { 32840b6f911SPeter Chubb if (event == CHR_EVENT_BREAK) { 329478a573aSTrent Piepho imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR); 33040b6f911SPeter Chubb } 33140b6f911SPeter Chubb } 33240b6f911SPeter Chubb 33340b6f911SPeter Chubb 33440b6f911SPeter Chubb static const struct MemoryRegionOps imx_serial_ops = { 33540b6f911SPeter Chubb .read = imx_serial_read, 33640b6f911SPeter Chubb .write = imx_serial_write, 33740b6f911SPeter Chubb .endianness = DEVICE_NATIVE_ENDIAN, 33840b6f911SPeter Chubb }; 33940b6f911SPeter Chubb 340f6c64000SJean-Christophe Dubois static void imx_serial_realize(DeviceState *dev, Error **errp) 34140b6f911SPeter Chubb { 3428d8e3481SAndreas Färber IMXSerialState *s = IMX_SERIAL(dev); 34340b6f911SPeter Chubb 344fa394ed6SMarc-André Lureau DPRINTF("char dev for uart: %p\n", qemu_chr_fe_get_driver(&s->chr)); 345fa394ed6SMarc-André Lureau 3465345fdb4SMarc-André Lureau qemu_chr_fe_set_handlers(&s->chr, imx_can_receive, imx_receive, 34781517ba3SAnton Nefedov imx_event, NULL, s, NULL, true); 348f6c64000SJean-Christophe Dubois } 34940b6f911SPeter Chubb 350f6c64000SJean-Christophe Dubois static void imx_serial_init(Object *obj) 351f6c64000SJean-Christophe Dubois { 352f6c64000SJean-Christophe Dubois SysBusDevice *sbd = SYS_BUS_DEVICE(obj); 353f6c64000SJean-Christophe Dubois IMXSerialState *s = IMX_SERIAL(obj); 354f6c64000SJean-Christophe Dubois 355f6c64000SJean-Christophe Dubois memory_region_init_io(&s->iomem, obj, &imx_serial_ops, s, 356f6c64000SJean-Christophe Dubois TYPE_IMX_SERIAL, 0x1000); 357f6c64000SJean-Christophe Dubois sysbus_init_mmio(sbd, &s->iomem); 358f6c64000SJean-Christophe Dubois sysbus_init_irq(sbd, &s->irq); 35940b6f911SPeter Chubb } 36040b6f911SPeter Chubb 361f6c64000SJean-Christophe Dubois static Property imx_serial_properties[] = { 36240b6f911SPeter Chubb DEFINE_PROP_CHR("chardev", IMXSerialState, chr), 36340b6f911SPeter Chubb DEFINE_PROP_END_OF_LIST(), 36440b6f911SPeter Chubb }; 36540b6f911SPeter Chubb 36640b6f911SPeter Chubb static void imx_serial_class_init(ObjectClass *klass, void *data) 36740b6f911SPeter Chubb { 36840b6f911SPeter Chubb DeviceClass *dc = DEVICE_CLASS(klass); 36940b6f911SPeter Chubb 370f6c64000SJean-Christophe Dubois dc->realize = imx_serial_realize; 37140b6f911SPeter Chubb dc->vmsd = &vmstate_imx_serial; 37240b6f911SPeter Chubb dc->reset = imx_serial_reset_at_boot; 373125ee0edSMarcel Apfelbaum set_bit(DEVICE_CATEGORY_INPUT, dc->categories); 37440b6f911SPeter Chubb dc->desc = "i.MX series UART"; 375f6c64000SJean-Christophe Dubois dc->props = imx_serial_properties; 37640b6f911SPeter Chubb } 37740b6f911SPeter Chubb 3788c43a6f0SAndreas Färber static const TypeInfo imx_serial_info = { 3798d8e3481SAndreas Färber .name = TYPE_IMX_SERIAL, 38040b6f911SPeter Chubb .parent = TYPE_SYS_BUS_DEVICE, 38140b6f911SPeter Chubb .instance_size = sizeof(IMXSerialState), 382f6c64000SJean-Christophe Dubois .instance_init = imx_serial_init, 38340b6f911SPeter Chubb .class_init = imx_serial_class_init, 38440b6f911SPeter Chubb }; 38540b6f911SPeter Chubb 38640b6f911SPeter Chubb static void imx_serial_register_types(void) 38740b6f911SPeter Chubb { 38840b6f911SPeter Chubb type_register_static(&imx_serial_info); 38940b6f911SPeter Chubb } 39040b6f911SPeter Chubb 39140b6f911SPeter Chubb type_init(imx_serial_register_types) 392