2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/string.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 #include <asm/addrspace.h>
17 #include <bcm63xx_board.h>
18 #include <bcm63xx_cpu.h>
19 #include <bcm63xx_regs.h>
20 #include <bcm63xx_io.h>
21 #include <bcm63xx_board.h>
22 #include <bcm63xx_dev_pci.h>
23 #include <bcm63xx_dev_uart.h>
24 #include <bcm63xx_dev_enet.h>
25 #include <bcm63xx_dev_pcmcia.h>
26 #include <bcm63xx_dev_usb_ohci.h>
27 #include <bcm63xx_dev_usb_ehci.h>
28 #include <board_bcm963xx.h>
30 #define PFX "board_livebox: "
32 static unsigned int mac_addr_used
= 0;
33 static struct board_info board
;
38 #ifdef CONFIG_BCM63XX_CPU_6348
39 static struct board_info __initdata board_livebox
= {
41 .expected_cpu_id
= 0x6348,
48 .use_internal_phy
= 1,
56 static const struct board_info __initdata
*bcm963xx_boards
[] = {
57 #ifdef CONFIG_BCM63XX_CPU_6348
65 void __init
board_prom_init(void)
69 /* read base address of boot chip select (0) */
70 val
= bcm_mpi_readl(MPI_CSBASE_REG(0));
71 val
&= MPI_CSBASE_BASE_MASK
;
73 /* assume board is a Livebox */
74 memcpy(&board
, bcm963xx_boards
[0], sizeof(board
));
76 /* setup pin multiplexing depending on board enabled device,
77 * this has to be done this early since PCI init is done
78 * inside arch_initcall */
82 bcm63xx_pci_enabled
= 1;
84 val
|= GPIO_MODE_6348_G2_PCI
;
87 if (board
.has_pccard
) {
89 val
|= GPIO_MODE_6348_G1_MII_PCCARD
;
92 if (board
.has_enet0
&& !board
.enet0
.use_internal_phy
) {
94 val
|= GPIO_MODE_6348_G3_EXT_MII
|
95 GPIO_MODE_6348_G0_EXT_MII
;
98 if (board
.has_enet1
&& !board
.enet1
.use_internal_phy
) {
100 val
|= GPIO_MODE_6348_G3_EXT_MII
|
101 GPIO_MODE_6348_G0_EXT_MII
;
104 bcm_gpio_writel(val
, GPIO_MODE_REG
);
108 * second stage init callback, good time to panic if we couldn't
109 * identify on which board we're running since early printk is working
111 void __init
board_setup(void)
114 panic("unable to detect bcm963xx board");
115 printk(KERN_INFO PFX
"board name: %s\n", board
.name
);
117 /* make sure we're running on expected cpu */
118 if (bcm63xx_get_cpu_id() != board
.expected_cpu_id
)
119 panic("unexpected CPU for bcm963xx board");
123 * return board name for /proc/cpuinfo
125 const char *board_get_name(void)
131 * register & return a new board mac address
133 static int board_get_mac_address(u8
*mac
)
135 /* Not yet implemented */
140 * third stage init callback, register all board devices.
142 int __init
board_register_devices(void)
146 bcm63xx_uart_register();
148 if (board
.has_pccard
)
149 bcm63xx_pcmcia_register();
151 if (board
.has_enet0
&&
152 !board_get_mac_address(board
.enet0
.mac_addr
))
153 bcm63xx_enet_register(0, &board
.enet0
);
155 if (board
.has_enet1
&&
156 !board_get_mac_address(board
.enet1
.mac_addr
))
157 bcm63xx_enet_register(1, &board
.enet1
);
160 bcm63xx_ohci_register();
163 bcm63xx_ehci_register();
166 /* read base address of boot chip select (0) */
167 val
= bcm_mpi_readl(MPI_CSBASE_REG(0));
168 val
&= MPI_CSBASE_BASE_MASK
;