All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: paulus@samba.org
Cc: linuxppc64-dev@ozlabs.org, netdev@vger.kernel.org,
	Arnd Bergmann <arndb@de.ibm.com>,
	Jens.Osterkamp@de.ibm.com
Subject: [PATCH 12/14] spidernet: check if firmware was loaded correctly
Date: Mon, 05 Dec 2005 22:52:32 -0500	[thread overview]
Message-ID: <20051206040645.193163000@localhost> (raw)
In-Reply-To: 20051206035220.097737000@localhost

[-- Attachment #1: spidernet-programcheck.diff --]
[-- Type: text/plain, Size: 1798 bytes --]

Uploading the device firmware may fail if wrong input data
was provided by the user. This checks for the condition.

From: Jens.Osterkamp@de.ibm.com
Cc: netdev@vger.kernel.org
Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>

Index: linux-2.6.15-rc/drivers/net/spider_net.c
===================================================================
--- linux-2.6.15-rc.orig/drivers/net/spider_net.c
+++ linux-2.6.15-rc/drivers/net/spider_net.c
@@ -1836,7 +1836,7 @@ spider_net_setup_phy(struct spider_net_c
  * spider_net_download_firmware loads the firmware opened by
  * spider_net_init_firmware into the adapter.
  */
-static void
+static int 
 spider_net_download_firmware(struct spider_net_card *card,
 			     const struct firmware *firmware)
 {
@@ -1857,8 +1857,13 @@ spider_net_download_firmware(struct spid
 		}
 	}
 
+	if (spider_net_read_reg(card, SPIDER_NET_GSINIT))
+		return -EIO;
+	
 	spider_net_write_reg(card, SPIDER_NET_GSINIT,
 			     SPIDER_NET_RUN_SEQ_VALUE);
+
+	return 0;
 }
 
 /**
@@ -1909,9 +1914,8 @@ spider_net_init_firmware(struct spider_n
 		goto out;
 	}
 
-	spider_net_download_firmware(card, firmware);
-
-	err = 0;
+	if (!spider_net_download_firmware(card, firmware))
+		err = 0;
 out:
 	release_firmware(firmware);
 
Index: linux-2.6.15-rc/drivers/net/spider_net.h
===================================================================
--- linux-2.6.15-rc.orig/drivers/net/spider_net.h
+++ linux-2.6.15-rc/drivers/net/spider_net.h
@@ -155,7 +155,7 @@ extern char spider_net_driver_name[];
 /* set this first, then the FRAMENUM_VALUE */
 #define SPIDER_NET_GFXFRAMES_VALUE	0x00000000
 
-#define SPIDER_NET_STOP_SEQ_VALUE	0x00000000
+#define SPIDER_NET_STOP_SEQ_VALUE	0x007e0000
 #define SPIDER_NET_RUN_SEQ_VALUE	0x0000007e
 
 #define SPIDER_NET_PHY_CTRL_VALUE	0x00040040

--

  parent reply	other threads:[~2005-12-06  3:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20051206035220.097737000@localhost>
2005-12-06  3:52 ` [PATCH 11/14] spidernet: fix Kconfig after BPA->CELL rename Arnd Bergmann
2005-12-06  3:52 ` Arnd Bergmann [this message]
2005-12-06  0:59   ` [PATCH 12/14] spidernet: check if firmware was loaded correctly Paul Mackerras
2005-12-06 10:23     ` Arnd Bergmann
2005-12-07  9:53       ` Jens Osterkamp
2005-12-06  3:52 ` [PATCH 13/14] spidernet: read firmware from the OF device tree Arnd Bergmann
2005-12-06  3:52 ` [PATCH 14/14] spidernet: fix HW structures for 64 bit dma_addr_t Arnd Bergmann
     [not found] ` <200512061118.19633.arnd@arndb.de>
     [not found]   ` <1133869108.7968.1.camel@localhost>
2005-12-06 18:49     ` [PATCH 02/14] spufs: fix local store page refcounting Arnd Bergmann
2005-12-06 19:05       ` Pekka Enberg
2005-12-06 21:10         ` Paul Mackerras
2005-12-06 21:41           ` Pekka Enberg
2005-12-06 22:19             ` Paul Mackerras
2005-12-06 22:27               ` Arnd Bergmann
2005-12-07  2:26               ` Al Viro
2005-12-07  3:15                 ` Paul Mackerras
2005-12-07  8:21                   ` Pekka Enberg
2005-12-07 10:17                   ` Al Viro
2005-12-06 22:14           ` Nathan Lynch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051206040645.193163000@localhost \
    --to=arnd@arndb.de \
    --cc=Jens.Osterkamp@de.ibm.com \
    --cc=arndb@de.ibm.com \
    --cc=linuxppc64-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.