Skip to contentSkip to conversation

Network support for Calxeda highbank

PATCH Superseded Rob Herring 3 participants 23 messages Dec 2, 2011 – Jan 5, 2012 Network drivers

lore
Share & tools
lore
#0 lore raw

cover Network support for Calxeda highbank

From: Rob Herring <[email protected]>

This series adds the Calxeda xgmac ethernet driver and enables networking options on the highbank platform.

Rob

Rob Herring (2):
net: add Calxeda xgmac driver
ARM: highbank: enable networking and pxe

 README                     |    6 +
 board/highbank/highbank.c  |   14 ++
 drivers/net/Makefile       |    1 +
 drivers/net/calxedaxgmac.c |  552 ++++++++++++++++++++++++++++++++++++++++++++
 include/configs/highbank.h |   19 ++-
 include/netdev.h           |    1 +
 6 files changed, 591 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/calxedaxgmac.c
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/2 net: add Calxeda xgmac driver

From: Rob Herring <[email protected]>

This adds ethernet driver for Calxeda xgmac found on Highbank SOC.

---
 README                     |    6 +
 drivers/net/Makefile       |    1 +
 drivers/net/calxedaxgmac.c |  552 ++++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h           |    1 +
 4 files changed, 560 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/calxedaxgmac.c
README +6 -0
index fda0190..43a48ed 100644
@@ -1003,6 +1003,12 @@ The following options need to be configured:
 			If this defined, the driver is quiet.
 			The driver doen't show link status messages.
 
+		CONFIG_CALXEDA_XGMAC
+		Support for the Calxeda XGMAC adapter
+			CONFIG_CALXEDA_XGMAC_BASE
+			Define this to hold the physical address
+			of the device (I/O space)
+
 		CONFIG_DRIVER_LAN91C96
 		Support for SMSC's LAN91C96 chips.
 
drivers/net/Makefile +1 -0
index d3df82e..f4f7ea3 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_ARMADA100_FEC) += armada100_fec.o
 COBJS-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
 COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
 COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
+COBJS-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
 COBJS-$(CONFIG_CS8900) += cs8900.o
 COBJS-$(CONFIG_TULIP) += dc2114x.o
 COBJS-$(CONFIG_DESIGNWARE_ETH) += designware.o
drivers/net/calxedaxgmac.c new file +552 -0

552 lines not on this page · raw message

include/netdev.h +1 -0
index 04d9f75..96e9f8f 100644
@@ -48,6 +48,7 @@ int at91emac_register(bd_t *bis, unsigned long iobase);
 int au1x00_enet_initialize(bd_t*);
 int ax88180_initialize(bd_t *bis);
 int bfin_EMAC_initialize(bd_t *bis);
+int calxedaxgmac_initialize(u32 id, ulong base_addr);
 int cs8900_initialize(u8 dev_num, int base_addr);
 int davinci_emac_initialize(void);
 int dc21x4x_initialize(bd_t *bis);
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 1/2 net: add Calxeda xgmac driver

drivers/net/calxedaxgmac.c

Quoted 4 lines · On Friday 02 December 2011 15:21:48 Rob Herring wrote:
drivers/net/calxedaxgmac.c new file +1 -0
 
+	writel(value, dev->iobase + XGMAC_CORE_CONFIG);

you should declare a C struct that represents the hardware's register layout, and then use that rather than iobase+register_offset

drivers/net/calxedaxgmac.c line 382

