r973 - in trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian: . patches

Sven Luther luther@haydn.debian.org
Thu, 05 Aug 2004 07:42:11 -0600


Author: luther
Date: 2004-08-05 07:41:59 -0600 (Thu, 05 Aug 2004)
New Revision: 973

Modified:
   trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/changelog
   trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/patches/marvell-pegasos.dpatch
Log:
Fixed Marvell-pegasos patch to read the MAC address set by the firmware into
the marvell chip on powerpc, instead of reading it from the (mips board) prom.


Modified: trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/changelog	2004-08-04 19:07:58 UTC (rev 972)
+++ trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/changelog	2004-08-05 13:41:59 UTC (rev 973)
@@ -3,10 +3,14 @@
   * Migrated pegasos patch from the powerpc package, as it will be accepted
     upstream (Sven Luther).
 
-  * Added a errata fix for some recent G4 processors (Sven Luther)
+  * Added a errata fix for some recent G4 processors (Sven Luther).
 
- -- Sven Luther <luther@debian.org>  Tue, 20 Jul 2004 17:45:36 +0200
+  * Fixed the Powerpc/Pegasos marvell discovery II builtin gigabit ethernet
+    driver to use the MAC address set by the firmware, instead of reading the
+    value from the prom in a way specific to the mips board (Sven Luther).
 
+ -- Sven Luther <luther@debian.org>  Thu,  5 Aug 2004 13:31:44 +0200
+
 kernel-source-2.6.7 (2.6.7-3) unstable; urgency=low
 
   * Upgraded the fs-asfs patch to 1.0beta7 (Jens Schmalzing).

Modified: trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/patches/marvell-pegasos.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/patches/marvell-pegasos.dpatch	2004-08-04 19:07:58 UTC (rev 972)
+++ trunk/kernel/source/kernel-source-2.6.7-2.6.7/debian/patches/marvell-pegasos.dpatch	2004-08-05 13:41:59 UTC (rev 973)
@@ -8,10 +8,10 @@
 . $(dirname $0)/DPATCH
 
 @DPATCH@
---- a/drivers/scsi/Kconfig	2004-06-27 17:18:45.305154040 +0200
---- a/drivers/net/Kconfig	2004-07-06 14:06:42.742341968 +0200
-+++ b/drivers/net/Kconfig	2004-07-06 14:09:37.071839856 +0200
-@@ -2132,11 +2109,14 @@
+diff -urN kernel-source-2.6.7.orig/drivers/net/Kconfig kernel-source-2.6.7/drivers/net/Kconfig
+--- kernel-source-2.6.7.orig/drivers/net/Kconfig	2004-08-05 13:06:32.664497528 +0200
++++ kernel-source-2.6.7/drivers/net/Kconfig	2004-07-08 08:08:14.000000000 +0200
+@@ -2068,11 +2068,14 @@
  	  will be called tg3.  This is recommended.
  
  config MV64340_ETH
@@ -29,9 +29,19 @@
  
  config MV64340_ETH_0
  	bool "MV-64340 Port 0"
---- a/drivers/net/mv64340_eth.c	2004-07-05 20:27:28.771946464 +0200
-+++ b/drivers/net/mv64340_eth.c	2004-07-05 20:25:41.274288592 +0200
-@@ -85,6 +85,13 @@
+diff -urN kernel-source-2.6.7.orig/drivers/net/mv64340_eth.c kernel-source-2.6.7/drivers/net/mv64340_eth.c
+--- kernel-source-2.6.7.orig/drivers/net/mv64340_eth.c	2004-08-05 13:06:32.672496312 +0200
++++ kernel-source-2.6.7/drivers/net/mv64340_eth.c	2004-08-05 12:42:24.000000000 +0200
+@@ -76,6 +76,8 @@
+ #endif
+ 
+ /* Static function declarations */
++static void eth_port_uc_addr_get(unsigned int PortNum,
++		                                 unsigned char *MacAddr);
+ static int mv64340_eth_real_open(struct net_device *);
+ static int mv64340_eth_real_stop(struct net_device *);
+ static int mv64340_eth_change_mtu(struct net_device *, int);
+@@ -85,6 +87,13 @@
  static int mv64340_poll(struct net_device *dev, int *budget);
  #endif
  
@@ -45,7 +55,7 @@
  unsigned char prom_mac_addr_base[6];
  unsigned long mv64340_sram_base;
  
-@@ -443,8 +450,17 @@
+@@ -443,8 +452,17 @@
  			skb_put(skb, pkt_info.byte_cnt - 4);
  			skb->dev = dev;
  
@@ -63,20 +73,49 @@
  				skb->csum = htons((pkt_info.cmd_sts
  							& 0x0007fff8) >> 3);
  			}
