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 13/14] spidernet: read firmware from the OF device tree
Date: Mon, 05 Dec 2005 22:52:33 -0500 [thread overview]
Message-ID: <20051206040645.368270000@localhost> (raw)
In-Reply-To: 20051206035220.097737000@localhost
[-- Attachment #1: spidernet-fw-from-dt-2.diff --]
[-- Type: text/plain, Size: 1584 bytes --]
request_firmware() is sometimes problematic, especially
in initramfs, reading the firmware from Open Firmware
is much preferrable.
We still try to get the firmware from the file system
first, in order to support old SLOF releases and to allow
updates of the spidernet firmware without reflashing
the system.
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
@@ -1895,16 +1895,27 @@ spider_net_download_firmware(struct spid
static int
spider_net_init_firmware(struct spider_net_card *card)
{
- const struct firmware *firmware;
+ struct firmware *firmware;
+ struct device_node *dn;
+ u8 *fw_prop;
int err = -EIO;
- if (request_firmware(&firmware,
+ if (request_firmware((const struct firmware **)&firmware,
SPIDER_NET_FIRMWARE_NAME, &card->pdev->dev) < 0) {
if (netif_msg_probe(card))
pr_err("Couldn't read in sequencer data file %s.\n",
SPIDER_NET_FIRMWARE_NAME);
- firmware = NULL;
- goto out;
+
+ dn = pci_device_to_OF_node(card->pdev);
+ if (!dn)
+ goto out;
+
+ fw_prop = (u8 *)get_property(dn, "firmware", NULL);
+ if (!fw_prop)
+ goto out;
+
+ memcpy(firmware->data, fw_prop, 6 * SPIDER_NET_FIRMWARE_LEN * sizeof(u32));
+ firmware->size = 6 * SPIDER_NET_FIRMWARE_LEN * sizeof(u32);
}
if (firmware->size != 6 * SPIDER_NET_FIRMWARE_LEN * sizeof(u32)) {
--
next prev parent reply other threads:[~2005-12-06 3:52 UTC|newest]
Thread overview: 7+ 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 ` [PATCH 12/14] spidernet: check if firmware was loaded correctly Arnd Bergmann
2005-12-06 0:59 ` Paul Mackerras
2005-12-06 10:23 ` Arnd Bergmann
2005-12-07 9:53 ` Jens Osterkamp
2005-12-06 3:52 ` Arnd Bergmann [this message]
2005-12-06 3:52 ` [PATCH 14/14] spidernet: fix HW structures for 64 bit dma_addr_t Arnd Bergmann
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.368270000@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).