Home | History | Annotate | Line # | Download | only in imx
imxuart.c revision 1.1.20.1
      1  1.1.20.1  mjf /* $Id: imxuart.c,v 1.1.20.1 2008/06/02 13:21:54 mjf Exp $ */
      2  1.1.20.1  mjf #include <sys/types.h>
      3  1.1.20.1  mjf #include <sys/systm.h>
      4  1.1.20.1  mjf #include <sys/device.h>
      5  1.1.20.1  mjf #include <sys/conf.h>
      6  1.1.20.1  mjf 
      7  1.1.20.1  mjf #include <arm/armreg.h>
      8  1.1.20.1  mjf 
      9  1.1.20.1  mjf #include <sys/tty.h>
     10  1.1.20.1  mjf #include <sys/termios.h>
     11  1.1.20.1  mjf #include <dev/cons.h>
     12  1.1.20.1  mjf 
     13  1.1.20.1  mjf #include <machine/bus.h>
     14  1.1.20.1  mjf #include <arm/imx/imx31var.h>
     15  1.1.20.1  mjf #include <arm/imx/imxuartreg.h>
     16  1.1.20.1  mjf #include <arm/imx/imxuartvar.h>
     17  1.1.20.1  mjf #include <evbarm/imx31/imx31lk_reg.h>
     18  1.1.20.1  mjf 
     19  1.1.20.1  mjf #define IMXUART_UNIT_MASK	0x7ffff
     20  1.1.20.1  mjf #define IMXUART_DIALOUT_MASK	0x80000
     21  1.1.20.1  mjf 
     22  1.1.20.1  mjf #define IMXUART_UNIT(dev)	(minor(dev) & IMXUART_UNIT_MASK)
     23  1.1.20.1  mjf #define IMXUART_DIALOUT(dev)	(minor(dev) & IMXUART_DIALOUT_MASK)
     24  1.1.20.1  mjf 
     25  1.1.20.1  mjf 
     26  1.1.20.1  mjf 
     27  1.1.20.1  mjf #define __TRACE	imxuart_puts(&imxuart_softc, __FUNCTION__ )
     28  1.1.20.1  mjf 
     29  1.1.20.1  mjf extern struct bus_space imx31_bs_tag;
     30  1.1.20.1  mjf 
     31  1.1.20.1  mjf imxuart_softc_t imxuart_softc = { { 0, }, };
     32  1.1.20.1  mjf 
     33  1.1.20.1  mjf uint32_t imxuart_snapshot_data[32];
     34  1.1.20.1  mjf const char *imxuart_test_string =
     35  1.1.20.1  mjf 	"0123456789012345678901234567890123456789\r\n";
     36  1.1.20.1  mjf 
     37  1.1.20.1  mjf 
     38  1.1.20.1  mjf cons_decl(imxuart);
     39  1.1.20.1  mjf static struct consdev imxuartcntab = cons_init(imxuart);
     40  1.1.20.1  mjf 
     41  1.1.20.1  mjf #ifdef NOTYET
     42  1.1.20.1  mjf dev_type_open(imxuartopen);
     43  1.1.20.1  mjf dev_type_close(imxuartclose);
     44  1.1.20.1  mjf dev_type_read(imxuartread);
     45  1.1.20.1  mjf dev_type_write(imxuartwrite);
     46  1.1.20.1  mjf dev_type_ioctl(imxuartioctl);
     47  1.1.20.1  mjf dev_type_stop(imxuartstop);
     48  1.1.20.1  mjf dev_type_tty(imxuarttty);
     49  1.1.20.1  mjf dev_type_poll(imxuartpoll);
     50  1.1.20.1  mjf const struct cdevsw imxuart_cdevsw = {
     51  1.1.20.1  mjf         imxuartopen, imxuartclose, imxuartread, imxuartwrite,
     52  1.1.20.1  mjf 	imxuartioctl, imxuartstop, imxuarttty, imxuartpoll,
     53  1.1.20.1  mjf 	nommap, ttykqfilter, D_TTY
     54  1.1.20.1  mjf };
     55  1.1.20.1  mjf #else
     56  1.1.20.1  mjf const struct cdevsw imxuart_cdevsw = {
     57  1.1.20.1  mjf         nullopen, nullclose, nullread, nullwrite,
     58  1.1.20.1  mjf 	nullioctl, nullstop, notty, nullpoll,
     59  1.1.20.1  mjf 	nommap, nullkqfilter, D_TTY
     60  1.1.20.1  mjf };
     61  1.1.20.1  mjf #endif
     62  1.1.20.1  mjf 
     63  1.1.20.1  mjf 
     64  1.1.20.1  mjf int  imxuart_cnattach(bus_space_tag_t, bus_addr_t, int, int, int, tcflag_t);
     65  1.1.20.1  mjf int  imxuart_puts(imxuart_softc_t *, const char *);
     66  1.1.20.1  mjf int  imxuart_putchar(imxuart_softc_t *, int);
     67  1.1.20.1  mjf int  imxuart_getchar(imxuart_softc_t *);
     68  1.1.20.1  mjf 
     69  1.1.20.1  mjf static int  imxuart_urxd_brk(void);
     70  1.1.20.1  mjf static void imxuart_urxd_err(imxuart_softc_t *, uint32_t);
     71  1.1.20.1  mjf 
     72  1.1.20.1  mjf static int imxuart_match(struct device *, struct cfdata *, void *);
     73  1.1.20.1  mjf static void imxuart_attach(struct device *, struct device *, void *);
     74  1.1.20.1  mjf 
     75  1.1.20.1  mjf static void imxuart_start(struct tty *);
     76  1.1.20.1  mjf static int  imxuart_param(struct tty *, struct termios *);
     77  1.1.20.1  mjf static void imxuart_shutdownhook(void *arg);
     78  1.1.20.1  mjf 
     79  1.1.20.1  mjf CFATTACH_DECL(imxuart, sizeof(struct imxuart_softc),
     80  1.1.20.1  mjf     imxuart_match, imxuart_attach, NULL, NULL);
     81  1.1.20.1  mjf 
     82  1.1.20.1  mjf 
     83  1.1.20.1  mjf /*
     84  1.1.20.1  mjf  * disable the specified IMX UART interrupt in softc
     85  1.1.20.1  mjf  * return -1 on error
     86  1.1.20.1  mjf  * else return previous enabled state
     87  1.1.20.1  mjf  */
     88  1.1.20.1  mjf static __inline int
     89  1.1.20.1  mjf imxuart_intrspec_dis(imxuart_softc_t *sc, imxuart_intrix_t ix)
     90  1.1.20.1  mjf {
     91  1.1.20.1  mjf 	const imxuart_intrspec_t *spec = &imxuart_intrspec_tab[ix];
     92  1.1.20.1  mjf 	uint32_t v;
     93  1.1.20.1  mjf 	uint32_t b;
     94  1.1.20.1  mjf 	const uint32_t syncbit = 1 << 31;
     95  1.1.20.1  mjf 	uint n;
     96  1.1.20.1  mjf 
     97  1.1.20.1  mjf 	if (ix >= IMXUART_INTRSPEC_TAB_SZ)
     98  1.1.20.1  mjf 		return -1;
     99  1.1.20.1  mjf 
    100  1.1.20.1  mjf 	v = (1 << ix);
    101  1.1.20.1  mjf 	if ((sc->sc_intrspec_enb & v) == 0)
    102  1.1.20.1  mjf 		return 0;
    103  1.1.20.1  mjf 	sc->sc_intrspec_enb &= ~v;
    104  1.1.20.1  mjf 
    105  1.1.20.1  mjf 	n = spec->enb_reg;
    106  1.1.20.1  mjf 	b = spec->enb_bit;
    107  1.1.20.1  mjf 	v = sc->sc_ucr[n];
    108  1.1.20.1  mjf 	v &= ~b;
    109  1.1.20.1  mjf 	v |= syncbit;
    110  1.1.20.1  mjf 	sc->sc_ucr[n] = v;
    111  1.1.20.1  mjf 
    112  1.1.20.1  mjf 	n = spec->flg_reg;
    113  1.1.20.1  mjf 	b = spec->flg_bit;
    114  1.1.20.1  mjf 	v = sc->sc_usr[n];
    115  1.1.20.1  mjf 	v &= ~b;
    116  1.1.20.1  mjf 	v |= syncbit;
    117  1.1.20.1  mjf 	sc->sc_usr[n] = v;
    118  1.1.20.1  mjf 
    119  1.1.20.1  mjf 	return 1;
    120  1.1.20.1  mjf }
    121  1.1.20.1  mjf 
    122  1.1.20.1  mjf /*
    123  1.1.20.1  mjf  * enable the specified IMX UART interrupt in softc
    124  1.1.20.1  mjf  * return -1 on error
    125  1.1.20.1  mjf  * else return previous enabled state
    126  1.1.20.1  mjf  */
    127  1.1.20.1  mjf static __inline int
    128  1.1.20.1  mjf imxuart_intrspec_enb(imxuart_softc_t *sc, imxuart_intrix_t ix)
    129  1.1.20.1  mjf {
    130  1.1.20.1  mjf 	const imxuart_intrspec_t *spec = &imxuart_intrspec_tab[ix];
    131  1.1.20.1  mjf 	uint32_t v;
    132  1.1.20.1  mjf 	uint n;
    133  1.1.20.1  mjf 	const uint32_t syncbit = 1 << 31;
    134  1.1.20.1  mjf 
    135  1.1.20.1  mjf 	if (ix >= IMXUART_INTRSPEC_TAB_SZ)
    136  1.1.20.1  mjf 		return -1;
    137  1.1.20.1  mjf 
    138  1.1.20.1  mjf 	v = (1 << ix);
    139  1.1.20.1  mjf 	if ((sc->sc_intrspec_enb & v) != 0)
    140  1.1.20.1  mjf 		return 1;
    141  1.1.20.1  mjf 	sc->sc_intrspec_enb |= v;
    142  1.1.20.1  mjf 
    143  1.1.20.1  mjf 
    144  1.1.20.1  mjf 	n = spec->enb_reg;
    145  1.1.20.1  mjf 	v = spec->enb_bit;
    146  1.1.20.1  mjf 	v |= syncbit;
    147  1.1.20.1  mjf 	sc->sc_ucr[n] |= v;
    148  1.1.20.1  mjf 
    149  1.1.20.1  mjf 	n = spec->flg_reg;
    150  1.1.20.1  mjf 	v = spec->flg_bit;
    151  1.1.20.1  mjf 	v |= syncbit;
    152  1.1.20.1  mjf 	sc->sc_usr[n] |= v;
    153  1.1.20.1  mjf 
    154  1.1.20.1  mjf 	return 0;
    155  1.1.20.1  mjf }
    156  1.1.20.1  mjf 
    157  1.1.20.1  mjf /*
    158  1.1.20.1  mjf  * sync softc interrupt spec to UART Control regs
    159  1.1.20.1  mjf  */
    160  1.1.20.1  mjf static __inline void
    161  1.1.20.1  mjf imxuart_intrspec_sync(imxuart_softc_t *sc)
    162  1.1.20.1  mjf {
    163  1.1.20.1  mjf 	int i;
    164  1.1.20.1  mjf 	uint32_t r;
    165  1.1.20.1  mjf 	uint32_t v;
    166  1.1.20.1  mjf 	const uint32_t syncbit = 1 << 31;
    167  1.1.20.1  mjf 	const uint32_t mask[4] = {
    168  1.1.20.1  mjf 		IMXUART_INTRS_UCR1,
    169  1.1.20.1  mjf 		IMXUART_INTRS_UCR2,
    170  1.1.20.1  mjf 		IMXUART_INTRS_UCR3,
    171  1.1.20.1  mjf 		IMXUART_INTRS_UCR4
    172  1.1.20.1  mjf 	};
    173  1.1.20.1  mjf 
    174  1.1.20.1  mjf 	for (i=0; i < 4; i++) {
    175  1.1.20.1  mjf 		v = sc->sc_ucr[i];
    176  1.1.20.1  mjf 		if (v & syncbit) {
    177  1.1.20.1  mjf 			v &= ~syncbit;
    178  1.1.20.1  mjf 			sc->sc_ucr[i] = v;
    179  1.1.20.1  mjf 			r = bus_space_read_4(sc->sc_bt, sc->sc_bh, IMX_UCRn(i));
    180  1.1.20.1  mjf 			r &= ~mask[i];
    181  1.1.20.1  mjf 			r |= v;
    182  1.1.20.1  mjf 			bus_space_write_4(sc->sc_bt, sc->sc_bh, IMX_UCRn(i), r);
    183  1.1.20.1  mjf 		}
    184  1.1.20.1  mjf 	}
    185  1.1.20.1  mjf }
    186  1.1.20.1  mjf 
    187  1.1.20.1  mjf 
    188  1.1.20.1  mjf int
    189  1.1.20.1  mjf imxuart_init(imxuart_softc_t *sc, uint bh)
    190  1.1.20.1  mjf {
    191  1.1.20.1  mjf 	if (sc == 0)
    192  1.1.20.1  mjf 		sc = &imxuart_softc;
    193  1.1.20.1  mjf 	sc->sc_init_cnt++;
    194  1.1.20.1  mjf 	cn_tab = &imxuartcntab;
    195  1.1.20.1  mjf 	sc->sc_bt = &imx31_bs_tag;
    196  1.1.20.1  mjf 	sc->sc_bh = bh;
    197  1.1.20.1  mjf 
    198  1.1.20.1  mjf 	memset(&sc->sc_errors, 0, sizeof(sc->sc_errors));
    199  1.1.20.1  mjf 
    200  1.1.20.1  mjf 	return 0;
    201  1.1.20.1  mjf }
    202  1.1.20.1  mjf 
    203  1.1.20.1  mjf int
    204  1.1.20.1  mjf imxuart_puts(imxuart_softc_t *sc, const char *s)
    205  1.1.20.1  mjf {
    206  1.1.20.1  mjf 	char c;
    207  1.1.20.1  mjf 	int err = -2;
    208  1.1.20.1  mjf 
    209  1.1.20.1  mjf 	for(;;) {
    210  1.1.20.1  mjf 		c = *s++;
    211  1.1.20.1  mjf 		if (c == '\0')
    212  1.1.20.1  mjf 			break;
    213  1.1.20.1  mjf 		err = imxuart_putchar(sc, c);
    214  1.1.20.1  mjf 	}
    215  1.1.20.1  mjf 	return err;
    216  1.1.20.1  mjf }
    217  1.1.20.1  mjf 
    218  1.1.20.1  mjf int
    219  1.1.20.1  mjf imxuart_putchar(imxuart_softc_t *sc, int c)
    220  1.1.20.1  mjf {
    221  1.1.20.1  mjf 	uint32_t r;
    222  1.1.20.1  mjf 
    223  1.1.20.1  mjf 	for (;;) {
    224  1.1.20.1  mjf 		r = bus_space_read_4(sc->sc_bt, sc->sc_bh, IMX_UTS);
    225  1.1.20.1  mjf 		if ((r & IMX_UTS_TXFUL) == 0)
    226  1.1.20.1  mjf 			break;
    227  1.1.20.1  mjf 	}
    228  1.1.20.1  mjf 
    229  1.1.20.1  mjf 	r = (uint32_t)c & IMX_UTXD_TX_DATA;
    230  1.1.20.1  mjf 	bus_space_write_4(sc->sc_bt, sc->sc_bh, IMX_UTXD, r);
    231  1.1.20.1  mjf 
    232  1.1.20.1  mjf 	return 0;
    233  1.1.20.1  mjf }
    234  1.1.20.1  mjf 
    235  1.1.20.1  mjf int
    236  1.1.20.1  mjf imxuart_getchar(imxuart_softc_t *sc)
    237  1.1.20.1  mjf {
    238  1.1.20.1  mjf 	uint32_t r;
    239  1.1.20.1  mjf 	int c;
    240  1.1.20.1  mjf 
    241  1.1.20.1  mjf 	for(;;) {
    242  1.1.20.1  mjf 		r = bus_space_read_4(sc->sc_bt, sc->sc_bh, IMX_URXD);
    243  1.1.20.1  mjf 		if (r & IMX_URXD_ERR) {
    244  1.1.20.1  mjf 			imxuart_urxd_err(sc, r);
    245  1.1.20.1  mjf 			continue;
    246  1.1.20.1  mjf 		}
    247  1.1.20.1  mjf 		if (r & IMX_URXD_CHARDY) {
    248  1.1.20.1  mjf 			c = (int)(r & IMX_URXD_RX_DATA);
    249  1.1.20.1  mjf 			break;
    250  1.1.20.1  mjf 		}
    251  1.1.20.1  mjf 	}
    252  1.1.20.1  mjf 
    253  1.1.20.1  mjf 	return c;
    254  1.1.20.1  mjf }
    255  1.1.20.1  mjf 
    256  1.1.20.1  mjf static int
    257  1.1.20.1  mjf imxuart_urxd_brk(void)
    258  1.1.20.1  mjf {
    259  1.1.20.1  mjf #ifdef DDB
    260  1.1.20.1  mjf 	if (cn_tab == &imxuartcntab) {
    261  1.1.20.1  mjf 		Debugger();
    262  1.1.20.1  mjf 		return 0;
    263  1.1.20.1  mjf 	}
    264  1.1.20.1  mjf #endif
    265  1.1.20.1  mjf 	return 1;
    266  1.1.20.1  mjf }
    267  1.1.20.1  mjf 
    268  1.1.20.1  mjf static void
    269  1.1.20.1  mjf imxuart_urxd_err(imxuart_softc_t *sc, uint32_t r)
    270  1.1.20.1  mjf {
    271  1.1.20.1  mjf 	if (r & IMX_URXD_BRK)
    272  1.1.20.1  mjf 		if (imxuart_urxd_brk() == 0)
    273  1.1.20.1  mjf 			return;
    274  1.1.20.1  mjf 
    275  1.1.20.1  mjf 	sc->sc_errors.err++;
    276  1.1.20.1  mjf 	if (r & IMX_URXD_BRK)
    277  1.1.20.1  mjf 		sc->sc_errors.brk++;
    278  1.1.20.1  mjf 	if (r & IMX_URXD_PRERR)
    279  1.1.20.1  mjf 		sc->sc_errors.prerr++;
    280  1.1.20.1  mjf 	if (r & IMX_URXD_FRMERR)
    281  1.1.20.1  mjf 		sc->sc_errors.frmerr++;
    282  1.1.20.1  mjf 	if (r & IMX_URXD_OVRRUN)
    283  1.1.20.1  mjf 		sc->sc_errors.ovrrun++;
    284  1.1.20.1  mjf }
    285  1.1.20.1  mjf 
    286  1.1.20.1  mjf static int
    287  1.1.20.1  mjf imxuart_snapshot(imxuart_softc_t *sc, uint32_t *p)
    288  1.1.20.1  mjf {
    289  1.1.20.1  mjf 	int i;
    290  1.1.20.1  mjf 	const uint r[] = {	IMX_URXD, IMX_UTXD, IMX_UCR1, IMX_UCR2,
    291  1.1.20.1  mjf 			IMX_UCR3, IMX_UCR4, IMX_UFCR, IMX_USR1,
    292  1.1.20.1  mjf 			IMX_USR2, IMX_UESC, IMX_UTIM, IMX_UBIR,
    293  1.1.20.1  mjf 			IMX_UBMR, IMX_UBRC, IMX_ONEMS, IMX_UTS };
    294  1.1.20.1  mjf 
    295  1.1.20.1  mjf 	for (i=0; i < ((sizeof(r)/sizeof(r[0]))); i++) {
    296  1.1.20.1  mjf 		*p++ = sc->sc_bh + r[i];
    297  1.1.20.1  mjf 		*p++ = bus_space_read_4(sc->sc_bt, sc->sc_bh, r[i]);
    298  1.1.20.1  mjf 	}
    299  1.1.20.1  mjf 	return 0;
    300  1.1.20.1  mjf }
    301  1.1.20.1  mjf 
    302  1.1.20.1  mjf int
    303  1.1.20.1  mjf imxuart_test(void)
    304  1.1.20.1  mjf {
    305  1.1.20.1  mjf 	imxuart_softc_t *sc = &imxuart_softc;
    306  1.1.20.1  mjf 	int n;
    307  1.1.20.1  mjf 	int err;
    308  1.1.20.1  mjf 
    309  1.1.20.1  mjf 	err = imxuart_init(sc, 1);
    310  1.1.20.1  mjf 	if (err != 0)
    311  1.1.20.1  mjf 		return err;
    312  1.1.20.1  mjf 
    313  1.1.20.1  mjf 	if (0) {
    314  1.1.20.1  mjf 		extern u_int cpufunc_id(void);
    315  1.1.20.1  mjf 		err = cpufunc_id();
    316  1.1.20.1  mjf 		return err;
    317  1.1.20.1  mjf 	}
    318  1.1.20.1  mjf 
    319  1.1.20.1  mjf #if 0
    320  1.1.20.1  mjf 	err = imxuart_snapshot(sc, imxuart_snapshot_data);
    321  1.1.20.1  mjf 	if (err != 0)
    322  1.1.20.1  mjf 		return err;
    323  1.1.20.1  mjf #endif
    324  1.1.20.1  mjf 
    325  1.1.20.1  mjf 
    326  1.1.20.1  mjf 	err = imxuart_putchar(sc, 'x');
    327  1.1.20.1  mjf 	if (err != 0)
    328  1.1.20.1  mjf 		return err;
    329  1.1.20.1  mjf 
    330  1.1.20.1  mjf 	for (n=100; n--; ) {
    331  1.1.20.1  mjf 		err = imxuart_puts(sc, imxuart_test_string);
    332  1.1.20.1  mjf 		if (err != 0)
    333  1.1.20.1  mjf 			break;
    334  1.1.20.1  mjf 	}
    335  1.1.20.1  mjf 
    336  1.1.20.1  mjf 	err = imxuart_snapshot(sc, imxuart_snapshot_data);
    337  1.1.20.1  mjf 	if (err != 0)
    338  1.1.20.1  mjf 		return err;
    339  1.1.20.1  mjf 
    340  1.1.20.1  mjf 	return err;
    341  1.1.20.1  mjf }
    342  1.1.20.1  mjf 
    343  1.1.20.1  mjf static int
    344  1.1.20.1  mjf imxuart_match(struct device *parent, struct cfdata *cf, void *aux)
    345  1.1.20.1  mjf {
    346  1.1.20.1  mjf 	struct aips_attach_args * const aipsa = aux;
    347  1.1.20.1  mjf 
    348  1.1.20.1  mjf 	switch (aipsa->aipsa_addr) {
    349  1.1.20.1  mjf 	case IMX_UART1_BASE:
    350  1.1.20.1  mjf 	case IMX_UART2_BASE:
    351  1.1.20.1  mjf 	case IMX_UART3_BASE:
    352  1.1.20.1  mjf 	case IMX_UART4_BASE:
    353  1.1.20.1  mjf 	case IMX_UART5_BASE:
    354  1.1.20.1  mjf 		return 1;
    355  1.1.20.1  mjf 	default:
    356  1.1.20.1  mjf 		return 0;
    357  1.1.20.1  mjf 	}
    358  1.1.20.1  mjf }
    359  1.1.20.1  mjf 
    360  1.1.20.1  mjf static void
    361  1.1.20.1  mjf imxuart_attach(struct device *parent, struct device *self, void *aux)
    362  1.1.20.1  mjf {
    363  1.1.20.1  mjf 	imxuart_softc_t *sc = (void *)self;
    364  1.1.20.1  mjf 	struct aips_attach_args * const aipsa = aux;
    365  1.1.20.1  mjf 	struct tty *tp;
    366  1.1.20.1  mjf 
    367  1.1.20.1  mjf 	sc->sc_bt = aipsa->aipsa_memt;
    368  1.1.20.1  mjf 	sc->sc_addr = aipsa->aipsa_addr;
    369  1.1.20.1  mjf 	sc->sc_size = aipsa->aipsa_size;
    370  1.1.20.1  mjf 	sc->sc_intr = aipsa->aipsa_intr;
    371  1.1.20.1  mjf 
    372  1.1.20.1  mjf 	sc->sc_tty = tp = ttymalloc();
    373  1.1.20.1  mjf 	tp->t_oproc = imxuart_start;
    374  1.1.20.1  mjf 	tp->t_param = imxuart_param;
    375  1.1.20.1  mjf 	tty_attach(tp);
    376  1.1.20.1  mjf 
    377  1.1.20.1  mjf 	shutdownhook_establish(imxuart_shutdownhook, sc);
    378  1.1.20.1  mjf 
    379  1.1.20.1  mjf 	printf("\n");
    380  1.1.20.1  mjf }
    381  1.1.20.1  mjf 
    382  1.1.20.1  mjf void
    383  1.1.20.1  mjf imxuartcnprobe(struct consdev *cp)
    384  1.1.20.1  mjf {
    385  1.1.20.1  mjf 	int major;
    386  1.1.20.1  mjf 
    387  1.1.20.1  mjf 	__TRACE;
    388  1.1.20.1  mjf 	major = cdevsw_lookup_major(&imxuart_cdevsw);
    389  1.1.20.1  mjf 	cp->cn_dev = makedev(major, 0);			/* XXX unit 0 */
    390  1.1.20.1  mjf 	cp->cn_pri = CN_REMOTE;
    391  1.1.20.1  mjf }
    392  1.1.20.1  mjf 
    393  1.1.20.1  mjf static void
    394  1.1.20.1  mjf imxuart_start(struct tty *tp)
    395  1.1.20.1  mjf {
    396  1.1.20.1  mjf 	__TRACE;
    397  1.1.20.1  mjf }
    398  1.1.20.1  mjf 
    399  1.1.20.1  mjf static int
    400  1.1.20.1  mjf imxuart_param(struct tty *tp, struct termios *termios)
    401  1.1.20.1  mjf {
    402  1.1.20.1  mjf 	__TRACE;
    403  1.1.20.1  mjf 	return 0;
    404  1.1.20.1  mjf }
    405  1.1.20.1  mjf 
    406  1.1.20.1  mjf static void
    407  1.1.20.1  mjf imxuart_shutdownhook(void *arg)
    408  1.1.20.1  mjf {
    409  1.1.20.1  mjf 	__TRACE;
    410  1.1.20.1  mjf }
    411  1.1.20.1  mjf 
    412  1.1.20.1  mjf void
    413  1.1.20.1  mjf imxuartcninit(struct consdev *cp)
    414  1.1.20.1  mjf {
    415  1.1.20.1  mjf 	__TRACE;
    416  1.1.20.1  mjf }
    417  1.1.20.1  mjf 
    418  1.1.20.1  mjf int
    419  1.1.20.1  mjf imxuartcngetc(dev_t dev)
    420  1.1.20.1  mjf {
    421  1.1.20.1  mjf 	struct imxuart_softc *sc;
    422  1.1.20.1  mjf 	uint unit;
    423  1.1.20.1  mjf 	int c;
    424  1.1.20.1  mjf 
    425  1.1.20.1  mjf 	unit = IMXUART_UNIT(dev);
    426  1.1.20.1  mjf 	if (unit != 0)
    427  1.1.20.1  mjf 		return 0;
    428  1.1.20.1  mjf 	sc = &imxuart_softc;
    429  1.1.20.1  mjf 	c = imxuart_getchar(sc);
    430  1.1.20.1  mjf 	return c;
    431  1.1.20.1  mjf }
    432  1.1.20.1  mjf 
    433  1.1.20.1  mjf void
    434  1.1.20.1  mjf imxuartcnputc(dev_t dev, int c)
    435  1.1.20.1  mjf {
    436  1.1.20.1  mjf 	(void)imxuart_putchar(&imxuart_softc, c);
    437  1.1.20.1  mjf }
    438  1.1.20.1  mjf 
    439  1.1.20.1  mjf void
    440  1.1.20.1  mjf imxuartcnpollc(dev_t dev, int mode)
    441  1.1.20.1  mjf {
    442  1.1.20.1  mjf 	/* always polled for now */
    443  1.1.20.1  mjf }
    444  1.1.20.1  mjf int
    445  1.1.20.1  mjf imxuart_cnattach(bus_space_tag_t iot, bus_addr_t iobase,
    446  1.1.20.1  mjf 	int rate, int frequency, int type, tcflag_t cflag)
    447  1.1.20.1  mjf {
    448  1.1.20.1  mjf 	cn_tab = &imxuartcntab;
    449  1.1.20.1  mjf 	return 0;
    450  1.1.20.1  mjf }
    451  1.1.20.1  mjf 
    452