Commit 18a8e864 authored by Li Yang's avatar Li Yang Committed by Jeff Garzik

[PATCH] ucc_geth: changes to ucc_geth driver as a result of qe_lib changes and bugfixes

changes due to qe_lib changes include:

o removed inclusion of platform header file
o removed platform_device code, replaced with of_device
o removed typedefs
o uint -> u32 conversions
o removed following defines:
  QE_SIZEOF_BD, BD_BUFFER_ARG, BD_BUFFER_CLEAR, BD_BUFFER,
  BD_STATUS_AND_LENGTH_SET, BD_STATUS_AND_LENGTH, and BD_BUFFER_SET
  because they hid sizeof/in_be32/out_be32 operations from the reader.
o removed irrelevant comments, added others to resemble removed BD_ defines
o const'd and uncasted all get_property() assignments

bugfixes, courtesy of Scott Wood, include:

- Read phy_address as a u32, not u8.
- Match on type == "network" as well as compatible == "ucc_geth", as
  device_is_compatible() will only compare up to the length of the
  test string, allowing "ucc_geth_phy" to match as well.
- fixes the MAC setting code in ucc_geth.c.  The old code was overwriting and dereferencing random stack contents.
Signed-off-by: default avatarLi Yang <leoli@freescale.com>
Signed-off-by: default avatarKim Phillips <kim.phillips@freescale.com>
Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 470ea7eb
...@@ -2288,7 +2288,7 @@ config UGETH_TX_ON_DEMOND ...@@ -2288,7 +2288,7 @@ config UGETH_TX_ON_DEMOND
config UGETH_HAS_GIGA config UGETH_HAS_GIGA
bool bool
depends on UCC_GETH && MPC836x depends on UCC_GETH && PPC_MPC836x
config MV643XX_ETH config MV643XX_ETH
tristate "MV-643XX Ethernet support" tristate "MV-643XX Ethernet support"
......
This diff is collapsed.
This diff is collapsed.
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "ucc_geth.h" #include "ucc_geth.h"
#include "ucc_geth_phy.h" #include "ucc_geth_phy.h"
#include <platforms/83xx/mpc8360e_pb.h>
#define ugphy_printk(level, format, arg...) \ #define ugphy_printk(level, format, arg...) \
printk(level format "\n", ## arg) printk(level format "\n", ## arg)
...@@ -72,16 +71,14 @@ static int genmii_read_status(struct ugeth_mii_info *mii_info); ...@@ -72,16 +71,14 @@ static int genmii_read_status(struct ugeth_mii_info *mii_info);
u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum); u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum);
void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val); void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val);
static u8 *bcsr_regs = NULL;
/* Write value to the PHY for this device to the register at regnum, */ /* Write value to the PHY for this device to the register at regnum, */
/* waiting until the write is done before it returns. All PHY */ /* waiting until the write is done before it returns. All PHY */
/* configuration has to be done through the TSEC1 MIIM regs */ /* configuration has to be done through the TSEC1 MIIM regs */
void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value)
{ {
ucc_geth_private_t *ugeth = netdev_priv(dev); struct ucc_geth_private *ugeth = netdev_priv(dev);
ucc_mii_mng_t *mii_regs; struct ucc_mii_mng *mii_regs;
enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; enum enet_tbi_mii_reg mii_reg = (enum enet_tbi_mii_reg) regnum;
u32 tmp_reg; u32 tmp_reg;
ugphy_vdbg("%s: IN", __FUNCTION__); ugphy_vdbg("%s: IN", __FUNCTION__);
...@@ -116,9 +113,9 @@ void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) ...@@ -116,9 +113,9 @@ void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value)
/* configuration has to be done through the TSEC1 MIIM regs */ /* configuration has to be done through the TSEC1 MIIM regs */
int read_phy_reg(struct net_device *dev, int mii_id, int regnum) int read_phy_reg(struct net_device *dev, int mii_id, int regnum)
{ {
ucc_geth_private_t *ugeth = netdev_priv(dev); struct ucc_geth_private *ugeth = netdev_priv(dev);
ucc_mii_mng_t *mii_regs; struct ucc_mii_mng *mii_regs;
enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; enum enet_tbi_mii_reg mii_reg = (enum enet_tbi_mii_reg) regnum;
u32 tmp_reg; u32 tmp_reg;
u16 value; u16 value;
...@@ -634,11 +631,6 @@ static void dm9161_close(struct ugeth_mii_info *mii_info) ...@@ -634,11 +631,6 @@ static void dm9161_close(struct ugeth_mii_info *mii_info)
static int dm9161_ack_interrupt(struct ugeth_mii_info *mii_info) static int dm9161_ack_interrupt(struct ugeth_mii_info *mii_info)
{ {
/* FIXME: This lines are for BUG fixing in the mpc8325.
Remove this from here when it's fixed */
if (bcsr_regs == NULL)
bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE);
bcsr_regs[14] |= 0x40;
ugphy_vdbg("%s: IN", __FUNCTION__); ugphy_vdbg("%s: IN", __FUNCTION__);
/* Clear the interrupts by reading the reg */ /* Clear the interrupts by reading the reg */
...@@ -650,12 +642,6 @@ Remove this from here when it's fixed */ ...@@ -650,12 +642,6 @@ Remove this from here when it's fixed */
static int dm9161_config_intr(struct ugeth_mii_info *mii_info) static int dm9161_config_intr(struct ugeth_mii_info *mii_info)
{ {
/* FIXME: This lines are for BUG fixing in the mpc8325.
Remove this from here when it's fixed */
if (bcsr_regs == NULL) {
bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE);
bcsr_regs[14] &= ~0x40;
}
ugphy_vdbg("%s: IN", __FUNCTION__); ugphy_vdbg("%s: IN", __FUNCTION__);
if (mii_info->interrupts == MII_INTERRUPT_ENABLED) if (mii_info->interrupts == MII_INTERRUPT_ENABLED)
......
...@@ -126,7 +126,7 @@ struct ugeth_mii_info { ...@@ -126,7 +126,7 @@ struct ugeth_mii_info {
/* And management functions */ /* And management functions */
struct phy_info *phyinfo; struct phy_info *phyinfo;
ucc_mii_mng_t *mii_regs; struct ucc_mii_mng *mii_regs;
/* forced speed & duplex (no autoneg) /* forced speed & duplex (no autoneg)
* partner speed & duplex & pause (autoneg) * partner speed & duplex & pause (autoneg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment