Skip to contentSkip to conversation

dm9601: enable EP3 interrupt

PATCH In review Joseph CHANG 3 participants 3 messages Mar 10, 2016 – Mar 11, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dm9601: enable EP3 interrupt

Enable chip's EP3 interrupt to get the link-up notify soon immediately.

---
 drivers/net/usb/dm9601.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/usb/dm9601.c +6 -0
index 0b4bdd3..520de4f 100644
@@ -46,6 +46,9 @@
 #define DM_GPR_DATA	0x1f
 #define DM_CHIP_ID	0x2c
 #define DM_MODE_CTRL	0x91	/* only on dm9620 */
+#define	DM_USB_CTRL	0xf4
+
+#define	USB_CTRL_EP3ACK	0x20
 
 /* chip id values */
 #define ID_DM9601	0
@@ -414,6 +417,9 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
 			goto out;
 		}
 		dm_write_reg(dev, DM_MODE_CTRL, mode & 0x7f);
+
+		/* Always return 8-bytes data to host per interrupt-interval */
+		dm_write_reg(dev, DM_USB_CTRL, USB_CTRL_EP3ACK);
 	}
 
 	/* power up phy */
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Joseph" == Joseph CHANG <[email protected]> writes:

Enable chip's EP3 interrupt to get the link-up notify soon immediately.

Sorry, what do you mean about 'soon immediately'?

drivers/net/usb/dm9601.c static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) · line 422

Quoted 3 lines
drivers/net/usb/dm9601.c +3 -0
+
+		/* Always return 8-bytes data to host per interrupt-interval */
+		dm_write_reg(dev, DM_USB_CTRL, USB_CTRL_EP3ACK);

Why would we want to do that instead of the current setup that afaik only returns data when the link status changes?

Signature · 5 lines
Bye, Peter Korsgaard
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

After check more.
I think this is also to fix the bug to dm962x chip too.

If keep no patch below:

drivers/net/usb/dm9601.c static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) · line 422

Quoted 3 lines
drivers/net/usb/dm9601.c +3 -0
+
+		/* Always return 8-bytes data to host per interrupt-interval */
+		dm_write_reg(dev, DM_USB_CTRL, USB_CTRL_EP3ACK);

When attach dm962x to linux USB host,
The reg 'DM_USB_CTRL' get default value 0x00
This means the USB interrupt routine below,
.status = dm9601_status,
will be called by events (they are: RX data found, TX complete, link change) Unfortunately, the link change CAN not work to trigger this event call.

So I do

drivers/net/usb/dm9601.c static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) · line 422

Quoted 1 line
drivers/net/usb/dm9601.c +1 -0
+		dm_write_reg(dev, DM_USB_CTRL, USB_CTRL_EP3ACK);

That
.status = dm9601_status,
will be called by time interval.

* ".status = dm9601_status" is the way to tell the kernel new link
state,
I can find it is bt 'usbnet_link_change( xx)' in ".status =
dm9601_status".

Information:
--------------------------------------------------------------------------------
--------
In my [PATCH 2/3],

+#define DM_EP3I_VAL 0x07
+ /* Render eeprom if need, WORD12 render, need 0x0007 */
+ dm_eeprom_render(dev, 12, DM_EP3I_VAL, 0xffff); }

It can determine the above time interval.

If user define
+#define DM_EP3I_VAL 0x0f

The time interval will be around 1 second.
Note: Must reset the device once to get effect.
--------------------------------------------------------------------------------
--------

Best Regards,
Joseph CHANG
System Application Engineering Division
Davicom Semiconductor, Inc.
No. 6 Li-Hsin 6th Rd., Science-Based Park,
Hsin-Chu, Taiwan.
Tel: 886-3-5798797 Ex 8534
Fax: 886-3-5646929
Web: http://www.davicom.com.tw

-----Original Message-----
From: Peter Korsgaard [mailto:[email protected]] On Behalf Of Peter Korsgaard
Sent: Friday, March 11, 2016 5:55 AM
To: Joseph CHANG
Cc: Peter Korsgaard; [email protected]; [email protected]; [email protected]; Joseph Chang
Subject: Re: [PATCH 1/3] dm9601: enable EP3 interrupt

Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Joseph" == Joseph CHANG <[email protected]> writes:

Enable chip's EP3 interrupt to get the link-up notify soon immediately.

Sorry, what do you mean about 'soon immediately'?

drivers/net/usb/dm9601.c static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) · line 422

Quoted 3 lines
drivers/net/usb/dm9601.c +3 -0
+
+		/* Always return 8-bytes data to host per interrupt-interval */
+		dm_write_reg(dev, DM_USB_CTRL, USB_CTRL_EP3ACK);

Why would we want to do that instead of the current setup that afaik only returns data when the link status changes?

Signature · 6 lines
Bye, Peter Korsgaard

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.