From 5b38501da66ed672b34922190744d3b78ac38915 Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 1 Apr 2013 00:44:20 +0000 Subject: Fix low-level uart drivers that set their fifo sizes in the softc too late. uart(4) allocates send and receiver buffers in attach() before it calls the low-level driver's attach routine. Many low-level drivers set the fifo sizes in their attach routine, which is too late. Other drivers set them in the probe() routine, so that they're available when uart(4) allocates buffers. This fixes the ones that were setting the values too late by moving the code to probe(). --- sys/arm/s3c2xx0/uart_dev_s3c2410.c | 18 +++++++++--------- sys/arm/sa11x0/uart_dev_sa1110.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sys/arm') diff --git a/sys/arm/s3c2xx0/uart_dev_s3c2410.c b/sys/arm/s3c2xx0/uart_dev_s3c2410.c index 9bd9c4b..0f9f798 100644 --- a/sys/arm/s3c2xx0/uart_dev_s3c2410.c +++ b/sys/arm/s3c2xx0/uart_dev_s3c2410.c @@ -233,14 +233,6 @@ static kobj_method_t s3c2410_methods[] = { int s3c2410_bus_probe(struct uart_softc *sc) { - return (0); -} - -static int -s3c2410_bus_attach(struct uart_softc *sc) -{ - uintptr_t irq; - switch(s3c2xx0_softc->sc_cpu) { case CPU_S3C2410: sc->sc_txfifosz = 16; @@ -253,7 +245,15 @@ s3c2410_bus_attach(struct uart_softc *sc) default: return (ENXIO); } - + + return (0); +} + +static int +s3c2410_bus_attach(struct uart_softc *sc) +{ + uintptr_t irq; + sc->sc_hwiflow = 0; sc->sc_hwoflow = 0; diff --git a/sys/arm/sa11x0/uart_dev_sa1110.c b/sys/arm/sa11x0/uart_dev_sa1110.c index 59a1290..6765cf2 100644 --- a/sys/arm/sa11x0/uart_dev_sa1110.c +++ b/sys/arm/sa11x0/uart_dev_sa1110.c @@ -156,6 +156,8 @@ static kobj_method_t sa1110_methods[] = { int sa1110_bus_probe(struct uart_softc *sc) { + sc->sc_txfifosz = 3; + sc->sc_rxfifosz = 1; return (0); } @@ -164,8 +166,6 @@ sa1110_bus_attach(struct uart_softc *sc) { bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas)); - sc->sc_txfifosz = 3; - sc->sc_rxfifosz = 1; sc->sc_hwiflow = 0; uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE); return (0); -- cgit v1.1