Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAME5x Ethernet Support #25

Merged
merged 39 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cb6e69b
Merged nuttx/nuttx into master
Apr 5, 2019
3c11d9e
Merged nuttx/nuttx into master
Apr 7, 2019
6d13529
Merged nuttx/nuttx into master
Jun 5, 2019
3b5c9d3
Merged nuttx/nuttx into master
Jul 9, 2019
00ddedb
Merged nuttx/nuttx into master
Jul 11, 2019
9ae6140
Merged nuttx/nuttx into master
Jul 17, 2019
8a20155
Save CONFIG_ARCH_BOARD_CUSTOM when running 'make savedefconfig'
Jul 17, 2019
835b5e9
Only use PCLKSEL0 for ADC on LPC176x family.
Jul 29, 2019
f3aba93
Merged in lpc40xx_updates (pull request #1)
Jul 29, 2019
c43e5a8
Made grep search expression more specific.
Aug 16, 2019
38b51f0
Added missing '=' to second grep
Aug 19, 2019
4a89539
Merged in makefile_update (pull request #2)
Aug 19, 2019
c785607
Revert "Only use PCLKSEL0 for ADC on LPC176x family."
Aug 19, 2019
aa2ed7f
Revert "Added missing '=' to second grep"
Aug 19, 2019
6fdf8ed
Merged nuttx/nuttx into master
Aug 19, 2019
3a6f68e
Added a missing '=' in the second grep statement
Aug 19, 2019
9f29211
Merged nuttx/nuttx into master
Aug 29, 2019
0a7ecc3
Merged nuttx/nuttx into master
Sep 3, 2019
389ae29
Merged nuttx/nuttx into master
Sep 5, 2019
9b55a26
Merged nuttx/nuttx into master
Sep 6, 2019
509fe86
Revert extra = in CONFIG_ARCH_BOARD_CUSTOM
Sep 6, 2019
c025a56
Merged nuttx/nuttx into master
Sep 18, 2019
dd5b493
Beginnings of SAME54 Xplained Pro board support
Sep 18, 2019
f97d655
Starting to pull in a few files for Ethernet support
ArrestedLightning Sep 21, 2019
9fb7156
More GMAC driver updates for SAME54
ArrestedLightning Sep 22, 2019
5da90df
Added MII/RMII switch
ArrestedLightning Sep 23, 2019
b0fd4fa
Removed unnecessary references to gigabit ethernet
Sep 26, 2019
2a715ec
Update clock control for SAMD5E5
Sep 26, 2019
c5d1110
Update board definition to use onboard virtual COM port
Oct 4, 2019
16548ff
added support for sam_phy_boardinitialize
Oct 5, 2019
dc74795
Enable APB as well as AHB clocks for GMAC
Oct 5, 2019
e33e323
Fixed MII/RMII mode setup
Oct 14, 2019
5220506
Updated some comments
Oct 16, 2019
fb8a0f3
Added webserver config
Nov 10, 2019
d7f3edc
Deleted non-working configs
Nov 11, 2019
7f5300e
Updated readme.
Nov 21, 2019
fb6e6d1
Merge remote-tracking branch 'bitbucket/same54' into same54
Jan 1, 2020
9d4c76d
Reverted accidental changes to arch/arm/src/sama5/sam_ethernet.c
Jan 1, 2020
edf4c9b
Removed old reference to Metro board.
Jan 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/arm/include/samd5e5/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

#define SAM_IRQ_EXTINT (16) /* Vector number of the first external interrupt */

#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(ARCH_CHIP_SAME5X)
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(CONFIG_ARCH_CHIP_SAME5X)
# include <arch/samd5e5/samd5e5_irq.h>
#else
# error "Unsupported SAMD5/E5 family"
Expand Down
115 changes: 115 additions & 0 deletions arch/arm/src/samd5e5/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ config SAMD5E5_DMAC
default n
select ARCH_DMA

config SAMD5E5_GMAC
bool "Ethernet"
default n
depends on SAMD5E5_HAVE_ETHERNET
select NETDEVICES
select ARCH_HAVE_PHY

config SAMD5E5_EVSYS
bool "Event System"
default n
Expand Down Expand Up @@ -710,3 +717,111 @@ config SAMD5E5_USB_REGDEBUG
CONFIG_DEBUG_USB_INFO.

endmenu # USB options


if SAMD5E5_GMAC

menu "GMAC device driver options"

config SAMD5E5_GMAC_NRXBUFFERS
int "Number of RX buffers"
default 16
---help---
GMAC buffer memory is segmented into 128 byte units (not
configurable). This setting provides the number of such 128 byte
units used for reception. This is also equal to the number of RX
descriptors that will be allocated The selected value must be an
even power of 2.

config SAMD5E5_GMAC_NTXBUFFERS
int "Number of TX buffers"
default 8
---help---
GMAC buffer memory is segmented into full Ethernet packets (size
NET_BUFSIZE bytes). This setting provides the number of such packets
that can be in flight. This is also equal to the number of TX
descriptors that will be allocated.

config SAMD5E5_GMAC_PREALLOCATE
bool "Preallocate buffers"
default n
---help---
Buffer an descriptor many may either be allocated from the memory
pool or pre-allocated to lie in .bss. This options selected pre-
allocated buffer memory.

config SAMD5E5_GMAC_NBC
bool "Disable Broadcast"
default n
---help---
Select to disable receipt of broadcast packets.

config SAMD5E5_GMAC_PHYADDR
int "PHY address"
default 1
---help---
The 5-bit address of the PHY on the board. Default: 1

config SAMD5E5_GMAC_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
SAMD5E5_GMAC_PHYINIT is defined in the configuration then the board specific logic must
provide sam_phyinitialize(); The SAMD5E5 GMAC driver will call this function
one time before it first uses the PHY.

config SAMD5E5_GMAC_AUTONEG
bool "Use autonegotiation"
default y
---help---
Use PHY autonegotiation to determine speed and mode

if !SAMD5E5_GMAC_AUTONEG

config SAMD5E5_GMAC_ETHFD
bool "Full duplex"
default n
---help---
If SAMD5E5_GMAC_AUTONEG is not defined, then this may be defined to
select full duplex mode. Default: half-duplex

choice
prompt "GMAC Speed"
default SAMD5E5_GMAC_ETH100MBPS
---help---
If autonegotiation is not used, then you must select the fixed speed
of the PHY

config SAMD5E5_GMAC_ETH10MBPS
bool "10 Mbps"
---help---
If SAMD5E5_GMAC_AUTONEG is not defined, then this may be defined to select 10 MBps
speed. Default: 100 Mbps

config SAMD5E5_GMAC_ETH100MBPS
bool "100 Mbps"
---help---
If SAMD5E5_GMAC_AUTONEG is not defined, then this may be defined to select 100 MBps
speed. Default: 100 Mbps

endchoice # GMAC speed
endif # !SAMD5E5_GMAC_AUTONEG

config SAMD5E5_GMAC_REGDEBUG
bool "Register-Level Debug"
default n
depends on DEBUG_NET_INFO
---help---
Enable very low-level register access debug. Depends on CONFIG_DEBUG_NET_INFO.

config SAMD5E5_GMAC_USE_MII
bool "Use MII interface for Ethernet"
default n
---help---
If selected, use MII interface to Ethernet PHY. Otherwise, RMII will be used.

endmenu # GMAC device driver options
endif # SAMD5E5_GMAC

1 change: 1 addition & 0 deletions arch/arm/src/samd5e5/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ endif

ifeq ($(CONFIG_SAMD5E5_GMAC),y)
CHIP_CSRCS += sam_gmac.c
CHIP_CSRCS += sam_ethernet.c
endif

ifeq ($(CONFIG_SAMD5E5_USB),y)
Expand Down
1,013 changes: 1,013 additions & 0 deletions arch/arm/src/samd5e5/hardware/sam_gmac.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion arch/arm/src/samd5e5/hardware/sam_memorymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#include <nuttx/config.h>

#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(ARCH_CHIP_SAME5X)
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(CONFIG_ARCH_CHIP_SAME5X)
# include "hardware/samd5e5_memorymap.h"
#else
# error "Unsupported SAMD5/E5 family"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/samd5e5/hardware/sam_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#include <nuttx/config.h>

#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(ARCH_CHIP_SAME5X)
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(CONFIG_ARCH_CHIP_SAME5X)
# include "hardware/samd5e5_pinmap.h"
#else
# error "Unsupported SAMD5/E5 family"
Expand Down
125 changes: 125 additions & 0 deletions arch/arm/src/samd5e5/sam_ethernet.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/****************************************************************************
* arch/arm/src/samd5e5/sam_ethernet.c
*
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* 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 <debug.h>
#include "sam_ethernet.h"

#ifdef CONFIG_NET

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/****************************************************************************
* Private Types
****************************************************************************/

/****************************************************************************
* Private Data
****************************************************************************/

/****************************************************************************
* Private Function Prototypes
****************************************************************************/

/****************************************************************************
* Private Functions
****************************************************************************/

/****************************************************************************
* Function: up_gmac_initialize
*
* Description:
* Initialize the GMAC driver
*
* Input Parameters:
* None.
*
* Returned Value:
* None.
*
****************************************************************************/

#ifdef CONFIG_SAMD5E5_GMAC
static inline void up_gmac_initialize(void)
{
int ret;

/* Initialize the GMAC driver */

ret = sam_gmac_initialize();
if (ret < 0)
{
nerr("ERROR: sam_gmac_initialize failed: %d\n", ret);
}
}
#else
# define up_gmac_initialize()
#endif

/****************************************************************************
* Public Functions
****************************************************************************/

/****************************************************************************
* Function: up_netinitialize
*
* Description:
* This is the "standard" network initialization logic called from the
* low-level initialization logic in up_initialize.c.
*
* Input Parameters:
* None.
*
* Returned Value:
* None.
*
* Assumptions:
*
****************************************************************************/

void up_netinitialize(void)
{

up_gmac_initialize();
}

#endif /* CONFIG_NET */
Loading