meta-digi-arm: Add atheros wireless module.

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2013-01-09 17:30:17 +01:00
parent 5f6cfda2e1
commit cec5fe3904
3 changed files with 149 additions and 0 deletions

View File

@ -17,6 +17,8 @@ KERNEL_IMAGETYPE = "uImage"
# Digi's kernel does not use device tree.
# KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/ccardxmx28js.dts"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-atheros"
SERIAL_CONSOLE = "115200 ttyAM0"
KERNEL_IMAGETYPE = "uImage"

View File

@ -0,0 +1,86 @@
#!/bin/sh -l
#===============================================================================
#
# 10-atheros_pre-up
#
# Copyright (C) 2012 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: Load Atheros' wireless driver
#
#===============================================================================
set -e
[ "${IFACE}" != "wlan0" ] && exit 0
FIRMWARE_DIR="/lib/firmware/ath6k/AR6003/hw2.1.1"
RAM_DRIVE="/var/run"
MAC_FILENAME="softmac"
#
# Get the wlan MAC address from NVRAM. Use a default
# value if the address has not been set.
#
# TODO: Hardcoded until passed to kernel command line from U-Boot.
#MAC_ADDR="$(nvram print module ethaddr2 | sed 's,ethaddr2=,,g')"
#if [ -z "${MAC_ADDR}" -o "${MAC_ADDR}" = "00:00:00:00:00:00" ]; then
MAC_ADDR="00:04:F3:4C:B1:D3"
#fi
mac1="$(echo ${MAC_ADDR} | cut -d':' -f1)"
mac2="$(echo ${MAC_ADDR} | cut -d':' -f2)"
mac3="$(echo ${MAC_ADDR} | cut -d':' -f3)"
mac4="$(echo ${MAC_ADDR} | cut -d':' -f4)"
mac5="$(echo ${MAC_ADDR} | cut -d':' -f5)"
mac6="$(echo ${MAC_ADDR} | cut -d':' -f6)"
printf "\x${mac1}\x${mac2}\x${mac3}\x${mac4}\x${mac5}\x${mac6}" > ${RAM_DRIVE}/${MAC_FILENAME}
# We need to write the WLAN MAC address to softmac in the ath6k firmware
# directory. However, we don't want to rewrite the file if it already exists
# and the address is the same because we don't want to wear out NAND flash.
#
# So create the file on the RAM DRIVE first and compare the two. Only update
# the copy on NAND if the address has changed.
#
if ! cmp -s ${RAM_DRIVE}/${MAC_FILENAME} ${FIRMWARE_DIR}/${MAC_FILENAME}; then
cp ${RAM_DRIVE}/${MAC_FILENAME} ${FIRMWARE_DIR}/${MAC_FILENAME}
fi
rm -f ${RAM_DRIVE}/${MAC_FILENAME}
# Figure out which wireless region we are in. The US has rules for
# what channels can be used and at what power level. We use a different set of
# rules for the other regions in the world that we sell into. The mod_cert field
# in OTP will be set to 0x0 for the US. Once we know the region, make sure the
# appropriate calibration file is loaded.
#
US_CODE="0x0"
REGION_CODE="$(cat /sys/kernel/ccardxmx28/mod_cert)"
if [ -z "${REGION_CODE}" -o "${US_CODE}" = "${REGION_CODE}" ]; then
BDATA_SOURCE=Digi_6203-6233-US.bin
else
BDATA_SOURCE=Digi_6203-6233-World.bin
fi
# We don't want to rewrite NAND every time we boot so only
# change the link if it is wrong.
BDATA_LINK="${FIRMWARE_DIR}/bdata.bin"
if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${FIRMWARE_DIR}/${BDATA_SOURCE}"; then
ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}"
fi
# ath6kl_sdio.ko
ATH6KL_PARAMS=""
[ -f "/root/wifi_test_mode" ] && { ATH6KL_PARAMS="${ATH6KL_PARAMS} testmode=1"; test_mode_str=" in test mode"; }
grep -qs ath6kl_sdio /proc/modules || \
/sbin/modprobe -q ath6kl_sdio ${ATH6KL_PARAMS} || echo "Loading ath6kl_sdio module${test_mode_str}: [FAILED]"
# Delay required for the interface 'wlan0' to settle down before trying to configure it.
sleep 0.5

View File

@ -0,0 +1,61 @@
DESCRIPTION = "Atheros's wireless driver"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://Ath6kl_LinuxRelease/Generic_Packages/compat-wireless/COPYRIGHT;md5=d7810fab7487fb0aad327b76f1be7cd7"
inherit module
PR = "r0"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRCREV = "del-5.9.3.1"
SRC_URI = "${DIGI_LOG_GIT}linux-modules/atheros.git;protocol=git \
file://atheros \
"
S = "${WORKDIR}/git"
FIRMWARE_S = "${S}/Ath6kl_LinuxRelease/Firmware_Package/target/AR6003/hw2.1.1"
EXTRA_OEMAKE = "-C ${STAGING_KERNEL_DIR}"
EXTRAMAKEFLAGS = "M=${S} CONFIG_DEL_KMOD_ATHEROS=y KLIB_BUILD=${STAGING_KERNEL_DIR}"
module_do_compile() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
KERNEL_SRC=${STAGING_KERNEL_DIR} \
CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
AR="${KERNEL_AR}" \
${EXTRAMAKEFLAGS} \
${MAKE_TARGETS}
}
module_do_install() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" \
KERNEL_SRC=${STAGING_KERNEL_DIR} \
CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
${EXTRAMAKEFLAGS} \
modules_install
}
do_install_append() {
install -d ${D}${sysconfdir}/network/if-pre-up.d
install -m 0755 ${WORKDIR}/atheros ${D}${sysconfdir}/network/if-pre-up.d/
install -d ${D}/lib/firmware/ath6k/AR6003/hw2.1.1
install -m 0755 ${FIRMWARE_S}/athtcmd_ram.bin ${D}/lib/firmware/ath6k/AR6003/hw2.1.1/
install -m 0755 ${FIRMWARE_S}/athwlan.bin ${D}/lib/firmware/ath6k/AR6003/hw2.1.1/
install -m 0755 ${FIRMWARE_S}/fw-3.bin ${D}/lib/firmware/ath6k/AR6003/hw2.1.1/
install -m 0755 ${FIRMWARE_S}/nullTestFlow.bin ${D}/lib/firmware/ath6k/AR6003/hw2.1.1/
install -m 0755 ${FIRMWARE_S}/utf.bin ${D}/lib/firmware/ath6k/AR6003/hw2.1.1/
install -m 0755 ${FIRMWARE_S}/Digi_6203-6233-US.bin ${D}/lib/firmware/ath6k/AR6003/hw2.1.1/
install -m 0755 ${FIRMWARE_S}/Digi_6203-6233-World.bin ${D}/lib/firmware/ath6k/AR6003/hw2.1.1/
}
FILES_${PN} += " /lib/firmware/ath6k/AR6003/hw2.1.1/athtcmd_ram.bin \
/lib/firmware/ath6k/AR6003/hw2.1.1/athwlan.bin \
/lib/firmware/ath6k/AR6003/hw2.1.1/fw-3.bin \
/lib/firmware/ath6k/AR6003/hw2.1.1/nullTestFlow.bin \
/lib/firmware/ath6k/AR6003/hw2.1.1/utf.bin \
/lib/firmware/ath6k/AR6003/hw2.1.1/Digi_6203-6233-US.bin \
/lib/firmware/ath6k/AR6003/hw2.1.1/Digi_6203-6233-World.bin "
COMPATIBLE_MACHINE = "(ccardxmx28js)"