Module Name: src
Committed By: tnn
Date: Fri Jul 30 12:46:46 UTC 2021
Modified Files:
src/sys/arch/arm/sunxi: sunxi_platform.c
src/sys/dev/ic: com.c
Log Message:
com(4): fix FIFO for DW_APB on Allwinner A20 (got broken by com.c 1.360)
Older DesignWare UARTs do not advertise their FIFO length so we must
provide it via device properties.
To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/sunxi/sunxi_platform.c
cvs rdiff -u -r1.363 -r1.364 src/sys/dev/ic/com.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/sunxi/sunxi_platform.c
diff -u src/sys/arch/arm/sunxi/sunxi_platform.c:1.43 src/sys/arch/arm/sunxi/sunxi_platform.c:1.44
--- src/sys/arch/arm/sunxi/sunxi_platform.c:1.43 Sat Apr 24 23:36:28 2021
+++ src/sys/arch/arm/sunxi/sunxi_platform.c Fri Jul 30 12:46:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.43 2021/04/24 23:36:28 thorpej Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <[email protected]>
@@ -31,7 +31,7 @@
#include "opt_console.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.43 2021/04/24 23:36:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -238,6 +238,15 @@ sunxi_platform_device_register(device_t
if (val)
prop_dictionary_set_bool(prop, "nomodeset", true);
}
+
+ if (device_is_a(self, "com")) {
+ static const struct device_compatible_entry compat_data[] = {
+ { .compat = "allwinner,sun7i-a20" },
+ DEVICE_COMPAT_EOL
+ };
+ if (of_compatible_match(OF_finddevice("/"), compat_data))
+ prop_dictionary_set_uint(prop, "fifolen", 64);
+ }
}
static u_int
Index: src/sys/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.363 src/sys/dev/ic/com.c:1.364
--- src/sys/dev/ic/com.c:1.363 Thu Mar 25 05:34:49 2021
+++ src/sys/dev/ic/com.c Fri Jul 30 12:46:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.363 2021/03/25 05:34:49 rin Exp $ */
+/* $NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.363 2021/03/25 05:34:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -541,7 +541,8 @@ com_attach_subr(struct com_softc *sc)
case COM_TYPE_DW_APB:
cpr = bus_space_read_4(sc->sc_regs.cr_iot, sc->sc_regs.cr_ioh,
DW_APB_UART_CPR);
- sc->sc_fifolen = __SHIFTOUT(cpr, UART_CPR_FIFO_MODE) * 16;
+ if (!prop_dictionary_get_uint(dict, "fifolen", &sc->sc_fifolen))
+ sc->sc_fifolen = __SHIFTOUT(cpr, UART_CPR_FIFO_MODE) * 16;
if (sc->sc_fifolen == 0) {
sc->sc_fifolen = 1;
fifo_msg = "DesignWare APB UART, no fifo";