On 2023/11/15 23:53, [email protected] wrote:
> Could you please try this patch?

Sorry, previous patch was wrong.
I was confused.

As a result, this patch changes nothing.
Perhaps 179A should work in compat mode by default.

--- src/sys/dev/usb/if_axen.c.orig      2022-08-20 23:30:49.194557768 +0000
+++ src/sys/dev/usb/if_axen.c   2023-11-18 06:18:40.100517746 +0000
@@ -52,6 +52,7 @@ struct axen_type {
        uint16_t                axen_flags;
 #define AX178A 0x0001          /* AX88178a */
 #define AX179  0x0002          /* AX88179 */
+#define AX179A 0x0004          /* AX88179A */
 };
 
 /*
@@ -605,6 +606,8 @@ axen_attach(device_t parent, device_t se
        }
 
        axen_flags = axen_lookup(uaa->uaa_vendor, uaa->uaa_product)->axen_flags;
+       if (UGETW(usbd_get_device_descriptor(dev)->bcdDevice) == 0x0200)
+               axen_flags = AX179A;
 
        err = usbd_device2interface_handle(dev, AXEN_IFACE_IDX, &un->un_iface);
        if (err) {
@@ -663,11 +666,23 @@ axen_attach(device_t parent, device_t se
 
        axen_ax88179_init(un);
 
+#define   AXEN_FW_MODE                         0x08
+#define     AXEN_FW_MODE_178A179               0x0000
+#define     AXEN_FW_MODE_179A                  0x0001
+       if (axen_flags & AX179A) {
+               uint8_t bval = 0;
+               /*          len         dir       cmd */
+               int cmd = (1 << 12) | (1 << 8) | (AXEN_FW_MODE & 0x00FF);
+               axen_cmd(un, cmd, 1, AXEN_FW_MODE_178A179, &bval);
+       }
+
        /* An ASIX chip was detected. Inform the world.  */
        if (axen_flags & AX178A)
                aprint_normal_dev(self, "AX88178a\n");
        else if (axen_flags & AX179)
                aprint_normal_dev(self, "AX88179\n");
+       else if (axen_flags & AX179A)
+               aprint_normal_dev(self, "AX88179A\n");
        else
                aprint_normal_dev(self, "(unknown)\n");
 

Reply via email to