mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
ssb: Add SPROM fallback support
This adds SSB functionality to register a fallback SPROM image from the architecture setup code. Weird architectures exist that have half-assed SSB devices without SPROM attached to their PCI busses. The architecture can register a fallback SPROM image that is used if no SPROM is found on the SSB device. Signed-off-by: Michael Buesch <mb@bu3sch.de> Cc: Florian Fainelli <florian@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
e31ae05083
commit
e79c1ba84c
4 changed files with 54 additions and 1 deletions
|
@ -564,6 +564,7 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
|
|||
static int ssb_pci_sprom_get(struct ssb_bus *bus,
|
||||
struct ssb_sprom *sprom)
|
||||
{
|
||||
const struct ssb_sprom *fallback;
|
||||
int err = -ENOMEM;
|
||||
u16 *buf;
|
||||
|
||||
|
@ -583,12 +584,23 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
|
|||
bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
|
||||
sprom_do_read(bus, buf);
|
||||
err = sprom_check_crc(buf, bus->sprom_size);
|
||||
if (err)
|
||||
if (err) {
|
||||
/* All CRC attempts failed.
|
||||
* Maybe there is no SPROM on the device?
|
||||
* If we have a fallback, use that. */
|
||||
fallback = ssb_get_fallback_sprom();
|
||||
if (fallback) {
|
||||
memcpy(sprom, fallback, sizeof(*sprom));
|
||||
err = 0;
|
||||
goto out_free;
|
||||
}
|
||||
ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
|
||||
" SPROM CRC (corrupt SPROM)\n");
|
||||
}
|
||||
}
|
||||
err = sprom_extract(bus, sprom, buf, bus->sprom_size);
|
||||
|
||||
out_free:
|
||||
kfree(buf);
|
||||
out:
|
||||
return err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue