diff options
author | Li Yang <leoli@freescale.com> | 2006-10-19 22:07:34 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-10-21 14:09:51 -0400 |
commit | 18a8e8649d2687283da51fbcf8218372dc5a8f6f (patch) | |
tree | 1961bce657aec08964c8b6ab5b270b8f962a8988 /drivers/net/ucc_geth_phy.c | |
parent | 470ea7eba4aaa517533f9b02ac9a104e77264548 (diff) |
[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: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ucc_geth_phy.c')
-rw-r--r-- | drivers/net/ucc_geth_phy.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c index 67260eb3188a..5360ec05eaa3 100644 --- a/drivers/net/ucc_geth_phy.c +++ b/drivers/net/ucc_geth_phy.c | |||
@@ -42,7 +42,6 @@ | |||
42 | 42 | ||
43 | #include "ucc_geth.h" | 43 | #include "ucc_geth.h" |
44 | #include "ucc_geth_phy.h" | 44 | #include "ucc_geth_phy.h" |
45 | #include <platforms/83xx/mpc8360e_pb.h> | ||
46 | 45 | ||
47 | #define ugphy_printk(level, format, arg...) \ | 46 | #define ugphy_printk(level, format, arg...) \ |
48 | printk(level format "\n", ## arg) | 47 | printk(level format "\n", ## arg) |
@@ -72,16 +71,14 @@ static int genmii_read_status(struct ugeth_mii_info *mii_info); | |||
72 | u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum); | 71 | u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum); |
73 | void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val); | 72 | void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val); |
74 | 73 | ||
75 | static u8 *bcsr_regs = NULL; | ||
76 | |||
77 | /* Write value to the PHY for this device to the register at regnum, */ | 74 | /* Write value to the PHY for this device to the register at regnum, */ |
78 | /* waiting until the write is done before it returns. All PHY */ | 75 | /* waiting until the write is done before it returns. All PHY */ |
79 | /* configuration has to be done through the TSEC1 MIIM regs */ | 76 | /* configuration has to be done through the TSEC1 MIIM regs */ |
80 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) | 77 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) |
81 | { | 78 | { |
82 | ucc_geth_private_t *ugeth = netdev_priv(dev); | 79 | struct ucc_geth_private *ugeth = netdev_priv(dev); |
83 | ucc_mii_mng_t *mii_regs; | 80 | struct ucc_mii_mng *mii_regs; |
84 | enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; | 81 | enum enet_tbi_mii_reg mii_reg = (enum enet_tbi_mii_reg) regnum; |
85 | u32 tmp_reg; | 82 | u32 tmp_reg; |
86 | 83 | ||
87 | ugphy_vdbg("%s: IN", __FUNCTION__); | 84 | 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 | /* configuration has to be done through the TSEC1 MIIM regs */ | 113 | /* configuration has to be done through the TSEC1 MIIM regs */ |
117 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum) | 114 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum) |
118 | { | 115 | { |
119 | ucc_geth_private_t *ugeth = netdev_priv(dev); | 116 | struct ucc_geth_private *ugeth = netdev_priv(dev); |
120 | ucc_mii_mng_t *mii_regs; | 117 | struct ucc_mii_mng *mii_regs; |
121 | enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; | 118 | enum enet_tbi_mii_reg mii_reg = (enum enet_tbi_mii_reg) regnum; |
122 | u32 tmp_reg; | 119 | u32 tmp_reg; |
123 | u16 value; | 120 | u16 value; |
124 | 121 | ||
@@ -634,11 +631,6 @@ static void dm9161_close(struct ugeth_mii_info *mii_info) | |||
634 | 631 | ||
635 | static int dm9161_ack_interrupt(struct ugeth_mii_info *mii_info) | 632 | static int dm9161_ack_interrupt(struct ugeth_mii_info *mii_info) |
636 | { | 633 | { |
637 | /* FIXME: This lines are for BUG fixing in the mpc8325. | ||
638 | Remove this from here when it's fixed */ | ||
639 | if (bcsr_regs == NULL) | ||
640 | bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE); | ||
641 | bcsr_regs[14] |= 0x40; | ||
642 | ugphy_vdbg("%s: IN", __FUNCTION__); | 634 | ugphy_vdbg("%s: IN", __FUNCTION__); |
643 | 635 | ||
644 | /* Clear the interrupts by reading the reg */ | 636 | /* Clear the interrupts by reading the reg */ |
@@ -650,12 +642,6 @@ Remove this from here when it's fixed */ | |||
650 | 642 | ||
651 | static int dm9161_config_intr(struct ugeth_mii_info *mii_info) | 643 | static int dm9161_config_intr(struct ugeth_mii_info *mii_info) |
652 | { | 644 | { |
653 | /* FIXME: This lines are for BUG fixing in the mpc8325. | ||
654 | Remove this from here when it's fixed */ | ||
655 | if (bcsr_regs == NULL) { | ||
656 | bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE); | ||
657 | bcsr_regs[14] &= ~0x40; | ||
658 | } | ||
659 | ugphy_vdbg("%s: IN", __FUNCTION__); | 645 | ugphy_vdbg("%s: IN", __FUNCTION__); |
660 | 646 | ||
661 | if (mii_info->interrupts == MII_INTERRUPT_ENABLED) | 647 | if (mii_info->interrupts == MII_INTERRUPT_ENABLED) |