Add basic support for Inventel Liveboxes, resync kernel config
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-2.6.27 / 014-inventel_livebox.patch
1 diff -urN linux-2.6.27.4/arch/mips/bcm63xx/boards/Kconfig linux-2.6.27.4.new/arch/mips/bcm63xx/boards/Kconfig
2 --- linux-2.6.27.4/arch/mips/bcm63xx/boards/Kconfig 2008-11-03 20:00:41.000000000 +0100
3 +++ linux-2.6.27.4.new/arch/mips/bcm63xx/boards/Kconfig 2008-11-03 20:02:45.000000000 +0100
4 @@ -7,4 +7,9 @@
5 bool "Generic Broadcom 963xx boards"
6 help
7
8 +config BOARD_LIVEBOX
9 + bool "Inventel Livebox(es) boards"
10 + help
11 + Boards using RedBoot.
12 +
13 endchoice
14 diff -urN linux-2.6.27.4/arch/mips/bcm63xx/boards/Makefile linux-2.6.27.4.new/arch/mips/bcm63xx/boards/Makefile
15 --- linux-2.6.27.4/arch/mips/bcm63xx/boards/Makefile 2008-11-03 20:00:41.000000000 +0100
16 +++ linux-2.6.27.4.new/arch/mips/bcm63xx/boards/Makefile 2008-11-03 20:01:34.000000000 +0100
17 @@ -1 +1,2 @@
18 obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o
19 +obj-$(CONFIG_BOARD_LIVEBOX) += board_livebox.o
20 diff -urN linux-2.6.27.4/arch/mips/bcm63xx/boards/board_livebox.c linux-2.6.27.4.new/arch/mips/bcm63xx/boards/board_livebox.c
21 --- linux-2.6.27.4/arch/mips/bcm63xx/boards/board_livebox.c 1970-01-01 01:00:00.000000000 +0100
22 +++ linux-2.6.27.4.new/arch/mips/bcm63xx/boards/board_livebox.c 2008-11-03 20:03:59.000000000 +0100
23 @@ -0,0 +1,172 @@
24 +/*
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
27 + * for more details.
28 + *
29 + * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
30 + */
31 +
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_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>
52 +
53 +#define PFX "board_livebox: "
54 +
55 +static unsigned int mac_addr_used = 0;
56 +static struct board_info board;
57 +
58 +/*
59 + * known 6348 boards
60 + */
61 +#ifdef CONFIG_BCM63XX_CPU_6348
62 +static struct board_info __initdata board_livebox = {
63 + .name = "Livebox",
64 + .expected_cpu_id = 0x6348,
65 +
66 + .has_enet0 = 1,
67 + .has_pci = 1,
68 +
69 + .enet0 = {
70 + .has_phy = 1,
71 + .use_internal_phy = 1,
72 + },
73 +};
74 +#endif
75 +
76 +/*
77 + * all boards
78 + */
79 +static const struct board_info __initdata *bcm963xx_boards[] = {
80 +#ifdef CONFIG_BCM63XX_CPU_6348
81 + &board_livebox
82 +#endif
83 +};
84 +
85 +/*
86 + * early init callback
87 + */
88 +void __init board_prom_init(void)
89 +{
90 + u32 val;
91 +
92 + /* read base address of boot chip select (0) */
93 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
94 + val &= MPI_CSBASE_BASE_MASK;
95 +
96 + /* assume board is a Livebox */
97 + memcpy(&board, bcm963xx_boards[0], sizeof(board));
98 +
99 + /* setup pin multiplexing depending on board enabled device,
100 + * this has to be done this early since PCI init is done
101 + * inside arch_initcall */
102 + val = 0;
103 +
104 + if (board.has_pci) {
105 + bcm63xx_pci_enabled = 1;
106 + if (BCMCPU_IS_6348())
107 + val |= GPIO_MODE_6348_G2_PCI;
108 + }
109 +
110 + if (board.has_pccard) {
111 + if (BCMCPU_IS_6348())
112 + val |= GPIO_MODE_6348_G1_MII_PCCARD;
113 + }
114 +
115 + if (board.has_enet0 && !board.enet0.use_internal_phy) {
116 + if (BCMCPU_IS_6348())
117 + val |= GPIO_MODE_6348_G3_EXT_MII |
118 + GPIO_MODE_6348_G0_EXT_MII;
119 + }
120 +
121 + if (board.has_enet1 && !board.enet1.use_internal_phy) {
122 + if (BCMCPU_IS_6348())
123 + val |= GPIO_MODE_6348_G3_EXT_MII |
124 + GPIO_MODE_6348_G0_EXT_MII;
125 + }
126 +
127 + bcm_gpio_writel(val, GPIO_MODE_REG);
128 +}
129 +
130 +/*
131 + * second stage init callback, good time to panic if we couldn't
132 + * identify on which board we're running since early printk is working
133 + */
134 +void __init board_setup(void)
135 +{
136 + if (!board.name[0])
137 + panic("unable to detect bcm963xx board");
138 + printk(KERN_INFO PFX "board name: %s\n", board.name);
139 +
140 + /* make sure we're running on expected cpu */
141 + if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
142 + panic("unexpected CPU for bcm963xx board");
143 +}
144 +
145 +/*
146 + * return board name for /proc/cpuinfo
147 + */
148 +const char *board_get_name(void)
149 +{
150 + return board.name;
151 +}
152 +
153 +/*
154 + * register & return a new board mac address
155 + */
156 +static int board_get_mac_address(u8 *mac)
157 +{
158 + /* Not yet implemented */
159 + return 0;
160 +}
161 +
162 +/*
163 + * third stage init callback, register all board devices.
164 + */
165 +int __init board_register_devices(void)
166 +{
167 + u32 val;
168 +
169 + bcm63xx_uart_register();
170 +
171 + if (board.has_pccard)
172 + bcm63xx_pcmcia_register();
173 +
174 + if (board.has_enet0 &&
175 + !board_get_mac_address(board.enet0.mac_addr))
176 + bcm63xx_enet_register(0, &board.enet0);
177 +
178 + if (board.has_enet1 &&
179 + !board_get_mac_address(board.enet1.mac_addr))
180 + bcm63xx_enet_register(1, &board.enet1);
181 +
182 + if (board.has_ohci0)
183 + bcm63xx_ohci_register();
184 +
185 + if (board.has_ehci0)
186 + bcm63xx_ehci_register();
187 +
188 +
189 + /* read base address of boot chip select (0) */
190 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
191 + val &= MPI_CSBASE_BASE_MASK;
192 +
193 + return 0;
194 +}
195 +