static struct platform_t __init *platform_detect(void) { enum bcm47xx_board board; const char *board_name; board = bcm47xx_board_get(); board_name = bcm47xx_board_get_name(); switch(board) { case BCM47XX_BOARD_BUFFALO_WBR2_G54: return &platforms[WBR2_G54]; case BCM47XX_BOARD_BUFFALO_WLA2_G54L: return &platforms[WLA2_G54L]; case BCM47XX_BOARD_LINKSYS_WRT54G: return &platforms[WRT54G]; case BCM47XX_BOARD_NETGEAR_WNDR3700V3: return &platforms[WNDR3700V3]; case BCM47XX_BOARD_UNKNOWN: case BCM47XX_BOARD_NO: printk(MODULE_NAME ": unknown board found, try legacy detect\n"); printk(MODULE_NAME ": please open a ticket at https://dev.openwrt.org and attach the complete nvram\n"); return platform_detect_legacy(); default: printk(MODULE_NAME ": board was detected as \"%s\", and kernel should handle it\n", board_name); return NULL; } }
/* * This finishes bus initialization doing things that were not possible without * kmalloc. Make sure to call it late enough (after mm_init). */ void __init bcm47xx_bus_setup(void) { #ifdef CONFIG_BCM47XX_BCMA if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { int err; err = bcma_host_soc_init(&bcm47xx_bus.bcma); if (err) panic("Failed to initialize BCMA bus (err %d)", err); } #endif /* With bus initialized we can access NVRAM and detect the board */ bcm47xx_board_detect(); mips_set_machine_name(bcm47xx_board_get_name()); }