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
This commit is contained in:
patacongo 2012-11-22 14:44:38 +00:00
parent a90f6ace35
commit 3ad0dfc1b6
4 changed files with 78 additions and 14 deletions

View File

@ -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))

View File

@ -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.

View File

@ -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 <gnutt@nuttx.org>
* Darcy Gong <darcy.gong@gmail.com>
*
* 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 <nuttx/config.h>
#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

View File

@ -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 <sub-directory>s.