[U-Boot] [PATCH] mii: miiphy register address width change

Chandan Nath chandan.nath at ti.com
Wed Sep 21 13:10:32 CEST 2011


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 at ti.com>
---
 common/miiphyutil.c |    8 ++++----
 include/miiphy.h    |   12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 35ad357..68a32fc 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -105,9 +105,9 @@ static int legacy_miiphy_write(struct mii_dev *bus, int addr, int devad,
  */
 void miiphy_register(const char *name,
 		      int (*read)(const char *devname, unsigned char addr,
-				   unsigned char reg, unsigned short *value),
+				   unsigned short reg, unsigned short *value),
 		      int (*write)(const char *devname, unsigned char addr,
-				    unsigned char reg, unsigned short value))
+				    unsigned short reg, unsigned short value))
 {
 	struct mii_dev *new_dev;
 	struct legacy_mii_dev *ldev;
@@ -284,7 +284,7 @@ static struct mii_dev *miiphy_get_active_dev(const char *devname)
  * Returns:
  *   0 on success
  */
-int miiphy_read(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_read(const char *devname, unsigned char addr, unsigned short reg,
 		 unsigned short *value)
 {
 	struct mii_dev *bus;
@@ -310,7 +310,7 @@ int miiphy_read(const char *devname, unsigned char addr, unsigned char reg,
  * Returns:
  *   0 on success
  */
-int miiphy_write(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_write(const char *devname, unsigned char addr, unsigned short reg,
 		  unsigned short value)
 {
 	struct mii_dev *bus;
diff --git a/include/miiphy.h b/include/miiphy.h
index 7e70cf8..7ce6d14 100644
--- a/include/miiphy.h
+++ b/include/miiphy.h
@@ -42,14 +42,14 @@
 
 struct legacy_mii_dev {
 	int (*read)(const char *devname, unsigned char addr,
-		     unsigned char reg, unsigned short *value);
+		     unsigned short reg, unsigned short *value);
 	int (*write)(const char *devname, unsigned char addr,
-		      unsigned char reg, unsigned short value);
+		      unsigned short reg, unsigned short value);
 };
 
-int miiphy_read(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_read(const char *devname, unsigned char addr, unsigned short reg,
 		 unsigned short *value);
-int miiphy_write(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_write(const char *devname, unsigned char addr, unsigned short reg,
 		  unsigned short value);
 int miiphy_info(const char *devname, unsigned char addr, unsigned int *oui,
 		 unsigned char *model, unsigned char *rev);
@@ -65,9 +65,9 @@ void miiphy_init(void);
 
 void miiphy_register(const char *devname,
 		      int (*read)(const char *devname, unsigned char addr,
-				   unsigned char reg, unsigned short *value),
+				   unsigned short reg, unsigned short *value),
 		      int (*write)(const char *devname, unsigned char addr,
-				    unsigned char reg, unsigned short value));
+				    unsigned short reg, unsigned short value));
 
 int miiphy_set_current_dev(const char *devname);
 const char *miiphy_get_current_dev(void);
-- 
1.7.1



More information about the U-Boot mailing list