Commit 32eb7c73 authored by Xose Vazquez Perez's avatar Xose Vazquez Perez Committed by Ben Hutchings

linux-firmware: add carl9170 firmware

GPLv2 firmware for carl9170, Atheros AR9170 802.11 draft-n USB driver.

Cc: Christian Lamparter <chunkeey@googlemail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarXose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 8cf14f0a
......@@ -2034,3 +2034,15 @@ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--------------------------------------------------------------------------
Driver: carl9170 -- Atheros AR9170 802.11 draft-n USB driver
File: carl9170-1.fw
Version: 1.9.6
Source: carl9170fw/
Downloaded from http://linuxwireless.org/en/users/Drivers/carl9170
Licence: GPLv2
--------------------------------------------------------------------------
File added
cmake_minimum_required(VERSION 2.8)
project(carl9170)
#if you don't want the full compiler output, remove the following line
#set(CMAKE_VERBOSE_MAKEFILE ON)
include("config.cmake")
add_subdirectory(carlfw)
if (CONFIG_CARL9170FW_BUILD_MINIBOOT)
add_subdirectory(minifw)
endif (CONFIG_CARL9170FW_BUILD_MINIBOOT)
if (CONFIG_CARL9170FW_BUILD_TOOLS)
add_subdirectory(tools)
endif (CONFIG_CARL9170FW_BUILD_TOOLS)
Atheros carl9170 firmware - used by the ar9170 wireless device
Copyright (c) 2000-2005 ZyDAS Technology Corporation
Copyright (c) 2007-2009 Atheros Communications, Inc.
Copyright (c) 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
This diff is collapsed.
mainmenu "CARL9170 Firmware Configuration"
source "carlfw/Kconfig"
source "minifw/Kconfig"
source "tools/Kconfig"
Community AR9170 Linux firmware
-----------------------
This is the firmware for the Atheros ar9170 802.11n devices.
To build the firmware you will need an SH-2 toolchain.
You can build your own toolchain:
make -C toolchain
but be aware that this will take some time and requires
about 1.2 GiB disk space.
The resulting firmware, carl9170.fw, can be used only
with the carl9170 Linux driver.
After getting a toolchain, you will need to get more
tools & libs:
* gcc 4.4+
* gperf, bison/flex
* cmake 2.8.0+
* libusb 1.0+
* SDL SDK 1.2.13+
afterwards, simply execute:
autogen.sh
to start the configuration and build process.
if you want to "install" your own firmware, you can either
do this manually, or by executing:
autogen.sh install
This will place a copy with the right filename [adds API rev]
into /lib/firmware/[the default path on most Distributions].
#!/bin/bash
set -e
case "$1" in
config)
echo "Configuring..."
pushd config
cmake .
make
popd
config/conf Kconfig
cmake .
;;
compile)
echo "Compile time..."
make
;;
install)
if [ ! -e .config ]; then
exit 1
fi
. ./.config
make
echo -n "Installing firmware..."
if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ] &&
[ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then
echo -n "Apply miniboot..."
tools/src/miniboot a carlfw/carl9170.fw minifw/miniboot.fw
fi
sudo install -m 644 carlfw/carl9170.fw \
/lib/firmware/carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw
echo "done."
;;
*)
$0 config
$0 compile
;;
esac
cmake_minimum_required(VERSION 2.8)
project(carl9170.fw)
include("../extra/sh-elf-linux.cmake")
include("../config.cmake")
set(CARLFW_CFLAGS_WARNING "-W -Wall -Wextra -Wunreachable-code -Winline -Wlogical-op -Wno-packed-bitfield-compat -Winit-self -Wshadow -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wformat=2 -Wcast-align -Wmissing-format-attribute -Wmissing-prototypes -Wtype-limits -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -Wnested-externs -Wdisabled-optimization -Wpointer-arith -Wvolatile-register-var -Waddress -Wbad-function-cast -Wunsafe-loop-optimizations")
set(CARLFW_CFLAGS_EXTRA "-mbitops -std=gnu99 -ffunction-sections -Wframe-larger-than=128 -Werror")
set(CARLFW_CFLAGS_DEF "-D__CARL9170FW__")
if (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS)
set(CARLFW_CFLAGS_AGGRESSIVE "-fomit-frame-pointer -fsee -frename-registers -ftree-vectorize -flto -fstrict-volatile-bitfields -fmodulo-sched")
endif (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS)
include_directories (../include/linux ../include/shared ../include include)
set(carl9170_main_src src/main.c src/wlan.c src/fw.c src/gpio.c
src/cmd.c src/uart.c src/dma.c src/hostif.c src/reboot.S
src/printf.c src/rf.c src/cam.c src/wol.c)
set(carl9170_lib_src src/ashlsi3.S src/memcpy.S src/memset.S src/udivsi3_i4i-Os.S)
set(carl9170_usb_src usb/main.c usb/usb.c usb/fifo.c)
set(carl9170_src ${carl9170_main_src} ${carl9170_lib_src} ${carl9170_usb_src})
set_source_files_properties(src/ashlsi3.S PROPERTIES LANGUAGE C)
set_source_files_properties(src/memcpy.S PROPERTIES LANGUAGE C)
set_source_files_properties(src/memset.S PROPERTIES LANGUAGE C)
set_source_files_properties(src/reboot.S PROPERTIES LANGUAGE C)
set_source_files_properties(src/udivsi3_i4i-Os.S PROPERTIES LANGUAGE C)
add_executable(carl9170.elf ${carl9170_src})
set_target_properties(carl9170.elf PROPERTIES LINKER_LANGUAGE C)
set_target_properties(carl9170.elf PROPERTIES COMPILE_FLAGS
" ${CARLFW_CFLAGS_DEF} ${CARLFW_CFLAGS_EXTRA} ${CARLFW_CFLAGS_AGGRESSIVE} ${CARLFW_CFLAGS_WARNING}")
set_target_properties(carl9170.elf PROPERTIES LINK_FLAGS "-Tcarl9170.lds")
add_custom_target(firmware ALL)
add_custom_command(
SOURCE carl9170.elf
COMMAND ${OBJCOPY}
ARGS --strip-unneeded -O binary -R .sram -R .eeprom -R .fwdsc carl9170.elf carl9170.bin
TARGET firmware
OUTPUTS carl9170.bin)
add_custom_command(
SOURCE carl9170.elf
COMMAND ${OBJCOPY}
ARGS --strip-unneeded -O binary -j .fwdsc carl9170.elf carl9170.dsc
TARGET firmware
OUTPUTS carl9170.dsc)
add_custom_command(
SOURCE firmware
TARGET firmware
COMMAND cat
ARGS "carl9170.bin" "carl9170.dsc" > "carl9170.fw"
DEPENDS carl9170.elf carl9170.bin carl9170.dsc
OUTPUTS carl9170.fw)
SET_DIRECTORY_PROPERTIES(
PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "carl9170.fw")
menu "General"
config CARL9170FW_RELEASE_VERSION
int
default 1
menu "Selectable Hardware Options"
choice
prompt "Receiver Max. Frame Length"
default CARL9170FW_RX_FRAME_LEN_8192
config CARL9170FW_RX_FRAME_LEN_4096
bool "4096"
config CARL9170FW_RX_FRAME_LEN_8192
bool "8192"
config CARL9170FW_RX_FRAME_LEN_16384
bool "16384"
config CARL9170FW_RX_FRAME_LEN_32768
bool "32768"
endchoice
config CARL9170FW_RX_FRAME_LEN
int
default 4096 if CARL9170FW_RX_FRAME_LEN_4096
default 8192 if CARL9170FW_RX_FRAME_LEN_8192
default 16384 if CARL9170FW_RX_FRAME_LEN_16384
default 32768 if CARL9170FW_RX_FRAME_LEN_32768
config CARL9170FW_GPIO_INTERRUPT
def_bool y
prompt "GPIO Software Interrupt"
---help---
When this option is enabled, the firmware will poll the GPIO
registers and reports to the driver whenever the GPIO state
has changed from a previous state.
Note: This feature is necessary to monitor the WPS button,
if you have one on your device, then say Y.
config CARL9170FW_SECURITY_ENGINE
def_bool y
prompt "Support Hardware Crypto Engine"
---help---
This options controls if the firmware will allow the driver
to program the security engine / CAM through a firmware
interface.
Say Y. Unless you want to do the en- and decryption for
CCMP(AES), TKIP/WEP(RC4) in the application anyway.
config CARL9170FW_RADIO_FUNCTIONS
def_bool y
prompt "Enable Firmware-supported Radio/RF functions"
---help---
Some PHY/RF functions (e.g.: AGC and Noise calibration) need
to be done in the firmware.
Say Y, unless you really don't need the Radio/RF for
your project.
endmenu
menu "802.11 Firmware Features"
config CARL9170FW_CAB_QUEUE
def_bool y
prompt "Support software-based Content after Beacon Queue"
---help---
This (software) queue is used to send any broad-/multi-cast buffered
frames after the next DTIM beacon.
This feature is required for Accesspoint mode operation.
Say Y.
endmenu
source "carlfw/usb/Kconfig"
menu "Experimental, Unstable & Testing Extensions"
config CARL9170FW_PRINTF
def_bool y
prompt "Advanced printf"
depends on CARL9170FW_DEBUG_UART || CARL9170FW_DEBUG_USB
---help---
Advanced printf (very useful for debugging purposes)
The formats supported by this implementation are:
'd' 'u' 'c' 's' 'x' 'X' 'p'.
Note: If this option is disabled, the firmware will be only
capable of reported _preformated_ string.
config CARL9170FW_EXPERIMENTAL
def_bool y
prompt "Experimental Features"
config CARL9170FW_WOL_OPTION
def_bool n
prompt "Wakeup on WLAN"
depends on CARL9170FW_EXPERIMENTAL
---help---
With this option enabled, the firmware can wake-up
suspended hosts... As long as they fully support
USB remote wakeup.
config CARL9170FW_WOL
def_bool n
depends on CARL9170FW_WOL_OPTION
config CARL9170FW_WOL_NL80211_TRIGGERS
def_bool n
prompt "Standard NL80211 wakeup triggers"
depends on CARL9170FW_WOL_OPTION
select CARL9170FW_WOL
---help---
Available triggers:
* Magic Packet(tm) pattern
* disconnect event
config CARL9170FW_WOL_PROBE_REQUEST
def_bool n
prompt "Probe Request"
depends on CARL9170FW_WOL_OPTION
select CARL9170FW_WOL
---help---
Scan probe requests for a given SSID.
config CARL9170FW_WOL_PROBE_REQUEST_SSID
string
prompt "Wakeup on WLAN SSID"
default "CARL9170_WAKEUP"
depends on CARL9170FW_WOL_PROBE_REQUEST
config CARL9170FW_VIFS_NUM
default 1
int
prompt "Number of additional pseudo virtual interfaces"
depends on CARL9170FW_EXPERIMENTAL
config CARL9170FW_FW_MAC_RESET
def_bool y
prompt "Firmware MAC Chip recovery"
depends on CARL9170FW_EXPERIMENTAL
config CARL9170FW_NOISY_MAC_RESET
def_bool n
prompt "Notify MAC RESET events"
depends on CARL9170FW_FW_MAC_RESET
config CARL9170FW_BROKEN_FEATURES
def_bool n
prompt "Broken Featurs"
config CARL9170FW_DEBUG
def_bool n
depends on CARL9170FW_BROKEN_FEATURES && CARL9170FW_PRINTF
prompt "Enable verbose debugging messages"
config CARL9170FW_DEBUG_LED_HEARTBEAT
def_bool n
prompt "LED Heartbeat"
depends on CARL9170FW_BROKEN_FEATURES
---help---
This option conflicts with the application's LED code.
Also, it assumes that you have two LEDs, which is not
necessarily true.
config CARL9170FW_DEBUG_UART
def_bool n
prompt "Pass debug messages through Highspeed UART"
depends on CARL9170FW_BROKEN_FEATURES
---help---
This option allows the firmware to send BUG/ERR/INFO/DBG and
hexdumps through the UART _as well_. However, first: you must
connect a working logger.
config CARL9170FW_WATCHDOG_BUTTON
def_bool n
depends on CARL9170FW_BROKEN && CARL9170FW_GPIO_INTERRUPT
prompt "Trigger Watchdog by pressing the WPS button"
choice CARL9170FW_UART_CLOCK
prompt "UART Clock"
depends on CARL9170FW_DEBUG_UART
default CARL9170FW_UART_CLOCK_40M
config CARL9170FW_UART_CLOCK_25M
bool "25"
config CARL9170FW_UART_CLOCK_40M
bool "40"
endchoice
config CARL9170FW_UNUSABLE
def_bool y
depends on CARL9170FW_BROKEN || CARL9170FW_DEBUG
config CARL9170FW_USB_MODESWITCH
def_bool n
prompt "USB 1.1 / 2.0 switching support"
depends on CARL9170FW_BROKEN_FEATURES
---help---
Mostly implemented, but untested and some serious
doubts remain.
config CARL9170FW_DMA_QUEUE_BUMP
def_bool n
prompt "Bump a stuck TX queue before doing a MAC reset"
depends on CARL9170FW_BROKEN_FEATURES
menu "Build Options"
config CARL9170FW_AGGRESSIVE_CFLAGS
def_bool y
prompt "Enable aggressive size optimization"
---help---
This option adds several more optimization compiler flags,
which can greatly reduce the firmware size... at the expense
of machine-code readability.
Say Y. Else the firmware might not fit onto the device!
endmenu
endmenu
endmenu
/*
* The carl9170 firwmare gets copied into the device's
* Program RAM (pram), which has a size of 16K, but
* also has to accomodate the stack the device uses,
* which starts at the top of the 16k, so we pretend
* that we just have 16256 (16k - 128) of pram.
*
* This section documents some of the other areas
* mapped into the firmware processor's address space
* as well.
*/
ENTRY(_start);
MEMORY
{
eeprom : ORIGIN = 0x000000, LENGTH = 1024k
sram : ORIGIN = 0x100000, LENGTH = 96k
uart : ORIGIN = 0x1c0000, LENGTH = 4k
timer : ORIGIN = 0x1c1000, LENGTH = 4k
vflash : ORIGIN = 0x1c2000, LENGTH = 4k
wlan : ORIGIN = 0x1c3000, LENGTH = 4k
pci2ahb : ORIGIN = 0x1c4000, LENGTH = 4k
security : ORIGIN = 0x1c5000, LENGTH = 4k
gpio : ORIGIN = 0x1d0000, LENGTH = 4k
memctl : ORIGIN = 0x1d1000, LENGTH = 4k
irqctl : ORIGIN = 0x1d2000, LENGTH = 4k
usb : ORIGIN = 0x1e1000, LENGTH = 4k
pta : ORIGIN = 0x1e2000, LENGTH = 4k
pram : ORIGIN = 0x200000, LENGTH = 16256
bogus : ORIGIN = 0x300000, LENGTH = 8k
}
SECTIONS
{
.eeprom : { *(.eeprom*) } > eeprom
.sram : { *(.sram*) } > sram
/*
* The ar9170 boot code will execute the code
* at address 0x04 from the loaded firmware as
* such we must ensure our starting routine
* is kept at that address.
*/
.padding : {
/* NOP NOP just in case */
LONG(0x00090009)
} > pram
.boot : { *(.boot) } > pram
/* anything else can be anywhere */
.text : { *(.text*) } > pram
.rodata : { *(.rodata*) } > pram
.bss : { *(.bss) } > pram
.data : { *(.data*) } > pram
.fwdsc : { KEEP(*(.fwdsc)) } > bogus
}
/*
* carl9170 firmware - used by the ar9170 wireless device
*
* CAM (Security Engine) definitions
*
* Copyright (c) 2000-2005 ZyDAS Technology Corporation
* Copyright (c) 2007-2009 Atheros Communications, Inc.
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __CARL9170FW_CAM_H
#define __CARL9170FW_CAM_H
#include "config.h"
#include "cmd.h"
#ifdef CONFIG_CARL9170FW_SECURITY_ENGINE
#define ENCRY_TYPE_START_ADDR 24
#define DEFAULT_ENCRY_TYPE 26
#define KEY_START_ADDR 27
#define STA_KEY_START_ADDR 155
#define COUNTER_START_ADDR 163
#define STA_COUNTER_START_ADDR 165
/* CAM */
#define MIC_FINISH 0x1
void set_key(const struct carl9170_set_key_cmd *key);
void disable_key(const struct carl9170_disable_key_cmd *key);
#endif /* CONFIG_CARL9170FW_SECURITY_ENGINE */
#endif /* __CARL9170FW_CAM_H */
/*
* carl9170 firmware - used by the ar9170 wireless device
*
* Firmware context definition
*
* Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __CARL9170FW_CARL9170_H
#define __CARL9170FW_CARL9170_H
#include "generated/autoconf.h"
#include "version.h"
#include "config.h"
#include "types.h"
#include "compiler.h"
#include "fwcmd.h"
#include "hw.h"
#include "dma.h"
#include "usb.h"
#include "cmd.h"
struct carl9170_bar_ctx {
uint8_t ta[6];
uint8_t ra[6];
__le16 start_seq_num;
__le16 control;
};
#ifdef CONFIG_CARL9170FW_CAB_QUEUE
enum carl9170_cab_trigger {
CARL9170_CAB_TRIGGER_EMPTY = 0,
CARL9170_CAB_TRIGGER_ARMED = BIT(0),
CARL9170_CAB_TRIGGER_DEFER = BIT(1),
};
#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
enum carl9170_ep0_action {
CARL9170_EP0_NO_ACTION = 0,
CARL9170_EP0_STALL = BIT(0),
CARL9170_EP0_TRIGGER = BIT(1),
};
enum carl9170_mac_reset_state {
CARL9170_MAC_RESET_OFF = 0,
CARL9170_MAC_RESET_ARMED,
CARL9170_MAC_RESET_RESET,
CARL9170_MAC_RESET_FORCE,
};
enum carl9170_suspend_mode {
CARL9170_HOST_AWAKE = 0,
CARL9170_HOST_SUSPENDED,
CARL9170_AWAKE_HOST,
};
enum carl9170_phy_state {
CARL9170_PHY_OFF = 0,
CARL9170_PHY_ON
};
typedef void (*fw_desc_callback_t)(void *, const bool);
/*
* This platform - being an odd 32-bit architecture - prefers to
* have 32-Bit variables.
*/
struct firmware_context_struct {
/* timer / clocks */
unsigned int ticks_per_usec;
unsigned int counter; /* main() cycles */
/* misc */
unsigned int watchdog_enable;
unsigned int reboot;
unsigned int suspend_mode;
struct {
/* Host Interface DMA queues */
struct dma_queue up_queue; /* used to send frames to the host */
struct dma_queue down_queue; /* stores incoming frames from the host */
} pta;
struct {
/* Hardware DMA queues */
struct dma_queue tx_queue[__AR9170_NUM_TX_QUEUES]; /* wlan tx queue */
struct dma_queue tx_retry;
struct dma_queue rx_queue; /* wlan rx queue */
/* tx aggregate scheduling */
struct carl9170_tx_superframe *ampdu_prev[__AR9170_NUM_TX_QUEUES];
/* Hardware DMA queue unstuck/fix detection */
unsigned int last_super_num[__AR9170_NUM_TX_QUEUES];
struct carl9170_tx_superframe *last_super[__AR9170_NUM_TX_QUEUES];
unsigned int mac_reset;
unsigned int soft_int;
/* rx filter */
unsigned int rx_filter;
/* tx sequence control counters */
unsigned int sequence[CARL9170_INTF_NUM];
#ifdef CONFIG_CARL9170FW_CAB_QUEUE
/* CAB */
struct dma_queue cab_queue[CARL9170_INTF_NUM];
unsigned int cab_queue_len[CARL9170_INTF_NUM];
unsigned int cab_flush_time;
enum carl9170_cab_trigger cab_flush_trigger[CARL9170_INTF_NUM];
#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
/* tx status */
unsigned int tx_status_pending,
tx_status_head_idx,
tx_status_tail_idx;
struct carl9170_tx_status tx_status_cache[CARL9170_TX_STATUS_NUM];
/* internal descriptor for use within the service routines */
struct dma_desc *fw_desc;
unsigned int fw_desc_available;
void *fw_desc_data;
fw_desc_callback_t fw_desc_callback;
/* BA(R) Request Handler */
struct carl9170_bar_ctx ba_cache[CONFIG_CARL9170FW_BACK_REQS_NUM];
unsigned int ba_tail_idx,
ba_head_idx,
queued_ba;
unsigned int queued_bar;
} wlan;