Merge branch 'master' of git://git.denx.de/u-boot-net

This commit is contained in:
Tom Rini 2015-04-20 20:16:21 -04:00
commit 91528821d9
10 changed files with 89 additions and 26 deletions

View File

@ -328,10 +328,11 @@ T: git git://git.denx.de/u-boot-ppc4xx.git
F: arch/powerpc/cpu/ppc4xx/
NETWORK
M: Joe Hershberger <joe.hershberger@gmail.com>
M: Joe Hershberger <joe.hershberger@ni.com>
S: Maintained
T: git git://git.denx.de/u-boot-net.git
F: drivers/net/
F: net/
NAND FLASH
M: Scott Wood <scottwood@freescale.com>

View File

@ -249,6 +249,7 @@ static uint last_addr_lo;
static uint last_addr_hi;
static uint last_reg_lo;
static uint last_reg_hi;
static uint last_mask;
static void extract_range(
char * input,
@ -272,7 +273,7 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char op[2];
unsigned char addrlo, addrhi, reglo, reghi;
unsigned char addr, reg;
unsigned short data;
unsigned short data, mask;
int rcode = 0;
const char *devname;
@ -294,6 +295,7 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
reglo = last_reg_lo;
reghi = last_reg_hi;
data = last_data;
mask = last_mask;
if ((flag & CMD_FLAG_REPEAT) == 0) {
op[0] = argv[1][0];
@ -307,7 +309,9 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc >= 4)
extract_range(argv[3], &reglo, &reghi);
if (argc >= 5)
data = simple_strtoul (argv[4], NULL, 16);
data = simple_strtoul(argv[4], NULL, 16);
if (argc >= 6)
mask = simple_strtoul(argv[5], NULL, 16);
}
/* use current device */
@ -375,6 +379,28 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
}
}
} else if (op[0] == 'm') {
for (addr = addrlo; addr <= addrhi; addr++) {
for (reg = reglo; reg <= reghi; reg++) {
unsigned short val = 0;
if (miiphy_read(devname, addr,
reg, &val)) {
printf("Error reading from the PHY");
printf(" addr=%02x", addr);
printf(" reg=%02x\n", reg);
rcode = 1;
} else {
val = (val & ~mask) | (data & mask);
if (miiphy_write(devname, addr,
reg, val)) {
printf("Error writing to the PHY");
printf(" addr=%02x", addr);
printf(" reg=%02x\n", reg);
rcode = 1;
}
}
}
}
} else if (strncmp(op, "du", 2) == 0) {
ushort regs[6];
int ok = 1;
@ -417,6 +443,7 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
last_reg_lo = reglo;
last_reg_hi = reghi;
last_data = data;
last_mask = mask;
return rcode;
}
@ -424,13 +451,15 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/***************************************************/
U_BOOT_CMD(
mii, 5, 1, do_mii,
mii, 6, 1, do_mii,
"MII utility commands",
"device - list available devices\n"
"mii device <devname> - set current device\n"
"mii info <addr> - display MII PHY info\n"
"mii read <addr> <reg> - read MII PHY <addr> register <reg>\n"
"mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n"
"mii dump <addr> <reg> - pretty-print <addr> <reg> (0-5 only)\n"
"device - list available devices\n"
"mii device <devname> - set current device\n"
"mii info <addr> - display MII PHY info\n"
"mii read <addr> <reg> - read MII PHY <addr> register <reg>\n"
"mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n"
"mii modify <addr> <reg> <data> <mask> - modify MII PHY <addr> register <reg>\n"
" updating bits identified in <mask>\n"
"mii dump <addr> <reg> - pretty-print <addr> <reg> (0-5 only)\n"
"Addr and/or reg may be ranges, e.g. 2-7."
);

View File

@ -24,7 +24,7 @@ alias ijc Ian Campbell <ijc+uboot@hellion.org.uk>
alias iwamatsu Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
alias jagan Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
alias jasonjin Jason Jin <jason.jin@freescale.com>
alias jhersh Joe Hershberger <joe.hershberger@gmail.com>
alias jhersh Joe Hershberger <joe.hershberger@ni.com>
alias jwrdegoede Hans de Goede <hdegoede@redhat.com>
alias kimphill Kim Phillips <kim.phillips@freescale.com>
alias luka Luka Perkov <luka.perkov@sartura.hr>
@ -113,6 +113,7 @@ alias x86 uboot, sjg, gruss
alias dm uboot, sjg
alias cfi uboot, stroese
alias dfu uboot, lukma
alias eth uboot, jhersh
alias kerneldoc uboot, marex
alias fdt uboot, sjg
alias i2c uboot, hs
@ -120,6 +121,7 @@ alias kconfig uboot, masahiro
alias mmc uboot, panto
alias nand uboot, scottwood
alias net uboot, jhersh
alias phy uboot, jhersh
alias spi uboot, jagan
alias ubi uboot, hs
alias usb uboot, marex

View File

@ -446,7 +446,7 @@ int pch_gbe_register(bd_t *bis)
dev->iobase = iobase;
priv->mac_regs = (struct pch_gbe_regs *)iobase;
sprintf(dev->name, "pch_gbe.%x", iobase);
sprintf(dev->name, "pch_gbe");
/* Read MAC address from SROM and initialize dev->enetaddr with it */
pch_gbe_mac_read(priv->mac_regs, dev->enetaddr);

View File

@ -22,6 +22,16 @@ static struct phy_driver KSZ804_driver = {
.shutdown = &genphy_shutdown,
};
static struct phy_driver KSZ8081_driver = {
.name = "Micrel KSZ8081",
.uid = 0x221560,
.mask = 0xfffff0,
.features = PHY_BASIC_FEATURES,
.config = &genphy_config,
.startup = &genphy_startup,
.shutdown = &genphy_shutdown,
};
/**
* KSZ8895
*/
@ -272,6 +282,7 @@ static struct phy_driver ksz9031_driver = {
int phy_micrel_init(void)
{
phy_register(&KSZ804_driver);
phy_register(&KSZ8081_driver);
#ifdef CONFIG_PHY_MICREL_KSZ9021
phy_register(&ksz9021_driver);
#else

View File

@ -582,7 +582,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
* Description: Reads the ID registers of the PHY at @addr on the
* @bus, stores it in @phy_id and returns zero on success.
*/
static int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
int __weak get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
{
int phy_reg;

View File

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: GPL-2.0+
*
* Copyright 2010-2011 Freescale Semiconductor, Inc.
* Copyright 2010-2011, 2015 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
#include <config.h>
@ -21,12 +21,28 @@
#define MIIM_RTL8211x_PHYSTAT_SPDDONE 0x0800
#define MIIM_RTL8211x_PHYSTAT_LINK 0x0400
/* RTL8211x PHY Interrupt Enable Register */
#define MIIM_RTL8211x_PHY_INER 0x12
#define MIIM_RTL8211x_PHY_INTR_ENA 0x9f01
#define MIIM_RTL8211x_PHY_INTR_DIS 0x0000
/* RTL8211x PHY Interrupt Status Register */
#define MIIM_RTL8211x_PHY_INSR 0x13
/* RealTek RTL8211x */
static int rtl8211x_config(struct phy_device *phydev)
{
phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
/* mask interrupt at init; if the interrupt is
* needed indeed, it should be explicitly enabled
*/
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER,
MIIM_RTL8211x_PHY_INTR_DIS);
/* read interrupt status just to clear it */
phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER);
genphy_config_aneg(phydev);
return 0;

View File

@ -55,7 +55,7 @@
#define drv_version "v1.5"
#define drv_date "01-17-2004"
static u32 ioaddr;
static unsigned long ioaddr;
/* Condensed operations for readability. */
#define currticks() get_timer(0)
@ -92,19 +92,21 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
#define TX_TIMEOUT (6*HZ)
/* write/read MMIO register. Notice: {read,write}[wl] do the necessary swapping */
#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
#define RTL_R8(reg) readb (ioaddr + (reg))
#define RTL_R16(reg) readw (ioaddr + (reg))
#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
#define RTL_W8(reg, val8) writeb((val8), ioaddr + (reg))
#define RTL_W16(reg, val16) writew((val16), ioaddr + (reg))
#define RTL_W32(reg, val32) writel((val32), ioaddr + (reg))
#define RTL_R8(reg) readb(ioaddr + (reg))
#define RTL_R16(reg) readw(ioaddr + (reg))
#define RTL_R32(reg) readl(ioaddr + (reg))
#define ETH_FRAME_LEN MAX_ETH_FRAME_SIZE
#define ETH_ALEN MAC_ADDR_LEN
#define ETH_ZLEN 60
#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, (pci_addr_t)a)
#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, (phys_addr_t)a)
#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)(unsigned long)dev->priv, \
(pci_addr_t)(unsigned long)a)
#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)(unsigned long)dev->priv, \
(phys_addr_t)a)
enum RTL8169_registers {
MAC0 = 0, /* Ethernet hardware address. */
@ -852,7 +854,7 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
#ifdef DEBUG_RTL8169
/* Print out some hardware info */
printf("%s: at ioaddr 0x%x\n", dev->name, ioaddr);
printf("%s: at ioaddr 0x%lx\n", dev->name, ioaddr);
#endif
/* if TBI is not endbled */
@ -1004,7 +1006,7 @@ int rtl8169_initialize(bd_t *bis)
memset(dev, 0, sizeof(*dev));
sprintf (dev->name, "RTL8169#%d", card_number);
dev->priv = (void *) devno;
dev->priv = (void *)(unsigned long)devno;
dev->iobase = (int)pci_mem_to_phys(devno, iobase);
dev->init = rtl_reset;

View File

@ -513,7 +513,8 @@ int zynq_gem_initialize(bd_t *bis, phys_addr_t base_addr,
/* Align bd_space to 1MB */
bd_space = memalign(1 << MMU_SECTION_SHIFT, BD_SPACE);
mmu_set_region_dcache_behaviour((u32)bd_space, BD_SPACE, DCACHE_OFF);
mmu_set_region_dcache_behaviour((phys_addr_t)bd_space,
BD_SPACE, DCACHE_OFF);
/* Initialize the bd spaces for tx and rx bd's */
priv->tx_bd = (struct emac_bd *)bd_space;

View File

@ -254,6 +254,7 @@ int phy_teranetics_init(void);
int phy_vitesse_init(void);
int board_phy_config(struct phy_device *phydev);
int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id);
/**
* phy_get_interface_by_name() - Look up a PHY interface name