From 3ad0dfc1b68d54d536a54e1c526279bd7d304fba Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 22 Nov 2012 14:44:38 +0000 Subject: [PATCH] Move some PHY initialization logic for Darcy git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5382 42af7a65-404d-4744-a932-0658087f49c3 --- configs/cloudctrl/src/Makefile | 3 ++ configs/cloudctrl/src/up_boot.c | 14 ------ configs/cloudctrl/src/up_phyinit.c | 71 ++++++++++++++++++++++++++++++ configs/ez80f910200kitg/README.txt | 4 ++ 4 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 configs/cloudctrl/src/up_phyinit.c diff --git a/configs/cloudctrl/src/Makefile b/configs/cloudctrl/src/Makefile index 3e4773518a4..37c944f4d4e 100644 --- a/configs/cloudctrl/src/Makefile +++ b/configs/cloudctrl/src/Makefile @@ -85,6 +85,9 @@ ifeq ($(CONFIG_WATCHDOG),y) CSRCS += up_watchdog.c endif +ifeq ($(CONFIG_STM32_PHYINIT),y) +CSRCS += up_phyinit.c +endif COBJS = $(CSRCS:.c=$(OBJEXT)) diff --git a/configs/cloudctrl/src/up_boot.c b/configs/cloudctrl/src/up_boot.c index f536429716b..fe0093d48d7 100644 --- a/configs/cloudctrl/src/up_boot.c +++ b/configs/cloudctrl/src/up_boot.c @@ -56,16 +56,6 @@ * Private Functions ************************************************************************************/ -#ifdef CONFIG_PHY_DM9161 -static inline void stm232_configdm9161(void) -{ - stm32_configgpio(GPIO_DM9161_RET); - stm32_gpiowrite(GPIO_DM9161_RET, true); -} -# else -# define stm232_configdm9161() -#endif - /************************************************************************************ * Public Functions ************************************************************************************/ @@ -93,10 +83,6 @@ void stm32_boardinitialize(void) } #endif - /* Configure the DM9161 PHY reset pin and take it out of reset */ - - stm232_configdm9161(); - /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. diff --git a/configs/cloudctrl/src/up_phyinit.c b/configs/cloudctrl/src/up_phyinit.c new file mode 100644 index 00000000000..114c9f07bfd --- /dev/null +++ b/configs/cloudctrl/src/up_phyinit.c @@ -0,0 +1,71 @@ +/************************************************************************************ + * configs/cloudctrl/src/up_phyinit.c + * arch/arm/src/board/up_phyinit.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * Darcy Gong + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "stm32_gpio.h" +#include "stm32_eth.h" + +#include "cloudctrl-internal.h" + +/************************************************************************************ + * Definitions + ************************************************************************************/ + +/************************************************************************************ + * Private Functions + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#if defined(CONFIG_PHY_DM9161) && defined(CONFIG_STM32_PHYINIT) +int stm32_phy_boardinitialize(int intf) +{ + /* Configure the DM9161 PHY reset pin and take it out of reset */ + + stm32_configgpio(GPIO_DM9161_RET); + stm32_gpiowrite(GPIO_DM9161_RET, true); + return 0; +} +#endif + diff --git a/configs/ez80f910200kitg/README.txt b/configs/ez80f910200kitg/README.txt index 2bac3c5db8c..222a25db1f0 100644 --- a/configs/ez80f910200kitg/README.txt +++ b/configs/ez80f910200kitg/README.txt @@ -107,4 +107,8 @@ available: CONFIG_APPS_DIR="..\apps" + NOTE: If you need to change the toolchain path used in Make.defs, + you will need to use the short 8.3 filenames to avoid spaces. On + my change C:\PROGRA~1\ is C:\PROGRA~2\ is C:\Program Files (x86)\ + Check out any README.txt files in these s.