Skip to contentSkip to conversation

My GT-64260 enhancements

PATCH In review Michael Sokolov 6 participants 11 messages Mar 15, 2002 – Mar 18, 2002 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 My GT-64260 enhancements

Hi there,

The patch below contains my promised enhancements to the GT-64260 and EV-64260 code in linuxppc_2_4_devel. Its main features are:

* The interface to vmlinux is bi_recs. Two new bi_recs have been added by me:
BI_GT64260_BASE and BI_GT64260_ETH_CFG.

* Core GT-64260 code enhancements:
- added gt64260_phys_base variable to hold the physical address of the GT-64260 registers, set by parse_bootinfo (and can be set by others too).
- "GT64260 Options" goo removed from arch/ppc/config.in. See below for how is everything configured properly.

* GT-64260 Ethernet driver enhancements:
- The driver is an option in drivers/net/Config.in where it belongs. Not buildable as a module yet, but we'll get there eventually.
- Ethernet station addresses (aka MAC addresses) are taken from BI_GT64260_ETH_CFG records (always). No more compiled-in MAC addresses, PPCBoot #ifdefs, or mucking with bd_t.
- Other Ethernet information, specifically MII vs. RMII and PHY address, is also passed at run time via BI_GT64260_ETH_CFG records. There are no more #ifdefs in the GT-64260 Ethernet driver.

* EV-64260-BP port enhancements:
- A pointer to bi_recs is expected in R3 just like on SBS K2 and Adirondack instead of the screwy find_bootinfo(). Just like on SBS K2 this works with both ppc-linux-boot and the arch/ppc/boot wrapper.
- The arch/ppc/boot wrapper is still supported. There are options in arch/ppc/config.in to set compiled-in MAC addresses, but now they are strictly optional, appear only for the EV-64260-BP port, and affect only the zImage wrapper. The latter uses them to generate BI_GT64260_ETH_CFG records for the EVB (that's where the hard-coded knowledge of EVB's quad RMII PHY now lives).
- BI_GT64260_BASE is honored if present but not required, as prior to calling parse_bootinfo() gt64260_phys_base is set to the old hard-coded value.

* Miscellaneous:
- A correction for arch/ppc/config.in: CONFIG_SERIAL_TEXT_DEBUG should be conditionalised on CONFIG_EV64260 (and other boards in the future if applicable) rather than on CONFIG_GT64260, because there is no guarantee that every board port in the future will support it.

So having thus introduced it, I hereby submit this patch for integration into linuxppc_2_4_devel:

arch/ppc/boot/common/misc-simple.c +8 -0
diff -Nru a/arch/ppc/boot/common/misc-simple.c b/arch/ppc/boot/common/misc-simple.c
@@ -69,6 +69,10 @@
 extern void gunzip(void *, int, unsigned char *, int *);
 extern void serial_fixups(void);
 
+#ifdef CONFIG_EV64260
+extern struct bi_record *add_extra_bi_recs(struct bi_record *bp);
+#endif
+
 struct bi_record *
 decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
 {
@@ -208,6 +212,10 @@
 		rec = (struct bi_record *)((unsigned long)rec +
 				rec->size);
 	}
+
+#ifdef CONFIG_EV64260
+	rec = add_extra_bi_recs(rec);
+#endif
 
 	rec->tag = BI_LAST;
 	rec->size = sizeof(struct bi_record);
arch/ppc/boot/simple/Makefile +1 -1
diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
@@ -34,7 +34,7 @@
 ifeq ($(CONFIG_EV64260),y)
 ZIMAGE				:= zImage-EV64260
 ZIMAGEINITRD			:= zImage.initrd-EV64260
-HEADHELP			:= direct.o misc-ev64260.o
+HEADHELP			:= direct.o misc-ev64260.o ev64260-birecs.o
 TFTPIMAGE			:= /tftpboot/zImage.ev64260
 endif
 ifeq ($(CONFIG_GEMINI),y)
arch/ppc/boot/simple/ev64260-birecs.c new file +118 -0

118 lines not on this page · raw message

arch/ppc/config.in +6 -21
diff -Nru a/arch/ppc/config.in b/arch/ppc/config.in
@@ -151,32 +151,17 @@
   bool 'Enable MPC10x store gathering' CONFIG_MPC10X_STORE_GATHERING
 fi
 
 if [ "$CONFIG_EV64260" = "y" ]; then
   define_bool CONFIG_GT64260 y
   define_int CONFIG_SERIAL_CONSOLE_BAUD 115200
 fi
 
-if [ "$CONFIG_GT64260" = "y" ]; then
+if [ "$CONFIG_EV64260" = "y" ]; then
    mainmenu_option next_comment
-   comment 'Galileo GT64260 Options'
-   bool 'GT64260 Ethernet Ports' CONFIG_GT64260_ETH
-   if [ "$CONFIG_GT64260_ETH" = "y" ]; then
-     bool ' EVB64260 - Ethernet Port 0' CONFIG_GT64260_ETH_0
-     string '  MAC Address' CONFIG_GT64260_ETH_0_MACADDR "feffff000000"
-     bool ' EVB64260 - Ethernet Port 1' CONFIG_GT64260_ETH_1
-     string '  MAC Address' CONFIG_GT64260_ETH_1_MACADDR "feffff000001"
-     bool ' EVB64260 - Ethernet Port 2' CONFIG_GT64260_ETH_2
-     string '  MAC Address' CONFIG_GT64260_ETH_2_MACADDR "feffff000002"
-   fi
-   bool 'GT64260 MPSC Serial Ports' CONFIG_GT64260_MPSC
-   if [ "$CONFIG_GT64260_MPSC" = "y" ]; then
-     bool ' MPSC Port 0' CONFIG_GT64260_MPSC_0
-     bool ' MPSC Port 1' CONFIG_GT64260_MPSC_1
-     bool ' MPSC Port 0 as system console' CONFIG_GT64260_CONSOLE
-   fi
-   if [ "$CONFIG_GT64260_CONSOLE" = "y" ]; then
-     define_bool CONFIG_SERIAL_CONSOLE y
-   fi
+   comment 'EV-64260-BP zImage Wrapper Options'
+   string 'Ethernet 0 MAC Address' CONFIG_EV64260_ETH_0_MACADDR "feffff000000"
+   string 'Ethernet 1 MAC Address' CONFIG_EV64260_ETH_1_MACADDR "feffff000001"
+   string 'Ethernet 2 MAC Address' CONFIG_EV64260_ETH_2_MACADDR "feffff000002"
    endmenu
 fi
 
@@ -690,7 +675,7 @@
 fi
 if [ "$CONFIG_MCPN765" = "y" -o "$CONFIG_SANDPOINT" = "y" \
 	-o "$CONFIG_ZX4500" = "y" -o "$CONFIG_PRPMC800" = "y" \
-	-o "$CONFIG_4xx" = "y" -o "$CONFIG_GT64260" = "y" ]; then
+	-o "$CONFIG_4xx" = "y" -o "$CONFIG_EV64260" = "y" ]; then
   bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG
 fi
 endmenu
arch/ppc/kernel/gt64260_common.c +1 -0
diff -Nru a/arch/ppc/kernel/gt64260_common.c b/arch/ppc/kernel/gt64260_common.c
@@ -58,6 +58,7 @@
 
 
 u32	gt64260_base; /* Virtual base address of 64260's regs */
+u32	gt64260_phys_base; /* Physical base address of 64260's regs */
 u32	gt64260_revision; /* Revision of the chip */
 u8	gt64260_pci_exclude_bridge = TRUE;
 
arch/ppc/kernel/setup.c +16 -0
diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
@@ -40,6 +40,10 @@
 #include <asm/kgdb.h>
 #endif
 
+#ifdef CONFIG_GT64260
+#include <asm/gt64260.h>
+#endif /* CONFIG_GT64260 */
+
 extern void platform_init(unsigned long r3, unsigned long r4,
 		unsigned long r5, unsigned long r6, unsigned long r7);
 extern void bootx_init(unsigned long r4, unsigned long phys);
@@ -491,6 +495,18 @@
 		case BI_MEMSIZE:
 			boot_mem_size = data[0];
 			break;
+#ifdef CONFIG_GT64260
+		case BI_GT64260_BASE:
+			gt64260_phys_base = data[0];
+			break;
+#ifdef CONFIG_GT64260_ETH
+		case BI_GT64260_ETH_CFG:
+			gt64260_eth_enable |= 1 << data[0];
+			bcopy(&data[1], &gt64260_eth_config[data[0]],
+			      sizeof(struct gt64260_eth_config));
+			break;
+#endif /* CONFIG_GT64260_ETH */
+#endif /* CONFIG_GT64260 */
 		}
 		rec = (struct bi_record *)((ulong)rec + rec->size);
 	}
arch/ppc/platforms/ev64260_setup.c +10 -4
diff -Nru a/arch/ppc/platforms/ev64260_setup.c b/arch/ppc/platforms/ev64260_setup.c
@@ -105,7 +105,7 @@
 	GT64260_BRIDGE_INFO_DEFAULT(&info, ev64260_find_end_of_memory());
 
 	/* Lookup PCI host bridges */
-	if (gt64260_find_bridges(EV64260_BRIDGE_REG_BASE,
+	if (gt64260_find_bridges(gt64260_phys_base,
 				 &info,
 				 ev64260_map_irq)) {
 		printk("Bridge initialization failed.\n");
@@ -322,7 +322,7 @@
 
 	if (mem_size == 0) {
 		/* Next 2 lines are a kludge for gt64260_get_mem_size() */
-		gt64260_base = EV64260_BRIDGE_REG_BASE;
+		gt64260_base = gt64260_phys_base;
 		ev64260_set_bat();
 		mem_size = gt64260_get_mem_size();
 	}
@@ -498,7 +498,13 @@
 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 	      unsigned long r6, unsigned long r7)
 {
-	parse_bootinfo(find_bootinfo());
+	/*
+	 * The GT-64260 physical base address will normally be passed in a
+	 * bootinfo record, but if there isn't one the default below will
+	 * remain in effect.
+	 */
+	gt64260_phys_base = EV64260_BRIDGE_REG_BASE;
+	parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
 
 	isa_mem_base = 0;
 
@@ -530,7 +536,7 @@
 #ifdef	CONFIG_SERIAL_TEXT_DEBUG
 	ev64260_set_bat();
 #ifdef	CONFIG_GT64260_CONSOLE
-	gt64260_base = EV64260_BRIDGE_REG_BASE;
+	gt64260_base = gt64260_phys_base;
 	ppc_md.progress = gt64260_mpsc_progress; /* embedded UART */
 #else
 	ppc_md.progress = ev64260_16550_progress; /* Dev module DUART */
drivers/net/Config.in +1 -0
diff -Nru a/drivers/net/Config.in b/drivers/net/Config.in
@@ -37,6 +37,7 @@
       fi
       dep_tristate '  BMAC (G3 ethernet) support' CONFIG_BMAC $CONFIG_ALL_PPC
       dep_tristate '  GMAC (G4/iBook ethernet) support' CONFIG_GMAC $CONFIG_ALL_PPC
+      dep_bool '  GT64260 Ethernet Ports' CONFIG_GT64260_ETH $CONFIG_GT64260
       if [ "$CONFIG_4xx" = "y" ]; then
          if [ "$CONFIG_REDWOOD_4" = "y" -o "$CONFIG_403GCX" = "y" ]; then
 	    tristate '  National DP83902AV (Oak ethernet) support' CONFIG_OAKNET
drivers/net/gt64260_eth.c +39 -140

286 lines not on this page · raw message

drivers/net/gt64260_eth.h +6 -41

92 lines not on this page · raw message

include/asm-ppc/bootinfo.h +3 -0
diff -Nru a/include/asm-ppc/bootinfo.h b/include/asm-ppc/bootinfo.h
@@ -32,6 +32,9 @@
 #define BI_SYSMAP		0x1015
 #define BI_MACHTYPE		0x1016
 #define BI_MEMSIZE		0x1017
+/* For systems with the GT-64260 system controller */
+#define	BI_GT64260_BASE		0x1018
+#define	BI_GT64260_ETH_CFG	0x1019
 
 extern struct bi_record *find_bootinfo(void);
 extern void parse_bootinfo(struct bi_record *rec);
include/asm-ppc/gt64260.h +9 -0
diff -Nru a/include/asm-ppc/gt64260.h b/include/asm-ppc/gt64260.h
@@ -30,6 +30,7 @@
 
 
 extern u32     gt64260_base;
+extern u32     gt64260_phys_base;
 extern u32     gt64260_irq_base;     /* We handle the next 96 IRQs from here */
 extern u32     gt64260_revision;
 extern u8      gt64260_pci_exclude_bridge;
@@ -186,6 +187,14 @@
 	(ip)->pci_1_io_size	  = GT64260_PCI_1_IO_SIZE;		\
 	(ip)->pci_1_io_swap	  = GT64260_CPU_PCI_SWAP_NONE;		\
 }
+
+/* GT64260 Ethernet configuration passed via bootinfo records */
+extern struct gt64260_eth_config {
+	u_char eth_stat_addr[6];
+	u_char is_rmii;
+	u_char phy_addr;
+} gt64260_eth_config[3];
+extern u_long gt64260_eth_enable;
 
 /*
  *****************************************************************************

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 4 lines · Michael Sokolov

diff -Nru a/arch/ppc/boot/common/misc-simple.c b/arch/ppc/boot/common/misc-simple.c

arch/ppc/boot/common/misc-simple.c line 78

Quoted 10 lines
arch/ppc/boot/common/misc-simple.c +4 -0
@@ -69,6 +69,10 @@
 extern void gunzip(void *, int, unsigned char *, int *);
 extern void serial_fixups(void);
 
+#ifdef CONFIG_EV64260
+extern struct bi_record *add_extra_bi_recs(struct bi_record *bp);
+#endif
+
 struct bi_record *
 decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
 {

Don't need to #ifdef externs..

Quoted 4 lines

diff -Nru a/arch/ppc/config.in b/arch/ppc/config.in

arch/ppc/config.in line 159

Quoted 10 lines
arch/ppc/config.in +1 -1
@@ -151,32 +151,17 @@
   bool 'Enable MPC10x store gathering' CONFIG_MPC10X_STORE_GATHERING
 fi
 
 if [ "$CONFIG_EV64260" = "y" ]; then
   define_bool CONFIG_GT64260 y
   define_int CONFIG_SERIAL_CONSOLE_BAUD 115200
 fi
 
-if [ "$CONFIG_GT64260" = "y" ]; then
+if [ "$CONFIG_EV64260" = "y" ]; then

If you're going to use the same test here as above, don't make it two cases.

arch/ppc/config.in line 164

Quoted 4 lines
arch/ppc/config.in +4 -0
+   comment 'EV-64260-BP zImage Wrapper Options'
+   string 'Ethernet 0 MAC Address' CONFIG_EV64260_ETH_0_MACADDR "feffff000000"
+   string 'Ethernet 1 MAC Address' CONFIG_EV64260_ETH_1_MACADDR "feffff000001"
+   string 'Ethernet 2 MAC Address' CONFIG_EV64260_ETH_2_MACADDR "feffff000002"

I think this is semi-wrong, or at least the comment is. Troy is working on the Motorola MVP and is confined to DINK. But I don't know as much about the gt64260 stuffs as Troy and Mark do.

arch/ppc/config.in line 681

Quoted 9 lines
arch/ppc/config.in +1 -1
@@ -690,7 +675,7 @@
 fi
 if [ "$CONFIG_MCPN765" = "y" -o "$CONFIG_SANDPOINT" = "y" \
 	-o "$CONFIG_ZX4500" = "y" -o "$CONFIG_PRPMC800" = "y" \
-	-o "$CONFIG_4xx" = "y" -o "$CONFIG_GT64260" = "y" ]; then
+	-o "$CONFIG_4xx" = "y" -o "$CONFIG_EV64260" = "y" ]; then
   bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG
 fi
 endmenu

I think this is also wrong for the same reasons, and iirc this should just work, or should.

Quoted 4 lines

diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c

arch/ppc/kernel/setup.c line 49

Quoted 10 lines
arch/ppc/kernel/setup.c +4 -0
@@ -40,6 +40,10 @@
 #include <asm/kgdb.h>
 #endif
 
+#ifdef CONFIG_GT64260
+#include <asm/gt64260.h>
+#endif /* CONFIG_GT64260 */
+
 extern void platform_init(unsigned long r3, unsigned long r4,
 		unsigned long r5, unsigned long r6, unsigned long r7);
 extern void bootx_init(unsigned long r4, unsigned long phys);

Don't protect includes with #ifdefs unless it's really needed (from what I can see, it isn't).

drivers/net/Config.in line 43

Quoted 11 lines

diff -Nru a/drivers/net/Config.in b/drivers/net/Config.in

drivers/net/Config.in +1 -0
@@ -37,6 +37,7 @@
       fi
       dep_tristate '  BMAC (G3 ethernet) support' CONFIG_BMAC $CONFIG_ALL_PPC
       dep_tristate '  GMAC (G4/iBook ethernet) support' CONFIG_GMAC $CONFIG_ALL_PPC
+      dep_bool '  GT64260 Ethernet Ports' CONFIG_GT64260_ETH $CONFIG_GT64260
       if [ "$CONFIG_4xx" = "y" ]; then
          if [ "$CONFIG_REDWOOD_4" = "y" -o "$CONFIG_403GCX" = "y" ]; then
 	    tristate '  National DP83902AV (Oak ethernet) support' CONFIG_OAKNET

Not quite. We do a really bad thing of explicity setting CONFIG_ALL_PPC always, so we can always do a test on it in config bits. This should be:
if [ "$CONFIG_GT64260" = "y" ]; then
bool ' GT64260 Ethernet Ports' CONFIG_GT64260_ETH
fi

Aside from that, it looks quite good and removes the horribly ugly setting of MAC addrs, for the most part.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to Michael Sokolov
Quoted 2 lines · Michael Sokolov

The patch below contains my promised enhancements to the GT-64260 and EV-64260 code in linuxppc_2_4_devel. Its main features are:

Please check the _galileo tree. Much of this stuff has already been addressed.

--
Nye Liu
[email protected]

"Who would be stupid enough to quote a fictitious character?"
-- Don Quixote

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 1 line · Tom Rini

Don't need to #ifdef externs..

OK, changed this in the revised patch.

Quoted 10 lines

Review

Quoted 7 lines

if [ "$CONFIG_EV64260" = "y" ]; then
define_bool CONFIG_GT64260 y
define_int CONFIG_SERIAL_CONSOLE_BAUD 115200
fi

(quoted diff) +1 -1
-if [ "$CONFIG_GT64260" = "y" ]; then
+if [ "$CONFIG_EV64260" = "y" ]; then

If you're going to use the same test here as above, don't make it two cases.

Ditto. BTW, do you really want that 115200 thing in there? I've axed it in my personal tree, but didn't include that in my posted patch to reduce the patch scare factor.

Quoted 6 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+   comment 'EV-64260-BP zImage Wrapper Options'
+   string 'Ethernet 0 MAC Address' CONFIG_EV64260_ETH_0_MACADDR "feffff000000"
+   string 'Ethernet 1 MAC Address' CONFIG_EV64260_ETH_1_MACADDR "feffff000001"
+   string 'Ethernet 2 MAC Address' CONFIG_EV64260_ETH_2_MACADDR "feffff000002"

I think this is semi-wrong, or at least the comment is.

No, my comment is correct, as with my patch these options exist only for EV-64260-BP, not for other boards, and affect only the zImage wrapper, no effect if you make vmlinux.

Quoted 2 lines

Troy is working
on the Motorola MVP and is confined to DINK.

So what are you suggesting? With my patch everything that worked before still works exactly the same way, except that there is a new possibility of booting vmlinux directly and configuring it via bi_recs. People who used hard-coded MAC addresses previously can still do so if they want.

Or are you instead suggesting that we drop support for that and assume that everyone uses one of {DINK,PPCBoot,StarMON} (in alphabetical order) and provide MAC address support for these three (in the zImage wrapper for the first and let the other two boot vmlinux with bi_recs)? That would be fine with me, but I can't implement it without help from DINK and PPCBoot people.

Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +1 -1
-	-o "$CONFIG_4xx" = "y" -o "$CONFIG_GT64260" = "y" ]; then
+	-o "$CONFIG_4xx" = "y" -o "$CONFIG_EV64260" = "y" ]; then
   bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG

I think this is also wrong for the same reasons, and iirc this should just work, or should.

No, I think this is right. Whether a board port supports CONFIG_SERIAL_TEXT_DEBUG or not is entirely up to the person doing the port and has nothing to do with what chips happen to be on the board.

Quoted 2 lines

Don't protect includes with #ifdefs unless it's really needed (from what I can see, it isn't).

OK, changed this in the revised patch.

Quoted 8 lines
Quoted 1 line

+ dep_bool ' GT64260 Ethernet Ports' CONFIG_GT64260_ETH $CONFIG_GT64260

Not quite. We do a really bad thing of explicity setting CONFIG_ALL_PPC always, so we can always do a test on it in config bits. This should be:
if [ "$CONFIG_GT64260" = "y" ]; then
bool ' GT64260 Ethernet Ports' CONFIG_GT64260_ETH
fi

Ditto.

Quoted 2 lines

Aside from that, it looks quite good and removes the horribly ugly setting of MAC addrs, for the most part.

The revised patch is below. How about pushing it?

arch/ppc/boot/common/misc-simple.c +5 -0
diff -Nru a/arch/ppc/boot/common/misc-simple.c b/arch/ppc/boot/common/misc-simple.c
@@ -68,6 +68,7 @@
 extern void serial_close(unsigned long com_port);
 extern void gunzip(void *, int, unsigned char *, int *);
 extern void serial_fixups(void);
+extern struct bi_record *add_extra_bi_recs(struct bi_record *bp);
 
 struct bi_record *
 decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
@@ -208,6 +209,10 @@
 		rec = (struct bi_record *)((unsigned long)rec +
 				rec->size);
 	}
+
+#ifdef CONFIG_EV64260
+	rec = add_extra_bi_recs(rec);
+#endif
 
 	rec->tag = BI_LAST;
 	rec->size = sizeof(struct bi_record);
arch/ppc/boot/simple/Makefile +1 -1
diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
@@ -34,7 +34,7 @@
 ifeq ($(CONFIG_EV64260),y)
 ZIMAGE				:= zImage-EV64260
 ZIMAGEINITRD			:= zImage.initrd-EV64260
-HEADHELP			:= direct.o misc-ev64260.o
+HEADHELP			:= direct.o misc-ev64260.o ev64260-birecs.o
 TFTPIMAGE			:= /tftpboot/zImage.ev64260
 endif
 ifeq ($(CONFIG_GEMINI),y)
arch/ppc/boot/simple/ev64260-birecs.c new file +118 -0

118 lines not on this page · raw message

arch/ppc/config.in +7 -25
diff -Nru a/arch/ppc/config.in b/arch/ppc/config.in
@@ -151,33 +151,15 @@
   bool 'Enable MPC10x store gathering' CONFIG_MPC10X_STORE_GATHERING
 fi
 
 if [ "$CONFIG_EV64260" = "y" ]; then
   define_bool CONFIG_GT64260 y
   define_int CONFIG_SERIAL_CONSOLE_BAUD 115200
-fi
-
-if [ "$CONFIG_GT64260" = "y" ]; then
-   mainmenu_option next_comment
-   comment 'Galileo GT64260 Options'
-   bool 'GT64260 Ethernet Ports' CONFIG_GT64260_ETH
-   if [ "$CONFIG_GT64260_ETH" = "y" ]; then
-     bool ' EVB64260 - Ethernet Port 0' CONFIG_GT64260_ETH_0
-     string '  MAC Address' CONFIG_GT64260_ETH_0_MACADDR "feffff000000"
-     bool ' EVB64260 - Ethernet Port 1' CONFIG_GT64260_ETH_1
-     string '  MAC Address' CONFIG_GT64260_ETH_1_MACADDR "feffff000001"
-     bool ' EVB64260 - Ethernet Port 2' CONFIG_GT64260_ETH_2
-     string '  MAC Address' CONFIG_GT64260_ETH_2_MACADDR "feffff000002"
-   fi
-   bool 'GT64260 MPSC Serial Ports' CONFIG_GT64260_MPSC
-   if [ "$CONFIG_GT64260_MPSC" = "y" ]; then
-     bool ' MPSC Port 0' CONFIG_GT64260_MPSC_0
-     bool ' MPSC Port 1' CONFIG_GT64260_MPSC_1
-     bool ' MPSC Port 0 as system console' CONFIG_GT64260_CONSOLE
-   fi
-   if [ "$CONFIG_GT64260_CONSOLE" = "y" ]; then
-     define_bool CONFIG_SERIAL_CONSOLE y
-   fi
-   endmenu
+  mainmenu_option next_comment
+  comment 'EV-64260-BP zImage Wrapper Options'
+  string 'Ethernet 0 MAC Address' CONFIG_EV64260_ETH_0_MACADDR "feffff000000"
+  string 'Ethernet 1 MAC Address' CONFIG_EV64260_ETH_1_MACADDR "feffff000001"
+  string 'Ethernet 2 MAC Address' CONFIG_EV64260_ETH_2_MACADDR "feffff000002"
+  endmenu
 fi
 
 if [ "$CONFIG_K2" = "y" ]; then
@@ -690,7 +672,7 @@
 fi
 if [ "$CONFIG_MCPN765" = "y" -o "$CONFIG_SANDPOINT" = "y" \
 	-o "$CONFIG_ZX4500" = "y" -o "$CONFIG_PRPMC800" = "y" \
-	-o "$CONFIG_4xx" = "y" -o "$CONFIG_GT64260" = "y" ]; then
+	-o "$CONFIG_4xx" = "y" -o "$CONFIG_EV64260" = "y" ]; then
   bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG
 fi
 endmenu
