]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-net
authorTom Rini <trini@konsulko.com>
Thu, 9 Feb 2017 16:56:35 +0000 (11:56 -0500)
committerTom Rini <trini@konsulko.com>
Thu, 9 Feb 2017 16:56:35 +0000 (11:56 -0500)
1  2 
common/fdt_support.c
drivers/net/designware.c
drivers/net/fec_mxc.c
drivers/net/macb.c
drivers/net/phy/ti.c
tools/Makefile

diff --combined common/fdt_support.c
index a57a5759e4a030d9c03a5aad969703de787d41d6,f16039114aba21bd4baf157e61a5f848332ceeb4..55d4d6f6d444ef6cc4bd208efa4da58a9e11d386
@@@ -473,7 -473,7 +473,7 @@@ void fdt_fixup_ethernet(void *fdt
        char *tmp, *end;
        char mac[16];
        const char *path;
-       unsigned char mac_addr[6];
+       unsigned char mac_addr[ARP_HLEN];
        int offset;
  
        if (fdt_path_offset(fdt, "/aliases") < 0)
@@@ -903,9 -903,14 +903,9 @@@ void fdt_fixup_mtdparts(void *blob, voi
  {
        struct node_info *ni = node_info;
        struct mtd_device *dev;
 -      char *parts;
        int i, idx;
        int noff;
  
 -      parts = getenv("mtdparts");
 -      if (!parts)
 -              return;
 -
        if (mtdparts_init() != 0)
                return;
  
diff --combined drivers/net/designware.c
index eee4e09d7ed9859339c43bce9d756c3f3713e4e0,a8e2a92def8c510e08d5f5b4c87e941637f6a1a5..f9fb8e08867beb365ec2b759a52603ebbfe26637
@@@ -728,8 -728,7 +728,8 @@@ int designware_eth_ofdata_to_platdata(s
  
        pdata->iobase = dev_get_addr(dev);
        pdata->phy_interface = -1;
 -      phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
 +      phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
 +                             NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
        }
  
        pdata->max_speed = 0;
 -      cell = fdt_getprop(gd->fdt_blob, dev->of_offset, "max-speed", NULL);
 +      cell = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed", NULL);
        if (cell)
                pdata->max_speed = fdt32_to_cpu(*cell);
  
  #ifdef CONFIG_DM_GPIO
 -      if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
 +      if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                            "snps,reset-active-low"))
                reset_flags |= GPIOD_ACTIVE_LOW;
  
        ret = gpio_request_by_name(dev, "snps,reset-gpio", 0,
                &priv->reset_gpio, reset_flags);
        if (ret == 0) {
 -              ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
 +              ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                        "snps,reset-delays-us", dw_pdata->reset_delays, 3);
        } else if (ret == -ENOENT) {
                ret = 0;
@@@ -764,6 -763,7 +764,7 @@@ static const struct udevice_id designwa
        { .compatible = "allwinner,sun7i-a20-gmac" },
        { .compatible = "altr,socfpga-stmmac" },
        { .compatible = "amlogic,meson6-dwmac" },
+       { .compatible = "amlogic,meson-gx-dwmac" },
        { .compatible = "st,stm32-dwmac" },
        { }
  };
diff --combined drivers/net/fec_mxc.c
index 5f34c8fe3c6e22fde41aa50bd8d2874be51a41c5,9e9b8beb92495d1a80fa0ae419fc129c23d2e084..910879ba3e4c08cd8df43842958e00411c632164
@@@ -1240,7 -1240,6 +1240,6 @@@ static int fecmxc_probe(struct udevice 
        }
  
        fec_reg_setup(priv);
-       fec_set_dev_name((char *)dev->name, dev_id);
        priv->dev_id = (dev_id == -1) ? 0 : dev_id;
  
        return 0;
