summaryrefslogtreecommitdiffstats
path: root/sys/arm/sa11x0
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/sa11x0
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/sa11x0')
-rw-r--r--sys/arm/sa11x0/uart_cpu_sa1110.c5
-rw-r--r--sys/arm/sa11x0/uart_dev_sa1110.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/sys/arm/sa11x0/uart_cpu_sa1110.c b/sys/arm/sa11x0/uart_cpu_sa1110.c
index d96dee3..5d6a3c3 100644
--- a/sys/arm/sa11x0/uart_cpu_sa1110.c
+++ b/sys/arm/sa11x0/uart_cpu_sa1110.c
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
bus_space_tag_t uart_bus_space_io;
bus_space_tag_t uart_bus_space_mem;
-extern struct uart_ops uart_sa1110_ops;
+extern struct uart_class uart_sa1110_class;
vm_offset_t sa1110_uart_vaddr;
@@ -55,7 +55,8 @@ uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
int
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
{
- di->ops = uart_sa1110_ops;
+
+ di->ops = uart_getops(&uart_sa1110_class);
di->bas.chan = 0;
di->bas.bst = &sa11x0_bs_tag;
di->bas.bsh = sa1110_uart_vaddr;
diff --git a/sys/arm/sa11x0/uart_dev_sa1110.c b/sys/arm/sa11x0/uart_dev_sa1110.c
index 0a36bca..35ff22b 100644
--- a/sys/arm/sa11x0/uart_dev_sa1110.c
+++ b/sys/arm/sa11x0/uart_dev_sa1110.c
@@ -57,7 +57,7 @@ static int sa1110_getc(struct uart_bas *bas, struct mtx *mtx);
extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
-struct uart_ops uart_sa1110_ops = {
+static struct uart_ops uart_sa1110_ops = {
.probe = sa1110_probe,
.init = sa1110_init,
.term = sa1110_term,
@@ -272,10 +272,12 @@ sa1110_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
{
return (EINVAL);
}
+
struct uart_class uart_sa1110_class = {
- "sa1110 class",
+ "sa1110",
sa1110_methods,
1,
+ .uc_ops = &uart_sa1110_ops,
.uc_range = 8,
.uc_rclk = 3686400
};
OpenPOWER on IntegriCloud