tech-net archive

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

[PATCH 1/2] Additions to zyd(4)



Hello.

I have a Siemens' IEEE 802.11b/g USB dongle that is not currently supported:

# usbdevs -v -a 3
Controller /dev/usb0:
Controller /dev/usb1:
Controller /dev/usb2:
Controller /dev/usb3:
Controller /dev/usb4:
addr 3: high speed, power 500 mA, config 1, USB2.0 WLAN(0x1667),
ZyDAS(0x129b),rev 48.10, serial USB2.0 WLAN

The following diff makes it work with zyd(4). This is tested only with
stable 5.0 branch (i386), but the diff should apply also to HEAD.

The changes are based on corresponding ones in OpenBSD, although my
understanding is that these were first implemented in FreeBSD.

This diff contains only functional changes; the follow-up will in addition
replace a repeated custom macro with __arraycount.

Regards,

Jukka.


Index: src/sys/dev/usb/if_zyd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_zyd.c,v
retrieving revision 1.14
diff -u -p -r1.14 if_zyd.c
--- src/sys/dev/usb/if_zyd.c    21 Sep 2008 09:38:27 -0000      1.14
+++ src/sys/dev/usb/if_zyd.c    18 Aug 2009 10:39:51 -0000
@@ -127,6 +127,7 @@ static const struct zyd_type {
        ZYD_ZD1211B_DEV(BELKIN,         F5D7050C),
        ZYD_ZD1211B_DEV(BELKIN,         ZD1211B),
        ZYD_ZD1211B_DEV(CISCOLINKSYS,   WUSBF54G),
+       ZYD_ZD1211B_DEV(CYBERTAN,       ZD1211B),
        ZYD_ZD1211B_DEV(FIBERLINE,      WL430U),
        ZYD_ZD1211B_DEV(MELCO,          KG54L),
        ZYD_ZD1211B_DEV(PHILIPS,        SNU5600),
@@ -995,6 +996,7 @@ zyd_al2230_init(struct zyd_rf *rf)
 #define N(a)   (sizeof (a) / sizeof ((a)[0]))
        struct zyd_softc *sc = rf->rf_sc;
        static const struct zyd_phy_pair phyini[] = ZYD_AL2230_PHY;
+       static const struct zyd_phy_pair phy2230s[] = ZYD_AL2230S_PHY_INIT;
        static const uint32_t rfini[] = ZYD_AL2230_RF;
        int i, error;
 
@@ -1004,7 +1006,14 @@ zyd_al2230_init(struct zyd_rf *rf)
                if (error != 0)
                        return error;
        }
-
+       if (sc->rf_rev == ZYD_RF_AL2230S) {
+               for (i = 0; i < N(phy2230s); i++) {
+                       error = zyd_write16(sc, phy2230s[i].reg,
+                           phy2230s[i].val);
+                       if (error != 0)
+                               return error;
+               }
+       }
        /* init AL2230 radio */
        for (i = 0; i < N(rfini); i++) {
                if ((error = zyd_rfwrite(sc, rfini[i])) != 0)
@@ -1472,6 +1481,7 @@ zyd_rf_attach(struct zyd_softc *sc, uint
                rf->width        = 24;  /* 24-bit RF values */
                break;
        case ZYD_RF_AL2230:
+       case ZYD_RF_AL2230S:
                if (sc->mac_rev == ZYD_ZD1211B)
                        rf->init = zyd_al2230_init_b;
                else
@@ -1524,7 +1534,7 @@ zyd_rf_name(uint8_t type)
        static const char * const zyd_rfs[] = {
                "unknown", "unknown", "UW2451",   "UCHIP",     "AL2230",
                "AL7230B", "THETA",   "AL2210",   "MAXIM_NEW", "GCT",
-               "PV2000",  "RALINK",  "INTERSIL", "RFMD",      "MAXIM_NEW2",
+               "AL2230S",  "RALINK",  "INTERSIL", "RFMD",      "MAXIM_NEW2",
                "PHILIPS"
        };
 
Index: src/sys/dev/usb/if_zydreg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_zydreg.h,v
retrieving revision 1.2
diff -u -p -r1.2 if_zydreg.h
--- src/sys/dev/usb/if_zydreg.h 16 Jun 2007 11:18:45 -0000      1.2
+++ src/sys/dev/usb/if_zydreg.h 18 Aug 2009 10:39:51 -0000
@@ -160,7 +160,7 @@
 #define ZYD_RF_AL2210          0x7
 #define ZYD_RF_MAXIM_NEW       0x8
 #define ZYD_RF_GCT             0x9
-#define ZYD_RF_PV2000          0xa     /* not supported yet */
+#define ZYD_RF_AL2230S          0xa
 #define ZYD_RF_RALINK          0xb     /* not supported yet */
 #define ZYD_RF_INTERSIL                0xc     /* not supported yet */
 #define ZYD_RF_RFMD            0xd
@@ -638,6 +638,14 @@
        { ZYD_CR252, 0x00 }, { ZYD_CR253, 0x00 }                        \
 }
 
+#define        ZYD_AL2230S_PHY_INIT                                            
\
+{                                                                      \
+       { ZYD_CR47,  0x1e }, { ZYD_CR106, 0x22 }, { ZYD_CR107, 0x2a },  \
+       { ZYD_CR109, 0x13 }, { ZYD_CR118, 0xf8 }, { ZYD_CR119, 0x12 },  \
+       { ZYD_CR122, 0xe0 }, { ZYD_CR128, 0x10 }, { ZYD_CR129, 0x0e },  \
+       { ZYD_CR130, 0x10 }                                             \
+}
+
 #define ZYD_AL2230_RF                                                  \
 {                                                                      \
        0x03f790, 0x033331, 0x00000d, 0x0b3331, 0x03b812, 0x00fff3,     \
Index: src/sys/dev/usb/usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.519.4.1
diff -u -p -r1.519.4.1 usbdevs
--- src/sys/dev/usb/usbdevs     22 Nov 2008 05:10:07 -0000      1.519.4.1
+++ src/sys/dev/usb/usbdevs     18 Aug 2009 10:39:51 -0000
@@ -895,6 +895,7 @@ product CTX EX1300          0x9999  Ex1300 hub
 
 /* CyberTAN Technology products */
 product CYBERTAN TG54USB       0x1666  TG54USB
+product CYBERTAN ZD1211B        0x1667  ZD1211B
 
 /* Cypress Semiconductor products */
 product CYPRESS MOUSE          0x0001  mouse


Home | Main Index | Thread Index | Old Index