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