summaryrefslogtreecommitdiff
path: root/ANDROID_3.4.5/arch/mips/bcm63xx
diff options
context:
space:
mode:
Diffstat (limited to 'ANDROID_3.4.5/arch/mips/bcm63xx')
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/Kconfig29
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/Makefile5
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/Platform7
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/boards/Kconfig11
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/boards/Makefile3
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/boards/board_bcm963xx.c908
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/clk.c290
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/cpu.c274
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/cs.c144
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/dev-dsp.c56
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/dev-enet.c162
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/dev-pcmcia.c144
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/dev-uart.c75
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/dev-wdt.c37
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/early_printk.c30
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/gpio.c165
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/irq.c505
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/prom.c55
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/setup.c147
-rw-r--r--ANDROID_3.4.5/arch/mips/bcm63xx/timer.c205
20 files changed, 0 insertions, 3252 deletions
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/Kconfig b/ANDROID_3.4.5/arch/mips/bcm63xx/Kconfig
deleted file mode 100644
index 6b1b9ad8..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/Kconfig
+++ /dev/null
@@ -1,29 +0,0 @@
-menu "CPU support"
- depends on BCM63XX
-
-config BCM63XX_CPU_6338
- bool "support 6338 CPU"
- select HW_HAS_PCI
- select USB_ARCH_HAS_OHCI
- select USB_OHCI_BIG_ENDIAN_DESC
- select USB_OHCI_BIG_ENDIAN_MMIO
-
-config BCM63XX_CPU_6345
- bool "support 6345 CPU"
- select USB_OHCI_BIG_ENDIAN_DESC
- select USB_OHCI_BIG_ENDIAN_MMIO
-
-config BCM63XX_CPU_6348
- bool "support 6348 CPU"
- select HW_HAS_PCI
-
-config BCM63XX_CPU_6358
- bool "support 6358 CPU"
- select HW_HAS_PCI
-
-config BCM63XX_CPU_6368
- bool "support 6368 CPU"
- select HW_HAS_PCI
-endmenu
-
-source "arch/mips/bcm63xx/boards/Kconfig"
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/Makefile b/ANDROID_3.4.5/arch/mips/bcm63xx/Makefile
deleted file mode 100644
index 6dfdc699..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
- dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o
-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
-
-obj-y += boards/
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/Platform b/ANDROID_3.4.5/arch/mips/bcm63xx/Platform
deleted file mode 100644
index 5f86b2ff..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/Platform
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Broadcom BCM63XX boards
-#
-platform-$(CONFIG_BCM63XX) += bcm63xx/
-cflags-$(CONFIG_BCM63XX) += \
- -I$(srctree)/arch/mips/include/asm/mach-bcm63xx/
-load-$(CONFIG_BCM63XX) := 0xffffffff80010000
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/boards/Kconfig b/ANDROID_3.4.5/arch/mips/bcm63xx/boards/Kconfig
deleted file mode 100644
index c6aed33d..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/boards/Kconfig
+++ /dev/null
@@ -1,11 +0,0 @@
-choice
- prompt "Board support"
- depends on BCM63XX
- default BOARD_BCM963XX
-
-config BOARD_BCM963XX
- bool "Generic Broadcom 963xx boards"
- select SSB
- help
-
-endchoice
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/boards/Makefile b/ANDROID_3.4.5/arch/mips/bcm63xx/boards/Makefile
deleted file mode 100644
index 9f64fb41..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/boards/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o
-
-ccflags-y := -Werror
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/boards/board_bcm963xx.c b/ANDROID_3.4.5/arch/mips/bcm63xx/boards/board_bcm963xx.c
deleted file mode 100644
index 2f1773f3..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
- */
-
-#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 <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 <board_bcm963xx.h>
-
-#define PFX "board_bcm963xx: "
-
-static struct bcm963xx_nvram nvram;
-static unsigned int mac_addr_used;
-static struct board_info board;
-
-/*
- * known 6338 boards
- */
-#ifdef CONFIG_BCM63XX_CPU_6338
-static struct board_info __initdata board_96338gw = {
- .name = "96338GW",
- .expected_cpu_id = 0x6338,
-
- .has_uart0 = 1,
- .has_enet0 = 1,
- .enet0 = {
- .force_speed_100 = 1,
- .force_duplex_full = 1,
- },
-
- .has_ohci0 = 1,
-
- .leds = {
- {
- .name = "adsl",
- .gpio = 3,
- .active_low = 1,
- },
- {
- .name = "ses",
- .gpio = 5,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 4,
- .active_low = 1,
- },
- {
- .name = "power",
- .gpio = 0,
- .active_low = 1,
- .default_trigger = "default-on",
- },
- {
- .name = "stop",
- .gpio = 1,
- .active_low = 1,
- }
- },
-};
-
-static struct board_info __initdata board_96338w = {
- .name = "96338W",
- .expected_cpu_id = 0x6338,
-
- .has_uart0 = 1,
- .has_enet0 = 1,
- .enet0 = {
- .force_speed_100 = 1,
- .force_duplex_full = 1,
- },
-
- .leds = {
- {
- .name = "adsl",
- .gpio = 3,
- .active_low = 1,
- },
- {
- .name = "ses",
- .gpio = 5,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 4,
- .active_low = 1,
- },
- {
- .name = "power",
- .gpio = 0,
- .active_low = 1,
- .default_trigger = "default-on",
- },
- {
- .name = "stop",
- .gpio = 1,
- .active_low = 1,
- },
- },
-};
-#endif
-
-/*
- * known 6345 boards
- */
-#ifdef CONFIG_BCM63XX_CPU_6345
-static struct board_info __initdata board_96345gw2 = {
- .name = "96345GW2",
- .expected_cpu_id = 0x6345,
-
- .has_uart0 = 1,
-};
-#endif
-
-/*
- * known 6348 boards
- */
-#ifdef CONFIG_BCM63XX_CPU_6348
-static struct board_info __initdata board_96348r = {
- .name = "96348R",
- .expected_cpu_id = 0x6348,
-
- .has_uart0 = 1,
- .has_enet0 = 1,
- .has_pci = 1,
-
- .enet0 = {
- .has_phy = 1,
- .use_internal_phy = 1,
- },
-
- .leds = {
- {
- .name = "adsl-fail",
- .gpio = 2,
- .active_low = 1,
- },
- {
- .name = "ppp",
- .gpio = 3,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 4,
- .active_low = 1,
- },
- {
- .name = "power",
- .gpio = 0,
- .active_low = 1,
- .default_trigger = "default-on",
-
- },
- {
- .name = "stop",
- .gpio = 1,
- .active_low = 1,
- },
- },
-};
-
-static struct board_info __initdata board_96348gw_10 = {
- .name = "96348GW-10",
- .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,
-
- .has_dsp = 1,
- .dsp = {
- .gpio_rst = 6,
- .gpio_int = 34,
- .cs = 2,
- .ext_irq = 2,
- },
-
- .leds = {
- {
- .name = "adsl-fail",
- .gpio = 2,
- .active_low = 1,
- },
- {
- .name = "ppp",
- .gpio = 3,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 4,
- .active_low = 1,
- },
- {
- .name = "power",
- .gpio = 0,
- .active_low = 1,
- .default_trigger = "default-on",
- },
- {
- .name = "stop",
- .gpio = 1,
- .active_low = 1,
- },
- },
-};
-
-static struct board_info __initdata board_96348gw_11 = {
- .name = "96348GW-11",
- .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,
-
- .leds = {
- {
- .name = "adsl-fail",
- .gpio = 2,
- .active_low = 1,
- },
- {
- .name = "ppp",
- .gpio = 3,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 4,
- .active_low = 1,
- },
- {
- .name = "power",
- .gpio = 0,
- .active_low = 1,
- .default_trigger = "default-on",
- },
- {
- .name = "stop",
- .gpio = 1,
- .active_low = 1,
- },
- },
-};
-
-static struct board_info __initdata board_96348gw = {
- .name = "96348GW",
- .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_dsp = 1,
- .dsp = {
- .gpio_rst = 6,
- .gpio_int = 34,
- .ext_irq = 2,
- .cs = 2,
- },
-
- .leds = {
- {
- .name = "adsl-fail",
- .gpio = 2,
- .active_low = 1,
- },
- {
- .name = "ppp",
- .gpio = 3,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 4,
- .active_low = 1,
- },
- {
- .name = "power",
- .gpio = 0,
- .active_low = 1,
- .default_trigger = "default-on",
- },
- {
- .name = "stop",
- .gpio = 1,
- .active_low = 1,
- },
- },
-};
-
-static struct board_info __initdata board_FAST2404 = {
- .name = "F@ST2404",
- .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,
-};
-
-static struct board_info __initdata board_rta1025w_16 = {
- .name = "RTA1025W_16",
- .expected_cpu_id = 0x6348,
-
- .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,
- },
-};
-
-
-static struct board_info __initdata board_DV201AMR = {
- .name = "DV201AMR",
- .expected_cpu_id = 0x6348,
-
- .has_uart0 = 1,
- .has_pci = 1,
- .has_ohci0 = 1,
-
- .has_enet0 = 1,
- .has_enet1 = 1,
- .enet0 = {
- .has_phy = 1,
- .use_internal_phy = 1,
- },
- .enet1 = {
- .force_speed_100 = 1,
- .force_duplex_full = 1,
- },
-};
-
-static struct board_info __initdata board_96348gw_a = {
- .name = "96348GW-A",
- .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,
-};
-#endif
-
-/*
- * known 6358 boards
- */
-#ifdef CONFIG_BCM63XX_CPU_6358
-static struct board_info __initdata board_96358vw = {
- .name = "96358VW",
- .expected_cpu_id = 0x6358,
-
- .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,
-
- .leds = {
- {
- .name = "adsl-fail",
- .gpio = 15,
- .active_low = 1,
- },
- {
- .name = "ppp",
- .gpio = 22,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 23,
- .active_low = 1,
- },
- {
- .name = "power",
- .gpio = 4,
- .default_trigger = "default-on",
- },
- {
- .name = "stop",
- .gpio = 5,
- },
- },
-};
-
-static struct board_info __initdata board_96358vw2 = {
- .name = "96358VW2",
- .expected_cpu_id = 0x6358,
-
- .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,
-
- .leds = {
- {
- .name = "adsl",
- .gpio = 22,
- .active_low = 1,
- },
- {
- .name = "ppp-fail",
- .gpio = 23,
- },
- {
- .name = "power",
- .gpio = 5,
- .active_low = 1,
- .default_trigger = "default-on",
- },
- {
- .name = "stop",
- .gpio = 4,
- .active_low = 1,
- },
- },
-};
-
-static struct board_info __initdata board_AGPFS0 = {
- .name = "AGPF-S0",
- .expected_cpu_id = 0x6358,
-
- .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_ehci0 = 1,
-};
-
-static struct board_info __initdata board_DWVS0 = {
- .name = "DWV-S0",
- .expected_cpu_id = 0x6358,
-
- .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,
-};
-#endif
-
-/*
- * all boards
- */
-static const struct board_info __initdata *bcm963xx_boards[] = {
-#ifdef CONFIG_BCM63XX_CPU_6338
- &board_96338gw,
- &board_96338w,
-#endif
-#ifdef CONFIG_BCM63XX_CPU_6345
- &board_96345gw2,
-#endif
-#ifdef CONFIG_BCM63XX_CPU_6348
- &board_96348r,
- &board_96348gw,
- &board_96348gw_10,
- &board_96348gw_11,
- &board_FAST2404,
- &board_DV201AMR,
- &board_96348gw_a,
- &board_rta1025w_16,
-#endif
-
-#ifdef CONFIG_BCM63XX_CPU_6358
- &board_96358vw,
- &board_96358vw2,
- &board_AGPFS0,
- &board_DWVS0,
-#endif
-};
-
-/*
- * 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,
-};
-
-int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
-{
- if (bus->bustype == SSB_BUSTYPE_PCI) {
- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
- return 0;
- } else {
- printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
- return -EINVAL;
- }
-}
-#endif
-
-/*
- * return board name for /proc/cpuinfo
- */
-const char *board_get_name(void)
-{
- return board.name;
-}
-
-/*
- * register & return a new board mac address
- */
-static int board_get_mac_address(u8 *mac)
-{
- u8 *p;
- int count;
-
- if (mac_addr_used >= nvram.mac_addr_count) {
- printk(KERN_ERR PFX "not enough mac address\n");
- return -ENODEV;
- }
-
- memcpy(mac, nvram.mac_addr_base, 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;
-}
-
-/*
- * early init callback, read nvram data from flash and checksum it
- */
-void __init board_prom_init(void)
-{
- unsigned int check_len, i;
- u8 *boot_addr, *cfe, *p;
- char cfe_version[32];
- u32 val;
-
- /* read base address of boot chip select (0) */
- val = bcm_mpi_readl(MPI_CSBASE_REG(0));
- val &= MPI_CSBASE_BASE_MASK;
- boot_addr = (u8 *)KSEG1ADDR(val);
-
- /* dump cfe version */
- cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
- if (!memcmp(cfe, "cfe-v", 5))
- snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
- cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
- else
- strcpy(cfe_version, "unknown");
- printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
-
- /* extract nvram data */
- memcpy(&nvram, boot_addr + BCM963XX_NVRAM_OFFSET, sizeof(nvram));
-
- /* check checksum before using data */
- if (nvram.version <= 4)
- check_len = offsetof(struct bcm963xx_nvram, checksum_old);
- else
- check_len = sizeof(nvram);
- val = 0;
- p = (u8 *)&nvram;
- while (check_len--)
- val += *p;
- if (val) {
- printk(KERN_ERR PFX "invalid nvram checksum\n");
- return;
- }
-
- /* find board by name */
- for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
- if (strncmp(nvram.name, bcm963xx_boards[i]->name,
- sizeof(nvram.name)))
- continue;
- /* copy, board desc array is marked initdata */
- memcpy(&board, bcm963xx_boards[i], sizeof(board));
- break;
- }
-
- /* bail out if board is not found, will complain later */
- if (!board.name[0]) {
- char name[17];
- memcpy(name, nvram.name, 16);
- name[16] = 0;
- printk(KERN_ERR PFX "unknown bcm963xx board: %s\n",
- name);
- return;
- }
-
- /* 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;
- }
-
- bcm_gpio_writel(val, GPIO_MODE_REG);
-}
-
-/*
- * 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 bcm963xx 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 bcm963xx board");
-}
-
-static struct mtd_partition mtd_partitions[] = {
- {
- .name = "cfe",
- .offset = 0x0,
- .size = 0x40000,
- }
-};
-
-static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
-
-static struct physmap_flash_data flash_data = {
- .width = 2,
- .nr_parts = ARRAY_SIZE(mtd_partitions),
- .parts = mtd_partitions,
- .part_probe_types = bcm63xx_part_types,
-};
-
-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 = "physmap-flash",
- .resource = mtd_resources,
- .num_resources = ARRAY_SIZE(mtd_resources),
- .dev = {
- .platform_data = &flash_data,
- },
-};
-
-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,
-};
-
-/*
- * third stage init callback, register all board devices.
- */
-int __init board_register_devices(void)
-{
- u32 val;
-
- 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_dsp)
- bcm63xx_dsp_register(&board.dsp);
-
- /* Generate MAC address for WLAN and register our SPROM,
- * do this after registering enet devices
- */
-#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_register_fallback_sprom(
- &bcm63xx_get_fallback_sprom) < 0)
- pr_err(PFX "failed to register fallback SPROM\n");
- }
-#endif
-
- /* read base address of boot chip select (0) */
- val = bcm_mpi_readl(MPI_CSBASE_REG(0));
- val &= MPI_CSBASE_BASE_MASK;
-
- mtd_resources[0].start = val;
- mtd_resources[0].end = 0x1FFFFFFF;
-
- platform_device_register(&mtd_dev);
-
- bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
- bcm63xx_led_data.leds = board.leds;
-
- platform_device_register(&bcm63xx_gpio_leds);
-
- return 0;
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/clk.c b/ANDROID_3.4.5/arch/mips/bcm63xx/clk.c
deleted file mode 100644
index 9d57c71b..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/clk.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/module.h>
-#include <linux/mutex.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-#include <bcm63xx_clk.h>
-
-static DEFINE_MUTEX(clocks_mutex);
-
-
-static void clk_enable_unlocked(struct clk *clk)
-{
- if (clk->set && (clk->usage++) == 0)
- clk->set(clk, 1);
-}
-
-static void clk_disable_unlocked(struct clk *clk)
-{
- if (clk->set && (--clk->usage) == 0)
- clk->set(clk, 0);
-}
-
-static void bcm_hwclock_set(u32 mask, int enable)
-{
- u32 reg;
-
- reg = bcm_perf_readl(PERF_CKCTL_REG);
- if (enable)
- reg |= mask;
- else
- reg &= ~mask;
- bcm_perf_writel(reg, PERF_CKCTL_REG);
-}
-
-/*
- * Ethernet MAC "misc" clock: dma clocks and main clock on 6348
- */
-static void enet_misc_set(struct clk *clk, int enable)
-{
- u32 mask;
-
- if (BCMCPU_IS_6338())
- mask = CKCTL_6338_ENET_EN;
- else if (BCMCPU_IS_6345())
- mask = CKCTL_6345_ENET_EN;
- else if (BCMCPU_IS_6348())
- mask = CKCTL_6348_ENET_EN;
- else
- /* BCMCPU_IS_6358 */
- mask = CKCTL_6358_EMUSB_EN;
- bcm_hwclock_set(mask, enable);
-}
-
-static struct clk clk_enet_misc = {
- .set = enet_misc_set,
-};
-
-/*
- * Ethernet MAC clocks: only revelant on 6358, silently enable misc
- * clocks
- */
-static void enetx_set(struct clk *clk, int enable)
-{
- if (enable)
- clk_enable_unlocked(&clk_enet_misc);
- else
- clk_disable_unlocked(&clk_enet_misc);
-
- if (BCMCPU_IS_6358()) {
- u32 mask;
-
- if (clk->id == 0)
- mask = CKCTL_6358_ENET0_EN;
- else
- mask = CKCTL_6358_ENET1_EN;
- bcm_hwclock_set(mask, enable);
- }
-}
-
-static struct clk clk_enet0 = {
- .id = 0,
- .set = enetx_set,
-};
-
-static struct clk clk_enet1 = {
- .id = 1,
- .set = enetx_set,
-};
-
-/*
- * Ethernet PHY clock
- */
-static void ephy_set(struct clk *clk, int enable)
-{
- if (!BCMCPU_IS_6358())
- return;
- bcm_hwclock_set(CKCTL_6358_EPHY_EN, enable);
-}
-
-
-static struct clk clk_ephy = {
- .set = ephy_set,
-};
-
-/*
- * Ethernet switch clock
- */
-static void enetsw_set(struct clk *clk, int enable)
-{
- if (!BCMCPU_IS_6368())
- return;
- bcm_hwclock_set(CKCTL_6368_ROBOSW_CLK_EN |
- CKCTL_6368_SWPKT_USB_EN |
- CKCTL_6368_SWPKT_SAR_EN, enable);
- if (enable) {
- u32 val;
-
- /* reset switch core afer clock change */
- val = bcm_perf_readl(PERF_SOFTRESET_6368_REG);
- val &= ~SOFTRESET_6368_ENETSW_MASK;
- bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
- msleep(10);
- val |= SOFTRESET_6368_ENETSW_MASK;
- bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
- msleep(10);
- }
-}
-
-static struct clk clk_enetsw = {
- .set = enetsw_set,
-};
-
-/*
- * PCM clock
- */
-static void pcm_set(struct clk *clk, int enable)
-{
- if (!BCMCPU_IS_6358())
- return;
- bcm_hwclock_set(CKCTL_6358_PCM_EN, enable);
-}
-
-static struct clk clk_pcm = {
- .set = pcm_set,
-};
-
-/*
- * USB host clock
- */
-static void usbh_set(struct clk *clk, int enable)
-{
- if (BCMCPU_IS_6348())
- bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
- else if (BCMCPU_IS_6368())
- bcm_hwclock_set(CKCTL_6368_USBH_CLK_EN, enable);
-}
-
-static struct clk clk_usbh = {
- .set = usbh_set,
-};
-
-/*
- * SPI clock
- */
-static void spi_set(struct clk *clk, int enable)
-{
- u32 mask;
-
- if (BCMCPU_IS_6338())
- mask = CKCTL_6338_SPI_EN;
- else if (BCMCPU_IS_6348())
- mask = CKCTL_6348_SPI_EN;
- else
- /* BCMCPU_IS_6358 */
- mask = CKCTL_6358_SPI_EN;
- bcm_hwclock_set(mask, enable);
-}
-
-static struct clk clk_spi = {
- .set = spi_set,
-};
-
-/*
- * XTM clock
- */
-static void xtm_set(struct clk *clk, int enable)
-{
- if (!BCMCPU_IS_6368())
- return;
-
- bcm_hwclock_set(CKCTL_6368_SAR_CLK_EN |
- CKCTL_6368_SWPKT_SAR_EN, enable);
-
- if (enable) {
- u32 val;
-
- /* reset sar core afer clock change */
- val = bcm_perf_readl(PERF_SOFTRESET_6368_REG);
- val &= ~SOFTRESET_6368_SAR_MASK;
- bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
- mdelay(1);
- val |= SOFTRESET_6368_SAR_MASK;
- bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
- mdelay(1);
- }
-}
-
-
-static struct clk clk_xtm = {
- .set = xtm_set,
-};
-
-/*
- * Internal peripheral clock
- */
-static struct clk clk_periph = {
- .rate = (50 * 1000 * 1000),
-};
-
-
-/*
- * Linux clock API implementation
- */
-int clk_enable(struct clk *clk)
-{
- mutex_lock(&clocks_mutex);
- clk_enable_unlocked(clk);
- mutex_unlock(&clocks_mutex);
- return 0;
-}
-
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *clk)
-{
- mutex_lock(&clocks_mutex);
- clk_disable_unlocked(clk);
- mutex_unlock(&clocks_mutex);
-}
-
-EXPORT_SYMBOL(clk_disable);
-
-unsigned long clk_get_rate(struct clk *clk)
-{
- return clk->rate;
-}
-
-EXPORT_SYMBOL(clk_get_rate);
-
-struct clk *clk_get(struct device *dev, const char *id)
-{
- if (!strcmp(id, "enet0"))
- return &clk_enet0;
- if (!strcmp(id, "enet1"))
- return &clk_enet1;
- if (!strcmp(id, "enetsw"))
- return &clk_enetsw;
- if (!strcmp(id, "ephy"))
- return &clk_ephy;
- if (!strcmp(id, "usbh"))
- return &clk_usbh;
- if (!strcmp(id, "spi"))
- return &clk_spi;
- if (!strcmp(id, "xtm"))
- return &clk_xtm;
- if (!strcmp(id, "periph"))
- return &clk_periph;
- if (BCMCPU_IS_6358() && !strcmp(id, "pcm"))
- return &clk_pcm;
- return ERR_PTR(-ENOENT);
-}
-
-EXPORT_SYMBOL(clk_get);
-
-void clk_put(struct clk *clk)
-{
-}
-
-EXPORT_SYMBOL(clk_put);
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/cpu.c b/ANDROID_3.4.5/arch/mips/bcm63xx/cpu.c
deleted file mode 100644
index 8f0d6c77..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/cpu.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/cpu.h>
-#include <asm/cpu.h>
-#include <asm/cpu-info.h>
-#include <asm/mipsregs.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_regs.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_irq.h>
-
-const unsigned long *bcm63xx_regs_base;
-EXPORT_SYMBOL(bcm63xx_regs_base);
-
-const int *bcm63xx_irqs;
-EXPORT_SYMBOL(bcm63xx_irqs);
-
-static u16 bcm63xx_cpu_id;
-static u16 bcm63xx_cpu_rev;
-static unsigned int bcm63xx_cpu_freq;
-static unsigned int bcm63xx_memory_size;
-
-static const unsigned long bcm6338_regs_base[] = {
- __GEN_CPU_REGS_TABLE(6338)
-};
-
-static const int bcm6338_irqs[] = {
- __GEN_CPU_IRQ_TABLE(6338)
-};
-
-static const unsigned long bcm6345_regs_base[] = {
- __GEN_CPU_REGS_TABLE(6345)
-};
-
-static const int bcm6345_irqs[] = {
- __GEN_CPU_IRQ_TABLE(6345)
-};
-
-static const unsigned long bcm6348_regs_base[] = {
- __GEN_CPU_REGS_TABLE(6348)
-};
-
-static const int bcm6348_irqs[] = {
- __GEN_CPU_IRQ_TABLE(6348)
-
-};
-
-static const unsigned long bcm6358_regs_base[] = {
- __GEN_CPU_REGS_TABLE(6358)
-};
-
-static const int bcm6358_irqs[] = {
- __GEN_CPU_IRQ_TABLE(6358)
-
-};
-
-static const unsigned long bcm6368_regs_base[] = {
- __GEN_CPU_REGS_TABLE(6368)
-};
-
-static const int bcm6368_irqs[] = {
- __GEN_CPU_IRQ_TABLE(6368)
-
-};
-
-u16 __bcm63xx_get_cpu_id(void)
-{
- return bcm63xx_cpu_id;
-}
-
-EXPORT_SYMBOL(__bcm63xx_get_cpu_id);
-
-u16 bcm63xx_get_cpu_rev(void)
-{
- return bcm63xx_cpu_rev;
-}
-
-EXPORT_SYMBOL(bcm63xx_get_cpu_rev);
-
-unsigned int bcm63xx_get_cpu_freq(void)
-{
- return bcm63xx_cpu_freq;
-}
-
-unsigned int bcm63xx_get_memory_size(void)
-{
- return bcm63xx_memory_size;
-}
-
-static unsigned int detect_cpu_clock(void)
-{
- switch (bcm63xx_get_cpu_id()) {
- case BCM6338_CPU_ID:
- /* BCM6338 has a fixed 240 Mhz frequency */
- return 240000000;
-
- case BCM6345_CPU_ID:
- /* BCM6345 has a fixed 140Mhz frequency */
- return 140000000;
-
- case BCM6348_CPU_ID:
- {
- unsigned int tmp, n1, n2, m1;
-
- /* 16MHz * (N1 + 1) * (N2 + 2) / (M1_CPU + 1) */
- tmp = bcm_perf_readl(PERF_MIPSPLLCTL_REG);
- n1 = (tmp & MIPSPLLCTL_N1_MASK) >> MIPSPLLCTL_N1_SHIFT;
- n2 = (tmp & MIPSPLLCTL_N2_MASK) >> MIPSPLLCTL_N2_SHIFT;
- m1 = (tmp & MIPSPLLCTL_M1CPU_MASK) >> MIPSPLLCTL_M1CPU_SHIFT;
- n1 += 1;
- n2 += 2;
- m1 += 1;
- return (16 * 1000000 * n1 * n2) / m1;
- }
-
- case BCM6358_CPU_ID:
- {
- unsigned int tmp, n1, n2, m1;
-
- /* 16MHz * N1 * N2 / M1_CPU */
- tmp = bcm_ddr_readl(DDR_DMIPSPLLCFG_REG);
- n1 = (tmp & DMIPSPLLCFG_N1_MASK) >> DMIPSPLLCFG_N1_SHIFT;
- n2 = (tmp & DMIPSPLLCFG_N2_MASK) >> DMIPSPLLCFG_N2_SHIFT;
- m1 = (tmp & DMIPSPLLCFG_M1_MASK) >> DMIPSPLLCFG_M1_SHIFT;
- return (16 * 1000000 * n1 * n2) / m1;
- }
-
- case BCM6368_CPU_ID:
- {
- unsigned int tmp, p1, p2, ndiv, m1;
-
- /* (64MHz / P1) * P2 * NDIV / M1_CPU */
- tmp = bcm_ddr_readl(DDR_DMIPSPLLCFG_6368_REG);
-
- p1 = (tmp & DMIPSPLLCFG_6368_P1_MASK) >>
- DMIPSPLLCFG_6368_P1_SHIFT;
-
- p2 = (tmp & DMIPSPLLCFG_6368_P2_MASK) >>
- DMIPSPLLCFG_6368_P2_SHIFT;
-
- ndiv = (tmp & DMIPSPLLCFG_6368_NDIV_MASK) >>
- DMIPSPLLCFG_6368_NDIV_SHIFT;
-
- tmp = bcm_ddr_readl(DDR_DMIPSPLLDIV_6368_REG);
- m1 = (tmp & DMIPSPLLDIV_6368_MDIV_MASK) >>
- DMIPSPLLDIV_6368_MDIV_SHIFT;
-
- return (((64 * 1000000) / p1) * p2 * ndiv) / m1;
- }
-
- default:
- BUG();
- }
-}
-
-/*
- * attempt to detect the amount of memory installed
- */
-static unsigned int detect_memory_size(void)
-{
- unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
- u32 val;
-
- if (BCMCPU_IS_6345()) {
- val = bcm_sdram_readl(SDRAM_MBASE_REG);
- return (val * 8 * 1024 * 1024);
- }
-
- if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
- val = bcm_sdram_readl(SDRAM_CFG_REG);
- rows = (val & SDRAM_CFG_ROW_MASK) >> SDRAM_CFG_ROW_SHIFT;
- cols = (val & SDRAM_CFG_COL_MASK) >> SDRAM_CFG_COL_SHIFT;
- is_32bits = (val & SDRAM_CFG_32B_MASK) ? 1 : 0;
- banks = (val & SDRAM_CFG_BANK_MASK) ? 2 : 1;
- }
-
- if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
- val = bcm_memc_readl(MEMC_CFG_REG);
- rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT;
- cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT;
- is_32bits = (val & MEMC_CFG_32B_MASK) ? 0 : 1;
- banks = 2;
- }
-
- /* 0 => 11 address bits ... 2 => 13 address bits */
- rows += 11;
-
- /* 0 => 8 address bits ... 2 => 10 address bits */
- cols += 8;
-
- return 1 << (cols + rows + (is_32bits + 1) + banks);
-}
-
-void __init bcm63xx_cpu_init(void)
-{
- unsigned int tmp, expected_cpu_id;
- struct cpuinfo_mips *c = &current_cpu_data;
- unsigned int cpu = smp_processor_id();
-
- /* soc registers location depends on cpu type */
- expected_cpu_id = 0;
-
- switch (c->cputype) {
- case CPU_BMIPS3300:
- if ((read_c0_prid() & 0xff00) == PRID_IMP_BMIPS3300_ALT) {
- expected_cpu_id = BCM6348_CPU_ID;
- bcm63xx_regs_base = bcm6348_regs_base;
- bcm63xx_irqs = bcm6348_irqs;
- } else {
- __cpu_name[cpu] = "Broadcom BCM6338";
- expected_cpu_id = BCM6338_CPU_ID;
- bcm63xx_regs_base = bcm6338_regs_base;
- bcm63xx_irqs = bcm6338_irqs;
- }
- break;
- case CPU_BMIPS32:
- expected_cpu_id = BCM6345_CPU_ID;
- bcm63xx_regs_base = bcm6345_regs_base;
- bcm63xx_irqs = bcm6345_irqs;
- break;
- case CPU_BMIPS4350:
- switch (read_c0_prid() & 0xf0) {
- case 0x10:
- expected_cpu_id = BCM6358_CPU_ID;
- bcm63xx_regs_base = bcm6358_regs_base;
- bcm63xx_irqs = bcm6358_irqs;
- break;
- case 0x30:
- expected_cpu_id = BCM6368_CPU_ID;
- bcm63xx_regs_base = bcm6368_regs_base;
- bcm63xx_irqs = bcm6368_irqs;
- break;
- }
- break;
- }
-
- /*
- * really early to panic, but delaying panic would not help since we
- * will never get any working console
- */
- if (!expected_cpu_id)
- panic("unsupported Broadcom CPU");
-
- /*
- * bcm63xx_regs_base is set, we can access soc registers
- */
-
- /* double check CPU type */
- tmp = bcm_perf_readl(PERF_REV_REG);
- bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT;
- bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT;
-
- if (bcm63xx_cpu_id != expected_cpu_id)
- panic("bcm63xx CPU id mismatch");
-
- bcm63xx_cpu_freq = detect_cpu_clock();
- bcm63xx_memory_size = detect_memory_size();
-
- printk(KERN_INFO "Detected Broadcom 0x%04x CPU revision %02x\n",
- bcm63xx_cpu_id, bcm63xx_cpu_rev);
- printk(KERN_INFO "CPU frequency is %u MHz\n",
- bcm63xx_cpu_freq / 1000000);
- printk(KERN_INFO "%uMB of RAM installed\n",
- bcm63xx_memory_size >> 20);
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/cs.c b/ANDROID_3.4.5/arch/mips/bcm63xx/cs.c
deleted file mode 100644
index 50d8190b..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/cs.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <linux/log2.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-#include <bcm63xx_cs.h>
-
-static DEFINE_SPINLOCK(bcm63xx_cs_lock);
-
-/*
- * check if given chip select exists
- */
-static int is_valid_cs(unsigned int cs)
-{
- if (cs > 6)
- return 0;
- return 1;
-}
-
-/*
- * Configure chipselect base address and size (bytes).
- * Size must be a power of two between 8k and 256M.
- */
-int bcm63xx_set_cs_base(unsigned int cs, u32 base, unsigned int size)
-{
- unsigned long flags;
- u32 val;
-
- if (!is_valid_cs(cs))
- return -EINVAL;
-
- /* sanity check on size */
- if (size != roundup_pow_of_two(size))
- return -EINVAL;
-
- if (size < 8 * 1024 || size > 256 * 1024 * 1024)
- return -EINVAL;
-
- val = (base & MPI_CSBASE_BASE_MASK);
- /* 8k => 0 - 256M => 15 */
- val |= (ilog2(size) - ilog2(8 * 1024)) << MPI_CSBASE_SIZE_SHIFT;
-
- spin_lock_irqsave(&bcm63xx_cs_lock, flags);
- bcm_mpi_writel(val, MPI_CSBASE_REG(cs));
- spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
-
- return 0;
-}
-
-EXPORT_SYMBOL(bcm63xx_set_cs_base);
-
-/*
- * configure chipselect timing (ns)
- */
-int bcm63xx_set_cs_timing(unsigned int cs, unsigned int wait,
- unsigned int setup, unsigned int hold)
-{
- unsigned long flags;
- u32 val;
-
- if (!is_valid_cs(cs))
- return -EINVAL;
-
- spin_lock_irqsave(&bcm63xx_cs_lock, flags);
- val = bcm_mpi_readl(MPI_CSCTL_REG(cs));
- val &= ~(MPI_CSCTL_WAIT_MASK);
- val &= ~(MPI_CSCTL_SETUP_MASK);
- val &= ~(MPI_CSCTL_HOLD_MASK);
- val |= wait << MPI_CSCTL_WAIT_SHIFT;
- val |= setup << MPI_CSCTL_SETUP_SHIFT;
- val |= hold << MPI_CSCTL_HOLD_SHIFT;
- bcm_mpi_writel(val, MPI_CSCTL_REG(cs));
- spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
-
- return 0;
-}
-
-EXPORT_SYMBOL(bcm63xx_set_cs_timing);
-
-/*
- * configure other chipselect parameter (data bus size, ...)
- */
-int bcm63xx_set_cs_param(unsigned int cs, u32 params)
-{
- unsigned long flags;
- u32 val;
-
- if (!is_valid_cs(cs))
- return -EINVAL;
-
- /* none of this fields apply to pcmcia */
- if (cs == MPI_CS_PCMCIA_COMMON ||
- cs == MPI_CS_PCMCIA_ATTR ||
- cs == MPI_CS_PCMCIA_IO)
- return -EINVAL;
-
- spin_lock_irqsave(&bcm63xx_cs_lock, flags);
- val = bcm_mpi_readl(MPI_CSCTL_REG(cs));
- val &= ~(MPI_CSCTL_DATA16_MASK);
- val &= ~(MPI_CSCTL_SYNCMODE_MASK);
- val &= ~(MPI_CSCTL_TSIZE_MASK);
- val &= ~(MPI_CSCTL_ENDIANSWAP_MASK);
- val |= params;
- bcm_mpi_writel(val, MPI_CSCTL_REG(cs));
- spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
-
- return 0;
-}
-
-EXPORT_SYMBOL(bcm63xx_set_cs_param);
-
-/*
- * set cs status (enable/disable)
- */
-int bcm63xx_set_cs_status(unsigned int cs, int enable)
-{
- unsigned long flags;
- u32 val;
-
- if (!is_valid_cs(cs))
- return -EINVAL;
-
- spin_lock_irqsave(&bcm63xx_cs_lock, flags);
- val = bcm_mpi_readl(MPI_CSCTL_REG(cs));
- if (enable)
- val |= MPI_CSCTL_ENABLE_MASK;
- else
- val &= ~MPI_CSCTL_ENABLE_MASK;
- bcm_mpi_writel(val, MPI_CSCTL_REG(cs));
- spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
- return 0;
-}
-
-EXPORT_SYMBOL(bcm63xx_set_cs_status);
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-dsp.c b/ANDROID_3.4.5/arch/mips/bcm63xx/dev-dsp.c
deleted file mode 100644
index da46d1d3..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-dsp.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Broadcom BCM63xx VoIP DSP registration
- *
- * 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) 2009 Florian Fainelli <florian@openwrt.org>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_dev_dsp.h>
-#include <bcm63xx_regs.h>
-#include <bcm63xx_io.h>
-
-static struct resource voip_dsp_resources[] = {
- {
- .start = -1, /* filled at runtime */
- .end = -1, /* filled at runtime */
- .flags = IORESOURCE_MEM,
- },
- {
- .start = -1, /* filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct platform_device bcm63xx_voip_dsp_device = {
- .name = "bcm63xx-voip-dsp",
- .id = 0,
- .num_resources = ARRAY_SIZE(voip_dsp_resources),
- .resource = voip_dsp_resources,
-};
-
-int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd)
-{
- struct bcm63xx_dsp_platform_data *dpd;
- u32 val;
-
- /* Get the memory window */
- val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1));
- val &= MPI_CSBASE_BASE_MASK;
- voip_dsp_resources[0].start = val;
- voip_dsp_resources[0].end = val + 0xFFFFFFF;
- voip_dsp_resources[1].start = pd->ext_irq;
-
- /* copy given platform data */
- dpd = bcm63xx_voip_dsp_device.dev.platform_data;
- memcpy(dpd, pd, sizeof (*pd));
-
- return platform_device_register(&bcm63xx_voip_dsp_device);
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-enet.c b/ANDROID_3.4.5/arch/mips/bcm63xx/dev-enet.c
deleted file mode 100644
index 39c23366..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-enet.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <bcm63xx_dev_enet.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-
-static struct resource shared_res[] = {
- {
- .start = -1, /* filled at runtime */
- .end = -1, /* filled at runtime */
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct platform_device bcm63xx_enet_shared_device = {
- .name = "bcm63xx_enet_shared",
- .id = 0,
- .num_resources = ARRAY_SIZE(shared_res),
- .resource = shared_res,
-};
-
-static int shared_device_registered;
-
-static struct resource enet0_res[] = {
- {
- .start = -1, /* filled at runtime */
- .end = -1, /* filled at runtime */
- .flags = IORESOURCE_MEM,
- },
- {
- .start = -1, /* filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
- {
- .start = -1, /* filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
- {
- .start = -1, /* filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct bcm63xx_enet_platform_data enet0_pd;
-
-static struct platform_device bcm63xx_enet0_device = {
- .name = "bcm63xx_enet",
- .id = 0,
- .num_resources = ARRAY_SIZE(enet0_res),
- .resource = enet0_res,
- .dev = {
- .platform_data = &enet0_pd,
- },
-};
-
-static struct resource enet1_res[] = {
- {
- .start = -1, /* filled at runtime */
- .end = -1, /* filled at runtime */
- .flags = IORESOURCE_MEM,
- },
- {
- .start = -1, /* filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
- {
- .start = -1, /* filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
- {
- .start = -1, /* filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct bcm63xx_enet_platform_data enet1_pd;
-
-static struct platform_device bcm63xx_enet1_device = {
- .name = "bcm63xx_enet",
- .id = 1,
- .num_resources = ARRAY_SIZE(enet1_res),
- .resource = enet1_res,
- .dev = {
- .platform_data = &enet1_pd,
- },
-};
-
-int __init bcm63xx_enet_register(int unit,
- const struct bcm63xx_enet_platform_data *pd)
-{
- struct platform_device *pdev;
- struct bcm63xx_enet_platform_data *dpd;
- int ret;
-
- if (unit > 1)
- return -ENODEV;
-
- if (unit == 1 && BCMCPU_IS_6338())
- return -ENODEV;
-
- if (!shared_device_registered) {
- shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA);
- shared_res[0].end = shared_res[0].start;
- if (BCMCPU_IS_6338())
- shared_res[0].end += (RSET_ENETDMA_SIZE / 2) - 1;
- else
- shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
-
- ret = platform_device_register(&bcm63xx_enet_shared_device);
- if (ret)
- return ret;
- shared_device_registered = 1;
- }
-
- if (unit == 0) {
- enet0_res[0].start = bcm63xx_regset_address(RSET_ENET0);
- enet0_res[0].end = enet0_res[0].start;
- enet0_res[0].end += RSET_ENET_SIZE - 1;
- enet0_res[1].start = bcm63xx_get_irq_number(IRQ_ENET0);
- enet0_res[2].start = bcm63xx_get_irq_number(IRQ_ENET0_RXDMA);
- enet0_res[3].start = bcm63xx_get_irq_number(IRQ_ENET0_TXDMA);
- pdev = &bcm63xx_enet0_device;
- } else {
- enet1_res[0].start = bcm63xx_regset_address(RSET_ENET1);
- enet1_res[0].end = enet1_res[0].start;
- enet1_res[0].end += RSET_ENET_SIZE - 1;
- enet1_res[1].start = bcm63xx_get_irq_number(IRQ_ENET1);
- enet1_res[2].start = bcm63xx_get_irq_number(IRQ_ENET1_RXDMA);
- enet1_res[3].start = bcm63xx_get_irq_number(IRQ_ENET1_TXDMA);
- pdev = &bcm63xx_enet1_device;
- }
-
- /* copy given platform data */
- dpd = pdev->dev.platform_data;
- memcpy(dpd, pd, sizeof(*pd));
-
- /* adjust them in case internal phy is used */
- if (dpd->use_internal_phy) {
-
- /* internal phy only exists for enet0 */
- if (unit == 1)
- return -ENODEV;
-
- dpd->phy_id = 1;
- dpd->has_phy_interrupt = 1;
- dpd->phy_interrupt = bcm63xx_get_irq_number(IRQ_ENET_PHY);
- }
-
- ret = platform_device_register(pdev);
- if (ret)
- return ret;
- return 0;
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-pcmcia.c b/ANDROID_3.4.5/arch/mips/bcm63xx/dev-pcmcia.c
deleted file mode 100644
index de4d917f..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-pcmcia.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <asm/bootinfo.h>
-#include <linux/platform_device.h>
-#include <bcm63xx_cs.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_dev_pcmcia.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-
-static struct resource pcmcia_resources[] = {
- /* pcmcia registers */
- {
- /* start & end filled at runtime */
- .flags = IORESOURCE_MEM,
- },
-
- /* pcmcia memory zone resources */
- {
- .start = BCM_PCMCIA_COMMON_BASE_PA,
- .end = BCM_PCMCIA_COMMON_END_PA,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = BCM_PCMCIA_ATTR_BASE_PA,
- .end = BCM_PCMCIA_ATTR_END_PA,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = BCM_PCMCIA_IO_BASE_PA,
- .end = BCM_PCMCIA_IO_END_PA,
- .flags = IORESOURCE_MEM,
- },
-
- /* PCMCIA irq */
- {
- /* start filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-
- /* declare PCMCIA IO resource also */
- {
- .start = BCM_PCMCIA_IO_BASE_PA,
- .end = BCM_PCMCIA_IO_END_PA,
- .flags = IORESOURCE_IO,
- },
-};
-
-static struct bcm63xx_pcmcia_platform_data pd;
-
-static struct platform_device bcm63xx_pcmcia_device = {
- .name = "bcm63xx_pcmcia",
- .id = 0,
- .num_resources = ARRAY_SIZE(pcmcia_resources),
- .resource = pcmcia_resources,
- .dev = {
- .platform_data = &pd,
- },
-};
-
-static int __init config_pcmcia_cs(unsigned int cs,
- u32 base, unsigned int size)
-{
- int ret;
-
- ret = bcm63xx_set_cs_status(cs, 0);
- if (!ret)
- ret = bcm63xx_set_cs_base(cs, base, size);
- if (!ret)
- ret = bcm63xx_set_cs_status(cs, 1);
- return ret;
-}
-
-static const __initdata struct {
- unsigned int cs;
- unsigned int base;
- unsigned int size;
-} pcmcia_cs[3] = {
- {
- .cs = MPI_CS_PCMCIA_COMMON,
- .base = BCM_PCMCIA_COMMON_BASE_PA,
- .size = BCM_PCMCIA_COMMON_SIZE
- },
- {
- .cs = MPI_CS_PCMCIA_ATTR,
- .base = BCM_PCMCIA_ATTR_BASE_PA,
- .size = BCM_PCMCIA_ATTR_SIZE
- },
- {
- .cs = MPI_CS_PCMCIA_IO,
- .base = BCM_PCMCIA_IO_BASE_PA,
- .size = BCM_PCMCIA_IO_SIZE
- },
-};
-
-int __init bcm63xx_pcmcia_register(void)
-{
- int ret, i;
-
- if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358())
- return 0;
-
- /* use correct pcmcia ready gpio depending on processor */
- switch (bcm63xx_get_cpu_id()) {
- case BCM6348_CPU_ID:
- pd.ready_gpio = 22;
- break;
-
- case BCM6358_CPU_ID:
- pd.ready_gpio = 18;
- break;
-
- default:
- return -ENODEV;
- }
-
- pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA);
- pcmcia_resources[0].end = pcmcia_resources[0].start +
- RSET_PCMCIA_SIZE - 1;
- pcmcia_resources[4].start = bcm63xx_get_irq_number(IRQ_PCMCIA);
-
- /* configure pcmcia chip selects */
- for (i = 0; i < 3; i++) {
- ret = config_pcmcia_cs(pcmcia_cs[i].cs,
- pcmcia_cs[i].base,
- pcmcia_cs[i].size);
- if (ret)
- goto out_err;
- }
-
- return platform_device_register(&bcm63xx_pcmcia_device);
-
-out_err:
- printk(KERN_ERR "unable to set pcmcia chip select\n");
- return ret;
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-uart.c b/ANDROID_3.4.5/arch/mips/bcm63xx/dev-uart.c
deleted file mode 100644
index d6e42c60..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-uart.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <bcm63xx_cpu.h>
-
-static struct resource uart0_resources[] = {
- {
- /* start & end filled at runtime */
- .flags = IORESOURCE_MEM,
- },
- {
- /* start filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct resource uart1_resources[] = {
- {
- /* start & end filled at runtime */
- .flags = IORESOURCE_MEM,
- },
- {
- /* start filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct platform_device bcm63xx_uart_devices[] = {
- {
- .name = "bcm63xx_uart",
- .id = 0,
- .num_resources = ARRAY_SIZE(uart0_resources),
- .resource = uart0_resources,
- },
-
- {
- .name = "bcm63xx_uart",
- .id = 1,
- .num_resources = ARRAY_SIZE(uart1_resources),
- .resource = uart1_resources,
- }
-};
-
-int __init bcm63xx_uart_register(unsigned int id)
-{
- if (id >= ARRAY_SIZE(bcm63xx_uart_devices))
- return -ENODEV;
-
- if (id == 1 && (!BCMCPU_IS_6358() && !BCMCPU_IS_6368()))
- return -ENODEV;
-
- if (id == 0) {
- uart0_resources[0].start = bcm63xx_regset_address(RSET_UART0);
- uart0_resources[0].end = uart0_resources[0].start +
- RSET_UART_SIZE - 1;
- uart0_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0);
- }
-
- if (id == 1) {
- uart1_resources[0].start = bcm63xx_regset_address(RSET_UART1);
- uart1_resources[0].end = uart1_resources[0].start +
- RSET_UART_SIZE - 1;
- uart1_resources[1].start = bcm63xx_get_irq_number(IRQ_UART1);
- }
-
- return platform_device_register(&bcm63xx_uart_devices[id]);
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-wdt.c b/ANDROID_3.4.5/arch/mips/bcm63xx/dev-wdt.c
deleted file mode 100644
index 3e6c716a..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/dev-wdt.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 <florian@openwrt.org>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <bcm63xx_cpu.h>
-
-static struct resource wdt_resources[] = {
- {
- .start = -1, /* filled at runtime */
- .end = -1, /* filled at runtime */
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct platform_device bcm63xx_wdt_device = {
- .name = "bcm63xx-wdt",
- .id = 0,
- .num_resources = ARRAY_SIZE(wdt_resources),
- .resource = wdt_resources,
-};
-
-int __init bcm63xx_wdt_register(void)
-{
- wdt_resources[0].start = bcm63xx_regset_address(RSET_WDT);
- wdt_resources[0].end = wdt_resources[0].start;
- wdt_resources[0].end += RSET_WDT_SIZE - 1;
-
- return platform_device_register(&bcm63xx_wdt_device);
-}
-arch_initcall(bcm63xx_wdt_register);
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/early_printk.c b/ANDROID_3.4.5/arch/mips/bcm63xx/early_printk.c
deleted file mode 100644
index bf353c93..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/early_printk.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-
-static void __init wait_xfered(void)
-{
- unsigned int val;
-
- /* wait for any previous char to be transmitted */
- do {
- val = bcm_uart0_readl(UART_IR_REG);
- if (val & UART_IR_STAT(UART_IR_TXEMPTY))
- break;
- } while (1);
-}
-
-void __init prom_putchar(char c)
-{
- wait_xfered();
- bcm_uart0_writel(c, UART_FIFO_REG);
- wait_xfered();
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/gpio.c b/ANDROID_3.4.5/arch/mips/bcm63xx/gpio.c
deleted file mode 100644
index a6c2135d..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/gpio.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- * Copyright (C) 2008-2011 Florian Fainelli <florian@openwrt.org>
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_gpio.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-
-#ifndef BCMCPU_RUNTIME_DETECT
-#define gpio_out_low_reg GPIO_DATA_LO_REG
-#ifdef CONFIG_BCM63XX_CPU_6345
-#ifdef gpio_out_low_reg
-#undef gpio_out_low_reg
-#define gpio_out_low_reg GPIO_DATA_LO_REG_6345
-#endif /* gpio_out_low_reg */
-#endif /* CONFIG_BCM63XX_CPU_6345 */
-
-static inline void bcm63xx_gpio_out_low_reg_init(void)
-{
-}
-#else /* ! BCMCPU_RUNTIME_DETECT */
-static u32 gpio_out_low_reg;
-
-static void bcm63xx_gpio_out_low_reg_init(void)
-{
- switch (bcm63xx_get_cpu_id()) {
- case BCM6345_CPU_ID:
- gpio_out_low_reg = GPIO_DATA_LO_REG_6345;
- break;
- default:
- gpio_out_low_reg = GPIO_DATA_LO_REG;
- break;
- }
-}
-#endif /* ! BCMCPU_RUNTIME_DETECT */
-
-static DEFINE_SPINLOCK(bcm63xx_gpio_lock);
-static u32 gpio_out_low, gpio_out_high;
-
-static void bcm63xx_gpio_set(struct gpio_chip *chip,
- unsigned gpio, int val)
-{
- u32 reg;
- u32 mask;
- u32 *v;
- unsigned long flags;
-
- if (gpio >= chip->ngpio)
- BUG();
-
- if (gpio < 32) {
- reg = gpio_out_low_reg;
- mask = 1 << gpio;
- v = &gpio_out_low;
- } else {
- reg = GPIO_DATA_HI_REG;
- mask = 1 << (gpio - 32);
- v = &gpio_out_high;
- }
-
- spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
- if (val)
- *v |= mask;
- else
- *v &= ~mask;
- bcm_gpio_writel(*v, reg);
- spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
-}
-
-static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
-{
- u32 reg;
- u32 mask;
-
- if (gpio >= chip->ngpio)
- BUG();
-
- if (gpio < 32) {
- reg = gpio_out_low_reg;
- mask = 1 << gpio;
- } else {
- reg = GPIO_DATA_HI_REG;
- mask = 1 << (gpio - 32);
- }
-
- return !!(bcm_gpio_readl(reg) & mask);
-}
-
-static int bcm63xx_gpio_set_direction(struct gpio_chip *chip,
- unsigned gpio, int dir)
-{
- u32 reg;
- u32 mask;
- u32 tmp;
- unsigned long flags;
-
- if (gpio >= chip->ngpio)
- BUG();
-
- if (gpio < 32) {
- reg = GPIO_CTL_LO_REG;
- mask = 1 << gpio;
- } else {
- reg = GPIO_CTL_HI_REG;
- mask = 1 << (gpio - 32);
- }
-
- spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
- tmp = bcm_gpio_readl(reg);
- if (dir == BCM63XX_GPIO_DIR_IN)
- tmp &= ~mask;
- else
- tmp |= mask;
- bcm_gpio_writel(tmp, reg);
- spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
-
- return 0;
-}
-
-static int bcm63xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
-{
- return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_IN);
-}
-
-static int bcm63xx_gpio_direction_output(struct gpio_chip *chip,
- unsigned gpio, int value)
-{
- bcm63xx_gpio_set(chip, gpio, value);
- return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_OUT);
-}
-
-
-static struct gpio_chip bcm63xx_gpio_chip = {
- .label = "bcm63xx-gpio",
- .direction_input = bcm63xx_gpio_direction_input,
- .direction_output = bcm63xx_gpio_direction_output,
- .get = bcm63xx_gpio_get,
- .set = bcm63xx_gpio_set,
- .base = 0,
-};
-
-int __init bcm63xx_gpio_init(void)
-{
- bcm63xx_gpio_out_low_reg_init();
-
- gpio_out_low = bcm_gpio_readl(gpio_out_low_reg);
- if (!BCMCPU_IS_6345())
- gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
- bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
- pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
-
- return gpiochip_add(&bcm63xx_gpio_chip);
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/irq.c b/ANDROID_3.4.5/arch/mips/bcm63xx/irq.c
deleted file mode 100644
index 9a216a45..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/irq.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- * Copyright (C) 2008 Nicolas Schichan <nschichan@freebox.fr>
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/module.h>
-#include <linux/irq.h>
-#include <asm/irq_cpu.h>
-#include <asm/mipsregs.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_regs.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_irq.h>
-
-static void __dispatch_internal(void) __maybe_unused;
-static void __dispatch_internal_64(void) __maybe_unused;
-static void __internal_irq_mask_32(unsigned int irq) __maybe_unused;
-static void __internal_irq_mask_64(unsigned int irq) __maybe_unused;
-static void __internal_irq_unmask_32(unsigned int irq) __maybe_unused;
-static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused;
-
-#ifndef BCMCPU_RUNTIME_DETECT
-#ifdef CONFIG_BCM63XX_CPU_6338
-#define irq_stat_reg PERF_IRQSTAT_6338_REG
-#define irq_mask_reg PERF_IRQMASK_6338_REG
-#define irq_bits 32
-#define is_ext_irq_cascaded 0
-#define ext_irq_start 0
-#define ext_irq_end 0
-#define ext_irq_count 4
-#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6338
-#define ext_irq_cfg_reg2 0
-#endif
-#ifdef CONFIG_BCM63XX_CPU_6345
-#define irq_stat_reg PERF_IRQSTAT_6345_REG
-#define irq_mask_reg PERF_IRQMASK_6345_REG
-#define irq_bits 32
-#define is_ext_irq_cascaded 0
-#define ext_irq_start 0
-#define ext_irq_end 0
-#define ext_irq_count 0
-#define ext_irq_cfg_reg1 0
-#define ext_irq_cfg_reg2 0
-#endif
-#ifdef CONFIG_BCM63XX_CPU_6348
-#define irq_stat_reg PERF_IRQSTAT_6348_REG
-#define irq_mask_reg PERF_IRQMASK_6348_REG
-#define irq_bits 32
-#define is_ext_irq_cascaded 0
-#define ext_irq_start 0
-#define ext_irq_end 0
-#define ext_irq_count 4
-#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6348
-#define ext_irq_cfg_reg2 0
-#endif
-#ifdef CONFIG_BCM63XX_CPU_6358
-#define irq_stat_reg PERF_IRQSTAT_6358_REG
-#define irq_mask_reg PERF_IRQMASK_6358_REG
-#define irq_bits 32
-#define is_ext_irq_cascaded 1
-#define ext_irq_start (BCM_6358_EXT_IRQ0 - IRQ_INTERNAL_BASE)
-#define ext_irq_end (BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE)
-#define ext_irq_count 4
-#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6358
-#define ext_irq_cfg_reg2 0
-#endif
-#ifdef CONFIG_BCM63XX_CPU_6368
-#define irq_stat_reg PERF_IRQSTAT_6368_REG
-#define irq_mask_reg PERF_IRQMASK_6368_REG
-#define irq_bits 64
-#define is_ext_irq_cascaded 1
-#define ext_irq_start (BCM_6368_EXT_IRQ0 - IRQ_INTERNAL_BASE)
-#define ext_irq_end (BCM_6368_EXT_IRQ5 - IRQ_INTERNAL_BASE)
-#define ext_irq_count 6
-#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6368
-#define ext_irq_cfg_reg2 PERF_EXTIRQ_CFG_REG2_6368
-#endif
-
-#if irq_bits == 32
-#define dispatch_internal __dispatch_internal
-#define internal_irq_mask __internal_irq_mask_32
-#define internal_irq_unmask __internal_irq_unmask_32
-#else
-#define dispatch_internal __dispatch_internal_64
-#define internal_irq_mask __internal_irq_mask_64
-#define internal_irq_unmask __internal_irq_unmask_64
-#endif
-
-#define irq_stat_addr (bcm63xx_regset_address(RSET_PERF) + irq_stat_reg)
-#define irq_mask_addr (bcm63xx_regset_address(RSET_PERF) + irq_mask_reg)
-
-static inline void bcm63xx_init_irq(void)
-{
-}
-#else /* ! BCMCPU_RUNTIME_DETECT */
-
-static u32 irq_stat_addr, irq_mask_addr;
-static void (*dispatch_internal)(void);
-static int is_ext_irq_cascaded;
-static unsigned int ext_irq_count;
-static unsigned int ext_irq_start, ext_irq_end;
-static unsigned int ext_irq_cfg_reg1, ext_irq_cfg_reg2;
-static void (*internal_irq_mask)(unsigned int irq);
-static void (*internal_irq_unmask)(unsigned int irq);
-
-static void bcm63xx_init_irq(void)
-{
- int irq_bits;
-
- irq_stat_addr = bcm63xx_regset_address(RSET_PERF);
- irq_mask_addr = bcm63xx_regset_address(RSET_PERF);
-
- switch (bcm63xx_get_cpu_id()) {
- case BCM6338_CPU_ID:
- irq_stat_addr += PERF_IRQSTAT_6338_REG;
- irq_mask_addr += PERF_IRQMASK_6338_REG;
- irq_bits = 32;
- break;
- case BCM6345_CPU_ID:
- irq_stat_addr += PERF_IRQSTAT_6345_REG;
- irq_mask_addr += PERF_IRQMASK_6345_REG;
- irq_bits = 32;
- break;
- case BCM6348_CPU_ID:
- irq_stat_addr += PERF_IRQSTAT_6348_REG;
- irq_mask_addr += PERF_IRQMASK_6348_REG;
- irq_bits = 32;
- ext_irq_count = 4;
- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6348;
- break;
- case BCM6358_CPU_ID:
- irq_stat_addr += PERF_IRQSTAT_6358_REG;
- irq_mask_addr += PERF_IRQMASK_6358_REG;
- irq_bits = 32;
- ext_irq_count = 4;
- is_ext_irq_cascaded = 1;
- ext_irq_start = BCM_6358_EXT_IRQ0 - IRQ_INTERNAL_BASE;
- ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE;
- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358;
- break;
- case BCM6368_CPU_ID:
- irq_stat_addr += PERF_IRQSTAT_6368_REG;
- irq_mask_addr += PERF_IRQMASK_6368_REG;
- irq_bits = 64;
- ext_irq_count = 6;
- is_ext_irq_cascaded = 1;
- ext_irq_start = BCM_6368_EXT_IRQ0 - IRQ_INTERNAL_BASE;
- ext_irq_end = BCM_6368_EXT_IRQ5 - IRQ_INTERNAL_BASE;
- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6368;
- ext_irq_cfg_reg2 = PERF_EXTIRQ_CFG_REG2_6368;
- break;
- default:
- BUG();
- }
-
- if (irq_bits == 32) {
- dispatch_internal = __dispatch_internal;
- internal_irq_mask = __internal_irq_mask_32;
- internal_irq_unmask = __internal_irq_unmask_32;
- } else {
- dispatch_internal = __dispatch_internal_64;
- internal_irq_mask = __internal_irq_mask_64;
- internal_irq_unmask = __internal_irq_unmask_64;
- }
-}
-#endif /* ! BCMCPU_RUNTIME_DETECT */
-
-static inline u32 get_ext_irq_perf_reg(int irq)
-{
- if (irq < 4)
- return ext_irq_cfg_reg1;
- return ext_irq_cfg_reg2;
-}
-
-static inline void handle_internal(int intbit)
-{
- if (is_ext_irq_cascaded &&
- intbit >= ext_irq_start && intbit <= ext_irq_end)
- do_IRQ(intbit - ext_irq_start + IRQ_EXTERNAL_BASE);
- else
- do_IRQ(intbit + IRQ_INTERNAL_BASE);
-}
-
-/*
- * dispatch internal devices IRQ (uart, enet, watchdog, ...). do not
- * prioritize any interrupt relatively to another. the static counter
- * will resume the loop where it ended the last time we left this
- * function.
- */
-static void __dispatch_internal(void)
-{
- u32 pending;
- static int i;
-
- pending = bcm_readl(irq_stat_addr) & bcm_readl(irq_mask_addr);
-
- if (!pending)
- return ;
-
- while (1) {
- int to_call = i;
-
- i = (i + 1) & 0x1f;
- if (pending & (1 << to_call)) {
- handle_internal(to_call);
- break;
- }
- }
-}
-
-static void __dispatch_internal_64(void)
-{
- u64 pending;
- static int i;
-
- pending = bcm_readq(irq_stat_addr) & bcm_readq(irq_mask_addr);
-
- if (!pending)
- return ;
-
- while (1) {
- int to_call = i;
-
- i = (i + 1) & 0x3f;
- if (pending & (1ull << to_call)) {
- handle_internal(to_call);
- break;
- }
- }
-}
-
-asmlinkage void plat_irq_dispatch(void)
-{
- u32 cause;
-
- do {
- cause = read_c0_cause() & read_c0_status() & ST0_IM;
-
- if (!cause)
- break;
-
- if (cause & CAUSEF_IP7)
- do_IRQ(7);
- if (cause & CAUSEF_IP2)
- dispatch_internal();
- if (!is_ext_irq_cascaded) {
- if (cause & CAUSEF_IP3)
- do_IRQ(IRQ_EXT_0);
- if (cause & CAUSEF_IP4)
- do_IRQ(IRQ_EXT_1);
- if (cause & CAUSEF_IP5)
- do_IRQ(IRQ_EXT_2);
- if (cause & CAUSEF_IP6)
- do_IRQ(IRQ_EXT_3);
- }
- } while (1);
-}
-
-/*
- * internal IRQs operations: only mask/unmask on PERF irq mask
- * register.
- */
-static void __internal_irq_mask_32(unsigned int irq)
-{
- u32 mask;
-
- mask = bcm_readl(irq_mask_addr);
- mask &= ~(1 << irq);
- bcm_writel(mask, irq_mask_addr);
-}
-
-static void __internal_irq_mask_64(unsigned int irq)
-{
- u64 mask;
-
- mask = bcm_readq(irq_mask_addr);
- mask &= ~(1ull << irq);
- bcm_writeq(mask, irq_mask_addr);
-}
-
-static void __internal_irq_unmask_32(unsigned int irq)
-{
- u32 mask;
-
- mask = bcm_readl(irq_mask_addr);
- mask |= (1 << irq);
- bcm_writel(mask, irq_mask_addr);
-}
-
-static void __internal_irq_unmask_64(unsigned int irq)
-{
- u64 mask;
-
- mask = bcm_readq(irq_mask_addr);
- mask |= (1ull << irq);
- bcm_writeq(mask, irq_mask_addr);
-}
-
-static void bcm63xx_internal_irq_mask(struct irq_data *d)
-{
- internal_irq_mask(d->irq - IRQ_INTERNAL_BASE);
-}
-
-static void bcm63xx_internal_irq_unmask(struct irq_data *d)
-{
- internal_irq_unmask(d->irq - IRQ_INTERNAL_BASE);
-}
-
-/*
- * external IRQs operations: mask/unmask and clear on PERF external
- * irq control register.
- */
-static void bcm63xx_external_irq_mask(struct irq_data *d)
-{
- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
- u32 reg, regaddr;
-
- regaddr = get_ext_irq_perf_reg(irq);
- reg = bcm_perf_readl(regaddr);
-
- if (BCMCPU_IS_6348())
- reg &= ~EXTIRQ_CFG_MASK_6348(irq % 4);
- else
- reg &= ~EXTIRQ_CFG_MASK(irq % 4);
-
- bcm_perf_writel(reg, regaddr);
- if (is_ext_irq_cascaded)
- internal_irq_mask(irq + ext_irq_start);
-}
-
-static void bcm63xx_external_irq_unmask(struct irq_data *d)
-{
- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
- u32 reg, regaddr;
-
- regaddr = get_ext_irq_perf_reg(irq);
- reg = bcm_perf_readl(regaddr);
-
- if (BCMCPU_IS_6348())
- reg |= EXTIRQ_CFG_MASK_6348(irq % 4);
- else
- reg |= EXTIRQ_CFG_MASK(irq % 4);
-
- bcm_perf_writel(reg, regaddr);
-
- if (is_ext_irq_cascaded)
- internal_irq_unmask(irq + ext_irq_start);
-}
-
-static void bcm63xx_external_irq_clear(struct irq_data *d)
-{
- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
- u32 reg, regaddr;
-
- regaddr = get_ext_irq_perf_reg(irq);
- reg = bcm_perf_readl(regaddr);
-
- if (BCMCPU_IS_6348())
- reg |= EXTIRQ_CFG_CLEAR_6348(irq % 4);
- else
- reg |= EXTIRQ_CFG_CLEAR(irq % 4);
-
- bcm_perf_writel(reg, regaddr);
-}
-
-static int bcm63xx_external_irq_set_type(struct irq_data *d,
- unsigned int flow_type)
-{
- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
- u32 reg, regaddr;
- int levelsense, sense, bothedge;
-
- flow_type &= IRQ_TYPE_SENSE_MASK;
-
- if (flow_type == IRQ_TYPE_NONE)
- flow_type = IRQ_TYPE_LEVEL_LOW;
-
- levelsense = sense = bothedge = 0;
- switch (flow_type) {
- case IRQ_TYPE_EDGE_BOTH:
- bothedge = 1;
- break;
-
- case IRQ_TYPE_EDGE_RISING:
- sense = 1;
- break;
-
- case IRQ_TYPE_EDGE_FALLING:
- break;
-
- case IRQ_TYPE_LEVEL_HIGH:
- levelsense = 1;
- sense = 1;
- break;
-
- case IRQ_TYPE_LEVEL_LOW:
- levelsense = 1;
- break;
-
- default:
- printk(KERN_ERR "bogus flow type combination given !\n");
- return -EINVAL;
- }
-
- regaddr = get_ext_irq_perf_reg(irq);
- reg = bcm_perf_readl(regaddr);
- irq %= 4;
-
- if (BCMCPU_IS_6348()) {
- if (levelsense)
- reg |= EXTIRQ_CFG_LEVELSENSE_6348(irq);
- else
- reg &= ~EXTIRQ_CFG_LEVELSENSE_6348(irq);
- if (sense)
- reg |= EXTIRQ_CFG_SENSE_6348(irq);
- else
- reg &= ~EXTIRQ_CFG_SENSE_6348(irq);
- if (bothedge)
- reg |= EXTIRQ_CFG_BOTHEDGE_6348(irq);
- else
- reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq);
- }
-
- if (BCMCPU_IS_6338() || BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
- if (levelsense)
- reg |= EXTIRQ_CFG_LEVELSENSE(irq);
- else
- reg &= ~EXTIRQ_CFG_LEVELSENSE(irq);
- if (sense)
- reg |= EXTIRQ_CFG_SENSE(irq);
- else
- reg &= ~EXTIRQ_CFG_SENSE(irq);
- if (bothedge)
- reg |= EXTIRQ_CFG_BOTHEDGE(irq);
- else
- reg &= ~EXTIRQ_CFG_BOTHEDGE(irq);
- }
-
- bcm_perf_writel(reg, regaddr);
-
- irqd_set_trigger_type(d, flow_type);
- if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
- __irq_set_handler_locked(d->irq, handle_level_irq);
- else
- __irq_set_handler_locked(d->irq, handle_edge_irq);
-
- return IRQ_SET_MASK_OK_NOCOPY;
-}
-
-static struct irq_chip bcm63xx_internal_irq_chip = {
- .name = "bcm63xx_ipic",
- .irq_mask = bcm63xx_internal_irq_mask,
- .irq_unmask = bcm63xx_internal_irq_unmask,
-};
-
-static struct irq_chip bcm63xx_external_irq_chip = {
- .name = "bcm63xx_epic",
- .irq_ack = bcm63xx_external_irq_clear,
-
- .irq_mask = bcm63xx_external_irq_mask,
- .irq_unmask = bcm63xx_external_irq_unmask,
-
- .irq_set_type = bcm63xx_external_irq_set_type,
-};
-
-static struct irqaction cpu_ip2_cascade_action = {
- .handler = no_action,
- .name = "cascade_ip2",
- .flags = IRQF_NO_THREAD,
-};
-
-static struct irqaction cpu_ext_cascade_action = {
- .handler = no_action,
- .name = "cascade_extirq",
- .flags = IRQF_NO_THREAD,
-};
-
-void __init arch_init_irq(void)
-{
- int i;
-
- bcm63xx_init_irq();
- mips_cpu_irq_init();
- for (i = IRQ_INTERNAL_BASE; i < NR_IRQS; ++i)
- irq_set_chip_and_handler(i, &bcm63xx_internal_irq_chip,
- handle_level_irq);
-
- for (i = IRQ_EXTERNAL_BASE; i < IRQ_EXTERNAL_BASE + ext_irq_count; ++i)
- irq_set_chip_and_handler(i, &bcm63xx_external_irq_chip,
- handle_edge_irq);
-
- if (!is_ext_irq_cascaded) {
- for (i = 3; i < 3 + ext_irq_count; ++i)
- setup_irq(MIPS_CPU_IRQ_BASE + i, &cpu_ext_cascade_action);
- }
-
- setup_irq(MIPS_CPU_IRQ_BASE + 2, &cpu_ip2_cascade_action);
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/prom.c b/ANDROID_3.4.5/arch/mips/bcm63xx/prom.c
deleted file mode 100644
index 99d7f405..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/prom.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <linux/bootmem.h>
-#include <asm/bootinfo.h>
-#include <bcm63xx_board.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_regs.h>
-#include <bcm63xx_gpio.h>
-
-void __init prom_init(void)
-{
- u32 reg, mask;
-
- bcm63xx_cpu_init();
-
- /* stop any running watchdog */
- bcm_wdt_writel(WDT_STOP_1, WDT_CTL_REG);
- bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG);
-
- /* disable all hardware blocks clock for now */
- if (BCMCPU_IS_6338())
- mask = CKCTL_6338_ALL_SAFE_EN;
- else if (BCMCPU_IS_6345())
- mask = CKCTL_6345_ALL_SAFE_EN;
- else if (BCMCPU_IS_6348())
- mask = CKCTL_6348_ALL_SAFE_EN;
- else if (BCMCPU_IS_6358())
- mask = CKCTL_6358_ALL_SAFE_EN;
- else if (BCMCPU_IS_6368())
- mask = CKCTL_6368_ALL_SAFE_EN;
- else
- mask = 0;
-
- reg = bcm_perf_readl(PERF_CKCTL_REG);
- reg &= ~mask;
- bcm_perf_writel(reg, PERF_CKCTL_REG);
-
- /* register gpiochip */
- bcm63xx_gpio_init();
-
- /* do low level board init */
- board_prom_init();
-}
-
-void __init prom_free_prom_memory(void)
-{
-}
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/setup.c b/ANDROID_3.4.5/arch/mips/bcm63xx/setup.c
deleted file mode 100644
index 356b0558..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/setup.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/bootmem.h>
-#include <linux/ioport.h>
-#include <linux/pm.h>
-#include <asm/bootinfo.h>
-#include <asm/time.h>
-#include <asm/reboot.h>
-#include <asm/cacheflush.h>
-#include <bcm63xx_board.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_regs.h>
-#include <bcm63xx_io.h>
-
-void bcm63xx_machine_halt(void)
-{
- printk(KERN_INFO "System halted\n");
- while (1)
- ;
-}
-
-static void bcm6348_a1_reboot(void)
-{
- u32 reg;
-
- /* soft reset all blocks */
- printk(KERN_INFO "soft-resetting all blocks ...\n");
- reg = bcm_perf_readl(PERF_SOFTRESET_REG);
- reg &= ~SOFTRESET_6348_ALL;
- bcm_perf_writel(reg, PERF_SOFTRESET_REG);
- mdelay(10);
-
- reg = bcm_perf_readl(PERF_SOFTRESET_REG);
- reg |= SOFTRESET_6348_ALL;
- bcm_perf_writel(reg, PERF_SOFTRESET_REG);
- mdelay(10);
-
- /* Jump to the power on address. */
- printk(KERN_INFO "jumping to reset vector.\n");
- /* set high vectors (base at 0xbfc00000 */
- set_c0_status(ST0_BEV | ST0_ERL);
- /* run uncached in kseg0 */
- change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
- __flush_cache_all();
- /* remove all wired TLB entries */
- write_c0_wired(0);
- __asm__ __volatile__(
- "jr\t%0"
- :
- : "r" (0xbfc00000));
- while (1)
- ;
-}
-
-void bcm63xx_machine_reboot(void)
-{
- u32 reg, perf_regs[2] = { 0, 0 };
- unsigned int i;
-
- /* mask and clear all external irq */
- switch (bcm63xx_get_cpu_id()) {
- case BCM6338_CPU_ID:
- perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338;
- break;
- case BCM6348_CPU_ID:
- perf_regs[0] = PERF_EXTIRQ_CFG_REG_6348;
- break;
- case BCM6358_CPU_ID:
- perf_regs[0] = PERF_EXTIRQ_CFG_REG_6358;
- break;
- }
-
- for (i = 0; i < 2; i++) {
- reg = bcm_perf_readl(perf_regs[i]);
- if (BCMCPU_IS_6348()) {
- reg &= ~EXTIRQ_CFG_MASK_ALL_6348;
- reg |= EXTIRQ_CFG_CLEAR_ALL_6348;
- } else {
- reg &= ~EXTIRQ_CFG_MASK_ALL;
- reg |= EXTIRQ_CFG_CLEAR_ALL;
- }
- bcm_perf_writel(reg, perf_regs[i]);
- }
-
- if (BCMCPU_IS_6348() && (bcm63xx_get_cpu_rev() == 0xa1))
- bcm6348_a1_reboot();
-
- printk(KERN_INFO "triggering watchdog soft-reset...\n");
- reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
- reg |= SYS_PLL_SOFT_RESET;
- bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG);
- while (1)
- ;
-}
-
-static void __bcm63xx_machine_reboot(char *p)
-{
- bcm63xx_machine_reboot();
-}
-
-/*
- * return system type in /proc/cpuinfo
- */
-const char *get_system_type(void)
-{
- static char buf[128];
- snprintf(buf, sizeof(buf), "bcm63xx/%s (0x%04x/0x%04X)",
- board_get_name(),
- bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
- return buf;
-}
-
-void __init plat_time_init(void)
-{
- mips_hpt_frequency = bcm63xx_get_cpu_freq() / 2;
-}
-
-void __init plat_mem_setup(void)
-{
- add_memory_region(0, bcm63xx_get_memory_size(), BOOT_MEM_RAM);
-
- _machine_halt = bcm63xx_machine_halt;
- _machine_restart = __bcm63xx_machine_reboot;
- pm_power_off = bcm63xx_machine_halt;
-
- set_io_port_base(0);
- ioport_resource.start = 0;
- ioport_resource.end = ~0;
-
- board_setup();
-}
-
-int __init bcm63xx_register_devices(void)
-{
- return board_register_devices();
-}
-
-device_initcall(bcm63xx_register_devices);
diff --git a/ANDROID_3.4.5/arch/mips/bcm63xx/timer.c b/ANDROID_3.4.5/arch/mips/bcm63xx/timer.c
deleted file mode 100644
index 5f113598..00000000
--- a/ANDROID_3.4.5/arch/mips/bcm63xx/timer.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/kernel.h>
-#include <linux/err.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <linux/interrupt.h>
-#include <linux/clk.h>
-#include <bcm63xx_cpu.h>
-#include <bcm63xx_io.h>
-#include <bcm63xx_timer.h>
-#include <bcm63xx_regs.h>
-
-static DEFINE_RAW_SPINLOCK(timer_reg_lock);
-static DEFINE_RAW_SPINLOCK(timer_data_lock);
-static struct clk *periph_clk;
-
-static struct timer_data {
- void (*cb)(void *);
- void *data;
-} timer_data[BCM63XX_TIMER_COUNT];
-
-static irqreturn_t timer_interrupt(int irq, void *dev_id)
-{
- u32 stat;
- int i;
-
- raw_spin_lock(&timer_reg_lock);
- stat = bcm_timer_readl(TIMER_IRQSTAT_REG);
- bcm_timer_writel(stat, TIMER_IRQSTAT_REG);
- raw_spin_unlock(&timer_reg_lock);
-
- for (i = 0; i < BCM63XX_TIMER_COUNT; i++) {
- if (!(stat & TIMER_IRQSTAT_TIMER_CAUSE(i)))
- continue;
-
- raw_spin_lock(&timer_data_lock);
- if (!timer_data[i].cb) {
- raw_spin_unlock(&timer_data_lock);
- continue;
- }
-
- timer_data[i].cb(timer_data[i].data);
- raw_spin_unlock(&timer_data_lock);
- }
-
- return IRQ_HANDLED;
-}
-
-int bcm63xx_timer_enable(int id)
-{
- u32 reg;
- unsigned long flags;
-
- if (id >= BCM63XX_TIMER_COUNT)
- return -EINVAL;
-
- raw_spin_lock_irqsave(&timer_reg_lock, flags);
-
- reg = bcm_timer_readl(TIMER_CTLx_REG(id));
- reg |= TIMER_CTL_ENABLE_MASK;
- bcm_timer_writel(reg, TIMER_CTLx_REG(id));
-
- reg = bcm_timer_readl(TIMER_IRQSTAT_REG);
- reg |= TIMER_IRQSTAT_TIMER_IR_EN(id);
- bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
-
- raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
- return 0;
-}
-
-EXPORT_SYMBOL(bcm63xx_timer_enable);
-
-int bcm63xx_timer_disable(int id)
-{
- u32 reg;
- unsigned long flags;
-
- if (id >= BCM63XX_TIMER_COUNT)
- return -EINVAL;
-
- raw_spin_lock_irqsave(&timer_reg_lock, flags);
-
- reg = bcm_timer_readl(TIMER_CTLx_REG(id));
- reg &= ~TIMER_CTL_ENABLE_MASK;
- bcm_timer_writel(reg, TIMER_CTLx_REG(id));
-
- reg = bcm_timer_readl(TIMER_IRQSTAT_REG);
- reg &= ~TIMER_IRQSTAT_TIMER_IR_EN(id);
- bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
-
- raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
- return 0;
-}
-
-EXPORT_SYMBOL(bcm63xx_timer_disable);
-
-int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data)
-{
- unsigned long flags;
- int ret;
-
- if (id >= BCM63XX_TIMER_COUNT || !callback)
- return -EINVAL;
-
- ret = 0;
- raw_spin_lock_irqsave(&timer_data_lock, flags);
- if (timer_data[id].cb) {
- ret = -EBUSY;
- goto out;
- }
-
- timer_data[id].cb = callback;
- timer_data[id].data = data;
-
-out:
- raw_spin_unlock_irqrestore(&timer_data_lock, flags);
- return ret;
-}
-
-EXPORT_SYMBOL(bcm63xx_timer_register);
-
-void bcm63xx_timer_unregister(int id)
-{
- unsigned long flags;
-
- if (id >= BCM63XX_TIMER_COUNT)
- return;
-
- raw_spin_lock_irqsave(&timer_data_lock, flags);
- timer_data[id].cb = NULL;
- raw_spin_unlock_irqrestore(&timer_data_lock, flags);
-}
-
-EXPORT_SYMBOL(bcm63xx_timer_unregister);
-
-unsigned int bcm63xx_timer_countdown(unsigned int countdown_us)
-{
- return (clk_get_rate(periph_clk) / (1000 * 1000)) * countdown_us;
-}
-
-EXPORT_SYMBOL(bcm63xx_timer_countdown);
-
-int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us)
-{
- u32 reg, countdown;
- unsigned long flags;
-
- if (id >= BCM63XX_TIMER_COUNT)
- return -EINVAL;
-
- countdown = bcm63xx_timer_countdown(countdown_us);
- if (countdown & ~TIMER_CTL_COUNTDOWN_MASK)
- return -EINVAL;
-
- raw_spin_lock_irqsave(&timer_reg_lock, flags);
- reg = bcm_timer_readl(TIMER_CTLx_REG(id));
-
- if (monotonic)
- reg &= ~TIMER_CTL_MONOTONIC_MASK;
- else
- reg |= TIMER_CTL_MONOTONIC_MASK;
-
- reg &= ~TIMER_CTL_COUNTDOWN_MASK;
- reg |= countdown;
- bcm_timer_writel(reg, TIMER_CTLx_REG(id));
-
- raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
- return 0;
-}
-
-EXPORT_SYMBOL(bcm63xx_timer_set);
-
-int bcm63xx_timer_init(void)
-{
- int ret, irq;
- u32 reg;
-
- reg = bcm_timer_readl(TIMER_IRQSTAT_REG);
- reg &= ~TIMER_IRQSTAT_TIMER0_IR_EN;
- reg &= ~TIMER_IRQSTAT_TIMER1_IR_EN;
- reg &= ~TIMER_IRQSTAT_TIMER2_IR_EN;
- bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
-
- periph_clk = clk_get(NULL, "periph");
- if (IS_ERR(periph_clk))
- return -ENODEV;
-
- irq = bcm63xx_get_irq_number(IRQ_TIMER);
- ret = request_irq(irq, timer_interrupt, 0, "bcm63xx_timer", NULL);
- if (ret) {
- printk(KERN_ERR "bcm63xx_timer: failed to register irq\n");
- return ret;
- }
-
- return 0;
-}
-
-arch_initcall(bcm63xx_timer_init);