summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-06-20 10:33:33 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-06-20 10:33:33 -0600
commitc93bc6dc271027672de7e0e33fd3cb1ceb9da569 (patch)
treedffe270fed4ecab9fbce16388145156f511ee84a /nuttx/arch
parent8159b97c7f3d8ddf8662d71026858131ca85a228 (diff)
downloadpx4-nuttx-c93bc6dc271027672de7e0e33fd3cb1ceb9da569.tar.gz
px4-nuttx-c93bc6dc271027672de7e0e33fd3cb1ceb9da569.tar.bz2
px4-nuttx-c93bc6dc271027672de7e0e33fd3cb1ceb9da569.zip
SAMA5D4-EK: Make sure that the H32MX divider is set; correct sense of bit driver red LED
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/src/sama5/sam_clockconfig.c40
-rw-r--r--nuttx/arch/arm/src/sama5/sam_irq.c5
2 files changed, 42 insertions, 3 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_clockconfig.c b/nuttx/arch/arm/src/sama5/sam_clockconfig.c
index 2c5fa7d0e..cfcb965ea 100644
--- a/nuttx/arch/arm/src/sama5/sam_clockconfig.c
+++ b/nuttx/arch/arm/src/sama5/sam_clockconfig.c
@@ -351,6 +351,42 @@ static inline void __ramfunc__ sam_mckdivider(void)
#endif
/****************************************************************************
+ * Name: sam_h32mxdivider
+ *
+ * Description:
+ * Set the H32MX divider.
+ *
+ * 0: The AHB 32-bit Matrix frequency is equal to the AHB 64-bit Matrix
+ * frequency. It is possible only if the AHB 64-bit Matrix frequency
+ * does not exceed 90 MHz.
+ * 1: H32MXDIV2 The AHB 32-bit Matrix frequency is equal to the AHB 64-bit
+ * Matrix frequency divided by 2.
+ *
+ ****************************************************************************/
+
+#ifdef PMC_MCKR_H32MXDIV
+static inline void __ramfunc__ sam_h32mxdivider(void)
+{
+ uint32_t regval;
+
+ regval = getreg32(SAM_PMC_MCKR);
+
+ /* Check the 64-bit Matrix frequency (MCK, right?) */
+
+ if (BOARD_MCK_FREQUENCY <= 90000000)
+ {
+ regval &= ~PMC_MCKR_H32MXDIV;
+ }
+ else
+ {
+ regval |= PMC_MCKR_H32MXDIV;
+ }
+
+ putreg32(regval, SAM_PMC_MCKR);
+}
+#endif
+
+/****************************************************************************
* Name: sam_selectplla
*
* Description:
@@ -654,6 +690,10 @@ void __ramfunc__ sam_clockconfig(void)
sam_mckdivider();
+ /* Configure the H32MX Divider */
+
+ sam_h32mxdivider();
+
/* Finally, elect the PLLA output as the input clock for PCK and MCK. */
sam_selectplla();
diff --git a/nuttx/arch/arm/src/sama5/sam_irq.c b/nuttx/arch/arm/src/sama5/sam_irq.c
index ad4e1e5c9..ca7d63987 100644
--- a/nuttx/arch/arm/src/sama5/sam_irq.c
+++ b/nuttx/arch/arm/src/sama5/sam_irq.c
@@ -91,7 +91,7 @@ extern uint32_t _vector_end; /* End+1 of vector block */
static const uint8_t g_srctype[SCRTYPE_NTYPES] =
{
- 0, 0, 1, 1, 2, 3
+ 0, 0, 1, 1, 2, 3
};
/****************************************************************************
@@ -494,7 +494,7 @@ uint32_t *arm_decodeirq(uint32_t *regs)
ivr = getreg32(SAM_AIC_IVR);
putreg32(ivr, SAM_AIC_IVR);
- /* Get the IRQ number from the interrrupt status register. NOTE that the
+ /* Get the IRQ number from the interrupt status register. NOTE that the
* IRQ number is the same is the peripheral ID (PID).
*/
@@ -691,4 +691,3 @@ void sam_irq_srctype(int irq, enum sam_srctype_e srctype)
sam_dumpaic("srctype", irq);
irqrestore(flags);
}
-