root/arch/mips/bcm63xx/boards/board_bcm963xx.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. bcm63xx_get_fallback_sprom
  2. board_get_name
  3. board_prom_init
  4. board_setup
  5. board_register_devices

   1 /*
   2  * This file is subject to the terms and conditions of the GNU General Public
   3  * License.  See the file "COPYING" in the main directory of this archive
   4  * for more details.
   5  *
   6  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
   7  * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
   8  */
   9 
  10 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  11 
  12 #include <linux/init.h>
  13 #include <linux/kernel.h>
  14 #include <linux/string.h>
  15 #include <linux/platform_device.h>
  16 #include <linux/ssb/ssb.h>
  17 #include <asm/addrspace.h>
  18 #include <bcm63xx_board.h>
  19 #include <bcm63xx_cpu.h>
  20 #include <bcm63xx_dev_uart.h>
  21 #include <bcm63xx_regs.h>
  22 #include <bcm63xx_io.h>
  23 #include <bcm63xx_nvram.h>
  24 #include <bcm63xx_dev_pci.h>
  25 #include <bcm63xx_dev_enet.h>
  26 #include <bcm63xx_dev_flash.h>
  27 #include <bcm63xx_dev_hsspi.h>
  28 #include <bcm63xx_dev_pcmcia.h>
  29 #include <bcm63xx_dev_spi.h>
  30 #include <bcm63xx_dev_usb_usbd.h>
  31 #include <board_bcm963xx.h>
  32 
  33 #include <uapi/linux/bcm933xx_hcs.h>
  34 
  35 
  36 #define HCS_OFFSET_128K                 0x20000
  37 
  38 static struct board_info board;
  39 
  40 /*
  41  * known 3368 boards
  42  */
  43 #ifdef CONFIG_BCM63XX_CPU_3368
  44 static struct board_info __initdata board_cvg834g = {
  45         .name                           = "CVG834G_E15R3921",
  46         .expected_cpu_id                = 0x3368,
  47 
  48         .has_uart0                      = 1,
  49         .has_uart1                      = 1,
  50 
  51         .has_enet0                      = 1,
  52         .has_pci                        = 1,
  53 
  54         .enet0 = {
  55                 .has_phy                = 1,
  56                 .use_internal_phy       = 1,
  57         },
  58 
  59         .leds = {
  60                 {
  61                         .name           = "CVG834G:green:power",
  62                         .gpio           = 37,
  63                         .default_trigger= "default-on",
  64                 },
  65         },
  66 
  67         .ephy_reset_gpio                = 36,
  68         .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
  69 };
  70 #endif
  71 
  72 /*
  73  * known 6328 boards
  74  */
  75 #ifdef CONFIG_BCM63XX_CPU_6328
  76 static struct board_info __initdata board_96328avng = {
  77         .name                           = "96328avng",
  78         .expected_cpu_id                = 0x6328,
  79 
  80         .has_uart0                      = 1,
  81         .has_pci                        = 1,
  82         .has_usbd                       = 0,
  83 
  84         .usbd = {
  85                 .use_fullspeed          = 0,
  86                 .port_no                = 0,
  87         },
  88 
  89         .leds = {
  90                 {
  91                         .name           = "96328avng::ppp-fail",
  92                         .gpio           = 2,
  93                         .active_low     = 1,
  94                 },
  95                 {
  96                         .name           = "96328avng::power",
  97                         .gpio           = 4,
  98                         .active_low     = 1,
  99                         .default_trigger = "default-on",
 100                 },
 101                 {
 102                         .name           = "96328avng::power-fail",
 103                         .gpio           = 8,
 104                         .active_low     = 1,
 105                 },
 106                 {
 107                         .name           = "96328avng::wps",
 108                         .gpio           = 9,
 109                         .active_low     = 1,
 110                 },
 111                 {
 112                         .name           = "96328avng::ppp",
 113                         .gpio           = 11,
 114                         .active_low     = 1,
 115                 },
 116         },
 117 };
 118 #endif
 119 
 120 /*
 121  * known 6338 boards
 122  */
 123 #ifdef CONFIG_BCM63XX_CPU_6338
 124 static struct board_info __initdata board_96338gw = {
 125         .name                           = "96338GW",
 126         .expected_cpu_id                = 0x6338,
 127 
 128         .has_uart0                      = 1,
 129         .has_enet0                      = 1,
 130         .enet0 = {
 131                 .force_speed_100        = 1,
 132                 .force_duplex_full      = 1,
 133         },
 134 
 135         .has_ohci0                      = 1,
 136 
 137         .leds = {
 138                 {
 139                         .name           = "adsl",
 140                         .gpio           = 3,
 141                         .active_low     = 1,
 142                 },
 143                 {
 144                         .name           = "ses",
 145                         .gpio           = 5,
 146                         .active_low     = 1,
 147                 },
 148                 {
 149                         .name           = "ppp-fail",
 150                         .gpio           = 4,
 151                         .active_low     = 1,
 152                 },
 153                 {
 154                         .name           = "power",
 155                         .gpio           = 0,
 156                         .active_low     = 1,
 157                         .default_trigger = "default-on",
 158                 },
 159                 {
 160                         .name           = "stop",
 161                         .gpio           = 1,
 162                         .active_low     = 1,
 163                 }
 164         },
 165 };
 166 
 167 static struct board_info __initdata board_96338w = {
 168         .name                           = "96338W",
 169         .expected_cpu_id                = 0x6338,
 170 
 171         .has_uart0                      = 1,
 172         .has_enet0                      = 1,
 173         .enet0 = {
 174                 .force_speed_100        = 1,
 175                 .force_duplex_full      = 1,
 176         },
 177 
 178         .leds = {
 179                 {
 180                         .name           = "adsl",
 181                         .gpio           = 3,
 182                         .active_low     = 1,
 183                 },
 184                 {
 185                         .name           = "ses",
 186                         .gpio           = 5,
 187                         .active_low     = 1,
 188                 },
 189                 {
 190                         .name           = "ppp-fail",
 191                         .gpio           = 4,
 192                         .active_low     = 1,
 193                 },
 194                 {
 195                         .name           = "power",
 196                         .gpio           = 0,
 197                         .active_low     = 1,
 198                         .default_trigger = "default-on",
 199                 },
 200                 {
 201                         .name           = "stop",
 202                         .gpio           = 1,
 203                         .active_low     = 1,
 204                 },
 205         },
 206 };
 207 #endif
 208 
 209 /*
 210  * known 6345 boards
 211  */
 212 #ifdef CONFIG_BCM63XX_CPU_6345
 213 static struct board_info __initdata board_96345gw2 = {
 214         .name                           = "96345GW2",
 215         .expected_cpu_id                = 0x6345,
 216 
 217         .has_uart0                      = 1,
 218 };
 219 #endif
 220 
 221 /*
 222  * known 6348 boards
 223  */
 224 #ifdef CONFIG_BCM63XX_CPU_6348
 225 static struct board_info __initdata board_96348r = {
 226         .name                           = "96348R",
 227         .expected_cpu_id                = 0x6348,
 228 
 229         .has_uart0                      = 1,
 230         .has_enet0                      = 1,
 231         .has_pci                        = 1,
 232 
 233         .enet0 = {
 234                 .has_phy                = 1,
 235                 .use_internal_phy       = 1,
 236         },
 237 
 238         .leds = {
 239                 {
 240                         .name           = "adsl-fail",
 241                         .gpio           = 2,
 242                         .active_low     = 1,
 243                 },
 244                 {
 245                         .name           = "ppp",
 246                         .gpio           = 3,
 247                         .active_low     = 1,
 248                 },
 249                 {
 250                         .name           = "ppp-fail",
 251                         .gpio           = 4,
 252                         .active_low     = 1,
 253                 },
 254                 {
 255                         .name           = "power",
 256                         .gpio           = 0,
 257                         .active_low     = 1,
 258                         .default_trigger = "default-on",
 259 
 260                 },
 261                 {
 262                         .name           = "stop",
 263                         .gpio           = 1,
 264                         .active_low     = 1,
 265                 },
 266         },
 267 };
 268 
 269 static struct board_info __initdata board_96348gw_10 = {
 270         .name                           = "96348GW-10",
 271         .expected_cpu_id                = 0x6348,
 272 
 273         .has_uart0                      = 1,
 274         .has_enet0                      = 1,
 275         .has_enet1                      = 1,
 276         .has_pci                        = 1,
 277 
 278         .enet0 = {
 279                 .has_phy                = 1,
 280                 .use_internal_phy       = 1,
 281         },
 282         .enet1 = {
 283                 .force_speed_100        = 1,
 284                 .force_duplex_full      = 1,
 285         },
 286 
 287         .has_ohci0                      = 1,
 288         .has_pccard                     = 1,
 289         .has_ehci0                      = 1,
 290 
 291         .leds = {
 292                 {
 293                         .name           = "adsl-fail",
 294                         .gpio           = 2,
 295                         .active_low     = 1,
 296                 },
 297                 {
 298                         .name           = "ppp",
 299                         .gpio           = 3,
 300                         .active_low     = 1,
 301                 },
 302                 {
 303                         .name           = "ppp-fail",
 304                         .gpio           = 4,
 305                         .active_low     = 1,
 306                 },
 307                 {
 308                         .name           = "power",
 309                         .gpio           = 0,
 310                         .active_low     = 1,
 311                         .default_trigger = "default-on",
 312                 },
 313                 {
 314                         .name           = "stop",
 315                         .gpio           = 1,
 316                         .active_low     = 1,
 317                 },
 318         },
 319 };
 320 
 321 static struct board_info __initdata board_96348gw_11 = {
 322         .name                           = "96348GW-11",
 323         .expected_cpu_id                = 0x6348,
 324 
 325         .has_uart0                      = 1,
 326         .has_enet0                      = 1,
 327         .has_enet1                      = 1,
 328         .has_pci                        = 1,
 329 
 330         .enet0 = {
 331                 .has_phy                = 1,
 332                 .use_internal_phy       = 1,
 333         },
 334 
 335         .enet1 = {
 336                 .force_speed_100        = 1,
 337                 .force_duplex_full      = 1,
 338         },
 339 
 340 
 341         .has_ohci0 = 1,
 342         .has_pccard = 1,
 343         .has_ehci0 = 1,
 344 
 345         .leds = {
 346                 {
 347                         .name           = "adsl-fail",
 348                         .gpio           = 2,
 349                         .active_low     = 1,
 350                 },
 351                 {
 352                         .name           = "ppp",
 353                         .gpio           = 3,
 354                         .active_low     = 1,
 355                 },
 356                 {
 357                         .name           = "ppp-fail",
 358                         .gpio           = 4,
 359                         .active_low     = 1,
 360                 },
 361                 {
 362                         .name           = "power",
 363                         .gpio           = 0,
 364                         .active_low     = 1,
 365                         .default_trigger = "default-on",
 366                 },
 367                 {
 368                         .name           = "stop",
 369                         .gpio           = 1,
 370                         .active_low     = 1,
 371                 },
 372         },
 373 };
 374 
 375 static struct board_info __initdata board_96348gw = {
 376         .name                           = "96348GW",
 377         .expected_cpu_id                = 0x6348,
 378 
 379         .has_uart0                      = 1,
 380         .has_enet0                      = 1,
 381         .has_enet1                      = 1,
 382         .has_pci                        = 1,
 383 
 384         .enet0 = {
 385                 .has_phy                = 1,
 386                 .use_internal_phy       = 1,
 387         },
 388         .enet1 = {
 389                 .force_speed_100        = 1,
 390                 .force_duplex_full      = 1,
 391         },
 392 
 393         .has_ohci0 = 1,
 394 
 395         .leds = {
 396                 {
 397                         .name           = "adsl-fail",
 398                         .gpio           = 2,
 399                         .active_low     = 1,
 400                 },
 401                 {
 402                         .name           = "ppp",
 403                         .gpio           = 3,
 404                         .active_low     = 1,
 405                 },
 406                 {
 407                         .name           = "ppp-fail",
 408                         .gpio           = 4,
 409                         .active_low     = 1,
 410                 },
 411                 {
 412                         .name           = "power",
 413                         .gpio           = 0,
 414                         .active_low     = 1,
 415                         .default_trigger = "default-on",
 416                 },
 417                 {
 418                         .name           = "stop",
 419                         .gpio           = 1,
 420                         .active_low     = 1,
 421                 },
 422         },
 423 };
 424 
 425 static struct board_info __initdata board_FAST2404 = {
 426         .name                           = "F@ST2404",
 427         .expected_cpu_id                = 0x6348,
 428 
 429         .has_uart0                      = 1,
 430         .has_enet0                      = 1,
 431         .has_enet1                      = 1,
 432         .has_pci                        = 1,
 433 
 434         .enet0 = {
 435                 .has_phy                = 1,
 436                 .use_internal_phy       = 1,
 437         },
 438 
 439         .enet1 = {
 440                 .force_speed_100        = 1,
 441                 .force_duplex_full      = 1,
 442         },
 443 
 444         .has_ohci0                      = 1,
 445         .has_pccard                     = 1,
 446         .has_ehci0                      = 1,
 447 };
 448 
 449 static struct board_info __initdata board_rta1025w_16 = {
 450         .name                           = "RTA1025W_16",
 451         .expected_cpu_id                = 0x6348,
 452 
 453         .has_enet0                      = 1,
 454         .has_enet1                      = 1,
 455         .has_pci                        = 1,
 456 
 457         .enet0 = {
 458                 .has_phy                = 1,
 459                 .use_internal_phy       = 1,
 460         },
 461         .enet1 = {
 462                 .force_speed_100        = 1,
 463                 .force_duplex_full      = 1,
 464         },
 465 };
 466 
 467 
 468 static struct board_info __initdata board_DV201AMR = {
 469         .name                           = "DV201AMR",
 470         .expected_cpu_id                = 0x6348,
 471 
 472         .has_uart0                      = 1,
 473         .has_pci                        = 1,
 474         .has_ohci0                      = 1,
 475 
 476         .has_enet0                      = 1,
 477         .has_enet1                      = 1,
 478         .enet0 = {
 479                 .has_phy                = 1,
 480                 .use_internal_phy       = 1,
 481         },
 482         .enet1 = {
 483                 .force_speed_100        = 1,
 484                 .force_duplex_full      = 1,
 485         },
 486 };
 487 
 488 static struct board_info __initdata board_96348gw_a = {
 489         .name                           = "96348GW-A",
 490         .expected_cpu_id                = 0x6348,
 491 
 492         .has_uart0                      = 1,
 493         .has_enet0                      = 1,
 494         .has_enet1                      = 1,
 495         .has_pci                        = 1,
 496 
 497         .enet0 = {
 498                 .has_phy                = 1,
 499                 .use_internal_phy       = 1,
 500         },
 501         .enet1 = {
 502                 .force_speed_100        = 1,
 503                 .force_duplex_full      = 1,
 504         },
 505 
 506         .has_ohci0 = 1,
 507 };
 508 #endif
 509 
 510 /*
 511  * known 6358 boards
 512  */
 513 #ifdef CONFIG_BCM63XX_CPU_6358
 514 static struct board_info __initdata board_96358vw = {
 515         .name                           = "96358VW",
 516         .expected_cpu_id                = 0x6358,
 517 
 518         .has_uart0                      = 1,
 519         .has_enet0                      = 1,
 520         .has_enet1                      = 1,
 521         .has_pci                        = 1,
 522 
 523         .enet0 = {
 524                 .has_phy                = 1,
 525                 .use_internal_phy       = 1,
 526         },
 527 
 528         .enet1 = {
 529                 .force_speed_100        = 1,
 530                 .force_duplex_full      = 1,
 531         },
 532 
 533 
 534         .has_ohci0 = 1,
 535         .has_pccard = 1,
 536         .has_ehci0 = 1,
 537 
 538         .leds = {
 539                 {
 540                         .name           = "adsl-fail",
 541                         .gpio           = 15,
 542                         .active_low     = 1,
 543                 },
 544                 {
 545                         .name           = "ppp",
 546                         .gpio           = 22,
 547                         .active_low     = 1,
 548                 },
 549                 {
 550                         .name           = "ppp-fail",
 551                         .gpio           = 23,
 552                         .active_low     = 1,
 553                 },
 554                 {
 555                         .name           = "power",
 556                         .gpio           = 4,
 557                         .default_trigger = "default-on",
 558                 },
 559                 {
 560                         .name           = "stop",
 561                         .gpio           = 5,
 562                 },
 563         },
 564 };
 565 
 566 static struct board_info __initdata board_96358vw2 = {
 567         .name                           = "96358VW2",
 568         .expected_cpu_id                = 0x6358,
 569 
 570         .has_uart0                      = 1,
 571         .has_enet0                      = 1,
 572         .has_enet1                      = 1,
 573         .has_pci                        = 1,
 574 
 575         .enet0 = {
 576                 .has_phy                = 1,
 577                 .use_internal_phy       = 1,
 578         },
 579 
 580         .enet1 = {
 581                 .force_speed_100        = 1,
 582                 .force_duplex_full      = 1,
 583         },
 584 
 585 
 586         .has_ohci0 = 1,
 587         .has_pccard = 1,
 588         .has_ehci0 = 1,
 589 
 590         .leds = {
 591                 {
 592                         .name           = "adsl",
 593                         .gpio           = 22,
 594                         .active_low     = 1,
 595                 },
 596                 {
 597                         .name           = "ppp-fail",
 598                         .gpio           = 23,
 599                 },
 600                 {
 601                         .name           = "power",
 602                         .gpio           = 5,
 603                         .active_low     = 1,
 604                         .default_trigger = "default-on",
 605                 },
 606                 {
 607                         .name           = "stop",
 608                         .gpio           = 4,
 609                         .active_low     = 1,
 610                 },
 611         },
 612 };
 613 
 614 static struct board_info __initdata board_AGPFS0 = {
 615         .name                           = "AGPF-S0",
 616         .expected_cpu_id                = 0x6358,
 617 
 618         .has_uart0                      = 1,
 619         .has_enet0                      = 1,
 620         .has_enet1                      = 1,
 621         .has_pci                        = 1,
 622 
 623         .enet0 = {
 624                 .has_phy                = 1,
 625                 .use_internal_phy       = 1,
 626         },
 627 
 628         .enet1 = {
 629                 .force_speed_100        = 1,
 630                 .force_duplex_full      = 1,
 631         },
 632 
 633         .has_ohci0 = 1,
 634         .has_ehci0 = 1,
 635 };
 636 
 637 static struct board_info __initdata board_DWVS0 = {
 638         .name                           = "DWV-S0",
 639         .expected_cpu_id                = 0x6358,
 640 
 641         .has_enet0                      = 1,
 642         .has_enet1                      = 1,
 643         .has_pci                        = 1,
 644 
 645         .enet0 = {
 646                 .has_phy                = 1,
 647                 .use_internal_phy       = 1,
 648         },
 649 
 650         .enet1 = {
 651                 .force_speed_100        = 1,
 652                 .force_duplex_full      = 1,
 653         },
 654 
 655         .has_ohci0                      = 1,
 656 };
 657 #endif
 658 
 659 /*
 660  * all boards
 661  */
 662 static const struct board_info __initconst *bcm963xx_boards[] = {
 663 #ifdef CONFIG_BCM63XX_CPU_3368
 664         &board_cvg834g,
 665 #endif
 666 #ifdef CONFIG_BCM63XX_CPU_6328
 667         &board_96328avng,
 668 #endif
 669 #ifdef CONFIG_BCM63XX_CPU_6338
 670         &board_96338gw,
 671         &board_96338w,
 672 #endif
 673 #ifdef CONFIG_BCM63XX_CPU_6345
 674         &board_96345gw2,
 675 #endif
 676 #ifdef CONFIG_BCM63XX_CPU_6348
 677         &board_96348r,
 678         &board_96348gw,
 679         &board_96348gw_10,
 680         &board_96348gw_11,
 681         &board_FAST2404,
 682         &board_DV201AMR,
 683         &board_96348gw_a,
 684         &board_rta1025w_16,
 685 #endif
 686 
 687 #ifdef CONFIG_BCM63XX_CPU_6358
 688         &board_96358vw,
 689         &board_96358vw2,
 690         &board_AGPFS0,
 691         &board_DWVS0,
 692 #endif
 693 };
 694 
 695 /*
 696  * Register a sane SPROMv2 to make the on-board
 697  * bcm4318 WLAN work
 698  */
 699 #ifdef CONFIG_SSB_PCIHOST
 700 static struct ssb_sprom bcm63xx_sprom = {
 701         .revision               = 0x02,
 702         .board_rev              = 0x17,
 703         .country_code           = 0x0,
 704         .ant_available_bg       = 0x3,
 705         .pa0b0                  = 0x15ae,
 706         .pa0b1                  = 0xfa85,
 707         .pa0b2                  = 0xfe8d,
 708         .pa1b0                  = 0xffff,
 709         .pa1b1                  = 0xffff,
 710         .pa1b2                  = 0xffff,
 711         .gpio0                  = 0xff,
 712         .gpio1                  = 0xff,
 713         .gpio2                  = 0xff,
 714         .gpio3                  = 0xff,
 715         .maxpwr_bg              = 0x004c,
 716         .itssi_bg               = 0x00,
 717         .boardflags_lo          = 0x2848,
 718         .boardflags_hi          = 0x0000,
 719 };
 720 
 721 int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
 722 {
 723         if (bus->bustype == SSB_BUSTYPE_PCI) {
 724                 memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
 725                 return 0;
 726         } else {
 727                 pr_err("unable to fill SPROM for given bustype\n");
 728                 return -EINVAL;
 729         }
 730 }
 731 #endif
 732 
 733 /*
 734  * return board name for /proc/cpuinfo
 735  */
 736 const char *board_get_name(void)
 737 {
 738         return board.name;
 739 }
 740 
 741 /*
 742  * early init callback, read nvram data from flash and checksum it
 743  */
 744 void __init board_prom_init(void)
 745 {
 746         unsigned int i;
 747         u8 *boot_addr, *cfe;
 748         char cfe_version[32];
 749         char *board_name = NULL;
 750         u32 val;
 751         struct bcm_hcs *hcs;
 752 
 753         /* read base address of boot chip select (0)
 754          * 6328/6362 do not have MPI but boot from a fixed address
 755          */
 756         if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) {
 757                 val = 0x18000000;
 758         } else {
 759                 val = bcm_mpi_readl(MPI_CSBASE_REG(0));
 760                 val &= MPI_CSBASE_BASE_MASK;
 761         }
 762         boot_addr = (u8 *)KSEG1ADDR(val);
 763 
 764         /* dump cfe version */
 765         cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
 766         if (!memcmp(cfe, "cfe-v", 5))
 767                 snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
 768                          cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
 769         else
 770                 strcpy(cfe_version, "unknown");
 771         pr_info("CFE version: %s\n", cfe_version);
 772 
 773         bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
 774 
 775         if (BCMCPU_IS_3368()) {
 776                 hcs = (struct bcm_hcs *)boot_addr;
 777                 board_name = hcs->filename;
 778         } else {
 779                 board_name = bcm63xx_nvram_get_name();
 780         }
 781         /* find board by name */
 782         for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
 783                 if (strncmp(board_name, bcm963xx_boards[i]->name, 16))
 784                         continue;
 785                 /* copy, board desc array is marked initdata */
 786                 memcpy(&board, bcm963xx_boards[i], sizeof(board));
 787                 break;
 788         }
 789 
 790         /* bail out if board is not found, will complain later */
 791         if (!board.name[0]) {
 792                 char name[17];
 793                 memcpy(name, board_name, 16);
 794                 name[16] = 0;
 795                 pr_err("unknown bcm963xx board: %s\n", name);
 796                 return;
 797         }
 798 
 799         /* setup pin multiplexing depending on board enabled device,
 800          * this has to be done this early since PCI init is done
 801          * inside arch_initcall */
 802         val = 0;
 803 
 804 #ifdef CONFIG_PCI
 805         if (board.has_pci) {
 806                 bcm63xx_pci_enabled = 1;
 807                 if (BCMCPU_IS_6348())
 808                         val |= GPIO_MODE_6348_G2_PCI;
 809         }
 810 #endif
 811 
 812         if (board.has_pccard) {
 813                 if (BCMCPU_IS_6348())
 814                         val |= GPIO_MODE_6348_G1_MII_PCCARD;
 815         }
 816 
 817         if (board.has_enet0 && !board.enet0.use_internal_phy) {
 818                 if (BCMCPU_IS_6348())
 819                         val |= GPIO_MODE_6348_G3_EXT_MII |
 820                                 GPIO_MODE_6348_G0_EXT_MII;
 821         }
 822 
 823         if (board.has_enet1 && !board.enet1.use_internal_phy) {
 824                 if (BCMCPU_IS_6348())
 825                         val |= GPIO_MODE_6348_G3_EXT_MII |
 826                                 GPIO_MODE_6348_G0_EXT_MII;
 827         }
 828 
 829         bcm_gpio_writel(val, GPIO_MODE_REG);
 830 }
 831 
 832 /*
 833  * second stage init callback, good time to panic if we couldn't
 834  * identify on which board we're running since early printk is working
 835  */
 836 void __init board_setup(void)
 837 {
 838         if (!board.name[0])
 839                 panic("unable to detect bcm963xx board");
 840         pr_info("board name: %s\n", board.name);
 841 
 842         /* make sure we're running on expected cpu */
 843         if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
 844                 panic("unexpected CPU for bcm963xx board");
 845 }
 846 
 847 static struct gpio_led_platform_data bcm63xx_led_data;
 848 
 849 static struct platform_device bcm63xx_gpio_leds = {
 850         .name                   = "leds-gpio",
 851         .id                     = 0,
 852         .dev.platform_data      = &bcm63xx_led_data,
 853 };
 854 
 855 /*
 856  * third stage init callback, register all board devices.
 857  */
 858 int __init board_register_devices(void)
 859 {
 860         if (board.has_uart0)
 861                 bcm63xx_uart_register(0);
 862 
 863         if (board.has_uart1)
 864                 bcm63xx_uart_register(1);
 865 
 866         if (board.has_pccard)
 867                 bcm63xx_pcmcia_register();
 868 
 869         if (board.has_enet0 &&
 870             !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr))
 871                 bcm63xx_enet_register(0, &board.enet0);
 872 
 873         if (board.has_enet1 &&
 874             !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr))
 875                 bcm63xx_enet_register(1, &board.enet1);
 876 
 877         if (board.has_enetsw &&
 878             !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr))
 879                 bcm63xx_enetsw_register(&board.enetsw);
 880 
 881         if (board.has_usbd)
 882                 bcm63xx_usbd_register(&board.usbd);
 883 
 884         /* Generate MAC address for WLAN and register our SPROM,
 885          * do this after registering enet devices
 886          */
 887 #ifdef CONFIG_SSB_PCIHOST
 888         if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) {
 889                 memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
 890                 memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
 891                 if (ssb_arch_register_fallback_sprom(
 892                                 &bcm63xx_get_fallback_sprom) < 0)
 893                         pr_err("failed to register fallback SPROM\n");
 894         }
 895 #endif
 896 
 897         bcm63xx_spi_register();
 898 
 899         bcm63xx_hsspi_register();
 900 
 901         bcm63xx_flash_register();
 902 
 903         bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
 904         bcm63xx_led_data.leds = board.leds;
 905 
 906         platform_device_register(&bcm63xx_gpio_leds);
 907 
 908         if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
 909                 gpio_request_one(board.ephy_reset_gpio,
 910                                 board.ephy_reset_gpio_flags, "ephy-reset");
 911 
 912         return 0;
 913 }

/* [<][>][^][v][top][bottom][index][help] */