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 <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_pci.h>
47 +#include <bcm63xx_dev_enet.h>
48 +#include <bcm63xx_dev_pcmcia.h>
49 +#include <bcm63xx_dev_usb_ohci.h>
50 +#include <bcm63xx_dev_usb_ehci.h>
51 +#include <board_bcm963xx.h>
53 +#define PFX "board_livebox: "
55 +static unsigned int mac_addr_used = 0;
56 +static struct board_info board;
61 +#ifdef CONFIG_BCM63XX_CPU_6348
62 +static struct board_info __initdata board_livebox = {
64 + .expected_cpu_id = 0x6348,
72 + .use_internal_phy = 1,
76 + .force_speed_100 = 1,
77 + .force_duplex_full = 1,
89 +static const struct board_info __initdata *bcm963xx_boards[] = {
90 +#ifdef CONFIG_BCM63XX_CPU_6348
96 + * early init callback
98 +void __init board_prom_init(void)
102 + /* read base address of boot chip select (0) */
103 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
104 + val &= MPI_CSBASE_BASE_MASK;
106 + /* assume board is a Livebox */
107 + memcpy(&board, bcm963xx_boards[0], sizeof(board));
109 + /* setup pin multiplexing depending on board enabled device,
110 + * this has to be done this early since PCI init is done
111 + * inside arch_initcall */
114 + if (board.has_pci) {
115 + bcm63xx_pci_enabled = 1;
116 + if (BCMCPU_IS_6348())
117 + val |= GPIO_MODE_6348_G2_PCI;
120 + if (board.has_pccard) {
121 + if (BCMCPU_IS_6348())
122 + val |= GPIO_MODE_6348_G1_MII_PCCARD;
125 + if (board.has_enet0 && !board.enet0.use_internal_phy) {
126 + if (BCMCPU_IS_6348())
127 + val |= GPIO_MODE_6348_G3_EXT_MII |
128 + GPIO_MODE_6348_G0_EXT_MII;
131 + if (board.has_enet1 && !board.enet1.use_internal_phy) {
132 + if (BCMCPU_IS_6348())
133 + val |= GPIO_MODE_6348_G3_EXT_MII |
134 + GPIO_MODE_6348_G0_EXT_MII;
137 + bcm_gpio_writel(val, GPIO_MODE_REG);
141 + * second stage init callback, good time to panic if we couldn't
142 + * identify on which board we're running since early printk is working
144 +void __init board_setup(void)
146 + if (!board.name[0])
147 + panic("unable to detect bcm963xx board");
148 + printk(KERN_INFO PFX "board name: %s\n", board.name);
150 + /* make sure we're running on expected cpu */
151 + if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
152 + panic("unexpected CPU for bcm963xx board");
156 + * return board name for /proc/cpuinfo
158 +const char *board_get_name(void)
164 + * register & return a new board mac address
167 +static int board_get_mac_address(u8 *mac)
169 + u8 default_mac[ETH_ALEN] = {0x00, 0x07, 0x3A, 0x00, 0x00, 0x00};
173 + memcpy(mac, default_mac, ETH_ALEN);
175 + p = mac + ETH_ALEN - 1;
176 + count = mac_addr_used;
184 + } while (p != mac);
188 + printk(KERN_ERR PFX "unable to fetch mac address\n");
196 +static struct resource mtd_resources[] = {
198 + .start = 0, /* filled at runtime */
199 + .end = 0, /* filled at runtime */
200 + .flags = IORESOURCE_MEM,
204 +static struct platform_device mtd_dev = {
205 + .name = "bcm963xx-flash",
206 + .resource = mtd_resources,
207 + .num_resources = ARRAY_SIZE(mtd_resources),
212 + * third stage init callback, register all board devices.
214 +int __init board_register_devices(void)
218 + if (board.has_pccard)
219 + bcm63xx_pcmcia_register();
221 + if (board.has_enet0 &&
222 + !board_get_mac_address(board.enet0.mac_addr))
223 + bcm63xx_enet_register(0, &board.enet0);
225 + if (board.has_enet1 &&
226 + !board_get_mac_address(board.enet1.mac_addr))
227 + bcm63xx_enet_register(1, &board.enet1);
229 + if (board.has_ohci0)
230 + bcm63xx_ohci_register();
232 + if (board.has_ehci0)
233 + bcm63xx_ehci_register();
236 + /* read base address of boot chip select (0) */
237 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
238 + val &= MPI_CSBASE_BASE_MASK;
239 + mtd_resources[0].start = val;
240 + mtd_resources[0].end = 0x1FFFFFFF;
242 + platform_device_register(&mtd_dev);