mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
risc-v/mpfs: add support for ethernet
This commit is contained in:
committed by
Petro Karashchenko
parent
07aeb12b30
commit
d72a523c00
@@ -244,6 +244,26 @@ config MPFS_EMMCSD
|
|||||||
---help---
|
---help---
|
||||||
Selects the MPFS eMMCSD driver.
|
Selects the MPFS eMMCSD driver.
|
||||||
|
|
||||||
|
config MPFS_ETHMAC
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
select NETDEVICES
|
||||||
|
select ARCH_HAVE_PHY
|
||||||
|
|
||||||
|
config MPFS_ETHMAC_0
|
||||||
|
bool "Ethernet MAC 0"
|
||||||
|
default n
|
||||||
|
select MPFS_ETHMAC
|
||||||
|
---help---
|
||||||
|
Enable MPFS ethernet MAC-0.
|
||||||
|
|
||||||
|
config MPFS_ETHMAC_1
|
||||||
|
bool "Ethernet MAC 1"
|
||||||
|
default n
|
||||||
|
select MPFS_ETHMAC
|
||||||
|
---help---
|
||||||
|
Enable MPFS ethernet MAC-1.
|
||||||
|
|
||||||
comment "CorePWM Options"
|
comment "CorePWM Options"
|
||||||
|
|
||||||
config MPFS_HAVE_COREPWM
|
config MPFS_HAVE_COREPWM
|
||||||
@@ -317,10 +337,149 @@ config MPFS_DMA
|
|||||||
---help---
|
---help---
|
||||||
Enable DMA Support. MPFS DMA is Memory-to-Memory only.
|
Enable DMA Support. MPFS DMA is Memory-to-Memory only.
|
||||||
|
|
||||||
menu "MPFS Others"
|
menu "Ethernet MAC configuration"
|
||||||
|
depends on MPFS_ETHMAC
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "MII Interface mode"
|
||||||
|
|
||||||
|
config MPFS_MAC_SGMII
|
||||||
|
bool "SGMII"
|
||||||
|
---help---
|
||||||
|
Use Ethernet SGMII interface.
|
||||||
|
|
||||||
|
config MPFS_MAC_GMII
|
||||||
|
bool "GMII"
|
||||||
|
---help---
|
||||||
|
Use Ethernet GMII interface.
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config MPFS_PHYADDR
|
||||||
|
int "PHY address"
|
||||||
|
default 1
|
||||||
|
---help---
|
||||||
|
The 5-bit address of the PHY on the board. Default: 1
|
||||||
|
|
||||||
|
config MPFS_MAC_NO_BROADCAST
|
||||||
|
bool "Disable Broadcast"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Select to disable receipt of broadcast packets.
|
||||||
|
|
||||||
|
config MPFS_MAC_AUTONEG
|
||||||
|
bool "Use autonegotiation"
|
||||||
|
default y
|
||||||
|
---help---
|
||||||
|
Use PHY autonegotiation to determine speed and mode
|
||||||
|
|
||||||
|
config MPFS_MAC_AUTONEG_DISABLE_1000MBPS
|
||||||
|
bool "Disable Gigabit mode"
|
||||||
|
default n
|
||||||
|
depends on MPFS_MAC_AUTONEG
|
||||||
|
---help---
|
||||||
|
Select to disable Gigabit speed support.
|
||||||
|
If disabled then autonegotiation don't advertise 1GB mode
|
||||||
|
|
||||||
|
config MPFS_PHYINIT
|
||||||
|
bool "Use board phyinit"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
call mpfs_phy_boardinitialize() on init
|
||||||
|
|
||||||
|
if !MPFS_MAC_AUTONEG
|
||||||
|
|
||||||
|
config MPFS_MAC_ETHFD
|
||||||
|
bool "Full duplex"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
If MPFS_MAC_AUTONEG is not defined, then this may be defined to
|
||||||
|
select full duplex mode. Default: half-duplex
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "MAC Speed"
|
||||||
|
default MPFS_MAC_ETH100MBPS
|
||||||
|
---help---
|
||||||
|
If autonegotiation is not used, then you must select the fixed speed
|
||||||
|
of the PHY
|
||||||
|
|
||||||
|
config MPFS_MAC_ETH10MBPS
|
||||||
|
bool "10 Mbps"
|
||||||
|
---help---
|
||||||
|
If MPFS_MAC_AUTONEG is not defined, then this may be defined to select 10 MBps
|
||||||
|
speed. Default: 100 Mbps
|
||||||
|
|
||||||
|
config MPFS_MAC_ETH100MBPS
|
||||||
|
bool "100 Mbps"
|
||||||
|
---help---
|
||||||
|
If MPFS_MAC_AUTONEG is not defined, then this may be defined to select 100 MBps
|
||||||
|
speed. Default: 100 Mbps
|
||||||
|
|
||||||
|
config MPFS_MAC_ETH1000MBPS
|
||||||
|
bool "1000 Mbps"
|
||||||
|
---help---
|
||||||
|
If MPFS_MAC_AUTONEG is not defined, then this may be defined to select 1000 MBps
|
||||||
|
speed. Default: 100 Mbps
|
||||||
|
|
||||||
|
endchoice # GMAC speed
|
||||||
|
|
||||||
|
endif # !MPFS_MAC_AUTONEG
|
||||||
|
|
||||||
|
config MPFS_ETHMAC_MDC_CLOCK_SOURCE_HZ
|
||||||
|
int "MDC Clock Source (Hz)"
|
||||||
|
default 125000000
|
||||||
|
range 1000000 240000000
|
||||||
|
depends on MPFS_ETHMAC
|
||||||
|
---help---
|
||||||
|
Select the MDC clock source frequency.
|
||||||
|
|
||||||
|
config MPFS_ETHMAC_NTXBUFFERS
|
||||||
|
int "Number of TX DMA Buffers"
|
||||||
|
default 8
|
||||||
|
depends on MPFS_ETHMAC
|
||||||
|
---help---
|
||||||
|
Select the number of TX DMA buffers.
|
||||||
|
|
||||||
|
config MPFS_ETHMAC_NRXBUFFERS
|
||||||
|
int "Number of RX DMA Buffers"
|
||||||
|
default 16
|
||||||
|
depends on MPFS_ETHMAC
|
||||||
|
---help---
|
||||||
|
Select the number of RX DMA buffers.
|
||||||
|
|
||||||
|
config MPFS_ETHMAC_64BIT_ADDRESS_MODE
|
||||||
|
bool "64-bit DMA address mode"
|
||||||
|
default n
|
||||||
|
depends on MPFS_ETHMAC
|
||||||
|
---help---
|
||||||
|
Select to enable 64-bit DMA address mode. This is only needed if the
|
||||||
|
Nuttx memory address is above 4GB.
|
||||||
|
|
||||||
|
config MPFS_ETHMAC_REGDEBUG
|
||||||
|
bool "Register-Level Debug"
|
||||||
|
default n
|
||||||
|
depends on DEBUG_NET_INFO
|
||||||
|
---help---
|
||||||
|
Enable very low-level register access debug. Depends on
|
||||||
|
CONFIG_DEBUG_FEATURES.
|
||||||
|
|
||||||
|
config MPFS_MPU_DMA_ENABLE
|
||||||
|
bool "Enable ALL memory access for eth DMA"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Set ALL memory accessible for Ethernet DMA.
|
||||||
|
This should be done on bootloader. This is mostly for testing only.
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
config MPFS_HAVE_CORERMII
|
||||||
|
bool "CoreRMII FPGA IP block configured"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config MPFS_CORERMII_ADDRESS
|
||||||
|
int "CoreRMII Phy address"
|
||||||
|
default 1
|
||||||
|
depends on MPFS_HAVE_CORERMII
|
||||||
|
|
||||||
# Override the default values for MPU / PMP parameters here
|
# Override the default values for MPU / PMP parameters here
|
||||||
|
|
||||||
config ARCH_MPU_MIN_BLOCK_SIZE
|
config ARCH_MPU_MIN_BLOCK_SIZE
|
||||||
|
|||||||
@@ -93,6 +93,10 @@ ifeq ($(CONFIG_MPFS_EMMCSD),y)
|
|||||||
CHIP_CSRCS += mpfs_emmcsd.c
|
CHIP_CSRCS += mpfs_emmcsd.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_MPFS_ETHMAC),y)
|
||||||
|
CHIP_CSRCS += mpfs_ethernet.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (${CONFIG_MPFS_HAVE_COREPWM},y)
|
ifeq (${CONFIG_MPFS_HAVE_COREPWM},y)
|
||||||
CHIP_CSRCS += mpfs_corepwm.c
|
CHIP_CSRCS += mpfs_corepwm.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
+719
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/risc-v/src/mpfs/mpfs_ethernet.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_RISCV_SRC_MPFS_MPFS_ETHERNET_H
|
||||||
|
#define __ARCH_RISCV_SRC_MPFS_MPFS_ETHERNET_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include "hardware/mpfs_ethernet.h"
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: mpfs_ethinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the Ethernet driver for one interface.
|
||||||
|
*
|
||||||
|
* Input 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:
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int mpfs_ethinitialize(int intf);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: mpfs_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_MPFS_PHYINIT is defined in the configuration
|
||||||
|
* then the board specific logic must provide mpfs_phyinitialize();
|
||||||
|
* The MPFS Ethernet driver will call this function one time before
|
||||||
|
* it first uses the PHY.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* intf - Always zero for now.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* OK on success; Negated errno on failure.
|
||||||
|
*
|
||||||
|
* Assumptions:
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_MPFS_PHYINIT
|
||||||
|
int mpfs_phy_boardinitialize(int intf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __ARCH_RISCV_SRC_MPFS_MPFS_ETHERNET_H */
|
||||||
Reference in New Issue
Block a user