All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: David Hollis <dhollis@davehollis.com>
Cc: dbrownell@users.sourceforge.net, linux-kernel@vger.kernel.org,
	linux-usb-devel@lists.sourceforge.net, support@moschip.com,
	Michael Helmling <supermihi@web.de>
Subject: [PATCH] mcs7830: clean up use of kernel constants
Date: Sun, 27 Aug 2006 22:41:04 +0200	[thread overview]
Message-ID: <200608272241.05026.arnd@arndb.de> (raw)
In-Reply-To: <200608202207.39709.arnd@arndb.de>

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

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---

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;
 }
 


  parent reply	other threads:[~2006-08-27 23:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-07 13:00 [PATCH] please review mcs7830 (DeLOCK USB etherner) driver Arnd Bergmann
2006-08-07 14:54 ` David Hollis
2006-08-07 16:11   ` Arnd Bergmann
2006-08-20 20:07     ` [PATCH] driver for mcs7830 (aka DeLOCK) USB ethernet adapter Arnd Bergmann
2006-08-20 20:13       ` [PATCH] usbnet: add a mutex around phy register access Arnd Bergmann
2006-08-21 14:34       ` [PATCH] driver for mcs7830 (aka DeLOCK) USB ethernet adapter David Hollis
2006-08-27 20:41       ` Arnd Bergmann [this message]
2006-08-27 20:41         ` [PATCH] mcs7830: fix reception of 1514 byte frames Arnd Bergmann
2006-09-02 10:33           ` [linux-usb-devel] " David Brownell
2006-09-02 18:29             ` Arnd Bergmann
2006-08-28 19:09         ` [PATCH] mcs7830: clean up use of kernel constants David Hollis
2006-09-02 10:38       ` [linux-usb-devel] [PATCH] driver for mcs7830 (aka DeLOCK) USB ethernet adapter David Brownell
2006-09-02 17:51         ` Arnd Bergmann
2006-09-04  6:40           ` David Brownell
2006-09-07 19:37             ` David Hollis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200608272241.05026.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=dbrownell@users.sourceforge.net \
    --cc=dhollis@davehollis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=supermihi@web.de \
    --cc=support@moschip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.