@@@ -1277,8 -1276,7 +1276,8 @@@ static int fecmxc_ofdata_to_platdata(st
        priv->eth = (struct ethernet_regs *)pdata->iobase;
  
        pdata->phy_interface = -1;
 -      phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
 +      phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
 +                             NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
diff --combined drivers/net/macb.c
index 452fc3e3b97ccde238774011bcec30f42ace90b5,67d820fefa591c260d34b956cdac994c27ed9c4e..1c4bef97b6d18ef2549d88236f3322df1505a2c3
@@@ -4,6 -4,7 +4,7 @@@
   * SPDX-License-Identifier:   GPL-2.0+
   */
  #include <common.h>
+ #include <clk.h>
  #include <dm.h>
  
  /*
@@@ -112,6 -113,7 +113,7 @@@ struct macb_device 
        struct mii_dev          *bus;
  
  #ifdef CONFIG_DM_ETH
+       unsigned long           pclk_rate;
        phy_interface_t         phy_interface;
  #endif
  };
@@@ -754,7 -756,11 +756,11 @@@ static int _macb_write_hwaddr(struct ma
  static u32 macb_mdc_clk_div(int id, struct macb_device *macb)
  {
        u32 config;
+ #ifdef CONFIG_DM_ETH
+       unsigned long macb_hz = macb->pclk_rate;
+ #else
        unsigned long macb_hz = get_macb_pclk_rate(id);
+ #endif
  
        if (macb_hz < 20000000)
                config = MACB_BF(CLK, MACB_CLK_DIV8);
  static u32 gem_mdc_clk_div(int id, struct macb_device *macb)
  {
        u32 config;
+ #ifdef CONFIG_DM_ETH
+       unsigned long macb_hz = macb->pclk_rate;
+ #else
        unsigned long macb_hz = get_macb_pclk_rate(id);
+ #endif
  
        if (macb_hz < 20000000)
                config = GEM_BF(CLK, GEM_CLK_DIV8);
@@@ -991,27 -1002,53 +1002,54 @@@ static const struct eth_ops macb_eth_op
        .write_hwaddr   = macb_write_hwaddr,
  };
  
+ static int macb_enable_clk(struct udevice *dev)
+ {
+       struct macb_device *macb = dev_get_priv(dev);
+       struct clk clk;
+       ulong clk_rate;
+       int ret;
+       ret = clk_get_by_index(dev, 0, &clk);
+       if (ret)
+               return -EINVAL;
+       ret = clk_enable(&clk);
+       if (ret)
+               return ret;
+       clk_rate = clk_get_rate(&clk);
+       if (!clk_rate)
+               return -EINVAL;
+       macb->pclk_rate = clk_rate;
+       return 0;
+ }
  static int macb_eth_probe(struct udevice *dev)
  {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct macb_device *macb = dev_get_priv(dev);
- #ifdef CONFIG_DM_ETH
        const char *phy_mode;
+       int ret;
  
 -      phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
 +      phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
 +                             NULL);
        if (phy_mode)
                macb->phy_interface = phy_get_interface_by_name(phy_mode);
        if (macb->phy_interface == -1) {
                debug("%s: Invalid PHY interface '%s'\n", __func__, phy_mode);
                return -EINVAL;
        }
- #endif
  
        macb->regs = (void *)pdata->iobase;
  
+       ret = macb_enable_clk(dev);
+       if (ret)
+               return ret;
        _macb_eth_initialize(macb);
  #if defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
        int retval;
        struct mii_dev *mdiodev = mdio_alloc();
diff --combined drivers/net/phy/ti.c
index d1ce4060ff8613f51687eeb9afe433770d9e2bcf,2fd566cfa6660652edcaa9a3cbb59596c9e73e73..1d870806a3540453c972e0d59baf64742fe77a11
@@@ -27,6 -27,7 +27,7 @@@ DECLARE_GLOBAL_DATA_PTR
  /* Extended Registers */
  #define DP83867_RGMIICTL      0x0032
  #define DP83867_RGMIIDCTL     0x0086
+ #define DP83867_IO_MUX_CFG    0x0170
  
  #define DP83867_SW_RESET      BIT(15)
  #define DP83867_SW_RESTART    BIT(14)
  #define DEFAULT_TX_ID_DELAY   DP83867_RGMIIDCTL_2_75_NS
  #define DEFAULT_FIFO_DEPTH    DP83867_PHYCR_FIFO_DEPTH_4_B_NIB
  
+ /* IO_MUX_CFG bits */
+ #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL  0x1f
+ #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX   0x0
+ #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN   0x1f
  struct dp83867_private {
        int rx_id_delay;
        int tx_id_delay;
        int fifo_depth;
+       int io_impedance;
  };
  
  /**
@@@ -166,14 -174,23 +174,23 @@@ static int dp83867_of_init(struct phy_d
  {
        struct dp83867_private *dp83867 = phydev->priv;
        struct udevice *dev = phydev->dev;
+       int node = dev->of_offset;
+       const void *fdt = gd->fdt_blob;
+       if (fdtdec_get_bool(fdt, node, "ti,max-output-impedance"))
+               dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
+       else if (fdtdec_get_bool(fdt, node, "ti,min-output-impedance"))
+               dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;
+       else
+               dp83867->io_impedance = -EINVAL;
  
 -      dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
 +      dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,rx-internal-delay", -1);
  
 -      dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
 +      dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,tx-internal-delay", -1);
  
 -      dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
 +      dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,fifo-depth", -1);
  
        return 0;
@@@ -186,6 -203,7 +203,7 @@@ static int dp83867_of_init(struct phy_d
        dp83867->rx_id_delay = DEFAULT_RX_ID_DELAY;
        dp83867->tx_id_delay = DEFAULT_TX_ID_DELAY;
        dp83867->fifo_depth = DEFAULT_FIFO_DEPTH;
+       dp83867->io_impedance = -EINVAL;
  
        return 0;
  }
@@@ -246,8 -264,7 +264,7 @@@ static int dp83867_config(struct phy_de
                phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_BISCR, 0x0);
        }
  
-       if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) &&
-           (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {
+       if (phy_interface_is_rgmii(phydev)) {
                val = phy_read_mmd_indirect(phydev, DP83867_RGMIICTL,
                                            DP83867_DEVADDR, phydev->addr);
  
  
                phy_write_mmd_indirect(phydev, DP83867_RGMIIDCTL,
                                       DP83867_DEVADDR, phydev->addr, delay);
+               if (dp83867->io_impedance >= 0) {
+                       val = phy_read_mmd_indirect(phydev,
+                                                   DP83867_IO_MUX_CFG,
+                                                   DP83867_DEVADDR,
+                                                   phydev->addr);
+                       val &= ~DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL;
+                       val |= dp83867->io_impedance &
+                              DP83867_IO_MUX_CFG_IO_IMPEDANCE_CTRL;
+                       phy_write_mmd_indirect(phydev, DP83867_IO_MUX_CFG,
+                                              DP83867_DEVADDR, phydev->addr,
+                                              val);
+               }
        }
  
        genphy_config_aneg(phydev);
diff --combined tools/Makefile
index cbccd4ab91ae167b4d5daabf2e251bdc2b6e0234,eca8ecce107fb728310944dcfe33c72f1772bc85..5000f4d5bbafa94daac1a0e877d409a594cdcff6
@@@ -32,6 -32,7 +32,6 @@@ CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y
  
  hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
  
 -hostprogs-$(CONFIG_CMD_LICENSE) += bin2header
  hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
  hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
  HOSTCFLAGS_bmp_logo.o := -pedantic
@@@ -42,6 -43,10 +42,10 @@@ envcrc-objs := envcrc.o lib/crc32.o com
  hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
  HOSTCFLAGS_gen_eth_addr.o := -pedantic
  
+ hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
+ gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
+ HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
  hostprogs-$(CONFIG_CMD_LOADS) += img2srec
  HOSTCFLAGS_img2srec.o := -pedantic
  
@@@ -195,6 -200,7 +199,7 @@@ fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.
  # that won't build on some weird host compiler -- though there are lots of
  # exceptions for files that aren't complaint.
  HOSTCFLAGS_crc32.o := -pedantic
+ HOSTCFLAGS_crc8.o := -pedantic
  HOSTCFLAGS_md5.o := -pedantic
  HOSTCFLAGS_sha1.o := -pedantic
  HOSTCFLAGS_sha256.o := -pedantic
@@@ -232,6 -238,10 +237,6 @@@ endi
  
  endif # !LOGO_BMP
  
 -# Generated gziped GPL-2.0 license text
 -LICENSE_H = $(objtree)/include/license.h
 -LICENSE-$(CONFIG_CMD_LICENSE) += $(LICENSE_H)
 -
  #
  # Use native tools and options
  # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
@@@ -246,7 -256,7 +251,7 @@@ HOST_EXTRACFLAGS += -include $(srctree)
                -D__KERNEL_STRICT_NAMES \
                -D_GNU_SOURCE
  
 -__build:      $(LOGO-y) $(LICENSE-y)
 +__build:      $(LOGO-y)
  
  $(LOGO_H):    $(obj)/bmp_logo $(LOGO_BMP)
        $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
  $(LOGO_DATA_H):       $(obj)/bmp_logo $(LOGO_BMP)
        $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
  
 -$(LICENSE_H): $(obj)/bin2header $(srctree)/Licenses/gpl-2.0.txt
 -      cat $(srctree)/Licenses/gpl-2.0.txt | gzip -9 -c | \
 -              $(obj)/bin2header license_gzip > $(LICENSE_H)
 -
  # Let clean descend into subdirs
  subdir- += env