Introduce MII_ADDR_BASE option on ARM, which allows to override the default

per platform requirements.

Notes:
- Only used by mge(4) at the moment.

- This is very simplified approach and should be replaced by some long-term
  solution for managing the board/platform configuration (among others the
  MAC-PHY binding info).

Submitted by:	Michal Hajduk
Obtained from:	Semihalf
This commit is contained in:
Rafal Jaworowski 2009-08-25 09:47:12 +00:00
parent c0d853f6b9
commit 18159f6a49
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=196534
2 changed files with 8 additions and 4 deletions

View File

@ -24,6 +24,7 @@ KERNVIRTADDR opt_global.h
LOADERRAMADDR opt_global.h
PHYSADDR opt_global.h
PHYSMEM_SIZE opt_global.h
MII_ADDR_BASE opt_global.h
SKYEYE_WORKAROUNDS opt_global.h
SOC_MV_DISCOVERY opt_global.h
SOC_MV_KIRKWOOD opt_global.h

View File

@ -69,7 +69,9 @@ __FBSDID("$FreeBSD$");
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#define MV_PHY_ADDR_BASE 8
#ifndef MII_ADDR_BASE
#define MII_ADDR_BASE 8
#endif
#include <dev/mge/if_mgevar.h>
#include <arm/mv/mvreg.h>
@ -1264,14 +1266,15 @@ mge_miibus_readreg(device_t dev, int phy, int reg)
/*
* We assume static PHY address <=> device unit mapping:
* PHY Address = MV_PHY_ADDR_BASE + devce unit.
* PHY Address = MII_ADDR_BASE + devce unit.
* This is true for most Marvell boards.
*
* Code below grants proper PHY detection on each device
* unit.
*/
if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy)
if ((MII_ADDR_BASE + device_get_unit(dev)) != phy)
return (0);
MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff &
@ -1292,7 +1295,7 @@ mge_miibus_writereg(device_t dev, int phy, int reg, int value)
{
uint32_t retries;
if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy)
if ((MII_ADDR_BASE + device_get_unit(dev)) != phy)
return (0);
MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff &