summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2007-04-02 22:00:22 +0000
committermarcel <marcel@FreeBSD.org>2007-04-02 22:00:22 +0000
commitf30daf4b49b0b9e3c8eeb46082244bf7a7f354ae (patch)
treeb3ad51f3cb65c3badfb015aea4f71d800157abb8 /sys/arm/at91
parent5f0f57215ba83757397d27e8dcc686612e48e921 (diff)
downloadFreeBSD-src-f30daf4b49b0b9e3c8eeb46082244bf7a7f354ae.zip
FreeBSD-src-f30daf4b49b0b9e3c8eeb46082244bf7a7f354ae.tar.gz
Don't expose the uart_ops structure directly, but instead have
it obtained through the uart_class structure. This allows us to declare the uart_class structure as weak and as such allows us to reference it even when it's not compiled-in. It also allows is to get the uart_ops structure by name, which makes it possible to implement the dt tag handling in uart_getenv(). The side-effect of all this is that we're using the uart_class structure more consistently which means that we now also have access to the size of the bus space block needed by the hardware when we map the bus space, eliminating any hardcoding.
Diffstat (limited to 'sys/arm/at91')
-rw-r--r--sys/arm/at91/uart_cpu_at91rm9200usart.c11
-rw-r--r--sys/arm/at91/uart_dev_at91usart.c6
2 files changed, 10 insertions, 7 deletions
diff --git a/sys/arm/at91/uart_cpu_at91rm9200usart.c b/sys/arm/at91/uart_cpu_at91rm9200usart.c
index 75a053d..459badb 100644
--- a/sys/arm/at91/uart_cpu_at91rm9200usart.c
+++ b/sys/arm/at91/uart_cpu_at91rm9200usart.c
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
bus_space_tag_t uart_bus_space_io;
bus_space_tag_t uart_bus_space_mem;
-extern struct uart_ops at91_usart_ops;
+extern struct uart_class at91_usart_class;
extern struct bus_space at91_bs_tag;
int
@@ -55,7 +55,10 @@ uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
int
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
{
- di->ops = at91_usart_ops;
+ struct uart_class *class;
+
+ class = &at91_usart_class;
+ di->ops = uart_getops(class);
di->bas.chan = 0;
di->bas.bst = &at91_bs_tag;
/*
@@ -77,7 +80,5 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
uart_bus_space_io = &at91_bs_tag;
uart_bus_space_mem = NULL;
/* Check the environment for overrides */
- if (uart_getenv(devtype, di) == 0)
- return (0);
- return (0);
+ return (uart_getenv(devtype, di, class));
}
diff --git a/sys/arm/at91/uart_dev_at91usart.c b/sys/arm/at91/uart_dev_at91usart.c
index a405aa3..8862589 100644
--- a/sys/arm/at91/uart_dev_at91usart.c
+++ b/sys/arm/at91/uart_dev_at91usart.c
@@ -196,7 +196,7 @@ at91_usart_param(struct uart_bas *bas, int baudrate, int databits,
return (0);
}
-struct uart_ops at91_usart_ops = {
+static struct uart_ops at91_usart_ops = {
.probe = at91_usart_probe,
.init = at91_usart_init,
.term = at91_usart_term,
@@ -662,10 +662,12 @@ at91_usart_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
}
return (EINVAL);
}
+
struct uart_class at91_usart_class = {
- "at91_usart class",
+ "at91_usart",
at91_usart_methods,
sizeof(struct at91_usart_softc),
+ .uc_ops = &at91_usart_ops,
.uc_range = 8,
.uc_rclk = DEFAULT_RCLK
};
OpenPOWER on IntegriCloud