1 --- a/arch/mips/bcm63xx/boards/Kconfig
2 +++ b/arch/mips/bcm63xx/boards/Kconfig
3 @@ -8,4 +8,10 @@ config BOARD_BCM963XX
8 + bool "Inventel Livebox(es) boards"
11 + Inventel Livebox boards using the RedBoot bootloader.
14 --- a/arch/mips/bcm63xx/boards/Makefile
15 +++ b/arch/mips/bcm63xx/boards/Makefile
17 obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o
18 +obj-$(CONFIG_BOARD_LIVEBOX) += board_livebox.o
20 EXTRA_CFLAGS += -Werror
22 +++ b/arch/mips/bcm63xx/boards/board_livebox.c
25 + * This file is subject to the terms and conditions of the GNU General Public
26 + * License. See the file "COPYING" in the main directory of this archive
29 + * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
32 +#include <linux/init.h>
33 +#include <linux/kernel.h>
34 +#include <linux/string.h>
35 +#include <linux/platform_device.h>
36 +#include <linux/mtd/mtd.h>
37 +#include <linux/mtd/partitions.h>
38 +#include <linux/mtd/physmap.h>
39 +#include <asm/addrspace.h>
40 +#include <bcm63xx_board.h>
41 +#include <bcm63xx_cpu.h>
42 +#include <bcm63xx_regs.h>
43 +#include <bcm63xx_io.h>
44 +#include <bcm63xx_board.h>
45 +#include <bcm63xx_dev_pci.h>
46 +#include <bcm63xx_dev_uart.h>
47 +#include <bcm63xx_dev_wdt.h>
48 +#include <bcm63xx_dev_enet.h>
49 +#include <bcm63xx_dev_pcmcia.h>
50 +#include <bcm63xx_dev_usb_ohci.h>
51 +#include <bcm63xx_dev_usb_ehci.h>
52 +#include <board_bcm963xx.h>
54 +#define PFX "board_livebox: "
56 +static unsigned int mac_addr_used = 0;
57 +static struct board_info board;
62 +#ifdef CONFIG_BCM63XX_CPU_6348
63 +static struct board_info __initdata board_livebox = {
65 + .expected_cpu_id = 0x6348,
73 + .use_internal_phy = 1,
77 + .force_speed_100 = 1,
78 + .force_duplex_full = 1,
90 +static const struct board_info __initdata *bcm963xx_boards[] = {
91 +#ifdef CONFIG_BCM63XX_CPU_6348
97 + * early init callback
99 +void __init board_prom_init(void)
103 + /* read base address of boot chip select (0) */
104 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
105 + val &= MPI_CSBASE_BASE_MASK;
107 + /* assume board is a Livebox */
108 + memcpy(&board, bcm963xx_boards[0], sizeof(board));
110 + /* setup pin multiplexing depending on board enabled device,
111 + * this has to be done this early since PCI init is done
112 + * inside arch_initcall */
115 + if (board.has_pci) {
116 + bcm63xx_pci_enabled = 1;
117 + if (BCMCPU_IS_6348())
118 + val |= GPIO_MODE_6348_G2_PCI;
121 + if (board.has_pccard) {
122 + if (BCMCPU_IS_6348())
123 + val |= GPIO_MODE_6348_G1_MII_PCCARD;
126 + if (board.has_enet0 && !board.enet0.use_internal_phy) {
127 + if (BCMCPU_IS_6348())
128 + val |= GPIO_MODE_6348_G3_EXT_MII |
129 + GPIO_MODE_6348_G0_EXT_MII;
132 + if (board.has_enet1 && !board.enet1.use_internal_phy) {
133 + if (BCMCPU_IS_6348())
134 + val |= GPIO_MODE_6348_G3_EXT_MII |
135 + GPIO_MODE_6348_G0_EXT_MII;
138 + bcm_gpio_writel(val, GPIO_MODE_REG);
142 + * second stage init callback, good time to panic if we couldn't
143 + * identify on which board we're running since early printk is working
145 +void __init board_setup(void)
147 + if (!board.name[0])
148 + panic("unable to detect bcm963xx board");
149 + printk(KERN_INFO PFX "board name: %s\n", board.name);
151 + /* make sure we're running on expected cpu */
152 + if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
153 + panic("unexpected CPU for bcm963xx board");
157 + * return board name for /proc/cpuinfo
159 +const char *board_get_name(void)
165 + * register & return a new board mac address
168 +static int board_get_mac_address(u8 *mac)
170 + u8 default_mac[ETH_ALEN] = {0x00, 0x07, 0x3A, 0x00, 0x00, 0x00};
174 + memcpy(mac, default_mac, ETH_ALEN);
176 + p = mac + ETH_ALEN - 1;
177 + count = mac_addr_used;
185 + } while (p != mac);
189 + printk(KERN_ERR PFX "unable to fetch mac address\n");
197 +static struct resource mtd_resources[] = {
199 + .start = 0, /* filled at runtime */
200 + .end = 0, /* filled at runtime */
201 + .flags = IORESOURCE_MEM,
205 +static struct platform_device mtd_dev = {
206 + .name = "bcm963xx-flash",
207 + .resource = mtd_resources,
208 + .num_resources = ARRAY_SIZE(mtd_resources),
213 + * third stage init callback, register all board devices.
215 +int __init board_register_devices(void)
219 + bcm63xx_uart_register();
220 + bcm63xx_wdt_register();
222 + if (board.has_pccard)
223 + bcm63xx_pcmcia_register();
225 + if (board.has_enet0 &&
226 + !board_get_mac_address(board.enet0.mac_addr))
227 + bcm63xx_enet_register(0, &board.enet0);
229 + if (board.has_enet1 &&
230 + !board_get_mac_address(board.enet1.mac_addr))
231 + bcm63xx_enet_register(1, &board.enet1);
233 + if (board.has_ohci0)
234 + bcm63xx_ohci_register();
236 + if (board.has_ehci0)
237 + bcm63xx_ehci_register();
240 + /* read base address of boot chip select (0) */
241 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
242 + val &= MPI_CSBASE_BASE_MASK;
243 + mtd_resources[0].start = val;
244 + mtd_resources[0].end = 0x1FFFFFFF;
246 + platform_device_register(&mtd_dev);