/* * early init callback, read nvram data from flash and checksum it */ void __init board_prom_init(void) { unsigned int check_len, i; u8 *boot_addr, *cfe, *p; char cfe_version[32]; u32 val; /* read base address of boot chip select (0) * 6345 does not have MPI but boots from standard * MIPS Flash address */ if (BCMCPU_IS_6345()) val = 0x1fc00000; else { val = bcm_mpi_readl(MPI_CSBASE_REG(0)); val &= MPI_CSBASE_BASE_MASK; } boot_addr = (u8 *)KSEG1ADDR(val); /* dump cfe version */ cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET; if (!memcmp(cfe, "cfe-v", 5)) snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u", cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]); else strcpy(cfe_version, "unknown"); printk(KERN_INFO PFX "CFE version: %s\n", cfe_version); /* extract nvram data */ memcpy(&nvram, boot_addr + BCM963XX_NVRAM_OFFSET, sizeof(nvram)); /* check checksum before using data */ if (nvram.version <= 4) check_len = offsetof(struct bcm963xx_nvram, checksum_old); else
/* * third stage init callback, register all board devices. */ int __init board_register_devices(void) { u32 val; bcm63xx_uart_register(); bcm63xx_wdt_register(); if (board.has_pccard) bcm63xx_pcmcia_register(); if (board.has_enet0 && !board_get_mac_address(board.enet0.mac_addr)) bcm63xx_enet_register(0, &board.enet0); if (board.has_enet1 && !board_get_mac_address(board.enet1.mac_addr)) bcm63xx_enet_register(1, &board.enet1); if (board.has_ohci0) bcm63xx_ohci_register(); if (board.has_ehci0) bcm63xx_ehci_register(); /* read base address of boot chip select (0) */ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); val &= MPI_CSBASE_BASE_MASK; mtd_resources[0].start = val; mtd_resources[0].end = 0x1FFFFFFF; platform_device_register(&mtd_dev); return 0; }
int __init bcm63xx_flash_register(void) { int flash_type; u32 val; flash_type = bcm63xx_detect_flash_type(); switch (flash_type) { case BCM63XX_FLASH_TYPE_PARALLEL: /* read base address of boot chip select (0) */ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); val &= MPI_CSBASE_BASE_MASK; mtd_resources[0].start = val; mtd_resources[0].end = 0x1FFFFFFF; return platform_device_register(&mtd_dev); case BCM63XX_FLASH_TYPE_SERIAL: pr_warn("unsupported serial flash detected\n"); return -ENODEV; case BCM63XX_FLASH_TYPE_NAND: pr_warn("unsupported NAND flash detected\n"); return -ENODEV; default: pr_err("flash detection failed for BCM%x: %d\n", bcm63xx_get_cpu_id(), flash_type); return -ENODEV; } }
int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd) { struct bcm63xx_dsp_platform_data *dpd; u32 val; /* Get the memory window */ val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1)); val &= MPI_CSBASE_BASE_MASK; voip_dsp_resources[0].start = val; voip_dsp_resources[0].end = val + 0xFFFFFFF; voip_dsp_resources[1].start = pd->ext_irq; /* copy given platform data */ dpd = bcm63xx_voip_dsp_device.dev.platform_data; memcpy(dpd, pd, sizeof (*pd)); return platform_device_register(&bcm63xx_voip_dsp_device); }
/* * early init callback */ void __init board_prom_init(void) { u32 val; /* read base address of boot chip select (0) */ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); val &= MPI_CSBASE_BASE_MASK; /* assume board is a Livebox */ memcpy(&board, bcm963xx_boards[0], sizeof(board)); /* setup pin multiplexing depending on board enabled device, * this has to be done this early since PCI init is done * inside arch_initcall */ val = 0; if (board.has_pci) { bcm63xx_pci_enabled = 1; if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G2_PCI; } if (board.has_pccard) { if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G1_MII_PCCARD; } if (board.has_enet0 && !board.enet0.use_internal_phy) { if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G3_EXT_MII | GPIO_MODE_6348_G0_EXT_MII; } if (board.has_enet1 && !board.enet1.use_internal_phy) { if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G3_EXT_MII | GPIO_MODE_6348_G0_EXT_MII; } bcm_gpio_writel(val, GPIO_MODE_REG); }
/* * early init callback, read nvram data from flash and checksum it */ void __init board_prom_init(void) { unsigned int i; u8 *boot_addr, *cfe; char cfe_version[32]; char *board_name; u32 val; /* read base address of boot chip select (0) * 6328 does not have MPI but boots from a fixed address */ if (BCMCPU_IS_6328()) val = 0x18000000; else { val = bcm_mpi_readl(MPI_CSBASE_REG(0)); val &= MPI_CSBASE_BASE_MASK; } boot_addr = (u8 *)KSEG1ADDR(val); /* dump cfe version */ cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET; if (!memcmp(cfe, "cfe-v", 5)) snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u", cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]); else strcpy(cfe_version, "unknown"); printk(KERN_INFO PFX "CFE version: %s\n", cfe_version); bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET); board_name = bcm63xx_nvram_get_name(); /* find board by name */ for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) { if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) continue; /* copy, board desc array is marked initdata */ memcpy(&board, bcm963xx_boards[i], sizeof(board)); break; } /* bail out if board is not found, will complain later */ if (!board.name[0]) { char name[17]; memcpy(name, board_name, 16); name[16] = 0; printk(KERN_ERR PFX "unknown bcm963xx board: %s\n", name); return; } /* setup pin multiplexing depending on board enabled device, * this has to be done this early since PCI init is done * inside arch_initcall */ val = 0; #ifdef CONFIG_PCI if (board.has_pci) { bcm63xx_pci_enabled = 1; if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G2_PCI; } #endif if (board.has_pccard) { if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G1_MII_PCCARD; } if (board.has_enet0 && !board.enet0.use_internal_phy) { if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G3_EXT_MII | GPIO_MODE_6348_G0_EXT_MII; } if (board.has_enet1 && !board.enet1.use_internal_phy) { if (BCMCPU_IS_6348()) val |= GPIO_MODE_6348_G3_EXT_MII | GPIO_MODE_6348_G0_EXT_MII; } bcm_gpio_writel(val, GPIO_MODE_REG); }