Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
[firefly-linux-kernel-4.4.55.git] / arch / mips / bcm63xx / boards / board_bcm963xx.c
index 9c0ddafafb6cee7116bf22638bca552c334601c4..5b974eb125fcee5f3ec2c034db14cb564a63f2f8 100644 (file)
 #include <bcm63xx_dev_usb_usbd.h>
 #include <board_bcm963xx.h>
 
+#include <uapi/linux/bcm933xx_hcs.h>
+
 #define PFX    "board_bcm963xx: "
 
+#define HCS_OFFSET_128K                        0x20000
+
 static struct board_info board;
 
+/*
+ * known 3368 boards
+ */
+#ifdef CONFIG_BCM63XX_CPU_3368
+static struct board_info __initdata board_cvg834g = {
+       .name                           = "CVG834G_E15R3921",
+       .expected_cpu_id                = 0x3368,
+
+       .has_uart0                      = 1,
+       .has_uart1                      = 1,
+
+       .has_enet0                      = 1,
+       .has_pci                        = 1,
+
+       .enet0 = {
+               .has_phy                = 1,
+               .use_internal_phy       = 1,
+       },
+
+       .leds = {
+               {
+                       .name           = "CVG834G:green:power",
+                       .gpio           = 37,
+                       .default_trigger= "default-on",
+               },
+       },
+
+       .ephy_reset_gpio                = 36,
+       .ephy_reset_gpio_flags          = GPIOF_INIT_HIGH,
+};
+#endif
+
 /*
  * known 6328 boards
  */
@@ -639,6 +675,9 @@ static struct board_info __initdata board_DWVS0 = {
  * all boards
  */
 static const struct board_info __initconst *bcm963xx_boards[] = {
+#ifdef CONFIG_BCM63XX_CPU_3368
+       &board_cvg834g,
+#endif
 #ifdef CONFIG_BCM63XX_CPU_6328
        &board_96328avng,
 #endif
@@ -722,8 +761,9 @@ void __init board_prom_init(void)
        unsigned int i;
        u8 *boot_addr, *cfe;
        char cfe_version[32];
-       char *board_name;
+       char *board_name = NULL;
        u32 val;
+       struct bcm_hcs *hcs;
 
        /* read base address of boot chip select (0)
         * 6328/6362 do not have MPI but boot from a fixed address
@@ -747,7 +787,12 @@ void __init board_prom_init(void)
 
        bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
 
-       board_name = bcm63xx_nvram_get_name();
+       if (BCMCPU_IS_3368()) {
+               hcs = (struct bcm_hcs *)boot_addr;
+               board_name = hcs->filename;
+       } else {
+               board_name = bcm63xx_nvram_get_name();
+       }
        /* find board by name */
        for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
                if (strncmp(board_name, bcm963xx_boards[i]->name, 16))
@@ -877,5 +922,9 @@ int __init board_register_devices(void)
 
        platform_device_register(&bcm63xx_gpio_leds);
 
+       if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
+               gpio_request_one(board.ephy_reset_gpio,
+                               board.ephy_reset_gpio_flags, "ephy-reset");
+
        return 0;
 }