Add support for RMII in macb, cribbed slightly from the ate

driver. This is taken from the MAC at boot, but can be overridden with
'options AT91_MACB_USE_RMII'.

Switch to macb for HL201 and SAM9G20EK boards. It now works both
places. Also start to sneak up on FDT for the SAM9G20EK board, but
leave disabled due to issues with MMC that haven't been resolved.
Add early debug support for the SAM9G20EK since that is required
for FDT to work presently on these SoC.
This commit is contained in:
Warner Losh 2015-11-07 20:02:07 +00:00
parent 5d21db0905
commit 56ea9c7b08
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290509
6 changed files with 27 additions and 8 deletions

View File

@ -25,6 +25,7 @@
*/
#include "opt_platform.h"
#include "opt_at91.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@ -1359,8 +1360,14 @@ macb_attach(device_t dev)
sc->clock = sc->clock << 10;
#ifdef AT91_MACB_USE_RMII
sc->use_rmii = USRIO_RMII;
#else
sc->use_rmii = read_4(sc, EMAC_USRIO) & USRIO_RMII;
#endif
write_4(sc, EMAC_NCFGR, sc->clock);
write_4(sc, EMAC_USRIO, USRIO_CLOCK); //enable clock
write_4(sc, EMAC_USRIO, USRIO_CLOCK | sc->use_rmii); //enable clock
write_4(sc, EMAC_NCR, MPE_ENABLE); //enable MPE

View File

@ -99,7 +99,8 @@
#define CFG_DRFCS (1 << 17)
#define USRIO_CLOCK (1 << 1)
#define USRIO_RMII (1 << 0) /* RMII vs MII pins */
#define USRIO_CLOCK (1 << 1) /* Enable the clock! */

View File

@ -131,8 +131,8 @@ struct macb_softc
struct macb_chain_data macb_cdata;
int clock;
uint32_t use_rmii; /* 0 or USRIO_RMII */
};
#endif

View File

@ -70,7 +70,7 @@ options DDB # Enable the kernel debugger
#options BOOTP_NFSROOT
#options BOOTP_COMPAT
#options BOOTP_NFSV3
#options BOOTP_WIRED_TO=ate0
#options BOOTP_WIRED_TO=macb0
options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\"
@ -87,7 +87,7 @@ device bpf # Berkeley packet filter
# Ethernet
device mii # Minimal MII support
device ate # Atmel AT91 Ethernet driver
device macb # Atmel AT91 Ethernet driver
device lxtphy
# I2C

View File

@ -23,6 +23,14 @@ ident SAM9G20EK
include "std.arm"
include "../at91/std.sam9g20ek"
#options FDT
#options FDT_DTB_STATIC
#makeoptions FDT_DTS_FILE=at91sam9g20ek.dts
options EARLY_PRINTF
options SOCDEV_PA=0xfc000000
options SOCDEV_VA=0xdc000000
#To statically compile in device wiring instead of /boot/device.hints
hints "SAM9G20EK.hints"
makeoptions MODULES_OVERRIDE=""
@ -92,8 +100,10 @@ device bpf # Berkeley packet filter
# Ethernet
device mii # Minimal MII support
device ate # Atmel AT91 Ethernet driver
options AT91_ATE_USE_RMII
#device ate # Atmel AT91 Ethernet driver
#options AT91_ATE_USE_RMII
device macb # Atmel AT91 Ethernet driver
options AT91_MACB_USE_RMII
# I2C
device at91_twi # Atmel AT91 Two-wire Interface

View File

@ -62,6 +62,7 @@ XSACLE_DISABLE_CCNT opt_timer.h
VERBOSE_INIT_ARM opt_global.h
VM_MAXUSER_ADDRESS opt_global.h
AT91_ATE_USE_RMII opt_at91.h
AT91_MACB_USE_RMII opt_at91.h
AT91_MCI_ALLOW_OVERCLOCK opt_at91.h
AT91_MCI_HAS_4WIRE opt_at91.h
AT91_MCI_SLOT_B opt_at91.h