rt2x00: Parse chipset revision for RT chip validation
PATCH 10/11 rt2x00: Parse chipset revision for RT chip validation
Quoted 1 line
From
a8a6c0ece7a9a3c352c943b0ae686093fb09630aMon Sep 17 00:00:00 2001
From: Ivo van Doorn <[email protected]>
Date: Wed, 25 Jul 2007 19:43:16 +0200
Subject: [PATCH 10/11] rt2x00: Parse chipset revision for RT chip validation
Because of duplicate USB ID's it is possible the driver is attempting to work for a wrong device. Because RF chipset validation is insufficient we should parse the revision identification from the EEPROM.
example revisions:
rt2570: 0x0000c
rt73: 0x2573c
This helps us identify rt2570 from rt73, but it remains possible conflicts with other chipsets remain... :(
Signed-off-by Ivo van Doorn <[email protected]>
--- drivers/net/wireless/mac80211/rt2x00/rt2500pci.c | 4 ++-- drivers/net/wireless/mac80211/rt2x00/rt2500usb.c | 7 ++++++- drivers/net/wireless/mac80211/rt2x00/rt2x00.h | 7 ++++++- drivers/net/wireless/mac80211/rt2x00/rt73usb.c | 5 +++++ 4 files changed, 19 insertions(+), 4 deletions(-)
drivers/net/wireless/mac80211/rt2x00/rt2500pci.c +2 -2
@@ -682,7 +682,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)* up to version C the link tuning should halt after 20 * seconds. */ -if (rt2x00_rev (&rt2x00dev->chip) <RT2560_VERSION_D && +if (rt2x00_get_rev (&rt2x00dev->chip) <RT2560_VERSION_D && rt2x00dev->link.count >20 )return ;
@@ -692,7 +692,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)* Chipset versions C and lower should directly continue * to the dynamic CCA tuning. */ -if (rt2x00_rev (&rt2x00dev->chip) <RT2560_VERSION_D ) +if (rt2x00_get_rev (&rt2x00dev->chip) <RT2560_VERSION_D ) goto dynamic_cca_tune;/*
drivers/net/wireless/mac80211/rt2x00/rt2500usb.c +6 -1
@@ -756,7 +756,7 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev)rt2500usb_register_write (rt2x00dev,MAC_CSR1 ,0x0004 ); -if (rt2x00_rev (&rt2x00dev->chip) >=RT2570_VERSION_C ) { +if (rt2x00_get_rev (&rt2x00dev->chip) >=RT2570_VERSION_C ) {rt2500usb_register_read (rt2x00dev,PHY_CSR2 , ®); reg &= ~0x0002 ; }else {
@@ -1228,6 +1228,11 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)rt2500usb_register_read (rt2x00dev,MAC_CSR0 , ®);rt2x00_set_chip (rt2x00dev,RT2570 , value, reg); +if (rt2x00_rev (&rt2x00dev->chip,0xffff0 )) { +ERROR (rt2x00dev,"Invalid RT chipset detected.\n" ); +return -ENODEV ; + } + if (!rt2x00_rf(&rt2x00dev->chip, RF2522) && !rt2x00_rf(&rt2x00dev->chip, RF2523) && !rt2x00_rf(&rt2x00dev->chip, RF2524) &&
drivers/net/wireless/mac80211/rt2x00/rt2x00.h +6 -1
@@ -1034,11 +1034,16 @@ static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip)return (chipset->rf == chip); } -static inline u16 rt2x00_rev (const struct rt2x00_chip *chipset) +static inline u16 rt2x00_get_rev (const struct rt2x00_chip *chipset) {return chipset->rev; } +static inline u16 rt2x00_rev (const struct rt2x00_chip *chipset,const u32 mask) +{ +return chipset->rev & mask; +} +/* * Device specific rate value. * We will have to create the device specific rate value
drivers/net/wireless/mac80211/rt2x00/rt73usb.c +5 -0
@@ -1483,6 +1483,11 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)rt73usb_register_read (rt2x00dev,MAC_CSR0 , ®);rt2x00_set_chip (rt2x00dev,RT2571 , value, reg); +if (!rt2x00_rev (&rt2x00dev->chip,0x25730 )) { +ERROR (rt2x00dev,"Invalid RT chipset detected.\n" ); +return -ENODEV ; + } + if (!rt2x00_rf(&rt2x00dev->chip, RF5226) && !rt2x00_rf(&rt2x00dev->chip, RF2528) && !rt2x00_rf(&rt2x00dev->chip, RF5225) &&
Signature · 1 line
1.5.2.2