STM32 F7: Quick'n'dirty port of the STM32 F4 Ethernet driver. Does not yet even compile
This commit is contained in:
parent
9908449fca
commit
1d3329e6d9
@ -444,4 +444,198 @@ config STM32F7_DTCM_PROCFS
|
||||
will provide statistics about DTCM memory use similar to what you
|
||||
would get from mallinfo() for the user heap.
|
||||
|
||||
if STM32F7_ETHMAC
|
||||
menu "Ethernet MAC configuration"
|
||||
|
||||
config STM32F7_PHYADDR
|
||||
int "PHY address"
|
||||
default 1
|
||||
---help---
|
||||
The 5-bit address of the PHY on the board. Default: 1
|
||||
|
||||
config STM32F7_PHYINIT
|
||||
bool "Board-specific PHY Initialization"
|
||||
default n
|
||||
---help---
|
||||
Some boards require specialized initialization of the PHY before it can be used.
|
||||
This may include such things as configuring GPIOs, resetting the PHY, etc. If
|
||||
STM32F7_PHYINIT is defined in the configuration then the board specific logic must
|
||||
provide stm32_phyinitialize(); The STM32 Ethernet driver will call this function
|
||||
one time before it first uses the PHY.
|
||||
|
||||
config STM32F7_MII
|
||||
bool "Use MII interface"
|
||||
default n
|
||||
---help---
|
||||
Support Ethernet MII interface.
|
||||
|
||||
choice
|
||||
prompt "MII clock configuration"
|
||||
default STM32F7_MII_EXTCLK
|
||||
depends on STM32F7_MII
|
||||
|
||||
config STM32F7_MII_MCO1
|
||||
bool "Use MC01 as MII clock"
|
||||
---help---
|
||||
Use MCO1 to clock the MII interface.
|
||||
|
||||
config STM32F7_MII_MCO2
|
||||
bool "Use MC02 as MII clock"
|
||||
---help---
|
||||
Use MCO2 to clock the MII interface.
|
||||
|
||||
config STM32F7_MII_EXTCLK
|
||||
bool "External MII clock"
|
||||
---help---
|
||||
Clocking is provided by external logic.
|
||||
|
||||
endchoice
|
||||
|
||||
config STM32F7_AUTONEG
|
||||
bool "Use autonegotiation"
|
||||
default y
|
||||
---help---
|
||||
Use PHY autonegotiation to determine speed and mode
|
||||
|
||||
config STM32F7_ETHFD
|
||||
bool "Full duplex"
|
||||
default n
|
||||
depends on !STM32F7_AUTONEG
|
||||
---help---
|
||||
If STM32F7_AUTONEG is not defined, then this may be defined to select full duplex
|
||||
mode. Default: half-duplex
|
||||
|
||||
config STM32F7_ETH100MBPS
|
||||
bool "100 Mbps"
|
||||
default n
|
||||
depends on !STM32F7_AUTONEG
|
||||
---help---
|
||||
If STM32F7_AUTONEG is not defined, then this may be defined to select 100 MBps
|
||||
speed. Default: 10 Mbps
|
||||
|
||||
config STM32F7_PHYSR
|
||||
int "PHY Status Register Address (decimal)"
|
||||
depends on STM32F7_AUTONEG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. The PHY status register
|
||||
address may diff from PHY to PHY. This configuration sets the address of
|
||||
the PHY status register.
|
||||
|
||||
config STM32F7_PHYSR_ALTCONFIG
|
||||
bool "PHY Status Alternate Bit Layout"
|
||||
default n
|
||||
depends on STM32F7_AUTONEG
|
||||
---help---
|
||||
Different PHYs present speed and mode information in different ways. Some
|
||||
will present separate information for speed and mode (this is the default).
|
||||
Those PHYs, for example, may provide a 10/100 Mbps indication and a separate
|
||||
full/half duplex indication. This options selects an alternative representation
|
||||
where speed and mode information are combined. This might mean, for example,
|
||||
separate bits for 10HD, 100HD, 10FD and 100FD.
|
||||
|
||||
config STM32F7_PHYSR_SPEED
|
||||
hex "PHY Speed Mask"
|
||||
depends on STM32F7_AUTONEG && !STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This provides bit mask
|
||||
for isolating the 10 or 100MBps speed indication.
|
||||
|
||||
config STM32F7_PHYSR_100MBPS
|
||||
hex "PHY 100Mbps Speed Value"
|
||||
depends on STM32F7_AUTONEG && !STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This provides the value
|
||||
of the speed bit(s) indicating 100MBps speed.
|
||||
|
||||
config STM32F7_PHYSR_MODE
|
||||
hex "PHY Mode Mask"
|
||||
depends on STM32F7_AUTONEG && !STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This provide bit mask
|
||||
for isolating the full or half duplex mode bits.
|
||||
|
||||
config STM32F7_PHYSR_FULLDUPLEX
|
||||
hex "PHY Full Duplex Mode Value"
|
||||
depends on STM32F7_AUTONEG && !STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This provides the
|
||||
value of the mode bits indicating full duplex mode.
|
||||
|
||||
config STM32F7_PHYSR_ALTMODE
|
||||
hex "PHY Mode Mask"
|
||||
depends on STM32F7_AUTONEG && STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This provide bit mask
|
||||
for isolating the speed and full/half duplex mode bits.
|
||||
|
||||
config STM32F7_PHYSR_10HD
|
||||
hex "10MBase-T Half Duplex Value"
|
||||
depends on STM32F7_AUTONEG && STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This is the value
|
||||
under the bit mask that represents the 10Mbps, half duplex setting.
|
||||
|
||||
config STM32F7_PHYSR_100HD
|
||||
hex "100Base-T Half Duplex Value"
|
||||
depends on STM32F7_AUTONEG && STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This is the value
|
||||
under the bit mask that represents the 100Mbps, half duplex setting.
|
||||
|
||||
config STM32F7_PHYSR_10FD
|
||||
hex "10Base-T Full Duplex Value"
|
||||
depends on STM32F7_AUTONEG && STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This is the value
|
||||
under the bit mask that represents the 10Mbps, full duplex setting.
|
||||
|
||||
config STM32F7_PHYSR_100FD
|
||||
hex "100Base-T Full Duplex Value"
|
||||
depends on STM32F7_AUTONEG && STM32F7_PHYSR_ALTCONFIG
|
||||
---help---
|
||||
This must be provided if STM32F7_AUTONEG is defined. This is the value
|
||||
under the bit mask that represents the 100Mbps, full duplex setting.
|
||||
|
||||
config STM32F7_ETH_PTP
|
||||
bool "Precision Time Protocol (PTP)"
|
||||
default n
|
||||
---help---
|
||||
Precision Time Protocol (PTP). Not supported but some hooks are indicated
|
||||
with this condition.
|
||||
|
||||
config STM32F7_RMII
|
||||
bool
|
||||
default y if !STM32F7_MII
|
||||
|
||||
choice
|
||||
prompt "RMII clock configuration"
|
||||
default STM32F7_RMII_EXTCLK
|
||||
depends on STM32F7_RMII
|
||||
|
||||
config STM32F7_RMII_MCO1
|
||||
bool "Use MC01 as RMII clock"
|
||||
---help---
|
||||
Use MCO1 to clock the RMII interface.
|
||||
|
||||
config STM32F7_RMII_MCO2
|
||||
bool "Use MC02 as RMII clock"
|
||||
---help---
|
||||
Use MCO2 to clock the RMII interface.
|
||||
|
||||
config STM32F7_RMII_EXTCLK
|
||||
bool "External RMII clock"
|
||||
---help---
|
||||
Clocking is provided by external logic.
|
||||
|
||||
endchoice
|
||||
|
||||
config STM32F7_ETHMAC_REGDEBUG
|
||||
bool "Register-Level Debug"
|
||||
default n
|
||||
depends on DEBUG
|
||||
---help---
|
||||
Enable very low-level register access debug. Depends on DEBUG.
|
||||
|
||||
endmenu
|
||||
endif # STM32F7_ETHMAC
|
||||
endif # ARCH_CHIP_STM32F7
|
||||
|
@ -128,6 +128,10 @@ CHIP_CSRCS += stm32_exti_alarm.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32F7_ETHMAC),y)
|
||||
CHIP_CSRCS += stm32_ethernet.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
CHIP_CSRCS += stm32_dumpgpio.c
|
||||
endif
|
||||
|
4136
arch/arm/src/stm32f7/stm32_ethernet.c
Normal file
4136
arch/arm/src/stm32f7/stm32_ethernet.c
Normal file
File diff suppressed because it is too large
Load Diff
118
arch/arm/src/stm32f7/stm32_ethernet.h
Normal file
118
arch/arm/src/stm32f7/stm32_ethernet.h
Normal file
@ -0,0 +1,118 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32f7/stm32_ethernet.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_ETHERNET_H
|
||||
#define __ARCH_ARM_SRC_STM32F7_STM32_ETHERNET_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "chip/stm32_ethernet.h"
|
||||
|
||||
#if STM32F7_NETHERNET > 0
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Function: stm32_ethinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the Ethernet driver for one interface. If the STM32 chip supports
|
||||
* multiple Ethernet controllers, then board specific logic must implement
|
||||
* up_netinitialize() and call this function to initialize the desired interfaces.
|
||||
*
|
||||
* Parameters:
|
||||
* intf - In the case where there are multiple EMACs, this value identifies which
|
||||
* EMAC is to be initialized.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if STM32F7_NETHERNET > 1
|
||||
int stm32_ethinitialize(int intf);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Function: stm32_phy_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* Some boards require specialized initialization of the PHY before it can be used.
|
||||
* This may include such things as configuring GPIOs, resetting the PHY, etc. If
|
||||
* CONFIG_STM32F7_PHYINIT is defined in the configuration then the board specific
|
||||
* logic must provide stm32_phyinitialize(); The STM32 Ethernet driver will call
|
||||
* this function one time before it first uses the PHY.
|
||||
*
|
||||
* Parameters:
|
||||
* intf - Always zero for now.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32F7_PHYINIT
|
||||
int stm32_phy_boardinitialize(int intf);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* STM32F7_NETHERNET > 0 */
|
||||
#endif /* __ARCH_ARM_SRC_STM32F7_STM32_ETHERNET_H */
|
||||
|
Loading…
Reference in New Issue
Block a user