Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 2013 22:43:38 +0800
From:      Li-Wen Hsu <lwhsu@FreeBSD.org>
To:        Adrian Chadd <adrian.chadd@gmail.com>
Cc:        freebsd-wireless@freebsd.org
Subject:   Re: Fine, OK, here's my initial AR9380/AR9485 support
Message-ID:  <CAKBkRUwpTFc2hQ7NpuiUFDRsrk=2mkyySxDNfJTAFHa0jOyr2A@mail.gmail.com>
In-Reply-To: <CAKBkRUxo6smb6j4nj3YpNd2kvBFJkejHUmcgcaqcsoA_fHZ0eg@mail.gmail.com>
References:  <5142813d.83c2e00a.67a8.39d5@mx.google.com> <514284E5.9060303@gmail.com> <CAJ-Vmok255ODmYaq5FShODzeLt9QvAeNS7Ef-7sVF5_BSoq2Vg@mail.gmail.com> <51428E10.1000801@gmail.com> <CAJ-VmokkXaNHki-yza5hBzUN9z7FhzPH3RbwLsUchm8t5toM0g@mail.gmail.com> <78975985-a190-4915-82b5-b1810d6115b2@email.android.com> <CAJ-VmongS-xwLAhxG4gK4kMTMfFHzLADdTeOMqX5M4vPg79GNw@mail.gmail.com> <5143A1C3.7010304@gmail.com> <CAJ-Vmo=sC1Akv2r-UsvtLkEX7QSokw3FVU7nhUN29KHGdnEhCg@mail.gmail.com> <CAJ-Vmo=fwDCzdWJPvUQGcy%2BXorD%2BDDMihjHiNN3dsaYeMyw6vw@mail.gmail.com> <CAKBkRUxo6smb6j4nj3YpNd2kvBFJkejHUmcgcaqcsoA_fHZ0eg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 17, 2013 at 10:07 PM, Li-Wen Hsu <lwhsu@freebsd.org> wrote:
> On Sun, Mar 17, 2013 at 2:23 PM, Adrian Chadd <adrian.chadd@gmail.com> wrote:
>> I've just fixed a couple things with the AR9300 HAL:
>>
>> * I've implemented a "get slot time" method, so one stub function call
>> message should disappear;
>> * I've fixed a quirk with slot/ack/rtscts timeout calculations in HT40
>> - the AR9300 HAL was compensating for the 40Mhz width of the channel,
>> but FreeBSD's HAL library call already does this. So now the HAL
>> doesn't double compensate for this.
>> * I broke and then fixed some compile time issues.
>>
>> Please update and test!
>
> Thanks make this work, after updating to r248420 with commit
> f56a13fa8492944f899d4d1b23b8a068bc543c4c on github.
> I finally got my AR9380 work.

Oops, accidentally clicked on "send."  Before the changes you made yesterday,
I can only see it got found by kernel, but was unable to get IP
through DHCP, and
the status of wlan0 was flipping between associated and no carrier, while ath0
is always associated.  Don't know if this has something to do with
that I'm using WPA2.
Thanks making this work, even I haven't posted my report. :)

I am using clang from head, and this patch is needed:

diff --git a/hal/ar9300/ar9300_radio.c b/hal/ar9300/ar9300_radio.c
index 2f3bb3f..aedb76f 100644
--- a/hal/ar9300/ar9300_radio.c
+++ b/hal/ar9300/ar9300_radio.c
@@ -80,7 +80,7 @@ ar9300_set_channel(struct ath_hal *ah, struct
ieee80211_channel *chan)
     u_int8_t clk_25mhz = AH9300(ah)->clk_25mhz;
     CHAN_CENTERS centers;
     int load_synth_channel;
-#ifdef AH_DEBUG
+#if    defined(AH_DEBUG) && defined(AH_DEBUG_ALQ)
     HAL_CHANNEL_INTERNAL *ichan = ath_hal_checkchannel(ah, chan);
 #endif

This is absolutely not a good fix, but it seems that we can get it off
after finishing TODOs in that file.