-@@ -665,8 +681,12 @@
+@@ -488,6 +506,13 @@
+ 		MV_READ(MV64340_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num)) &
+ 		INT_CAUSE_UNMASK_ALL_EXT;
  
++	/*
++	 * If no real interrupt occured, exit.
++	 * This can happen when using gigE interrupt coalescing mechanism or shared interrupt
++	 */
++	if ((eth_int_cause == 0x0) && (eth_int_cause_ext == 0x0))
++		return IRQ_NONE;
++
+ #ifdef MV64340_NAPI
+ 	if (!(eth_int_cause & 0x0007fffd)) {
+ 	/* Dont ack the Rx interrupt */
+@@ -560,13 +585,6 @@
+ 		}
+ 	}
+ 
+-	/*
+-	 * If no real interrupt occured, exit.
+-	 * This can happen when using gigE interrupt coalescing mechanism.
+-	 */
+-	if ((eth_int_cause == 0x0) && (eth_int_cause_ext == 0x0))
+-		return IRQ_NONE;
+-
+ 	return IRQ_HANDLED;
+ }
+ 
+@@ -665,8 +683,13 @@
+ 
  	spin_lock_irq(&mp->lock);
  
 +#if 0
  	err = request_irq(dev->irq, mv64340_eth_int_handler,
  	                  SA_INTERRUPT | SA_SAMPLE_RANDOM, dev->name, dev);
 +#else
-+	err = request_irq(dev->irq, &mv64340_eth_int_handler, SA_SHIRQ, dev->name, dev);
++	err = request_irq(dev->irq, &mv64340_eth_int_handler, SA_SHIRQ | SA_SAMPLE_RANDOM,
++			dev->name, dev);
 +#endif
  
  	if (err) {
  		printk(KERN_ERR "Can not assign IRQ number to MV64340_eth%d\n",
-@@ -752,9 +772,7 @@
+@@ -752,9 +775,7 @@
  		p_rx_desc[i].byte_cnt = 0x0000;
  		p_rx_desc[i].cmd_sts =
  			ETH_BUFFER_OWNED_BY_DMA | ETH_RX_ENABLE_INTERRUPT;
@@ -87,7 +126,7 @@
  		p_rx_desc[i].buf_ptr = buffer_addr;
  
  		mp->rx_skb[i] = NULL;
-@@ -818,9 +836,7 @@
+@@ -818,9 +839,7 @@
  		p_tx_desc[i].byte_cnt	= 0x0000;
  		p_tx_desc[i].l4i_chk	= 0x0000;
  		p_tx_desc[i].cmd_sts	= 0x00000000;
@@ -98,7 +137,7 @@
  		p_tx_desc[i].buf_ptr	= 0x00000000;
  		mp->tx_skb[i]		= NULL;
  	}
-@@ -917,7 +933,7 @@
+@@ -917,7 +936,7 @@
  				    mp->tx_desc_dma);
  		return -ENOMEM;
  	}
@@ -107,7 +146,7 @@
  
  	if (!(ether_init_rx_desc_ring(mp, 0)))
  		panic("%s: Error initializing RX Ring", dev->name);
-@@ -1211,11 +1227,20 @@
+@@ -1211,11 +1230,20 @@
                                          skb_headlen(skb), PCI_DMA_TODEVICE);
                  pkt_info.return_info = 0;
                  ipheader = skb->nh.iph->ihl << 11;
@@ -128,7 +167,7 @@
                  pkt_info.l4i_chk = skb->h.th->check;
                  status = eth_port_send(mp, &pkt_info);
  		if (status != ETH_OK) {
-@@ -1316,7 +1341,7 @@
+@@ -1316,7 +1344,7 @@
   * Input : number of port to initialize
   * Output : -ENONMEM if failed , 0 if success
   */
@@ -137,7 +176,7 @@
  {
  	struct mv64340_private *mp;
  	struct net_device *dev;
-@@ -1324,11 +1349,15 @@
+@@ -1324,11 +1352,15 @@
  
  	dev = alloc_etherdev(sizeof(struct mv64340_private));
  	if (!dev)
@@ -154,7 +193,21 @@
  
  	dev->open = mv64340_eth_open;
  	dev->stop = mv64340_eth_stop;
-@@ -1395,14 +1424,29 @@
+@@ -1369,9 +1401,13 @@
+ 
+ 	spin_lock_init(&mp->lock);
+ 
++#if defined(__powerpc__)
++	eth_port_uc_addr_get(port_num, dev->dev_addr); 
++#else
+ 	/* set MAC addresses */
+ 	memcpy(dev->dev_addr, prom_mac_addr_base, 6);
+ 	dev->dev_addr[5] += port_num;
++#endif
+ 
+ 	err = register_netdev(dev);
+ 	if (err)
+@@ -1395,14 +1431,27 @@
  	printk("RX NAPI Enabled \n");
  #endif
  
@@ -166,17 +219,15 @@
  
 -	return err;
 +	return NULL;
-+}
-+
+ }
+ 
 +static void mv64340_eth_remove(struct net_device *dev)
 +{
-+	struct mv64340_private *mp = netdev_priv(dev);
-+
 +	unregister_netdev(dev);
 +	flush_scheduled_work();
 +	free_netdev(dev);
- }
- 
++}
++
 +// Nico
 +// Better to set that to NULL
 +static struct net_device *mv64340_dev0 = NULL;
