From 5999bbbf41bf195c8cba32e335a553f8bc5a143a Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 22 Jan 2009 21:56:41 +0000 Subject: [PATCH] Migrate towards using at91_master_clock. Initialize the clocks for the serial port class when we set the devclass since it is now no-longer a compile time constant. Eliminate the pci include, as it isn't relevant or necessary. --- sys/arm/at91/uart_bus_at91usart.c | 5 +++-- sys/arm/at91/uart_cpu_at91rm9200usart.c | 6 ++++++ sys/arm/at91/uart_dev_at91usart.c | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/arm/at91/uart_bus_at91usart.c b/sys/arm/at91/uart_bus_at91usart.c index 44a5b76b684f..aa246cbb3800 100644 --- a/sys/arm/at91/uart_bus_at91usart.c +++ b/sys/arm/at91/uart_bus_at91usart.c @@ -38,13 +38,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include #include +#include #include "uart_if.h" @@ -103,6 +102,8 @@ usart_at91rm92_probe(device_t dev) break; } sc->sc_class = &at91_usart_class; + if (sc->sc_class->uc_rclk == 0) + sc->sc_class->uc_rclk = at91_master_clock; return (uart_bus_probe(dev, 0, 0, 0, device_get_unit(dev))); } diff --git a/sys/arm/at91/uart_cpu_at91rm9200usart.c b/sys/arm/at91/uart_cpu_at91rm9200usart.c index 78c84e885523..d290c284f059 100644 --- a/sys/arm/at91/uart_cpu_at91rm9200usart.c +++ b/sys/arm/at91/uart_cpu_at91rm9200usart.c @@ -35,12 +35,16 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include +#include #include #include +#include bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; @@ -60,6 +64,8 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) struct uart_class *class; class = &at91_usart_class; + if (class->uc_rclk == 0) + class->uc_rclk = at91_master_clock; di->ops = uart_getops(class); di->bas.chan = 0; di->bas.bst = &at91_bs_tag; diff --git a/sys/arm/at91/uart_dev_at91usart.c b/sys/arm/at91/uart_dev_at91usart.c index 526b82d595b0..0f50fb42612e 100644 --- a/sys/arm/at91/uart_dev_at91usart.c +++ b/sys/arm/at91/uart_dev_at91usart.c @@ -45,10 +45,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "uart_if.h" -#define DEFAULT_RCLK AT91C_MASTER_CLOCK +#define DEFAULT_RCLK at91_master_clock #define USART_BUFFER_SIZE 128 /* @@ -684,6 +685,5 @@ struct uart_class at91_usart_class = { at91_usart_methods, sizeof(struct at91_usart_softc), .uc_ops = &at91_usart_ops, - .uc_range = 8, - .uc_rclk = DEFAULT_RCLK + .uc_range = 8 };