[U-Boot] [PATCH] at91: CONFIG_USART3 renamed to CONFIG_USART_DBGU
Michael Roth
mroth at nessie.de
Fri Feb 6 15:12:34 CET 2009
In reality there are only three usarts on at91 SoC and one serial
debug port called DBGU which is a reduced functionality usart.
For reasons of clarity and consistency the prefix USART is maintained
independently the fact that normally the debug port is just called DBGU.
Signed-off-by: Michael Roth <mroth at nessie.de>
---
drivers/serial/atmel_usart.c | 23 ++++++++++++++---------
include/asm-arm/arch-at91/clk.h | 5 +++++
include/asm-arm/arch-at91/memory-map.h | 8 ++++----
include/configs/afeb9260.h | 2 +-
include/configs/at91cap9adk.h | 2 +-
include/configs/at91sam9260ek.h | 2 +-
include/configs/at91sam9261ek.h | 2 +-
include/configs/at91sam9263ek.h | 2 +-
include/configs/at91sam9rlek.h | 2 +-
9 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index f3b146c..f310dcd 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -22,17 +22,22 @@
#include <asm/arch/memory-map.h>
#if defined(CONFIG_USART0)
-# define USART_ID 0
-# define USART_BASE USART0_BASE
+# define GET_USART_CLK_RATE() get_usart_clk_rate(0)
+# define USART_BASE USART0_BASE
#elif defined(CONFIG_USART1)
-# define USART_ID 1
-# define USART_BASE USART1_BASE
+# define GET_USART_CLK_RATE() get_usart_clk_rate(1)
+# define USART_BASE USART1_BASE
#elif defined(CONFIG_USART2)
-# define USART_ID 2
-# define USART_BASE USART2_BASE
+# define GET_USART_CLK_RATE() get_usart_clk_rate(2)
+# define USART_BASE USART2_BASE
#elif defined(CONFIG_USART3)
-# define USART_ID 3
-# define USART_BASE USART3_BASE
+# define GET_USART_CLK_RATE() get_usart_clk_rate(3)
+# define USART_BASE USART3_BASE
+#elif defined(CONFIG_USART_DBGU)
+# define GET_USART_CLK_RATE() get_usart_dbgu_clk_rate()
+# define USART_BASE USART_DBGU_BASE
+#else
+# error No CONFIG_USARTx defined!
#endif
#include "atmel_usart.h"
@@ -49,7 +54,7 @@ void serial_setbrg(void)
* Baud Rate = --------------
* 16 * CD
*/
- usart_hz = get_usart_clk_rate(USART_ID);
+ usart_hz = GET_USART_CLK_RATE();
divisor = (usart_hz / 16 + gd->baudrate / 2) / gd->baudrate;
usart3_writel(BRGR, USART3_BF(CD, divisor));
}
diff --git a/include/asm-arm/arch-at91/clk.h b/include/asm-arm/arch-at91/clk.h
index 1b502c8..51a90a9 100644
--- a/include/asm-arm/arch-at91/clk.h
+++ b/include/asm-arm/arch-at91/clk.h
@@ -36,6 +36,11 @@ static inline unsigned long get_usart_clk_rate(unsigned int dev_id)
return AT91_MASTER_CLOCK;
}
+static inline unsigned long get_usart_dbgu_clk_rate(void)
+{
+ return AT91_MASTER_CLOCK;
+}
+
static inline unsigned long get_lcdc_clk_rate(unsigned int dev_id)
{
return AT91_MASTER_CLOCK;
diff --git a/include/asm-arm/arch-at91/memory-map.h b/include/asm-arm/arch-at91/memory-map.h
index 8015dad..0013022 100644
--- a/include/asm-arm/arch-at91/memory-map.h
+++ b/include/asm-arm/arch-at91/memory-map.h
@@ -26,9 +26,9 @@
#include <asm/arch/hardware.h>
-#define USART0_BASE AT91_USART0
-#define USART1_BASE AT91_USART1
-#define USART2_BASE AT91_USART2
-#define USART3_BASE (AT91_BASE_SYS + AT91_DBGU)
+#define USART0_BASE AT91_USART0
+#define USART1_BASE AT91_USART1
+#define USART2_BASE AT91_USART2
+#define USART_DBGU_BASE (AT91_BASE_SYS + AT91_DBGU)
#endif /* __ASM_ARM_ARCH_MEMORYMAP_H__ */
diff --git a/include/configs/afeb9260.h b/include/configs/afeb9260.h
index 9eed342..815483a 100644
--- a/include/configs/afeb9260.h
+++ b/include/configs/afeb9260.h
@@ -52,7 +52,7 @@
#undef CONFIG_USART0
#undef CONFIG_USART1
#undef CONFIG_USART2
-#define CONFIG_USART3 1 /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU 1
#define CONFIG_BOOTDELAY 3
diff --git a/include/configs/at91cap9adk.h b/include/configs/at91cap9adk.h
index 01da99b..39d13ee 100644
--- a/include/configs/at91cap9adk.h
+++ b/include/configs/at91cap9adk.h
@@ -56,7 +56,7 @@
#undef CONFIG_USART0
#undef CONFIG_USART1
#undef CONFIG_USART2
-#define CONFIG_USART3 1 /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU 1
/* LCD */
#define CONFIG_LCD 1
diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index 2f1a41f..2b81cb0 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -56,7 +56,7 @@
#undef CONFIG_USART0
#undef CONFIG_USART1
#undef CONFIG_USART2
-#define CONFIG_USART3 1 /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU 1
#define CONFIG_BOOTDELAY 3
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index ebecfa4..3db0cca 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -55,7 +55,7 @@
#undef CONFIG_USART0
#undef CONFIG_USART1
#undef CONFIG_USART2
-#define CONFIG_USART3 1 /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU 1
/* LCD */
#define CONFIG_LCD 1
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index 09b871a..ff9ce46 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -56,7 +56,7 @@
#undef CONFIG_USART0
#undef CONFIG_USART1
#undef CONFIG_USART2
-#define CONFIG_USART3 1 /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU 1
/* LCD */
#define CONFIG_LCD 1
diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h
index 5bef1fe..b6adcb8 100644
--- a/include/configs/at91sam9rlek.h
+++ b/include/configs/at91sam9rlek.h
@@ -55,7 +55,7 @@
#undef CONFIG_USART0
#undef CONFIG_USART1
#undef CONFIG_USART2
-#define CONFIG_USART3 1 /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU 1
/* LCD */
#define CONFIG_LCD 1
--
1.6.0.6
More information about the U-Boot
mailing list