Quoted 8 lines
drivers/net/calxedaxgmac.c new file +7 -0
+static int xgmac_init(struct eth_device *dev, bd_t * bis)
+{
...
+	/* check that there is a valid MAC address */
+	if (memcmp(dev->enetaddr, "\0\0\0\0\0\0", 6) == 0) {
+		printf("ERROR: ethaddr not set!\n");
+		return -1;
+	}

i'd just omit this

drivers/net/calxedaxgmac.c line 520

Quoted 4 lines
drivers/net/calxedaxgmac.c new file +3 -0
+int calxedaxgmac_initialize(u32 id, ulong base_addr)
+{
...
+	priv = (struct calxeda_eth_dev *)memalign(32, sizeof(*priv));

no need for the cast

drivers/net/calxedaxgmac.c line 523

Quoted 3 lines
drivers/net/calxedaxgmac.c new file +3 -0
+	if (!priv) {
+		free(dev);
+		return -ENOMEM;

return 0

drivers/net/calxedaxgmac.c line 531

Quoted 2 lines
drivers/net/calxedaxgmac.c new file +2 -0
+	if (readl(dev->iobase + XGMAC_CORE_VERSION) != 0x1012)
+		return -EINVAL;

return -1

drivers/net/calxedaxgmac.c line 537

Quoted 3 lines
drivers/net/calxedaxgmac.c new file +3 -0
+	macaddr[1] = readl(dev->iobase + XGMAC_CORE_MACADDR0HI);
+	macaddr[0] = readl(dev->iobase + XGMAC_CORE_MACADDR0LO);
+	memcpy(dev->enetaddr, macaddr, 6);

does the initial mac regs really start off with useful info ?

drivers/net/calxedaxgmac.c line 539

Quoted 2 lines
drivers/net/calxedaxgmac.c new file +2 -0
+	sprintf(enetvar, id ? "eth%daddr" : "ethaddr", id);
+	eth_setenv_enetaddr(enetvar, dev->enetaddr);

NAK: delete this
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111202/c795e902/attachment.pgp>

#3 lore raw

PATCH 1/2 net: add Calxeda xgmac driver

Mike,

Thanks for your quick review.

Quoted 9 lines · Mike Frysinger

drivers/net/calxedaxgmac.c

Quoted 4 lines · On Friday 02 December 2011 15:21:48 Rob Herring wrote:
drivers/net/calxedaxgmac.c new file +1 -0
 
+	writel(value, dev->iobase + XGMAC_CORE_CONFIG);

you should declare a C struct that represents the hardware's register layout, and then use that rather than iobase+register_offset

Is that a suggestion or u-boot mandate? Because the Linux version of the driver does it the current way already, it's certainly done both ways in u-boot drivers already and personally I really don't like structs for register offsets.

...

Quoted 5 lines

drivers/net/calxedaxgmac.c line 537

Quoted 3 lines
drivers/net/calxedaxgmac.c new file +3 -0
+	macaddr[1] = readl(dev->iobase + XGMAC_CORE_MACADDR0HI);
+	macaddr[0] = readl(dev->iobase + XGMAC_CORE_MACADDR0LO);
+	memcpy(dev->enetaddr, macaddr, 6);

does the initial mac regs really start off with useful info ?

Yes. It contains the only value that will work.

Quoted 4 lines

drivers/net/calxedaxgmac.c line 539

Quoted 2 lines
drivers/net/calxedaxgmac.c new file +2 -0
+	sprintf(enetvar, id ? "eth%daddr" : "ethaddr", id);
+	eth_setenv_enetaddr(enetvar, dev->enetaddr);

NAK: delete this

PXE boot needs the MAC address to generate filenames and gets it from the env. See format_mac_pxe function in common/cmd_pxe.c. Should that be done differently? The user setting a MAC address on our platform won't work, so using the env setting as an override is not valid.

Rob

#4 lore raw

PATCH 1/2 net: add Calxeda xgmac driver

Quoted 10 lines · On Friday 02 December 2011 17:02:00 Rob Herring wrote:
Quoted 8 lines · Mike Frysinger

drivers/net/calxedaxgmac.c

Quoted 4 lines · On Friday 02 December 2011 15:21:48 Rob Herring wrote:
drivers/net/calxedaxgmac.c new file +1 -0
 
+	writel(value, dev->iobase + XGMAC_CORE_CONFIG);

you should declare a C struct that represents the hardware's register layout, and then use that rather than iobase+register_offset

Quoted 4 lines

Is that a suggestion or u-boot mandate? Because the Linux version of the driver does it the current way already, it's certainly done both ways in u-boot drivers already and personally I really don't like structs for register offsets.

i think Wolfgang would tell you it's a mandate, and code you see using register offsets are the old style that should get updated. sorry.

Quoted 7 lines
Quoted 5 lines

drivers/net/calxedaxgmac.c line 537

Quoted 3 lines
drivers/net/calxedaxgmac.c new file +3 -0
+	macaddr[1] = readl(dev->iobase + XGMAC_CORE_MACADDR0HI);
+	macaddr[0] = readl(dev->iobase + XGMAC_CORE_MACADDR0LO);
+	memcpy(dev->enetaddr, macaddr, 6);

does the initial mac regs really start off with useful info ?

Yes. It contains the only value that will work.

what i mean is that on embedded peripheral blocks, the device powers on with blank register settings and the core needs to program them. how did your device get a mac address already programmed into it ? did something run before u-boot and initialize the registers ? does the hardware block preseed the registers itself by talking to some internal storage ? certainly the mac address isn't programmed into the hardware block itself :).

Quoted 9 lines
Quoted 4 lines

drivers/net/calxedaxgmac.c line 539

Quoted 2 lines
drivers/net/calxedaxgmac.c new file +2 -0
+	sprintf(enetvar, id ? "eth%daddr" : "ethaddr", id);
+	eth_setenv_enetaddr(enetvar, dev->enetaddr);

NAK: delete this

PXE boot needs the MAC address to generate filenames and gets it from the env. See format_mac_pxe function in common/cmd_pxe.c. Should that be done differently? The user setting a MAC address on our platform won't work, so using the env setting as an override is not valid.

device drivers should not be touching the env. common code takes care of that. your driver should only be writing dev->enetaddr.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111202/efd292c4/attachment.pgp>

#5 lore raw

PATCH 1/2 net: add Calxeda xgmac driver

Quoted 25 lines · Mike Frysinger
Quoted 10 lines · On Friday 02 December 2011 17:02:00 Rob Herring wrote:
Quoted 8 lines · Mike Frysinger

drivers/net/calxedaxgmac.c

Quoted 4 lines · On Friday 02 December 2011 15:21:48 Rob Herring wrote:
drivers/net/calxedaxgmac.c new file +1 -0
 
+	writel(value, dev->iobase + XGMAC_CORE_CONFIG);

you should declare a C struct that represents the hardware's register layout, and then use that rather than iobase+register_offset

Quoted 4 lines

Is that a suggestion or u-boot mandate? Because the Linux version of the driver does it the current way already, it's certainly done both ways in u-boot drivers already and personally I really don't like structs for register offsets.

i think Wolfgang would tell you it's a mandate, and code you see using register offsets are the old style that should get updated. sorry.

Quoted 6 lines
Quoted 5 lines

drivers/net/calxedaxgmac.c line 537

Quoted 3 lines
drivers/net/calxedaxgmac.c new file +3 -0
+	macaddr[1] = readl(dev->iobase + XGMAC_CORE_MACADDR0HI);
+	macaddr[0] = readl(dev->iobase + XGMAC_CORE_MACADDR0LO);
+	memcpy(dev->enetaddr, macaddr, 6);

does the initial mac regs really start off with useful info ?

Quoted 8 lines
Quoted 1 line

Yes. It contains the only value that will work.

what i mean is that on embedded peripheral blocks, the device powers on with blank register settings and the core needs to program them. how did your device get a mac address already programmed into it ? did something run before u-boot and initialize the registers ? does the hardware block preseed the registers itself by talking to some internal storage ? certainly the mac address isn't programmed into the hardware block itself :).

Something else runs and sets it up and u-boot does not have access to it.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

drivers/net/calxedaxgmac.c line 539

Quoted 2 lines
drivers/net/calxedaxgmac.c new file +2 -0
+	sprintf(enetvar, id ? "eth%daddr" : "ethaddr", id);
+	eth_setenv_enetaddr(enetvar, dev->enetaddr);

NAK: delete this

Quoted 7 lines
Quoted 4 lines

PXE boot needs the MAC address to generate filenames and gets it from the env. See format_mac_pxe function in common/cmd_pxe.c. Should that be done differently? The user setting a MAC address on our platform won't work, so using the env setting as an override is not valid.

device drivers should not be touching the env. common code takes care of that. your driver should only be writing dev->enetaddr.

The common code does not set the env setting. The env setting is normally an override of the h/w value and may not even exist. So how should the pxe boot command get the MAC address?

- move setting of ethXaddr env to the highbank board file
- Have PXE call eth_get_dev and get it directly from struct eth_device.

The latter is the only way to enable all boards at once.

Rob

#6 lore raw

PATCH 1/2 net: add Calxeda xgmac driver

Quoted 20 lines · On Friday 02 December 2011 17:46:39 Rob Herring wrote:
Quoted 11 lines · Mike Frysinger
Quoted 9 lines · On Friday 02 December 2011 17:02:00 Rob Herring wrote:
Quoted 6 lines · Mike Frysinger

drivers/net/calxedaxgmac.c line 537

Quoted 3 lines · On Friday 02 December 2011 15:21:48 Rob Herring wrote:
drivers/net/calxedaxgmac.c new file +3 -0
+	macaddr[1] = readl(dev->iobase + XGMAC_CORE_MACADDR0HI);
+	macaddr[0] = readl(dev->iobase + XGMAC_CORE_MACADDR0LO);
+	memcpy(dev->enetaddr, macaddr, 6);

does the initial mac regs really start off with useful info ?

Yes. It contains the only value that will work.

Quoted 7 lines

what i mean is that on embedded peripheral blocks, the device powers on with blank register settings and the core needs to program them. how did your device get a mac address already programmed into it ? did something run before u-boot and initialize the registers ? does the hardware block preseed the registers itself by talking to some internal storage ? certainly the mac address isn't programmed into the hardware block itself :).

Quoted 1 line

Something else runs and sets it up and u-boot does not have access to it.

isn't this a board-specific assumption ? shouldn't those lines be protected by a CONFIG_xxx ifdef that boards can enable as they see fit ?

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

drivers/net/calxedaxgmac.c line 539

Quoted 2 lines
drivers/net/calxedaxgmac.c new file +2 -0
+	sprintf(enetvar, id ? "eth%daddr" : "ethaddr", id);
+	eth_setenv_enetaddr(enetvar, dev->enetaddr);

NAK: delete this

Quoted 7 lines
Quoted 4 lines

PXE boot needs the MAC address to generate filenames and gets it from the env. See format_mac_pxe function in common/cmd_pxe.c. Should that be done differently? The user setting a MAC address on our platform won't work, so using the env setting as an override is not valid.

device drivers should not be touching the env. common code takes care of that. your driver should only be writing dev->enetaddr.

Quoted 8 lines

The common code does not set the env setting. The env setting is normally an override of the h/w value and may not even exist. So how should the pxe boot command get the MAC address?

- move setting of ethXaddr env to the highbank board file
- Have PXE call eth_get_dev and get it directly from struct eth_device.

The latter is the only way to enable all boards at once.

i vaguely recall someone else mentioning this, but it doesn't change the driver logic. no net driver may touch the env, FIN. we can talk about improving the core/common net code. but let's do so in a dedicated thread. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111202/54e86324/attachment.pgp>

#7 lore raw

PATCH 2/2 ARM: highbank: enable networking and pxe

In reply to Rob Herring

From: Rob Herring <[email protected]>

This enables the XGMAC ethernet driver and networking related config options.

---
 board/highbank/highbank.c  |   14 ++++++++++++++
 include/configs/highbank.h |   19 +++++++++++++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)
board/highbank/highbank.c +14 -0
index 8db8a2b..1802c67 100644
@@ -33,8 +33,22 @@ int board_init(void)
 	return 0;
 }
 
+/* We know all the init functions have been run now */
+int board_eth_init(bd_t *bis)
+{
+	int rc = 0;
+
+#ifdef CONFIG_CALXEDA_XGMAC
+	rc = calxedaxgmac_initialize(0, 0xfff50000);
+	rc |= calxedaxgmac_initialize(1, 0xfff51000);
+#endif
+	return rc;
+}
+
 int misc_init_r(void)
 {
+	setenv("verify", "n");
+
 	ahci_init(0xffe08000);
 	scsi_scan(1);
 	return 0;
include/configs/highbank.h +17 -2
index 9c85788..01c128b 100644
@@ -51,19 +51,28 @@
 
 #define CONFIG_DOS_PARTITION
 
+#define CONFIG_NET_MULTI
+#define CONFIG_CALXEDA_XGMAC
+
+/* PXE support */
+#define CONFIG_BOOTP_PXE
+#define CONFIG_BOOTP_PXE_CLIENTARCH	0x100
+#define CONFIG_BOOTP_VCI_STRING		"U-boot.armv7.highbank"
+
 /*
  * Command line configuration.
  */
 #include <config_cmd_default.h>
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_NFS
 
 #define CONFIG_CMD_BDI
+#define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_LOADS
 #define CONFIG_CMD_SCSI
 #define CONFIG_CMD_EXT2
+#define CONFIG_CMD_PXE
+#define CONFIG_MENU
 
 #define CONFIG_BOOTDELAY		2
 /*
@@ -82,6 +91,12 @@
 
 #define CONFIG_SYS_LOAD_ADDR		0x800000
 
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+		"fdtaddr_r=0x600000\0" \
+		"pxefile_addr_r=0x700000\0" \
+		"kernel_addr_r=0x800000\0" \
+		"ramdisk_addr_r=0x01000000\0" \
+
 /*-----------------------------------------------------------------------
  * Stack sizes
  *
Signature · 1 line
1.7.5.4
#8 lore raw

PATCH 2/2 ARM: highbank: enable networking and pxe

board/highbank/highbank.c int board_init(void) · line 50

Quoted 3 lines · On Friday 02 December 2011 15:21:49 Rob Herring wrote:

int misc_init_r(void)
{

board/highbank/highbank.c +1 -0
+	setenv("verify", "n");

looks unrelated ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111202/e0e2512c/attachment.pgp>

#9 lore raw

PATCH 2/2 ARM: highbank: enable networking and pxe

Quoted 6 lines · Mike Frysinger

board/highbank/highbank.c int board_init(void) · line 50

Quoted 3 lines · On Friday 02 December 2011 15:21:49 Rob Herring wrote:

int misc_init_r(void)
{

board/highbank/highbank.c +1 -0
+	setenv("verify", "n");

looks unrelated ?

Yes. I meant to delete that...

Rob

#10 lore raw

PATCH 2/2 ARM: highbank: enable networking and pxe

In reply to Rob Herring

include/configs/highbank.h line 54

Quoted 4 lines · On Friday 02 December 2011 15:21:49 Rob Herring wrote:
include/configs/highbank.h +1 -0
 
+#define CONFIG_NET_MULTI

this define no longer exists, so delete it
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111202/fe2cae84/attachment.pgp>

#11 lore raw

PATCH v2 1/2 net: add Calxeda xgmac driver

In reply to Rob Herring

From: Rob Herring <[email protected]>

This adds ethernet driver for Calxeda xgmac found on Highbank SOC.

---
v2:
-Convert register base plus offset to a struct
-drop ethaddr env setting
-drop valid mac address check
-fix return values

 README                     |    3 +
 drivers/net/Makefile       |    1 +
 drivers/net/calxedaxgmac.c |  554 ++++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h           |    1 +
 4 files changed, 559 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/calxedaxgmac.c
README +3 -0
index fda0190..c7b6264 100644
@@ -1003,6 +1003,9 @@ The following options need to be configured:
 			If this defined, the driver is quiet.
 			The driver doen't show link status messages.
 
+		CONFIG_CALXEDA_XGMAC
+		Support for the Calxeda XGMAC device
+
 		CONFIG_DRIVER_LAN91C96
 		Support for SMSC's LAN91C96 chips.
 
drivers/net/Makefile +1 -0
index d3df82e..f4f7ea3 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_ARMADA100_FEC) += armada100_fec.o
 COBJS-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
 COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
 COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
+COBJS-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
 COBJS-$(CONFIG_CS8900) += cs8900.o
 COBJS-$(CONFIG_TULIP) += dc2114x.o
 COBJS-$(CONFIG_DESIGNWARE_ETH) += designware.o
drivers/net/calxedaxgmac.c new file +554 -0

554 lines not on this page · raw message

include/netdev.h +1 -0
index 04d9f75..96e9f8f 100644
@@ -48,6 +48,7 @@ int at91emac_register(bd_t *bis, unsigned long iobase);
 int au1x00_enet_initialize(bd_t*);
 int ax88180_initialize(bd_t *bis);
 int bfin_EMAC_initialize(bd_t *bis);
+int calxedaxgmac_initialize(u32 id, ulong base_addr);
 int cs8900_initialize(u8 dev_num, int base_addr);
 int davinci_emac_initialize(void);
 int dc21x4x_initialize(bd_t *bis);
Signature · 1 line
1.7.5.4
#12 lore raw

PATCH v2 2/2 ARM: highbank: enable networking and pxe

From: Rob Herring <[email protected]>

This enables the XGMAC ethernet driver and networking related config options.

---
v2:
-drop CONFIG_NET_MULTI
-drop leftover 'verify' env setting

 board/highbank/highbank.c  |   12 ++++++++++++
 include/configs/highbank.h |   18 ++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)
board/highbank/highbank.c +12 -0
index 8db8a2b..0fa363d 100644
@@ -33,6 +33,18 @@ int board_init(void)
 	return 0;
 }
 
+/* We know all the init functions have been run now */
+int board_eth_init(bd_t *bis)
+{
+	int rc = 0;
+
+#ifdef CONFIG_CALXEDA_XGMAC
+	rc = calxedaxgmac_initialize(0, 0xfff50000);
+	rc |= calxedaxgmac_initialize(1, 0xfff51000);
+#endif
+	return rc;
+}
+
 int misc_init_r(void)
 {
 	ahci_init(0xffe08000);
include/configs/highbank.h +16 -2
index 9c85788..5604733 100644
@@ -51,19 +51,27 @@
 
 #define CONFIG_DOS_PARTITION
 
+#define CONFIG_CALXEDA_XGMAC
+
+/* PXE support */
+#define CONFIG_BOOTP_PXE
+#define CONFIG_BOOTP_PXE_CLIENTARCH	0x100
+#define CONFIG_BOOTP_VCI_STRING		"U-boot.armv7.highbank"
+
 /*
  * Command line configuration.
  */
 #include <config_cmd_default.h>
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_NFS
 
 #define CONFIG_CMD_BDI
+#define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_LOADS
 #define CONFIG_CMD_SCSI
 #define CONFIG_CMD_EXT2
+#define CONFIG_CMD_PXE
+#define CONFIG_MENU
 
 #define CONFIG_BOOTDELAY		2
 /*
@@ -82,6 +90,12 @@
 
 #define CONFIG_SYS_LOAD_ADDR		0x800000
 
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+		"fdtaddr_r=0x600000\0" \
+		"pxefile_addr_r=0x700000\0" \
+		"kernel_addr_r=0x800000\0" \
+		"ramdisk_addr_r=0x01000000\0" \
+
 /*-----------------------------------------------------------------------
  * Stack sizes
  *
Signature · 1 line
1.7.5.4
#13 lore raw

PATCH v2 2/2 ARM: highbank: enable networking and pxe

board/highbank/highbank.c int board_init(void) · line 43

Quoted 10 lines · On Wednesday 07 December 2011 12:56:52 Rob Herring wrote:
board/highbank/highbank.c +7 -0
 
+int board_eth_init(bd_t *bis)
+{
+	int rc = 0;
+
+#ifdef CONFIG_CALXEDA_XGMAC
+	rc = calxedaxgmac_initialize(0, 0xfff50000);
+	rc |= calxedaxgmac_initialize(1, 0xfff51000);

this should be returning the # of devices registered ...

include/configs/highbank.h line 98

Quoted 9 lines
include/configs/highbank.h +6 -0
 
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+		"fdtaddr_r=0x600000\0" \
+		"pxefile_addr_r=0x700000\0" \
+		"kernel_addr_r=0x800000\0" \
+		"ramdisk_addr_r=0x01000000\0" \
+

no need for that last "\" since there's nothing after the ramdisk_addr line -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111208/9366b26e/attachment.pgp>

#14 lore raw

PATCH v2 1/2 net: add Calxeda xgmac driver

In reply to Rob Herring
Quoted 24 lines · On Wednesday 07 December 2011 12:56:51 Rob Herring wrote:
drivers/net/calxedaxgmac.c new file +21 -0
 
+struct xgmac_regs {
+	u32 config;
+	u32 framefilter;
+	u32 resv_1[4];
+	u32 flow_control;
+	u32 vlantag;
+	u32 version;
+	u32 vlaninclude;
+	u32 resv_2[2];
+	u32 pacestretch;
+	u32 vlanhash;
+	u32 resv_3;
+	u32 intreg;
+	struct {
+		u32 hi;         /* 0x40 */
+		u32 lo;         /* 0x44 */
+	} macaddr[16];
+	u32 resv_4[0xd0];
+        u32 core_opmode;	/* 0x400 */
+	u32 resv_5[0x2bf];
+        u32 busmode;		/* 0xf00 */

drivers/net/calxedaxgmac.c line 212

Quoted 10 lines
drivers/net/calxedaxgmac.c new file +10 -0
+        u32 txpoll;
+        u32 rxpoll;
+        u32 rxdesclist;
+        u32 txdesclist;
+        u32 dma_status;
+        u32 dma_opmode;
+        u32 intenable;
+	u32 resv_6[2];
+        u32 axi_mode;		/* 0xf28 */
+};

seems to mix tabs/spaces. should be fixed to be tabs only.

drivers/net/calxedaxgmac.c line 338

Quoted 4 lines
drivers/net/calxedaxgmac.c new file +3 -0
+static void init_rx_desc(struct calxeda_eth_dev *priv)
+{
...
+	};

delete that semicolon

drivers/net/calxedaxgmac.c line 513

Quoted 4 lines
drivers/net/calxedaxgmac.c new file +3 -0
+int calxedaxgmac_initialize(u32 id, ulong base_addr)
+{
...
+	char enetvar[32];

this is unused now. does this code compile warning-free ?

drivers/net/calxedaxgmac.c line 523

Quoted 3 lines
drivers/net/calxedaxgmac.c new file +3 -0
+	dev = malloc(sizeof(*dev));
+	if (!dev)
+		return -ENOMEM;

return 0

drivers/net/calxedaxgmac.c line 548

Quoted 1 line
drivers/net/calxedaxgmac.c new file +1 -0
+	if (xgmac_reset(dev) < 0) {

you shouldn't be resetting in the registration function. this belongs in your init func.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111208/1cf08421/attachment.pgp>

#15 lore raw

PATCH v3 1/2 net: add Calxeda xgmac driver

In reply to Rob Herring

From: Rob Herring <[email protected]>

This adds ethernet driver for Calxeda xgmac found on Highbank SOC.

---
v3:
- whitespace fixes
- move reset to .init function
- fix calxedaxgmac_initialize return values
- fix 2 build warnings

v2:
-Convert register base plus offset to struct
-drop ethaddr env setting
-drop valid mac address check

 README                     |    3 +
 drivers/net/Makefile       |    1 +
 drivers/net/calxedaxgmac.c |  553 ++++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h           |    1 +
 4 files changed, 558 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/calxedaxgmac.c
README +3 -0
index ff72e47..8434ebb 100644
@@ -1020,6 +1020,9 @@ The following options need to be configured:
 			If this defined, the driver is quiet.
 			The driver doen't show link status messages.
 
+		CONFIG_CALXEDA_XGMAC
+		Support for the Calxeda XGMAC device
+
 		CONFIG_DRIVER_LAN91C96
 		Support for SMSC's LAN91C96 chips.
 
drivers/net/Makefile +1 -0
index d3df82e..f4f7ea3 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_ARMADA100_FEC) += armada100_fec.o
 COBJS-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
 COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
 COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
+COBJS-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
 COBJS-$(CONFIG_CS8900) += cs8900.o
 COBJS-$(CONFIG_TULIP) += dc2114x.o
 COBJS-$(CONFIG_DESIGNWARE_ETH) += designware.o
drivers/net/calxedaxgmac.c new file +553 -0

553 lines not on this page · raw message

include/netdev.h +1 -0
index 150fa8e..b0c21d5 100644
@@ -48,6 +48,7 @@ int at91emac_register(bd_t *bis, unsigned long iobase);
 int au1x00_enet_initialize(bd_t*);
 int ax88180_initialize(bd_t *bis);
 int bfin_EMAC_initialize(bd_t *bis);
+int calxedaxgmac_initialize(u32 id, ulong base_addr);
 int cs8900_initialize(u8 dev_num, int base_addr);
 int davinci_emac_initialize(void);
 int dc21x4x_initialize(bd_t *bis);
Signature · 1 line
1.7.5.4
#16 lore raw

PATCH v3 2/2 ARM: highbank: enable networking and pxe

From: Rob Herring <[email protected]>

This enables the XGMAC ethernet driver and networking related config options.

---
v3:
- make board_eth_init return number of devices initialized

v2:
-drop CONFIG_NET_MULTI
-drop leftover 'verify' env setting

 board/highbank/highbank.c  |   12 ++++++++++++
 include/configs/highbank.h |   18 ++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)
board/highbank/highbank.c +12 -0
index 8db8a2b..b0aa182 100644
@@ -33,6 +33,18 @@ int board_init(void)
 	return 0;
 }
 
