summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-07-22 14:42:05 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-07-22 14:42:05 -0600
commit3e3f1fcdf06f73c648ade9c538fd80af73aaaeca (patch)
treecfb560a2bb3a9243a2751fc7df2b6690e4d5c5a6 /nuttx/configs
parentbd010e1e39749c4132ed12d50040c3958b84c6fe (diff)
downloadpx4-nuttx-3e3f1fcdf06f73c648ade9c538fd80af73aaaeca.tar.gz
px4-nuttx-3e3f1fcdf06f73c648ade9c538fd80af73aaaeca.tar.bz2
px4-nuttx-3e3f1fcdf06f73c648ade9c538fd80af73aaaeca.zip
Add SAMA5 clock logic. Cloned from SAM3U and not yet verified
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/sama5d3x-ek/README.txt12
-rw-r--r--nuttx/configs/sama5d3x-ek/include/board.h84
-rwxr-xr-xnuttx/configs/sama5d3x-ek/ostest/setenv.sh3
3 files changed, 90 insertions, 9 deletions
diff --git a/nuttx/configs/sama5d3x-ek/README.txt b/nuttx/configs/sama5d3x-ek/README.txt
index 25049c468..d7260e3cb 100644
--- a/nuttx/configs/sama5d3x-ek/README.txt
+++ b/nuttx/configs/sama5d3x-ek/README.txt
@@ -50,10 +50,9 @@ GNU Toolchain Options
The NuttX make system will support the several different toolchain options.
- All testing has been conducted using the AtmelStudio GCC toolchain. To use
- the CodeSourcery, devkitARM or other GNU toolchain, you simply need to add
- add one of the following configuration options to your .config (or defconfig)
- file:
+ All testing has been conducted using the CodeSourcery GCC toolchain. To use
+ a different toolchain, you simply need to add change to one of the following
+ configuration options to your .config (or defconfig) file:
CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery under Windows
CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYL=y : CodeSourcery under Linux
@@ -63,8 +62,9 @@ GNU Toolchain Options
CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIL=y : Generic GCC ARM EABI toolchain for Linux
CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIW=y : Generic GCC ARM EABI toolchain for Windows
- The AtmelStudio GCC toolchain is selected with CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIW=y
- and setting the PATH variable appropriately.
+ The CodeSourcery GCC toolchain is selected with
+ CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIW=y and setting the PATH variable
+ appropriately.
If you are not using AtmelStudio GCC toolchain, then you may also have to
modify the PATH in the setenv.h file if your make cannot find the tools.
diff --git a/nuttx/configs/sama5d3x-ek/include/board.h b/nuttx/configs/sama5d3x-ek/include/board.h
index 8759dce55..4bc9de143 100644
--- a/nuttx/configs/sama5d3x-ek/include/board.h
+++ b/nuttx/configs/sama5d3x-ek/include/board.h
@@ -47,10 +47,90 @@
************************************************************************************/
/* Clocking *************************************************************************/
+/* After power-on reset, the sam3u device is running on a 4MHz internal RC. These
+ * definitions will configure clocking
+ *
+ * MAINOSC: Frequency = 12MHz (crysta)
+ * PLLA: PLL Divider = 1, Multiplier = 16 to generate PLLACK = 192MHz
+ * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 96MHz
+ * CPU clock: 96MHz
+ */
+
+/* Main oscillator register settings.
+ *
+ * The start up time should be should be:
+ * Start Up Time = 8 * MOSCXTST / SLCK = 56 Slow Clock Cycles.
+ */
+
+#define BOARD_CKGR_MOR_MOSCXTST (62 << PMC_CKGR_MOR_MOSCXTST_SHIFT) /* Start-up Time */
+
+/* PLLA configuration.
+ *
+ * Divider = 1
+ * Multipler = 16
+ */
+
+#define BOARD_CKGR_PLLAR_MUL (15 << PMC_CKGR_PLLAR_MUL_SHIFT)
+#define BOARD_CKGR_PLLAR_STMODE PMC_CKGR_PLLAR_STMODE_FAST
+#define BOARD_CKGR_PLLAR_COUNT (63 << PMC_CKGR_PLLAR_COUNT_SHIFT)
+#define BOARD_CKGR_PLLAR_DIV PMC_CKGR_PLLAR_DIV_BYPASS
+
+/* PMC master clock register settings.
+ *
+ * Source = PLLA
+ * Divider = 2
+ */
+
+#define BOARD_PMC_MCKR_CSS PMC_MCKR_CSS_PLLA
+#define BOARD_PMC_MCKR_PRES PMC_MCKR_PRES_DIV2
+
+/* USB UTMI PLL start-up time */
+
+#define BOARD_CKGR_UCKR_UPLLCOUNT (3 << PMC_CKGR_UCKR_UPLLCOUNT_SHIFT)
-/* Resulting clock frquencies *******************************************************/
+/* Resulting frequencies */
-#define BOARD_MCK_FREQUENCY 0 /* FIXME */
+#define BOARD_MAINOSC_FREQUENCY (12000000) /* MAINOSC: 12MHz crystal on-board */
+#define BOARD_PLLA_FREQUENCY (192000000) /* PLLACK: 16 * 12Mhz / 1 */
+#define BOARD_MCK_FREQUENCY (96000000) /* MCK: PLLACK / 2 */
+#define BOARD_CPU_FREQUENCY (96000000) /* CPU: MCK */
+
+/* HSMCI clocking
+ *
+ * Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
+ * divided by (2*(CLKDIV+1)).
+ *
+ * MCI_SPEED = MCK / (2*(CLKDIV+1))
+ * CLKDIV = MCI / MCI_SPEED / 2 - 1
+ *
+ * Where CLKDIV has a range of 0-255.
+ */
+
+/* MCK = 96MHz, CLKDIV = 119, MCI_SPEED = 96MHz / 2 * (119+1) = 400 KHz */
+
+#define HSMCI_INIT_CLKDIV (119 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 96MHz, CLKDIV = 3, MCI_SPEED = 96MHz / 2 * (3+1) = 12 MHz */
+
+#define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 96MHz, CLKDIV = 1, MCI_SPEED = 96MHz / 2 * (1+1) = 24 MHz */
+
+#define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
+#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
+
+/* FLASH wait states
+ *
+ * FWS Max frequency
+ * 1.62V 1.8V
+ * --- ----- ------
+ * 0 24MHz 27MHz
+ * 1 40MHz 47MHz
+ * 2 72MHz 84MHz
+ * 3 84MHz 96MHz
+ */
+
+#define BOARD_FWS 3
/* LED definitions ******************************************************************/
diff --git a/nuttx/configs/sama5d3x-ek/ostest/setenv.sh b/nuttx/configs/sama5d3x-ek/ostest/setenv.sh
index 1378d4298..9b2028586 100755
--- a/nuttx/configs/sama5d3x-ek/ostest/setenv.sh
+++ b/nuttx/configs/sama5d3x-ek/ostest/setenv.sh
@@ -50,12 +50,13 @@ fi
# This is the Cygwin path to the location where I installed the Atmel GCC
# toolchain under Windows. You will also have to edit this if you install
# this toolchain in any other location
-export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install