From brucembeach at gmail.com  Fri Jun  3 10:26:18 2016
From: brucembeach at gmail.com (bruce m beach)
Date: Fri, 3 Jun 2016 10:26:18 -0700
Subject: ath9k_htc firmware
Message-ID: <CAArymCnfQaa29D2EXGzwOrp0yvXES+Qq1X-HbSUxC6gig8pH_A@mail.gmail.com>

Hello All

 I am still working on cleaning up ath9k_htc firmware build tree for about 6
months now ( and looks like I'll be doing this for all eternity**2 ) and am
not clear myself what I'm looking for right now.

I'm looking for some kind of simple request in the ath9k_htc driver, through
the usb ep0, like a memory read on the card, where a urb is sent with
the resulting chain of events. The simpler the better. The simplest.

Bruce


From linux at rempel-privat.de  Fri Jun  3 22:58:04 2016
From: linux at rempel-privat.de (Oleksij Rempel)
Date: Sat, 4 Jun 2016 07:58:04 +0200
Subject: Fwd: Re: ath9k_htc firmware
In-Reply-To: <57526D1D.9000305@gmx.net>
References: <57526D1D.9000305@gmx.net>
Message-ID: <57526DEC.40907@rempel-privat.de>



Am 03.06.2016 um 19:26 schrieb bruce m beach:
> Hello All
> 
>  I am still working on cleaning up ath9k_htc firmware build tree for about 6
> months now ( and looks like I'll be doing this for all eternity**2 ) and am
> not clear myself what I'm looking for right now.
> 
> I'm looking for some kind of simple request in the ath9k_htc driver, through
> the usb ep0, like a memory read on the card, where a urb is sent with
> the resulting chain of events. The simpler the better. The simplest.

For EP0 on drivers site:
static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
{
        int transfer, err;
        const void *data = hif_dev->fw_data;
        size_t len = hif_dev->fw_size;
        u32 addr = AR9271_FIRMWARE;
        u8 *buf = kzalloc(4096, GFP_KERNEL);
        u32 firm_offset;

        if (!buf)
                return -ENOMEM;

        while (len) {
                transfer = min_t(size_t, len, 4096);
                memcpy(buf, data, transfer);

                err = usb_control_msg(hif_dev->udev,
                                      usb_sndctrlpipe(hif_dev->udev, 0),
                                      FIRMWARE_DOWNLOAD, 0x40 | USB_DIR_OUT,
                                      addr >> 8, 0, buf, transfer, HZ);

=============================================================================



On side of pre installed firmware, the code looks like this:
open-ath9k-htc-firmware/sboot/magpie_1_1/sboot/hif/usb/src/usb_api.c
LOCAL void VendorCommand(void)
{
#define cUSB_REQ_DOWNLOAD          0x30
#define cUSB_REQ_DOWNLOAD_COMP     0x31
#define cUSB_REQ_BOOT              0x32
#define cUSB_REQ_RESERVED_1        0x33
#define cUSB_REQ_RESERVED_2        0x34

#define cUSB_REQ_FLASH_READ        0x35
#define cUSB_REQ_FLASH_READ_COMP   0x36

//#define ZM_FIRMWARE_ADDR           0x200000

    void (*funcPtr)(void);
    uint16_t *text_addr = 0;
    uint32_t ep0_data = 0x0;
...





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/ath9k_htc_fw/attachments/20160604/2a073a8d/attachment.sig>

From linux at rempel-privat.de  Sat Jun  4 13:27:02 2016
From: linux at rempel-privat.de (Oleksij Rempel)
Date: Sat, 4 Jun 2016 22:27:02 +0200
Subject: ath9k_htc firmware
In-Reply-To: <CAArymCm7SgKyK_cy+MucMb5-8nDZshiOCu-mPVyKR6WnNCm5Lg@mail.gmail.com>
References: <CAArymCnfQaa29D2EXGzwOrp0yvXES+Qq1X-HbSUxC6gig8pH_A@mail.gmail.com>
 <57526D1D.9000305@gmx.net>
 <CAArymCm7SgKyK_cy+MucMb5-8nDZshiOCu-mPVyKR6WnNCm5Lg@mail.gmail.com>
Message-ID: <57533996.905@rempel-privat.de>

Am 04.06.2016 um 21:44 schrieb bruce m beach:
>>> I'm looking for some kind of simple request in the ath9k_htc driver, through
>>> the usb ep0, like a memory read on the card, where a urb is sent with
>>> the resulting chain of events. The simpler the better. The simplest.
> 
>> For EP0 on drivers site:
>> static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
>> {
>> int transfer, err;
>> const void *data = hif_dev->fw_data;
>> size_t len = hif_dev->fw_size;
>> u32 addr = AR9271_FIRMWARE;
>> u8 *buf = kzalloc(4096, GFP_KERNEL);
>> u32 firm_offset;
>> ...
> 
>   What about the code for setting and resetting leds ???
> 
> Bruce

It is EP3/EP4 and it is not working without firmware.
Here is one example how you can add new command to firmware:
https://github.com/olerem/open-ath9k-htc-firmware/commit/c73c159303e30a28e2d3dc05ba0d2d15504e5fad


And for kernel driver:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8badb50cfab6d433622dbfd5a90b6adf27333107


PS: Grr... today i send message from wrong email. Sorry for the spam



-- 
Regards,
Oleksij

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/ath9k_htc_fw/attachments/20160604/7f9800c4/attachment.sig>

From brucembeach at gmail.com  Sat Jun 18 08:29:53 2016
From: brucembeach at gmail.com (bruce m beach)
Date: Sat, 18 Jun 2016 08:29:53 -0700
Subject: ath9k_htc firmware rom location
Message-ID: <CAArymCnbtFo1uFmN2i7GfNgmX7OKyvYzrqK30jxoZiYPt7b5HA@mail.gmail.com>

Hello

This is a little bit odd but I cannot actually find the physical
address where the rom starts for the ar9271

Bruce


