aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/uart
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2013-04-01 00:44:20 +0000
committerIan Lepore <ian@FreeBSD.org>2013-04-01 00:44:20 +0000
commit4d7abca0576b034bbe0c4ac8d723ff15d36f4323 (patch)
tree7e8822165fb7859a3446e9b064f7645e377504e3 /sys/dev/uart
parent5ea561e03a8777c14c6a8caa4b3e607dc1a41fbd (diff)
downloadsrc-4d7abca0576b034bbe0c4ac8d723ff15d36f4323.tar.gz
src-4d7abca0576b034bbe0c4ac8d723ff15d36f4323.zip
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().
Notes
Notes: svn path=/head/; revision=248965
Diffstat (limited to 'sys/dev/uart')
-rw-r--r--sys/dev/uart/uart_dev_imx.c6
-rw-r--r--sys/dev/uart/uart_dev_pl011.c6
-rw-r--r--sys/dev/uart/uart_dev_quicc.c6
-rw-r--r--sys/dev/uart/uart_dev_sab82532.c6
-rw-r--r--sys/dev/uart/uart_dev_z8530.c6
5 files changed, 15 insertions, 15 deletions
diff --git a/sys/dev/uart/uart_dev_imx.c b/sys/dev/uart/uart_dev_imx.c
index 81fe1631606d..1651a9f37eb8 100644
--- a/sys/dev/uart/uart_dev_imx.c
+++ b/sys/dev/uart/uart_dev_imx.c
@@ -187,9 +187,6 @@ imx_uart_bus_attach(struct uart_softc *sc)
imx_uart_init(bas, 115200, 8, 1, 0);
}
- sc->sc_rxfifosz = 1;
- sc->sc_txfifosz = 1;
-
(void)imx_uart_bus_getsig(sc);
/* XXX workaround to have working console on manut prompt */
@@ -353,6 +350,9 @@ imx_uart_bus_probe(struct uart_softc *sc)
if (error)
return (error);
+ sc->sc_rxfifosz = 1;
+ sc->sc_txfifosz = 1;
+
device_set_desc(sc->sc_dev, "imx_uart");
return (0);
}
diff --git a/sys/dev/uart/uart_dev_pl011.c b/sys/dev/uart/uart_dev_pl011.c
index d71ab1127eba..583dedfcc70e 100644
--- a/sys/dev/uart/uart_dev_pl011.c
+++ b/sys/dev/uart/uart_dev_pl011.c
@@ -278,9 +278,6 @@ uart_pl011_bus_attach(struct uart_softc *sc)
/* Clear RX & TX interrupts */
__uart_setreg(bas, UART_ICR, IMSC_MASK_ALL);
- sc->sc_rxfifosz = 1;
- sc->sc_txfifosz = 1;
-
return (0);
}
@@ -377,6 +374,9 @@ uart_pl011_bus_probe(struct uart_softc *sc)
device_set_desc(sc->sc_dev, "PrimeCell UART (PL011)");
+ sc->sc_rxfifosz = 1;
+ sc->sc_txfifosz = 1;
+
return (0);
}
diff --git a/sys/dev/uart/uart_dev_quicc.c b/sys/dev/uart/uart_dev_quicc.c
index df327a84a8c5..337591e8ec90 100644
--- a/sys/dev/uart/uart_dev_quicc.c
+++ b/sys/dev/uart/uart_dev_quicc.c
@@ -293,9 +293,6 @@ quicc_bus_attach(struct uart_softc *sc)
quicc_setup(bas, 9600, 8, 1, UART_PARITY_NONE);
}
- sc->sc_rxfifosz = 1;
- sc->sc_txfifosz = 1;
-
/* Enable interrupts on the receive buffer. */
rb = quicc_read2(bas, QUICC_PRAM_SCC_RBASE(bas->chan - 1));
st = quicc_read2(bas, rb);
@@ -417,6 +414,9 @@ quicc_bus_probe(struct uart_softc *sc)
if (error)
return (error);
+ sc->sc_rxfifosz = 1;
+ sc->sc_txfifosz = 1;
+
snprintf(buf, sizeof(buf), "quicc, channel %d", sc->sc_bas.chan);
device_set_desc_copy(sc->sc_dev, buf);
return (0);
diff --git a/sys/dev/uart/uart_dev_sab82532.c b/sys/dev/uart/uart_dev_sab82532.c
index 11cdb4b47387..e2ec22766eac 100644
--- a/sys/dev/uart/uart_dev_sab82532.c
+++ b/sys/dev/uart/uart_dev_sab82532.c
@@ -407,9 +407,6 @@ sab82532_bus_attach(struct uart_softc *sc)
if (sc->sc_sysdev == NULL)
sab82532_init(bas, 9600, 8, 1, UART_PARITY_NONE);
- sc->sc_rxfifosz = 32;
- sc->sc_txfifosz = 32;
-
imr0 = SAB_IMR0_TCD|SAB_IMR0_TIME|SAB_IMR0_CDSC|SAB_IMR0_RFO|
SAB_IMR0_RPF;
uart_setreg(bas, SAB_IMR0, 0xff & ~imr0);
@@ -592,6 +589,9 @@ sab82532_bus_probe(struct uart_softc *sc)
if (error)
return (error);
+ sc->sc_rxfifosz = 32;
+ sc->sc_txfifosz = 32;
+
ch = sc->sc_bas.chan - 1 + 'A';
switch (uart_getreg(&sc->sc_bas, SAB_VSTR) & SAB_VSTR_VMASK) {
diff --git a/sys/dev/uart/uart_dev_z8530.c b/sys/dev/uart/uart_dev_z8530.c
index 33bacdc98f72..f948b26fa2fa 100644
--- a/sys/dev/uart/uart_dev_z8530.c
+++ b/sys/dev/uart/uart_dev_z8530.c
@@ -332,9 +332,6 @@ z8530_bus_attach(struct uart_softc *sc)
}
z8530->txidle = 1; /* Report SER_INT_TXIDLE. */
- sc->sc_rxfifosz = 3;
- sc->sc_txfifosz = 1;
-
(void)z8530_bus_getsig(sc);
uart_setmreg(bas, WR_IC, IC_BRK | IC_CTS | IC_DCD);
@@ -515,6 +512,9 @@ z8530_bus_probe(struct uart_softc *sc)
if (error)
return (error);
+ sc->sc_rxfifosz = 3;
+ sc->sc_txfifosz = 1;
+
ch = sc->sc_bas.chan - 1 + 'A';
snprintf(buf, sizeof(buf), "z8530, channel %c", ch);