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
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 <linux/input.h>
40 +#include <linux/gpio_buttons.h>
41 +#include <asm/addrspace.h>
42 +#include <bcm63xx_board.h>
43 +#include <bcm63xx_cpu.h>
44 +#include <bcm63xx_regs.h>
45 +#include <bcm63xx_io.h>
46 +#include <bcm63xx_dev_uart.h>
47 +#include <bcm63xx_dev_pci.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,
74 + .use_internal_phy = 1,
78 + .force_speed_100 = 1,
79 + .force_duplex_full = 1,
91 +static const struct board_info __initdata *bcm963xx_boards[] = {
92 +#ifdef CONFIG_BCM63XX_CPU_6348
98 + * early init callback
100 +void __init board_prom_init(void)
104 + /* read base address of boot chip select (0) */
105 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
106 + val &= MPI_CSBASE_BASE_MASK;
108 + /* assume board is a Livebox */
109 + memcpy(&board, bcm963xx_boards[0], sizeof(board));
111 + /* setup pin multiplexing depending on board enabled device,
112 + * this has to be done this early since PCI init is done
113 + * inside arch_initcall */
116 + if (board.has_pci) {
117 + bcm63xx_pci_enabled = 1;
118 + if (BCMCPU_IS_6348())
119 + val |= GPIO_MODE_6348_G2_PCI;
122 + if (board.has_pccard) {
123 + if (BCMCPU_IS_6348())
124 + val |= GPIO_MODE_6348_G1_MII_PCCARD;
127 + if (board.has_enet0 && !board.enet0.use_internal_phy) {
128 + if (BCMCPU_IS_6348())
129 + val |= GPIO_MODE_6348_G3_EXT_MII |
130 + GPIO_MODE_6348_G0_EXT_MII;
133 + if (board.has_enet1 && !board.enet1.use_internal_phy) {
134 + if (BCMCPU_IS_6348())
135 + val |= GPIO_MODE_6348_G3_EXT_MII |
136 + GPIO_MODE_6348_G0_EXT_MII;
139 + bcm_gpio_writel(val, GPIO_MODE_REG);
143 + * second stage init callback, good time to panic if we couldn't
144 + * identify on which board we're running since early printk is working
146 +void __init board_setup(void)
148 + if (!board.name[0])
149 + panic("unable to detect bcm963xx board");
150 + printk(KERN_INFO PFX "board name: %s\n", board.name);
152 + /* make sure we're running on expected cpu */
153 + if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
154 + panic("unexpected CPU for bcm963xx board");
158 + * return board name for /proc/cpuinfo
160 +const char *board_get_name(void)
166 + * register & return a new board mac address
169 +static int board_get_mac_address(u8 *mac)
171 + u8 default_mac[ETH_ALEN] = {0x00, 0x07, 0x3A, 0x00, 0x00, 0x00};
175 + memcpy(mac, default_mac, ETH_ALEN);
177 + p = mac + ETH_ALEN - 1;
178 + count = mac_addr_used;
186 + } while (p != mac);
190 + printk(KERN_ERR PFX "unable to fetch mac address\n");
198 +static struct resource mtd_resources[] = {
200 + .start = 0, /* filled at runtime */
201 + .end = 0, /* filled at runtime */
202 + .flags = IORESOURCE_MEM,
206 +static struct platform_device mtd_dev = {
207 + .name = "bcm963xx-flash",
208 + .resource = mtd_resources,
209 + .num_resources = ARRAY_SIZE(mtd_resources),
214 + * third stage init callback, register all board devices.
216 +int __init board_register_devices(void)
220 + if (board.has_uart0)
221 + bcm63xx_uart_register(0);
223 + if (board.has_pccard)
224 + bcm63xx_pcmcia_register();
226 + if (board.has_enet0 &&
227 + !board_get_mac_address(board.enet0.mac_addr))
228 + bcm63xx_enet_register(0, &board.enet0);
230 + if (board.has_enet1 &&
231 + !board_get_mac_address(board.enet1.mac_addr))
232 + bcm63xx_enet_register(1, &board.enet1);
234 + if (board.has_ohci0)
235 + bcm63xx_ohci_register();
237 + if (board.has_ehci0)
238 + bcm63xx_ehci_register();
241 + /* read base address of boot chip select (0) */
242 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
243 + val &= MPI_CSBASE_BASE_MASK;
244 + mtd_resources[0].start = val;
245 + mtd_resources[0].end = 0x1FFFFFFF;
247 + platform_device_register(&mtd_dev);