Skip to content

Commit

Permalink
bcma: add boardinfo struct
Browse files Browse the repository at this point in the history
This struct contains information about the board, the chip is running
on. The struct is filled for PCIe devices and SoCs. This information is
used by b43 and will be used by brcmsmac soon.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Hauke Mehrtens authored and John W. Linville committed May 16, 2012
1 parent a9bba18 commit 0a2fcaa
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions arch/mips/bcm47xx/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ static void __init bcm47xx_register_bcma(void)
err = bcma_host_soc_register(&bcm47xx_bus.bcma);
if (err)
panic("Failed to initialize BCMA bus (err %d)", err);

bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
}
#endif

Expand Down
12 changes: 12 additions & 0 deletions arch/mips/bcm47xx/sprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,15 @@ void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
}
#endif

#ifdef CONFIG_BCM47XX_BCMA
void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
const char *prefix)
{
nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0);
if (!boardinfo->vendor)
boardinfo->vendor = SSB_BOARDVENDOR_BCM;

nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
}
#endif
4 changes: 4 additions & 0 deletions arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);
void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
const char *prefix);
#endif
#ifdef CONFIG_BCM47XX_BCMA
void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
const char *prefix);
#endif

#endif /* __ASM_BCM47XX_H */
3 changes: 3 additions & 0 deletions drivers/bcma/host_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ static int __devinit bcma_host_pci_probe(struct pci_dev *dev,
bus->hosttype = BCMA_HOSTTYPE_PCI;
bus->ops = &bcma_host_pci_ops;

bus->boardinfo.vendor = bus->host_pci->subsystem_vendor;
bus->boardinfo.type = bus->host_pci->subsystem_device;

/* Register */
err = bcma_bus_register(bus);
if (err)
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/wireless/b43/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core)
dev->dma_dev = core->dma_dev;
dev->irq = core->irq;

/*
dev->board_vendor = core->bus->boardinfo.vendor;
dev->board_type = core->bus->boardinfo.type;
dev->board_rev = core->bus->boardinfo.rev;
*/
dev->board_rev = core->bus->sprom.board_rev;

dev->chip_id = core->bus->chipinfo.id;
dev->chip_rev = core->bus->chipinfo.rev;
Expand Down
7 changes: 7 additions & 0 deletions include/linux/bcma/bcma.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ struct bcma_chipinfo {
u8 pkg;
};

struct bcma_boardinfo {
u16 vendor;
u16 type;
};

enum bcma_clkmode {
BCMA_CLKMODE_FAST,
BCMA_CLKMODE_DYNAMIC,
Expand Down Expand Up @@ -198,6 +203,8 @@ struct bcma_bus {

struct bcma_chipinfo chipinfo;

struct bcma_boardinfo boardinfo;

struct bcma_device *mapped_core;
struct list_head cores;
u8 nr_cores;
Expand Down

0 comments on commit 0a2fcaa

Please sign in to comment.