arch/ppc/kernel/gt64260_common.c +1 -0
diff -Nru a/arch/ppc/kernel/gt64260_common.c b/arch/ppc/kernel/gt64260_common.c
@@ -58,6 +58,7 @@
 
 
 u32	gt64260_base; /* Virtual base address of 64260's regs */
+u32	gt64260_phys_base; /* Physical base address of 64260's regs */
 u32	gt64260_revision; /* Revision of the chip */
 u8	gt64260_pci_exclude_bridge = TRUE;
 
arch/ppc/kernel/setup.c +13 -0
diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
@@ -35,6 +35,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <asm/pmac_feature.h>
+#include <asm/gt64260.h>
 
 #if defined CONFIG_KGDB
 #include <asm/kgdb.h>
@@ -491,6 +492,18 @@
 		case BI_MEMSIZE:
 			boot_mem_size = data[0];
 			break;
+#ifdef CONFIG_GT64260
+		case BI_GT64260_BASE:
+			gt64260_phys_base = data[0];
+			break;
+#ifdef CONFIG_GT64260_ETH
+		case BI_GT64260_ETH_CFG:
+			gt64260_eth_enable |= 1 << data[0];
+			bcopy(&data[1], &gt64260_eth_config[data[0]],
+			      sizeof(struct gt64260_eth_config));
+			break;
+#endif /* CONFIG_GT64260_ETH */
+#endif /* CONFIG_GT64260 */
 		}
 		rec = (struct bi_record *)((ulong)rec + rec->size);
 	}
arch/ppc/platforms/ev64260_setup.c +10 -4
diff -Nru a/arch/ppc/platforms/ev64260_setup.c b/arch/ppc/platforms/ev64260_setup.c
@@ -105,7 +105,7 @@
 	GT64260_BRIDGE_INFO_DEFAULT(&info, ev64260_find_end_of_memory());
 
 	/* Lookup PCI host bridges */
-	if (gt64260_find_bridges(EV64260_BRIDGE_REG_BASE,
+	if (gt64260_find_bridges(gt64260_phys_base,
 				 &info,
 				 ev64260_map_irq)) {
 		printk("Bridge initialization failed.\n");
@@ -322,7 +322,7 @@
 
 	if (mem_size == 0) {
 		/* Next 2 lines are a kludge for gt64260_get_mem_size() */
-		gt64260_base = EV64260_BRIDGE_REG_BASE;
+		gt64260_base = gt64260_phys_base;
 		ev64260_set_bat();
 		mem_size = gt64260_get_mem_size();
 	}
@@ -498,7 +498,13 @@
 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 	      unsigned long r6, unsigned long r7)
 {
-	parse_bootinfo(find_bootinfo());
+	/*
+	 * The GT-64260 physical base address will normally be passed in a
+	 * bootinfo record, but if there isn't one the default below will
+	 * remain in effect.
+	 */
+	gt64260_phys_base = EV64260_BRIDGE_REG_BASE;
+	parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
 
 	isa_mem_base = 0;
 
@@ -530,7 +536,7 @@
 #ifdef	CONFIG_SERIAL_TEXT_DEBUG
 	ev64260_set_bat();
 #ifdef	CONFIG_GT64260_CONSOLE
-	gt64260_base = EV64260_BRIDGE_REG_BASE;
+	gt64260_base = gt64260_phys_base;
 	ppc_md.progress = gt64260_mpsc_progress; /* embedded UART */
 #else
 	ppc_md.progress = ev64260_16550_progress; /* Dev module DUART */
drivers/net/Config.in +3 -0
diff -Nru a/drivers/net/Config.in b/drivers/net/Config.in
@@ -37,6 +37,9 @@
       fi
       dep_tristate '  BMAC (G3 ethernet) support' CONFIG_BMAC $CONFIG_ALL_PPC
       dep_tristate '  GMAC (G4/iBook ethernet) support' CONFIG_GMAC $CONFIG_ALL_PPC
+      if [ "$CONFIG_GT64260" = "y" ]; then
+	 bool '  GT64260 Ethernet Ports' CONFIG_GT64260_ETH
+      fi
       if [ "$CONFIG_4xx" = "y" ]; then
          if [ "$CONFIG_REDWOOD_4" = "y" -o "$CONFIG_403GCX" = "y" ]; then
 	    tristate '  National DP83902AV (Oak ethernet) support' CONFIG_OAKNET
drivers/net/gt64260_eth.c +39 -140

286 lines not on this page · raw message

drivers/net/gt64260_eth.h +6 -41

92 lines not on this page · raw message

include/asm-ppc/bootinfo.h +3 -0
diff -Nru a/include/asm-ppc/bootinfo.h b/include/asm-ppc/bootinfo.h
@@ -32,6 +32,9 @@
 #define BI_SYSMAP		0x1015
 #define BI_MACHTYPE		0x1016
 #define BI_MEMSIZE		0x1017
+/* For systems with the GT-64260 system controller */
+#define	BI_GT64260_BASE		0x1018
+#define	BI_GT64260_ETH_CFG	0x1019
 
 extern struct bi_record *find_bootinfo(void);
 extern void parse_bootinfo(struct bi_record *rec);
include/asm-ppc/gt64260.h +9 -0
diff -Nru a/include/asm-ppc/gt64260.h b/include/asm-ppc/gt64260.h
@@ -30,6 +30,7 @@
 
 
 extern u32     gt64260_base;
+extern u32     gt64260_phys_base;
 extern u32     gt64260_irq_base;     /* We handle the next 96 IRQs from here */
 extern u32     gt64260_revision;
 extern u8      gt64260_pci_exclude_bridge;
@@ -186,6 +187,14 @@
 	(ip)->pci_1_io_size	  = GT64260_PCI_1_IO_SIZE;		\
 	(ip)->pci_1_io_swap	  = GT64260_CPU_PCI_SWAP_NONE;		\
 }
+
+/* GT64260 Ethernet configuration passed via bootinfo records */
+extern struct gt64260_eth_config {
+	u_char eth_stat_addr[6];
+	u_char is_rmii;
+	u_char phy_addr;
+} gt64260_eth_config[3];
+extern u_long gt64260_eth_enable;
 
 /*
  *****************************************************************************

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
Quoted 18 lines · Michael Sokolov
Quoted 1 line · Tom Rini

Don't need to #ifdef externs..

OK, changed this in the revised patch.

Quoted 10 lines

Review

Quoted 7 lines

if [ "$CONFIG_EV64260" = "y" ]; then
define_bool CONFIG_GT64260 y
define_int CONFIG_SERIAL_CONSOLE_BAUD 115200
fi

(quoted diff) +1 -1
-if [ "$CONFIG_GT64260" = "y" ]; then
+if [ "$CONFIG_EV64260" = "y" ]; then

If you're going to use the same test here as above, don't make it two cases.

Quoted 3 lines

Ditto. BTW, do you really want that 115200 thing in there? I've axed it in my personal tree, but didn't include that in my posted patch to reduce the patch scare factor.

I'd be willing to bet $5 it's from Troy. IMHO, 9600 is the defacto default rate, but Troy likes 'fast' serial consoles.

Quoted 10 lines
Quoted 6 lines

arch/ppc/config.in line 161

Quoted 4 lines
arch/ppc/config.in +4 -0
+   comment 'EV-64260-BP zImage Wrapper Options'
+   string 'Ethernet 0 MAC Address' CONFIG_EV64260_ETH_0_MACADDR "feffff000000"
+   string 'Ethernet 1 MAC Address' CONFIG_EV64260_ETH_1_MACADDR "feffff000001"
+   string 'Ethernet 2 MAC Address' CONFIG_EV64260_ETH_2_MACADDR "feffff000002"

I think this is semi-wrong, or at least the comment is.

No, my comment is correct, as with my patch these options exist only for EV-64260-BP, not for other boards, and affect only the zImage wrapper, no effect if you make vmlinux.

Right, And boards other than the EV-64260-BP use the zImage wrapper, like the Motorola MVP.

Quoted 7 lines
Quoted 2 lines

Troy is working
on the Motorola MVP and is confined to DINK.

So what are you suggesting? With my patch everything that worked before still works exactly the same way, except that there is a new possibility of booting vmlinux directly and configuring it via bi_recs. People who used hard-coded MAC addresses previously can still do so if they want.

I'm saying that if nothing else the comment is wrong or slightly misleading, as it's not 'just' for the EV-64260-BP, it's for the Motorola MVP as well, and possibly other boards in the future which have to use !(StarMON || PPCBoot).

Quoted 10 lines
Quoted 6 lines

arch/ppc/config.in line 676

Quoted 3 lines
arch/ppc/config.in +1 -1
-	-o "$CONFIG_4xx" = "y" -o "$CONFIG_GT64260" = "y" ]; then
+	-o "$CONFIG_4xx" = "y" -o "$CONFIG_EV64260" = "y" ]; then
   bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG

I think this is also wrong for the same reasons, and iirc this should just work, or should.

No, I think this is right. Whether a board port supports CONFIG_SERIAL_TEXT_DEBUG or not is entirely up to the person doing the port and has nothing to do with what chips happen to be on the board.

Well, (and I do need to check out the _galileo tree) iirc the stuff to support that option is in one of the generic files. Or generic to the work currently in there. If that's the case, and you're explicitly not going to support it in your files (and ports) then add a -a "$CONFIG_xxx" = "n" .

Quoted 4 lines
Quoted 2 lines

Aside from that, it looks quite good and removes the horribly ugly setting of MAC addrs, for the most part.

The revised patch is below. How about pushing it?

Looks better, but I still want to see Troy and/or Marks comments on it.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
Quoted 6 lines · Tom Rini
Quoted 3 lines

Ditto. BTW, do you really want that 115200 thing in there? I've axed it in my personal tree, but didn't include that in my posted patch to reduce the patch scare factor.

I'd be willing to bet $5 it's from Troy. IMHO, 9600 is the defacto default rate, but Troy likes 'fast' serial consoles.

No, its from me. The reason its 115200 is because that's what that version of DINK that comes with it uses. Having to set minicom to 115200, then change it to 9600 in the middle of a boot doesn't make sense to me.
Why do what DINK does?? Because that's what comes with the board.

Mark

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
Quoted 6 lines · Mark A. Greer
Quoted 4 lines · Tom Rini
Quoted 3 lines

Ditto. BTW, do you really want that 115200 thing in there? I've axed it in my personal tree, but didn't include that in my posted patch to reduce the patch scare factor.

Quoted 7 lines
Quoted 2 lines

I'd be willing to bet $5 it's from Troy. IMHO, 9600 is the defacto default rate, but Troy likes 'fast' serial consoles.

No, its from me. The reason its 115200 is because that's what that version of DINK that comes with it uses. Having to set minicom to 115200, then change it to 9600 in the middle of a boot doesn't make sense to me.
Why do what DINK does?? Because that's what comes with the board.

Well if DINK is what's doing it, then yes, that is the sane choice of speeds.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw
Quoted 1 line · Tom Rini

I'd be willing to bet $5 it's from Troy.

OK...

Quoted 2 lines

IMHO, 9600 is the defacto
default rate,

YES!!!

Quoted 1 line

but Troy likes 'fast' serial consoles.

But Troy's personal preferences shouldn't affect the public tree, should they? If 9600 is the default baud rate for all of Linux, why should one port be different? Who is the maintainer with authority over this? Would s/he accept a patch to axe that 115200 line out?

Quoted 9 lines

Right, And boards other than the EV-64260-BP use the zImage wrapper, like the Motorola MVP.

[...]

I'm saying that if nothing else the comment is wrong or slightly misleading, as it's not 'just' for the EV-64260-BP, it's for the Motorola MVP as well, and possibly other boards in the future which have to use !(StarMON || PPCBoot).

But right now there is no MVP in 2_4_devel, so for 2_4_devel as it is right now it's for EV-64260-BP only. If/then someone adds another port that needs the same ugly hack in the zImage wrapper, they can add -o "$CONFIG_MYBOARD" = "y" to it. But it still won't be for all GT-64260 boards, like it won't be for my StarMON-only boards.

Quoted 5 lines

Well, (and I do need to check out the _galileo tree) iirc the stuff to support that option is in one of the generic files. Or generic to the work currently in there. If that's the case, and you're explicitly not going to support it in your files (and ports) then add a -a "$CONFIG_xxx" = "n" .

You still don't get it. I find that logic offensive. It makes me not want to use the GT-64260 in my designs because your logic implies that if someone uses the GT-64260 s/he wants to do things your way. Just because there is a generic file doesn't mean I'm obligated to use it in my ports. I can build a board with a GT-64260A in an epoxy-filled tamper-resistant module where StarMON sets up the system environment and the Linux port looks just like the Adirondack one. You'll never be able to tell that there even is a GT-64260 in that system!

Think of StarMON like OF. That's a good model, as StarMON is indeed a real competitor to OF. Just like on OF machines the device tree tells you where system features are located and you don't really know or care what chips implement these features and what magic the firmware had to do to make it all work, so with StarMON. You have so much memory, a PCI bus here, a UART there, etc., and you don't really need to know whether it's a CPC710 or a GT-64260.

I want to design my ports like this: OK, here is my hardware feature set, let's write the files telling Linux how to make use of it. You are forcing me to think differently: OK, here are the chips on my board, let's see what generic files they have for them. But I don't want to do my ports your way, and I find it offensive that the GT-64260 code you have in the tree now essentially forces me how to think.

MS

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw
Quoted 3 lines · Michael Sokolov

But Troy's personal preferences shouldn't affect the public tree, should they? If 9600 is the default baud rate for all of Linux, why should one port be different?

I didn't know there was a "default" baud rate for Linux. I think the lowest I have ever seen is 9600, but I certainly wouldn't call it a default. It seems every one of the boards I have uses something different,

The debug console serial port rates are either provided by passing some bootloader information to the kernel or by a kernel command line option. Either one is locally configurable.

Quoted 2 lines

.... Who is the maintainer with authority over this? Would s/he accept a patch to axe that 115200 line out?

It shouldn't be a hard-coded value. It should at least be the standard Linux command line option. Bootloaders should simply use the port as it was configured by the boot rom.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#9 lore raw
Quoted 8 lines · Dan Malek
Quoted 3 lines · Michael Sokolov

But Troy's personal preferences shouldn't affect the public tree, should they? If 9600 is the default baud rate for all of Linux, why should one port be different?

Quoted 5 lines

I didn't know there was a "default" baud rate for Linux. I think the lowest I have ever seen is 9600, but I certainly wouldn't call it a default. It seems every one of the boards I have uses something different,

The default for just about any unix box (and an awful lot of other things - network switches etc) seems to be 9600 8N1, partly because even ancient terminals can cope with that (a lot of older ones don't go past 38400 for example). Allowing an override is fine, but leaving the default at 9600 will follow the 'path of least surprise'.

Cheers,

David

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#10 lore raw
In reply to Michael Sokolov
Quoted 11 lines · Michael Sokolov
Quoted 5 lines · Tom Rini

Well, (and I do need to check out the _galileo tree) iirc the stuff to support that option is in one of the generic files. Or generic to the work currently in there. If that's the case, and you're explicitly not going to support it in your files (and ports) then add a -a "$CONFIG_xxx" = "n" .

You still don't get it. I find that logic offensive. It makes me not want to use the GT-64260 in my designs because your logic implies that if someone uses the GT-64260 s/he wants to do things your way.

Yes, it assumes that if you're going to make a GT-64260 based port and get it into the main tree you're going to use the common files for said chipset so that all of the boards can be said to have certain things working and reduce the ammount of coding needed to be done by you.

Like Troy said in an earlier message, it's great that you've got all of this work done, but if you want to get it into the main tree and not just keep up your own fork of it, some of your code will have to be modified. The current stuff has the feature that it can make use of CONFIG_SERIAL_TEXT_DEBUG on all ports.

Quoted 2 lines

Just because there is a generic file doesn't mean I'm obligated to use it in my ports.

Actually, unless you've got good and preferably technical objections to it, you are. Once it gets into the main trees, it's not just your board port, it's everyones board port. And duplication of code isn't generally a good thing.

If you've done your GT-64260 board without duplicating most of the work in gt64260_common.c, then we can add in tests for your board(s) or even just define a CONFIG_STARMON and test for that.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/