Search Linux Wireless

Re: [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/5/10 Hauke Mehrtens <hauke@xxxxxxxxxx>:
> Some embedded devices like the Netgear WNDR3300 have two SSB based
> cards without an own sprom on the pci bus. We have to provide two
> different fallback sproms for these and this was not possible with the
> old solution. In the bcm47xx architecture the sprom data is stored in
> the nvram in the main flash storage. The architecture code will be able
> to fill the sprom with the stored data based on the bus where the
> device was found.
>
> The bcm63xx code should do the same thing as before, just using the new
> API.
>
> Acked-by: Michael Buesch <mb@xxxxxxxxx>
> CC: netdev@xxxxxxxxxxxxxxx
> CC: linux-wireless@xxxxxxxxxxxxxxx
> CC: Florian Fainelli <florian@xxxxxxxxxxx>
> Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
> ---
>
> v2: * fix some checkpatch errors and warnings
> Â Â* spelling issues
>
> Âarch/mips/bcm63xx/boards/board_bcm963xx.c | Â 16 +++++++++-
> Âdrivers/ssb/pci.c             |  16 +++++++---
> Âdrivers/ssb/sprom.c            |  43 +++++++++++++++++------------
> Âdrivers/ssb/ssb_private.h         |  Â3 +-
> Âinclude/linux/ssb/ssb.h          |  Â4 ++-
> Â5 files changed, 55 insertions(+), 27 deletions(-)
>
> diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
> index 8dba8cf..40b223b 100644
> --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
> +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
> @@ -643,6 +643,17 @@ static struct ssb_sprom bcm63xx_sprom = {
>    Â.boardflags_lo     Â= 0x2848,
>    Â.boardflags_hi     Â= 0x0000,
> Â};
> +
> +int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
> +{
> + Â Â Â if (bus->bustype == SSB_BUSTYPE_PCI) {
> + Â Â Â Â Â Â Â memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
> + Â Â Â Â Â Â Â return 0;
> + Â Â Â } else {
> + Â Â Â Â Â Â Â printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
> + Â Â Â Â Â Â Â return -EINVAL;
> + Â Â Â }
> +}
> Â#endif
>
> Â/*
> @@ -793,8 +804,9 @@ void __init board_prom_init(void)
> Â Â Â Âif (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
> Â Â Â Â Â Â Â Âmemcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
> Â Â Â Â Â Â Â Âmemcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
> - Â Â Â Â Â Â Â if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
> - Â Â Â Â Â Â Â Â Â Â Â printk(KERN_ERR "failed to register fallback SPROM\n");
> + Â Â Â Â Â Â Â if (ssb_arch_register_fallback_sprom(
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &bcm63xx_get_fallback_sprom) < 0)
> + Â Â Â Â Â Â Â Â Â Â Â printk(KERN_ERR PFX "failed to register fallback SPROM\n");
> Â Â Â Â}
> Â#endif
> Â}
> diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
> index 6f34963..7ad4858 100644
> --- a/drivers/ssb/pci.c
> +++ b/drivers/ssb/pci.c
> @@ -662,7 +662,6 @@ 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;
> Â Â Â Âu16 *buf;
>
> @@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
> Â Â Â Â Â Â Â Â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));
> + Â Â Â Â Â Â Â Â Â Â Â Â* Now we ask the arch code if there is some sprom
> + Â Â Â Â Â Â Â Â Â Â Â Â* available for this device in some other storage */
> + Â Â Â Â Â Â Â Â Â Â Â err = ssb_fill_sprom_with_fallback(bus, sprom);
> + Â Â Â Â Â Â Â Â Â Â Â if (err) {
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ssb_printk(KERN_WARNING PFX "WARNING: Using"
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â" fallback SPROM failed (err %d)\n",
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âerr);

I was recently told we should not duplicate message levels info with
own prefixes ("WARNING: ").

-- 
RafaÅ
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux