summaryrefslogtreecommitdiff
path: root/common/miiphyutil.c
Commit message (Collapse)AuthorAgeLines
* dm: net: Adjust PHY interface to work with CONFIG_DM_ETHSimon Glass2015-04-18-0/+1
| | | | | | | | | | | | When driver model is used for Ethernet a few functions are passed a udevice instead of an eth_device. Also add a function to find a PHY type given its name. This will be used to decode the device tree node. Finally, put a phy_interface field in struct eth_pdata since this is an important part of the platform data for Ethernet. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* Revert "mii: miiphy register address width change"Wolfgang Denk2011-12-07-4/+4
| | | | | | | | | | | | This reverts commit 5c45a22b9203351a32aec4600514341b91175542. It causes a lot of "incompatible pointer type" warnings for a large number of Ethernet drivers, which are not really worth fixing especially as this patch was only supposed to help the old, deprecated miiphy API. Instead of adding more efforts to a lost case we rather revert it. Signed-off-by: Wolfgang Denk <wd@denx.de>
* mii: miiphy register address width changeChandan Nath2011-12-06-4/+4
| | | | | | | | | | | This patch is added for PHY whose register offset value exceeds 0xFF and cannot be used with "unsigned char" datatype in miiphy_read, miiphy_write and miiphy_register functions. Datatype of register offset is changed to unsigned short instead of unsigned char so that offset value greater then 0xFF can be used. Signed-off-by: Chandan Nath <chandan.nath@ti.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* miiphy: Note that miiphy_* API is deprecatedAndy Fleming2011-12-05-0/+10
| | | | | | | We want to move everything to phylib, and we definitely don't want new drivers using the miiphy infrastructure. Signed-off-by: Andy Fleming <afleming@freescale.com>
* miiphy: use strncpy() not sprintf()Laurence Withers2011-07-26-10/+4
| | | | | | | | | | In miiphy_register() the new device's name was initialised by passing a string parameter as the format string to sprintf(). As this would cause problems if it ever contained a '%' symbol, switch to using strncpy() instead. Signed-off-by: Laurence Withers <lwithers@guralp.com> Cc: Andy Fleming <afleming@freescale.com>
* miiphy: miiphyutil.c: fix compile warningAnatolij Gustschin2011-04-30-4/+8
| | | | | | | | | | Fix warning introduced while recent PHY Lib changes: miiphyutil.c: In function 'miiphy_read': miiphyutil.c:304: warning: comparison is always false due to limited range of data type Signed-off-by: Anatolij Gustschin <agust@denx.de> Cc: Andy Fleming <afleming@freescale.com>
* Create PHY Lib for U-BootAndy Fleming2011-04-20-36/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extends the mii_dev structure to participate in a full-blown MDIO and PHY driver scheme. The mii_dev structure and miiphy calls are modified in such a way to allow the original mii command and miiphy infrastructure to work as before, but also to support a new set of APIs which allow (among other things) sharing of PHY driver code and 10G support The mii command will continue to support normal PHY management functions (Clause 22 of 802.3), but will not be changed to support 10G (Clause 45). The basic design is similar to PHY Lib from Linux, but simplified for U-Boot's network and driver infrastructure. We now have MDIO drivers and PHY drivers An MDIO driver provides: read write reset A PHY driver provides: (optionally): probe config - initial setup, starting of auto-negotiation startup - waiting for AN, and reading link state shutdown - any cleanup needed The ethernet drivers interact with the PHY Lib using these functions: phy_connect() phy_config() phy_startup() phy_shutdown() Each PHY driver can be configured separately, or all at once using config_phylib_all_drivers.h (added in the patch which adds the drivers) We also provide generic drivers for Clause 22 (10/100/1000), and Clause 45 (10G) PHYs. We also implement phy_reset(), and call it in phy_connect(). Because phy_reset() is essentially the same as miiphy_reset, but: a) must support 10G PHYs, and b) should use the phylib primitives, we implement miiphy_reset, using phy_reset(), but only when CONFIG_PHYLIB is set. Otherwise, we just use the old version. In this way, we save on compile size, even if we don't manage to save code size. Pulled ethtool.h and mdio.h from: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 782d640afd15af7a1faf01cfe566ca4ac511319d With many, many deletions so as to enable compilation under u-boot Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Detlev Zundel <dzu@denx.de>
* miiphy: Fix some formatting issuesAndy Fleming2011-04-20-72/+72
| | | | | | | | Mostly putting a space between function name and "(", and doing return (foo) Signed-off-by: Andy Fleming <afleming@freescale.com> Acked-by: Detlev Zundel <dzu@denx.de>
* miiphy: convert to linux/mii.hMike Frysinger2011-01-09-25/+25
| | | | | | | | The include/miiphy.h header duplicates a lot of things from linux/mii.h. So punt all the things that overlap to keep the API simple and to make merging between U-Boot and Linux simpler. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* miiphy: leverage current_mii cache moreMike Frysinger2010-08-09-2/+16
| | | | | | | | | | For code that uses miiphy_{read,write}, every call invokes a full look up of the mii list. There is already a "current_mii" cache that is used by some code, but have the miiphy_{read,write} function use it as well. This does increase the code size slightly, but I think it's worth it. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* miiphy: unify device list lookupMike Frysinger2010-08-09-60/+40
| | | | | | | | | Rather than have every func re-implement the list walking code, do it one local function. This shrinks the resulting object code a little while making the source much more manageable. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* miiphy: constify device nameMike Frysinger2010-08-09-20/+21
| | | | | | | The driver name does not need to be writable, so constify it. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* Cosmetic change - indentation correction.Michael Zaidman2010-03-12-2/+2
| | | | Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
* net: Use 0.5 sec timeout in miiphy_reset() instead of counting loopStefan Roese2010-02-06-6/+6
| | | | | | | | | | | | | This patch fixes a problem I've notived on a buggy PPC4xx system. This system has problems with the PHY MDIO communication and seemed to be stuck/crashed in miiphy_reset(). But degugging revealed, that the CPU didn't crash, but "only" hung in this counting loop for about 2 minutes. This patch now uses a real timeout of 0.5 seconds (as mentioned in the comment in miiphy_reset). Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* Cleanup: use constantNiklaus Giger2009-10-18-1/+1
| | | | Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
* rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD2008-10-18-1/+1
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* miiphyutil: Move conditional compilation to MakefileJean-Christophe PLAGNIOL-VILLARD2008-08-29-2/+0
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* common/miiphyutil.c: Cleanup MII_DEBUG and debug()Shinya Kuribayashi2008-02-14-22/+9
| | | | | | | | | | | | Current MII_DEBUG is confusing in two ways. One is useless define-then- undef at the top of the file. The other is there is only one debug() in this file, and that doesn't seem worthwhile to bother having MII_DEBUG. While there are many useful printf()/puts() debug codes, but they are for DEBUG, not for MII_DEBUG. This patch tries to put them all together into MII_DEBUG and debug(). Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
* NET: Add Ethernet 1000BASE-X support for PPC4xxLarry Johnson2007-11-06-58/+93
| | | | | | | | | | This patch adds support for 1000BASE-X to functions "miiphy_speed ()" and "miiphy_duplex()". It also adds function "miiphy_is_1000base_x ()", which returns non-zero iff the PHY registers are configured for 1000BASE-X. The "mii info" command is modified to distinguish between 1000BASE-T and -X. Signed-off-by: Larry Johnson <lrj@acm.org> Signed-off-by: Ben Warren <bwarren@qstreams.com>
* NET: Cosmetic changesLarry Johnson2007-11-06-73/+68
| | | | | Signed-off-by: Larry Johnson <lrj@acm.org> Signed-off-by: Ben Warren <bwarren@qstreams.com>
* common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDSJon Loeliger2007-07-08-2/+2
| | | | Signed-off-by: Jon Loeliger <jdl@freescale.com>
* common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).Jon Loeliger2007-07-04-1/+1
| | | | | | | | | | | | | | This is a compatibility step that allows both the older form and the new form to co-exist for a while until the older can be removed entirely. All transformations are of the form: Before: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) After: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT) Signed-off-by: Jon Loeliger <jdl@freescale.com>
* Fix miiphy global data initialization (problem on 4xx boards when noMarian Balakowicz2005-11-30-7/+10
| | | | | | | ethaddr is assigned). Initialization moved from miiphy_register() to eth_initialize(). Based on initial patch for 4xx platform by Matthias Fuchs.
* Add support for multiple PHYs.Marian Balakowicz2005-10-28-18/+228
|
* Preserve PHY_BMCR during a soft reset.Wolfgang Denk2005-08-12-1/+7
| | | | Patch by Carl Riechers, 24 Jun 2005
* * Patch by Dave Peverley, 30 Apr 2004:wdenk2004-06-06-5/+37
| | | | | | | | | | | | | | Add support for OMAP730 Perseus2 Development board * Patch by Alan J. Luse, 29 Apr 2004: Fix flash chip-select (OR0) option register setting on FADS boards. * Patch by Alan J. Luse, 29 Apr 2004: Report MII network speed and duplex setting properly when auto-negotiate is not enabled. * Patch by Jarrett Redd, 29 Apr 2004: Fix hang on reset on Ocotea board due to flash in wrong mode.
* Patches by Pantelis Antoniou, 30 Mar 2004:wdenk2004-04-15-0/+2
| | | | add networking support for VLANs (802.1q), and CDP (Cisco Discovery Protocol)
* * Patch by Stephen Williams, 19 March 2004wdenk2004-03-23-1/+4
| | | | | | | | | | | | | | | Increase speed of sector reads from SystemACE, shorten poll timeout and remove a useless reset * Patch by Tolunay Orkun, 19 Mar 2004: Make GigE PHY 1000Mbps Speed/Duplex detection conditional (CONFIG_PHY_GIGE) * Patch by Brad Kemp, 18 Mar 2004: prevent machine checks during a PCI scan * Patch by Pierre Aubert, 18 Mar 2004: Fix string cleaning in IDE identification
* * Patches by Thomas Viehweger, 16 Mar 2004:wdenk2004-03-23-8/+8
| | | | | | | | | - show PCI clock frequency on MPC8260 systems - add FCC_PSMR_RMII flag for HiP7 processors - in do_jffs2_fsload(), take load address from load_addr if not set explicit, update load_addr otherwise - replaced printf by putc/puts when no formatting is needed (smaller code size, faster execution)
* * Patches by Travis Sawyer, 12 Mar 2004:wdenk2004-03-14-1/+24
| | | | | | | | | | | | | | | | | | | | | - Fix Gigabit Ethernet support for 440GX - Add Gigabit Ethernet Support to MII PHY utilities * Patch by Brad Kemp, 12 Mar 2004: Fixes for drivers/cfi_flash.c: - Better support for x8/x16 implementations - Added failure for AMD chips attempting to use CFG_FLASH_USE_BUFFER_WRITE - Added defines for AMD command and address constants * Patch by Leon Kukovec, 12 Mar 2004: Fix get_dentfromdir() to correctly handle deleted dentries * Patch by George G. Davis, 11 Mar 2004: Remove hard coded network settings in TI OMAP1610 H2 default board config * Patch by George G. Davis, 11 Mar 2004: add support for ADS GraphicsClient+ board.
* * Patch by Yuli Barcohen, 26 Jan 2004:wdenk2004-02-08-1/+3
| | | | | | | | | | | | | | | | | | | Allow bzip2 compression for small memory footprint boards * Patch by Brad Kemp, 21 Jan 2004: Add support for CFI flash driver for both the Intel and the AMD command sets. * Patch by Travis Sawyer, 20 Jan 2004: Fix pci bridge auto enumeration of sibling p2p bridges. * Patch by Tolunay Orkun, 12 Jan 2004: Add some delays as needed for Intel LXT971A PHY support * Patches by Stephan Linz, 09 Jan 2004: - avoid warning: unused variable `piop' in board/altera/common/sevenseg.c - make DK1C20 board configuration related to ASMI conform to documentation
* * Patches by Stephan Linz, 3 Nov 2003:wdenk2003-12-06-8/+5
| | | | | | | | | | | | - more endianess fixes for LAN91C111 driver - CFG_HZ configuration patch for NIOS Cyclone board * Patch by Stephan Linz, 28 Oct 2003: fix PHY_INT_REG vs. PHY_MASK_REG bug in drivers/smc91111.c * Patch by Steven Scholz, 20 Oct 2003: - make "mii info <addr>" show infor for PHY at "addr" only - Endian fix for miiphy_info()
* * Patch by Sangmoon Kim, 23 Sep 2003:wdenk2003-10-08-0/+23
| | | | | | | | | | | | | | | | | | | | fix pll_pci_to_mem_multiplier table for MPC8245 * Patch by Anders Larsen, 22 Sep 2003: enable timed autoboot on PXA * Patch by David Müller, 22 Sep 2003: - add $(CFLAGS) to "-print-libgcc-filename" so compiler driver returns correct libgcc file path - "latency" reduction of busy-loop waiting to improve "U-Boot" boot time on s3c24x0 systems * Patch by Jon Diekema, 19 Sep 2003: - Add CFG_FAULT_ECHO_LINK_DOWN option to echo the inverted Ethernet link state to the fault LED. - In NetLoop, make the Fault LED reflect the link status. The link status gets updated on entry, and on timeouts.
* Initial revisionwdenk2002-11-03-0/+172