@@ -186,7 +237,7 @@
  /*
   * mv64340_init_module
   *
-@@ -1415,20 +1459,30 @@
+@@ -1415,20 +1464,30 @@
  static int __init mv64340_init_module(void)
  {
  	printk(KERN_NOTICE "MV-64340 10/100/1000 Ethernet Driver\n");
@@ -220,13 +271,15 @@
  		printk(KERN_ERR
  		       "Error registering MV-64360 ethernet port 2\n");
  	}
-@@ -1447,7 +1501,13 @@
+@@ -1445,9 +1504,15 @@
+  *
+  * Output : N/A
   */
 -static void __init mv64340_cleanup_module(void)
 +static void __exit mv64340_cleanup_module(void)
  {
 -	/* Nothing to do here ! it's not a removable module */
-+	printk(KERN_NOTICE "MV-64340: Bye bye !\n");
++	printk(KERN_NOTICE "MV-64340: Bye bye cruel world!\n");
 +	if (mv64340_dev2)
 +		mv64340_eth_remove(mv64340_dev2);
 +	if (mv64340_dev1)
@@ -236,7 +289,7 @@
  }
  
  module_init(mv64340_init_module);
-@@ -1758,6 +1818,10 @@
+@@ -1758,6 +1823,10 @@
  	MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(eth_port_num),
  		 mp->port_rx_queue_command);
  
@@ -247,7 +300,31 @@
  	/* Check if link is up */
  	eth_port_read_smi_reg(eth_port_num, 1, &phy_reg_data);
  
