Re: ral(4) diff that needs testing

2013-08-01 Thread Mark Kettenis
 Date: Thu, 1 Aug 2013 02:03:14 +
 From: Martin Brandenburg mar...@martinbrandenburg.com
 
 On Tue, Jul 30, 2013 at 12:16:13AM +0200, Mark Kettenis wrote:
  Would appreciate it if somebody could test this diff on a RT2790,
  RT2860 or RT3090 variant.  Shouldn't change anything for those
  variants, but is necessary to support some newer hardware.
 
 I have tested on amd64 with
 
   ral0 at pci0 dev 13 function 0 Ralink RT2860 rev 0x00: apic 2 int 19, 
 address 00:25:9c:0d:59:24
   ral0: MAC/BBP RT2860 (rev 0x0103), RF RT2850 (MIMO 2T2R)
 
 Everything works fine. Was able to bring the interface up and pass
 packets. Didn't do any heavy load testing, as you said nothing should
 change, but was able to download a file at usual speeds.

Great.  Thanks!

Looking for OKs now.



ral(4) diff that needs testing

2013-07-29 Thread Mark Kettenis
Would appreciate it if somebody could test this diff on a RT2790,
RT2860 or RT3090 variant.  Shouldn't change anything for those
variants, but is necessary to support some newer hardware.

Thanks,

Mark


Index: rt2860.c
===
RCS file: /cvs/src/sys/dev/ic/rt2860.c,v
retrieving revision 1.68
diff -u -p -r1.68 rt2860.c
--- rt2860.c11 Jun 2013 18:15:53 -  1.68
+++ rt2860.c25 Jul 2013 09:30:13 -
@@ -197,6 +197,8 @@ static const struct {
uint8_t val;
 }  rt3090_def_rf[] = {
RT3070_DEF_RF
+}, rt3572_def_rf[] = {
+   RT3572_DEF_RF
 };
 
 int
@@ -2158,13 +2160,15 @@ rt2860_select_chan_group(struct rt2860_s
rt2860_mcu_bbp_write(sc, 75, 0x50);
}
} else {
-   if (sc-ext_5ghz_lna) {
+   if (sc-mac_ver == 0x3572)
+   rt2860_mcu_bbp_write(sc, 82, 0x94);
+   else
rt2860_mcu_bbp_write(sc, 82, 0xf2);
+
+   if (sc-ext_5ghz_lna)
rt2860_mcu_bbp_write(sc, 75, 0x46);
-   } else {
-   rt2860_mcu_bbp_write(sc, 82, 0xf2);
+   else
rt2860_mcu_bbp_write(sc, 75, 0x50);
-   }
}
 
tmp = RAL_READ(sc, RT2860_TX_BAND_CFG);
@@ -2191,7 +2195,12 @@ rt2860_select_chan_group(struct rt2860_s
if (sc-mac_ver == 0x3593  sc-ntxchains  2)
tmp |= RT3593_PA_PE_A2_EN;
}
-   RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp);
+   if (sc-mac_ver == 0x3572) {
+   rt3090_rf_write(sc, 8, 0x00);
+   RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp);
+   rt3090_rf_write(sc, 8, 0x80);
+   } else
+   RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp);
 
