Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Nov 2015 20:02:07 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r290509 - in head/sys: arm/at91 arm/conf conf
Message-ID:  <201511072002.tA7K27DI064330@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Nov  7 20:02:07 2015
New Revision: 290509
URL: https://svnweb.freebsd.org/changeset/base/290509

Log:
  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.

Modified:
  head/sys/arm/at91/if_macb.c
  head/sys/arm/at91/if_macbreg.h
  head/sys/arm/at91/if_macbvar.h
  head/sys/arm/conf/HL201
  head/sys/arm/conf/SAM9G20EK
  head/sys/conf/options.arm

Modified: head/sys/arm/at91/if_macb.c
==============================================================================
--- head/sys/arm/at91/if_macb.c	Sat Nov  7 19:54:40 2015	(r290508)
+++ head/sys/arm/at91/if_macb.c	Sat Nov  7 20:02:07 2015	(r290509)
@@ -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
 

Modified: head/sys/arm/at91/if_macbreg.h
==============================================================================
--- head/sys/arm/at91/if_macbreg.h	Sat Nov  7 19:54:40 2015	(r290508)
+++ head/sys/arm/at91/if_macbreg.h	Sat Nov  7 20:02:07 2015	(r290509)
@@ -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! */
 
 
 

Modified: head/sys/arm/at91/if_macbvar.h
==============================================================================
--- head/sys/arm/at91/if_macbvar.h	Sat Nov  7 19:54:40 2015	(r290508)
+++ head/sys/arm/at91/if_macbvar.h	Sat Nov  7 20:02:07 2015	(r290509)
@@ -131,8 +131,8 @@ struct macb_softc
 
 	struct macb_chain_data	macb_cdata;
 	int clock;
-};
-
 
+	uint32_t use_rmii; /* 0 or USRIO_RMII */
+};
 
 #endif

Modified: head/sys/arm/conf/HL201
==============================================================================
--- head/sys/arm/conf/HL201	Sat Nov  7 19:54:40 2015	(r290508)
+++ head/sys/arm/conf/HL201	Sat Nov  7 20:02:07 2015	(r290509)
@@ -70,7 +70,7 @@ options 	DDB			# Enable the kernel debug
 #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

Modified: head/sys/arm/conf/SAM9G20EK
==============================================================================
--- head/sys/arm/conf/SAM9G20EK	Sat Nov  7 19:54:40 2015	(r290508)
+++ head/sys/arm/conf/SAM9G20EK	Sat Nov  7 20:02:07 2015	(r290509)
@@ -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

Modified: head/sys/conf/options.arm
==============================================================================
--- head/sys/conf/options.arm	Sat Nov  7 19:54:40 2015	(r290508)
+++ head/sys/conf/options.arm	Sat Nov  7 20:02:07 2015	(r290509)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511072002.tA7K27DI064330>