Lines Matching refs:plat
74 static void _mt7620_serial_setbrg(struct mt7620_serial_plat *plat, int baud) in _mt7620_serial_setbrg() argument
79 quot = DIV_ROUND_CLOSEST(plat->clock, 16 * baud); in _mt7620_serial_setbrg()
80 writel(quot, &plat->regs->dl); in _mt7620_serial_setbrg()
83 writel(UART_LCR_WLS_8, &plat->regs->lcr); in _mt7620_serial_setbrg()
88 struct mt7620_serial_plat *plat = dev_get_plat(dev); in mt7620_serial_setbrg() local
90 _mt7620_serial_setbrg(plat, baudrate); in mt7620_serial_setbrg()
97 struct mt7620_serial_plat *plat = dev_get_plat(dev); in mt7620_serial_putc() local
99 if (!(readl(&plat->regs->lsr) & UART_LSR_THRE)) in mt7620_serial_putc()
102 writel(ch, &plat->regs->thr); in mt7620_serial_putc()
112 struct mt7620_serial_plat *plat = dev_get_plat(dev); in mt7620_serial_getc() local
114 if (!(readl(&plat->regs->lsr) & UART_LSR_DR)) in mt7620_serial_getc()
117 return readl(&plat->regs->rbr); in mt7620_serial_getc()
122 struct mt7620_serial_plat *plat = dev_get_plat(dev); in mt7620_serial_pending() local
125 return (readl(&plat->regs->lsr) & UART_LSR_DR) ? 1 : 0; in mt7620_serial_pending()
127 return (readl(&plat->regs->lsr) & UART_LSR_THRE) ? 0 : 1; in mt7620_serial_pending()
132 struct mt7620_serial_plat *plat = dev_get_plat(dev); in mt7620_serial_probe() local
135 plat->regs = (void __iomem *)KSEG1ADDR(plat->dtplat.reg[0]); in mt7620_serial_probe()
136 plat->clock = plat->dtplat.clock_frequency; in mt7620_serial_probe()
140 writel(0, &plat->regs->ier); in mt7620_serial_probe()
142 writel(UART_MCRVAL, &plat->regs->mcr); in mt7620_serial_probe()
143 writel(UART_FCRVAL, &plat->regs->fcr); in mt7620_serial_probe()
151 struct mt7620_serial_plat *plat = dev_get_plat(dev); in mt7620_serial_of_to_plat() local
160 plat->regs = dev_remap_addr_index(dev, 0); in mt7620_serial_of_to_plat()
161 if (!plat->regs) { in mt7620_serial_of_to_plat()
170 plat->clock = err; in mt7620_serial_of_to_plat()
176 if (!plat->clock) in mt7620_serial_of_to_plat()
177 plat->clock = dev_read_u32_default(dev, "clock-frequency", 0); in mt7620_serial_of_to_plat()
179 if (!plat->clock) { in mt7620_serial_of_to_plat()
221 struct mt7620_serial_plat plat; in _debug_uart_init() local
223 plat.regs = (void *)CONFIG_DEBUG_UART_BASE; in _debug_uart_init()
224 plat.clock = CONFIG_DEBUG_UART_CLOCK; in _debug_uart_init()
226 writel(0, &plat.regs->ier); in _debug_uart_init()
227 writel(UART_MCRVAL, &plat.regs->mcr); in _debug_uart_init()
228 writel(UART_FCRVAL, &plat.regs->fcr); in _debug_uart_init()
230 _mt7620_serial_setbrg(&plat, CONFIG_BAUDRATE); in _debug_uart_init()