-@@ -2016,10 +2080,24 @@
+@@ -1804,6 +1873,23 @@
+ 	return;
+ }
+ 
++static void eth_port_uc_addr_get(unsigned int PortNum,
++				 unsigned char *MacAddr)
++{
++        u32 MacLow;
++        u32 MacHigh;
++
++        MacLow = MV_READ(MV64340_ETH_MAC_ADDR_LOW(PortNum));
++        MacHigh = MV_READ(MV64340_ETH_MAC_ADDR_HIGH(PortNum));
++
++        MacAddr[5] = (MacLow) & 0xff;
++        MacAddr[4] = (MacLow >> 8) & 0xff;
++        MacAddr[3] = (MacHigh) & 0xff;
++        MacAddr[2] = (MacHigh >> 8) & 0xff;
++        MacAddr[1] = (MacHigh >> 16) & 0xff;
++        MacAddr[0] = (MacHigh >> 24) & 0xff;
++}
++
+ /*
+  * eth_port_uc_addr - This function Set the port unicast address table
+  *
+@@ -2016,10 +2102,24 @@
  	unsigned int time_out = 50;
  	unsigned int phy_reg_data;
  
@@ -276,7 +353,7 @@
  
  	/* Poll on the PHY LINK */
  	do {
-@@ -2317,6 +2395,9 @@
+@@ -2317,6 +2417,9 @@
  		return ETH_ERROR;
  
  	tx_next_desc = (tx_desc_curr + 1) % MV64340_TX_QUEUE_SIZE;
@@ -286,17 +363,18 @@
  	command_status = p_pkt_info->cmd_sts | ETH_ZERO_PADDING | ETH_GEN_CRC;
  
  	if (command_status & ETH_TX_FIRST_DESC) {
-@@ -2329,8 +2410,7 @@
+@@ -2329,9 +2432,7 @@
                  first_descriptor->cmd_sts = command_status;
                  first_descriptor->byte_cnt = p_pkt_info->byte_cnt;
                  first_descriptor->buf_ptr = p_pkt_info->buf_ptr;
 -                first_descriptor->next_desc_ptr =
 -			(struct eth_tx_desc *) mp->tx_desc_dma + tx_next_desc;
+-		wmb();
 +                first_descriptor->next_desc_ptr = (u32) mp->tx_desc_dma + tx_next_desc;
- 		wmb();
          } else {
                  tx_first_desc = mp->tx_first_desc_q;
-@@ -2343,11 +2423,12 @@
+                 first_descriptor = &mp->p_tx_desc_area[tx_first_desc];
+@@ -2343,11 +2444,12 @@
                          current_descriptor->next_desc_ptr = 0x00000000;
                  else {
                          command_status |= ETH_BUFFER_OWNED_BY_DMA;
@@ -311,7 +389,24 @@
          if (p_pkt_info->byte_cnt < 8) {
                  printk(" < 8 problem \n");
                  return ETH_ERROR;
-@@ -2378,6 +2459,8 @@
+@@ -2360,8 +2462,6 @@
+ 
+         mp->tx_skb[tx_desc_curr] = (struct sk_buff*) p_pkt_info->return_info;
+ 
+-        wmb();
+-
+         /* Set last desc with DMA ownership and interrupt enable. */
+         if (command_status & ETH_TX_LAST_DESC) {
+                 current_descriptor->cmd_sts = command_status |
+@@ -2370,14 +2470,14 @@
+ 
+ 		if (!(command_status & ETH_TX_FIRST_DESC))
+ 			first_descriptor->cmd_sts |= ETH_BUFFER_OWNED_BY_DMA;
+-		wmb();
+-
+ 		first_chip_ptr = MV_READ(MV64340_ETH_CURRENT_SERVED_TX_DESC_PTR(mp->port_num));
+ 
+ 		/* Apply send command */
  		if (first_chip_ptr == 0x00000000)
  			MV_WRITE(MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_0(mp->port_num), (struct eth_tx_desc *) mp->tx_desc_dma + tx_first_desc);
  
@@ -320,7 +415,7 @@
                  ETH_ENABLE_TX_QUEUE(mp->port_num);
  
  		/*
-@@ -2433,6 +2516,10 @@
+@@ -2433,6 +2533,10 @@
  	 * 64-bit boundary. We use the memory allocated for Tx descriptor.
  	 * This memory is located in TX_BUF_OFFSET_IN_DESC offset within the
  	 * Tx descriptor. */
@@ -331,7 +426,7 @@
  	if (p_pkt_info->byte_cnt <= 8) {
  		printk(KERN_ERR
  		       "You have failed in the < 8 bytes errata - fixme\n");
-@@ -2442,12 +2529,12 @@
+@@ -2442,12 +2546,12 @@
  	current_descriptor->byte_cnt = p_pkt_info->byte_cnt;
  	mp->tx_skb[tx_desc_curr] = (struct sk_buff *) p_pkt_info->return_info;
  
@@ -346,7 +441,7 @@
  	/* Apply send command */
  	ETH_ENABLE_TX_QUEUE(mp->port_num);
  
-@@ -2586,6 +2673,8 @@
+@@ -2586,6 +2690,8 @@
  	/* The following parameters are used to save readings from memory */
  	command_status = p_rx_desc->cmd_sts;
  
@@ -355,8 +450,9 @@
  	/* Nothing to receive... */
  	if (command_status & (ETH_BUFFER_OWNED_BY_DMA))
  		return ETH_END_OF_JOB;
---- a/drivers/net/mv64340_eth.h	2004-07-05 20:27:28.776945704 +0200
-+++ b/drivers/net/mv64340_eth.h	2004-07-05 20:25:41.691225208 +0200
+diff -urN kernel-source-2.6.7.orig/drivers/net/mv64340_eth.h kernel-source-2.6.7/drivers/net/mv64340_eth.h
+--- kernel-source-2.6.7.orig/drivers/net/mv64340_eth.h	2004-08-05 13:06:32.674496008 +0200
++++ kernel-source-2.6.7/drivers/net/mv64340_eth.h	2004-07-08 08:08:14.000000000 +0200
 @@ -51,7 +51,7 @@
  #define ETH_PORT2_IRQ_NUM ETH_PORT0_IRQ_NUM+2	/* main high register, bit1 */
  
@@ -396,8 +492,9 @@
  /* typedefs */
  
  typedef enum _eth_func_ret_status {
---- /dev/null	2004-05-30 14:45:31.000000000 +0200
-+++ b/include/asm-ppc/mv64340.h	2004-07-06 14:08:12.856642512 +0200
+diff -urN kernel-source-2.6.7.orig/include/asm-ppc/mv64340.h kernel-source-2.6.7/include/asm-ppc/mv64340.h
+--- kernel-source-2.6.7.orig/include/asm-ppc/mv64340.h	1970-01-01 01:00:00.000000000 +0100
++++ kernel-source-2.6.7/include/asm-ppc/mv64340.h	2004-07-08 08:08:14.000000000 +0200
 @@ -0,0 +1,1070 @@
 +/*
 + * mv64340.h - MV-64340 Internal registers definition file.