if (sc-mac_ver == 0x3593) {
tmp = RAL_READ(sc, RT2860_GPIO_CTRL);
@@ -2215,7 +2224,10 @@ rt2860_select_chan_group(struct rt2860_s
else
agc = 0x2e + sc-lna[0];
} else {/* 5GHz band */
-   agc = 0x32 + (sc-lna[group] * 5) / 3;
+   if (sc-mac_ver == 0x3572)
+   agc = 0x22 + (sc-lna[group] * 5) / 3;
+   else
+   agc = 0x32 + (sc-lna[group] * 5) / 3;
}
rt2860_mcu_bbp_write(sc, 66, agc);
 
@@ -2367,9 +2379,16 @@ rt3090_rf_init(struct rt2860_softc *sc)
RAL_WRITE(sc, RT3070_GPIO_SWITCH, tmp  ~0x20);
 
/* initialize RF registers to default value */
-   for (i = 0; i  nitems(rt3090_def_rf); i++) {
-   rt3090_rf_write(sc, rt3090_def_rf[i].reg,
-   rt3090_def_rf[i].val);
+   if (sc-mac_ver == 0x3572) {
+   for (i = 0; i  nitems(rt3572_def_rf); i++) {
+   rt3090_rf_write(sc, rt3572_def_rf[i].reg,
+   rt3572_def_rf[i].val);
+   }
+   } else {
+   for (i = 0; i  nitems(rt3090_def_rf); i++) {
+   rt3090_rf_write(sc, rt3090_def_rf[i].reg,
+   rt3090_def_rf[i].val);
+   }
}
 
/* select 20MHz bandwidth */



Re: ral(4) diff

2011-03-12 Thread Igor Zinovik
On Mar 10, Tim van der Molen wrote: 
 I have the following ral(4):
 
 ral0 at pci0 dev 13 function 0 Ralink RT2561S rev 0x00: irq 5, address 
 00:1d:7d:49:28:92
 ral0: MAC/BBP RT2561C, RF RT2527
 
 After a commit from August 2010 (see
 http://marc.info/?l=openbsd-cvsm=128095139804862) the ral stopped
 working: clients could not associate with it in hostap mode and it could
 not detect other APs with ifconfig scan.
 
 After a hint from damien@ I came up with the following diff which brings
 back some of the code that was removed by the commit mentioned above.
 
 damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
 please test it.

My ral(4) was running fine without this diff.  After i applied it
nothing changed, it is working normally.  Clients still can connect to my AP.

ral0 at pci2 dev 10 function 0 Ralink RT2561S rev 0x00: irq 11, address 
00:11:6b:35:03:d5
ral0: MAC/BBP RT2661B, RF RT2527




Re: ral(4) diff

2011-03-12 Thread Sviatoslav Chagaev
On Thu, 10 Mar 2011 22:07:09 +0100
Tim van der Molen tb...@xs4all.nl wrote:

 I have the following ral(4):
 
 ral0 at pci0 dev 13 function 0 Ralink RT2561S rev 0x00: irq 5, address 
 00:1d:7d:49:28:92
 ral0: MAC/BBP RT2561C, RF RT2527
 
 After a commit from August 2010 (see
 http://marc.info/?l=openbsd-cvsm=128095139804862) the ral stopped
 working: clients could not associate with it in hostap mode and it could
 not detect other APs with ifconfig scan.
 
 After a hint from damien@ I came up with the following diff which brings
 back some of the code that was removed by the commit mentioned above.
 
 damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
 please test it.
 
 Regards,
 Tim
 

Without the patch: after boot I type `ifconfig ral0 scan`, it outputs
the list of detected APs. All subsequent `ifconfig` commands have no
effect, including turning on 'monitor' and 'hostap'. Also, during or
shortly after the second `ifconfig ral0 scan`, a kernel message appears
saying ral0: device timeout.

With the patch: everything works as expected, including hostap mode.

OpenBSD 4.9-current (GENERIC) #1: Sun Mar 13 01:07:58 EET 2011
r...@scenic.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III (GenuineIntel 686-class) 862 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,SSE
real mem  = 266891264 (254MB)
avail mem = 252387328 (240MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/11/02, BIOS32 rev. 0 @ 0xfd880, SMBIOS 
rev. 2.31 @ 0xefda0 (77 entries)
bios0: vendor FUJITSU SIEMENS // Phoenix Technologies Ltd. version 4.06  Rev. 
1.10.1215 date 03/11/2002
bios0: FUJITSU SIEMENS SCENIC xS/SCOVERY xS
apm0 at bios0: Power Management spec V1.2
apm0: AC on, battery charge unknown
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xfd880/0x780
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf20/192 (10 entries)
pcibios0: PCI Interrupt Router at 000:31:0 (Intel 82371FB ISA rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc/0xc000! 0xcc000/0x1000! 0xcd000/0x4000!
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82815 Host rev 0x04
vga1 at pci0 dev 2 function 0 Intel 82815 Video rev 0x04
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0xf800, size 0x400
ppb0 at pci0 dev 30 function 0 Intel 82801BA Hub-to-PCI rev 0x05
pci1 at ppb0 bus 1
fxp0 at pci1 dev 8 function 0 Intel 82562 rev 0x03, i82562: irq 15, address 
00:30:05:17:e5:c6
inphy0 at fxp0 phy 1: i82562EM 10/100 PHY, rev. 0
sis0 at pci1 dev 9 function 0 SiS 900 10/100BaseTX rev 0x02: irq 11, address 
00:06:4f:0e:94:ed
ukphy0 at sis0 phy 0: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x000760, model 0x
ral0 at pci1 dev 11 function 0 Ralink RT2561S rev 0x00: irq 9, address 
00:0e:2e:4e:77:f1
ral0: MAC/BBP RT2561C, RF RT2527
ichpcib0 at pci0 dev 31 function 0 Intel 82801BA LPC rev 0x05: 24-bit timer 
at 3579545Hz
pciide0 at pci0 dev 31 function 1 Intel 82801BA IDE rev 0x05: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: SAMSUNG SP0802N
wd0: 16-sector PIO, LBA48, 76351MB, 156368016 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
pciide0: channel 1 ignored (disabled)
uhci0 at pci0 dev 31 function 2 Intel 82801BA USB rev 0x05: irq 9
ichiic0 at pci0 dev 31 function 3 Intel 82801BA SMBus rev 0x05: irq 5
iic0 at ichiic0
spdmem0 at iic0 addr 0x55: 128MB SDRAM non-parity PC133CL2
spdmem1 at iic0 addr 0x56: 128MB SDRAM non-parity PC133CL3
uhci1 at pci0 dev 31 function 4 Intel 82801BA USB rev 0x05: irq 11
auich0 at pci0 dev 31 function 5 Intel 82801BA AC97 rev 0x05: irq 5, ICH2 AC97
ac97: codec id 0x41445360 (Analog Devices AD1885)
ac97: codec features headphone, Analog Devices Phat Stereo
audio0 at auich0
isa0 at ichpcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 Intel UHCI root hub rev 1.00/1.00 addr 1
usb1 at uhci1: USB revision 1.0
uhub1 at usb1 Intel UHCI root hub rev 1.00/1.00 addr 1
biomask 7ffd netmask fffd ttymask 
mtrr: Pentium Pro MTRR support
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
root on wd0a swap on wd0b dump on wd0b



Re: ral(4) diff

2011-03-11 Thread Laurent Ghigonis
On Thu, Mar 10, 2011 at 10:07:09PM +0100, Tim van der Molen wrote:
 I have the following ral(4):

 ral0 at pci0 dev 13 function 0 Ralink RT2561S rev 0x00: irq 5, address
00:1d:7d:49:28:92
 ral0: MAC/BBP RT2561C, RF RT2527

 After a commit from August 2010 (see
 http://marc.info/?l=openbsd-cvsm=128095139804862) the ral stopped
 working: clients could not associate with it in hostap mode and it could
 not detect other APs with ifconfig scan.

 After a hint from damien@ I came up with the following diff which brings
 back some of the code that was removed by the commit mentioned above.

 damien@ suggested I post the diff here. If you have an RT2561 or RT2661,
 please test it.

I have the same card as you, and your patch fixes it.

Previously it would only obey the first ifconfig command after boot,
now it works normaly.

Thank you :)


OpenBSD 4.9-current (GENERIC) #18: Fri Mar 11 17:35:48 CET 2011
k...@gouloum.lan.gouloum:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 1071841280 (1022MB)
avail mem = 1029304320 (981MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.3 @ 0xf0520 (61 entries)
bios0: vendor American Megatrends Inc. version 1004.002 date 08/03/2004
bios0: ASUSTeK Computer Inc. K8V-X
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP OEMB
acpi0: wakeup devices PCI0(S4) PS2K(S4) PS2M(S4) UAR1(S4) AC97(S4) USB1(S4)
USB2(S4) USB3(S4) USB4(S4) EHCI(S4) PWRB(S4) SLPB(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: PSS
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: SLPB
cpu0 at mainbus0: (uniprocessor)
cpu0: AMD Athlon(tm) 64 Processor 2800+, 1802.57 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUS
H,MMX,FXSR,SSE,SSE2,NXE,MMXX,LONG,3DNOW2,3DNOW
cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line
16-way L2 cache
cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: AMD errata 89, 97 present, BIOS upgrade may be required
cpu0: Cool'n'Quiet K8 1802 MHz: speeds: 1800 1000 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 VIA K8HTB Host rev 0x01
agp at pchb0 not configured
ppb0 at pci0 dev 1 function 0 VIA K8HTB AGP rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 NVIDIA GeForce2 MX rev 0xb2
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
rl0 at pci0 dev 9 function 0 Realtek 8139 rev 0x10: irq 11, address
00:08:a1:88:39:c2
rlphy0 at rl0 phy 0: RTL internal PHY
skc0 at pci0 dev 10 function 0 Marvell Yukon 88E8001/8003/8010 rev 0x13,
Yukon Lite rev. A3 (0x7): irq 10
sk0 at skc0 port A: address 00:11:2f:b4:a4:31
eephy0 at sk0 phy 0: 88E1011 Gigabit PHY, rev. 5
ral0 at pci0 dev 11 function 0 Ralink RT2561S rev 0x00: irq 11, address
00:08:d3:28:16:ad
ral0: MAC/BBP RT2561C, RF RT2527
ral1 at pci0 dev 12 function 0 Ralink RT2561S rev 0x00: irq 10, address
00:08:d3:28:a5:21
ral1: MAC/BBP RT2561C, RF RT2527
emu0 at pci0 dev 13 function 0 Creative Labs SoundBlaster Live rev 0x07: irq
5
ac97: codec id 0x54524123 (TriTech Microelectronics TR28602)
audio0 at emu0
Creative Labs PCI Gameport Joystick rev 0x07 at pci0 dev 13 function 1 not
configured
ral2 at pci0 dev 14 function 0 Ralink RT2561S rev 0x00: irq 3, address
00:08:d3:28:d6:e4
ral2: MAC/BBP RT2561C, RF RT2527
pciide0 at pci0 dev 15 function 0 VIA VT6420 SATA rev 0x80: DMA
pciide0: using irq 10 for native-PCI interrupt
wd0 at pciide0 channel 0 drive 0: WDC WD740GD-00FLA2
wd0: 16-sector PIO, LBA48, 70911MB, 145226112 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 6
wd1 at pciide0 channel 1 drive 0: WDC WD3200KS-00PFB0
wd1: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
wd1(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 6
pciide1 at pci0 dev 15 function 1 VIA VT82C571 IDE rev 0x06: ATA133, channel
0 configured to compatibility, channel 1 configured to compatibility
atapiscsi0 at pciide1 channel 0 drive 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: PHILIPS, DVD8801, NW02 ATAPI 5/cdrom
removable
cd0(pciide1:0:1): using PIO mode 4, Ultra-DMA mode 2
pciide1: channel 1 disabled (no drives)
uhci0 at pci0 dev 16 function 0 VIA VT83C572 USB rev 0x81: irq 11
uhci1 at pci0 dev 16 function 1 VIA VT83C572 USB rev 0x81: irq 11
uhci2 at pci0 dev 16 function 2 VIA VT83C572 USB rev 0x81: irq 10
uhci3 at pci0 dev 16 function 3 VIA VT83C572 USB rev 0x81: irq 10
ehci0 at pci0 dev 16 function 4 VIA VT6202 USB rev 0x86: irq 5
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 VIA EHCI root hub rev 2.00/1.00 addr 1
viapm0 at pci0 dev 17 function 0 VIA VT8237 ISA rev 0x00
iic0 at viapm0
iic0: addr 0x4a 00=3f 01=03 02=7f 03=07 05=30 06=c0 07=90 08=3f 09=03 0a=7f
0b=07 0d=30 0e=c0 0f=90 10=3f 11=03 12=7f 13=07 15=30 16=c0 17=90 18=3f 19=03
1a=7f 1b=07 1d=30 1e=c0 1f=90 20=3f 21=03 22=7f 23=07 25=30 26=c0 27=90 28=3f
29=03 2a=7f