This adds initial board support for the BT Homehub V1/V1.5 for use with Redboot.

Looks like USB, Wireless, first ethernet port (not second for the
moment) all work.  This is similar to the livebox implementation.

Detail:  Adds 
target/linux/brcm63xx/patches-2.6.35/340-add_bt_homehub_v1_v1.5.patch,
which in turn does:

Modifies /arch/mips/bcm63xx/boards/Kconfig to add the ability to
select the "BT Homehub V1/V1.5 Redboot" board

Modifies /drivers/mtd/maps/bcm963xx-flash.c to make the flash mapping
work when CONFIG_BOARD_BTHOMEHUBV1 is selected.

Adds /arch/mips/bcm63xx/boards/board_bthomehubv1.c, based on
board_livebox.c, but updated for some features of board_bcm63xx.c (I
think livebox may be broken with 2.6.35; the registration of serial
has changed in the kernel).

Modifies /arch/mips/bcm63xx/boards/Makefile to add the new c file when
CONFIG_BOARD_BTHOMEHUBV1 is selected.


Signed-off-by: Simon Hailes <btsimonh at googlemail.com>




Index: target/linux/brcm63xx/patches-2.6.35/340-add_bt_homehub_v1_v1.5.patch
===================================================================
--- target/linux/brcm63xx/patches-2.6.35/340-add_bt_homehub_v1_v1.5.patch
(revision
0)
+++ target/linux/brcm63xx/patches-2.6.35/340-add_bt_homehub_v1_v1.5.patch
(revision
0)
@@ -0,0 +1,496 @@
+--- a/drivers/mtd/maps/bcm963xx-flash.c
++++ b/drivers/mtd/maps/bcm963xx-flash.c
+@@ -169,7 +169,12 @@ static int bcm963xx_probe(struct platfor
+
+  r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+  bcm963xx_map.phys = r->start;
++#ifdef CONFIG_BOARD_BTHOMEHUBV1
++ /* probed size is not correct for HH*/
++ bcm963xx_map.size = 0x00800000;
++#else
+  bcm963xx_map.size = (r->end - r->start) + 1;
++#endif
+  bcm963xx_map.virt = ioremap(r->start, r->end - r->start + 1);
+
+  if (!bcm963xx_map.virt) {
+@@ -202,8 +207,13 @@ static int bcm963xx_probe(struct platfor
+  } else {
+  printk(KERN_INFO PFX "assuming RedBoot bootloader\n");
+  if (bcm963xx_mtd_info->size > 0x00400000) {
++#ifdef CONFIG_BOARD_BTHOMEHUBV1
++ printk(KERN_INFO PFX "Support for extended flash memory size : 0x%lx -
bthomehub virt->be400000\n", bcm963xx_mtd_info->size);
++ bcm963xx_map.virt = (u32)(0xbe400000);
++#else
+  printk(KERN_INFO PFX "Support for extended flash memory size : 0x%lx ;
ONLY 64MBIT SUPPORT\n", bcm963xx_mtd_info->size);
+  bcm963xx_map.virt = (u32)(EXTENDED_SIZE);
++#endif
+  }
+
+ #ifdef CONFIG_MTD_REDBOOT_PARTS
+--- a/arch/mips/bcm63xx/boards/Kconfig
++++ b/arch/mips/bcm63xx/boards/Kconfig
+@@ -14,4 +14,10 @@ config BOARD_LIVEBOX
+  help
+   Inventel Livebox boards using the RedBoot bootloader.
+
++config BOARD_BTHOMEHUBV1
++        bool "BT Homehub V1/V1.5 Redboot"
++        select SSB
++        help
++         BT Homehub V1/V1.5 boards using the RedBoot bootloader.
++
+ endchoice
+--- /dev/null
++++ b/arch/mips/bcm63xx/boards/board_bthomehubv1.c
+@@ -0,0 +1,442 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General
Public
++ * License.  See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2008 Florian Fainelli <[email protected]>
++ */
++
++#include <linux/init.h>
++#include <linux/kernel.h>
++#include <linux/string.h>
++#include <linux/platform_device.h>
++#include <linux/mtd/mtd.h>
++#include <linux/mtd/partitions.h>
++#include <linux/mtd/physmap.h>
++#include <linux/ssb/ssb.h>
++#include <linux/gpio_buttons.h>
++#include <linux/input.h>
++#include <linux/nxp_74hc164.h>
++#include <asm/addrspace.h>
++#include <bcm63xx_board.h>
++#include <bcm63xx_cpu.h>
++#include <bcm63xx_dev_uart.h>
++#include <bcm63xx_regs.h>
++#include <bcm63xx_io.h>
++#include <bcm63xx_dev_pci.h>
++#include <bcm63xx_dev_enet.h>
++#include <bcm63xx_dev_dsp.h>
++#include <bcm63xx_dev_pcmcia.h>
++#include <bcm63xx_dev_usb_ohci.h>
++#include <bcm63xx_dev_usb_ehci.h>
++#include <bcm63xx_dev_usb_udc.h>
++#include <bcm63xx_dev_spi.h>
++#include <board_bcm963xx.h>
++
++#define PFX "board_bthomehubv1: "
++
++static unsigned int mac_addr_used = 0;
++static struct board_info board;
++
++/*
++ * Required export for WL
++ */
++#define NVRAM_SPACE 0x8000
++char nvram_buf[NVRAM_SPACE];
++EXPORT_SYMBOL(nvram_buf);
++
++static struct bcm963xx_nvram nvram =
++{
++ 1,  /*u32 version;*/
++ {0},  /*u8 reserved1[256];*/
++ "MyWireless", /*u8 name[16];*/
++ 0,  /*u32 main_tp_number;*/
++ 0, /*u32 psi_size;*/
++ 1, /*u32 mac_addr_count;*/
++ {0x00, 0x07, 0x3A, 0x00, 0x00, 0x02}, /*u8 mac_addr_base[6];*/
++ {0},  /*u8 reserved2[2];*/
++ 0,  /*u32 checksum_old;*/
++ {0},  /*u8 reserved3[720];*/
++ 0 /*u32 checksum_high;*/
++};
++
++/*
++ * known 6348 boards
++ */
++#ifdef CONFIG_BCM63XX_CPU_6348
++static struct board_info __initdata board_bthomehubv1 = {
++ .name = "BTHomeHubV1",
++
++ .expected_cpu_id = 0x6348,
++
++ .has_uart0 = 1,
++ .has_enet0 = 1,
++ .has_enet1 = 1,
++ .has_pci = 1,
++
++ .enet0 = {
++ .has_phy = 1,
++ .use_internal_phy = 1,
++ },
++
++ .enet1 = {
++ .force_speed_100 = 1,
++ .force_duplex_full = 1,
++ },
++
++ .has_ohci0 = 1,
++ .has_pccard = 1,
++ .has_ehci0 = 1,
++
++ /* the hub has a dsp but im not sure of these */
++ /*.has_dsp = 1,
++ .dsp = {
++ .gpio_rst = 6,
++ .gpio_int = 34,
++ .cs = 2,
++ .ext_irq = 2,
++ },*/
++ .leds = {
++ {
++ .name = "green:1",
++ .gpio = 0,
++ .active_low = 0,
++ },
++ {
++ .name = "green:2",
++ .gpio = 1,
++ .active_low = 0,
++ },
++ {
++ .name = "green:3",
++ .gpio = 2,
++ .active_low = 0,
++ },
++ {
++ .name = "green:4",
++ .gpio = 3,
++ .active_low = 0,
++ },
++ {
++ .name = "green:5",
++ .gpio = 4,
++ .active_low = 0,
++ },
++ {
++ .name = "red:1",
++ .gpio = 5,
++ .active_low = 0,
++ },
++ {
++ .name = "red:2",
++ .gpio = 22,
++ .active_low = 0,
++ },
++ {
++ .name = "red:3",
++ .gpio = 7,
++ .active_low = 0,
++ },
++ {
++ .name = "red:4",
++ .gpio = 29,
++ .active_low = 0,
++ },
++ {
++ .name = "red:5",
++ .gpio = 30,
++ .active_low = 0,
++ },
++ },
++
++};
++#endif
++
++/*
++ * all boards
++ */
++static const struct board_info __initdata *bcm963xx_boards[] = {
++#ifdef CONFIG_BCM63XX_CPU_6348
++ &board_bthomehubv1
++#endif
++};
++
++/*
++ * register & return a new board mac address
++ */
++static int board_get_mac_address(u8 *mac)
++{
++ u8 default_mac[ETH_ALEN] = {0x00, 0x07, 0x3A, 0x00, 0x00, 0x00};
++ u8 *p;
++ int count;
++
++ memcpy(mac, default_mac, ETH_ALEN);
++
++ p = mac + ETH_ALEN - 1;
++ count = mac_addr_used;
++
++ while (count--) {
++ do {
++ (*p)++;
++ if (*p != 0)
++ break;
++ p--;
++ } while (p != mac);
++ }
++
++ if (p == mac) {
++ printk(KERN_ERR PFX "unable to fetch mac address\n");
++ return -ENODEV;
++ }
++
++    mac_addr_used++;
++ return 0;
++}
++
++
++/*
++ * Register a sane SPROMv2 to make the on-board
++ * bcm4318 WLAN work
++ */
++#ifdef CONFIG_SSB_PCIHOST
++static struct ssb_sprom bcm63xx_sprom = {
++ .revision = 0x02,
++ .board_rev = 0x17,
++ .country_code = 0x0,
++ .ant_available_bg  = 0x3,
++ .pa0b0 = 0x15ae,
++ .pa0b1 = 0xfa85,
++ .pa0b2 = 0xfe8d,
++ .pa1b0 = 0xffff,
++ .pa1b1 = 0xffff,
++ .pa1b2 = 0xffff,
++ .gpio0 = 0xff,
++ .gpio1 = 0xff,
++ .gpio2 = 0xff,
++ .gpio3 = 0xff,
++ .maxpwr_bg = 0x004c,
++ .itssi_bg = 0x00,
++ .boardflags_lo = 0x2848,
++ .boardflags_hi = 0x0000,
++};
++#endif
++
++
++/*
++ * early init callback
++ */
++void __init board_prom_init(void)
++{
++ u32 val;
++
++ /* read base address of boot chip select (0) */
++ val = bcm_mpi_readl(MPI_CSBASE_REG(0));
++ val &= MPI_CSBASE_BASE_MASK;
++
++ /* assume board is a bt homehub */
++ memcpy(&board, bcm963xx_boards[0], sizeof(board));
++
++ /* dummy? nvram buffer for wl */
++ memset( nvram_buf, 0, sizeof(nvram_buf) );
++ memcpy( nvram_buf, &nvram, sizeof(nvram) );
++
++ /* setup pin multiplexing depending on board enabled device,
++  * this has to be done this early since PCI init is done
++  * inside arch_initcall */
++ val = 0;
++
++#ifdef CONFIG_PCI
++ if (board.has_pci) {
++ bcm63xx_pci_enabled = 1;
++ if (BCMCPU_IS_6348())
++ val |= GPIO_MODE_6348_G2_PCI;
++ }
++#endif
++
++ if (board.has_pccard) {
++ if (BCMCPU_IS_6348())
++ val |= GPIO_MODE_6348_G1_MII_PCCARD;
++ }
++
++ if (board.has_enet0 && !board.enet0.use_internal_phy) {
++ if (BCMCPU_IS_6348())
++ val |= GPIO_MODE_6348_G3_EXT_MII |
++ GPIO_MODE_6348_G0_EXT_MII;
++ }
++
++ if (board.has_enet1 && !board.enet1.use_internal_phy) {
++ if (BCMCPU_IS_6348())
++ val |= GPIO_MODE_6348_G3_EXT_MII |
++ GPIO_MODE_6348_G0_EXT_MII;
++ else if (BCMCPU_IS_6358())
++ val |= GPIO_MODE_6358_ENET1_MII_CLK_INV;
++ }
++
++ bcm_gpio_writel(val, GPIO_MODE_REG);
++
++ /* Generate MAC address for WLAN and
++  * register our SPROM */
++#ifdef CONFIG_SSB_PCIHOST
++ if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
++ memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
++ memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
++ if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
++ printk(KERN_ERR "failed to register fallback SPROM\n");
++ }
++#endif
++}
++
++/*
++ * second stage init callback, good time to panic if we couldn't
++ * identify on which board we're running since early printk is working
++ */
++void __init board_setup(void)
++{
++ if (!board.name[0])
++ panic("unable to detect homehub board");
++ printk(KERN_INFO PFX "board name: %s\n", board.name);
++
++ /* make sure we're running on expected cpu */
++ if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
++ panic("unexpected CPU for homehub board");
++}
++
++/*
++ * return board name for /proc/cpuinfo
++ */
++const char *board_get_name(void)
++{
++ return board.name;
++}
++
++
++static struct resource mtd_resources[] = {
++ {
++ .start          = 0,    /* filled at runtime */
++ .end            = 0,    /* filled at runtime */
++ .flags          = IORESOURCE_MEM,
++ }
++};
++
++static struct platform_device mtd_dev = {
++ .name                   = "bcm963xx-flash",
++ .resource               = mtd_resources,
++ .num_resources          = ARRAY_SIZE(mtd_resources),
++};
++
++
++static struct resource gpiodev_resource = {
++ .start = 0xFFFFFFFF,
++};
++
++static struct gpio_led_platform_data bcm63xx_led_data;
++
++static struct platform_device bcm63xx_gpio_leds = {
++ .name = "leds-gpio",
++ .id = 0,
++ .dev.platform_data = &bcm63xx_led_data,
++};
++
++static struct gpio_buttons_platform_data bcm63xx_gpio_buttons_data = {
++ .poll_interval  = 20,
++};
++
++static struct platform_device bcm63xx_gpio_buttons_device = {
++ .name = "gpio-buttons",
++ .id = 0,
++ .dev.platform_data = &bcm63xx_gpio_buttons_data,
++};
++
++/*
++ * third stage init callback, register all board devices.
++ */
++int __init board_register_devices(void)
++{
++ u32 val;
++ int led_count = 0;
++ int button_count = 0;
++
++ if (board.has_uart0)
++ bcm63xx_uart_register(0);
++
++ if (board.has_uart1)
++ bcm63xx_uart_register(1);
++
++ if (board.has_pccard)
++ bcm63xx_pcmcia_register();
++
++ if (board.has_enet0 &&
++     !board_get_mac_address(board.enet0.mac_addr))
++ bcm63xx_enet_register(0, &board.enet0);
++
++ if (board.has_enet1 &&
++     !board_get_mac_address(board.enet1.mac_addr))
++ bcm63xx_enet_register(1, &board.enet1);
++
++ if (board.has_ehci0)
++ bcm63xx_ehci_register();
++
++ if (board.has_ohci0)
++ bcm63xx_ohci_register();
++
++ if (board.has_dsp)
++ bcm63xx_dsp_register(&board.dsp);
++
++#ifdef CONFIG_SSB_PCIHOST
++ if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
++ memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
++ memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
++ if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
++ printk(KERN_ERR "failed to register fallback SPROM\n");
++ }
++#endif
++
++ if (board.has_udc0)
++ bcm63xx_udc_register();
++
++ if (!BCMCPU_IS_6345())
++ bcm63xx_spi_register();
++
++ /* read base address of boot chip select (0) */
++ if (BCMCPU_IS_6345())
++ val = 0x1fc00000;
++ else {
++ val = bcm_mpi_readl(MPI_CSBASE_REG(0));
++ val &= MPI_CSBASE_BASE_MASK;
++ }
++
++ printk(KERN_NOTICE " board_bthomehub: MPI_CSBASE_REG(0) = 0x%08lx\n",
(long unsigned int)val);
++
++ mtd_resources[0].start = val;
++ mtd_resources[0].end = 0x1FFFFFFF;
++
++ platform_device_register(&mtd_dev);
++
++ platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1);
++
++ /* count number of LEDs defined by this device */
++ while (led_count < ARRAY_SIZE(board.leds) && board.leds[led_count].name)
++ led_count++;
++
++ bcm63xx_led_data.num_leds = led_count;
++ bcm63xx_led_data.leds = board.leds;
++
++ platform_device_register(&bcm63xx_gpio_leds);
++
++ /* count number of BUTTONs defined by this device */
++ while (button_count < ARRAY_SIZE(board.buttons) &&
board.buttons[button_count].desc)
++ button_count++;
++
++ if (button_count) {
++ bcm63xx_gpio_buttons_data.nbuttons = button_count;
++ bcm63xx_gpio_buttons_data.buttons = board.buttons;
++
++ platform_device_register(&bcm63xx_gpio_buttons_device);
++ }
++
++ if (board.num_devs) {
++ platform_add_devices(board.devs, board.num_devs);
++ }
++
++ return 0;
++}
+\ No newline at end of file
+--- a/arch/mips/bcm63xx/boards/Makefile
++++ b/arch/mips/bcm63xx/boards/Makefile
+@@ -1,4 +1,5 @@
+ obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o
+ obj-$(CONFIG_BOARD_LIVEBOX) += board_livebox.o
++obj-$(CONFIG_BOARD_BTHOMEHUBV1) += board_bthomehubv1.o
+
+ EXTRA_CFLAGS += -Werror
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to