-/* $OpenBSD: exuart.c,v 1.6 2021/02/14 13:39:24 kettenis Exp $ */
+/* $OpenBSD: exuart.c,v 1.7 2021/02/16 21:58:14 kettenis Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@motorola.com>
*
struct fdt_reg reg;
void *node, *root;
- if ((node = fdt_find_cons("samsung,exynos4210-uart")) == NULL)
+ if ((node = fdt_find_cons("apple,s5l-uart")) == NULL &&
+ (node = fdt_find_cons("samsung,exynos4210-uart")) == NULL)
return;
/* dtb uses serial2, qemu uses serial0 */
if (fdt_get_reg(node, 0, ®))
return;
- exuart_rx_fifo_cnt_mask = EXUART_UFSTAT_RX_FIFO_CNT_MASK;
- exuart_rx_fifo_full = EXUART_UFSTAT_RX_FIFO_FULL;
- exuart_tx_fifo_full = EXUART_UFSTAT_TX_FIFO_FULL;
+ if (fdt_is_compatible(node, "apple,s5l-uart")) {
+ exuart_rx_fifo_cnt_mask = EXUART_S5L_UFSTAT_RX_FIFO_CNT_MASK;
+ exuart_rx_fifo_full = EXUART_S5L_UFSTAT_RX_FIFO_FULL;
+ exuart_tx_fifo_full = EXUART_S5L_UFSTAT_TX_FIFO_FULL;
+ } else {
+ exuart_rx_fifo_cnt_mask = EXUART_UFSTAT_RX_FIFO_CNT_MASK;
+ exuart_rx_fifo_full = EXUART_UFSTAT_RX_FIFO_FULL;
+ exuart_tx_fifo_full = EXUART_UFSTAT_TX_FIFO_FULL;
+ }
exuartcnattach(fdt_cons_bs_tag, reg.addr, B115200, TTYDEF_CFLAG);
}
{
struct fdt_attach_args *faa = aux;
- return OF_is_compatible(faa->fa_node, "samsung,exynos4210-uart");
+ return (OF_is_compatible(faa->fa_node, "apple,s5l-uart") ||
+ OF_is_compatible(faa->fa_node, "samsung,exynos4210-uart"));
}
void
printf(": console");
}
- sc->sc_rx_fifo_cnt_mask = EXUART_UFSTAT_RX_FIFO_CNT_MASK;
- sc->sc_rx_fifo_full = EXUART_UFSTAT_RX_FIFO_FULL;
- sc->sc_tx_fifo_full = EXUART_UFSTAT_TX_FIFO_FULL;
+ if (OF_is_compatible(faa->fa_node, "apple,s5l-uart")) {
+ sc->sc_rx_fifo_cnt_mask = EXUART_S5L_UFSTAT_RX_FIFO_CNT_MASK;
+ sc->sc_rx_fifo_full = EXUART_S5L_UFSTAT_RX_FIFO_FULL;
+ sc->sc_tx_fifo_full = EXUART_S5L_UFSTAT_TX_FIFO_FULL;
+ } else {
+ sc->sc_rx_fifo_cnt_mask = EXUART_UFSTAT_RX_FIFO_CNT_MASK;
+ sc->sc_rx_fifo_full = EXUART_UFSTAT_RX_FIFO_FULL;
+ sc->sc_tx_fifo_full = EXUART_UFSTAT_TX_FIFO_FULL;
+ }
/* Mask and clear interrupts. */
bus_space_write_4(sc->sc_iot, sc->sc_ioh, EXUART_UINTM,
-/* $OpenBSD: exuartreg.h,v 1.2 2021/02/05 00:25:19 patrick Exp $ */
+/* $OpenBSD: exuartreg.h,v 1.3 2021/02/16 21:58:14 kettenis Exp $ */
/*
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
*
#define EXUART_UFSTAT_TX_FIFO_CNT(x) (((x) >> 16) & 0xff) /* 0 when full */
#define EXUART_UFSTAT_TX_FIFO_CNT_MASK (0xff << 16) /* 0 when full */
#define EXUART_UFSTAT_TX_FIFO_FULL (0x1 << 24)
+#define EXUART_S5L_UFSTAT_RX_FIFO_CNT(x) (((x) >> 0) & 0xf) /* 0 when full */
+#define EXUART_S5L_UFSTAT_RX_FIFO_CNT_MASK (0xf << 0) /* 0 when full */
+#define EXUART_S5L_UFSTAT_RX_FIFO_FULL (0x1 << 8)
+#define EXUART_S5L_UFSTAT_TX_FIFO_CNT(x) (((x) >> 4) & 0xf) /* 0 when full */
+#define EXUART_S5L_UFSTAT_TX_FIFO_CNT_MASK (0xf << 4) /* 0 when full */
+#define EXUART_S5L_UFSTAT_TX_FIFO_FULL (0x1 << 9)
#define EXUART_UMSTAT 0x1c
#define EXUART_UMSTAT_CTS (0x1 << 0)
#define EXUART_UMSTAT_DELTA_CTS (0x1 << 4)