[PATCH] mcs7830: clean up use of kernel constants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This use the MII register constants provided
by the kernel instead of hardcoding numerical
values in the driver.

Signed-off-by: Arnd Bergmann <[email protected]>
---

Index: linux-cg/drivers/usb/net/mcs7830.c
===================================================================
--- linux-cg.orig/drivers/usb/net/mcs7830.c	2006-08-25 21:17:24.000000000 +0200
+++ linux-cg/drivers/usb/net/mcs7830.c	2006-08-25 21:23:35.000000000 +0200
@@ -35,8 +35,10 @@
 #include "usbnet.h"
 
 /* requests */
-#define MCS7830_RD_BMREQ	(USB_DIR_IN  | USB_TYPE_VENDOR | USB_RECIP_DEVICE)
-#define MCS7830_WR_BMREQ	(USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE)
+#define MCS7830_RD_BMREQ	(USB_DIR_IN  | USB_TYPE_VENDOR | \
+				 USB_RECIP_DEVICE)
+#define MCS7830_WR_BMREQ	(USB_DIR_OUT | USB_TYPE_VENDOR | \
+				 USB_RECIP_DEVICE)
 #define MCS7830_RD_BREQ		0x0E
 #define MCS7830_WR_BREQ		0x0D
 
@@ -46,6 +48,10 @@
 #define MCS7830_VENDOR_ID	0x9710
 #define MCS7830_PRODUCT_ID	0x7830
 
+#define MCS7830_MII_ADVERTISE	(ADVERTISE_PAUSE_CAP | ADVERTISE_100FULL | \
+				 ADVERTISE_100HALF | ADVERTISE_10FULL | \
+				 ADVERTISE_10HALF | ADVERTISE_CSMA)
+
 /* HIF_REG_XX coressponding index value */
 enum {
 	HIF_REG_MULTICAST_HASH			= 0x00,
@@ -258,16 +264,18 @@
 {
 	int ret;
 	/* Enable all media types */
-	ret = mcs7830_write_phy(dev, MII_ADVERTISE, 0x05e1);
-	/* First Disable All */
+	ret = mcs7830_write_phy(dev, MII_ADVERTISE, MCS7830_MII_ADVERTISE);
+
+	/* First reset BMCR */
 	if (!ret)
 		ret = mcs7830_write_phy(dev, MII_BMCR, 0x0000);
 	/* Enable Auto Neg */
 	if (!ret)
-		ret = mcs7830_write_phy(dev, MII_BMCR, 0x1000);
+		ret = mcs7830_write_phy(dev, MII_BMCR, BMCR_ANENABLE);
 	/* Restart Auto Neg (Keep the Enable Auto Neg Bit Set) */
 	if (!ret)
-		ret = mcs7830_write_phy(dev, MII_BMCR, 0x1200);
+		ret = mcs7830_write_phy(dev, MII_BMCR,
+				BMCR_ANENABLE | BMCR_ANRESTART	);
 	return ret < 0 ? : 0;
 }
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux