Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org> |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 3 | * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> |
Michael Büsch | eb032b9 | 2011-07-04 20:50:05 +0200 | [diff] [blame] | 4 | * Copyright (C) 2006 Michael Buesch <m@bues.ch> |
Waldemar Brodkorb | 121915c | 2010-06-08 19:06:01 +0200 | [diff] [blame] | 5 | * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 6 | * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de> |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the |
| 10 | * Free Software Foundation; either version 2 of the License, or (at your |
| 11 | * option) any later version. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN |
| 16 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 18 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 19 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 20 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | * |
| 24 | * You should have received a copy of the GNU General Public License along |
| 25 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 26 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 27 | */ |
| 28 | |
Rafał Miłecki | 515fa75 | 2014-01-14 12:14:41 +0100 | [diff] [blame] | 29 | #include "bcm47xx_private.h" |
| 30 | |
Paul Gortmaker | cae39d1 | 2011-07-28 18:46:31 -0400 | [diff] [blame] | 31 | #include <linux/export.h> |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 32 | #include <linux/types.h> |
Hauke Mehrtens | b04138b | 2013-12-20 02:16:13 +0100 | [diff] [blame] | 33 | #include <linux/ethtool.h> |
| 34 | #include <linux/phy.h> |
| 35 | #include <linux/phy_fixed.h> |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 36 | #include <linux/ssb/ssb.h> |
Aurelien Jarno | b06f3e1 | 2008-10-14 11:44:26 +0200 | [diff] [blame] | 37 | #include <linux/ssb/ssb_embedded.h> |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 38 | #include <linux/bcma/bcma_soc.h> |
Aurelien Jarno | 25e5fb9 | 2007-09-25 15:41:24 +0200 | [diff] [blame] | 39 | #include <asm/bootinfo.h> |
Hauke Mehrtens | 76b573e | 2013-12-22 14:36:30 +0100 | [diff] [blame] | 40 | #include <asm/idle.h> |
Hauke Mehrtens | 7da4b6f | 2014-01-14 12:06:08 +0100 | [diff] [blame] | 41 | #include <asm/prom.h> |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 42 | #include <asm/reboot.h> |
| 43 | #include <asm/time.h> |
| 44 | #include <bcm47xx.h> |
Hauke Mehrtens | 111bd98 | 2012-12-26 19:51:14 +0000 | [diff] [blame] | 45 | #include <bcm47xx_nvram.h> |
Hauke Mehrtens | 786c497 | 2013-09-18 13:29:57 +0200 | [diff] [blame] | 46 | #include <bcm47xx_board.h> |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 47 | |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 48 | union bcm47xx_bus bcm47xx_bus; |
| 49 | EXPORT_SYMBOL(bcm47xx_bus); |
| 50 | |
| 51 | enum bcm47xx_bus_type bcm47xx_bus_type; |
| 52 | EXPORT_SYMBOL(bcm47xx_bus_type); |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 53 | |
| 54 | static void bcm47xx_machine_restart(char *command) |
| 55 | { |
| 56 | printk(KERN_ALERT "Please stand by while rebooting the system...\n"); |
| 57 | local_irq_disable(); |
| 58 | /* Set the watchdog timer to reset immediately */ |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 59 | switch (bcm47xx_bus_type) { |
Hauke Mehrtens | a656ffc | 2011-07-23 01:20:13 +0200 | [diff] [blame] | 60 | #ifdef CONFIG_BCM47XX_SSB |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 61 | case BCM47XX_BUS_TYPE_SSB: |
Hauke Mehrtens | 2727cab | 2014-08-18 22:01:16 +0200 | [diff] [blame^] | 62 | if (bcm47xx_bus.ssb.chip_id == 0x4785) |
| 63 | write_c0_diag4(1 << 22); |
| 64 | ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1); |
| 65 | if (bcm47xx_bus.ssb.chip_id == 0x4785) { |
| 66 | __asm__ __volatile__( |
| 67 | ".set\tmips3\n\t" |
| 68 | "sync\n\t" |
| 69 | "wait\n\t" |
| 70 | ".set\tmips0"); |
| 71 | } |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 72 | break; |
Hauke Mehrtens | a656ffc | 2011-07-23 01:20:13 +0200 | [diff] [blame] | 73 | #endif |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 74 | #ifdef CONFIG_BCM47XX_BCMA |
| 75 | case BCM47XX_BUS_TYPE_BCMA: |
Hauke Mehrtens | 2727cab | 2014-08-18 22:01:16 +0200 | [diff] [blame^] | 76 | bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1); |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 77 | break; |
| 78 | #endif |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 79 | } |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 80 | while (1) |
| 81 | cpu_relax(); |
| 82 | } |
| 83 | |
| 84 | static void bcm47xx_machine_halt(void) |
| 85 | { |
| 86 | /* Disable interrupts and watchdog and spin forever */ |
| 87 | local_irq_disable(); |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 88 | switch (bcm47xx_bus_type) { |
Hauke Mehrtens | a656ffc | 2011-07-23 01:20:13 +0200 | [diff] [blame] | 89 | #ifdef CONFIG_BCM47XX_SSB |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 90 | case BCM47XX_BUS_TYPE_SSB: |
| 91 | ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0); |
| 92 | break; |
Hauke Mehrtens | a656ffc | 2011-07-23 01:20:13 +0200 | [diff] [blame] | 93 | #endif |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 94 | #ifdef CONFIG_BCM47XX_BCMA |
| 95 | case BCM47XX_BUS_TYPE_BCMA: |
| 96 | bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 0); |
| 97 | break; |
| 98 | #endif |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 99 | } |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 100 | while (1) |
| 101 | cpu_relax(); |
| 102 | } |
| 103 | |
Hauke Mehrtens | a656ffc | 2011-07-23 01:20:13 +0200 | [diff] [blame] | 104 | #ifdef CONFIG_BCM47XX_SSB |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 105 | static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) |
Hauke Mehrtens | fe6f364 | 2011-05-10 23:31:32 +0200 | [diff] [blame] | 106 | { |
| 107 | char prefix[10]; |
| 108 | |
| 109 | if (bus->bustype == SSB_BUSTYPE_PCI) { |
Nathan Hintz | 5fe2e07 | 2012-05-04 21:56:32 -0700 | [diff] [blame] | 110 | memset(out, 0, sizeof(struct ssb_sprom)); |
Hauke Mehrtens | fe6f364 | 2011-05-10 23:31:32 +0200 | [diff] [blame] | 111 | snprintf(prefix, sizeof(prefix), "pci/%u/%u/", |
| 112 | bus->host_pci->bus->number + 1, |
| 113 | PCI_SLOT(bus->host_pci->devfn)); |
Hauke Mehrtens | b8ebbaf | 2012-10-03 11:34:20 +0000 | [diff] [blame] | 114 | bcm47xx_fill_sprom(out, prefix, false); |
Hauke Mehrtens | fe6f364 | 2011-05-10 23:31:32 +0200 | [diff] [blame] | 115 | return 0; |
| 116 | } else { |
| 117 | printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n"); |
| 118 | return -EINVAL; |
| 119 | } |
| 120 | } |
| 121 | |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 122 | static int bcm47xx_get_invariants(struct ssb_bus *bus, |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 123 | struct ssb_init_invariants *iv) |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 124 | { |
Hauke Mehrtens | 2aa088d | 2010-11-27 17:45:59 +0100 | [diff] [blame] | 125 | char buf[20]; |
Aurelien Jarno | 25e5fb9 | 2007-09-25 15:41:24 +0200 | [diff] [blame] | 126 | |
| 127 | /* Fill boardinfo structure */ |
| 128 | memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); |
| 129 | |
Hauke Mehrtens | a9bba18 | 2012-04-29 02:04:07 +0200 | [diff] [blame] | 130 | bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL); |
Aurelien Jarno | 25e5fb9 | 2007-09-25 15:41:24 +0200 | [diff] [blame] | 131 | |
Nathan Hintz | 5fe2e07 | 2012-05-04 21:56:32 -0700 | [diff] [blame] | 132 | memset(&iv->sprom, 0, sizeof(struct ssb_sprom)); |
Hauke Mehrtens | b8ebbaf | 2012-10-03 11:34:20 +0000 | [diff] [blame] | 133 | bcm47xx_fill_sprom(&iv->sprom, NULL, false); |
Aurelien Jarno | 25e5fb9 | 2007-09-25 15:41:24 +0200 | [diff] [blame] | 134 | |
Hauke Mehrtens | 111bd98 | 2012-12-26 19:51:14 +0000 | [diff] [blame] | 135 | if (bcm47xx_nvram_getenv("cardbus", buf, sizeof(buf)) >= 0) |
Hauke Mehrtens | 2aa088d | 2010-11-27 17:45:59 +0100 | [diff] [blame] | 136 | iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10); |
Aurelien Jarno | 25e5fb9 | 2007-09-25 15:41:24 +0200 | [diff] [blame] | 137 | |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 138 | return 0; |
| 139 | } |
| 140 | |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 141 | static void __init bcm47xx_register_ssb(void) |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 142 | { |
| 143 | int err; |
Hauke Mehrtens | 1690a7f | 2010-11-27 17:46:01 +0100 | [diff] [blame] | 144 | char buf[100]; |
| 145 | struct ssb_mipscore *mcore; |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 146 | |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 147 | err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom_ssb); |
Hauke Mehrtens | fe6f364 | 2011-05-10 23:31:32 +0200 | [diff] [blame] | 148 | if (err) |
| 149 | printk(KERN_WARNING "bcm47xx: someone else already registered" |
| 150 | " a ssb SPROM callback handler (err %d)\n", err); |
| 151 | |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 152 | err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE, |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 153 | bcm47xx_get_invariants); |
| 154 | if (err) |
Ralf Baechle | ab75dc0 | 2011-11-17 15:07:31 +0000 | [diff] [blame] | 155 | panic("Failed to initialize SSB bus (err %d)", err); |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 156 | |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 157 | mcore = &bcm47xx_bus.ssb.mipscore; |
Hauke Mehrtens | 111bd98 | 2012-12-26 19:51:14 +0000 | [diff] [blame] | 158 | if (bcm47xx_nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) { |
Hauke Mehrtens | 1690a7f | 2010-11-27 17:46:01 +0100 | [diff] [blame] | 159 | if (strstr(buf, "console=ttyS1")) { |
| 160 | struct ssb_serial_port port; |
| 161 | |
| 162 | printk(KERN_DEBUG "Swapping serial ports!\n"); |
| 163 | /* swap serial ports */ |
| 164 | memcpy(&port, &mcore->serial_ports[0], sizeof(port)); |
| 165 | memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], |
| 166 | sizeof(port)); |
| 167 | memcpy(&mcore->serial_ports[1], &port, sizeof(port)); |
| 168 | } |
| 169 | } |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 170 | } |
Hauke Mehrtens | a656ffc | 2011-07-23 01:20:13 +0200 | [diff] [blame] | 171 | #endif |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 172 | |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 173 | #ifdef CONFIG_BCM47XX_BCMA |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 174 | static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) |
| 175 | { |
| 176 | char prefix[10]; |
| 177 | struct bcma_device *core; |
| 178 | |
| 179 | switch (bus->hosttype) { |
| 180 | case BCMA_HOSTTYPE_PCI: |
Nathan Hintz | 5fe2e07 | 2012-05-04 21:56:32 -0700 | [diff] [blame] | 181 | memset(out, 0, sizeof(struct ssb_sprom)); |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 182 | snprintf(prefix, sizeof(prefix), "pci/%u/%u/", |
| 183 | bus->host_pci->bus->number + 1, |
| 184 | PCI_SLOT(bus->host_pci->devfn)); |
Hauke Mehrtens | b8ebbaf | 2012-10-03 11:34:20 +0000 | [diff] [blame] | 185 | bcm47xx_fill_sprom(out, prefix, false); |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 186 | return 0; |
| 187 | case BCMA_HOSTTYPE_SOC: |
Nathan Hintz | 5fe2e07 | 2012-05-04 21:56:32 -0700 | [diff] [blame] | 188 | memset(out, 0, sizeof(struct ssb_sprom)); |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 189 | core = bcma_find_core(bus, BCMA_CORE_80211); |
| 190 | if (core) { |
| 191 | snprintf(prefix, sizeof(prefix), "sb/%u/", |
| 192 | core->core_index); |
Hauke Mehrtens | b8ebbaf | 2012-10-03 11:34:20 +0000 | [diff] [blame] | 193 | bcm47xx_fill_sprom(out, prefix, true); |
Hauke Mehrtens | 2c37631 | 2012-10-03 11:34:19 +0000 | [diff] [blame] | 194 | } else { |
Hauke Mehrtens | b8ebbaf | 2012-10-03 11:34:20 +0000 | [diff] [blame] | 195 | bcm47xx_fill_sprom(out, NULL, false); |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 196 | } |
| 197 | return 0; |
| 198 | default: |
| 199 | pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n"); |
| 200 | return -EINVAL; |
| 201 | } |
| 202 | } |
| 203 | |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 204 | static void __init bcm47xx_register_bcma(void) |
| 205 | { |
| 206 | int err; |
| 207 | |
Hauke Mehrtens | f384b3d | 2012-02-28 00:56:14 +0100 | [diff] [blame] | 208 | err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma); |
| 209 | if (err) |
| 210 | pr_warn("bcm47xx: someone else already registered a bcma SPROM callback handler (err %d)\n", err); |
| 211 | |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 212 | err = bcma_host_soc_register(&bcm47xx_bus.bcma); |
| 213 | if (err) |
Ralf Baechle | ab75dc0 | 2011-11-17 15:07:31 +0000 | [diff] [blame] | 214 | panic("Failed to initialize BCMA bus (err %d)", err); |
Hauke Mehrtens | 0a2fcaa | 2012-04-29 02:04:08 +0200 | [diff] [blame] | 215 | |
| 216 | bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL); |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 217 | } |
| 218 | #endif |
| 219 | |
Hauke Mehrtens | 08ccf572 | 2011-07-23 01:20:12 +0200 | [diff] [blame] | 220 | void __init plat_mem_setup(void) |
| 221 | { |
| 222 | struct cpuinfo_mips *c = ¤t_cpu_data; |
| 223 | |
Steven J. Hill | 442e14a | 2014-01-17 15:03:50 -0600 | [diff] [blame] | 224 | if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K)) { |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 225 | printk(KERN_INFO "bcm47xx: using bcma bus\n"); |
| 226 | #ifdef CONFIG_BCM47XX_BCMA |
| 227 | bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA; |
| 228 | bcm47xx_register_bcma(); |
Hauke Mehrtens | dd57328 | 2013-09-19 23:40:09 +0200 | [diff] [blame] | 229 | bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id); |
Rafał Miłecki | 6ee1d93 | 2014-07-17 23:26:33 +0200 | [diff] [blame] | 230 | #ifdef CONFIG_HIGHMEM |
| 231 | bcm47xx_prom_highmem_init(); |
| 232 | #endif |
Hauke Mehrtens | a656ffc | 2011-07-23 01:20:13 +0200 | [diff] [blame] | 233 | #endif |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 234 | } else { |
| 235 | printk(KERN_INFO "bcm47xx: using ssb bus\n"); |
| 236 | #ifdef CONFIG_BCM47XX_SSB |
| 237 | bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB; |
| 238 | bcm47xx_register_ssb(); |
Hauke Mehrtens | dd57328 | 2013-09-19 23:40:09 +0200 | [diff] [blame] | 239 | bcm47xx_set_system_type(bcm47xx_bus.ssb.chip_id); |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 240 | #endif |
| 241 | } |
Hauke Mehrtens | 1690a7f | 2010-11-27 17:46:01 +0100 | [diff] [blame] | 242 | |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 243 | _machine_restart = bcm47xx_machine_restart; |
| 244 | _machine_halt = bcm47xx_machine_halt; |
| 245 | pm_power_off = bcm47xx_machine_halt; |
Hauke Mehrtens | 786c497 | 2013-09-18 13:29:57 +0200 | [diff] [blame] | 246 | bcm47xx_board_detect(); |
Hauke Mehrtens | 7da4b6f | 2014-01-14 12:06:08 +0100 | [diff] [blame] | 247 | mips_set_machine_name(bcm47xx_board_get_name()); |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 248 | } |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 249 | |
Hauke Mehrtens | 3c06b12 | 2014-01-14 19:36:55 +0100 | [diff] [blame] | 250 | static int __init bcm47xx_cpu_fixes(void) |
| 251 | { |
| 252 | switch (bcm47xx_bus_type) { |
| 253 | #ifdef CONFIG_BCM47XX_SSB |
| 254 | case BCM47XX_BUS_TYPE_SSB: |
| 255 | /* Nothing to do */ |
| 256 | break; |
| 257 | #endif |
| 258 | #ifdef CONFIG_BCM47XX_BCMA |
| 259 | case BCM47XX_BUS_TYPE_BCMA: |
| 260 | /* The BCM4706 has a problem with the CPU wait instruction. |
| 261 | * When r4k_wait or r4k_wait_irqoff is used will just hang and |
| 262 | * not return from a msleep(). Removing the cpu_wait |
| 263 | * functionality is a workaround for this problem. The BCM4716 |
| 264 | * does not have this problem. |
| 265 | */ |
| 266 | if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706) |
| 267 | cpu_wait = NULL; |
| 268 | break; |
| 269 | #endif |
| 270 | } |
| 271 | return 0; |
| 272 | } |
| 273 | arch_initcall(bcm47xx_cpu_fixes); |
| 274 | |
Hauke Mehrtens | b04138b | 2013-12-20 02:16:13 +0100 | [diff] [blame] | 275 | static struct fixed_phy_status bcm47xx_fixed_phy_status __initdata = { |
| 276 | .link = 1, |
| 277 | .speed = SPEED_100, |
| 278 | .duplex = DUPLEX_FULL, |
| 279 | }; |
| 280 | |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 281 | static int __init bcm47xx_register_bus_complete(void) |
| 282 | { |
| 283 | switch (bcm47xx_bus_type) { |
| 284 | #ifdef CONFIG_BCM47XX_SSB |
| 285 | case BCM47XX_BUS_TYPE_SSB: |
| 286 | /* Nothing to do */ |
| 287 | break; |
| 288 | #endif |
| 289 | #ifdef CONFIG_BCM47XX_BCMA |
| 290 | case BCM47XX_BUS_TYPE_BCMA: |
| 291 | bcma_bus_register(&bcm47xx_bus.bcma.bus); |
| 292 | break; |
| 293 | #endif |
| 294 | } |
Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 295 | bcm47xx_buttons_register(); |
Rafał Miłecki | 515fa75 | 2014-01-14 12:14:41 +0100 | [diff] [blame] | 296 | bcm47xx_leds_register(); |
Rafał Miłecki | a2bec078 | 2014-03-21 10:08:08 +0100 | [diff] [blame] | 297 | bcm47xx_workarounds(); |
Rafał Miłecki | 515fa75 | 2014-01-14 12:14:41 +0100 | [diff] [blame] | 298 | |
Hauke Mehrtens | b04138b | 2013-12-20 02:16:13 +0100 | [diff] [blame] | 299 | fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status); |
Hauke Mehrtens | c1d1c5d | 2011-07-23 01:20:14 +0200 | [diff] [blame] | 300 | return 0; |
| 301 | } |
| 302 | device_initcall(bcm47xx_register_bus_complete); |