+/* We know all the init functions have been run now */
+int board_eth_init(bd_t *bis)
+{
+	int rc = 0;
+
+#ifdef CONFIG_CALXEDA_XGMAC
+	rc += calxedaxgmac_initialize(0, 0xfff50000);
+	rc += calxedaxgmac_initialize(1, 0xfff51000);
+#endif
+	return rc;
+}
+
 int misc_init_r(void)
 {
 	ahci_init(0xffe08000);
include/configs/highbank.h +16 -2
index 9c85788..5604733 100644
@@ -51,19 +51,27 @@
 
 #define CONFIG_DOS_PARTITION
 
+#define CONFIG_CALXEDA_XGMAC
+
+/* PXE support */
+#define CONFIG_BOOTP_PXE
+#define CONFIG_BOOTP_PXE_CLIENTARCH	0x100
+#define CONFIG_BOOTP_VCI_STRING		"U-boot.armv7.highbank"
+
 /*
  * Command line configuration.
  */
 #include <config_cmd_default.h>
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_NFS
 
 #define CONFIG_CMD_BDI
+#define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_LOADS
 #define CONFIG_CMD_SCSI
 #define CONFIG_CMD_EXT2
+#define CONFIG_CMD_PXE
+#define CONFIG_MENU
 
 #define CONFIG_BOOTDELAY		2
 /*
@@ -82,6 +90,12 @@
 
 #define CONFIG_SYS_LOAD_ADDR		0x800000
 
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+		"fdtaddr_r=0x600000\0" \
+		"pxefile_addr_r=0x700000\0" \
+		"kernel_addr_r=0x800000\0" \
+		"ramdisk_addr_r=0x01000000\0" \
+
 /*-----------------------------------------------------------------------
  * Stack sizes
  *
Signature · 1 line
1.7.5.4
#17 lore raw

PATCH v3 2/2 ARM: highbank: enable networking and pxe

Dear Rob Herring,

Quoted 13 lines · In message <[email protected]> you wrote:

From: Rob Herring <[email protected]>

This enables the XGMAC ethernet driver and networking related config options.

---
v3:
- make board_eth_init return number of devices initialized

v2:

Review

Quoted 6 lines
(quoted diff) +0 -2
-drop CONFIG_NET_MULTI
-drop leftover 'verify' env setting
 
 board/highbank/highbank.c  |   12 ++++++++++++
 include/configs/highbank.h |   18 ++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
C++ was an interesting and valuable experiment, but we've learned its
lessons and it's time to move on.
                            - Peter Curran in <[email protected]>
#18 lore raw

PATCH v3 1/2 net: add Calxeda xgmac driver

In reply to Rob Herring

Dear Rob Herring,

Quoted 13 lines · In message <[email protected]> you wrote:

From: Rob Herring <[email protected]>

This adds ethernet driver for Calxeda xgmac found on Highbank SOC.

---
v3:
- whitespace fixes
- move reset to .init function
- fix calxedaxgmac_initialize return values
- fix 2 build warnings

v2:

Review

Quoted 10 lines
(quoted diff) +0 -3
-Convert register base plus offset to struct
-drop ethaddr env setting
-drop valid mac address check
 
 README                     |    3 +
 drivers/net/Makefile       |    1 +
 drivers/net/calxedaxgmac.c |  553 ++++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h           |    1 +
 4 files changed, 558 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/calxedaxgmac.c

Are there going to be any users for this driver?

Checkpatch says:

WARNING: __aligned(size) is preferred over __attribute__((aligned(size))) #461: FILE: drivers/net/calxedaxgmac.c:317:
+} __attribute__((aligned(32)));

Is there any special reason not to change this?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No, I'm not going to explain it. If you  can't  figure  it  out,  you
didn't want to know anyway... :-)
                   - Larry Wall in <[email protected]>
#19 lore raw

PATCH v3 1/2 net: add Calxeda xgmac driver

Wolfgang,

Quoted 20 lines · Wolfgang Denk

Dear Rob Herring,

Quoted 17 lines · In message <[email protected]> you wrote:

From: Rob Herring <[email protected]>

This adds ethernet driver for Calxeda xgmac found on Highbank SOC.

---
v3:
- whitespace fixes
- move reset to .init function
- fix calxedaxgmac_initialize return values
- fix 2 build warnings

v2:

(quoted diff) +0 -3
-Convert register base plus offset to struct
-drop ethaddr env setting
-drop valid mac address check
Quoted 8 lines
Quoted 6 lines
 README                     |    3 +
 drivers/net/Makefile       |    1 +
 drivers/net/calxedaxgmac.c |  553 ++++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h           |    1 +
 4 files changed, 558 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/calxedaxgmac.c

Are there going to be any users for this driver?

Yes. Patch 2/2 adds support to Calxeda Highbank.

Quoted 8 lines

Checkpatch says:

WARNING: __aligned(size) is preferred over __attribute__((aligned(size))) #461: FILE: drivers/net/calxedaxgmac.c:317:
+} __attribute__((aligned(32)));

Is there any special reason not to change this?

I thought it was a false positive because I didn't find any other users of __aligned().

Rob

#20 lore raw

PATCH v3 1/2 net: add Calxeda xgmac driver

Dear Rob Herring,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Are there going to be any users for this driver?

Yes. Patch 2/2 adds support to Calxeda Highbank.

I saw this myself 5 seconds later, but my "send" button has no "undo" function ;-) Sorry...

Quoted 10 lines
Quoted 7 lines

Checkpatch says:

WARNING: __aligned(size) is preferred over __attribute__((aligned(size))) #461: FILE: drivers/net/calxedaxgmac.c:317:
+} __attribute__((aligned(32)));

Is there any special reason not to change this?

I thought it was a false positive because I didn't find any other users of __aligned().

I think we should change this. [I can do this when applying, if you like.]

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
What the gods would destroy they first submit to  an  IEEE  standards
committee.
#21 lore raw

PATCH v3 1/2 net: add Calxeda xgmac driver

Wolfgang,

Quoted 17 lines · Wolfgang Denk

Dear Rob Herring,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Are there going to be any users for this driver?

Yes. Patch 2/2 adds support to Calxeda Highbank.

I saw this myself 5 seconds later, but my "send" button has no "undo" function ;-) Sorry...

Quoted 6 lines
Quoted 6 lines

Checkpatch says:

WARNING: __aligned(size) is preferred over __attribute__((aligned(size))) #461: FILE: drivers/net/calxedaxgmac.c:317:
+} __attribute__((aligned(32)));

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Is there any special reason not to change this?

I thought it was a false positive because I didn't find any other users of __aligned().

I think we should change this. [I can do this when applying, if you like.]

Agreed. If you're applying, I like. :)

Thanks,
Rob

#22 lore raw

PATCH v3 1/2 net: add Calxeda xgmac driver

In reply to Rob Herring

Dear Rob Herring,

Quoted 13 lines · In message <[email protected]> you wrote:

From: Rob Herring <[email protected]>

This adds ethernet driver for Calxeda xgmac found on Highbank SOC.

---
v3:
- whitespace fixes
- move reset to .init function
- fix calxedaxgmac_initialize return values
- fix 2 build warnings

v2:

Review

Quoted 10 lines
(quoted diff) +0 -3
-Convert register base plus offset to struct
-drop ethaddr env setting
-drop valid mac address check
 
 README                     |    3 +
 drivers/net/Makefile       |    1 +
 drivers/net/calxedaxgmac.c |  553 ++++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h           |    1 +
 4 files changed, 558 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/calxedaxgmac.c

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A penny saved is a penny to squander.
- Ambrose Bierce