Index: Module/assoc.c =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/assoc.c,v retrieving revision 1.11 diff -u -r1.11 assoc.c --- Module/assoc.c 16 Jul 2008 18:14:31 -0000 1.11 +++ Module/assoc.c 30 Oct 2008 18:28:28 -0000 @@ -532,7 +532,14 @@ DBGPRINT(RT_DEBUG_TRACE, "ASSOC - Send DISASSOC request\n"); MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, &pAd->PortCfg.Bssid, &pAd->PortCfg.Bssid); +#ifdef __MIPSEB__ + { + char *p = (char *) &DisassocReq->Reason; + Reason = (p[1] << 8) | p[0]; + } +#else Reason = cpu_to_le16p(&DisassocReq->Reason); +#endif MakeOutgoingFrame(OutBuffer, &FrameLen, sizeof(MACHDR), &DisassocHdr, 2, &Reason, Index: Module/mlme.c =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/mlme.c,v retrieving revision 1.30 diff -u -r1.30 mlme.c --- Module/mlme.c 3 Aug 2008 18:27:26 -0000 1.30 +++ Module/mlme.c 30 Oct 2008 18:28:28 -0000 @@ -1281,12 +1281,17 @@ { DBGPRINT(RT_DEBUG_INFO,"- %s: DRS: ", __FUNCTION__); } + + // The following DBGPRINT_RAW() triggers a kernel panic + // on TiVo Series 2 SA MIPS. +#if 0 DBGPRINT_RAW(RT_DEBUG_INFO,"Qty[%d]=%d PER=%d%% %d-sec, Qty[%d]=%d, Pty=%d\n", RateIdToMbps[CurrRate], pAd->DrsCounters.TxQuality[CurrRate], TxErrorRatio, pAd->DrsCounters.CurrTxRateStableTime, RateIdToMbps[UpRate], pAd->DrsCounters.TxQuality[UpRate], pAd->DrsCounters.TxRateUpPenalty); +#endif // 2004-3-13 special case: Claim noisy environment // decide if there was a false "rate down" in the past 2 sec due to noisy Index: Module/rt_config.h =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/rt_config.h,v retrieving revision 1.38 diff -u -r1.38 rt_config.h --- Module/rt_config.h 12 Oct 2008 16:30:10 -0000 1.38 +++ Module/rt_config.h 30 Oct 2008 18:28:28 -0000 @@ -39,7 +39,7 @@ // Propagate predefined compiler variables asap - bb. #if defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \ - defined(_BIG_ENDIAN) || defined(__ARMEB__) + defined(_BIG_ENDIAN) || defined(__ARMEB__) || defined(__MIPSEB__) #define BIG_ENDIAN #endif /* __BIG_ENDIAN */ Index: Module/rtmp_type.h =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/rtmp_type.h,v retrieving revision 1.8 diff -u -r1.8 rtmp_type.h --- Module/rtmp_type.h 14 Jul 2008 16:38:27 -0000 1.8 +++ Module/rtmp_type.h 30 Oct 2008 18:28:28 -0000 @@ -42,6 +42,8 @@ #if defined(PPC) || defined(ARM) #define ALIGN_USB_RCV __attribute__ ((aligned(2))) +#elseif defined(mips) +#define ALIGN_USB_RCV __attribute__ ((aligned(4))) #else #define ALIGN_USB_RCV #endif Index: Module/rtusb_data.c =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/rtusb_data.c,v retrieving revision 1.31 diff -u -r1.31 rtusb_data.c --- Module/rtusb_data.c 22 Jul 2008 17:35:14 -0000 1.31 +++ Module/rtusb_data.c 30 Oct 2008 18:28:28 -0000 @@ -1710,7 +1710,14 @@ flipMACHeader((PMACHDR)pData); pManage = (PVOID) pData; +#ifdef __MIPSEB__ + // pRxD needs to be word-aligned on MIPS + pRxD = (PRXD_STRUC) kmalloc(sizeof(RXD_STRUC), GFP_KERNEL); + memcpy(pRxD, pData + pRxContext->pUrb->actual_length - sizeof(RXD_STRUC), sizeof(RXD_STRUC)); +#else pRxD = (PRXD_STRUC)(pData + pRxContext->pUrb->actual_length - sizeof(RXD_STRUC)); +#endif + flipRxDescriptor(pRxD); pHeader = (PHEADER_802_11)pData; DBGPRINT(RT_DEBUG_INFO, "- %s: type=%d subtype=%d\n", @@ -2600,6 +2607,10 @@ RTUSBEnqueueInternalCmd(pAdapter, RT_OID_USB_RESET_BULK_IN); return; } + +#ifdef __MIPSEB__ + kfree(pRxD); +#endif } else { DBGPRINT(RT_DEBUG_ERROR, "- RTUSBRxPacket error: frame < min\n"); Index: Module/rtusb_info.c =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/rtusb_info.c,v retrieving revision 1.55 diff -u -r1.55 rtusb_info.c --- Module/rtusb_info.c 12 Aug 2008 15:43:58 -0000 1.55 +++ Module/rtusb_info.c 30 Oct 2008 18:28:28 -0000 @@ -44,6 +44,10 @@ #include #endif +#ifndef IW_MODE_MONITOR +#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ +#endif + #ifndef IW_ESSID_MAX_SIZE /* Maximum size of the ESSID and NICKN strings */ #define IW_ESSID_MAX_SIZE 32 Index: Module/rtusb_main.c =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/rtusb_main.c,v retrieving revision 1.67 diff -u -r1.67 rtusb_main.c --- Module/rtusb_main.c 18 Aug 2008 01:00:12 -0000 1.67 +++ Module/rtusb_main.c 30 Oct 2008 18:28:29 -0000 @@ -227,6 +227,30 @@ disconnect:usb_rtusb_disconnect, id_table:rtusb_usb_id, }; + +/* + * Linux 2.4 lacks free_netdev(). Borrowed code from Linux 2.6 + * net/core/dev.c, but removed dev->padded. + */ +void free_netdev(struct net_device *dev) +{ +#ifdef CONFIG_SYSFS + /* Compatibility with error handling in drivers */ + if (dev->reg_state == NETREG_UNINITIALIZED) { + kfree((char *)dev); + return; + } + + BUG_ON(dev->reg_state != NETREG_UNREGISTERED); + dev->reg_state = NETREG_RELEASED; + + /* will free via device release */ + put_device(&dev->dev); +#else + kfree((char *)dev); +#endif +} + #else /**************************************************************************/ /**************************************************************************/ @@ -1553,12 +1577,23 @@ usb_get_dev(dev); for (i = 0; i < rtusb_usb_id_len; i++) { +#ifdef __MIPSEB__ + if (dev->descriptor.idVendor == rtusb_usb_id[i].idVendor && + dev->descriptor.idProduct == rtusb_usb_id[i].idProduct) +#else if (le16_to_cpu(dev->descriptor.idVendor) == rtusb_usb_id[i].idVendor && le16_to_cpu(dev->descriptor.idProduct) == rtusb_usb_id[i].idProduct) +#endif { +#ifdef __MIPSEB__ + KPRINT(KERN_INFO, "idVendor = 0x%x, idProduct = 0x%x \n", + dev->descriptor.idVendor, + dev->descriptor.idProduct); +#else KPRINT(KERN_INFO, "idVendor = 0x%x, idProduct = 0x%x \n", le16_to_cpu(dev->descriptor.idVendor), le16_to_cpu(dev->descriptor.idProduct)); +#endif break; } } Index: Module/sanity.c =================================================================== RCS file: /cvsroot/rt2400/source/rt2570/Module/sanity.c,v retrieving revision 1.7 diff -u -r1.7 sanity.c --- Module/sanity.c 14 Jul 2008 16:38:28 -0000 1.7 +++ Module/sanity.c 30 Oct 2008 18:28:29 -0000 @@ -200,14 +200,23 @@ COPY_MAC_ADDR(Addr2, &Fr->Hdr.Addr2); Ptr = Fr->Octet; +#ifdef __MIPSEB__ + *CapabilityInfo = (Fr->Octet[1] << 8) | Fr->Octet[0]; + *Status = (Fr->Octet[3] << 8) | Fr->Octet[2]; +#else *CapabilityInfo = le16_to_cpup((PUSHORT)(&Fr->Octet[0])); *Status = le16_to_cpup((PUSHORT)(&Fr->Octet[2])); +#endif // Mask out unnecessary capability information *CapabilityInfo &= SUPPORTED_CAPABILITY_INFO; if (*Status == MLME_SUCCESS) { +#ifdef __MIPSEB__ + *Aid = (Fr->Octet[5] << 8) | Fr->Octet[4]; +#else *Aid = le16_to_cpup((PUSHORT)(&Fr->Octet[4])); +#endif *Aid = (*Aid) & 0x3fff; // AID is low 14-bit // -- get supported rates from payload and advance the pointer @@ -277,7 +286,11 @@ MACFRAME *Fr = (MACFRAME *)Msg; COPY_MAC_ADDR(Addr2, &Fr->Hdr.Addr2); +#ifdef __MIPSEB__ + *Reason = (Fr->Octet[1] << 8) | Fr->Octet[0]; +#else *Reason = le16_to_cpup((PUSHORT)(&Fr->Octet[0])); +#endif return TRUE; } @@ -332,9 +345,15 @@ MACFRAME *Fr = (MACFRAME *)Msg; COPY_MAC_ADDR(Addr, &Fr->Hdr.Addr2); +#ifdef __MIPSEB__ + *Alg = (Fr->Octet[1] << 8) | Fr->Octet[0]; + *Seq = (Fr->Octet[3] << 8) | Fr->Octet[2]; + *Status = (Fr->Octet[5] << 8) | Fr->Octet[4]; +#else *Alg = le16_to_cpup((PUSHORT)(&Fr->Octet[0])); *Seq = le16_to_cpup((PUSHORT)(&Fr->Octet[2])); *Status = le16_to_cpup((PUSHORT)(&Fr->Octet[4])); +#endif if (*Alg == Ndis802_11AuthModeOpen) { @@ -500,11 +519,19 @@ Ptr += TIMESTAMP_LEN; // get beacon interval from payload and advance the pointer - *BeaconPeriod = le16_to_cpup((PUSHORT)(Ptr)); +#ifdef __MIPSEB__ + *BeaconPeriod = (Ptr[1] << 8) | Ptr[0]; +#else + *BeaconPeriod = le16_to_cpup((PUSHORT)(Ptr)); +#endif Ptr += 2; // get capability info from payload and advance the pointer - *CapabilityInfo = le16_to_cpup((PUSHORT)(Ptr)); +#ifdef __MIPSEB__ + *CapabilityInfo = (Ptr[1] << 8) | Ptr[0]; +#else + *CapabilityInfo = le16_to_cpup((PUSHORT)(Ptr)); +#endif Ptr += 2; if (CAP_IS_ESS_ON(*CapabilityInfo)) {