From ranma+ath9k_htc_fw at tdiedrich.de Sat May 20 14:03:17 2017 From: ranma+ath9k_htc_fw at tdiedrich.de (Tobias Diedrich) Date: Sat, 20 May 2017 23:03:17 +0200 Subject: Datel XBox 360 adapter Message-ID: <20170520210317.GA20162@yumi.tdiedrich.de> Hi, while looking for a AR7010-based wlan adapter I bought a used Datel XBox 360 adapter on ebay. Interestingly compared to the pictures on https://wikidevi.com/wiki/Datel_Wireless_%27N%27_Networking_Adapter_For_Xbox_360 mine doesn't have the raw//science XB102 chip (which seems to be connected to what I'd guess are the jtag pins?). I've got it to work with a minor hacky patch (the eeprom data is stored at the end of the SPI flash instead of the EEPROM which is populated, but empty (all 0s)): usb 1-3.4.3: New USB device found, idVendor=045e, idProduct=02a8 usb 1-3.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-3.4.3: Product: Wireless Network Adapter Boot usb 1-3.4.3: Manufacturer: Microsoft Corporation usb 1-3.4.3: SerialNumber: usb 1-3.4.3: ath9k_htc: Firmware ath9k_htc/htc_7010-1.4.0.fw requested usbcore: registered new interface driver ath9k_htc usb 1-3.4.3: ath9k_htc: Transferred FW: ath9k_htc/htc_7010-1.4.0.fw, size: 72812 ath9k_htc 1-3.4.3:1.0: ath9k_htc: HTC initialized with 45 credits ath9k_htc 1-3.4.3:1.0: ath9k_htc: FW Version: 1.4 ath9k_htc 1-3.4.3:1.0: FW RMW support: On ath: EEPROM regdomain: 0x0 ath: EEPROM indicates default country code should be used ath: doing EEPROM country->regdmn map search ath: country maps to regdmn code: 0x3a ath: Country alpha2 being used: US ath: Regpair used: 0x3a ieee80211 phy29: Atheros AR9280 Rev:2 ath9k_htc 1-3.4.3:1.0 wlx0: renamed from wlan0 The 512KiB SPI flash (Winbond W25X40) is memory-mapped at 0xf000000 in the Xtensa address space, with two identical copies of the wifi EEPROM data at the very end of the flash at offset 0x7e000 and 0x7f000. Any suggestions on how to hook this up more properly instead of this hack? Hacky patch to read the ath9k eeprom data from the memory-mapped PSI flash instead of the actual EEPROM: --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -57,6 +57,8 @@ static struct usb_device_id ath9k_hif_us .driver_info = AR9280_USB }, { USB_DEVICE(0x0930, 0x0a08), .driver_info = AR9280_USB }, /* Toshiba WLM-20U2 and GN-1080 */ + { USB_DEVICE(0x045e, 0x02a8), + .driver_info = AR9280_USB }, /* Datel Xbox 360 */ { USB_DEVICE(0x0cf3, 0x20ff), .driver_info = STORAGE_DEVICE }, --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -522,6 +522,22 @@ static bool ath_usb_eeprom_read(struct a { struct ath_hw *ah = (struct ath_hw *) common->ah; + u32 magic = REG_READ(ah, 0xf07f000); + if (magic == 0x00005aa5 || magic == 0x5aa50000) { + u32 offset = (off << 1) & ~3; + u32 word = be32_to_cpu(REG_READ(ah, 0xf07f000 + offset)); + u16 x; + if (off & 1) { + x = word; + } else { + x = word >> 16; + } + *data = x; + return true; + } else { + ath_info(common, "Magic=%08x\n", magic); + } + (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); if (!ath9k_hw_wait(ah, --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c @@ -84,6 +84,14 @@ void ath9k_hw_usb_gen_fill_eeprom(struct u32 addrdata[8]; u32 data[8]; +#if 1 + for (addr = 0; addr < size; addr++) { + if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) + return; + eep_data++; + } + +#else for (addr = 0; addr < size; addr++) { addrdata[i] = AR5416_EEPROM_OFFSET + ((addr + eep_start_loc) << AR5416_EEPROM_S); @@ -107,6 +115,7 @@ void ath9k_hw_usb_gen_fill_eeprom(struct eep_data++; } } +#endif } static bool ath9k_hw_nvram_read_array(u16 *blob, size_t blob_size, -- Tobias PGP: http://8ef7ddba.uguu.de From linux at rempel-privat.de Tue May 23 03:26:25 2017 From: linux at rempel-privat.de (Oleksij Rempel) Date: Tue, 23 May 2017 12:26:25 +0200 Subject: Datel XBox 360 adapter In-Reply-To: <20170520210317.GA20162@yumi.tdiedrich.de> References: <20170520210317.GA20162@yumi.tdiedrich.de> Message-ID: Hi, Am 20.05.2017 um 23:03 schrieb Tobias Diedrich: > Hi, > > while looking for a AR7010-based wlan adapter I bought a used Datel > XBox 360 adapter on ebay. > > Interestingly compared to the pictures on > https://wikidevi.com/wiki/Datel_Wireless_%27N%27_Networking_Adapter_For_Xbox_360 > mine doesn't have the raw//science XB102 chip (which seems to be > connected to what I'd guess are the jtag pins?). this pins can be multiplexed with other funktionions. But i don't have ar7010 docs, so not really sure > I've got it to work with a minor hacky patch (the eeprom data is > stored at the end of the SPI flash instead of the EEPROM which is > populated, but empty (all 0s)): > > usb 1-3.4.3: New USB device found, idVendor=045e, idProduct=02a8 > usb 1-3.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 > usb 1-3.4.3: Product: Wireless Network Adapter Boot > usb 1-3.4.3: Manufacturer: Microsoft Corporation > usb 1-3.4.3: SerialNumber: > usb 1-3.4.3: ath9k_htc: Firmware ath9k_htc/htc_7010-1.4.0.fw requested > usbcore: registered new interface driver ath9k_htc > usb 1-3.4.3: ath9k_htc: Transferred FW: ath9k_htc/htc_7010-1.4.0.fw, size: 72812 > ath9k_htc 1-3.4.3:1.0: ath9k_htc: HTC initialized with 45 credits > ath9k_htc 1-3.4.3:1.0: ath9k_htc: FW Version: 1.4 > ath9k_htc 1-3.4.3:1.0: FW RMW support: On > ath: EEPROM regdomain: 0x0 > ath: EEPROM indicates default country code should be used > ath: doing EEPROM country->regdmn map search > ath: country maps to regdmn code: 0x3a > ath: Country alpha2 being used: US > ath: Regpair used: 0x3a > ieee80211 phy29: Atheros AR9280 Rev:2 > ath9k_htc 1-3.4.3:1.0 wlx0: renamed from wlan0 > > > The 512KiB SPI flash (Winbond W25X40) is memory-mapped at 0xf000000 in the > Xtensa address space, with two identical copies of the wifi EEPROM data at the > very end of the flash at offset 0x7e000 and 0x7f000. > > Any suggestions on how to hook this up more properly instead of this hack? First of all thank you for your work! :) I would assume, adding a quirk will be the way to go. > > Hacky patch to read the ath9k eeprom data from the memory-mapped PSI flash instead of the actual EEPROM: > > --- a/drivers/net/wireless/ath/ath9k/hif_usb.c > +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c > @@ -57,6 +57,8 @@ static struct usb_device_id ath9k_hif_us > .driver_info = AR9280_USB }, > { USB_DEVICE(0x0930, 0x0a08), > .driver_info = AR9280_USB }, /* Toshiba WLM-20U2 and GN-1080 */ > + { USB_DEVICE(0x045e, 0x02a8), > + .driver_info = AR9280_USB }, /* Datel Xbox 360 */ For example: .driver_info = AR9280_USB_SPI > { USB_DEVICE(0x0cf3, 0x20ff), > .driver_info = STORAGE_DEVICE }, > --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c > +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c > @@ -522,6 +522,22 @@ static bool ath_usb_eeprom_read(struct a > { > struct ath_hw *ah = (struct ath_hw *) common->ah; > > + u32 magic = REG_READ(ah, 0xf07f000); > + if (magic == 0x00005aa5 || magic == 0x5aa50000) { > + u32 offset = (off << 1) & ~3; > + u32 word = be32_to_cpu(REG_READ(ah, 0xf07f000 + offset)); > + u16 x; > + if (off & 1) { > + x = word; > + } else { > + x = word >> 16; > + } > + *data = x; > + return true; > + } else { > + ath_info(common, "Magic=%08x\n", magic); > + } > + > (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); > > if (!ath9k_hw_wait(ah, > --- a/drivers/net/wireless/ath/ath9k/eeprom.c > +++ b/drivers/net/wireless/ath/ath9k/eeprom.c > @@ -84,6 +84,14 @@ void ath9k_hw_usb_gen_fill_eeprom(struct > u32 addrdata[8]; > u32 data[8]; > > +#if 1 > + for (addr = 0; addr < size; addr++) { > + if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) > + return; > + eep_data++; > + } > + > +#else > for (addr = 0; addr < size; addr++) { > addrdata[i] = AR5416_EEPROM_OFFSET + > ((addr + eep_start_loc) << AR5416_EEPROM_S); > @@ -107,6 +115,7 @@ void ath9k_hw_usb_gen_fill_eeprom(struct > eep_data++; > } > } > +#endif > } > > static bool ath9k_hw_nvram_read_array(u16 *blob, size_t blob_size, > > > -- Regards, Oleksij -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: OpenPGP digital signature URL: