summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-06-20 11:40:36 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-06-20 11:40:36 -0600
commit302fc87b5fdab3e0cf001be9a610d6655607e9a7 (patch)
tree562aa8a981694368773669189adc172d9cee2322
parent917edabee07b8edd78c4ca0d4d932ad7bc893d13 (diff)
downloadnuttx-302fc87b5fdab3e0cf001be9a610d6655607e9a7.tar.gz
nuttx-302fc87b5fdab3e0cf001be9a610d6655607e9a7.tar.bz2
nuttx-302fc87b5fdab3e0cf001be9a610d6655607e9a7.zip
SAMA5D4: USART peripheral clock appears to be MCK/2
-rw-r--r--nuttx/arch/arm/src/sama5/sam_lowputc.c6
-rw-r--r--nuttx/arch/arm/src/sama5/sam_serial.c6
-rw-r--r--nuttx/configs/sama5d3-xplained/include/board_384mhz.h6
-rw-r--r--nuttx/configs/sama5d3-xplained/include/board_396mhz.h6
-rw-r--r--nuttx/configs/sama5d3-xplained/include/board_528mhz.h6
-rw-r--r--nuttx/configs/sama5d3-xplained/include/board_sdram.h6
-rw-r--r--nuttx/configs/sama5d3x-ek/include/board_384mhz.h6
-rw-r--r--nuttx/configs/sama5d3x-ek/include/board_396mhz.h6
-rw-r--r--nuttx/configs/sama5d3x-ek/include/board_528mhz.h5
-rw-r--r--nuttx/configs/sama5d3x-ek/include/board_sdram.h6
-rw-r--r--nuttx/configs/sama5d4-ek/include/board_384mhz.h7
-rw-r--r--nuttx/configs/sama5d4-ek/include/board_396mhz.h7
-rw-r--r--nuttx/configs/sama5d4-ek/include/board_528mhz.h7
-rw-r--r--nuttx/configs/sama5d4-ek/include/board_sdram.h7
14 files changed, 81 insertions, 6 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_lowputc.c b/nuttx/arch/arm/src/sama5/sam_lowputc.c
index 6931c6cee..2685335ca 100644
--- a/nuttx/arch/arm/src/sama5/sam_lowputc.c
+++ b/nuttx/arch/arm/src/sama5/sam_lowputc.c
@@ -149,10 +149,10 @@
# undef HAVE_UART_CONSOLE
#endif
-/* The UART/USART modules are driven by the main clock (MCK). */
+/* The UART/USART modules are driven by the peripheral clock (MCK or MCK2). */
-#define SAM_USART_CLOCK BOARD_MCK_FREQUENCY /* Frequency of the main clock */
-#define SAM_MR_USCLKS UART_MR_USCLKS_MCK /* Source = Main clock */
+#define SAM_USART_CLOCK BOARD_USART_FREQUENCY /* Frequency of the USART clock */
+#define SAM_MR_USCLKS UART_MR_USCLKS_MCK /* Source = Main clock */
/* Select USART parameters for the selected console */
diff --git a/nuttx/arch/arm/src/sama5/sam_serial.c b/nuttx/arch/arm/src/sama5/sam_serial.c
index 8dcc05bdb..479caf5b0 100644
--- a/nuttx/arch/arm/src/sama5/sam_serial.c
+++ b/nuttx/arch/arm/src/sama5/sam_serial.c
@@ -382,10 +382,10 @@
# define USART4_ASSIGNED 1
#endif
-/* The UART/USART modules are driven by the main clock (MCK). */
+/* The UART/USART modules are driven by the peripheral clock (MCK or MCK2). */
-#define SAM_USART_CLOCK BOARD_MCK_FREQUENCY /* Frequency of the main clock */
-#define SAM_MR_USCLKS UART_MR_USCLKS_MCK /* Source = Main clock */
+#define SAM_USART_CLOCK BOARD_USART_FREQUENCY /* Frequency of the USART clock */
+#define SAM_MR_USCLKS UART_MR_USCLKS_MCK /* Source = Main clock */
/****************************************************************************
* Private Types
diff --git a/nuttx/configs/sama5d3-xplained/include/board_384mhz.h b/nuttx/configs/sama5d3-xplained/include/board_384mhz.h
index 75b416777..f9d38fba3 100644
--- a/nuttx/configs/sama5d3-xplained/include/board_384mhz.h
+++ b/nuttx/configs/sama5d3-xplained/include/board_384mhz.h
@@ -167,6 +167,12 @@
#define BOARD_MCK_FREQUENCY (128000000) /* MCK: PLLACK / 2 / 1 / 3 */
#define BOARD_ADCCLK_FREQUENCY (8000000) /* ADCCLK: MCK / ((7+1)*2) */
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
+
/* HSMCI clocking
*
* Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
diff --git a/nuttx/configs/sama5d3-xplained/include/board_396mhz.h b/nuttx/configs/sama5d3-xplained/include/board_396mhz.h
index a16190a0b..7293956a5 100644
--- a/nuttx/configs/sama5d3-xplained/include/board_396mhz.h
+++ b/nuttx/configs/sama5d3-xplained/include/board_396mhz.h
@@ -125,6 +125,12 @@
#define BOARD_MCK_FREQUENCY (132000000) /* MCK: PLLACK / 2 / 1 / 3 */
#define BOARD_ADCCLK_FREQUENCY (8250000) /* ADCCLK: MCK / ((7+1)*2) */
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d3-xplained/include/board_528mhz.h b/nuttx/configs/sama5d3-xplained/include/board_528mhz.h
index ff1b88ca6..dc857bee4 100644
--- a/nuttx/configs/sama5d3-xplained/include/board_528mhz.h
+++ b/nuttx/configs/sama5d3-xplained/include/board_528mhz.h
@@ -124,6 +124,12 @@
#define BOARD_MCK_FREQUENCY (132000000) /* MCK: PLLACK / 1 / 1 / 4 */
#define BOARD_ADCCLK_FREQUENCY (8250000) /* ADCCLK: MCK / ((7+1)*2) */
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d3-xplained/include/board_sdram.h b/nuttx/configs/sama5d3-xplained/include/board_sdram.h
index 61d25155b..4f2e5f971 100644
--- a/nuttx/configs/sama5d3-xplained/include/board_sdram.h
+++ b/nuttx/configs/sama5d3-xplained/include/board_sdram.h
@@ -63,6 +63,12 @@
#define BOARD_PCK_FREQUENCY (sam_pck_frequency(BOARD_MAINOSC_FREQUENCY))
#define BOARD_MCK_FREQUENCY (sam_mck_frequency(BOARD_MAINOSC_FREQUENCY))
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d3x-ek/include/board_384mhz.h b/nuttx/configs/sama5d3x-ek/include/board_384mhz.h
index 3dee82044..528ff509a 100644
--- a/nuttx/configs/sama5d3x-ek/include/board_384mhz.h
+++ b/nuttx/configs/sama5d3x-ek/include/board_384mhz.h
@@ -167,6 +167,12 @@
#define BOARD_MCK_FREQUENCY (128000000) /* MCK: PLLACK / 2 / 1 / 3 */
#define BOARD_ADCCLK_FREQUENCY (8000000) /* ADCCLK: MCK / ((7+1)*2) */
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
+
/* HSMCI clocking
*
* Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
diff --git a/nuttx/configs/sama5d3x-ek/include/board_396mhz.h b/nuttx/configs/sama5d3x-ek/include/board_396mhz.h
index 707ffd878..ef850fda8 100644
--- a/nuttx/configs/sama5d3x-ek/include/board_396mhz.h
+++ b/nuttx/configs/sama5d3x-ek/include/board_396mhz.h
@@ -125,6 +125,12 @@
#define BOARD_MCK_FREQUENCY (132000000) /* MCK: PLLACK / 2 / 1 / 3 */
#define BOARD_ADCCLK_FREQUENCY (8250000) /* ADCCLK: MCK / ((7+1)*2) */
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d3x-ek/include/board_528mhz.h b/nuttx/configs/sama5d3x-ek/include/board_528mhz.h
index 4f79ecd4a..0b2744030 100644
--- a/nuttx/configs/sama5d3x-ek/include/board_528mhz.h
+++ b/nuttx/configs/sama5d3x-ek/include/board_528mhz.h
@@ -124,6 +124,11 @@
#define BOARD_MCK_FREQUENCY (132000000) /* MCK: PLLACK / 1 / 1 / 4 */
#define BOARD_ADCCLK_FREQUENCY (8250000) /* ADCCLK: MCK / ((7+1)*2) */
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d3x-ek/include/board_sdram.h b/nuttx/configs/sama5d3x-ek/include/board_sdram.h
index f7e8b8015..9e4b60469 100644
--- a/nuttx/configs/sama5d3x-ek/include/board_sdram.h
+++ b/nuttx/configs/sama5d3x-ek/include/board_sdram.h
@@ -63,6 +63,12 @@
#define BOARD_PCK_FREQUENCY (sam_pck_frequency(BOARD_MAINOSC_FREQUENCY))
#define BOARD_MCK_FREQUENCY (sam_mck_frequency(BOARD_MAINOSC_FREQUENCY))
+/* On some SAMA5's, the clocking to peripherals may be divided down from MCK,
+ * but not for the SAMA5D3.
+ */
+
+#define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d4-ek/include/board_384mhz.h b/nuttx/configs/sama5d4-ek/include/board_384mhz.h
index 878c82222..fc2d4e4bc 100644
--- a/nuttx/configs/sama5d4-ek/include/board_384mhz.h
+++ b/nuttx/configs/sama5d4-ek/include/board_384mhz.h
@@ -165,6 +165,13 @@
#define BOARD_MCK_FREQUENCY (128000000) /* MCK: PLLACK / 2 / 1 / 3 */
#define BOARD_ADCCLK_FREQUENCY (8000000) /* ADCCLK: MCK / ((7+1)*2) */
+/* Clocking to certain peripherals may be MCK/2.
+ *
+ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV?
+ */
+
+#define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1)
+
/* HSMCI clocking
*
* Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
diff --git a/nuttx/configs/sama5d4-ek/include/board_396mhz.h b/nuttx/configs/sama5d4-ek/include/board_396mhz.h
index a20527403..11af935ed 100644
--- a/nuttx/configs/sama5d4-ek/include/board_396mhz.h
+++ b/nuttx/configs/sama5d4-ek/include/board_396mhz.h
@@ -123,6 +123,13 @@
#define BOARD_MCK_FREQUENCY (132000000) /* MCK: PLLACK / 2 / 1 / 3 */
#define BOARD_ADCCLK_FREQUENCY (8250000) /* ADCCLK: MCK / ((7+1)*2) */
+/* Clocking to certain peripherals may be MCK/2.
+ *
+ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV?
+ */
+
+#define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1)
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d4-ek/include/board_528mhz.h b/nuttx/configs/sama5d4-ek/include/board_528mhz.h
index 446a480ab..aa6a336e8 100644
--- a/nuttx/configs/sama5d4-ek/include/board_528mhz.h
+++ b/nuttx/configs/sama5d4-ek/include/board_528mhz.h
@@ -122,6 +122,13 @@
#define BOARD_MCK_FREQUENCY (132000000) /* MCK: PLLACK / 1 / 1 / 4 */
#define BOARD_ADCCLK_FREQUENCY (8250000) /* ADCCLK: MCK / ((7+1)*2) */
+/* Clocking to certain peripherals may be MCK/2.
+ *
+ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV?
+ */
+
+#define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1)
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)
diff --git a/nuttx/configs/sama5d4-ek/include/board_sdram.h b/nuttx/configs/sama5d4-ek/include/board_sdram.h
index 338c03818..5b113d17e 100644
--- a/nuttx/configs/sama5d4-ek/include/board_sdram.h
+++ b/nuttx/configs/sama5d4-ek/include/board_sdram.h
@@ -63,6 +63,13 @@
#define BOARD_PCK_FREQUENCY (sam_pck_frequency(BOARD_MAINOSC_FREQUENCY))
#define BOARD_MCK_FREQUENCY (sam_mck_frequency(BOARD_MAINOSC_FREQUENCY))
+/* Clocking to certain peripherals may be MCK/2.
+ *
+ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV?
+ */
+
+#define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1)
+
#if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \
defined(CONFIG_SAMA5_UDPHS)