]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Merge branch 'next'
authorKim Phillips <kim.phillips@freescale.com>
Mon, 25 Aug 2008 22:02:10 +0000 (17:02 -0500)
committerKim Phillips <kim.phillips@freescale.com>
Mon, 25 Aug 2008 22:02:10 +0000 (17:02 -0500)
1  2 
common/fdt_support.c
include/configs/MPC8315ERDB.h

diff --combined common/fdt_support.c
index e57ac0a545322819cf7239703a5f46219eabdb4a,2a323769266a7e6905f56a6176e8dab8bef4a309..405b9dbda977f74d08a48bdf4e62919d8545bc7d
@@@ -368,64 -368,94 +368,80 @@@ int fdt_fixup_memory(void *blob, u64 st
        return 0;
  }
  
 -#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
 -    defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
 -
 -void fdt_fixup_ethernet(void *fdt, bd_t *bd)
 +void fdt_fixup_ethernet(void *fdt)
  {
 -      int node;
 +      int node, i, j;
 +      char enet[16], *tmp, *end;
 +      char mac[16] = "ethaddr";
        const char *path;
 +      unsigned char mac_addr[6];
  
        node = fdt_path_offset(fdt, "/aliases");
 -      if (node >= 0) {
 -#if defined(CONFIG_HAS_ETH0)
 -              path = fdt_getprop(fdt, node, "ethernet0", NULL);
 -              if (path) {
 -                      do_fixup_by_path(fdt, path, "mac-address",
 -                              bd->bi_enetaddr, 6, 0);
 -                      do_fixup_by_path(fdt, path, "local-mac-address",
 -                              bd->bi_enetaddr, 6, 1);
 -              }
 -#endif
 -#if defined(CONFIG_HAS_ETH1)
 -              path = fdt_getprop(fdt, node, "ethernet1", NULL);
 -              if (path) {
 -                      do_fixup_by_path(fdt, path, "mac-address",
 -                              bd->bi_enet1addr, 6, 0);
 -                      do_fixup_by_path(fdt, path, "local-mac-address",
 -                              bd->bi_enet1addr, 6, 1);
 -              }
 -#endif
 -#if defined(CONFIG_HAS_ETH2)
 -              path = fdt_getprop(fdt, node, "ethernet2", NULL);
 -              if (path) {
 -                      do_fixup_by_path(fdt, path, "mac-address",
 -                              bd->bi_enet2addr, 6, 0);
 -                      do_fixup_by_path(fdt, path, "local-mac-address",
 -                              bd->bi_enet2addr, 6, 1);
 +      if (node < 0)
 +              return;
 +
 +      i = 0;
 +      while ((tmp = getenv(mac)) != NULL) {
 +              sprintf(enet, "ethernet%d", i);
 +              path = fdt_getprop(fdt, node, enet, NULL);
 +              if (!path) {
 +                      debug("No alias for %s\n", enet);
 +                      sprintf(mac, "eth%daddr", ++i);
 +                      continue;
                }
 -#endif
 -#if defined(CONFIG_HAS_ETH3)
 -              path = fdt_getprop(fdt, node, "ethernet3", NULL);
 -              if (path) {
 -                      do_fixup_by_path(fdt, path, "mac-address",
 -                              bd->bi_enet3addr, 6, 0);
 -                      do_fixup_by_path(fdt, path, "local-mac-address",
 -                              bd->bi_enet3addr, 6, 1);
 +
 +              for (j = 0; j < 6; j++) {
 +                      mac_addr[j] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
 +                      if (tmp)
 +                              tmp = (*end) ? end+1 : end;
                }
 -#endif
 +
 +              do_fixup_by_path(fdt, path, "mac-address", &mac_addr, 6, 0);
 +              do_fixup_by_path(fdt, path, "local-mac-address",
 +                              &mac_addr, 6, 1);
 +
 +              sprintf(mac, "eth%daddr", ++i);
        }
  }
 -#endif
  
  #ifdef CONFIG_HAS_FSL_DR_USB
  void fdt_fixup_dr_usb(void *blob, bd_t *bd)
  {
        char *mode;
+       char *type;
        const char *compat = "fsl-usb2-dr";
-       const char *prop = "dr_mode";
+       const char *prop_mode = "dr_mode";
+       const char *prop_type = "phy_type";
        int node_offset;
        int err;
  
        mode = getenv("usb_dr_mode");
-       if (!mode)
+       type = getenv("usb_phy_type");
+       if (!mode && !type)
                return;
  
        node_offset = fdt_node_offset_by_compatible(blob, 0, compat);
-       if (node_offset < 0)
+       if (node_offset < 0) {
                printf("WARNING: could not find compatible node %s: %s.\n",
                        compat, fdt_strerror(node_offset));
+               return;
+       }
  
-       err = fdt_setprop(blob, node_offset, prop, mode, strlen(mode) + 1);
-       if (err < 0)
-               printf("WARNING: could not set %s for %s: %s.\n",
-                      prop, compat, fdt_strerror(err));
+       if (mode) {
+               err = fdt_setprop(blob, node_offset, prop_mode, mode,
+                                 strlen(mode) + 1);
+               if (err < 0)
+                       printf("WARNING: could not set %s for %s: %s.\n",
+                              prop_mode, compat, fdt_strerror(err));
+       }
+       if (type) {
+               err = fdt_setprop(blob, node_offset, prop_type, type,
+                                 strlen(type) + 1);
+               if (err < 0)
+                       printf("WARNING: could not set %s for %s: %s.\n",
+                              prop_type, compat, fdt_strerror(err));
+       }
  }
  #endif /* CONFIG_HAS_FSL_DR_USB */
  
index b0cc36dce3922250bf7527dfdd161e2e3a7d4475,6b019f85adf86528234ac228a512385fe05e719b..006b93a0bf7e76b28f363ea72cca082b9d57a350
   * FLASH on the Local Bus
   */
  #define CFG_FLASH_CFI         /* use the Common Flash Interface */
 -#define CFG_FLASH_CFI_DRIVER  /* use the CFI driver */
 +#define CONFIG_FLASH_CFI_DRIVER       /* use the CFI driver */
  #define CFG_FLASH_CFI_WIDTH   FLASH_CFI_16BIT
  
  #define CFG_FLASH_BASE                0xFE000000 /* FLASH base address */
  #define CONFIG_NET_MULTI      1
  #endif
  
+ #define CONFIG_HAS_FSL_DR_USB
  /*
   * TSEC
   */