SAMA5D4: Still trying to reconcile Ethernet interfaces
This commit is contained in:
parent
379f516780
commit
288c891ad1
@ -1186,20 +1186,6 @@ config SAMA5_EMAC_NTXBUFFERS
|
||||
that can be in flight. This is also equal to the number of TX
|
||||
descriptors that will be allocated.
|
||||
|
||||
config SAMA5_EMAC_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 SAMA5_EMAC_NBC
|
||||
bool "Disable Broadcast"
|
||||
default n
|
||||
---help---
|
||||
Select to disable receipt of broadcast packets.
|
||||
|
||||
config SAMA5_EMAC_PHYADDR
|
||||
int "PHY address"
|
||||
default 1
|
||||
@ -1332,6 +1318,20 @@ config SAMA5_EMAC_PHYSR_100FD
|
||||
This must be provided if SAMA5_EMAC_AUTONEG is defined. This is the value
|
||||
under the bit mask that represents the 100Mbps, full duplex setting.
|
||||
|
||||
config SAMA5_EMACA_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 SAMA5_EMACA_NBC
|
||||
bool "Disable Broadcast"
|
||||
default n
|
||||
---help---
|
||||
Select to disable receipt of broadcast packets.
|
||||
|
||||
config SAMA5_EMACA_REGDEBUG
|
||||
bool "Register-Level Debug"
|
||||
default n
|
||||
|
@ -42,6 +42,13 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/* These two EMAC implementations differ in naming and in register layout but are
|
||||
* functionally equivalent. Here they are distinguished as 'A' and 'B'. For now,
|
||||
* the 'A' and 'B' drivers are kept separate (mostly because the 'B' driver needs
|
||||
* to support two EMAC blocks. But the 'B' driver should replace the 'A' driver
|
||||
* someday.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SAMA5_EMACA)
|
||||
# include "chip/sam_emaca.h"
|
||||
#elif defined(CONFIG_SAMA5_EMACB)
|
||||
|
@ -1,6 +1,9 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/sama5/sam_emaca.c
|
||||
*
|
||||
* 10/100 Base-T Ethernet driver for the SAMA5D3. Denoted as 'A' to
|
||||
* distinguish it from the SAMA5D4 EMAC driver.
|
||||
*
|
||||
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
@ -81,7 +84,7 @@
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_SAMA5_EMACA)
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Preprocessor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
@ -97,7 +100,7 @@
|
||||
# define CONFIG_SAMA5_EMAC_NTXBUFFERS 8
|
||||
#endif
|
||||
|
||||
#undef CONFIG_SAMA5_EMAC_NBC
|
||||
#undef CONFIG_SAMA5_EMACA_NBC
|
||||
|
||||
#ifndef CONFIG_SAMA5_EMAC_PHYADDR
|
||||
# error "CONFIG_SAMA5_EMAC_PHYADDR must be defined in the NuttX configuration"
|
||||
@ -290,7 +293,7 @@ struct sam_emac_s
|
||||
|
||||
static struct sam_emac_s g_emac;
|
||||
|
||||
#ifdef CONFIG_SAMA5_EMAC_PREALLOCATE
|
||||
#ifdef CONFIG_SAMA5_EMACA_PREALLOCATE
|
||||
/* Preallocated data */
|
||||
/* TX descriptors list */
|
||||
|
||||
@ -565,7 +568,7 @@ static uint16_t sam_txfree(struct sam_emac_s *priv)
|
||||
|
||||
static int sam_buffer_initialize(struct sam_emac_s *priv)
|
||||
{
|
||||
#ifdef CONFIG_SAMA5_EMAC_PREALLOCATE
|
||||
#ifdef CONFIG_SAMA5_EMACA_PREALLOCATE
|
||||
/* Use pre-allocated buffers */
|
||||
|
||||
priv->txdesc = g_txdesc;
|
||||
@ -643,7 +646,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
|
||||
|
||||
static void sam_buffer_free(struct sam_emac_s *priv)
|
||||
{
|
||||
#ifndef CONFIG_SAMA5_EMAC_PREALLOCATE
|
||||
#ifndef CONFIG_SAMA5_EMACA_PREALLOCATE
|
||||
/* Free allocated buffers */
|
||||
|
||||
if (priv->txdesc)
|
||||
@ -723,7 +726,7 @@ static int sam_transmit(struct sam_emac_s *priv)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/* Setup/Copy data to transmition buffer */
|
||||
/* Setup/Copy data to transmission buffer */
|
||||
|
||||
if (dev->d_len > 0)
|
||||
{
|
||||
@ -1086,7 +1089,9 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
||||
}
|
||||
}
|
||||
|
||||
/* We have not encount the SOF yet... discard this fragment and keep looking */
|
||||
/* We have not encountered the SOF yet... discard this fragment and
|
||||
* keep looking
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
@ -1230,7 +1235,7 @@ static void sam_txdone(struct sam_emac_s *priv)
|
||||
{
|
||||
struct emac_txdesc_s *txdesc;
|
||||
|
||||
/* Are there any outstanding transmssions? Loop until either (1) all of
|
||||
/* Are there any outstanding transmissions? Loop until either (1) all of
|
||||
* the TX have been examined, or (2) until we encounter the first
|
||||
* descriptor that is still in use by the hardware.
|
||||
*/
|
||||
@ -2525,7 +2530,7 @@ static int sam_phyinit(struct sam_emac_s *priv)
|
||||
* Function: sam_ethgpioconfig
|
||||
*
|
||||
* Description:
|
||||
* Configure GPIOs for the EMAC interface.
|
||||
* Configure PIOs for the EMAC interface.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - A reference to the private driver state structure
|
||||
@ -2824,7 +2829,7 @@ static int sam_emac_configure(struct sam_emac_s *priv)
|
||||
regval &= ~EMAC_NCFGR_CAF;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMA5_EMAC_NBC
|
||||
#ifdef CONFIG_SAMA5_EMACA_NBC
|
||||
regval |= EMAC_NCFGR_NBC;
|
||||
#else
|
||||
regval &= ~EMAC_NCFGR_NBC;
|
||||
@ -2895,7 +2900,7 @@ int sam_emac_initialize(void)
|
||||
priv->txpoll = wd_create();
|
||||
if (!priv->txpoll)
|
||||
{
|
||||
nlldbg("ERROR: Failed to create periodic poll timer\n");
|
||||
ndbg("ERROR: Failed to create periodic poll timer\n");
|
||||
ret = -EAGAIN;
|
||||
goto errout;
|
||||
}
|
||||
@ -2903,7 +2908,7 @@ int sam_emac_initialize(void)
|
||||
priv->txtimeout = wd_create(); /* Create TX timeout timer */
|
||||
if (!priv->txpoll)
|
||||
{
|
||||
nlldbg("ERROR: Failed to create periodic poll timer\n");
|
||||
ndbg("ERROR: Failed to create periodic poll timer\n");
|
||||
ret = -EAGAIN;
|
||||
goto errout_with_txpoll;
|
||||
}
|
||||
@ -2917,7 +2922,7 @@ int sam_emac_initialize(void)
|
||||
ret = sam_buffer_initialize(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
nlldbg("ERROR: sam_buffer_initialize failed: %d\n", ret);
|
||||
ndbg("ERROR: sam_buffer_initialize failed: %d\n", ret);
|
||||
goto errout_with_txtimeout;
|
||||
}
|
||||
|
||||
@ -2928,7 +2933,7 @@ int sam_emac_initialize(void)
|
||||
ret = irq_attach(SAM_IRQ_EMAC, sam_emac_interrupt);
|
||||
if (ret < 0)
|
||||
{
|
||||
nlldbg("ERROR: Failed to attach the handler to the IRQ%d\n", SAM_IRQ_EMAC);
|
||||
ndbg("ERROR: Failed to attach the handler to the IRQ%d\n", SAM_IRQ_EMAC);
|
||||
goto errout_with_buffers;
|
||||
}
|
||||
|
||||
@ -2941,7 +2946,7 @@ int sam_emac_initialize(void)
|
||||
ret = sam_ifdown(&priv->dev);
|
||||
if (ret < 0)
|
||||
{
|
||||
nlldbg("ERROR: Failed to put the interface in the down state: %d\n", ret);
|
||||
ndbg("ERROR: Failed to put the interface in the down state: %d\n", ret);
|
||||
goto errout_with_buffers;
|
||||
}
|
||||
|
||||
@ -2953,7 +2958,7 @@ int sam_emac_initialize(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
nlldbg("ERROR: netdev_register() failed: %d\n", ret);
|
||||
ndbg("ERROR: netdev_register() failed: %d\n", ret);
|
||||
|
||||
errout_with_buffers:
|
||||
sam_buffer_free(priv);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/sama5/sam_ethernet.h
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -78,6 +78,10 @@
|
||||
# error GMAC and EMAC cannot both be ETH0
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SAMA5_EMAC0_ISETH0) && defined(CONFIG_SAMA5_EMAC1_ISETH0)
|
||||
# error EMAC0 and EMAC2 cannot both be ETH0
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SAMA5_GMAC_ISETH0)
|
||||
# if defined(CONFIG_ETH0_PHY_DM9161)
|
||||
# define SAMA5_GMAC_PHY_DM9161 1
|
||||
@ -130,6 +134,58 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SAMA5_EMAC0_ISETH0)
|
||||
# if defined(CONFIG_ETH0_PHY_DM9161)
|
||||
# define SAMA5_EMAC0_PHY_DM9161 1
|
||||
# elif defined(CONFIG_ETH0_PHY_LAN8700)
|
||||
# define SAMA5_EMAC0_PHY_LAN8700 1
|
||||
# elif defined(CONFIG_ETH0_PHY_KSZ8051)
|
||||
# define SAMA5_EMAC0_PHY_KSZ8051 1
|
||||
# elif defined(CONFIG_ETH0_PHY_KSZ90x1)
|
||||
# define SAMA5_EMAC0_PHY_KSZ90x1 1
|
||||
# else
|
||||
# error ETH0 PHY unrecognized
|
||||
# endif
|
||||
#elif defined(CONFIG_SAMA5_EMAC0)
|
||||
# if defined(CONFIG_ETH1_PHY_DM9161)
|
||||
# define SAMA5_EMAC0_PHY_DM9161 1
|
||||
# elif defined(CONFIG_ETH1_PHY_LAN8700)
|
||||
# define SAMA5_EMAC0_PHY_LAN8700 1
|
||||
# elif defined(CONFIG_ETH1_PHY_KSZ8051)
|
||||
# define SAMA5_EMAC0_PHY_KSZ8051 1
|
||||
# elif defined(CONFIG_ETH1_PHY_KSZ90x1)
|
||||
# define SAMA5_EMAC0_PHY_KSZ90x1 1
|
||||
# else
|
||||
# error ETH1 PHY unrecognized
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SAMA5_EMAC1_ISETH0)
|
||||
# if defined(CONFIG_ETH0_PHY_DM9161)
|
||||
# define SAMA5_EMAC1_PHY_DM9161 1
|
||||
# elif defined(CONFIG_ETH0_PHY_LAN8700)
|
||||
# define SAMA5_EMAC1_PHY_LAN8700 1
|
||||
# elif defined(CONFIG_ETH0_PHY_KSZ8051)
|
||||
# define SAMA5_EMAC1_PHY_KSZ8051 1
|
||||
# elif defined(CONFIG_ETH0_PHY_KSZ90x1)
|
||||
# define SAMA5_EMAC1_PHY_KSZ90x1 1
|
||||
# else
|
||||
# error ETH0 PHY unrecognized
|
||||
# endif
|
||||
#elif defined(CONFIG_SAMA5_EMAC1)
|
||||
# if defined(CONFIG_ETH1_PHY_DM9161)
|
||||
# define SAMA5_EMAC1_PHY_DM9161 1
|
||||
# elif defined(CONFIG_ETH1_PHY_LAN8700)
|
||||
# define SAMA5_EMAC1_PHY_LAN8700 1
|
||||
# elif defined(CONFIG_ETH1_PHY_KSZ8051)
|
||||
# define SAMA5_EMAC1_PHY_KSZ8051 1
|
||||
# elif defined(CONFIG_ETH1_PHY_KSZ90x1)
|
||||
# define SAMA5_EMAC1_PHY_KSZ90x1 1
|
||||
# else
|
||||
# error ETH1 PHY unrecognized
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user