summaryrefslogtreecommitdiff
path: root/nuttx/configs/sama5d3x-ek
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-11 14:29:43 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-11 14:29:43 -0600
commitc3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5 (patch)
tree34548c82d1e28ee44f0738985eef5ad5494dc748 /nuttx/configs/sama5d3x-ek
parent65a029c74614adbfaba41ef0192c7e03d993ff30 (diff)
downloadpx4-nuttx-c3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5.tar.gz
px4-nuttx-c3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5.tar.bz2
px4-nuttx-c3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5.zip
SAMA5: Enable the 32.768 crystal if SCHED_TICKLESS is selected
Diffstat (limited to 'nuttx/configs/sama5d3x-ek')
-rw-r--r--nuttx/configs/sama5d3x-ek/Kconfig6
-rw-r--r--nuttx/configs/sama5d3x-ek/README.txt3
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sam_boot.c9
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sam_wm8904.c6
4 files changed, 19 insertions, 5 deletions
diff --git a/nuttx/configs/sama5d3x-ek/Kconfig b/nuttx/configs/sama5d3x-ek/Kconfig
index 8c7bcb84e..5444cd2d5 100644
--- a/nuttx/configs/sama5d3x-ek/Kconfig
+++ b/nuttx/configs/sama5d3x-ek/Kconfig
@@ -248,6 +248,11 @@ config SAMA5D3xEK_OV2640_DEMO
endif # VIDEO_OV2640
+config SAMA5D3xEK_SLOWCLOCK
+ bool
+ default y if SCHED_TICKLESS
+ default n if !SCHED_TICKLESS
+
if AUDIO_WM8904
config SAMA5D3xEK_WM8904_I2CFREQUENCY
@@ -266,6 +271,7 @@ choice
config SAMA5D3xEK_WM8904_SRCMAIN
bool "Main Clock (12MHz)"
+ select SAMA5D3xEK_SLOWCLOCK
config SAMA5D3xEK_WM8904_SRCSCK
bool "Slow XTAL (32.768KHz)"
diff --git a/nuttx/configs/sama5d3x-ek/README.txt b/nuttx/configs/sama5d3x-ek/README.txt
index f3c6fa7d1..3b4de458f 100644
--- a/nuttx/configs/sama5d3x-ek/README.txt
+++ b/nuttx/configs/sama5d3x-ek/README.txt
@@ -2708,7 +2708,8 @@ Tickless OS
NOTE: In most cases, the slow clock will be used as the timer/counter
input. You should enable the 32.768KHz crystal for the slow clock by
calling sam_sckc_enable(). Otherwise, you will be doing all system
- timing using the RC clock!
+ timing using the RC clock! UPDATE: This will now be selected by default
+ when you configure for TICKLESS support.
SAMA5 Timer Usage
-----------------
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_boot.c b/nuttx/configs/sama5d3x-ek/src/sam_boot.c
index fc28ecd53..42e2f9012 100644
--- a/nuttx/configs/sama5d3x-ek/src/sam_boot.c
+++ b/nuttx/configs/sama5d3x-ek/src/sam_boot.c
@@ -41,6 +41,7 @@
#include <debug.h>
+#include "sam_sckc.h"
#include "sama5d3x-ek.h"
/************************************************************************************
@@ -60,13 +61,19 @@
*
* Description:
* All SAMA5 architectures must provide the following entry point. This entry
- * point is called early in the intitialization -- after all memory has been
+ * point is called early in the initialization -- after all memory has been
* configured and mapped but before any devices have been initialized.
*
************************************************************************************/
void sam_boardinitialize(void)
{
+#ifdef CONFIG_SAMA5D3xEK_SLOWCLOCK
+ /* Enable the external slow clock */
+
+ sam_sckc_enable(true);
+#endif
+
/* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function
* sam_spiinitialize() has been brought into the link.
*/
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c b/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c
index 919e96089..d81e891fa 100644
--- a/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c
+++ b/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c
@@ -56,7 +56,6 @@
#include "sam_pio.h"
#include "sam_twi.h"
#include "sam_ssc.h"
-#include "sam_sckc.h"
#include "sam_pck.h"
#include "sama5d3x-ek.h"
@@ -293,9 +292,10 @@ int sam_wm8904_initialize(int minor)
*/
#ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK
- /* Drive the DAC with the slow clock (32.768 KHz) */
+ /* Drive the DAC with the slow clock (32.768 KHz). The slow clock was
+ * enabled in sam_boot.c if needed.
+ */
- sam_sckc_enable(true);
(void)sam_pck_configure(PCK0, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY);
#else
/* Drive the DAC with the main clock (12 MHz) */