And it looks that the code will be import to
contrib/sys/dev/ath/ath_hal/ar9300, but the current
instructions still are:

  $ cd sys/dev/ath/ath_hal/ar9003/
  $ ln -s /path/to/git/qcamain_open_hal_public/hal/ar9300/* .

So this is still needed:

  $ ln -s sys/dev/ath/ath_hal/ar9003 sys/dev/ath/ath_hal/ar9300

as well as this patch:

Index: sys/modules/ath/Makefile
===================================================================
--- sys/modules/ath/Makefile    (revision 248420)
+++ sys/modules/ath/Makefile    (working copy)
@@ -125,12 +125,13 @@

 # + AR9300 HAL
 # .PATH:  ${.CURDIR}/../../contrib/sys/dev/ath/ath_hal/ar9300
-#SRCS+= ar9300_interrupts.c ar9300_radar.c ar9300_ani.c ar9300_keycache.c
-#SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c
-#SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c
-#SRCS+= ar9300_stub_funcs.c ar9300_eeprom.c ar9300_paprd.c ar9300_recv_ds.c
-#SRCS+= ar9300_freebsd.c ar9300_phy.c ar9300_reset.c ar9300_gpio.c
-#SRCS+= ar9300_power.c ar9300_timer.c
+.PATH:  ${.CURDIR}/../../../sys/dev/ath/ath_hal/ar9300
+SRCS+= ar9300_interrupts.c ar9300_radar.c ar9300_ani.c ar9300_keycache.c
+SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c
+SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c
+SRCS+= ar9300_stub_funcs.c ar9300_eeprom.c ar9300_paprd.c ar9300_recv_ds.c
+SRCS+= ar9300_freebsd.c ar9300_phy.c ar9300_reset.c ar9300_gpio.c
+SRCS+= ar9300_power.c ar9300_timer.c

 # NB: rate control is bound to the driver by symbol names so only pick one
 .if ${ATH_RATE} == "sample"
@@ -164,5 +165,5 @@
 CWARNFLAGS+=                   ${CWARNFLAGS.${.IMPSRC:T}}

 # AR9300 HAL build overrides, as there's still some code to tidy up
-#CWARNFLAGS.ar9300_eeprom.c=   ${NO_WCONSTANT_CONVERSION}
-#CWARNFLAGS.ar9300_reset.c=    ${NO_WSOMETIMES_UNINITIALIZED}
+CWARNFLAGS.ar9300_eeprom.c=    ${NO_WCONSTANT_CONVERSION}
+CWARNFLAGS.ar9300_reset.c=     ${NO_WSOMETIMES_UNINITIALIZED}

Following is my dmesg output (after loading if_ath.ko & if_ath_pci.ko)

ath0: <Atheros AR938x> mem 0xf2600000-0xf261ffff irq 17 at device 0.0 on pci3
ar9300_set_stub_functions: setting stub functions
ar9300_set_stub_functions: setting stub functions
ar9300_attach: calling ar9300_hw_attach
ar9300_hw_attach: calling ar9300_eeprom_attach
ar9300_flash_map: unimplemented for now
Restoring Cal data from DRAM
Restoring Cal data from EEPROM
Restoring Cal data from Flash
Restoring Cal data from Flash
Restoring Cal data from OTP
ar9300_hw_attach: ar9300_eeprom_attach returned 0
ath0: RX status length: 48
ath0: RX buffer size: 4096
ath0: TX descriptor length: 128
ath0: TX status length: 36
ath0: TX buffers per descriptor: 4
ar9300_freebsd_setup_x_tx_desc: called, 0x0/0, 0x0/0, 0x0/0
ath0: ath_edma_setup_rxfifo: type=0, FIFO depth = 16 entriesath0:
ath_edma_setup_rxfifo: type=1, FIFO depth = 128 entries
ath0: [HT] enabling HT modes
ath0: [HT] enabling short-GI in 20MHz mode
ath0: [HT] 1 stream STBC receive enabled  ath0: [HT] 1 stream STBC
transmit enabled
ath0: [HT] 3 RX streams; 3 TX streams
ath0: AR9380 mac 448.3 RF5110 phy 1140.8
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0000
wlan0: Ethernet address: xx:xx:xx:xx:xx:xx    (masked when posting)
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
ath0: ath_edma_recv_proc_queue: handled npkts 0 ngood 0
wlan0: link state changed to UP

Thanks again for making this work, I am happy to help with further
testing and debugging.

Cheers,
Li-Wen

-- 
Li-Wen Hsu
http://lwhsu.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKBkRUwpTFc2hQ7NpuiUFDRsrk=2mkyySxDNfJTAFHa0jOyr2A>