On Sunday 12 February 2006 01:03, Francois Romieu wrote: > Ivo van Doorn <[EMAIL PROTECTED]> : > > Cleanup channel initialization and remove device specific > > value magic calculations. Just deliver a plain list of values. > > Read the EEPROM for default TXpower values for each channel. > > > > Signed-off-by Ivo van Doorn <[EMAIL PROTECTED]> > > > > diff -U 3 -H -w -E -d -r -N -- > > wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c > > wireless-2.6-rt2x00/drivers/net/wireless/rt2x00/rt2400pci.c > > --- wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c 2006-02-09 > > 20:35:21.000000000 +0100 > > +++ wireless-2.6-rt2x00/drivers/net/wireless/rt2x00/rt2400pci.c > > 2006-02-11 22:56:08.000000000 +0100 > [...] >> [...] > > - channels[13].chan = 14; > > - channels[13].freq = 2484; > > - channels[13].val = cpu_to_le32(0x00000d1a); > > - channels[13].flag = IEEE80211_CHAN_W_SCAN | > > - IEEE80211_CHAN_W_ACTIVE_SCAN | IEEE80211_CHAN_W_IBSS; > > - }else if(rt2x00_rf(&rt2x00pci->chip, RF2525E)){ > > - for(counter = 0; counter < 13; counter++){ > > - channels[counter].chan = counter + 1; > > - channels[counter].freq = 2407 > > - + ((counter + 1) * 5); > > - channels[counter].val = cpu_to_le32(0x00081136 > > - + (counter * 0x04)); > > - if(channels[counter].val & 0x00000040) > > - channels[counter].val += 0x00000040; > > - channels[counter].flag = > > - IEEE80211_CHAN_W_ACTIVE_SCAN > > - | IEEE80211_CHAN_W_SCAN > > - | IEEE80211_CHAN_W_IBSS; > > - } > > + channels[22].val = cpu_to_le32(0x00008802); > > + channels[23].val = cpu_to_le32(0x00008806); > > + channels[24].val = cpu_to_le32(0x0000880a); > > + channels[25].val = cpu_to_le32(0x0000880e); > > + channels[26].val = cpu_to_le32(0x00008812); > > + channels[27].val = cpu_to_le32(0x00008816); > > + channels[28].val = cpu_to_le32(0x0000881a); > > + channels[29].val = cpu_to_le32(0x0000881e); > > + channels[30].val = cpu_to_le32(0x00008822); > > + channels[31].val = cpu_to_le32(0x00008826); > > + channels[32].val = cpu_to_le32(0x0000882a); > > > > - channels[13].chan = 14; > > - channels[13].freq = 2484; > > - channels[13].val = cpu_to_le32(0x000811ae); > > - channels[13].flag = IEEE80211_CHAN_W_SCAN | > > - IEEE80211_CHAN_W_ACTIVE_SCAN | IEEE80211_CHAN_W_IBSS; > > - }else if(rt2x00_rf(&rt2x00pci->chip, RF5222)){ > > - for(counter = 0; counter < 13; counter++){ > > - channels[counter].chan = counter + 1; > > - channels[counter].freq = 2407 > > - + ((counter + 1) * 5); > > - channels[counter].val = cpu_to_le32(0x00001136 > > - + (counter * 0x04)); > > - if(channels[counter].val & 0x00000040) > > - channels[counter].val += 0x00000040; > > - channels[counter].flag = > > - IEEE80211_CHAN_W_ACTIVE_SCAN > > - | IEEE80211_CHAN_W_SCAN > > - | IEEE80211_CHAN_W_IBSS; > > + channels[33].val = cpu_to_le32(0x000090a6); > > + channels[34].val = cpu_to_le32(0x000090ae); > > + channels[35].val = cpu_to_le32(0x000090b6); > > + channels[36].val = cpu_to_le32(0x000090be); > > } > > What about something like: > > if (rt2x00_rf(&rt2x00pci->chip, RF2522)) { > u32 vals[] = { > 0x000c1fda, 0x000c1fee, 0x000c2002, 0x000c2016, > 0x000c202a, 0x000c203e, 0x000c2052, 0x000c2066, > 0x000c207a, 0x000c208e, 0x000c20a2, 0x000c20b6, > 0x000c20ca, 0x000c20fa > }; > > for (i = 0; i < ARRAY_SIZE(vals); i++) > channels[i].val = cpu_to_le32(vals[i]); > } else if (rt2x00_rf(&rt2x00pci->chip, RF2523) || > rt2x00_rf(&rt2x00pci->chip, RF2524) || > rt2x00_rf(&rt2x00pci->chip, RF2525)) { > u32 vals[] = { > 0x00000c9e, 0x00000ca2, 0x00000ca6, 0x00000caa, > 0x00000cae, 0x00000cb2, 0x00000cb6, 0x00000cba, > 0x00000cbe, 0x00000d02, 0x00000d06, 0x00000d0a, > 0x00000d0e, 0x00000d1a > }; > > for (i = 0; i < ARRAY_SIZE(vals); i++) > channels[i].val = cpu_to_le32(vals[i] | rf2_base); > } else if (rt2x00_rf(&rt2x00pci->chip, RF2525E) || > rt2x00_rf(&rt2x00pci->chip, RF5222)) { > u32 vals[] = { > 0x00001136, 0x0000113a, 0x0000113e, 0x00001182, > 0x00001186, 0x0000118a, 0x0000118e, 0x00001192, > 0x00001196, 0x0000119a, 0x0000119e, 0x000011a2, > 0x000011a6, 0x000011ae > }; > > for (i = 0; i < ARRAY_SIZE(vals); i++) > channels[i].val = cpu_to_le32(vals[i] | rf2_base); > } > > if (rt2x00_rf(&rt2x00pci->chip, RF5222)) { > u32 vals[] = { > 0x00018896, 0x0001889a, 0x0001889e, 0x000188a2, > 0x000188a6, 0x000188aa, 0x000188ae, 0x000188b2, > 0x00008802, 0x00008806, 0x0000880a, 0x0000880e, > 0x00008812, 0x00008816, 0x0000881a, 0x0000881e, > 0x00008822, 0x00008826, 0x0000882a, 0x000090a6, > 0x000090ae, 0x000090b6, 0x000090be > }; > struct ieee80211_channel *chan = channels + 14; > > for (i = 0; i < ARRAY_SIZE(vals); i++) > (chan++)->val = cpu_to_le32(vals[i] | rf2_base); > } > [...] > > + > > + /* > > + * Set device specific, but channel independent RF values. > > + */ > > + if(rt2x00_rf(&rt2x00pci->chip, RF2522)){ > > + rt2x00pci->rf1 = cpu_to_le32(0x00002050); > > + rt2x00pci->rf3 = cpu_to_le32(0x00000101); > > + rt2x00pci->rf4 = 0; > > + }else if(rt2x00_rf(&rt2x00pci->chip, RF2523)){ > > + rt2x00pci->rf1 = cpu_to_le32(0x00022010); > > + rt2x00pci->rf3 = cpu_to_le32(0x000e0111); > > + rt2x00pci->rf4 = cpu_to_le32(0x00000a1b); > > + }else if(rt2x00_rf(&rt2x00pci->chip, RF2524)){ > > + rt2x00pci->rf1 = cpu_to_le32(0x00032020); > > + rt2x00pci->rf3 = cpu_to_le32(0x00000101); > > + rt2x00pci->rf4 = cpu_to_le32(0x00000a1b); > > + }else if(rt2x00_rf(&rt2x00pci->chip, RF2525)){ > > + rt2x00pci->rf1 = cpu_to_le32(0x00022020); > > + rt2x00pci->rf3 = cpu_to_le32(0x00060111); > > + rt2x00pci->rf4 = cpu_to_le32(0x00000a1b); > > + }else if(rt2x00_rf(&rt2x00pci->chip, RF2525E)){ > > + rt2x00pci->rf1 = cpu_to_le32(0x00022020); > > + rt2x00pci->rf3 = cpu_to_le32(0x00060111); > > + rt2x00pci->rf4 = cpu_to_le32(0x00000a0b); > > + }else if(rt2x00_rf(&rt2x00pci->chip, RF5222)){ > > + rt2x00pci->rf1 = 0; > > + rt2x00pci->rf3 = cpu_to_le32(0x00000101); > > + rt2x00pci->rf4 = 0; > > struct { > unsigned int chip; > u32 val[3]; > } rf[] = { > { RF2522, { 0x00002050, 0x00000101, 0x00000000 } }, > { RF2523, { 0x00022010, 0x000e0111, 0x00000a1b } }, > { RF2524, { 0x00032020, 0x00000101, 0x00000a1b } }, > { RF2525, { 0x00022020, 0x00060111, 0x00000a1b } }, > { RF2525E, { 0x00022020, 0x00060111, 0x00000a0b } }, > { RF5222, { 0x00000000, 0x00000101, 0x00000000 } } > }; > > for (i = 0; i < ARRAY_SIZE(rf); i++) { > if (rt2x00_rf(&rt2x00pci->chip, rf[i].chip)) { > rt2x00pci->rf1 = cpu_to_le32(rf[i].val[0]); > rt2x00pci->rf3 = cpu_to_le32(rf[i].val[1]); > rt2x00pci->rf4 = cpu_to_le32(rf[i].val[2]); > } > } >
Both suggestions Sounds good to me. I will resend this patch with proposed changes. IvD
pgpyhV7GXVdiJ.pgp
Description: PGP signature