summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-14 14:07:21 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-14 14:07:21 +0000
commitb12d1dada94cd7083c2a5a023ec2e7a9a51c192a (patch)
tree78375ed0dfcfed58f45bf266c76a1f9230df01c9 /nuttx/arch/arm/src/stm32
parentbf8d0c68312793631ed4ade1541ec36168b3722b (diff)
downloadpx4-nuttx-b12d1dada94cd7083c2a5a023ec2e7a9a51c192a.tar.gz
px4-nuttx-b12d1dada94cd7083c2a5a023ec2e7a9a51c192a.tar.bz2
px4-nuttx-b12d1dada94cd7083c2a5a023ec2e7a9a51c192a.zip
Add XML RPC server plus NXWM build fixes from Max Holtzberg
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5150 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-rw-r--r--nuttx/arch/arm/src/stm32/Kconfig38
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_eth.c60
2 files changed, 88 insertions, 10 deletions
diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig
index 6b2ac39d3..b5d0306da 100644
--- a/nuttx/arch/arm/src/stm32/Kconfig
+++ b/nuttx/arch/arm/src/stm32/Kconfig
@@ -1670,6 +1670,12 @@ config STM32_MII_MCO2
---help---
Use MCO2 to clock the MII interface. Default: Use MC01
+config STM32_MII_EXTCLK
+ bool "External MII clock"
+ ---help---
+ Clocking is provided by external logic. Don't use MCO for MII
+ clock. Default: Use MC0[1]
+
endchoice
config STM32_AUTONEG
@@ -1746,6 +1752,38 @@ config STM32_RMII
default y if !STM32_MII
depends on STM32_ETHMAC
+choice
+ prompt "RMII clock configuration"
+ default STM32_RMII_MCO if STM32_STM32F10XX
+ default STM32_RMII_MCO1 if STM32_STM32F20XX || STM32_STM32F40XX
+ depends on STM32_RMII
+
+config STM32_RMII_MCO
+ bool "Use MC0 as RMII clock"
+ depends on STM32_STM32F10XX
+ ---help---
+ Use MCO to clock the RMII interface. Default: Use MC0
+
+config STM32_RMII_MCO1
+ bool "Use MC01 as RMII clock"
+ depends on (STM32_STM32F20XX || STM32_STM32F40XX)
+ ---help---
+ Use MCO1 to clock the RMII interface. Default: Use MC01
+
+config STM32_RMII_MCO2
+ bool "Use MC02 as RMII clock"
+ depends on (STM32_STM32F20XX || STM32_STM32F40XX)
+ ---help---
+ Use MCO2 to clock the RMII interface. Default: Use MC01
+
+config STM32_RMII_EXTCLK
+ bool "External RMII clock"
+ ---help---
+ Clocking is provided by external logic. Don't use MCO for RMII
+ clock. Default: Use MC0[1]
+
+endchoice
+
menu "USB Host Configuration"
config STM32_OTGFS_RXFIFO_SIZE
diff --git a/nuttx/arch/arm/src/stm32/stm32_eth.c b/nuttx/arch/arm/src/stm32/stm32_eth.c
index 4493983ad..59f3def7f 100644
--- a/nuttx/arch/arm/src/stm32/stm32_eth.c
+++ b/nuttx/arch/arm/src/stm32/stm32_eth.c
@@ -103,15 +103,30 @@
#ifdef CONFIG_STM32_MII
# if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
-# if !defined(CONFIG_STM32_MII_MCO1) && !defined(CONFIG_STM32_MII_MCO2)
-# warning "Neither CONFIG_STM32_MII_MCO1 nor CONFIG_STM32_MII_MCO2 defined"
+# if !defined(CONFIG_STM32_MII_MCO1) && !defined(CONFIG_STM32_MII_MCO2) && !defined(CONFIG_STM32_MII_EXTCLK)
+# warning "Neither CONFIG_STM32_MII_MCO1, CONFIG_STM32_MII_MCO2, nor CONFIG_STM32_MII_EXTCLK defined"
# endif
# if defined(CONFIG_STM32_MII_MCO1) && defined(CONFIG_STM32_MII_MCO2)
# error "Both CONFIG_STM32_MII_MCO1 and CONFIG_STM32_MII_MCO2 defined"
# endif
# elif defined(CONFIG_STM32_CONNECTIVITYLINE)
-# if !defined(CONFIG_STM32_MII_MCO)
-# warning "CONFIG_STM32_MII_MCO not defined"
+# if !defined(CONFIG_STM32_MII_MCO) && !defined(CONFIG_STM32_MII_EXTCLK)
+# warning "Neither CONFIG_STM32_MII_MCO nor CONFIG_STM32_MII_EXTCLK defined"
+# endif
+# endif
+#endif
+
+#ifdef CONFIG_STM32_RMII
+# if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
+# if !defined(CONFIG_STM32_RMII_MCO1) && !defined(CONFIG_STM32_RMII_MCO2) && !defined(CONFIG_STM32_RMII_EXTCLK)
+# warning "Neither CONFIG_STM32_RMII_MCO1, CONFIG_STM32_RMII_MCO2, nor CONFIG_STM32_RMII_EXTCLK defined"
+# endif
+# if defined(CONFIG_STM32_RMII_MCO1) && defined(CONFIG_STM32_RMII_MCO2)
+# error "Both CONFIG_STM32_RMII_MCO1 and CONFIG_STM32_RMII_MCO2 defined"
+# endif
+# elif defined(CONFIG_STM32_CONNECTIVITYLINE)
+# if !defined(CONFIG_STM32_RMII_MCO) && !defined(CONFIG_STM32_RMII_EXTCLK)
+# warning "Neither CONFIG_STM32_RMII_MCO nor CONFIG_STM32_RMII_EXTCLK defined"
# endif
# endif
#endif
@@ -2735,16 +2750,41 @@ static inline void stm32_ethgpioconfig(FAR struct stm32_ethmac_s *priv)
#elif defined(CONFIG_STM32_RMII)
+ /* Select the RMII interface */
+
+ stm32_selectrmii();
+
+ /* Provide clocking via MCO, MCO1 or MCO2:
+ *
+ * "MCO1 (microcontroller clock output), used to output HSI, LSE, HSE or PLL
+ * clock (through a configurable prescaler) on PA8 pin."
+ *
+ * "MCO2 (microcontroller clock output), used to output HSE, PLL, SYSCLK or
+ * PLLI2S clock (through a configurable prescaler) on PC9 pin."
+ */
+
+# if defined(CONFIG_STM32_RMII_MCO1)
+ /* Configure MC01 to drive the PHY. Board logic must provide MC01 clocking
+ * info.
+ */
+
+ stm32_configgpio(GPIO_MCO1);
+ stm32_mco1config(BOARD_CFGR_MC01_SOURCE, BOARD_CFGR_MC01_DIVIDER);
+
+# elif defined(CONFIG_STM32_RMII_MCO2)
+ /* Configure MC02 to drive the PHY. Board logic must provide MC02 clocking
+ * info.
+ */
+
+ stm32_configgpio(GPIO_MCO2);
+ stm32_mco2config(BOARD_CFGR_MC02_SOURCE, BOARD_CFGR_MC02_DIVIDER);
+
+# elif defined(CONFIG_STM32_RMII_MCO)
/* Setup MCO pin for alternative usage */
-#if defined(CONFIG_STM32_MII_MCO)
stm32_configgpio(GPIO_MCO);
stm32_mcoconfig(BOARD_CFGR_MCO_SOURCE);
-#endif
-
- /* Select the RMII interface */
-
- stm32_selectrmii();
+# endif
/* RMII interface pins (7):
*