/* * This hardware is similar to 8250, but its register map is a bit different: * - MMIO32 (regshift = 2) * - FCR is not at 2, but 3 * - LCR and MCR are not at 3 and 4, they share 4 * - No SCR (Instead, CHAR can be used as a scratch register) * - Divisor latch at 9, no divisor latch access bit
*/
/* * The register map is slightly different from that of 8250. * IO callbacks must be overridden for correct access to FCR, LCR, MCR and SCR.
*/ static u32 uniphier_serial_in(struct uart_port *p, unsignedint offset)
{ unsignedint valshift = 0;
switch (offset) { case UART_SCR: /* No SCR for this hardware. Use CHAR as a scratch register */
valshift = 8;
offset = UNIPHIER_UART_CHAR_FCR; break; case UART_LCR:
valshift = 8;
fallthrough; case UART_MCR:
offset = UNIPHIER_UART_LCR_MCR; break; default:
offset <<= UNIPHIER_UART_REGSHIFT; break;
}
/* * The return value must be masked with 0xff because some registers * share the same offset that must be accessed by 32-bit write/read. * 8 or 16 bit access to this hardware result in unexpected behavior.
*/ return (readl(p->membase + offset) >> valshift) & 0xff;
}
switch (offset) { case UART_SCR: /* No SCR for this hardware. Use CHAR as a scratch register */
valshift = 8;
fallthrough; case UART_FCR:
offset = UNIPHIER_UART_CHAR_FCR; break; case UART_LCR:
valshift = 8; /* Divisor latch access bit does not exist. */
value &= ~UART_LCR_DLAB;
fallthrough; case UART_MCR:
offset = UNIPHIER_UART_LCR_MCR; break; default:
offset <<= UNIPHIER_UART_REGSHIFT;
normal = true; break;
}
if (normal) {
writel(value, p->membase + offset);
} else { /* * Special case: two registers share the same address that * must be 32-bit accessed. As this is not longer atomic safe, * take a lock just in case.
*/ struct uniphier8250_priv *priv = p->private_data; unsignedlong flags;
u32 tmp;
/* * This hardware does not have the divisor latch access bit. * The divisor latch register exists at different address. * Override dl_read/write callbacks.
*/ static u32 uniphier_serial_dl_read(struct uart_8250_port *up)
{ return readl(up->port.membase + UNIPHIER_UART_DLR);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.