diff options
author | Arnd Bergmann <arnd@arndb.de> | 2006-01-12 17:16:42 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 07:25:00 -0500 |
commit | 030d6753f8b6251927330431a7e5f0ac86bc6da9 (patch) | |
tree | 12cab3e13f51b63ced212d2ac909c42ca8c10857 | |
parent | 0d3ea1666f1894a874681fe33e2cb7fee41a0c73 (diff) | |
download | blackbird-op-linux-030d6753f8b6251927330431a7e5f0ac86bc6da9.tar.gz blackbird-op-linux-030d6753f8b6251927330431a7e5f0ac86bc6da9.zip |
[PATCH] spidernet: read firmware from the OF device tree
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 <Jens.Osterkamp@de.ibm.com>
Signed-off-by: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/net/spider_net.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 2154469678b7..94e238f6ed31 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c @@ -1895,16 +1895,27 @@ spider_net_download_firmware(struct spider_net_card *card, 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)) { |