net: wireless: rockchip_wlan: support ssv6051 wifi

Change-Id: I936a05f2c2b6b29298f1a1eb945ec3a2fedc5262
Signed-off-by: huweiguo <hwg@rock-chips.com>
This commit is contained in:
huweiguo 2018-07-25 15:48:21 +08:00 committed by Tao Huang
parent f03f0892aa
commit 22099e51c7
197 changed files with 73806 additions and 0 deletions

View File

@ -39,5 +39,6 @@ source "drivers/net/wireless/rockchip_wlan/rtl8723cs/Kconfig"
source "drivers/net/wireless/rockchip_wlan/rtl8723ds/Kconfig"
source "drivers/net/wireless/rockchip_wlan/rtl8822be/Kconfig"
source "drivers/net/wireless/rockchip_wlan/mvl88w8977/Kconfig"
source "drivers/net/wireless/rockchip_wlan/ssv6xxx/Kconfig"
endif # WL_ROCKCHIP

View File

@ -9,6 +9,7 @@ obj-$(CONFIG_RTL8723BU) += rtl8723bu/
obj-$(CONFIG_RTL8723CS) += rtl8723cs/
obj-$(CONFIG_RTL8723DS) += rtl8723ds/
obj-$(CONFIG_RTL8822BE) += rtl8822be/
obj-$(CONFIG_SSV6051) += ssv6xxx/
obj-$(CONFIG_MVL88W8977) += mvl88w8977/
obj-$(CONFIG_WL_ROCKCHIP) += wifi_sys/rkwifi_sys_iface.o
obj-$(CONFIG_WL_ROCKCHIP) += rkwifi/rk_wifi_config.o

View File

@ -0,0 +1,8 @@
menu "SouthSV 6XXX WLAN support"
config SSV6051
tristate "ssv6XXX Wireless driver"
depends on MAC80211 && MMC
---help---
Enable SouthSV 6XXX WLAN kernel driver.
endmenu

View File

@ -0,0 +1,75 @@
KMODULE_NAME=ssv6051
KBUILD_TOP := drivers/net/wireless/rockchip_wlan/ssv6xxx
KERNEL_TOP := $(PWD)
FIRMWARE_PATH := $(KERNEL_TOP)/../vendor/rockchip/common/wifi/firmware
KO_PATH := $(KERNEL_TOP)/../device/rockchip/common/wifi/modules/
ifeq ($(KERNELRELEASE),)
# current directory is driver
CFGDIR = $(PWD)/../../../../config
-include $(CFGDIR)/build_config.cfg
-include $(CFGDIR)/rules.make
endif
include $(KBUILD_TOP)/ssv6051.cfg
include $(KBUILD_TOP)/platform-config.mak
EXTRA_CFLAGS := -I$(KBUILD_TOP) -I$(KBUILD_TOP)/include
DEF_PARSER_H = $(KBUILD_TOP)/include/ssv_conf_parser.h
$(shell env ccflags="$(ccflags-y)" $(KBUILD_TOP)/parser-conf.sh $(DEF_PARSER_H))
KERN_SRCS := ssvdevice/ssvdevice.c
KERN_SRCS += ssvdevice/ssv_cmd.c
KERN_SRCS += hci/ssv_hci.c
KERN_SRCS += smac/init.c
KERN_SRCS += smac/dev.c
KERN_SRCS += smac/ssv_rc.c
KERN_SRCS += smac/ssv_ht_rc.c
KERN_SRCS += smac/ap.c
KERN_SRCS += smac/ampdu.c
KERN_SRCS += smac/ssv6xxx_debugfs.c
KERN_SRCS += smac/sec_ccmp.c
KERN_SRCS += smac/sec_tkip.c
KERN_SRCS += smac/sec_wep.c
KERN_SRCS += smac/wapi_sms4.c
KERN_SRCS += smac/sec_wpi.c
KERN_SRCS += smac/efuse.c
KERN_SRCS += smac/ssv_pm.c
KERN_SRCS += smac/sar.c
KERN_SRCS += smac/ssv_cfgvendor.c
ifeq ($(findstring -DCONFIG_SSV_SMARTLINK, $(ccflags-y)), -DCONFIG_SSV_SMARTLINK)
KERN_SRCS += smac/smartlink.c
endif
KERN_SRCS += hwif/sdio/sdio.c
#KERNEL_MODULES += crypto
ifeq ($(findstring -DCONFIG_SSV_SUPPORT_AES_ASM, $(ccflags-y)), -DCONFIG_SSV_SUPPORT_AES_ASM)
KERN_SRCS += crypto/aes_glue.c
KERN_SRCS += crypto/sha1_glue.c
KERN_SRCS_S := crypto/aes-armv4.S
KERN_SRCS_S += crypto/sha1-armv4-large.S
endif
KERN_SRCS += ssv6051-generic-wlan.c
$(KMODULE_NAME)-y += $(KERN_SRCS_S:.S=.o)
$(KMODULE_NAME)-y += $(KERN_SRCS:.c=.o)
obj-$(CONFIG_SSV6200_CORE) += $(KMODULE_NAME).o
$(shell cp $(KBUILD_TOP)/firmware/ssv6051-wifi.cfg $(FIRMWARE_PATH)/)
$(shell cp $(KBUILD_TOP)/firmware/ssv6051-sw.bin $(FIRMWARE_PATH)/)
#$(shell cp $(KBUILD_TOP)/ssv6051.ko $(KO_PATH)/ssv6051.ko)

View File

@ -0,0 +1,95 @@
PLATFORMS =
KBUILD_TOP := $(PWD)
include $(KBUILD_TOP)/platforms/$(PLATFORMS).cfg
include $(KBUILD_TOP)/platforms/platform-config.mak
PWD := $(shell pwd)
ifeq ($(KERNELRELEASE),)
# current directory is driver
CFGDIR = $(PWD)/../../../../config
-include $(CFGDIR)/build_config.cfg
-include $(CFGDIR)/rules.make
endif
KMODULE_NAME=ssv6051
EXTRA_CFLAGS := -I$(KBUILD_TOP) -I$(KBUILD_TOP)/include
DEF_PARSER_H = $(KBUILD_TOP)/include/ssv_conf_parser.h
$(shell env ccflags="$(ccflags-y)" $(KBUILD_TOP)/parser-conf.sh $(DEF_PARSER_H))
KERN_SRCS := ssvdevice/ssvdevice.c
KERN_SRCS += ssvdevice/ssv_cmd.c
KERN_SRCS += hci/ssv_hci.c
KERN_SRCS += smac/init.c
KERN_SRCS += smac/dev.c
KERN_SRCS += smac/ssv_rc.c
KERN_SRCS += smac/ssv_ht_rc.c
KERN_SRCS += smac/ap.c
KERN_SRCS += smac/ampdu.c
KERN_SRCS += smac/ssv6xxx_debugfs.c
KERN_SRCS += smac/sec_ccmp.c
KERN_SRCS += smac/sec_tkip.c
KERN_SRCS += smac/sec_wep.c
KERN_SRCS += smac/wapi_sms4.c
KERN_SRCS += smac/sec_wpi.c
KERN_SRCS += smac/efuse.c
KERN_SRCS += smac/ssv_pm.c
KERN_SRCS += smac/sar.c
ifeq ($(findstring -DCONFIG_SSV_SMARTLINK, $(ccflags-y)), -DCONFIG_SSV_SMARTLINK)
KERN_SRCS += smac/smartlink.c
endif
KERN_SRCS += hwif/sdio/sdio.c
#KERNEL_MODULES += crypto
ifeq ($(findstring -DCONFIG_SSV_SUPPORT_AES_ASM, $(ccflags-y)), -DCONFIG_SSV_SUPPORT_AES_ASM)
KERN_SRCS += crypto/aes_glue.c
KERN_SRCS += crypto/sha1_glue.c
KERN_SRCS_S := crypto/aes-armv4.S
KERN_SRCS_S += crypto/sha1-armv4-large.S
endif
KERN_SRCS += platforms/$(PLATFORMS)-generic-wlan.c
$(KMODULE_NAME)-y += $(KERN_SRCS_S:.S=.o)
$(KMODULE_NAME)-y += $(KERN_SRCS:.c=.o)
obj-$(CONFIG_SSV6200_CORE) += $(KMODULE_NAME).o
all:module strip
module:
make -C $(SSV_KERNEL_PATH) ARCH=$(SSV_ARCH) CROSS_COMPILE=$(SSV_CROSS) \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" M=$(PWD) modules
install:
install -p -m 644 $(KMODULE_NAME).ko $(KMODDESTDIR)
uninstall:
rm -f $(KMODDESTDIR)/$(KMODULE_NAME).ko
strip:
#cp eagle.ko $(KO_NAME).ko
#cp $(KO_NAME).ko $(DEFAULT_MODULES_DIR)
#cp ssv6200.ko $(DEFAULT_MODULES_DIR)
cp platforms/$(PLATFORMS)-wifi.cfg image/$(KMODULE_NAME)-wifi.cfg
cp $(KMODULE_NAME).ko image/$(KMODULE_NAME).ko
cp platforms/cli image
ifneq ($(SSV_STRIP),)
cp $(KMODULE_NAME).ko image/$(KMODULE_NAME)_ori.ko
$(SSV_STRIP) --strip-unneeded image/$(KMODULE_NAME).ko
#$(SSV_STRIP) --strip-debug image/$(KMODULE_NAME).ko
endif
clean:
make -C $(SSV_KERNEL_PATH) ARCH=$(SSV_ARCH) CROSS_COMPILE=$(SSV_CROSS) \
M=$(PWD) clean

View File

@ -0,0 +1,51 @@
#!/bin/bash
prompt="Pick the target platform:"
chip_options=("a33" \
"h8" \
"h3" \
"rk3126" \
"rk3128" \
"atm7039-action" \
"aml-s805" \
"aml-s905" \
"aml-t950" \
"xm-hi3518" \
"v66")
PLATFORM=""
select opt in "${chip_options[@]}" "Quit"; do
case "$REPLY" in
1 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
2 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
3 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
4 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
5 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
6 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
7 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
8 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
9 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
10 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
11 ) echo "${chip_options[$REPLY-1]} is option";PLATFORM=${chip_options[$REPLY-1]};break;;
$(( ${#chip_options[@]}+1 )) ) echo "Goodbye!"; break;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
if [ "$PLATFORM" != "" ]; then
./ver_info.pl include/ssv_version.h
if [ $? -eq 0 ]; then
echo "Please check SVN first !!"
else
cp Makefile.android Makefile
sed -i 's,PLATFORMS =,PLATFORMS = '"$PLATFORM"',g' Makefile
make clean
make
echo "Done ko!"
fi
else
echo "Fail!"
fi

View File

@ -0,0 +1,17 @@
config SSV_SDIO_BRIDGE_HW
tristate
default m
depends on MMC
---help---
This option enables the SDIO bus support in ssvcabrio.
Say Y, if you have a ssv SDIO device.
config SSV_SDIO_BRIDGE_DEBUGFS
bool "SSV ssvsdiobridge debugging"
depends on DEBUG_FS
---help---
Say Y, if you need access to ssvsdiobridge's statistics.
Also required for changing debug message flags at run time.

View File

@ -0,0 +1,22 @@
ifeq ($(KBUILD_TOP),)
ifneq ($(KBUILD_EXTMOD),)
KBUILD_DIR := $(KBUILD_EXTMOD)
else
KBUILD_DIR := $(PWD)
endif
KBUILD_TOP := $(KBUILD_DIR)/../
endif
include $(KBUILD_TOP)/config.mak
KBUILD_EXTRA_SYMBOLS += $(KBUILD_TOP)/ssvdevice/Module.symvers
#Define CONFIG_CABRIO_DEBUG to show debug messages
ccflags-y += -DCONFIG_CABRIO_DEBUG
KMODULE_NAME=ssv6200_sdiobridge
KERN_SRCS := sdiobridge.c
KERN_SRCS += debug.c
include $(KBUILD_TOP)/rules.mak

View File

@ -0,0 +1,27 @@
#aaa.mk - what is this used for?
obj-m += ssvsdiobridge.o
ssvsdiobridge-y += sdiobridge.o
ssvsdiobridge-y += debug.o
#Define CONFIG_CABRIO_DEBUG to show debug messages
ccflags-y += -DCONFIG_CABRIO_DEBUG
ifndef ($(KBUILD_EXTMOD),)
KDIR=/lib/modules/`uname -r`/build
_all:
$(MAKE) -C $(KDIR) M=$(PWD) KBUILD_EXTRA_SYMBOLS=$(PWD)/../ssvdevice/Module.symvers modules 2>&1 | tee make.log
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
rm -f make.log
install:
@-rmmod ssvsdiobridge
$(MAKE) INSTALL_MOD_DIR=kernel/drivers/net/wireless/ssv6200 -C $(KDIR) M=$(PWD) modules_install
modprobe ssvsdiobridge
endif

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/export.h>
#include <asm/unaligned.h>
#include "debug.h"
int ssv_sdiobridge_init_debug(struct ssv_sdiobridge_glue *glue)
{
glue->debugfs = debugfs_create_dir("ssv",
NULL);
if (!glue->debugfs)
return -ENOMEM;
glue->dump_entry = debugfs_create_bool("sdiobridge_dump", S_IRUSR, glue->debugfs, &glue->dump);
return 0;
}
void ssv_sdiobridge_deinit_debug(struct ssv_sdiobridge_glue *glue)
{
if (!glue->dump_entry)
debugfs_remove(glue->dump_entry);
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEBUG_H
#define DEBUG_H
#include "sdiobridge.h"
#include <linux/debugfs.h>
int ssv_sdiobridge_init_debug(struct ssv_sdiobridge_glue *glue);
void ssv_sdiobridge_deinit_debug(struct ssv_sdiobridge_glue *glue);
#endif

View File

@ -0,0 +1,7 @@
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-48-generic'
CC [M] /root/felix/1015-Release/final/host_drivers/Linux/ssv/bridge/sdiobridge.o
/root/felix/1015-Release/final/host_drivers/Linux/ssv/bridge/sdiobridge.c:44:33: fatal error: ../include/sdio_def.h: No such file or directory
compilation terminated.
make[2]: *** [/root/felix/1015-Release/final/host_drivers/Linux/ssv/bridge/sdiobridge.o] Error 1
make[1]: *** [_module_/root/felix/1015-Release/final/host_drivers/Linux/ssv/bridge] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-48-generic'

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef SSVSDIOBRIDGE_H
#define SSVSDIOBRIDGE_H
#include <linux/etherdevice.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/leds.h>
#include <linux/completion.h>
#include <linux/ioctl.h>
#include <linux/types.h>
#include "sdiobridge_pub.h"
struct ssv_sdiobridge_glue
{
struct device *dev;
u8 blockMode;
u16 blockSize;
u8 autoAckInt;
unsigned int dataIOPort;
unsigned int regIOPort;
u8 funcFocus;
atomic_t irq_handling;
wait_queue_head_t irq_wq;
wait_queue_head_t read_wq;
spinlock_t rxbuflock;
void *bufaddr;
struct list_head rxbuf;
struct list_head rxreadybuf;
struct dentry *debugfs;
struct dentry *dump_entry;
u32 dump;
};
#define MANUFACTURER_SSV_CODE 0x3030
#define MANUFACTURER_ID_CABRIO_BASE 0x3030
#endif

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef SSVSDIOBRIDGE_PUB_H
#define SSVSDIOBRIDGE_PUB_H
#include <linux/etherdevice.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/leds.h>
#include <linux/completion.h>
#include <linux/ioctl.h>
#include <linux/types.h>
struct ssv_sdiobridge_cmd {
__u32 in_data_len;
u8* in_data;
#ifndef __x86_64
__u32 padding1;
#endif
__u32 out_data_len;
u8* out_data;
#ifndef __x86_64
__u32 padding2;
#endif
__u32 response;
}__attribute__((packed));
#define FILE_DEVICE_SSVSDIO MMC_BLOCK_MAJOR
#define FILE_DEVICE_SSVSDIO_SEQ 0x50
#define FILE_DEVICE_SSVSDIO_NAME "ssvsdiobridge"
#if 0
#define IOCTL_SSVSDIO_GET_DRIVER_VERSION \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x01, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_FUNCTION_NUMBER \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x02, struct ssv_sdiobridge_cmd)
#endif
#define IOCTL_SSVSDIO_GET_FUNCTION_FOCUS \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x03, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_FUNCTION_FOCUS \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x04, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_BUS_WIDTH \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x05, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_BUS_WIDTH \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x06, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_BUS_CLOCK \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x07, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_BUS_CLOCK \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x08, struct ssv_sdiobridge_cmd)
#if 0
#define IOCTL_SSVSDIO_GET_BLOCK_MODE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x09, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_BLOCK_MODE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0a, struct ssv_sdiobridge_cmd)
#endif
#define IOCTL_SSVSDIO_GET_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0b, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0c, struct ssv_sdiobridge_cmd)
#if 0
#define IOCTL_SSVSDIO_GET_FN0_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0d, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_FN0_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0e, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_BUS_INTERFACE_CONTROL \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0f, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_BUS_INTERFACE_CONTROL \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x10, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_INT_ENABLE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x11, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_INT_ENABLE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x12, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_AUTO_ACK_INT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x13, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_AUTO_ACK_INT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x14, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_ACK_INT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x15, struct ssv_sdiobridge_cmd)
#endif
#define IOCTL_SSVSDIO_READ_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x16, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_WRITE_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x17, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_MULTI_BYTE_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x18, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_MULTI_BYTE_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x19, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_READ_MULTI_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1a, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_WRITE_MULTI_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1b, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_GET_MULTI_BYTE_REG_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1c, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_SET_MULTI_BYTE_REG_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1d, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_READ_REG \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1e, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_WRITE_REG \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1f, struct ssv_sdiobridge_cmd)
#define IOCTL_SSVSDIO_READ_DATA \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x20, struct ssv_sdiobridge_cmd)
#endif

View File

@ -0,0 +1,123 @@
KVERSION="`uname -r`"
#DRVPATH=/lib/modules/$(KVERSION)/kernel/drivers/net/wireless/ssv6200
DRVPATH=kernel/drivers/net/wireless/ssv6200
KCFLAG += -Werror
EXTRA_CFLAGS := -I$(KBUILD_TOP) -I$(KBUILD_TOP)/include
CONFIG_SSV6200_CORE=m
#ccflags-y += -DCONFIG_SSV6200_CORE
###########################################################################
# Compiler options #
###########################################################################
ccflags-y += -Werror
# Enable -g to help debug. Deassembly from .o to .S would help to track to
# the problomatic line from call stack dump.
ccflags-y += -g
############################################################
# If you change the settings, please change the file synchronization
# smac\firmware\include\config.h & compiler firmware
############################################################
#ccflags-y += -DCONFIG_SSV_CABRIO_A
#ccflags-y += -DSDIO_USE_SLOW_CLOCK
ccflags-y += -DCONFIG_SSV_CABRIO_E
#CONFIG_SSV_SUPPORT_BTCX=y
ccflags-y += -DCONFIG_SSV6200_CLI_ENABLE
#ccflags-y += -DCONFIG_SSV_BUILD_AS_ONE_KO
############################################################
# Options should be able to set as parameters. #
############################################################
#PADPD
#ccflags-y += -DCONFIG_SSV_DPD
#ccflags-y += -DCONFIG_SSV_CABRIO_MB_DEBUG
ccflags-y += -DCONFIG_SSV6XXX_DEBUGFS
#SDIO
ccflags-y += -DCONFIG_SSV_TX_LOWTHRESHOLD
############################################################
# Rate control update for MPDU.
############################################################
ccflags-y += -DRATE_CONTROL_REALTIME_UPDATA
#workaround
#ccflags-y += -DCONFIG_SSV_CABRIO_EXT_PA
############################################################
# NOTE:
# Only one of the following flags could be turned on.
# It also turned off the following flags. In this case,
# pure software security or pure hardware security is used.
#
############################################################
#ccflags-y += -DCONFIG_SSV_SW_ENCRYPT_HW_DECRYPT
#ccflags-y += -DCONFIG_SSV_HW_ENCRYPT_SW_DECRYPT
# FOR WFA
#ccflags-y += -DWIFI_CERTIFIED
#ccflags-y += -DCONFIG_SSV_SDIO_EXT_INT
#######################################################
ccflags-y += -DCONFIG_SSV6200_HAS_RX_WORKQUEUE
#ccflags-y += -DUSE_THREAD_RX
ccflags-y += -DUSE_THREAD_TX
ccflags-y += -DENABLE_AGGREGATE_IN_TIME
ccflags-y += -DENABLE_INCREMENTAL_AGGREGATION
# Generic decision table applicable to both AP and STA modes.
ccflags-y += -DUSE_GENERIC_DECI_TBL
# Use crypto in SSV driver.
ccflags-y += -DUSE_LOCAL_CRYPTO
ccflags-y += -DUSE_LOCAL_WEP_CRYPTO
ccflags-y += -DUSE_LOCAL_TKIP_CRYPTO
ccflags-y += -DUSE_LOCAL_CCMP_CRYPTO
ccflags-y += -DUSE_LOCAL_SMS4_CRYPTO
ccflags-y += -DCONFIG_SSV_WAPI
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
ccflags-y += -DFW_WSID_WATCH_LIST
#ccflags-y += -DUSE_BATCH_RX
#ccflags-y += -DCONFIG_IRQ_DEBUG_COUNT
#ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DSSV6200_ECO
#ccflags-y += -DENABLE_WAKE_IO_ISR_WHEN_HCI_ENQUEUE
ccflags-y += -DHAS_CRYPTO_LOCK
ccflags-y += -DENABLE_TX_Q_FLOW_CONTROL
#ccflags-y += -DCONFIG_DEBUG_SKB_TIMESTAMP
###########################################################
# option to :qswitch driver between relay device and sw mac device
# Enable ->Relay device (CHAR)
# Disable->SW MAC device(NET)
#DRV_OPT = HUW_DRV
#For HUW to define some resources
ifeq ($(DRV_OPT), HUW_DRV)
ccflags-y += -DHUW_DRV
endif
#enable p2p client to parse GO broadcast noa
#ccflags-y += -DCONFIG_P2P_NOA
#enable rx management frame check
#ccflags-y += -DCONFIG_RX_MGMT_CHECK
ccflags-y += -DCONFIG_SSV_RSSI

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/module.h>
#include <linux/crypto.h>
#include <crypto/aes.h>
#define AES_MAXNR 14
typedef struct {
unsigned int rd_key[4 *(AES_MAXNR + 1)];
int rounds;
} AES_KEY;
struct AES_CTX {
AES_KEY enc_key;
AES_KEY dec_key;
};
asmlinkage void AES_encrypt(const u8 *in, u8 *out, AES_KEY *ctx);
asmlinkage void AES_decrypt(const u8 *in, u8 *out, AES_KEY *ctx);
asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
struct AES_CTX *ctx = crypto_tfm_ctx(tfm);
AES_encrypt(src, dst, &ctx->enc_key);
}
static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
struct AES_CTX *ctx = crypto_tfm_ctx(tfm);
AES_decrypt(src, dst, &ctx->dec_key);
}
static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
unsigned int key_len)
{
struct AES_CTX *ctx = crypto_tfm_ctx(tfm);
switch (key_len) {
case AES_KEYSIZE_128:
key_len = 128;
break;
case AES_KEYSIZE_192:
key_len = 192;
break;
case AES_KEYSIZE_256:
key_len = 256;
break;
default:
tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL;
}
if (private_AES_set_encrypt_key(in_key, key_len, &ctx->enc_key) == -1) {
tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL;
}
ctx->dec_key = ctx->enc_key;
if (private_AES_set_decrypt_key(in_key, key_len, &ctx->dec_key) == -1) {
tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL;
}
return 0;
}
static struct crypto_alg aes_alg = {
.cra_name = "aes",
.cra_driver_name = "aes-asm",
.cra_priority = 200,
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct AES_CTX),
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(aes_alg.cra_list),
.cra_u = {
.cipher = {
.cia_min_keysize = AES_MIN_KEY_SIZE,
.cia_max_keysize = AES_MAX_KEY_SIZE,
.cia_setkey = aes_set_key,
.cia_encrypt = aes_encrypt,
.cia_decrypt = aes_decrypt
}
}
};
int aes_init(void)
{
return crypto_register_alg(&aes_alg);
}
void aes_fini(void)
{
crypto_unregister_alg(&aes_alg);
}

View File

@ -0,0 +1,503 @@
#define __ARM_ARCH__ __LINUX_ARM_ARCH__
@ ====================================================================
@ Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
@ project. The module is, however, dual licensed under OpenSSL and
@ CRYPTOGAMS licenses depending on where you obtain it. For further
@ details see http://www.openssl.org/~appro/cryptogams/.
@ ====================================================================
@ sha1_block procedure for ARMv4.
@
@ January 2007.
@ Size/performance trade-off
@ ====================================================================
@ impl size in bytes comp cycles[*] measured performance
@ ====================================================================
@ thumb 304 3212 4420
@ armv4-small 392/+29% 1958/+64% 2250/+96%
@ armv4-compact 740/+89% 1552/+26% 1840/+22%
@ armv4-large 1420/+92% 1307/+19% 1370/+34%[***]
@ full unroll ~5100/+260% ~1260/+4% ~1300/+5%
@ ====================================================================
@ thumb = same as 'small' but in Thumb instructions[**] and
@ with recurring code in two private functions;
@ small = detached Xload/update, loops are folded;
@ compact = detached Xload/update, 5x unroll;
@ large = interleaved Xload/update, 5x unroll;
@ full unroll = interleaved Xload/update, full unroll, estimated[!];
@
@ [*] Manually counted instructions in "grand" loop body. Measured
@ performance is affected by prologue and epilogue overhead,
@ i-cache availability, branch penalties, etc.
@ [**] While each Thumb instruction is twice smaller, they are not as
@ diverse as ARM ones: e.g., there are only two arithmetic
@ instructions with 3 arguments, no [fixed] rotate, addressing
@ modes are limited. As result it takes more instructions to do
@ the same job in Thumb, therefore the code is never twice as
@ small and always slower.
@ [***] which is also ~35% better than compiler generated code. Dual-
@ issue Cortex A8 core was measured to process input block in
@ ~990 cycles.
@ August 2010.
@
@ Rescheduling for dual-issue pipeline resulted in 13% improvement on
@ Cortex A8 core and in absolute terms ~870 cycles per input block
@ [or 13.6 cycles per byte].
@ February 2011.
@
@ Profiler-assisted and platform-specific optimization resulted in 10%
@ improvement on Cortex A8 core and 12.2 cycles per byte.
.text
.global sha1_block_data_order
.type sha1_block_data_order,%function
.align 2
sha1_block_data_order:
stmdb sp!,{r4-r12,lr}
add r2,r1,r2,lsl#6 @ r2 to point at the end of r1
ldmia r0,{r3,r4,r5,r6,r7}
.Lloop:
ldr r8,.LK_00_19
mov r14,sp
sub sp,sp,#15*4
mov r5,r5,ror#30
mov r6,r6,ror#30
mov r7,r7,ror#30 @ [6]
.L_00_15:
#if __ARM_ARCH__<7
ldrb r10,[r1,#2]
ldrb r9,[r1,#3]
ldrb r11,[r1,#1]
add r7,r8,r7,ror#2 @ E+=K_00_19
ldrb r12,[r1],#4
orr r9,r9,r10,lsl#8
eor r10,r5,r6 @ F_xx_xx
orr r9,r9,r11,lsl#16
add r7,r7,r3,ror#27 @ E+=ROR(A,27)
orr r9,r9,r12,lsl#24
#else
ldr r9,[r1],#4 @ handles unaligned
add r7,r8,r7,ror#2 @ E+=K_00_19
eor r10,r5,r6 @ F_xx_xx
add r7,r7,r3,ror#27 @ E+=ROR(A,27)
#ifdef __ARMEL__
rev r9,r9 @ byte swap
#endif
#endif
and r10,r4,r10,ror#2
add r7,r7,r9 @ E+=X[i]
eor r10,r10,r6,ror#2 @ F_00_19(B,C,D)
str r9,[r14,#-4]!
add r7,r7,r10 @ E+=F_00_19(B,C,D)
#if __ARM_ARCH__<7
ldrb r10,[r1,#2]
ldrb r9,[r1,#3]
ldrb r11,[r1,#1]
add r6,r8,r6,ror#2 @ E+=K_00_19
ldrb r12,[r1],#4
orr r9,r9,r10,lsl#8
eor r10,r4,r5 @ F_xx_xx
orr r9,r9,r11,lsl#16
add r6,r6,r7,ror#27 @ E+=ROR(A,27)
orr r9,r9,r12,lsl#24
#else
ldr r9,[r1],#4 @ handles unaligned
add r6,r8,r6,ror#2 @ E+=K_00_19
eor r10,r4,r5 @ F_xx_xx
add r6,r6,r7,ror#27 @ E+=ROR(A,27)
#ifdef __ARMEL__
rev r9,r9 @ byte swap
#endif
#endif
and r10,r3,r10,ror#2
add r6,r6,r9 @ E+=X[i]
eor r10,r10,r5,ror#2 @ F_00_19(B,C,D)
str r9,[r14,#-4]!
add r6,r6,r10 @ E+=F_00_19(B,C,D)
#if __ARM_ARCH__<7
ldrb r10,[r1,#2]
ldrb r9,[r1,#3]
ldrb r11,[r1,#1]
add r5,r8,r5,ror#2 @ E+=K_00_19
ldrb r12,[r1],#4
orr r9,r9,r10,lsl#8
eor r10,r3,r4 @ F_xx_xx
orr r9,r9,r11,lsl#16
add r5,r5,r6,ror#27 @ E+=ROR(A,27)
orr r9,r9,r12,lsl#24
#else
ldr r9,[r1],#4 @ handles unaligned
add r5,r8,r5,ror#2 @ E+=K_00_19
eor r10,r3,r4 @ F_xx_xx
add r5,r5,r6,ror#27 @ E+=ROR(A,27)
#ifdef __ARMEL__
rev r9,r9 @ byte swap
#endif
#endif
and r10,r7,r10,ror#2
add r5,r5,r9 @ E+=X[i]
eor r10,r10,r4,ror#2 @ F_00_19(B,C,D)
str r9,[r14,#-4]!
add r5,r5,r10 @ E+=F_00_19(B,C,D)
#if __ARM_ARCH__<7
ldrb r10,[r1,#2]
ldrb r9,[r1,#3]
ldrb r11,[r1,#1]
add r4,r8,r4,ror#2 @ E+=K_00_19
ldrb r12,[r1],#4
orr r9,r9,r10,lsl#8
eor r10,r7,r3 @ F_xx_xx
orr r9,r9,r11,lsl#16
add r4,r4,r5,ror#27 @ E+=ROR(A,27)
orr r9,r9,r12,lsl#24
#else
ldr r9,[r1],#4 @ handles unaligned
add r4,r8,r4,ror#2 @ E+=K_00_19
eor r10,r7,r3 @ F_xx_xx
add r4,r4,r5,ror#27 @ E+=ROR(A,27)
#ifdef __ARMEL__
rev r9,r9 @ byte swap
#endif
#endif
and r10,r6,r10,ror#2
add r4,r4,r9 @ E+=X[i]
eor r10,r10,r3,ror#2 @ F_00_19(B,C,D)
str r9,[r14,#-4]!
add r4,r4,r10 @ E+=F_00_19(B,C,D)
#if __ARM_ARCH__<7
ldrb r10,[r1,#2]
ldrb r9,[r1,#3]
ldrb r11,[r1,#1]
add r3,r8,r3,ror#2 @ E+=K_00_19
ldrb r12,[r1],#4
orr r9,r9,r10,lsl#8
eor r10,r6,r7 @ F_xx_xx
orr r9,r9,r11,lsl#16
add r3,r3,r4,ror#27 @ E+=ROR(A,27)
orr r9,r9,r12,lsl#24
#else
ldr r9,[r1],#4 @ handles unaligned
add r3,r8,r3,ror#2 @ E+=K_00_19
eor r10,r6,r7 @ F_xx_xx
add r3,r3,r4,ror#27 @ E+=ROR(A,27)
#ifdef __ARMEL__
rev r9,r9 @ byte swap
#endif
#endif
and r10,r5,r10,ror#2
add r3,r3,r9 @ E+=X[i]
eor r10,r10,r7,ror#2 @ F_00_19(B,C,D)
str r9,[r14,#-4]!
add r3,r3,r10 @ E+=F_00_19(B,C,D)
teq r14,sp
bne .L_00_15 @ [((11+4)*5+2)*3]
#if __ARM_ARCH__<7
ldrb r10,[r1,#2]
ldrb r9,[r1,#3]
ldrb r11,[r1,#1]
add r7,r8,r7,ror#2 @ E+=K_00_19
ldrb r12,[r1],#4
orr r9,r9,r10,lsl#8
eor r10,r5,r6 @ F_xx_xx
orr r9,r9,r11,lsl#16
add r7,r7,r3,ror#27 @ E+=ROR(A,27)
orr r9,r9,r12,lsl#24
#else
ldr r9,[r1],#4 @ handles unaligned
add r7,r8,r7,ror#2 @ E+=K_00_19
eor r10,r5,r6 @ F_xx_xx
add r7,r7,r3,ror#27 @ E+=ROR(A,27)
#ifdef __ARMEL__
rev r9,r9 @ byte swap
#endif
#endif
and r10,r4,r10,ror#2
add r7,r7,r9 @ E+=X[i]
eor r10,r10,r6,ror#2 @ F_00_19(B,C,D)
str r9,[r14,#-4]!
add r7,r7,r10 @ E+=F_00_19(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r6,r8,r6,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r4,r5 @ F_xx_xx
mov r9,r9,ror#31
add r6,r6,r7,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r3,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r6,r6,r9 @ E+=X[i]
eor r10,r10,r5,ror#2 @ F_00_19(B,C,D)
add r6,r6,r10 @ E+=F_00_19(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r5,r8,r5,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r3,r4 @ F_xx_xx
mov r9,r9,ror#31
add r5,r5,r6,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r7,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r5,r5,r9 @ E+=X[i]
eor r10,r10,r4,ror#2 @ F_00_19(B,C,D)
add r5,r5,r10 @ E+=F_00_19(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r4,r8,r4,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r7,r3 @ F_xx_xx
mov r9,r9,ror#31
add r4,r4,r5,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r6,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r4,r4,r9 @ E+=X[i]
eor r10,r10,r3,ror#2 @ F_00_19(B,C,D)
add r4,r4,r10 @ E+=F_00_19(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r3,r8,r3,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r6,r7 @ F_xx_xx
mov r9,r9,ror#31
add r3,r3,r4,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r5,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r3,r3,r9 @ E+=X[i]
eor r10,r10,r7,ror#2 @ F_00_19(B,C,D)
add r3,r3,r10 @ E+=F_00_19(B,C,D)
ldr r8,.LK_20_39 @ [+15+16*4]
sub sp,sp,#25*4
cmn sp,#0 @ [+3], clear carry to denote 20_39
.L_20_39_or_60_79:
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r7,r8,r7,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r5,r6 @ F_xx_xx
mov r9,r9,ror#31
add r7,r7,r3,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
eor r10,r4,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r7,r7,r9 @ E+=X[i]
add r7,r7,r10 @ E+=F_20_39(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r6,r8,r6,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r4,r5 @ F_xx_xx
mov r9,r9,ror#31
add r6,r6,r7,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
eor r10,r3,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r6,r6,r9 @ E+=X[i]
add r6,r6,r10 @ E+=F_20_39(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r5,r8,r5,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r3,r4 @ F_xx_xx
mov r9,r9,ror#31
add r5,r5,r6,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
eor r10,r7,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r5,r5,r9 @ E+=X[i]
add r5,r5,r10 @ E+=F_20_39(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r4,r8,r4,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r7,r3 @ F_xx_xx
mov r9,r9,ror#31
add r4,r4,r5,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
eor r10,r6,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r4,r4,r9 @ E+=X[i]
add r4,r4,r10 @ E+=F_20_39(B,C,D)
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r3,r8,r3,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r6,r7 @ F_xx_xx
mov r9,r9,ror#31
add r3,r3,r4,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
eor r10,r5,r10,ror#2 @ F_xx_xx
@ F_xx_xx
add r3,r3,r9 @ E+=X[i]
add r3,r3,r10 @ E+=F_20_39(B,C,D)
teq r14,sp @ preserve carry
bne .L_20_39_or_60_79 @ [+((12+3)*5+2)*4]
bcs .L_done @ [+((12+3)*5+2)*4], spare 300 bytes
ldr r8,.LK_40_59
sub sp,sp,#20*4 @ [+2]
.L_40_59:
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r7,r8,r7,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r5,r6 @ F_xx_xx
mov r9,r9,ror#31
add r7,r7,r3,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r4,r10,ror#2 @ F_xx_xx
and r11,r5,r6 @ F_xx_xx
add r7,r7,r9 @ E+=X[i]
add r7,r7,r10 @ E+=F_40_59(B,C,D)
add r7,r7,r11,ror#2
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r6,r8,r6,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r4,r5 @ F_xx_xx
mov r9,r9,ror#31
add r6,r6,r7,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r3,r10,ror#2 @ F_xx_xx
and r11,r4,r5 @ F_xx_xx
add r6,r6,r9 @ E+=X[i]
add r6,r6,r10 @ E+=F_40_59(B,C,D)
add r6,r6,r11,ror#2
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r5,r8,r5,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r3,r4 @ F_xx_xx
mov r9,r9,ror#31
add r5,r5,r6,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r7,r10,ror#2 @ F_xx_xx
and r11,r3,r4 @ F_xx_xx
add r5,r5,r9 @ E+=X[i]
add r5,r5,r10 @ E+=F_40_59(B,C,D)
add r5,r5,r11,ror#2
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r4,r8,r4,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r7,r3 @ F_xx_xx
mov r9,r9,ror#31
add r4,r4,r5,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r6,r10,ror#2 @ F_xx_xx
and r11,r7,r3 @ F_xx_xx
add r4,r4,r9 @ E+=X[i]
add r4,r4,r10 @ E+=F_40_59(B,C,D)
add r4,r4,r11,ror#2
ldr r9,[r14,#15*4]
ldr r10,[r14,#13*4]
ldr r11,[r14,#7*4]
add r3,r8,r3,ror#2 @ E+=K_xx_xx
ldr r12,[r14,#2*4]
eor r9,r9,r10
eor r11,r11,r12 @ 1 cycle stall
eor r10,r6,r7 @ F_xx_xx
mov r9,r9,ror#31
add r3,r3,r4,ror#27 @ E+=ROR(A,27)
eor r9,r9,r11,ror#31
str r9,[r14,#-4]!
and r10,r5,r10,ror#2 @ F_xx_xx
and r11,r6,r7 @ F_xx_xx
add r3,r3,r9 @ E+=X[i]
add r3,r3,r10 @ E+=F_40_59(B,C,D)
add r3,r3,r11,ror#2
teq r14,sp
bne .L_40_59 @ [+((12+5)*5+2)*4]
ldr r8,.LK_60_79
sub sp,sp,#20*4
cmp sp,#0 @ set carry to denote 60_79
b .L_20_39_or_60_79 @ [+4], spare 300 bytes
.L_done:
add sp,sp,#80*4 @ "deallocate" stack frame
ldmia r0,{r8,r9,r10,r11,r12}
add r3,r8,r3
add r4,r9,r4
add r5,r10,r5,ror#2
add r6,r11,r6,ror#2
add r7,r12,r7,ror#2
stmia r0,{r3,r4,r5,r6,r7}
teq r1,r2
bne .Lloop @ [+18], total 1307
#if __ARM_ARCH__>=5
ldmia sp!,{r4-r12,pc}
#else
ldmia sp!,{r4-r12,lr}
tst lr,#1
moveq pc,lr @ be binary compatible with V4, yet
.word 0xe12fff1e @ interoperable with Thumb ISA:-)
#endif
.align 2
.LK_00_19: .word 0x5a827999
.LK_20_39: .word 0x6ed9eba1
.LK_40_59: .word 0x8f1bbcdc
.LK_60_79: .word 0xca62c1d6
.size sha1_block_data_order,.-sha1_block_data_order
.asciz "SHA1 block transform for ARMv4, CRYPTOGAMS by <appro@openssl.org>"
.align 2

View File

@ -0,0 +1,141 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <crypto/internal/hash.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/cryptohash.h>
#include <linux/types.h>
#include <crypto/sha.h>
#include <asm/byteorder.h>
struct SHA1_CTX {
uint32_t h0,h1,h2,h3,h4;
u64 count;
u8 data[SHA1_BLOCK_SIZE];
};
asmlinkage void sha1_block_data_order(struct SHA1_CTX *digest,
const unsigned char *data, unsigned int rounds);
static int sha1_init(struct shash_desc *desc)
{
struct SHA1_CTX *sctx = shash_desc_ctx(desc);
memset(sctx, 0, sizeof(*sctx));
sctx->h0 = SHA1_H0;
sctx->h1 = SHA1_H1;
sctx->h2 = SHA1_H2;
sctx->h3 = SHA1_H3;
sctx->h4 = SHA1_H4;
return 0;
}
static int __sha1_update(struct SHA1_CTX *sctx, const u8 *data,
unsigned int len, unsigned int partial)
{
unsigned int done = 0;
sctx->count += len;
if (partial) {
done = SHA1_BLOCK_SIZE - partial;
memcpy(sctx->data + partial, data, done);
sha1_block_data_order(sctx, sctx->data, 1);
}
if (len - done >= SHA1_BLOCK_SIZE) {
const unsigned int rounds = (len - done) / SHA1_BLOCK_SIZE;
sha1_block_data_order(sctx, data + done, rounds);
done += rounds * SHA1_BLOCK_SIZE;
}
memcpy(sctx->data, data + done, len - done);
return 0;
}
static int sha1_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct SHA1_CTX *sctx = shash_desc_ctx(desc);
unsigned int partial = sctx->count % SHA1_BLOCK_SIZE;
int res;
if (partial + len < SHA1_BLOCK_SIZE) {
sctx->count += len;
memcpy(sctx->data + partial, data, len);
return 0;
}
res = __sha1_update(sctx, data, len, partial);
return res;
}
static int sha1_final(struct shash_desc *desc, u8 *out)
{
struct SHA1_CTX *sctx = shash_desc_ctx(desc);
unsigned int i, index, padlen;
__be32 *dst = (__be32 *)out;
__be64 bits;
static const u8 padding[SHA1_BLOCK_SIZE] = { 0x80, };
bits = cpu_to_be64(sctx->count << 3);
index = sctx->count % SHA1_BLOCK_SIZE;
padlen = (index < 56) ? (56 - index) : ((SHA1_BLOCK_SIZE+56) - index);
if (padlen <= 56) {
sctx->count += padlen;
memcpy(sctx->data + index, padding, padlen);
} else {
__sha1_update(sctx, padding, padlen, index);
}
__sha1_update(sctx, (const u8 *)&bits, sizeof(bits), 56);
for (i = 0; i < 5; i++)
dst[i] = cpu_to_be32(((u32 *)sctx)[i]);
memset(sctx, 0, sizeof(*sctx));
return 0;
}
static int sha1_export(struct shash_desc *desc, void *out)
{
struct SHA1_CTX *sctx = shash_desc_ctx(desc);
memcpy(out, sctx, sizeof(*sctx));
return 0;
}
static int sha1_import(struct shash_desc *desc, const void *in)
{
struct SHA1_CTX *sctx = shash_desc_ctx(desc);
memcpy(sctx, in, sizeof(*sctx));
return 0;
}
static struct shash_alg alg = {
.digestsize = SHA1_DIGEST_SIZE,
.init = sha1_init,
.update = sha1_update,
.final = sha1_final,
.export = sha1_export,
.import = sha1_import,
.descsize = sizeof(struct SHA1_CTX),
.statesize = sizeof(struct SHA1_CTX),
.base = {
.cra_name = "sha1",
.cra_driver_name= "sha1-asm",
.cra_priority = 150,
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SHA1_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
};
int sha1_mod_init(void)
{
return crypto_register_shash(&alg);
}
void sha1_mod_fini(void)
{
crypto_unregister_shash(&alg);
}
#if 0
module_init(sha1_mod_init);
module_exit(sha1_mod_fini);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm (ARM)");
MODULE_ALIAS("sha1");
MODULE_AUTHOR("David McCullough <ucdevel@gmail.com>");
#endif

View File

@ -0,0 +1,91 @@
############################################################
# ROCKCHIP RK3X28 & RK322X
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /vendor/etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 2
#wifi_tx_gain_level_gn = 5
################################################
# Signal strength control
# rssi control
#rssi_ctl = 10
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,4 @@
#!/bin/bash
./ver_info.pl include/ssv_version.h

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Script to convert defines in compiler option in to C's defines
# Should be executed in make file and it take ccflags-y as the
# compiler options. The content will be redirected to the first arguement.
echo "#ifndef __SSV_MOD_CONF_H__" > $1
echo "#define __SSV_MOD_CONF_H__" >> $1
for flag in ${ccflags-y}; do
if [[ "$flag" =~ ^-D.* ]]; then
#def=${flag//-D/}
def=${flag:2}
echo "#ifndef $def" >> $1
echo "#define $def" >> $1
echo "#endif" >> $1
fi
done
echo "#define __must_check" >> $1
echo "#define __devinit" >> $1
echo "#define __devexit" >> $1
echo "#define __init" >> $1
echo "#define __exit" >> $1
echo "#endif // __SSV_MOD_CONF_H__" >> $1

View File

@ -0,0 +1,19 @@
ifeq ($(KBUILD_TOP),)
ifneq ($(KBUILD_EXTMOD),)
KBUILD_DIR := $(KBUILD_EXTMOD)
else
KBUILD_DIR := $(PWD)
endif
KBUILD_TOP := $(KBUILD_DIR)/../
endif
include $(KBUILD_TOP)/config.mak
KBUILD_EXTRA_SYMBOLS += $(KBUILD_TOP)/ssvdevice/Module.symvers
KMODULE_NAME=ssv6200_hci
KERN_SRCS += ssv_hci.c
include $(KBUILD_TOP)/rules.mak

View File

@ -0,0 +1,169 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _HCTRL_H_
#define _HCTRL_H_
#define MAX_FRAME_SIZE 4096
#define SSV6XXX_INT_RX 0x00000001
#define SSV6XXX_INT_TX 0x00000002
#define SSV6XXX_INT_SOC 0x00000004
#define SSV6XXX_INT_LOW_EDCA_0 0x00000008
#define SSV6XXX_INT_LOW_EDCA_1 0x00000010
#define SSV6XXX_INT_LOW_EDCA_2 0x00000020
#define SSV6XXX_INT_LOW_EDCA_3 0x00000040
#define SSV6XXX_INT_RESOURCE_LOW 0x00000080
#define IFDEV(_ct) ((_ct)->shi->dev)
#define IFOPS(_ct) ((_ct)->shi->if_ops)
#define HCI_REG_READ(_ct,_adr,_val) IFOPS(_ct)->readreg(IFDEV(_ct), _adr, _val)
#define HCI_REG_WRITE(_ct,_adr,_val) IFOPS(_ct)->writereg(IFDEV(_ct), _adr, _val)
#define HCI_REG_SET_BITS(_ct,_reg,_set,_clr) \
{ \
u32 _regval; \
if(HCI_REG_READ(_ct, _reg, &_regval)); \
_regval &= ~(_clr); \
_regval |= (_set); \
if(HCI_REG_WRITE(_ct, _reg, _regval)); \
}
#define IF_SEND(_ct,_bf,_len,_qid) IFOPS(_ct)->write(IFDEV(_ct), _bf, _len, _qid)
#define IF_RECV(ct,bf,len) IFOPS(ct)->read(IFDEV(ct), bf, len)
#define HCI_LOAD_FW(ct,_bf,open) IFOPS(ct)->load_fw(IFDEV(ct), _bf, open)
#define HCI_IFC_RESET(ct) IFOPS(ct)->interface_reset(IFDEV(ct))
struct ssv6xxx_hci_ctrl {
struct ssv6xxx_hci_info *shi;
spinlock_t int_lock;
u32 int_status;
u32 int_mask;
struct mutex txq_mask_lock;
u32 txq_mask;
struct ssv_hw_txq hw_txq[SSV_HW_TXQ_NUM];
struct mutex hci_mutex;
bool hci_start;
struct sk_buff *rx_buf;
u32 rx_pkt;
struct workqueue_struct *hci_work_queue;
struct work_struct hci_rx_work;
#ifdef CONFIG_SSV_TX_LOWTHRESHOLD
struct work_struct hci_tx_work;
#else
struct work_struct hci_tx_work[SSV_HW_TXQ_NUM];
#endif
u32 read_rs0_info_fail;
u32 read_rs1_info_fail;
u32 rx_work_running;
u32 isr_running;
u32 xmit_running;
u32 isr_summary_eable;
u32 isr_routine_time;
u32 isr_tx_time;
u32 isr_rx_time;
u32 isr_idle_time;
u32 isr_rx_idle_time;
u32 isr_miss_cnt;
unsigned long prev_isr_jiffes;
unsigned long prev_rx_isr_jiffes;
#ifdef CONFIG_SSV6XXX_DEBUGFS
struct dentry *debugfs_dir;
u32 isr_mib_enable;
u32 isr_mib_reset;
long long isr_total_time;
long long isr_tx_io_time;
long long isr_rx_io_time;
u32 isr_rx_io_count;
u32 isr_tx_io_count;
long long isr_rx_proc_time;
#ifdef CONFIG_IRQ_DEBUG_COUNT
bool irq_enable;
u32 irq_count;
u32 invalid_irq_count;
u32 tx_irq_count;
u32 real_tx_irq_count;
u32 rx_irq_count;
u32 irq_rx_pkt_count;
u32 irq_tx_pkt_count;
#endif
#endif
};
struct ssv6xxx_hci_txq_info {
u32 tx_use_page:8;
u32 tx_use_id:6;
u32 txq0_size:4;
u32 txq1_size:4;
u32 txq2_size:5;
u32 txq3_size:5;
};
struct ssv6xxx_hci_txq_info2 {
u32 tx_use_page:9;
u32 tx_use_id:8;
u32 txq4_size:4;
u32 rsvd:11;
};
struct ssv6xxx_hw_resource
{
u32 free_tx_page;
u32 free_tx_id;
int max_tx_frame[SSV_HW_TXQ_NUM];
};
static inline void ssv6xxx_hwif_irq_request(struct ssv6xxx_hci_ctrl *hctrl, irq_handler_t irq_handler)
{
if(hctrl->shi->if_ops->irq_request)
hctrl->shi->if_ops->irq_request(IFDEV(hctrl), irq_handler, hctrl);
}
static inline void ssv6xxx_hwif_irq_enable(struct ssv6xxx_hci_ctrl *hctrl)
{
if(hctrl->shi->if_ops->irq_enable)
hctrl->shi->if_ops->irq_enable(IFDEV(hctrl));
}
static inline void ssv6xxx_hwif_irq_disable(struct ssv6xxx_hci_ctrl *hctrl)
{
if(hctrl->shi->if_ops->irq_disable)
hctrl->shi->if_ops->irq_disable(IFDEV(hctrl), false);
}
static inline int ssv6xxx_hwif_irq_getstatus(struct ssv6xxx_hci_ctrl *hctrl, int *status)
{
if(hctrl->shi->if_ops->irq_getstatus)
return hctrl->shi->if_ops->irq_getstatus(IFDEV(hctrl), status);
return 0;
}
static inline void ssv6xxx_hwif_irq_setmask(struct ssv6xxx_hci_ctrl *hctrl, int mask)
{
if(hctrl->shi->if_ops->irq_setmask)
hctrl->shi->if_ops->irq_setmask(IFDEV(hctrl), mask);
}
static inline void ssv6xxx_hwif_irq_trigger(struct ssv6xxx_hci_ctrl *hctrl)
{
if(hctrl->shi->if_ops->irq_trigger)
hctrl->shi->if_ops->irq_trigger(IFDEV(hctrl));
}
static inline void ssv6xxx_hwif_pmu_wakeup(struct ssv6xxx_hci_ctrl *hctrl)
{
if(hctrl->shi->if_ops->pmu_wakeup)
hctrl->shi->if_ops->pmu_wakeup(IFDEV(hctrl));
}
static inline int ssv6xxx_hwif_write_sram(struct ssv6xxx_hci_ctrl *hctrl, u32 addr, u8 *data, u32 size)
{
if(hctrl->shi->if_ops->write_sram)
return hctrl->shi->if_ops->write_sram(IFDEV(hctrl), addr, data, size);
return 0;
}
#define HCI_IRQ_REQUEST(ct,hdle) ssv6xxx_hwif_irq_request(ct, hdle)
#define HCI_IRQ_ENABLE(ct) ssv6xxx_hwif_irq_enable(ct)
#define HCI_IRQ_DISABLE(ct) ssv6xxx_hwif_irq_disable(ct)
#define HCI_IRQ_STATUS(ct,sts) ssv6xxx_hwif_irq_getstatus(ct, sts)
#define HCI_IRQ_SET_MASK(ct,mk) ssv6xxx_hwif_irq_setmask(ct, mk)
#define HCI_IRQ_TRIGGER(ct) ssv6xxx_hwif_irq_trigger(ct)
#define HCI_PMU_WAKEUP(ct) ssv6xxx_hwif_pmu_wakeup(ct)
#define HCI_SRAM_WRITE(_ct,_adr,_dat,_size) ssv6xxx_hwif_write_sram(_ct, _adr, _dat, _size);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SSV_HCI_H_
#define _SSV_HCI_H_
#define SSV_HW_TXQ_NUM 5
#define SSV_HW_TXQ_MAX_SIZE 64
#define SSV_HW_TXQ_RESUME_THRES ((SSV_HW_TXQ_MAX_SIZE >> 2) *3)
#define HCI_FLAGS_ENQUEUE_HEAD 0x00000001
#define HCI_FLAGS_NO_FLOWCTRL 0x00000002
struct ssv_hw_txq {
u32 txq_no;
struct sk_buff_head qhead;
int max_qsize;
int resum_thres;
bool paused;
u32 tx_pkt;
u32 tx_flags;
};
struct ssv6xxx_hci_ops {
int (*hci_start)(void);
int (*hci_stop)(void);
int (*hci_read_word)(u32 addr, u32 *regval);
int (*hci_write_word)(u32 addr, u32 regval);
int (*hci_load_fw)(u8 *firmware_name, u8 openfile);
int (*hci_tx)(struct sk_buff *, int, u32);
#if 0
int (*hci_rx)(struct sk_buff *);
#endif
int (*hci_tx_pause)(u32 txq_mask);
int (*hci_tx_resume)(u32 txq_mask);
int (*hci_txq_flush)(u32 txq_mask);
int (*hci_txq_flush_by_sta)(int aid);
bool (*hci_txq_empty)(int txqid);
int (*hci_pmu_wakeup)(void);
int (*hci_send_cmd)(struct sk_buff *);
#ifdef CONFIG_SSV6XXX_DEBUGFS
bool (*hci_init_debugfs)(struct dentry *dev_deugfs_dir);
void (*hci_deinit_debugfs)(void);
#endif
int (*hci_write_sram)(u32 addr, u8* data, u32 size);
int (*hci_interface_reset)(void);
};
struct ssv6xxx_hci_info {
struct device *dev;
struct ssv6xxx_hwif_ops *if_ops;
struct ssv6xxx_hci_ops *hci_ops;
#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX)
int (*hci_rx_cb)(struct sk_buff_head *, void *);
#else
int (*hci_rx_cb)(struct sk_buff *, void *);
#endif
void *rx_cb_args;
void (*hci_tx_cb)(struct sk_buff_head *, void *);
void *tx_cb_args;
int (*hci_tx_flow_ctrl_cb)(void *, int, bool, int debug);
void *tx_fctrl_cb_args;
void (*hci_tx_buf_free_cb)(struct sk_buff *, void *);
void *tx_buf_free_args;
void (*hci_skb_update_cb)(struct sk_buff *, void *);
void *skb_update_args;
void (*hci_tx_q_empty_cb)(u32 txq_no, void *);
void *tx_q_empty_args;
};
int ssv6xxx_hci_deregister(void);
int ssv6xxx_hci_register(struct ssv6xxx_hci_info *);
#endif

View File

@ -0,0 +1,19 @@
ifeq ($(KBUILD_TOP),)
ifneq ($(KBUILD_EXTMOD),)
KBUILD_DIR := $(KBUILD_EXTMOD)
else
KBUILD_DIR := $(PWD)
endif
KBUILD_TOP := $(KBUILD_DIR)/../
endif
include $(KBUILD_TOP)/config.mak
KBUILD_EXTRA_SYMBOLS += $(KBUILD_TOP)/hci/Module.symvers
KMODULE_NAME=hci_wrapper
KERN_SRCS := ssv_huw.c
include $(KBUILD_TOP)/rules.mak

View File

@ -0,0 +1,497 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/wait.h>
#include <linux/netdevice.h>
#include <hci/ssv_hci.h>
#include <hwif/hwif.h>
#include "ssv_huw.h"
#define SSV6200_ID_NUMBER (128)
#define BLOCKSIZE 0x40
#define RXBUFLENGTH 1024*3
#define RXBUFSIZE 512
#define CHECK_RET(_fun) \
do { \
if (0 != _fun) \
printk("File = %s\nLine = %d\nFunc=%s\nDate=%s\nTime=%s\n", __FILE__, __LINE__, __FUNCTION__, __DATE__, __TIME__); \
} while (0)
#define SMAC_SRAM_WRITE(_s,_r,_v,_sz) \
(_s)->hci.hci_ops->hci_write_sram(_r, _v, _sz)
#define SMAC_REG_WRITE(_s,_r,_v) \
(_s)->hci.hci_ops->hci_write_word(_r, _v)
#define SMAC_REG_READ(_s,_r,_v) \
(_s)->hci.hci_ops->hci_read_word(_r, _v)
#define HCI_START(_sh) \
(_sh)->hci.hci_ops->hci_start()
#define HCI_STOP(_sh) \
(_sh)->hci.hci_ops->hci_stop()
#define HCI_SEND(_sh,_sk,_q) \
(_sh)->hci.hci_ops->hci_tx(_sk, _q, HCI_FLAGS_NO_FLOWCTRL)
#define HCI_PAUSE(_sh,_mk) \
(_sh)->hci.hci_ops->hci_tx_pause(_mk)
#define HCI_RESUME(_sh,_mk) \
(_sh)->hci.hci_ops->hci_tx_resume(_mk)
#define HCI_TXQ_FLUSH(_sh,_mk) \
(_sh)->hci.hci_ops->hci_txq_flush(_mk)
#define HCI_TXQ_FLUSH_BY_STA(_sh,_aid) \
(_sh)->hci.hci_ops->hci_txq_flush_by_sta(_aid)
#define HCI_TXQ_EMPTY(_sh,_txqid) \
(_sh)->hci.hci_ops->hci_txq_empty(_txqid)
#define HCI_WAKEUP_PMU(_sh) \
(_sh)->hci.hci_ops->hci_pmu_wakeup()
#define HCI_SEND_CMD(_sh,_sk) \
(_sh)->hci.hci_ops->hci_send_cmd(_sk)
struct ssv_huw_dev {
struct device *dev;
struct ssv6xxx_platform_data *priv;
struct ssv6xxx_hci_info hci;
char chip_id[24];
u64 chip_tag;
u8 funcFocus;
wait_queue_head_t read_wq;
spinlock_t rxlock;
void *bufaddr;
struct sk_buff_head rx_skb_q;
};
struct ssv_rxbuf
{
struct list_head list;
u32 rxsize;
u8 rxdata[RXBUFLENGTH];
};
struct ssv_huw_dev g_huw_dev;
static unsigned int ssv_sdiobridge_ioctl_major = 0;
static unsigned int num_of_dev = 1;
static struct cdev ssv_sdiobridge_ioctl_cdev;
static struct class *fc;
#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX)
int ssv_huw_rx(struct sk_buff_head *rx_skb_q, void *args)
#else
int ssv_huw_rx(struct sk_buff *rx_skb, void *args)
#endif
{
struct ssv_huw_dev *phuw_dev = (struct ssv_huw_dev *)args;
unsigned long flags;
spin_lock_irqsave(&phuw_dev->rxlock, flags);
#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX)
while (skb_queue_len(rx_skb_q))
__skb_queue_tail(&phuw_dev->rx_skb_q, __skb_dequeue(rx_skb_q));
#else
__skb_queue_tail(&phuw_dev->rx_skb_q, rx_skb);
#endif
spin_unlock_irqrestore(&phuw_dev->rxlock, flags);
wake_up_interruptible(&phuw_dev->read_wq);
return 0;
}
void ssv_huw_txbuf_free_skb(struct sk_buff *skb, void *args)
{
if (!skb)
return;
dev_kfree_skb_any(skb);
}
unsigned int skb_queue_len_bhsafe(struct sk_buff_head *head, spinlock_t *plock)
{
unsigned int len = 0;
spin_lock_bh(plock);
len = skb_queue_len(head);
spin_unlock_bh(plock);
return len;
}
static long ssv_huw_ioctl_readReg(struct ssv_huw_dev *phuw_dev,unsigned int cmd, struct ssv_huw_cmd *pcmd_data,struct ssv_huw_cmd *pucmd_data,bool isCompat)
{
long retval =0;
if ( pcmd_data->in_data_len < 4 || pcmd_data->out_data_len < 4)
{
retval = -1;
}
else
{
u32 tmpdata;
u32 regval;
int ret = 0;
#ifdef CONFIG_COMPAT
if ( isCompat )
{
CHECK_RET(copy_from_user(&tmpdata,(int __user *)compat_ptr((unsigned long)pucmd_data->in_data),sizeof(tmpdata)));
}
else
#endif
{
CHECK_RET(copy_from_user(&tmpdata,(int __user *)pucmd_data->in_data,sizeof(tmpdata)));
}
ret = SMAC_REG_READ(phuw_dev, tmpdata, &regval);
if ( !ret )
{
#ifdef CONFIG_COMPAT
if ( isCompat )
{
CHECK_RET(copy_to_user((int __user *)compat_ptr((unsigned long)pucmd_data->out_data),&regval,sizeof(regval)));
}
else
#endif
{
CHECK_RET(copy_to_user((int __user *)pucmd_data->out_data,&regval,sizeof(regval)));
}
}
else
{
dev_err(phuw_dev->dev,"%s: error : %d",__FUNCTION__,ret);
retval = -1;
}
}
return retval;
}
static long ssv_huw_ioctl_writeReg(struct ssv_huw_dev *phuw_dev,unsigned int cmd, struct ssv_huw_cmd *pcmd_data,struct ssv_huw_cmd *pucmd_data,bool isCompat)
{
long retval =0;
if ( pcmd_data->in_data_len < 8)
{
retval = -1;
}
else
{
u32 tmpdata[2];
int ret = 0;
#ifdef CONFIG_COMPAT
if ( isCompat )
{
CHECK_RET(copy_from_user(&tmpdata,(int __user *)compat_ptr((unsigned long)pucmd_data->in_data),sizeof(tmpdata)));
}
else
#endif
{
CHECK_RET(copy_from_user(&tmpdata,(int __user *)pucmd_data->in_data,sizeof(tmpdata)));
}
SMAC_REG_WRITE(phuw_dev, tmpdata[0], tmpdata[1]);
if ( ret )
{
dev_err(phuw_dev->dev,"%s: error : %d",__FUNCTION__,ret);
retval = -1;
}
}
return retval;
}
static long ssv_huw_ioctl_writeSram(struct ssv_huw_dev *phuw_dev,unsigned int cmd, struct ssv_huw_cmd *pcmd_data,struct ssv_huw_cmd *pucmd_data,bool isCompat)
{
long retval =0;
unsigned char *ptr = NULL;
unsigned int addr;
if (( pcmd_data->in_data_len != 4) || ( pcmd_data->out_data_len <= 0))
{
retval = -1;
}
else
{
int ret = 0;
ptr = kzalloc(pcmd_data->out_data_len, GFP_KERNEL);
if(ptr == NULL)
return -ENOMEM;
#ifdef CONFIG_COMPAT
if ( isCompat )
{
CHECK_RET(copy_from_user(&addr, (int __user *)compat_ptr((unsigned long)pucmd_data->in_data), sizeof(addr)));
CHECK_RET(copy_from_user(ptr, (int __user *)compat_ptr((unsigned long)pucmd_data->out_data), pcmd_data->out_data_len));
}
else
#endif
{
CHECK_RET(copy_from_user(&addr, (int __user *)pucmd_data->in_data, sizeof(addr)));
CHECK_RET(copy_from_user(ptr, (int __user *)pucmd_data->out_data, pcmd_data->out_data_len));
}
SMAC_SRAM_WRITE(phuw_dev, addr, ptr, pcmd_data->out_data_len);
if ( ret )
{
dev_err(phuw_dev->dev,"%s: error : %d",__FUNCTION__,ret);
retval = -1;
}
kfree(ptr);
}
return retval;
}
static long ssv_huw_ioctl_process(struct ssv_huw_dev *glue, unsigned int cmd, struct ssv_huw_cmd *pucmd_data, bool isCompat)
{
struct ssv_huw_cmd cmd_data;
long retval=0;
if ( isCompat )
{
CHECK_RET(copy_from_user(&cmd_data,(int __user *)pucmd_data,sizeof(*pucmd_data)));
}
else
{
CHECK_RET(copy_from_user(&cmd_data,(int __user *)pucmd_data,sizeof(*pucmd_data)));
}
switch (cmd)
{
case IOCTL_SSVSDIO_READ_REG:
retval = ssv_huw_ioctl_readReg(glue,cmd,&cmd_data,pucmd_data,isCompat);
break;
case IOCTL_SSVSDIO_WRITE_REG:
retval = ssv_huw_ioctl_writeReg(glue,cmd,&cmd_data,pucmd_data,isCompat);
break;
case IOCTL_SSVSDIO_WRITE_SRAM:
retval = ssv_huw_ioctl_writeSram(glue,cmd,&cmd_data,pucmd_data,isCompat);
break;
case IOCTL_SSVSDIO_START:
retval = HCI_START(glue);
break;
case IOCTL_SSVSDIO_STOP:
retval = HCI_STOP(glue);
break;
default:
return -EINVAL;
}
return retval;
}
#ifdef CONFIG_COMPAT
static long ssv_huw_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
long retval=0;
struct ssv_huw_cmd *pucmd_data;
pucmd_data = (struct ssv_huw_cmd *)arg;
retval = ssv_huw_ioctl_process(&g_huw_dev, cmd, pucmd_data, true);
return retval;
}
#endif
static long ssv_huw_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
long retval=0;
struct ssv_huw_cmd *pucmd_data;
pucmd_data = (struct ssv_huw_cmd *)arg;
retval = ssv_huw_ioctl_process( &g_huw_dev,cmd,pucmd_data,false);
return retval;
}
static int ssv_huw_open(struct inode *inode, struct file *fp)
{
fp->private_data = &g_huw_dev;
return 0;
}
static int ssv_huw_release(struct inode *inode, struct file *fp)
{
struct sk_buff *skb = NULL;
while((skb = skb_dequeue(&(g_huw_dev.rx_skb_q))) != NULL)
{
dev_kfree_skb_any(skb);
skb = NULL;
}
return 0;
}
static ssize_t ssv_huw_read(struct file *fp, char __user * buf, size_t length, loff_t * offset)
{
int ret = 0, copy_length = 0;
struct sk_buff *skb = NULL;
if (skb_queue_len_bhsafe(&(g_huw_dev.rx_skb_q), &(g_huw_dev.rxlock)) == 0)
{
ret = wait_event_interruptible((g_huw_dev.read_wq), (skb_queue_len_bhsafe(&(g_huw_dev.rx_skb_q), &(g_huw_dev.rxlock)) != 0));
if (ret != 0)
return -1;
}
spin_lock_bh(&(g_huw_dev.rxlock));
if (skb_queue_len(&(g_huw_dev.rx_skb_q)) > 0)
skb = skb_dequeue(&(g_huw_dev.rx_skb_q));
spin_unlock_bh(&(g_huw_dev.rxlock));
if (skb != NULL)
{
copy_length = min(skb->len,(u32)length);
CHECK_RET(copy_to_user((int __user *)buf, skb->data, copy_length));
dev_kfree_skb_any(skb);
}
return copy_length;
}
static ssize_t ssv_huw_write(struct file *fp, const char __user * buf, size_t length, loff_t * offset)
{
struct sk_buff *skb;
unsigned int len = (unsigned int)length;
len = (len & 0x1f)?(((len>>5) + 1)<<5):len;
skb = __dev_alloc_skb(len, GFP_KERNEL);
if (skb == NULL)
{
dev_err(g_huw_dev.dev,"%s: error : alloc buf error size:%d",__FUNCTION__,(u32)len);
return -ENOMEM;
}
CHECK_RET(copy_from_user(skb->data, (int __user *)buf, length));
skb_put(skb, length);
HCI_SEND(&g_huw_dev, skb, 1);
return length;
}
void ssv_huw_tx_cb(struct sk_buff_head *skb_head, void *args)
{
struct sk_buff *skb = NULL;
while ((skb=skb_dequeue(skb_head)))
{
dev_kfree_skb_any(skb);
skb = NULL;
}
}
int ssv_huw_read_hci_info(struct ssv_huw_dev *phuw_dev)
{
struct ssv6xxx_hci_info *pinfo = &(phuw_dev->hci);
pinfo->hci_ops = NULL;
pinfo->dev = phuw_dev->dev;
pinfo->hci_rx_cb = ssv_huw_rx;
pinfo->rx_cb_args = (void *)phuw_dev;
pinfo->hci_tx_cb= ssv_huw_tx_cb;
pinfo->tx_cb_args = NULL;
pinfo->hci_skb_update_cb = NULL;
pinfo->skb_update_args = NULL;
pinfo->hci_tx_flow_ctrl_cb = NULL;
pinfo->tx_fctrl_cb_args = NULL;
pinfo->hci_tx_q_empty_cb = NULL;
pinfo->tx_q_empty_args = NULL;
pinfo->hci_tx_buf_free_cb = ssv_huw_txbuf_free_skb;
pinfo->tx_buf_free_args = NULL;
pinfo->if_ops = phuw_dev->priv->ops;
return 0;
}
struct file_operations s_huw_ops =
{
.read = ssv_huw_read,
.write = ssv_huw_write,
.unlocked_ioctl = ssv_huw_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ssv_huw_compat_ioctl,
#endif
.open = ssv_huw_open,
.release = ssv_huw_release,
};
static int ssv_huw_init_buf(struct ssv_huw_dev *hdev)
{
init_waitqueue_head(&hdev->read_wq);
spin_lock_init(&hdev->rxlock);
skb_queue_head_init(&(hdev->rx_skb_q));
return 0;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
static char *ssv_huw_devnode(struct device *dev, umode_t *mode)
#else
static char *ssv_huw_devnode(struct device *dev, mode_t *mode)
#endif
{
if (!mode)
return NULL;
*mode = 0666;
return NULL;
}
int ssv_huw_probe(struct platform_device *pdev)
{
dev_t dev;
int alloc_ret = 0;
int cdev_ret = 0;
if (!pdev->dev.platform_data) {
dev_err(&pdev->dev, "no platform data specified!\n");
return -EINVAL;
}
ssv_huw_init_buf(&g_huw_dev);
g_huw_dev.priv = (pdev->dev.platform_data);
g_huw_dev.dev = &(pdev->dev);
ssv_huw_read_hci_info(&g_huw_dev);
ssv6xxx_hci_register(&(g_huw_dev.hci));
dev = MKDEV(ssv_sdiobridge_ioctl_major, 0);
alloc_ret = alloc_chrdev_region(&dev, 0, num_of_dev, FILE_DEVICE_SSVSDIO_NAME);
if (alloc_ret)
goto error;
ssv_sdiobridge_ioctl_major = MAJOR(dev);
cdev_init(&ssv_sdiobridge_ioctl_cdev, &s_huw_ops);
cdev_ret = cdev_add(&ssv_sdiobridge_ioctl_cdev, dev, num_of_dev);
if (cdev_ret)
goto error;
fc=class_create(THIS_MODULE, FILE_DEVICE_SSVSDIO_NAME);
fc->devnode = ssv_huw_devnode;
device_create(fc,NULL,dev,NULL,"%s",FILE_DEVICE_SSVSDIO_NAME);
dev_err(&pdev->dev, "%s driver(major: %d) installed.\n", FILE_DEVICE_SSVSDIO_NAME, ssv_sdiobridge_ioctl_major);
return 0;
error:
if (cdev_ret == 0)
cdev_del(&ssv_sdiobridge_ioctl_cdev);
if (alloc_ret == 0)
unregister_chrdev_region(dev, num_of_dev);
return -ENODEV;
}
EXPORT_SYMBOL(ssv_huw_probe);
int ssv_huw_remove(struct platform_device *pdev)
{
dev_t dev;
int ret = 0;
ssv6xxx_hci_deregister();
memset(&g_huw_dev, 0 , sizeof(g_huw_dev));
dev = MKDEV(ssv_sdiobridge_ioctl_major, 0);
device_destroy(fc,dev);
class_destroy(fc);
cdev_del(&ssv_sdiobridge_ioctl_cdev);
unregister_chrdev_region(dev, num_of_dev);
return ret;
}
EXPORT_SYMBOL(ssv_huw_remove);
static const struct platform_device_id huw_id_table[] = {
{
.name = "ssv6200",
.driver_data = 0x00,
},
{},
};
MODULE_DEVICE_TABLE(platform, huw_id_table);
static struct platform_driver ssv_huw_driver =
{
.probe = ssv_huw_probe,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
.remove = __devexit_p(ssv_huw_remove),
#else
.remove = ssv_huw_remove,
#endif
.id_table = huw_id_table,
.driver = {
.name = "SSV WLAN driver",
.owner = THIS_MODULE,
}
};
#if (defined(CONFIG_SSV_SUPPORT_ANDROID)||defined(CONFIG_SSV_BUILD_AS_ONE_KO))
int ssv_huw_init(void)
#else
static int __init ssv_huw_init(void)
#endif
{
int ret;
memset(&g_huw_dev, 0 , sizeof(g_huw_dev));
ret = platform_driver_register(&ssv_huw_driver);
if (ret < 0)
{
printk(KERN_ALERT "[HCI user-space wrapper]: Fail to register huw\n");
}
return ret;
}
#if (defined(CONFIG_SSV_SUPPORT_ANDROID)||defined(CONFIG_SSV_BUILD_AS_ONE_KO))
void ssv_huw_exit(void)
#else
static void __exit ssv_huw_exit(void)
#endif
{
platform_driver_unregister(&ssv_huw_driver);
}
#if (defined(CONFIG_SSV_SUPPORT_ANDROID)||defined(CONFIG_SSV_BUILD_AS_ONE_KO))
EXPORT_SYMBOL(ssv_huw_init);
EXPORT_SYMBOL(ssv_huw_exit);
#else
module_init(ssv_huw_init);
module_exit(ssv_huw_exit);
#endif
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,108 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SSV_HUW_H_
#define _SSV_HUW_H_
#include <linux/ioctl.h>
struct ssv_huw_cmd {
__u32 in_data_len;
u8* in_data;
#ifndef __x86_64
__u32 padding1;
#endif
__u32 out_data_len;
u8* out_data;
#ifndef __x86_64
__u32 padding2;
#endif
__u32 response;
}__attribute__((packed));
#define FILE_DEVICE_SSVSDIO MMC_BLOCK_MAJOR
#define FILE_DEVICE_SSVSDIO_SEQ 0x50
#define FILE_DEVICE_SSVSDIO_NAME "ssvhuwdev"
#if 0
#define IOCTL_SSVSDIO_GET_DRIVER_VERSION \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x01, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_FUNCTION_NUMBER \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x02, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_FUNCTION_FOCUS \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x03, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_FUNCTION_FOCUS \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x04, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_BUS_WIDTH \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x05, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_BUS_WIDTH \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x06, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_BUS_CLOCK \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x07, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_BUS_CLOCK \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x08, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_BLOCK_MODE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x09, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_BLOCK_MODE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0a, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0b, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0c, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_FN0_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0d, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_FN0_BLOCKLEN \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0e, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_BUS_INTERFACE_CONTROL \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x0f, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_BUS_INTERFACE_CONTROL \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x10, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_INT_ENABLE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x11, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_INT_ENABLE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x12, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_AUTO_ACK_INT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x13, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_AUTO_ACK_INT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x14, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_ACK_INT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x15, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_READ_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x16, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_WRITE_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x17, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_MULTI_BYTE_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x18, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_MULTI_BYTE_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x19, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_READ_MULTI_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1a, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_WRITE_MULTI_BYTE \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1b, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_GET_MULTI_BYTE_REG_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1c, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_SET_MULTI_BYTE_REG_IO_PORT \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1d, struct ssv_huw_cmd)
#endif
#define IOCTL_SSVSDIO_READ_REG \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1e, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_WRITE_REG \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x1f, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_READ_DATA \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x20, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_WRITE_SRAM \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x21, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_START \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x22, struct ssv_huw_cmd)
#define IOCTL_SSVSDIO_STOP \
_IOWR( FILE_DEVICE_SSVSDIO, FILE_DEVICE_SSVSDIO_SEQ+0x23, struct ssv_huw_cmd)
#endif

View File

@ -0,0 +1,84 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LINUX_SSVCABRIO_PLATFORM_H
#define _LINUX_SSVCABRIO_PLATFORM_H
#include <linux/mmc/host.h>
#include <hwif/sdio/sdio_def.h>
#define SSVCABRIO_PLAT_EEP_MAX_WORDS 2048
#define SSV_REG_WRITE(dev,reg,val) \
(sh)->priv->ops->writereg((sh)->sc->dev, (reg), (val))
#define SSV_REG_READ(dev,reg,buf) \
(sh)->priv->ops->readreg((sh)->sc->dev, (reg), (buf))
#if 0
#define SSV_REG_WRITE(sh,reg,val) \
(sh)->priv->ops->writereg((sh)->sc->dev, (reg), (val))
#define SSV_REG_READ(sh,reg,buf) \
(sh)->priv->ops->readreg((sh)->sc->dev, (reg), (buf))
#define SSV_REG_CONFIRM(sh,reg,val) \
{ \
u32 regval; \
SSV_REG_READ(sh, reg, &regval); \
if (regval != (val)) { \
printk("[0x%08x]: 0x%08x!=0x%08x\n",\
(reg), (val), regval); \
return -1; \
} \
}
#define SSV_REG_SET_BITS(sh,reg,set,clr) \
{ \
u32 reg_val; \
SSV_REG_READ(sh, reg, &reg_val); \
reg_val &= ~(clr); \
reg_val |= (set); \
SSV_REG_WRITE(sh, reg, reg_val); \
}
#endif
struct ssv6xxx_hwif_ops {
int __must_check (*read)(struct device *child, void *buf,size_t *size);
int __must_check (*write)(struct device *child, void *buf, size_t len,u8 queue_num);
int __must_check (*readreg)(struct device *child, u32 addr, u32 *buf);
int __must_check (*writereg)(struct device *child, u32 addr, u32 buf);
int (*trigger_tx_rx)(struct device *child);
int (*irq_getmask)(struct device *child, u32 *mask);
void (*irq_setmask)(struct device *child,int mask);
void (*irq_enable)(struct device *child);
void (*irq_disable)(struct device *child,bool iswaitirq);
int (*irq_getstatus)(struct device *child,int *status);
void (*irq_request)(struct device *child,irq_handler_t irq_handler,void *irq_dev);
void (*irq_trigger)(struct device *child);
void (*pmu_wakeup)(struct device *child);
int __must_check (*load_fw)(struct device *child, u8 *firmware_name, u8 openfile);
int (*cmd52_read)(struct device *child, u32 addr, u32 *value);
int (*cmd52_write)(struct device *child, u32 addr, u32 value);
bool (*support_scatter)(struct device *child);
int (*rw_scatter)(struct device *child, struct sdio_scatter_req *scat_req);
bool (*is_ready)(struct device *child);
int (*write_sram)(struct device *child, u32 addr, u8 *data, u32 size);
void (*interface_reset)(struct device *child);
};
struct ssv6xxx_if_debug {
struct device *dev;
struct platform_device *pdev;
};
struct ssv6xxx_platform_data {
atomic_t irq_handling;
bool is_enabled;
unsigned short vendor;
unsigned short device;
struct ssv6xxx_hwif_ops *ops;
};
#endif

View File

@ -0,0 +1,21 @@
ifeq ($(KBUILD_TOP),)
ifneq ($(KBUILD_EXTMOD),)
KBUILD_DIR := $(KBUILD_EXTMOD)
else
KBUILD_DIR := $(PWD)
endif
KBUILD_TOP := $(KBUILD_DIR)/../../
endif
include $(KBUILD_TOP)/config.mak
KBUILD_EXTRA_SYMBOLS += $(KBUILD_TOP)/smac/Module.symvers
ifeq ($(DRV_OPT), HUW_DRV)
KBUILD_EXTRA_SYMBOLS += $(KBUILD_TOP)/hci_wrapper/Module.symvers
endif
KBUILD_EXTRA_SYMBOLS += $(KBUILD_TOP)/ssvdevice/Module.symvers
KMODULE_NAME=ssv6200_sdio
KERN_SRCS := sdio.c
include $(KBUILD_TOP)/rules.mak

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SDIO_DEF_H_
#define _SDIO_DEF_H_
#include <linux/scatterlist.h>
#define BASE_SDIO 0
#define REG_DATA_IO_PORT_0 (BASE_SDIO + 0x00)
#define REG_DATA_IO_PORT_1 (BASE_SDIO + 0x01)
#define REG_DATA_IO_PORT_2 (BASE_SDIO + 0x02)
#define REG_INT_MASK (BASE_SDIO + 0x04)
#define REG_INT_STATUS (BASE_SDIO + 0x08)
#define REG_INT_TRIGGER (BASE_SDIO + 0x09)
#define REG_Fn1_STATUS (BASE_SDIO + 0x0c)
#define REG_CARD_PKT_LEN_0 (BASE_SDIO + 0x10)
#define REG_CARD_PKT_LEN_1 (BASE_SDIO + 0x11)
#define REG_CARD_FW_DL_STATUS (BASE_SDIO + 0x12)
#define REG_CARD_SELF_TEST (BASE_SDIO + 0x13)
#define REG_CARD_RCA_0 (BASE_SDIO + 0x20)
#define REG_CARD_RCA_1 (BASE_SDIO + 0x21)
#define REG_SDIO_FIFO_WR_THLD_0 (BASE_SDIO + 0x24)
#define REG_SDIO_FIFO_WR_THLD_1 (BASE_SDIO + 0x25)
#define REG_OUTPUT_TIMING_REG (BASE_SDIO + 0x55)
#define REG_PMU_WAKEUP (BASE_SDIO + 0x67)
#define REG_REG_IO_PORT_0 (BASE_SDIO + 0x70)
#define REG_REG_IO_PORT_1 (BASE_SDIO + 0x71)
#define REG_REG_IO_PORT_2 (BASE_SDIO + 0x72)
#define REG_SDIO_TX_ALLOC_SIZE (BASE_SDIO + 0x98)
#define REG_SDIO_TX_ALLOC_SHIFT (BASE_SDIO + 0x99)
#define REG_SDIO_TX_ALLOC_STATE (BASE_SDIO + 0x9a)
#define REG_SDIO_TX_INFORM_0 (BASE_SDIO + 0x9c)
#define REG_SDIO_TX_INFORM_1 (BASE_SDIO + 0x9d)
#define REG_SDIO_TX_INFORM_2 (BASE_SDIO + 0x9e)
#if 0
#define SDIO_TX_ALLOC_SUCCESS 0x01
#define SDIO_TX_NO_ALLOC 0x02
#define SDIO_TX_DULPICATE_ALLOC 0x04
#define SDIO_TX_TX_DONE 0x08
#define SDIO_TX_AHB_HANG 0x10
#define SDIO_TX_MB_FULL 0x80
#define SDIO_HCI_IN_QUEUE_EMPTY 0x04
#define SDIO_EDCA0_SHIFT 4
#define SDIO_TX_ALLOC_SIZE_SHIFT 0x07
#define SDIO_TX_ALLOC_ENABLE 0x10
#endif
#define SDIO_DEF_BLOCK_SIZE 0x80
#if (SDIO_DEF_BLOCK_SIZE % 8)
#error Wrong SDIO_DEF_BLOCK_SIZE value!! Should be the multiple of 8 bytes!!!!!!!!!!!!!!!!!!!!!!
#endif
#define SDIO_DEF_OUTPUT_TIMING 0
#define SDIO_DEF_BLOCK_MODE_THRD 128
#if (SDIO_DEF_BLOCK_MODE_THRD % 8)
#error Wrong SDIO_DEF_BLOCK_MODE_THRD value!! Should be the multiple of 8 bytes!!!!!!!!!!!!!!!!!!!!!!
#endif
#define SDIO_DEF_FORCE_BLOCK_MODE 0
#define MAX_SCATTER_ENTRIES_PER_REQ 8
struct sdio_scatter_item {
u8 *buf;
int len;
};
struct sdio_scatter_req {
u32 req;
u32 len;
int scat_entries;
struct sdio_scatter_item scat_list[MAX_SCATTER_ENTRIES_PER_REQ];
struct scatterlist sgentries[MAX_SCATTER_ENTRIES_PER_REQ];
};
#define SDIO_READ 0x00000001
#define SDIO_WRITE 0x00000002
#define CMD53_ARG_READ 0
#define CMD53_ARG_WRITE 1
#define CMD53_ARG_BLOCK_BASIS 1
#define CMD53_ARG_FIXED_ADDRESS 0
#define CMD53_ARG_INCR_ADDRESS 1
#ifdef CONFIG_FW_ALIGNMENT_CHECK
#define SDIO_DMA_BUFFER_LEN 2048
#endif
#ifdef CONFIG_PM
#define SDIO_COMMAND_BUFFER_LEN 256
#endif
#endif

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef CABRIO_H
#define CABRIO_H
#define SSV_VENDOR_ID 0x3030
#define SSV_CABRIO_DEVID 0x3030
#define SSV_SUBVENDOR_ID_NOG 0x0e11
#define SSV_SUBVENDOR_ID_NEW_A 0x7065
#define SSV_CABRIO_MAGIC 0x19641014
#define SSV_AMPDU_LIMIT_MAX (64 * 1024 - 1)
#define SSV_DEFAULT_NOISE_FLOOR -95
#define SSVCABRIO_RSSI_BAD -128
#define SSVCABRIO_NUM_CHANNELS 38
#endif

View File

@ -0,0 +1,98 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SSV6200_H_
#define _SSV6200_H_
#include <linux/device.h>
#include <linux/interrupt.h>
#include <net/mac80211.h>
#ifdef ECLIPSE
#include <ssv_mod_conf.h>
#endif
#include <ssv6200_reg.h>
#include <ssv6200_aux.h>
#include <hwif/hwif.h>
#include <hci/ssv_hci.h>
#include "ssv6200_common.h"
#ifdef SSV6200_ECO
#define SSV6200_TOTAL_ID 128
#ifndef HUW_DRV
#define SSV6200_ID_TX_THRESHOLD 19
#define SSV6200_ID_RX_THRESHOLD 60
#define SSV6200_PAGE_TX_THRESHOLD 115
#define SSV6200_PAGE_RX_THRESHOLD 115
#define SSV6XXX_AMPDU_DIVIDER (2)
#define SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER (SSV6200_PAGE_TX_THRESHOLD - (SSV6200_PAGE_TX_THRESHOLD/SSV6XXX_AMPDU_DIVIDER))
#define SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER 2
#else
#undef SSV6200_ID_TX_THRESHOLD
#undef SSV6200_ID_RX_THRESHOLD
#undef SSV6200_PAGE_TX_THRESHOLD
#undef SSV6200_PAGE_RX_THRESHOLD
#undef SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER
#undef SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER
#define SSV6200_ID_TX_THRESHOLD 31
#define SSV6200_ID_RX_THRESHOLD 31
#define SSV6200_PAGE_TX_THRESHOLD 61
#define SSV6200_PAGE_RX_THRESHOLD 61
#define SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER 45
#define SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER 2
#endif
#else
#undef SSV6200_ID_TX_THRESHOLD
#undef SSV6200_ID_RX_THRESHOLD
#undef SSV6200_PAGE_TX_THRESHOLD
#undef SSV6200_PAGE_RX_THRESHOLD
#undef SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER
#undef SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER
#define SSV6200_ID_TX_THRESHOLD 63
#define SSV6200_ID_RX_THRESHOLD 63
#ifdef PREFER_RX
#define SSV6200_PAGE_TX_THRESHOLD (126-24)
#define SSV6200_PAGE_RX_THRESHOLD (126+24)
#else
#undef SSV6200_PAGE_TX_THRESHOLD
#undef SSV6200_PAGE_RX_THRESHOLD
#define SSV6200_PAGE_TX_THRESHOLD 126
#define SSV6200_PAGE_RX_THRESHOLD 126
#endif
#define SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER (SSV6200_PAGE_TX_THRESHOLD/2)
#define SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER 2
#endif
#define SSV6200_ID_NUMBER (128)
#define PACKET_ADDR_2_ID(addr) ((addr >> 16) & 0x7F)
#define SSV6200_ID_AC_RESERVED 1
#define SSV6200_ID_AC_BK_OUT_QUEUE 8
#define SSV6200_ID_AC_BE_OUT_QUEUE 15
#define SSV6200_ID_AC_VI_OUT_QUEUE 16
#define SSV6200_ID_AC_VO_OUT_QUEUE 16
#define SSV6200_ID_MANAGER_QUEUE 8
#define HW_MMU_PAGE_SHIFT 0x8
#define HW_MMU_PAGE_MASK 0xff
#define SSV6200_BT_PRI_SMP_TIME 0
#define SSV6200_BT_STA_SMP_TIME (SSV6200_BT_PRI_SMP_TIME+0)
#define SSV6200_WLAN_REMAIN_TIME 0
#define BT_2WIRE_EN_MSK 0x00000400
struct txResourceControl {
u32 txUsePage:8;
u32 txUseID:6;
u32 edca0:4;
u32 edca1:4;
u32 edca2:5;
u32 edca3:5;
};
#include <ssv_cfg.h>
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,483 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SSV6200_COMMON_H_
#define _SSV6200_COMMON_H_
#define FW_VERSION_REG ADR_TX_SEG
#define M_ENG_CPU 0x00
#define M_ENG_HWHCI 0x01
#define M_ENG_EMPTY 0x02
#define M_ENG_ENCRYPT 0x03
#define M_ENG_MACRX 0x04
#define M_ENG_MIC 0x05
#define M_ENG_TX_EDCA0 0x06
#define M_ENG_TX_EDCA1 0x07
#define M_ENG_TX_EDCA2 0x08
#define M_ENG_TX_EDCA3 0x09
#define M_ENG_TX_MNG 0x0A
#define M_ENG_ENCRYPT_SEC 0x0B
#define M_ENG_MIC_SEC 0x0C
#define M_ENG_RESERVED_1 0x0D
#define M_ENG_RESERVED_2 0x0E
#define M_ENG_TRASH_CAN 0x0F
#define M_ENG_MAX (M_ENG_TRASH_CAN+1)
#define M_CPU_HWENG 0x00
#define M_CPU_TXL34CS 0x01
#define M_CPU_RXL34CS 0x02
#define M_CPU_DEFRAG 0x03
#define M_CPU_EDCATX 0x04
#define M_CPU_RXDATA 0x05
#define M_CPU_RXMGMT 0x06
#define M_CPU_RXCTRL 0x07
#define M_CPU_FRAG 0x08
#define M_CPU_TXTPUT 0x09
#ifndef ID_TRAP_SW_TXTPUT
#define ID_TRAP_SW_TXTPUT 50
#endif
#define M0_TXREQ 0
#define M1_TXREQ 1
#define M2_TXREQ 2
#define M0_RXEVENT 3
#define M2_RXEVENT 4
#define HOST_CMD 5
#define HOST_EVENT 6
#define TEST_CMD 7
#define SSV6XXX_RX_DESC_LEN \
(sizeof(struct ssv6200_rx_desc) + \
sizeof(struct ssv6200_rxphy_info))
#define SSV6XXX_TX_DESC_LEN \
(sizeof(struct ssv6200_tx_desc) + 0)
#define TXPB_OFFSET 80
#define RXPB_OFFSET 80
#define SSV6200_TX_PKT_RSVD_SETTING 0x3
#define SSV6200_TX_PKT_RSVD SSV6200_TX_PKT_RSVD_SETTING*16
#define SSV6200_ALLOC_RSVD TXPB_OFFSET+SSV6200_TX_PKT_RSVD
#define SSV62XX_TX_MAX_RATES 3
enum ssv6xxx_sr_bhvr {
SUSPEND_RESUME_0,
SUSPEND_RESUME_1,
SUSPEND_RESUME_MAX
};
enum ssv6xxx_reboot_bhvr {
SSV_SYS_REBOOT = 1,
SSV_SYS_HALF,
SSV_SYS_POWER_OFF
};
struct fw_rc_retry_params {
u32 count:4;
u32 drate:6;
u32 crate:6;
u32 rts_cts_nav:16;
u32 frame_consume_time:10;
u32 dl_length:12;
u32 RSVD:10;
} __attribute__((packed));
struct ssv6200_tx_desc
{
u32 len:16;
u32 c_type:3;
u32 f80211:1;
u32 qos:1;
u32 ht:1;
u32 use_4addr:1;
u32 RSVD_0:3;
u32 bc_que:1;
u32 security:1;
u32 more_data:1;
u32 stype_b5b4:2;
u32 extra_info:1;
u32 fCmd;
u32 hdr_offset:8;
u32 frag:1;
u32 unicast:1;
u32 hdr_len:6;
u32 tx_report:1;
u32 tx_burst:1;
u32 ack_policy:2;
u32 aggregation:1;
u32 RSVD_1:3;
u32 do_rts_cts:2;
u32 reason:6;
u32 payload_offset:8;
u32 RSVD_4:7;
u32 RSVD_2:1;
u32 fCmdIdx:3;
u32 wsid:4;
u32 txq_idx:3;
u32 TxF_ID:6;
u32 rts_cts_nav:16;
u32 frame_consume_time:10;
u32 crate_idx:6;
u32 drate_idx:6;
u32 dl_length:12;
u32 RSVD_3:14;
u32 RESERVED[8];
struct fw_rc_retry_params rc_params[SSV62XX_TX_MAX_RATES];
};
struct ssv6200_rx_desc
{
u32 len:16;
u32 c_type:3;
u32 f80211:1;
u32 qos:1;
u32 ht:1;
u32 use_4addr:1;
u32 l3cs_err:1;
u32 l4cs_err:1;
u32 align2:1;
u32 RSVD_0:2;
u32 psm:1;
u32 stype_b5b4:2;
u32 extra_info:1;
u32 edca0_used:4;
u32 edca1_used:5;
u32 edca2_used:5;
u32 edca3_used:5;
u32 mng_used:4;
u32 tx_page_used:9;
u32 hdr_offset:8;
u32 frag:1;
u32 unicast:1;
u32 hdr_len:6;
u32 RxResult:8;
u32 wildcard_bssid:1;
u32 RSVD_1:1;
u32 reason:6;
u32 payload_offset:8;
u32 tx_id_used:8;
u32 fCmdIdx:3;
u32 wsid:4;
u32 RSVD_3:3;
u32 rate_idx:6;
};
struct ssv6200_rxphy_info {
u32 len:16;
u32 rsvd0:16;
u32 mode:3;
u32 ch_bw:3;
u32 preamble:1;
u32 ht_short_gi:1;
u32 rate:7;
u32 rsvd1:1;
u32 smoothing:1;
u32 no_sounding:1;
u32 aggregate:1;
u32 stbc:2;
u32 fec:1;
u32 n_ess:2;
u32 rsvd2:8;
u32 l_length:12;
u32 l_rate:3;
u32 rsvd3:17;
u32 rsvd4;
u32 rpci:8;
u32 snr:8;
u32 service:16;
};
struct ssv6200_rxphy_info_padding {
u32 rpci:8;
u32 snr:8;
u32 RSVD:16;
};
struct ssv6200_txphy_info {
u32 rsvd[7];
};
#ifdef CONFIG_P2P_NOA
struct ssv6xxx_p2p_noa_param {
u32 duration;
u32 interval;
u32 start_time;
u32 enable:8;
u32 count:8;
u8 addr[6];
u8 vif_id;
}__attribute__((packed));
#endif
typedef struct cfg_host_cmd {
u32 len:16;
u32 c_type:3;
u32 RSVD0:5;
u32 h_cmd:8;
u32 cmd_seq_no;
union {
u32 dummy;
u8 dat8[0];
u16 dat16[0];
u32 dat32[0];
};
} HDR_HostCmd;
#define HOST_CMD_HDR_LEN ((size_t)(((HDR_HostCmd *)100)->dat8)-100U)
struct sdio_rxtput_cfg {
u32 size_per_frame;
u32 total_frames;
};
typedef enum{
SSV6XXX_HOST_CMD_START = 0 ,
SSV6XXX_HOST_CMD_LOG ,
SSV6XXX_HOST_CMD_PS ,
SSV6XXX_HOST_CMD_INIT_CALI ,
SSV6XXX_HOST_CMD_RX_TPUT ,
SSV6XXX_HOST_CMD_TX_TPUT ,
SSV6XXX_HOST_CMD_WATCHDOG_START,
SSV6XXX_HOST_CMD_WATCHDOG_STOP,
#ifdef FW_WSID_WATCH_LIST
SSV6XXX_HOST_CMD_WSID_OP ,
#endif
#ifdef CONFIG_P2P_NOA
SSV6XXX_HOST_CMD_SET_NOA ,
#endif
SSV6XXX_HOST_SOC_CMD_MAXID ,
}ssv6xxx_host_cmd_id;
#define SSV_NUM_HW_STA 2
typedef struct cfg_host_event {
u32 len:16;
u32 c_type:3;
u32 RSVD0:5;
u32 h_event:8;
u32 evt_seq_no;
u8 dat[0];
} HDR_HostEvent;
typedef enum{
#ifdef USE_CMD_RESP
SOC_EVT_CMD_RESP ,
SOC_EVT_SCAN_RESULT ,
SOC_EVT_DEAUTH ,
#else
SOC_EVT_GET_REG_RESP ,
#endif
SOC_EVT_NO_BA ,
SOC_EVT_RC_MPDU_REPORT ,
SOC_EVT_RC_AMPDU_REPORT ,
SOC_EVT_LOG ,
#ifdef CONFIG_P2P_NOA
SOC_EVT_NOA ,
#endif
SOC_EVT_USER_END ,
SOC_EVT_SDIO_TEST_COMMAND ,
SOC_EVT_RESET_HOST ,
SOC_EVT_SDIO_TXTPUT_RESULT ,
SOC_EVT_WATCHDOG_TRIGGER ,
SOC_EVT_TXLOOPBK_RESULT ,
SOC_EVT_MAXID ,
} ssv6xxx_soc_event;
#ifdef CONFIG_P2P_NOA
typedef enum{
SSV6XXX_NOA_START = 0 ,
SSV6XXX_NOA_STOP ,
}ssv6xxx_host_noa_event;
struct ssv62xx_noa_evt {
u8 evt_id;
u8 vif;
} __attribute__((packed));
#endif
typedef enum{
SSV6XXX_RC_COUNTER_CLEAR = 1 ,
SSV6XXX_RC_REPORT ,
}ssv6xxx_host_rate_control_event;
#define MAX_AGGR_NUM (24)
struct ssv62xx_tx_rate {
s8 data_rate;
u8 count;
} __attribute__((packed));
struct ampdu_ba_notify_data {
u8 wsid;
struct ssv62xx_tx_rate tried_rates[SSV62XX_TX_MAX_RATES];
u16 seq_no[MAX_AGGR_NUM];
} __attribute__((packed));
struct firmware_rate_control_report_data{
u8 wsid;
struct ssv62xx_tx_rate rates[SSV62XX_TX_MAX_RATES];
u16 ampdu_len;
u16 ampdu_ack_len;
int ack_signal;
} __attribute__((packed));
#define RC_RETRY_PARAM_OFFSET ((sizeof(struct fw_rc_retry_params))*SSV62XX_TX_MAX_RATES)
#define SSV_RC_RATE_MAX 39
#ifdef FW_WSID_WATCH_LIST
enum SSV6XXX_WSID_OPS
{
SSV6XXX_WSID_OPS_ADD,
SSV6XXX_WSID_OPS_DEL,
SSV6XXX_WSID_OPS_RESETALL,
SSV6XXX_WSID_OPS_ENABLE_CAPS,
SSV6XXX_WSID_OPS_DISABLE_CAPS,
SSV6XXX_WSID_OPS_HWWSID_PAIRWISE_SET_TYPE,
SSV6XXX_WSID_OPS_HWWSID_GROUP_SET_TYPE,
SSV6XXX_WSID_OPS_MAX
};
enum SSV6XXX_WSID_SEC
{
SSV6XXX_WSID_SEC_NONE = 0,
SSV6XXX_WSID_SEC_PAIRWISE = 1<<0,
SSV6XXX_WSID_SEC_GROUP = 1<<1,
};
enum SSV6XXX_WSID_SEC_TYPE
{
SSV6XXX_WSID_SEC_SW,
SSV6XXX_WSID_SEC_HW,
SSV6XXX_WSID_SEC_TYPE_MAX
};
enum SSV6XXX_RETURN_STATE
{
SSV6XXX_STATE_OK,
SSV6XXX_STATE_NG,
SSV6XXX_STATE_MAX
};
struct ssv6xxx_wsid_params
{
u8 cmd;
u8 wsid_idx;
u8 target_wsid[6];
u8 hw_security;
};
#endif
struct ssv6xxx_iqk_cfg {
u32 cfg_xtal:8;
u32 cfg_pa:8;
u32 cfg_pabias_ctrl:8;
u32 cfg_pacascode_ctrl:8;
u32 cfg_tssi_trgt:8;
u32 cfg_tssi_div:8;
u32 cfg_def_tx_scale_11b:8;
u32 cfg_def_tx_scale_11b_p0d5:8;
u32 cfg_def_tx_scale_11g:8;
u32 cfg_def_tx_scale_11g_p0d5:8;
u32 cmd_sel;
union {
u32 fx_sel;
u32 argv;
};
u32 phy_tbl_size;
u32 rf_tbl_size;
};
#define PHY_SETTING_SIZE sizeof(phy_setting)
#ifdef CONFIG_SSV_CABRIO_E
struct ssv6xxx_ch_cfg {
u32 reg_addr;
u32 ch1_12_value;
u32 ch13_14_value;
};
#define IQK_CFG_LEN (sizeof(struct ssv6xxx_iqk_cfg))
#define RF_SETTING_SIZE (sizeof(asic_rf_setting))
#endif
#define MAX_PHY_SETTING_TABLE_SIZE 1920
#define MAX_RF_SETTING_TABLE_SIZE 512
typedef enum {
SSV6XXX_VOLT_DCDC_CONVERT = 0,
SSV6XXX_VOLT_LDO_CONVERT,
} ssv6xxx_cfg_volt;
typedef enum {
SSV6XXX_VOLT_33V = 0,
SSV6XXX_VOLT_42V,
} ssv6xxx_cfg_volt_value;
typedef enum {
SSV6XXX_IQK_CFG_XTAL_26M = 0,
SSV6XXX_IQK_CFG_XTAL_40M,
SSV6XXX_IQK_CFG_XTAL_24M,
SSV6XXX_IQK_CFG_XTAL_MAX,
} ssv6xxx_iqk_cfg_xtal;
typedef enum {
SSV6XXX_IQK_CFG_PA_DEF = 0,
SSV6XXX_IQK_CFG_PA_LI_MPB,
SSV6XXX_IQK_CFG_PA_LI_EVB,
SSV6XXX_IQK_CFG_PA_HP,
} ssv6xxx_iqk_cfg_pa;
typedef enum {
SSV6XXX_IQK_CMD_INIT_CALI = 0,
SSV6XXX_IQK_CMD_RTBL_LOAD,
SSV6XXX_IQK_CMD_RTBL_LOAD_DEF,
SSV6XXX_IQK_CMD_RTBL_RESET,
SSV6XXX_IQK_CMD_RTBL_SET,
SSV6XXX_IQK_CMD_RTBL_EXPORT,
SSV6XXX_IQK_CMD_TK_EVM,
SSV6XXX_IQK_CMD_TK_TONE,
SSV6XXX_IQK_CMD_TK_CHCH,
} ssv6xxx_iqk_cmd_sel;
#define SSV6XXX_IQK_TEMPERATURE 0x00000004
#define SSV6XXX_IQK_RXDC 0x00000008
#define SSV6XXX_IQK_RXRC 0x00000010
#define SSV6XXX_IQK_TXDC 0x00000020
#define SSV6XXX_IQK_TXIQ 0x00000040
#define SSV6XXX_IQK_RXIQ 0x00000080
#define SSV6XXX_IQK_TSSI 0x00000100
#define SSV6XXX_IQK_PAPD 0x00000200
typedef struct ssv_cabrio_reg_st {
u32 address;
u32 data;
} ssv_cabrio_reg;
typedef enum __PBuf_Type_E {
NOTYPE_BUF = 0,
TX_BUF = 1,
RX_BUF = 2
} PBuf_Type_E;
struct SKB_info_st
{
struct ieee80211_sta *sta;
u16 mpdu_retry_counter;
unsigned long aggr_timestamp;
u16 ampdu_tx_status;
u16 ampdu_tx_final_retry_count;
u16 lowest_rate;
struct fw_rc_retry_params rates[SSV62XX_TX_MAX_RATES];
#ifdef CONFIG_DEBUG_SKB_TIMESTAMP
ktime_t timestamp;
#endif
#ifdef MULTI_THREAD_ENCRYPT
volatile u8 crypt_st;
#endif
};
typedef struct SKB_info_st SKB_info;
typedef struct SKB_info_st *p_SKB_info;
#define SSV_SKB_info_size (sizeof(struct SKB_info_st))
#ifdef MULTI_THREAD_ENCRYPT
enum ssv_pkt_crypt_status
{
PKT_CRYPT_ST_DEC_PRE,
PKT_CRYPT_ST_ENC_PRE,
PKT_CRYPT_ST_DEC_DONE,
PKT_CRYPT_ST_ENC_DONE,
PKT_CRYPT_ST_FAIL,
PKT_CRYPT_ST_NOT_SUPPORT
};
#endif
#ifdef CONFIG_DEBUG_SKB_TIMESTAMP
#define SKB_DURATION_TIMEOUT_MS 100
enum ssv_debug_skb_timestamp
{
SKB_DURATION_STAGE_TX_ENQ,
SKB_DURATION_STAGE_TO_SDIO,
SKB_DURATION_STAGE_IN_HWQ,
SKB_DURATION_STAGE_END
};
#endif
#define SSV6051Q_P1 0x00000000
#define SSV6051Q_P2 0x70000000
#define SSV6051Z 0x71000000
#define SSV6051Q 0x73000000
#define SSV6051P 0x75000000
#ifdef CONFIG_SSV_CABRIO_E
struct ssv6xxx_tx_loopback {
u32 reg;
u32 val;
u32 restore_val;
u8 restore;
u8 delay_ms;
};
#endif
#endif

View File

@ -0,0 +1,374 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
static ssv_cabrio_reg phy_setting[]={
{0xce0071bc, 0x565B565B},
{0xce000008, 0x0000006a},
{0xce00000c, 0x00000064},
{0xce000010, 0x00007FFF},
{0xce000014, 0x00000003},
{0xce000018, 0x0055003C},
{0xce00001c, 0x00000064},
{0xce000020, 0x20000000},
{0xce00002c, 0x00000000},
{0xce000030, 0x80046072},
{0xce000034, 0x1f300f6f},
{0xce000038, 0x660F36D0},
{0xce00003c, 0x106C0004},
{0xce000040, 0x01601400},
{0xce000044, 0x00600008},
{0xce000048, 0xff000160},
{0xce00004c, 0x00000840},
{0xce000060, 0x01000405},
{0xce000064, 0x06090813},
{0xce000068, 0x12070000},
{0xce00006c, 0x01000405},
{0xce000070, 0x06090813},
{0xce000074, 0x12010000},
{0xce000078, 0x00000000},
{0xce00007c, 0x10110003},
{0xce000080, 0x0110000F},
{0xce000084, 0x00000000},
{0xce000088, 0x00000000},
{0xce000094, 0x01012425},
{0xce000098, 0x01010101},
{0xce00009c, 0x00000011},
{0xce0000a0, 0x1fff0000},
{0xce0000a4, 0x1fff0000},
{0xce0000a8, 0x1fff0000},
{0xce0000ac, 0x1fff0000},
{0xce0000b8, 0x0000fe3e},
{0xce0000fc, 0xffffffff},
{0xce000108, 0x0ead04f5},
{0xce00010c, 0x0fd60080},
{0xce000110, 0x00000009},
{0xce0010a4, 0x0000002c},
{0xce0010b4, 0x00003001},
{0xce0010d4, 0x00000001},
{0xce002000, 0x00000044},
{0xce002004, 0x00040000},
{0xce002008, 0x20300050},
{0xce00200c, 0x00003467},
{0xce002010, 0x00430000},
{0xce002014, 0x20304015},
{0xce002018, 0x00390005},
{0xce00201c, 0x05555555},
{0xce002020, 0x00570057},
{0xce002024, 0x00570057},
{0xce002028, 0x00236700},
{0xce00202c, 0x000d1746},
{0xce002030, 0x05061787},
{0xce002034, 0x07800000},
{0xce00209c, 0x00900008},
{0xce0020a0, 0x00000000},
{0xce0023f8, 0x00000000},
{0xce0023fc, 0x00000001},
{0xce0030a4, 0x00001901},
{0xce0030b8, 0x5d08908e},
{0xce004000, 0x00000044},
{0xce004004, 0x00750075},
{0xce004008, 0x00000075},
{0xce00400c, 0x10000075},
{0xce004010, 0x3F384905},
{0xce004014, 0x40182000},
{0xce004018, 0x20600000},
{0xce00401c, 0x0C010120},
{0xce004020, 0x50505050},
{0xce004024, 0x50000000},
{0xce004028, 0x50505050},
{0xce00402c, 0x506070A0},
{0xce004030, 0xF0000000},
{0xce004034, 0x00002424},
{0xce004038, 0x00001420},
{0xce00409c, 0x0000300A},
{0xce0040c0, 0x20000280},
{0xce0040c4, 0x30023002},
{0xce0040c8, 0x0000003a},
{0xce004130, 0x40000000},
{0xce004164, 0x009C007E},
{0xce004180, 0x00044400},
{0xce004188, 0x82000000},
{0xce004190, 0x00000000},
{0xce004194, 0xffffffff},
{0xce004380, 0x00700010},
{0xce004384, 0x00007575},
{0xce004388, 0x0001fe3e},
{0xce00438c, 0x0000fe3e},
{0xce0043f8, 0x00000001},
{0xce007000, 0x00000000},
{0xce007004, 0x00008000},
{0xce007008, 0x00000000},
{0xce00700c, 0x00000000},
{0xce007010, 0x00000000},
{0xce007014, 0x00000000},
{0xce007018, 0x00000000},
{0xce00701c, 0x00000000},
{0xce007020, 0x00000000},
{0xce007024, 0x00000000},
{0xce007028, 0x00000000},
{0xce00702c, 0x00000000},
{0xce007030, 0x00000000},
{0xce007034, 0x00000000},
{0xce007038, 0x00000000},
{0xce00703c, 0x00000000},
{0xce007040, 0x02000200},
{0xce007048, 0x00000000},
{0xce00704c, 0x00000000},
{0xce007050, 0x00000000},
{0xce007054, 0x00000000},
{0xce007058, 0x000028ff},
{0xce00705c, 0x00000000},
{0xce007060, 0x00000000},
{0xce007064, 0x00000000},
{0xce007068, 0x00000000},
{0xce00706c, 0x00000202},
{0xce007070, 0x80ffc200},
{0xce007074, 0x00000000},
{0xce007078, 0x00000000},
{0xce00707c, 0x00000000},
{0xce007080, 0x00000000},
{0xce007084, 0x00000000},
{0xce007088, 0x00000000},
{0xce00708c, 0x00000000},
{0xce007090, 0x00000000},
{0xce007094, 0x00000000},
{0xce007098, 0x00000000},
{0xce00709c, 0x00000000},
{0xce0070a0, 0x00000000},
{0xce0070a4, 0x00000000},
{0xce0070a8, 0x00000000},
{0xce0070ac, 0x00000000},
{0xce0070b0, 0x00000000},
{0xce0070b4, 0x00000000},
{0xce0070b8, 0x00000000},
{0xce0070bc, 0x00000000},
{0xce0070c0, 0x00000000},
{0xce0070c4, 0x00000000},
{0xce0070c8, 0x00000000},
{0xce0070cc, 0x00000000},
{0xce0070d0, 0x00000000},
{0xce0070d4, 0x00000000},
{0xce0070d8, 0x00000000},
{0xce0070dc, 0x00000000},
{0xce0070e0, 0x00000000},
{0xce0070e4, 0x00000000},
{0xce0070e8, 0x00000000},
{0xce0070ec, 0x00000000},
{0xce0070f0, 0x00000000},
{0xce0070f4, 0x00000000},
{0xce0070f8, 0x00000000},
{0xce0070fc, 0x00000000},
{0xce007100, 0x00000000},
{0xce007104, 0x00000000},
{0xce007108, 0x00000000},
{0xce00710c, 0x00000000},
{0xce007110, 0x00000000},
{0xce007114, 0x00000000},
{0xce007118, 0x00000000},
{0xce00711c, 0x00000000},
{0xce007120, 0x02000200},
{0xce007124, 0x02000200},
{0xce007128, 0x02000200},
{0xce00712c, 0x02000200},
{0xce007130, 0x02000200},
{0xce007134, 0x02000200},
{0xce007138, 0x02000200},
{0xce00713c, 0x02000200},
{0xce007140, 0x02000200},
{0xce007144, 0x02000200},
{0xce007148, 0x02000200},
{0xce00714c, 0x02000200},
{0xce007150, 0x02000200},
{0xce007154, 0x02000200},
{0xce007158, 0x00000000},
{0xce00715c, 0x00000000},
{0xce007160, 0x00000000},
{0xce007164, 0x00000000},
{0xce007168, 0x00000000},
{0xce00716c, 0x00000000},
{0xce007170, 0x00000000},
{0xce007174, 0x00000000},
{0xce007178, 0x00000000},
{0xce00717c, 0x00000000},
{0xce007180, 0x00000000},
{0xce007184, 0x00000000},
{0xce007188, 0x00000000},
{0xce00718c, 0x00000000},
{0xce007190, 0x00000000},
{0xce007194, 0x00000000},
{0xce007198, 0x00000000},
{0xce00719c, 0x00000000},
{0xce0071a0, 0x00000000},
{0xce0071a4, 0x00000000},
{0xce0071a8, 0x00000000},
{0xce0071ac, 0x00000000},
{0xce0071b0, 0x00000000},
{0xce0071b4, 0x00000100},
{0xce0071b8, 0x00000000},
{0xce0071c0, 0x00000000},
{0xce0071c4, 0x00000000},
{0xce0071c8, 0x00000000},
{0xce0071cc, 0x00000000},
{0xce0071d0, 0x00000000},
{0xce0071d4, 0x00000000},
{0xce0071d8, 0x00000000},
{0xce0071dc, 0x00000000},
{0xce0071e0, 0x00000000},
{0xce0071e4, 0x00000000},
{0xce0071e8, 0x00000000},
{0xce0071ec, 0x00000000},
{0xce0071f0, 0x00000000},
{0xce0071f4, 0x00000000},
{0xce0071f8, 0x00000000},
{0xce0071fc, 0x00000000},
#ifdef CONFIG_SSV_CABRIO_E
{0xce0043fc, 0x000104E5},
{0xce007044, 0x00028080},
{0xce000000, 0x80000016},
#endif
#ifdef CONFIG_SSV_CABRIO_A
{0xce0043fc, 0x000004e1},
{0xce007044, 0x00038080},
{0xce000000, 0x0000001e},
#endif
};
static const u32 wifi_tx_gain[]={
0x79807980,
0x72797279,
0x6C726C72,
0x666C666C,
0x60666066,
0x5B605B60,
0x565B565B,
0x51565156,
0x4C514C51,
0x484C484C,
0x44484448,
0x40444044,
0x3C403C40,
0x3A3D3A3D,
0x36393639,
};
#ifndef CONFIG_SSV_CABRIO_A
static ssv_cabrio_reg asic_rf_setting[]={
{0xCE010038, 0x0003E07C},
{0xCE010060, 0x00406000},
{0xCE01009C, 0x00000024},
{0xCE0100A0, 0x00EC4CC5},
{0xCE010000, 0x40002000},
{0xCE010004, 0x00020FC0},
{0xCE010008, 0x000DF69B},
{0xCE010014, 0x3D3E84FE},
{0xCE010018, 0x01457D79},
{0xCE01001C, 0x000103A7},
{0xCE010020, 0x000103A6},
{0xCE01002C, 0x00032CA8},
{0xCE010048, 0xFCCCCF27},
{0xCE010050, 0x00444000},
{0xCE01000C, 0x151558C5},
{0xCE010010, 0x01011A88},
{0xCE010024, 0x00012001},
{0xCE010028, 0x00036000},
{0xCE010030, 0x20EA0224},
{0xCE010034, 0x44000755},
{0xCE01003C, 0x55D89D8A},
{0xCE010040, 0x005508BB},
{0xCE010044, 0x07C08BFF},
{0xCE01004C, 0x07700830},
{0xCE010054, 0x00007FF4},
{0xCE010058, 0x0000000E},
{0xCE01005C, 0x00088018},
{0xCE010064, 0x08820820},
{0xCE010068, 0x00820820},
{0xCE01006C, 0x00820820},
{0xCE010070, 0x00820820},
{0xCE010074, 0x00820820},
{0xCE010078, 0x00820820},
{0xCE01007C, 0x00820820},
{0xCE010080, 0x00820820},
{0xCE010084, 0x00004080},
{0xCE010088, 0x200800FE},
{0xCE01008C, 0xAAAAAAAA},
{0xCE010090, 0xAAAAAAAA},
{0xCE010094, 0x0000A487},
{0xCE010098, 0x0000070E},
{0xCE0100A4, 0x00000F43},
{0xCE0100A8, 0x00098900},
{0xCE0100AC, 0x00000000},
{0xC00003AC, 0x00000000},
{0xC00003B0, 0x00000000},
{0xC00003B4, 0x00000000},
{0xC00003BC, 0x00000000},
{0xC0001D00, 0x5E000040},
{0xC0001D04, 0x015D015D},
{0xC0001D08, 0x00000001},
{0xC0001D0C, 0x55550000},
{0xC0001D20, 0x7FFF0000},
{0xC0001D24, 0x00000003},
{0xC0001D28, 0x00000000},
{0xC0001D2C, 0x00000000},
};
#endif
#ifdef CONFIG_SSV_CABRIO_A
static ssv_cabrio_reg fpga_rf_setting[]=
{
{0xcb110000,0x5F00EFCE},
{0xcb110004,0x00001FC0},
{0xcb110008,0x1C96CA3A},
{0xcb11000c,0x15155A74},
{0xcb110010,0x01011A88},
{0xcb110014,0x3CBF703C},
{0xcb110018,0x00057579},
{0xcb11001c,0x000103A7},
{0xcb110020,0x000103A6},
{0xcb110024,0x00012001},
{0xcb110028,0x00036000},
{0xcb11002c,0x00000CA8},
{0xcb110030,0x002A0224},
{0xcb110034,0x00001E55},
{0xcb110038,0x00006C7C},
{0xcb11003c,0x55666666},
{0xcb110040,0x005508F8},
{0xcb110044,0x07C08BFF},
{0xcb110048,0xF1111A27},
{0xcb11004c,0x2773F53C},
{0xcb110050,0x00000A7C},
{0xcb110054,0x00087FF8},
{0xcb110058,0x00103014},
{0xcb11005c,0x0000848A},
{0xcb110060,0x00406030},
{0xcb110064,0x00820820},
{0xcb110068,0x00820820},
{0xcb11006c,0x00820820},
{0xcb110070,0x00820820},
{0xcb110074,0x00820820},
{0xcb110078,0x00820820},
{0xcb11007c,0x00820820},
{0xcb110080,0x00820820},
{0xcb110084,0x00004080},
{0xcb110088,0x00003EAA},
{0xcb11008c,0x5E00FFEB},
{0xcb110090,0xAAAAAAAA},
{0xcb110094,0x0000243F},
{0xcb110098,0x00018B10},
{0xcb120080,0x00000000},
{0xcb120084,0x00000000},
{0xcb120088,0x00000000},
{0xcb120090,0x00000813},
{0xcb120094,0x00000000},
{0xcb1203f8,0xFF000000},
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,174 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "ssv6200_reg.h"
#define BANK_COUNT 49
static const u32 BASE_BANK_SSV6200[] = {
SYS_REG_BASE ,
WBOOT_REG_BASE ,
TU0_US_REG_BASE ,
TU1_US_REG_BASE ,
TU2_US_REG_BASE ,
TU3_US_REG_BASE ,
TM0_MS_REG_BASE ,
TM1_MS_REG_BASE ,
TM2_MS_REG_BASE ,
TM3_MS_REG_BASE ,
MCU_WDT_REG_BASE ,
SYS_WDT_REG_BASE ,
GPIO_REG_BASE ,
SD_REG_BASE ,
SPI_REG_BASE ,
CSR_I2C_MST_BASE ,
UART_REG_BASE ,
DAT_UART_REG_BASE ,
INT_REG_BASE ,
DBG_SPI_REG_BASE ,
FLASH_SPI_REG_BASE ,
DMA_REG_BASE ,
CSR_PMU_BASE ,
CSR_RTC_BASE ,
RTC_RAM_BASE ,
D2_DMA_REG_BASE ,
HCI_REG_BASE ,
CO_REG_BASE ,
EFS_REG_BASE ,
SMS4_REG_BASE ,
MRX_REG_BASE ,
AMPDU_REG_BASE ,
MT_REG_CSR_BASE ,
TXQ0_MT_Q_REG_CSR_BASE ,
TXQ1_MT_Q_REG_CSR_BASE ,
TXQ2_MT_Q_REG_CSR_BASE ,
TXQ3_MT_Q_REG_CSR_BASE ,
TXQ4_MT_Q_REG_CSR_BASE ,
HIF_INFO_BASE ,
PHY_RATE_INFO_BASE ,
MAC_GLB_SET_BASE ,
BTCX_REG_BASE ,
MIB_REG_BASE ,
CBR_A_REG_BASE ,
MB_REG_BASE ,
ID_MNG_REG_BASE ,
CSR_PHY_BASE ,
CSR_RF_BASE ,
MMU_REG_BASE ,
0x00000000
};
static const char* STR_BANK_SSV6200[] = {
"SYS_REG" ,
"WBOOT_REG" ,
"TU0_US_REG" ,
"TU1_US_REG" ,
"TU2_US_REG" ,
"TU3_US_REG" ,
"TM0_MS_REG" ,
"TM1_MS_REG" ,
"TM2_MS_REG" ,
"TM3_MS_REG" ,
"MCU_WDT_REG" ,
"SYS_WDT_REG" ,
"GPIO_REG" ,
"SD_REG" ,
"SPI_REG" ,
"CSR_I2C_MST" ,
"UART_REG" ,
"DAT_UART_REG" ,
"INT_REG" ,
"DBG_SPI_REG" ,
"FLASH_SPI_REG" ,
"DMA_REG" ,
"CSR_PMU" ,
"CSR_RTC" ,
"RTC_RAM" ,
"D2_DMA_REG" ,
"HCI_REG" ,
"CO_REG" ,
"EFS_REG" ,
"SMS4_REG" ,
"MRX_REG" ,
"AMPDU_REG" ,
"MT_REG_CSR" ,
"TXQ0_MT_Q_REG_CSR" ,
"TXQ1_MT_Q_REG_CSR" ,
"TXQ2_MT_Q_REG_CSR" ,
"TXQ3_MT_Q_REG_CSR" ,
"TXQ4_MT_Q_REG_CSR" ,
"HIF_INFO" ,
"PHY_RATE_INFO" ,
"MAC_GLB_SET" ,
"BTCX_REG" ,
"MIB_REG" ,
"CBR_A_REG" ,
"MB_REG" ,
"ID_MNG_REG" ,
"CSR_PHY" ,
"CSR_RF" ,
"MMU_REG" ,
""
};
static const u32 SIZE_BANK_SSV6200[] = {
SYS_REG_BANK_SIZE ,
WBOOT_REG_BANK_SIZE ,
TU0_US_REG_BANK_SIZE ,
TU1_US_REG_BANK_SIZE ,
TU2_US_REG_BANK_SIZE ,
TU3_US_REG_BANK_SIZE ,
TM0_MS_REG_BANK_SIZE ,
TM1_MS_REG_BANK_SIZE ,
TM2_MS_REG_BANK_SIZE ,
TM3_MS_REG_BANK_SIZE ,
MCU_WDT_REG_BANK_SIZE ,
SYS_WDT_REG_BANK_SIZE ,
GPIO_REG_BANK_SIZE ,
SD_REG_BANK_SIZE ,
SPI_REG_BANK_SIZE ,
CSR_I2C_MST_BANK_SIZE ,
UART_REG_BANK_SIZE ,
DAT_UART_REG_BANK_SIZE ,
INT_REG_BANK_SIZE ,
DBG_SPI_REG_BANK_SIZE ,
FLASH_SPI_REG_BANK_SIZE ,
DMA_REG_BANK_SIZE ,
CSR_PMU_BANK_SIZE ,
CSR_RTC_BANK_SIZE ,
RTC_RAM_BANK_SIZE ,
D2_DMA_REG_BANK_SIZE ,
HCI_REG_BANK_SIZE ,
CO_REG_BANK_SIZE ,
EFS_REG_BANK_SIZE ,
SMS4_REG_BANK_SIZE ,
MRX_REG_BANK_SIZE ,
AMPDU_REG_BANK_SIZE ,
MT_REG_CSR_BANK_SIZE ,
TXQ0_MT_Q_REG_CSR_BANK_SIZE ,
TXQ1_MT_Q_REG_CSR_BANK_SIZE ,
TXQ2_MT_Q_REG_CSR_BANK_SIZE ,
TXQ3_MT_Q_REG_CSR_BANK_SIZE ,
TXQ4_MT_Q_REG_CSR_BANK_SIZE ,
HIF_INFO_BANK_SIZE ,
PHY_RATE_INFO_BANK_SIZE ,
MAC_GLB_SET_BANK_SIZE ,
BTCX_REG_BANK_SIZE ,
MIB_REG_BANK_SIZE ,
CBR_A_REG_BANK_SIZE ,
MB_REG_BANK_SIZE ,
ID_MNG_REG_BANK_SIZE ,
CSR_PHY_BANK_SIZE ,
CSR_RF_BANK_SIZE ,
MMU_REG_BANK_SIZE ,
0x00000000
};

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SSV_CFG_H_
#define _SSV_CFG_H_
#define SSV6200_HW_CAP_HT 0x00000001
#define SSV6200_HW_CAP_GF 0x00000002
#define SSV6200_HW_CAP_2GHZ 0x00000004
#define SSV6200_HW_CAP_5GHZ 0x00000008
#define SSV6200_HW_CAP_SECURITY 0x00000010
#define SSV6200_HT_CAP_SGI_20 0x00000020
#define SSV6200_HT_CAP_SGI_40 0x00000040
#define SSV6200_HW_CAP_AP 0x00000080
#define SSV6200_HW_CAP_P2P 0x00000100
#define SSV6200_HW_CAP_AMPDU_RX 0x00000200
#define SSV6200_HW_CAP_AMPDU_TX 0x00000400
#define SSV6200_HW_CAP_TDLS 0x00000800
#define EXTERNEL_CONFIG_SUPPORT 64
struct ssv6xxx_cfg {
u32 hw_caps;
u32 def_chan;
u32 crystal_type;
u32 volt_regulator;
u32 force_chip_identity;
u8 maddr[2][6];
u32 n_maddr;
u32 use_wpa2_only;
u32 ignore_reset_in_ap;
u32 r_calbration_result;
u32 sar_result;
u32 crystal_frequency_offset;
u32 tx_power_index_1;
u32 tx_power_index_2;
u32 chip_identity;
u32 wifi_tx_gain_level_gn;
u32 wifi_tx_gain_level_b;
u32 rssi_ctl;
u32 sr_bhvr;
u32 configuration[EXTERNEL_CONFIG_SUPPORT+1][2];
u8 firmware_path[128];
u8 flash_bin_path[128];
u8 mac_address_path[128];
u8 mac_output_path[128];
u32 ignore_efuse_mac;
u32 mac_address_mode;
};
#endif

View File

@ -0,0 +1,32 @@
#ifndef __SSV_CONF_PARSER_H__
#define __SSV_CONF_PARSER_H__
char const *conf_parser[] = {
"CONFIG_SSV_SUPPORT_ANDROID",
"CONFIG_FW_ALIGNMENT_CHECK",
"CONFIG_PLATFORM_SDIO_OUTPUT_TIMING_3",
"CONFIG_PLATFORM_SDIO_BLOCK_SIZE_128",
"MULTI_THREAD_ENCRYPT",
"KTHREAD_BIND",
"CONFIG_SSV_RSSI",
"CONFIG_SSV_VENDOR_EXT_SUPPORT",
"CONFIG_SSV_CABRIO_E",
"CONFIG_SSV6200_CLI_ENABLE",
"CONFIG_SSV6XXX_DEBUGFS",
"CONFIG_SSV_TX_LOWTHRESHOLD",
"RATE_CONTROL_REALTIME_UPDATA",
"CONFIG_SSV6200_HAS_RX_WORKQUEUE",
"USE_THREAD_TX",
"ENABLE_AGGREGATE_IN_TIME",
"ENABLE_INCREMENTAL_AGGREGATION",
"USE_GENERIC_DECI_TBL",
"USE_LOCAL_CRYPTO",
"USE_LOCAL_WEP_CRYPTO",
"USE_LOCAL_CCMP_CRYPTO",
"USE_LOCAL_SMS4_CRYPTO",
"CONFIG_SSV_WAPI",
"FW_WSID_WATCH_LIST",
"SSV6200_ECO",
"HAS_CRYPTO_LOCK",
"ENABLE_TX_Q_FLOW_CONTROL",
""};
#endif // __SSV_CONF_PARSER_H__

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SSV_FIRMWARE_VERSION_H_
#define _SSV_FIRMWARE_VERSION_H_
static u32 ssv_firmware_version = 16380;
#define SSV_FIRMWARE_URl "http://192.168.15.30/svn/software/wifi/tag/smac-release-tag/6051.Q0.1009.21.000000/ssv6xxx/smac/firmware"
#define FIRMWARE_COMPILERHOST "ssv-ThinkPad-X230"
#define FIRMWARE_COMPILERDATE "11-06-2017-09:17:18"
#define FIRMWARE_COMPILEROS "linux"
#define FIRMWARE_COMPILEROSARCH "x86_64-linux-gnu-thread-multi"
#endif

View File

@ -0,0 +1,13 @@
#ifndef _SSV_VERSION_H_
#define _SSV_VERSION_H_
static u32 ssv_root_version = 16529;
#define SSV_ROOT_URl "http://192.168.15.30/svn/software/project/release/android/box/rk3x28/6051.Q0.1009.21.400401/ssv6xxx"
#define COMPILERHOST "icomm-buildserver-T320"
#define COMPILERDATE "12-08-2017-10:34:54"
#define COMPILEROS "linux"
#define COMPILEROSARCH "x86_64-linux-gnu-thread-multi"
#endif

View File

@ -0,0 +1,38 @@
#!/bin/bash
# Script to convert defines in compiler option in to C's defines
# Should be executed in make file and it take ccflags-y as the
# compiler options. The content will be redirected to the first arguement.
temp=$1_temp
echo "#ifndef __SSV_CONF_PARSER_H__" > $temp
echo "#define __SSV_CONF_PARSER_H__" >> $temp
echo "char const *conf_parser[] = {" >> $temp
for flag in ${ccflags-y}; do
if [[ "$flag" =~ ^-D.* ]]; then
def=${flag:2}
if [[ "$def" =~ .= ]]; then
def_1=${def/\=/_}
echo "\"$def_1\"," >> $temp
else
echo "\"$def\"," >> $temp
fi
fi
done
echo "\"\"};" >> $temp
echo "#endif // __SSV_CONF_PARSER_H__" >> $temp
if [ -f $1 ];
then
DIFF=$(diff $1 $temp)
if [ "$DIFF" == "" ]; then
rm $temp
else
mv $temp $1
fi
else
mv $temp $1
fi

View File

@ -0,0 +1,97 @@
CONFIG_SSV6200_CORE=m
#ccflags-y += -DCONFIG_SSV6200_CORE
###########################################################################
# Compiler options #
###########################################################################
ccflags-y += -Werror
# Enable -g to help debug. Deassembly from .o to .S would help to track to
# the problomatic line from call stack dump.
ccflags-y += -g
############################################################
# If you change the settings, please change the file synchronization
# smac\firmware\include\config.h & compiler firmware
############################################################
#ccflags-y += -DCONFIG_SSV_CABRIO_A
ccflags-y += -DCONFIG_SSV_CABRIO_E
#CONFIG_SSV_SUPPORT_BTCX=y
ccflags-y += -DCONFIG_SSV6200_CLI_ENABLE
#ccflags-y += -DCONFIG_SSV_BUILD_AS_ONE_KO
#PADPD
#ccflags-y += -DCONFIG_SSV_DPD
#ccflags-y += -DCONFIG_SSV_CABRIO_MB_DEBUG
ccflags-y += -DCONFIG_SSV6XXX_DEBUGFS
#SDIO
ccflags-y += -DCONFIG_SSV_TX_LOWTHRESHOLD
############################################################
# Rate control update for MPDU.
############################################################
ccflags-y += -DRATE_CONTROL_REALTIME_UPDATA
#workaround
#ccflags-y += -DCONFIG_SSV_CABRIO_EXT_PA
############################################################
# NOTE:
# Only one of the following flags could be turned on.
# It also turned off the following flags. In this case,
# pure software security or pure hardware security is used.
#
############################################################
#ccflags-y += -DCONFIG_SSV_SW_ENCRYPT_HW_DECRYPT
#ccflags-y += -DCONFIG_SSV_HW_ENCRYPT_SW_DECRYPT
# FOR WFA
#ccflags-y += -DWIFI_CERTIFIED
#ccflags-y += -DCONFIG_SSV_SDIO_EXT_INT
#######################################################
ccflags-y += -DCONFIG_SSV6200_HAS_RX_WORKQUEUE
#ccflags-y += -DUSE_THREAD_RX
ccflags-y += -DUSE_THREAD_TX
ccflags-y += -DENABLE_AGGREGATE_IN_TIME
ccflags-y += -DENABLE_INCREMENTAL_AGGREGATION
# Generic decision table applicable to both AP and STA modes.
ccflags-y += -DUSE_GENERIC_DECI_TBL
# Use crypto in SSV driver.
ccflags-y += -DUSE_LOCAL_CRYPTO
ccflags-y += -DUSE_LOCAL_WEP_CRYPTO
#ccflags-y += -DUSE_LOCAL_TKIP_CRYPTO
ccflags-y += -DUSE_LOCAL_CCMP_CRYPTO
ccflags-y += -DUSE_LOCAL_SMS4_CRYPTO
ccflags-y += -DCONFIG_SSV_WAPI
ccflags-y += -DFW_WSID_WATCH_LIST
#ccflags-y += -DUSE_BATCH_RX
#ccflags-y += -DCONFIG_IRQ_DEBUG_COUNT
#ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DSSV6200_ECO
#ccflags-y += -DENABLE_WAKE_IO_ISR_WHEN_HCI_ENQUEUE
ccflags-y += -DHAS_CRYPTO_LOCK
ccflags-y += -DENABLE_TX_Q_FLOW_CONTROL
#ccflags-y += -DCONFIG_DEBUG_SKB_TIMESTAMP
#enable p2p client to parse GO broadcast noa
#ccflags-y += -DCONFIG_P2P_NOA
#enable rx management frame check
#ccflags-y += -DCONFIG_RX_MGMT_CHECK

View File

@ -0,0 +1,257 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/semaphore.h>
#include <linux/regulator/consumer.h>
#include <mach/hardware.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,2,0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data {
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
static struct wifi_platform_data *wifi_control_data = NULL;
static struct resource *wifi_irqres = NULL;
static int g_wifi_irq_rc=0;
#define SDIO_ID 1
#define IRQ_RES_NAME "ssv_wlan_irq"
#define WIFI_HOST_WAKE 0xFFFF
extern void sunxi_mci_rescan_card(unsigned id, unsigned insert);
extern int wifi_pm_gpio_ctrl(char* name, int level);
static int ssv_wifi_power(int on)
{
printk("ssv pwr on=%d\n",on);
if(on)
{
wifi_pm_gpio_ctrl("ssv6051_wl_chip_en", 0);
mdelay(50);
wifi_pm_gpio_ctrl("ssv6051_wl_chip_en", 1);
}
else
{
wifi_pm_gpio_ctrl("ssv6051_wl_chip_en", 0);
}
return 0;
}
static int ssv_wifi_reset(int on)
{
return 0;
}
int ssv_wifi_set_carddetect(int val)
{
sunxi_mci_rescan_card(SDIO_ID, val);
return 0;
}
static struct wifi_platform_data ssv_wifi_control = {
.set_power = ssv_wifi_power,
.set_reset = ssv_wifi_reset,
.set_carddetect = ssv_wifi_set_carddetect,
};
static struct resource resources[] = {
{
.start = WIFI_HOST_WAKE,
.flags = IORESOURCE_IRQ,
.name = IRQ_RES_NAME,
},
};
void ssv_wifi_device_release(struct device *dev)
{
printk(KERN_INFO "ssv_wifi_device_release\n");
}
static struct platform_device ssv_wifi_device = {
.name = "ssv_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(resources),
.resource = resources,
.dev = {
.platform_data = &ssv_wifi_control,
.release = ssv_wifi_device_release,
},
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
int wifi_set_reset(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_reset) {
wifi_control_data->set_reset(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev){
printk("sdhci_wakeup_irq_handler\n");
disable_irq_nosync(irq);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(struct platform_device *pdev, bool bEnable)
{
int rc=0,ret=0;
if (bEnable){
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, IRQ_RES_NAME);
rc = (int)wifi_irqres->start;
g_wifi_irq_rc = rc;
ret = request_threaded_irq(rc,
NULL,
(void *)wifi_wakeup_irq_handler,
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0)
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT |IRQF_FORCE_RESUME,
#else
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT,
#endif
"wlan_wakeup_irq", NULL);
enable_irq_wake(g_wifi_irq_rc);
}else{
if(g_wifi_irq_rc){
free_irq(g_wifi_irq_rc,NULL);
g_wifi_irq_rc = 0;
}
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk(KERN_ALERT "wifi_probe\n");
wifi_control_data = wifi_ctrl;
wifi_set_power(0,40);
wifi_set_power(1,50);
wifi_set_carddetect(1);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_carddetect(0);
return 0;
}
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver wifi_driver = {
.probe = wifi_probe,
.remove = wifi_remove,
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = {
.name = "ssv_wlan",
}
};
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret=0;
sema_init(&wifi_control_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
platform_device_register(&ssv_wifi_device);
platform_driver_register(&wifi_driver);
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n", __FUNCTION__);
}
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&ssv_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static int generic_wifi_init_module(void)
{
return initWlan();
}
static void generic_wifi_exit_module(void)
{
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,92 @@
############################################################
# A33
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 1
mac_address_path = /mnt/private/ULI/factory/mac.txt
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
# High PA
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 2
#register = CE010018:02457D79
# Normal PA
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,18 @@
############################################################
# A33
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
#ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
SSV_CROSS = $(ANDROID_BUILD_TOP)/../lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/../lichee/linux-3.4
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,109 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <linux/semaphore.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
extern void sdio_reinit(void);
extern void extern_wifi_set_enable(int is_on);
extern int wifi_setup_dt(void);
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
struct semaphore icomm_chipup_sem;
static int g_wifidev_registered = 0;
char ssvcabrio_fw_name[50] = "ssv6051-sw.bin";
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret=0;
if (wifi_setup_dt()) {
printk("wifi_dt : fail to setup dt\n");
goto fail;
}
extern_wifi_set_enable(0);
mdelay(200);
extern_wifi_set_enable(1);
mdelay(200);
sdio_reinit();
mdelay(100);
g_wifidev_registered = 1;
fail:
up(&icomm_chipup_sem);
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
extern_wifi_set_enable(0);
g_wifidev_registered = 0;
}
return;
}
static __init int generic_wifi_init_module(void)
{
int ret;
printk("%s\n", __func__);
sema_init(&icomm_chipup_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
ret = initWlan();
if (down_timeout(&icomm_chipup_sem,
msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n", __FUNCTION__);
goto out;
}
ret = ssvdevice_init();
out:
return ret;
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
############################################################
# A33-PUHETAI
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
#firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 2
#wifi_tx_gain_level_gn = 5
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,22 @@
############################################################
# amlogic m201 s805
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
ccflags-y += -DMULTI_THREAD_ENCRYPT
#ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
SSV_CROSS = arm-linux-gnueabihf-
#SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/out/target/product/m201/obj/KERNEL_OBJ/
#SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-
#SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/hardware/wifi/icomm/drivers/ssv6xxx/
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,157 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <linux/semaphore.h>
#include <asm/io.h>
#include <linux/cpufreq.h>
#include <linux/notifier.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#include <linux/amlogic/aml_thermal_hw.h>
extern void sdio_reinit(void);
extern void extern_wifi_set_enable(int is_on);
extern int ssv6xxx_get_dev_status(void);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
extern int wifi_setup_dt(void);
#endif
#define GPIO_REG_WRITEL(val,reg) \
do { \
__raw_writel(val, CTL_PIN_BASE + (reg)); \
} while (0)
struct semaphore icomm_chipup_sem;
static int g_wifidev_registered = 0;
char ssvcabrio_fw_name[50] = "ssv6051-sw.bin";
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
extern int max_aggr_num;
static int aml_cpufreq_notifier(struct notifier_block *nb,
unsigned long event, void *data)
{
struct cpufreq_freqs *frq = data;
int cpu_temp;
if((int)frq->cpu != 0 || (int)event == CPUFREQ_TRANSITION_NOTIFIER)
return 0;
cpu_temp = get_cpu_temp();
if(cpu_temp >= 85 && max_aggr_num != 3 )
max_aggr_num = 3;
else if(cpu_temp <= 83 && max_aggr_num != 24 )
max_aggr_num = 24;
printk(KERN_INFO "SSV set max_aggr_num : %d\n",max_aggr_num);
printk(KERN_INFO "SSV get temp : cur_temp = %d\n",cpu_temp);
printk(KERN_INFO "event=%d, cpu=%d, old =%d, new = %d\n", (int)event, (int)frq->cpu, (int)frq->old, (int)frq->new);
return 0;
}
static struct notifier_block aml_cpufreq_notifier_block = {
.notifier_call = aml_cpufreq_notifier,
};
void ssv_wifi_power(void)
{
extern_wifi_set_enable(0);
mdelay(150);
extern_wifi_set_enable(1);
mdelay(150);
sdio_reinit();
mdelay(150);
}
int initWlan(void)
{
int ret = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
if (wifi_setup_dt()) {
printk("wifi_dt : fail to setup dt\n");
goto fail;
}
#endif
ssv_wifi_power();
g_wifidev_registered = 1;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
fail:
#endif
up(&icomm_chipup_sem);
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered) {
ssvdevice_exit();
extern_wifi_set_enable(0);
g_wifidev_registered = 0;
mdelay(150);
}
return;
}
static __init int generic_wifi_init_module(void)
{
int ret, time = 5;
printk("%s\n", __func__);
sema_init(&icomm_chipup_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
ret = initWlan();
if (down_timeout(&icomm_chipup_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n",
__FUNCTION__);
goto out;
}
ret = ssvdevice_init();
while(time-- > 0){
mdelay(500);
if(ssv6xxx_get_dev_status() == 1)
break;
printk("%s : Retry to carddetect\n",__func__);
ssv_wifi_power();
}
cpufreq_register_notifier(&aml_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
out:
printk("generic_wifi_init finished\n");
return ret;
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
exitWlan();
cpufreq_unregister_notifier(&aml_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,88 @@
############################################################
# A33-PUHETAI
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /system/etc/wifi/ssv6051/
flash_bin_path = /tmp/flash.bin
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
sr_bhvr = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 2
#wifi_tx_gain_level_gn = 5
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,26 @@
############################################################
# amlogic s905
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DCONFIG_SSV_OPENFILE_LOADFW
ccflags-y += -DCONFIG_SSV_MRX_EN3_CTRL
ccflags-y += -DCONFIG_TRIGGER_LOW_SDIO_LOADING
#ccflags-y += -DCONFIG_SSV_RSSI
#ccflags-y += -DAML_WIFI_MAC
############################################################
# Compiler path
############################################################
#SSV_CROSS = arm-linux-gnueabihf-
#SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-
#SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/out/target/product/m201/obj/KERNEL_OBJ/
#SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-
#SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/hardware/wifi/icomm/drivers/ssv6xxx/
SSV_ARCH = arm64
#KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,131 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <linux/semaphore.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
extern void sdio_reinit(void);
extern void extern_wifi_set_enable(int is_on);
extern int ssv6xxx_get_dev_status(void);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
extern int wifi_setup_dt(void);
#endif
#define GPIO_REG_WRITEL(val,reg) \
do { \
__raw_writel(val, CTL_PIN_BASE + (reg)); \
} while (0)
struct semaphore icomm_chipup_sem;
static int g_wifidev_registered = 0;
char ssvcabrio_fw_name[50] = "ssv6051-sw.bin";
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
void ssv_wifi_power(void)
{
extern_wifi_set_enable(0);
mdelay(150);
extern_wifi_set_enable(1);
mdelay(150);
sdio_reinit();
mdelay(150);
}
int initWlan(void)
{
int ret = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
if (wifi_setup_dt()) {
printk("wifi_dt : fail to setup dt\n");
goto fail;
}
#endif
ssv_wifi_power();
g_wifidev_registered = 1;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
fail:
#endif
up(&icomm_chipup_sem);
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered) {
ssvdevice_exit();
extern_wifi_set_enable(0);
g_wifidev_registered = 0;
mdelay(150);
}
return;
}
static __init int generic_wifi_init_module(void)
{
int ret, time = 5;
printk("%s\n", __func__);
sema_init(&icomm_chipup_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
ret = initWlan();
if (down_timeout(&icomm_chipup_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n",
__FUNCTION__);
goto out;
}
ret = ssvdevice_init();
while(time-- > 0){
mdelay(500);
if(ssv6xxx_get_dev_status() == 1)
break;
printk("%s : Retry to carddetect\n",__func__);
ssv_wifi_power();
}
out:
printk("generic_wifi_init finished\n");
return ret;
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,87 @@
############################################################
# T950-Amlogic
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /etc/wifi/ssv6051/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 2
#wifi_tx_gain_level_gn = 5
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,24 @@
############################################################
# amlogic s905
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DCONFIG_SSV_OPENFILE_LOADFW
#ccflags-y += -DCONFIG_SSV_RSSI
#ccflags-y += -DAML_WIFI_MAC
############################################################
# Compiler path
############################################################
#SSV_CROSS = arm-linux-gnueabihf-
#SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-
#SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/out/target/product/m201/obj/KERNEL_OBJ/
#SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-
#SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/hardware/wifi/icomm/drivers/ssv6xxx/
SSV_ARCH = arm64
#KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,265 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/semaphore.h>
#include <linux/regulator/consumer.h>
#include <mach/hardware.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data
{
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
#include <mach/wlan_plat_data.h>
extern int acts_wifi_init(int type);
extern void acts_wifi_cleanup(void);
int platform_wifi_power_on(void)
{
int ret = 0;
int wifi_type = 0;
wifi_type = WLAN_SSV6051;
ret = acts_wifi_init(wifi_type);
if (unlikely(ret < 0))
{
pr_err("SSV6051: Failed to register the power control driver.\n");
goto exit;
}
exit:
return ret;
}
void platform_wifi_power_off(void)
{
acts_wifi_cleanup();
}
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
static struct wifi_platform_data *wifi_control_data = NULL;
static struct resource *wifi_irqres = NULL;
static int g_wifi_irq_rc = 0;
#define IRQ_RES_NAME "ssv_wlan_irq"
#define WIFI_HOST_WAKE 0xFFFF
static int ssv_wifi_power(int on)
{
printk("ssv pwr on=%d\n", on);
if (on)
{
}
else
{
}
return 0;
}
static int ssv_wifi_reset(int on)
{
return 0;
}
int ssv_wifi_set_carddetect(int val)
{
val = val;
return 0;
}
static struct wifi_platform_data ssv_wifi_control = {
.set_power = ssv_wifi_power,
.set_reset = ssv_wifi_reset,
.set_carddetect = ssv_wifi_set_carddetect,
};
static struct resource resources[] = { { .start = WIFI_HOST_WAKE,
.flags = IORESOURCE_IRQ,
.name = IRQ_RES_NAME, }, };
void ssv_wifi_device_release(struct device *dev)
{
printk(KERN_INFO "ssv_wifi_device_release\n");
}
static struct platform_device ssv_wifi_device = {
.name = "ssv_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(resources),
.resource = resources,
.dev = { .platform_data = &ssv_wifi_control,
.release = ssv_wifi_device_release, },
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
int wifi_set_reset(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_reset) {
wifi_control_data->set_reset(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev)
{
printk("sdhci_wakeup_irq_handler\n");
disable_irq_nosync(irq);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(struct platform_device *pdev, bool bEnable)
{
int rc = 0, ret = 0;
if (bEnable) {
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
IRQ_RES_NAME);
rc = (int)wifi_irqres->start;
g_wifi_irq_rc = rc;
ret = request_threaded_irq(
rc, NULL, (void *)wifi_wakeup_irq_handler,
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0)
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT | IRQF_FORCE_RESUME,
#else
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT,
#endif
"wlan_wakeup_irq", NULL);
enable_irq_wake(g_wifi_irq_rc);
} else {
if (g_wifi_irq_rc) {
free_irq(g_wifi_irq_rc, NULL);
g_wifi_irq_rc = 0;
}
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk(KERN_ALERT "wifi_probe\n");
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 40);
wifi_set_power(1, 10);
wifi_set_carddetect(1);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0);
wifi_set_carddetect(0);
setup_wifi_wakeup_BB(pdev, false);
return 0;
}
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
setup_wifi_wakeup_BB(pdev, true);
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
setup_wifi_wakeup_BB(pdev, false);
return 0;
}
static struct platform_driver wifi_driver = { .probe = wifi_probe,
.remove = wifi_remove,
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = { .name =
"ssv_wlan", } };
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret = 0;
sema_init(&wifi_control_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
platform_device_register(&ssv_wifi_device);
platform_driver_register(&wifi_driver);
(void)platform_wifi_power_on();
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n",
__FUNCTION__);
}
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered) {
ssvdevice_exit();
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
(void)platform_wifi_power_off();
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&ssv_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static int generic_wifi_init_module(void)
{
return initWlan();
}
static void generic_wifi_exit_module(void)
{
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,87 @@
############################################################
# ATM7039
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 2
#wifi_tx_gain_level_gn = 5
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,17 @@
############################################################
# ATM7039
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DMULTI_THREAD_ENCRYPT
#ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
#SSV_CROSS = $(R_CROSS_COMPILE)
#SSV_KERNEL_PATH = $(KERNEL_BUILD_PATH)
#SSV_ARCH = $(R_ARCH)
#KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,6 @@
SSV_DFS_FILE=/sys/kernel/debug/ssv/ssv_cmd
if [ -f $SSV_DFS_FILE ]; then
echo "$*" > $SSV_DFS_FILE
cat $SSV_DFS_FILE
fi

View File

@ -0,0 +1,257 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/semaphore.h>
#include <linux/regulator/consumer.h>
#include <mach/hardware.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,2,0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data {
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
static struct wifi_platform_data *wifi_control_data = NULL;
static struct resource *wifi_irqres = NULL;
static int g_wifi_irq_rc=0;
#define SDIO_ID 1
#define IRQ_RES_NAME "ssv_wlan_irq"
#define WIFI_HOST_WAKE 0xFFFF
extern void sunxi_mci_rescan_card(unsigned id, unsigned insert);
extern int wifi_pm_gpio_ctrl(char* name, int level);
static int ssv_wifi_power(int on)
{
printk("ssv pwr on=%d\n",on);
if(on)
{
wifi_pm_gpio_ctrl("wl_reg_on", 0);
mdelay(50);
wifi_pm_gpio_ctrl("wl_reg_on", 1);
}
else
{
wifi_pm_gpio_ctrl("wl_reg_on", 0);
}
return 0;
}
static int ssv_wifi_reset(int on)
{
return 0;
}
int ssv_wifi_set_carddetect(int val)
{
sunxi_mci_rescan_card(SDIO_ID, val);
return 0;
}
static struct wifi_platform_data ssv_wifi_control = {
.set_power = ssv_wifi_power,
.set_reset = ssv_wifi_reset,
.set_carddetect = ssv_wifi_set_carddetect,
};
static struct resource resources[] = {
{
.start = WIFI_HOST_WAKE,
.flags = IORESOURCE_IRQ,
.name = IRQ_RES_NAME,
},
};
void ssv_wifi_device_release(struct device *dev)
{
printk(KERN_INFO "ssv_wifi_device_release\n");
}
static struct platform_device ssv_wifi_device = {
.name = "ssv_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(resources),
.resource = resources,
.dev = {
.platform_data = &ssv_wifi_control,
.release = ssv_wifi_device_release,
},
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
int wifi_set_reset(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_reset) {
wifi_control_data->set_reset(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev){
printk("sdhci_wakeup_irq_handler\n");
disable_irq_nosync(irq);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(struct platform_device *pdev, bool bEnable)
{
int rc=0,ret=0;
if (bEnable){
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, IRQ_RES_NAME);
rc = (int)wifi_irqres->start;
g_wifi_irq_rc = rc;
ret = request_threaded_irq(rc,
NULL,
(void *)wifi_wakeup_irq_handler,
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0)
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT |IRQF_FORCE_RESUME,
#else
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT,
#endif
"wlan_wakeup_irq", NULL);
enable_irq_wake(g_wifi_irq_rc);
}else{
if(g_wifi_irq_rc){
free_irq(g_wifi_irq_rc,NULL);
g_wifi_irq_rc = 0;
}
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk(KERN_ALERT "wifi_probe\n");
wifi_control_data = wifi_ctrl;
wifi_set_power(0,40);
wifi_set_power(1,50);
wifi_set_carddetect(1);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_carddetect(0);
return 0;
}
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver wifi_driver = {
.probe = wifi_probe,
.remove = wifi_remove,
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = {
.name = "ssv_wlan",
}
};
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret=0;
sema_init(&wifi_control_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
platform_device_register(&ssv_wifi_device);
platform_driver_register(&wifi_driver);
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n", __FUNCTION__);
}
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&ssv_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static int generic_wifi_init_module(void)
{
return initWlan();
}
static void generic_wifi_exit_module(void)
{
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
##################################################
# H3
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. X or X
#
##################################################
#wifi_tx_gain_level_b = 0
#wifi_tx_gain_level_gn = 0
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,18 @@
############################################################
# H3
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
#ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
SSV_CROSS = $(ANDROID_BUILD_TOP)/../lichee/out/sun8iw7p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/../lichee/linux-3.4
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,257 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/semaphore.h>
#include <linux/regulator/consumer.h>
#include <mach/hardware.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,2,0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data {
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
static struct wifi_platform_data *wifi_control_data = NULL;
static struct resource *wifi_irqres = NULL;
static int g_wifi_irq_rc=0;
#define SDIO_ID 1
#define IRQ_RES_NAME "ssv_wlan_irq"
#define WIFI_HOST_WAKE 0xFFFF
extern void sunxi_mci_rescan_card(unsigned id, unsigned insert);
extern int wifi_pm_gpio_ctrl(char* name, int level);
static int ssv_wifi_power(int on)
{
printk("ssv pwr on=%d\n",on);
if(on)
{
wifi_pm_gpio_ctrl("wl_reg_on", 0);
mdelay(50);
wifi_pm_gpio_ctrl("wl_reg_on", 1);
}
else
{
wifi_pm_gpio_ctrl("wl_reg_on", 0);
}
return 0;
}
static int ssv_wifi_reset(int on)
{
return 0;
}
int ssv_wifi_set_carddetect(int val)
{
sunxi_mci_rescan_card(SDIO_ID, val);
return 0;
}
static struct wifi_platform_data ssv_wifi_control = {
.set_power = ssv_wifi_power,
.set_reset = ssv_wifi_reset,
.set_carddetect = ssv_wifi_set_carddetect,
};
static struct resource resources[] = {
{
.start = WIFI_HOST_WAKE,
.flags = IORESOURCE_IRQ,
.name = IRQ_RES_NAME,
},
};
void ssv_wifi_device_release(struct device *dev)
{
printk(KERN_INFO "ssv_wifi_device_release\n");
}
static struct platform_device ssv_wifi_device = {
.name = "ssv_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(resources),
.resource = resources,
.dev = {
.platform_data = &ssv_wifi_control,
.release = ssv_wifi_device_release,
},
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
int wifi_set_reset(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_reset) {
wifi_control_data->set_reset(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev){
printk("sdhci_wakeup_irq_handler\n");
disable_irq_nosync(irq);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(struct platform_device *pdev, bool bEnable)
{
int rc=0,ret=0;
if (bEnable){
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, IRQ_RES_NAME);
rc = (int)wifi_irqres->start;
g_wifi_irq_rc = rc;
ret = request_threaded_irq(rc,
NULL,
(void *)wifi_wakeup_irq_handler,
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0)
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT |IRQF_FORCE_RESUME,
#else
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT,
#endif
"wlan_wakeup_irq", NULL);
enable_irq_wake(g_wifi_irq_rc);
}else{
if(g_wifi_irq_rc){
free_irq(g_wifi_irq_rc,NULL);
g_wifi_irq_rc = 0;
}
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk(KERN_ALERT "wifi_probe\n");
wifi_control_data = wifi_ctrl;
wifi_set_power(0,40);
wifi_set_power(1,50);
wifi_set_carddetect(1);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_carddetect(0);
return 0;
}
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver wifi_driver = {
.probe = wifi_probe,
.remove = wifi_remove,
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = {
.name = "ssv_wlan",
}
};
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret=0;
sema_init(&wifi_control_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
platform_device_register(&ssv_wifi_device);
platform_driver_register(&wifi_driver);
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n", __FUNCTION__);
}
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&ssv_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static int generic_wifi_init_module(void)
{
return initWlan();
}
static void generic_wifi_exit_module(void)
{
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
############################################################
# A33
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,18 @@
############################################################
# H8
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
#ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
SSV_CROSS = $(ANDROID_BUILD_TOP)/../lichee/out/sun8iw7p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/../lichee/linux-3.4
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,97 @@
CONFIG_SSV6200_CORE=m
#ccflags-y += -DCONFIG_SSV6200_CORE
###########################################################################
# Compiler options #
###########################################################################
ccflags-y += -Werror
# Enable -g to help debug. Deassembly from .o to .S would help to track to
# the problomatic line from call stack dump.
ccflags-y += -g
############################################################
# If you change the settings, please change the file synchronization
# smac\firmware\include\config.h & compiler firmware
############################################################
#ccflags-y += -DCONFIG_SSV_CABRIO_A
ccflags-y += -DCONFIG_SSV_CABRIO_E
#CONFIG_SSV_SUPPORT_BTCX=y
ccflags-y += -DCONFIG_SSV6200_CLI_ENABLE
#ccflags-y += -DCONFIG_SSV_BUILD_AS_ONE_KO
#PADPD
#ccflags-y += -DCONFIG_SSV_DPD
#ccflags-y += -DCONFIG_SSV_CABRIO_MB_DEBUG
ccflags-y += -DCONFIG_SSV6XXX_DEBUGFS
#SDIO
ccflags-y += -DCONFIG_SSV_TX_LOWTHRESHOLD
############################################################
# Rate control update for MPDU.
############################################################
ccflags-y += -DRATE_CONTROL_REALTIME_UPDATA
#workaround
#ccflags-y += -DCONFIG_SSV_CABRIO_EXT_PA
############################################################
# NOTE:
# Only one of the following flags could be turned on.
# It also turned off the following flags. In this case,
# pure software security or pure hardware security is used.
#
############################################################
#ccflags-y += -DCONFIG_SSV_SW_ENCRYPT_HW_DECRYPT
#ccflags-y += -DCONFIG_SSV_HW_ENCRYPT_SW_DECRYPT
# FOR WFA
#ccflags-y += -DWIFI_CERTIFIED
#ccflags-y += -DCONFIG_SSV_SDIO_EXT_INT
#######################################################
ccflags-y += -DCONFIG_SSV6200_HAS_RX_WORKQUEUE
#ccflags-y += -DUSE_THREAD_RX
ccflags-y += -DUSE_THREAD_TX
ccflags-y += -DENABLE_AGGREGATE_IN_TIME
ccflags-y += -DENABLE_INCREMENTAL_AGGREGATION
# Generic decision table applicable to both AP and STA modes.
ccflags-y += -DUSE_GENERIC_DECI_TBL
# Use crypto in SSV driver.
ccflags-y += -DUSE_LOCAL_CRYPTO
ccflags-y += -DUSE_LOCAL_WEP_CRYPTO
#ccflags-y += -DUSE_LOCAL_TKIP_CRYPTO
ccflags-y += -DUSE_LOCAL_CCMP_CRYPTO
ccflags-y += -DUSE_LOCAL_SMS4_CRYPTO
ccflags-y += -DCONFIG_SSV_WAPI
ccflags-y += -DFW_WSID_WATCH_LIST
#ccflags-y += -DUSE_BATCH_RX
#ccflags-y += -DCONFIG_IRQ_DEBUG_COUNT
#ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DSSV6200_ECO
#ccflags-y += -DENABLE_WAKE_IO_ISR_WHEN_HCI_ENQUEUE
ccflags-y += -DHAS_CRYPTO_LOCK
ccflags-y += -DENABLE_TX_Q_FLOW_CONTROL
#ccflags-y += -DCONFIG_DEBUG_SKB_TIMESTAMP
#enable p2p client to parse GO broadcast noa
#ccflags-y += -DCONFIG_P2P_NOA
#enable rx management frame check
#ccflags-y += -DCONFIG_RX_MGMT_CHECK

View File

@ -0,0 +1,269 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <linux/semaphore.h>
#include <linux/platform_device.h>
#ifdef CONFIG_HAS_WAKELOCK
#include <linux/wakelock.h>
#endif
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,2,0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data {
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
extern int rockchip_wifi_power(int on);
extern int rockchip_wifi_set_carddetect(int val);
extern int ssv6xxx_get_dev_status(void);
static struct wifi_platform_data *wifi_control_data = NULL;
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
unsigned int oob_irq = 0;
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
extern int rockchip_wifi_get_oob_irq(void);
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
#ifdef CONFIG_HAS_WAKELOCK
struct wake_lock icomm_wake_lock;
#endif
static int icomm_wifi_power(int on)
{
printk("%s: %d\n", __func__, on);
rockchip_wifi_power(on);
return 0;
}
int icomm_wifi_set_carddetect(int val)
{
rockchip_wifi_set_carddetect(val);
return 0;
}
static struct wifi_platform_data icomm_wifi_control = {
.set_power = icomm_wifi_power,
.set_carddetect = icomm_wifi_set_carddetect,
};
void icomm_wifi_device_release(struct device *dev)
{
printk("%s\n", __func__);
}
static struct platform_device icomm_wifi_device = {
.name = "icomm_wlan",
.id = 1,
.dev = {
.platform_data = &icomm_wifi_control,
.release = icomm_wifi_device_release,
},
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev)
{
printk("%s\n", __func__);
wake_lock_timeout(&icomm_wake_lock, HZ);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(void)
{
int err;
oob_irq = rockchip_wifi_get_oob_irq();
if (oob_irq <= 0) {
printk("%s: oob_irq NULL\n", __func__);
return;
}
err = request_threaded_irq(oob_irq,
wifi_wakeup_irq_handler,
NULL,
IRQF_TRIGGER_FALLING,
"wlan_wakeup_irq",
NULL);
printk("%s: set oob_irq:%d %s\n", __func__, oob_irq, (err < 0) ? "NG": "OK");
}
void free_wifi_wakeup_BB(void)
{
if (oob_irq > 0) {
free_irq(oob_irq, NULL);
oob_irq = 0;
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk("%s\n", __func__);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 50);
wifi_set_power(1, 50);
wifi_set_carddetect(1);
msleep(120);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk("%s\n", __func__);
wifi_control_data = wifi_ctrl;
wifi_set_carddetect(0);
msleep(120);
wifi_set_power(0, 50);
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_destroy(&icomm_wake_lock);
#endif
return 0;
}
#ifdef CONFIG_PM
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
printk("%s\n", __func__);
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
printk("%s\n", __func__);
#if 0
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(0);
}
msleep(50);
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(1);
}
#endif
return 0;
}
#endif
static struct platform_driver wifi_driver = {
.probe = wifi_probe,
.remove = wifi_remove,
#ifdef CONFIG_PM
.suspend = wifi_suspend,
.resume = wifi_resume,
#endif
.driver = {
.name = "icomm_wlan",
}
};
int initWlan(void)
{
int ret=0;
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&icomm_wake_lock, WAKE_LOCK_SUSPEND, "ssv6051");
wake_lock(&icomm_wake_lock);
#endif
sema_init(&wifi_control_sem, 0);
platform_device_register(&icomm_wifi_device);
platform_driver_register(&wifi_driver);
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n", __FUNCTION__);
}
ret = ssvdevice_init();
#ifdef CONFIG_HAS_WAKELOCK
wake_unlock(&icomm_wake_lock);
#endif
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&icomm_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static __init int generic_wifi_init_module(void)
{
int ret;
int time = 5;
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
ret = initWlan();
while(time-- > 0)
{
msleep(500);
if(ssv6xxx_get_dev_status() == 1)
break;
printk("%s : Retry to carddetect\n",__func__);
wifi_set_carddetect(0);
wifi_set_power(0, 50);
msleep(150);
wifi_set_power(1, 50);
wifi_set_carddetect(1);
}
return ret;
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,91 @@
############################################################
# RK3128
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
#firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
#################################################
# Signal strength control
# rssi control
rssi_ctl = 0
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,22 @@
############################################################
# RK3128
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
ccflags-y += -DROCKCHIP_3126_SUPPORT
ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/kernel
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
extern int rockchip_wifi_power(int on);
extern int rockchip_wifi_set_carddetect(int val);
#ifdef ROCKCHIP_WIFI_AUTO_SUPPORT
extern char wifi_chip_type_string[];
#endif
#define GPIO_REG_WRITEL(val,reg) \
do { \
__raw_writel(val, CTL_PIN_BASE + (reg)); \
} while (0)
static int g_wifidev_registered = 0;
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
extern int ssv6xxx_get_dev_status(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
void ssv_wifi_power(void)
{
rockchip_wifi_set_carddetect(0);
msleep(150);
rockchip_wifi_power(0);
msleep(150);
rockchip_wifi_power(1);
msleep(150);
rockchip_wifi_set_carddetect(1);
msleep(150);
}
int initWlan(void)
{
int ret = 0;
int time = 5;
ssv_wifi_power();
msleep(120);
g_wifidev_registered = 1;
ret = ssvdevice_init();
while(time-- > 0){
msleep(500);
if(ssv6xxx_get_dev_status() == 1)
break;
printk("%s : Retry to carddetect\n",__func__);
ssv_wifi_power();
}
#ifdef ROCKCHIP_WIFI_AUTO_SUPPORT
if (!ret) {
strcpy(wifi_chip_type_string, "ssv6051");
printk(KERN_INFO "wifi_chip_type_string : %s\n" ,wifi_chip_type_string);
}
#endif
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
msleep(50);
#ifndef ROCKCHIP_WIFI_AUTO_SUPPORT
rockchip_wifi_set_carddetect(0);
#endif
rockchip_wifi_power(0);
g_wifidev_registered = 0;
}
return;
}
static __init int generic_wifi_init_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
return initWlan();
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
msleep(100);
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
############################################################
# RK3128
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
#firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 2
#wifi_tx_gain_level_gn = 5
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,21 @@
############################################################
# RK3128
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
#ccflags-y += -DCONFIG_SSV_RSSI
#ccflags-y += -DROCKCHIP_WIFI_AUTO_SUPPORT
############################################################
# Compiler path
############################################################
SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/kernel
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
extern int rockchip_wifi_power(int on);
extern int rockchip_wifi_set_carddetect(int val);
#ifdef ROCKCHIP_WIFI_AUTO_SUPPORT
extern char wifi_chip_type_string[];
#endif
#define GPIO_REG_WRITEL(val,reg) \
do { \
__raw_writel(val, CTL_PIN_BASE + (reg)); \
} while (0)
static int g_wifidev_registered = 0;
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
extern int ssv6xxx_get_dev_status(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
void ssv_wifi_power(void)
{
rockchip_wifi_set_carddetect(0);
msleep(150);
rockchip_wifi_power(0);
msleep(150);
rockchip_wifi_power(1);
msleep(150);
rockchip_wifi_set_carddetect(1);
msleep(150);
}
int initWlan(void)
{
int ret = 0;
int time = 5;
ssv_wifi_power();
msleep(120);
g_wifidev_registered = 1;
ret = ssvdevice_init();
while(time-- > 0){
msleep(500);
if(ssv6xxx_get_dev_status() == 1)
break;
printk("%s : Retry to carddetect\n",__func__);
ssv_wifi_power();
}
#ifdef ROCKCHIP_WIFI_AUTO_SUPPORT
if (!ret) {
strcpy(wifi_chip_type_string, "ssv6051");
printk(KERN_INFO "wifi_chip_type_string : %s\n" ,wifi_chip_type_string);
}
#endif
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
msleep(50);
#ifndef ROCKCHIP_WIFI_AUTO_SUPPORT
rockchip_wifi_set_carddetect(0);
#endif
rockchip_wifi_power(0);
g_wifidev_registered = 0;
}
return;
}
static __init int generic_wifi_init_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
return initWlan();
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
msleep(100);
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
############################################################
# ROCKCHIP RK3X28 & RK322X
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
#firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 2
#wifi_tx_gain_level_gn = 5
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,21 @@
############################################################
# RK322x
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
#ccflags-y += -DROCKCHIP_WIFI_AUTO_SUPPORT
ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/kernel
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#ifdef CONFIG_CONTROL_SDIOCARD_PWR
extern void mmc_rescan_sdio(void);
extern void wifi_power(int on);
#endif
static int g_wifidev_registered = 0;
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret = 0;
#ifdef CONFIG_CONTROL_SDIOCARD_PWR
wifi_power(0);
mdelay(10);
wifi_power(1);
mdelay(120);
mmc_rescan_sdio();
mdelay(120);
#endif
g_wifidev_registered = 1;
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered) {
ssvdevice_exit();
#ifdef CONFIG_CONTROL_SDIOCARD_PWR
wifi_power(0);
#endif
g_wifidev_registered = 0;
}
return;
}
static __init int generic_wifi_init_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
return initWlan();
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
############################################################
# Silan sc6138
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /lib/firmware/
force_chip_identity = 0x75000000
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 26
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = off
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,20 @@
############################################################
# Silan sc6138
############################################################
ccflags-y += -DCONFIG_SSV_BUILD_AS_ONE_KO
#ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
#ccflags-y += -DCONFIG_SSV_SMARTLINK
ccflags-y += -DCONFIG_HW_CAP_SINGLE_INTF
#ccflags-y += -DCONFIG_SSV_MRX_EN3_CTRL
############################################################
# Compiler path
############################################################
#SSV_CROSS =
#SSV_KERNEL_PATH =
#SSV_ARCH = arm
#SSV_STRIP =
#KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,286 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/semaphore.h>
#include <linux/regulator/consumer.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,2,0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data {
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
static struct wifi_platform_data *wifi_control_data = NULL;
static struct resource *wifi_irqres = NULL;
static int g_wifi_irq_rc=0;
#define SDIO_ID 2
#define IRQ_RES_NAME "ssv_wlan_irq"
#define WIFI_HOST_WAKE 0xFFFF
extern int ssv_6xxx_wlan_init(void);
extern int ssv_wlan_power_on(int flag);
extern int ssv_wlan_power_off(int flag);
static int wifi_pm_gpio_ctrl(char* name, int level)
{
(void)name;
(void)level;
if (level)
{
ssv_wlan_power_on(1);
}
else
{
ssv_wlan_power_off(1);
}
return 0;
}
static int ssv_wifi_power(int on)
{
printk("ssv pwr on=%d\n",on);
if(on)
{
wifi_pm_gpio_ctrl("wifi_ssv6200_power", 0);
mdelay(50);
wifi_pm_gpio_ctrl("wifi_ssv6200_power", 1);
}
else
{
wifi_pm_gpio_ctrl("wifi_ssv6200_power", 0);
}
return 0;
}
static int ssv_wifi_reset(int on)
{
return 0;
}
int ssv_wifi_set_carddetect(int val)
{
if (val)
{
ssv_wlan_power_on(1);
}
else
{
ssv_wlan_power_off(1);
}
return 0;
}
static struct wifi_platform_data ssv_wifi_control = {
.set_power = ssv_wifi_power,
.set_reset = ssv_wifi_reset,
.set_carddetect = ssv_wifi_set_carddetect,
};
static struct resource resources[] = {
{
.start = WIFI_HOST_WAKE,
.flags = IORESOURCE_IRQ,
.name = IRQ_RES_NAME,
},
};
void ssv_wifi_device_release(struct device *dev)
{
printk(KERN_INFO "ssv_wifi_device_release\n");
}
static struct platform_device ssv_wifi_device = {
.name = "ssv_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(resources),
.resource = resources,
.dev = {
.platform_data = &ssv_wifi_control,
.release = ssv_wifi_device_release,
},
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
int wifi_set_reset(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_reset) {
wifi_control_data->set_reset(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
printk("[Debug-%s-%d]------\n",__func__,__LINE__);
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev){
printk("sdhci_wakeup_irq_handler\n");
disable_irq_nosync(irq);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(struct platform_device *pdev, bool bEnable)
{
int rc=0,ret=0;
if (bEnable){
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, IRQ_RES_NAME);
rc = (int)wifi_irqres->start;
g_wifi_irq_rc = rc;
ret = request_threaded_irq(rc,
NULL,
(void *)wifi_wakeup_irq_handler,
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0)
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT |IRQF_FORCE_RESUME,
#else
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT,
#endif
"wlan_wakeup_irq", NULL);
enable_irq_wake(g_wifi_irq_rc);
}else{
if(g_wifi_irq_rc){
free_irq(g_wifi_irq_rc,NULL);
g_wifi_irq_rc = 0;
}
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk(KERN_ALERT "wifi_probe\n");
wifi_control_data = wifi_ctrl;
#ifndef CONFIG_SSV6XXX
printk("[Debug-%s-%d]------\n",__func__,__LINE__);
ssv_6xxx_wlan_init();
#endif
printk("[Debug-%s-%d]------\n",__func__,__LINE__);
wifi_set_carddetect(1);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0);
wifi_set_carddetect(0);
setup_wifi_wakeup_BB(pdev,false);
return 0;
}
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
setup_wifi_wakeup_BB(pdev,true);
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
setup_wifi_wakeup_BB(pdev,false);
return 0;
}
static struct platform_driver wifi_driver = {
.probe = wifi_probe,
.remove = wifi_remove,
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = {
.name = "ssv_wlan",
}
};
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret=0;
sema_init(&wifi_control_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
platform_device_register(&ssv_wifi_device);
platform_driver_register(&wifi_driver);
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n", __FUNCTION__);
}
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&ssv_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static int generic_wifi_init_module(void)
{
return initWlan();
}
static void generic_wifi_exit_module(void)
{
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
#ifdef CONFIG_SSV6XXX
late_initcall(generic_wifi_init_module);
#else
module_init(generic_wifi_init_module);
#endif
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,88 @@
############################################################
# Ingenic X1000
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
#firmware_path =
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
software_mac_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 26
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = off
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################
#register = CE010008:008B7C1C
#register = CE010014:3D7E84FE
#register = CE010048:FCCCCC27

View File

@ -0,0 +1,22 @@
############################################################
# Ingenic X1000
############################################################
#ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_BUILD_AS_ONE_KO
#ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=0
############################################################
# SSV Airkiss
############################################################
cflags-y += -DCONFIG_SSV_SMARTLINK
############################################################
# Compiler path
############################################################
#SSV_CROSS = $(R_CROSS_COMPILE)
#SSV_KERNEL_PATH = $(KERNEL_BUILD_PATH)
#SSV_ARCH = $(R_ARCH)
#KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,250 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/semaphore.h>
#include <linux/regulator/consumer.h>
#include <mach/hardware.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data
{
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
#define GPIO_REG_WRITEL(val,reg) \
do { \
__raw_writel(val, CTL_PIN_BASE + (reg)); \
} while (0)
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
static struct wifi_platform_data *wifi_control_data = NULL;
static struct resource *wifi_irqres = NULL;
static int g_wifi_irq_rc = 0;
#define SDIO_ID 1
#define IRQ_RES_NAME "ssv_wlan_irq"
#define WIFI_HOST_WAKE 0xFFFF
extern void sunxi_mci_rescan_card(unsigned id, unsigned insert);
extern int wifi_pm_gpio_ctrl(char *name, int level);
static int ssv_wifi_power(int on)
{
printk("ssv pwr on=%d\n", on);
if (on) {
wifi_pm_gpio_ctrl("wl_reg_on", 0);
mdelay(50);
wifi_pm_gpio_ctrl("wl_reg_on", 1);
} else {
wifi_pm_gpio_ctrl("wl_reg_on", 0);
}
return 0;
}
static int ssv_wifi_reset(int on)
{
return 0;
}
int ssv_wifi_set_carddetect(int val)
{
sunxi_mci_rescan_card(SDIO_ID, val);
return 0;
}
static struct wifi_platform_data ssv_wifi_control = {
.set_power = ssv_wifi_power,
.set_reset = ssv_wifi_reset,
.set_carddetect = ssv_wifi_set_carddetect,
};
static struct resource resources[] = { { .start = WIFI_HOST_WAKE,
.flags = IORESOURCE_IRQ,
.name = IRQ_RES_NAME, }, };
void ssv_wifi_device_release(struct device *dev)
{
printk(KERN_INFO "ssv_wifi_device_release\n");
}
static struct platform_device ssv_wifi_device = {
.name = "ssv_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(resources),
.resource = resources,
.dev = { .platform_data = &ssv_wifi_control,
.release = ssv_wifi_device_release, },
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
int wifi_set_reset(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_reset) {
wifi_control_data->set_reset(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev)
{
printk("sdhci_wakeup_irq_handler\n");
disable_irq_nosync(irq);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(struct platform_device *pdev, bool bEnable)
{
int rc = 0, ret = 0;
if (bEnable) {
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
IRQ_RES_NAME);
rc = (int)wifi_irqres->start;
g_wifi_irq_rc = rc;
ret = request_threaded_irq(
rc, NULL, (void *)wifi_wakeup_irq_handler,
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0)
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT | IRQF_FORCE_RESUME,
#else
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT,
#endif
"wlan_wakeup_irq", NULL);
enable_irq_wake(g_wifi_irq_rc);
} else {
if (g_wifi_irq_rc) {
free_irq(g_wifi_irq_rc, NULL);
g_wifi_irq_rc = 0;
}
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk(KERN_ALERT "wifi_probe\n");
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 40);
wifi_set_power(1, 50);
wifi_set_carddetect(1);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_power(0, 0);
wifi_set_carddetect(0);
return 0;
}
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver wifi_driver = { .probe = wifi_probe,
.remove = wifi_remove,
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = { .name =
"ssv_wlan", } };
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret = 0;
sema_init(&wifi_control_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
platform_device_register(&ssv_wifi_device);
platform_driver_register(&wifi_driver);
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n",
__FUNCTION__);
}
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered) {
ssvdevice_exit();
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&ssv_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static int generic_wifi_init_module(void)
{
return initWlan();
}
static void generic_wifi_exit_module(void)
{
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
############################################################
# A33
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /etc/firmware/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 26
volt_regulator = 1
force_chip_identity = 0x75000000
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,18 @@
############################################################
# v66
############################################################
ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
#ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
SSV_CROSS = $(ANDROID_BUILD_TOP)/../lichee/brandy/gcc-linaro/bin/arm-linux-gnueabi-
SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/../lichee/linux-3.4
SSV_ARCH = arm
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,283 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/semaphore.h>
#include <linux/regulator/consumer.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,2,0)
#include <linux/wlan_plat.h>
#else
struct wifi_platform_data {
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
void *(*get_country_code)(char *ccode);
};
#endif
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
static struct wifi_platform_data *wifi_control_data = NULL;
static struct resource *wifi_irqres = NULL;
static int g_wifi_irq_rc=0;
#define SDIO_ID 2
#define IRQ_RES_NAME "ssv_wlan_irq"
#define WIFI_HOST_WAKE 0xFFFF
extern int ssv_6xxx_wlan_init(void);
extern int ssv_wlan_power_on(int flag);
extern int ssv_wlan_power_off(int flag);
static int wifi_pm_gpio_ctrl(char* name, int level)
{
(void)name;
(void)level;
if (level)
{
ssv_wlan_power_on(1);
}
else
{
ssv_wlan_power_off(1);
}
return 0;
}
static int ssv_wifi_power(int on)
{
printk("ssv pwr on=%d\n",on);
if(on)
{
wifi_pm_gpio_ctrl("wifi_ssv6200_power", 0);
mdelay(50);
wifi_pm_gpio_ctrl("wifi_ssv6200_power", 1);
}
else
{
wifi_pm_gpio_ctrl("wifi_ssv6200_power", 0);
}
return 0;
}
static int ssv_wifi_reset(int on)
{
return 0;
}
int ssv_wifi_set_carddetect(int val)
{
if (val)
{
ssv_wlan_power_on(1);
}
else
{
ssv_wlan_power_off(1);
}
return 0;
}
static struct wifi_platform_data ssv_wifi_control = {
.set_power = ssv_wifi_power,
.set_reset = ssv_wifi_reset,
.set_carddetect = ssv_wifi_set_carddetect,
};
static struct resource resources[] = {
{
.start = WIFI_HOST_WAKE,
.flags = IORESOURCE_IRQ,
.name = IRQ_RES_NAME,
},
};
void ssv_wifi_device_release(struct device *dev)
{
printk(KERN_INFO "ssv_wifi_device_release\n");
}
static struct platform_device ssv_wifi_device = {
.name = "ssv_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(resources),
.resource = resources,
.dev = {
.platform_data = &ssv_wifi_control,
.release = ssv_wifi_device_release,
},
};
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
if (msec)
msleep(msec);
return 0;
}
int wifi_set_reset(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_reset) {
wifi_control_data->set_reset(on);
}
if (msec)
msleep(msec);
return 0;
}
static int wifi_set_carddetect(int on)
{
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
return 0;
}
static irqreturn_t wifi_wakeup_irq_handler(int irq, void *dev){
printk("sdhci_wakeup_irq_handler\n");
disable_irq_nosync(irq);
return IRQ_HANDLED;
}
void setup_wifi_wakeup_BB(struct platform_device *pdev, bool bEnable)
{
int rc=0,ret=0;
if (bEnable){
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, IRQ_RES_NAME);
rc = (int)wifi_irqres->start;
g_wifi_irq_rc = rc;
ret = request_threaded_irq(rc,
NULL,
(void *)wifi_wakeup_irq_handler,
#if LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0)
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT |IRQF_FORCE_RESUME,
#else
IRQ_TYPE_LEVEL_HIGH | IRQF_ONESHOT,
#endif
"wlan_wakeup_irq", NULL);
enable_irq_wake(g_wifi_irq_rc);
}else{
if(g_wifi_irq_rc){
free_irq(g_wifi_irq_rc,NULL);
g_wifi_irq_rc = 0;
}
}
}
static int wifi_probe(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
printk(KERN_ALERT "wifi_probe\n");
wifi_control_data = wifi_ctrl;
#ifndef CONFIG_SSV6XXX
ssv_6xxx_wlan_init();
#endif
wifi_set_carddetect(1);
up(&wifi_control_sem);
return 0;
}
static int wifi_remove(struct platform_device *pdev)
{
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0);
wifi_set_carddetect(0);
setup_wifi_wakeup_BB(pdev,false);
return 0;
}
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
setup_wifi_wakeup_BB(pdev,true);
return 0;
}
static int wifi_resume(struct platform_device *pdev)
{
setup_wifi_wakeup_BB(pdev,false);
return 0;
}
static struct platform_driver wifi_driver = {
.probe = wifi_probe,
.remove = wifi_remove,
.suspend = wifi_suspend,
.resume = wifi_resume,
.driver = {
.name = "ssv_wlan",
}
};
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret=0;
sema_init(&wifi_control_sem, 0);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
platform_device_register(&ssv_wifi_device);
platform_driver_register(&wifi_driver);
g_wifidev_registered = 1;
if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
ret = -EINVAL;
printk(KERN_ALERT "%s: platform_driver_register timeout\n", __FUNCTION__);
}
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
platform_driver_unregister(&wifi_driver);
platform_device_unregister(&ssv_wifi_device);
g_wifidev_registered = 0;
}
return;
}
static int generic_wifi_init_module(void)
{
return initWlan();
}
static void generic_wifi_exit_module(void)
{
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
#ifdef CONFIG_SSV6XXX
late_initcall(generic_wifi_init_module);
#else
module_init(generic_wifi_init_module);
#endif
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,88 @@
############################################################
# Ingenic X1000
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
#firmware_path =
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
mac_address_mode = 2
mac_output_path = /opt/conf/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 26
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = off
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################
#register = CE010008:008B7C1C
#register = CE010014:3D7E84FE
#register = CE010048:FCCCCC27

View File

@ -0,0 +1,22 @@
############################################################
# Ingenic X1000
############################################################
#ccflags-y += -DCONFIG_SSV_SUPPORT_ANDROID
ccflags-y += -DCONFIG_SSV_BUILD_AS_ONE_KO
#ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=0
############################################################
# SSV Airkiss
############################################################
ccflags-y += -DCONFIG_SSV_SMARTLINK
############################################################
# Compiler path
############################################################
#SSV_CROSS = $(R_CROSS_COMPILE)
#SSV_KERNEL_PATH = $(KERNEL_BUILD_PATH)
#SSV_ARCH = $(R_ARCH)
#KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,89 @@
/*
* Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
* Copyright (c) 2015 iComm Corporation
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#include <linux/printk.h>
#include <linux/err.h>
#else
#include <config/printk.h>
#endif
#define GPIO_REG_WRITEL(val,reg) do{__raw_writel(val, CTL_PIN_BASE + (reg));}while(0)
extern void mmc_rescan_sdio(void);
extern void wifi_power(int on);
static int g_wifidev_registered = 0;
extern int ssvdevice_init(void);
extern void ssvdevice_exit(void);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
extern int aes_init(void);
extern void aes_fini(void);
extern int sha1_mod_init(void);
extern void sha1_mod_fini(void);
#endif
int initWlan(void)
{
int ret=0;
wifi_power(0);
mdelay(10);
wifi_power(1);
mdelay(120);
mmc_rescan_sdio();
mdelay(120);
g_wifidev_registered = 1;
ret = ssvdevice_init();
return ret;
}
void exitWlan(void)
{
if (g_wifidev_registered)
{
ssvdevice_exit();
wifi_power(0);
g_wifidev_registered = 0;
}
return;
}
static __init int generic_wifi_init_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
sha1_mod_init();
aes_init();
#endif
return initWlan();
}
static __exit void generic_wifi_exit_module(void)
{
printk("%s\n", __func__);
#ifdef CONFIG_SSV_SUPPORT_AES_ASM
aes_fini();
sha1_mod_fini();
#endif
exitWlan();
}
EXPORT_SYMBOL(generic_wifi_init_module);
EXPORT_SYMBOL(generic_wifi_exit_module);
module_init(generic_wifi_init_module);
module_exit(generic_wifi_exit_module);
MODULE_LICENSE("Dual BSD/GPL");

View File

@ -0,0 +1,86 @@
############################################################
# RK3128
# WIFI-CONFIGURATION
##################################################
##################################################
# Firmware setting
# Priority.1 insmod parameter "cfgfirmwarepath"
# Priority.2 firmware_path
# Priority.3 default firmware
##################################################
firmware_path = /dev/
############################################################
# MAC address
#
# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ]
#
# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg]
#
# Priority 3. From insert module parameter
#
# Priority 4. From external file path
# path only support some special charater "_" ":" "/" "." "-"
#
# Priority 5. Default[Software mode]
#
# 0. => 00:33:33:33:33:33
# 1. => Always random
# 2. => First random and write to file[Default path mac_output_path]
#
############################################################
ignore_efuse_mac = 0
#mac_address_path = /xxxx/xxxx
mac_address_mode = 2
mac_output_path = /data/wifimac
##################################################
# Hardware setting
#
#volt regulator(DCDC-0 LDO-1)
#
##################################################
xtal_clock = 24
volt_regulator = 1
##################################################
# Default channel after wifi on
# value range: [1 ~ 14]
##################################################
def_chan = 6
##################################################
# Hardware Capability Settings:
##################################################
hw_cap_ht = on
hw_cap_gf = off
hw_cap_2ghz = on
hw_cap_5ghz = off
hw_cap_security = on
hw_cap_sgi_20 = on
hw_cap_sgi_40 = off
hw_cap_ap = on
hw_cap_p2p = on
hw_cap_ampdu_rx = on
hw_cap_ampdu_tx = on
use_wpa2_only = 1
##################################################
# TX power level setting [0-14]
# The larger the number the smaller the TX power
# 0 - The maximum power
# 1 level = -0.5db
#
# 6051Z .. 4 or 4
# 6051Q .. 2 or 5
# 6051P .. 0 or 0
#
##################################################
#wifi_tx_gain_level_b = 4
#wifi_tx_gain_level_gn = 4
##################################################
# Import extenal configuration(UP to 64 groups)
# example:
# register = CE010010:91919191
# register = 00CC0010:00091919
##################################################

View File

@ -0,0 +1,24 @@
############################################################
# XiongMai Hi3518
############################################################
ccflags-y += -DCONFIG_SSV_BUILD_AS_ONE_KO
ccflags-y += -DCONFIG_SSV_SUPPORT_AES_ASM
ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK
ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3
ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128
ccflags-y += -DCONFIG_SSV_SMARTLINK
ccflags-y += -DMULTI_THREAD_ENCRYPT
ccflags-y += -DKTHREAD_BIND
#ccflags-y += -DCONFIG_SSV_RSSI
############################################################
# Compiler path
############################################################
#SSV_CROSS = arm-hisiv100nptl-linux-
SSV_CROSS = arm-hisiv300-linux-
#SSV_KERNEL_PATH = /data/project/XiongMai/Hi3518_SDK_V1.0.9.0/osdrv/kernel/linux-3.0.y/
SSV_KERNEL_PATH = /data/project/XiongMai/18EV200/Hi3518E_SDK_V1.0.2.0/osdrv/opensource/kernel/linux-3.4.y/
SSV_ARCH = arm
#SSV_STRIP = arm-hisiv100nptl-linux-strip
SSV_STRIP = arm-hisiv300-linux-strip
KMODDESTDIR = $(MODDESTDIR)

View File

@ -0,0 +1,19 @@
$(KMODULE_NAME)-y += $(KERN_SRCS:.c=.o)
obj-$(CONFIG_SSV6200_CORE) += $(KMODULE_NAME).o
.PHONY: all clean install
all:
@$(MAKE) -C /lib/modules/$(KVERSION)/build \
SUBDIRS=$(KBUILD_DIR) CONFIG_DEBUG_SECTION_MISMATCH=y \
modules
clean:
@$(MAKE) -C /lib/modules/$(KVERSION)/build SUBDIRS=$(KBUILD_DIR) clean
install:
@$(MAKE) INSTALL_MOD_DIR=$(DRVPATH) -C /lib/modules/$(KVERSION)/build \
M=$(KBUILD_DIR) modules_install

View File

@ -0,0 +1,52 @@
#!/bin/bash
# ------------------------------
# Clean up first.
./unload_ap.sh
./unload.sh
./clean_log.sh
# Load driver for AP mode.
./ap.sh
sleep 2
# Check interface
if [[ _$1 = _wlan* ]]; then
SSV_WLAN=$1
else
SSV_WLAN=`./find_ssv_wlan`
if [[ _$SSV_WLAN != _wlan* ]]; then
echo "No SSV WLAN device found."
exit 1;
fi
fi
echo SSV device for AP mode is $SSV_WLAN
# Stop network manager from handling WiFi
nmcli nm wifi off
sudo rfkill unblock wlan
# Configure
ifconfig $SSV_WLAN 192.168.33.1 netmask 255.255.255.0
cp dhcpd.conf /tmp/dhcpd_$SSV_WLAN.conf
dhcpd -cf /tmp/dhcpd_$SSV_WLAN.conf -pf /var/run/dhcp-server/dhcpd.pid $SSV_WLAN
bash -c "echo 1 >/proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
ap_name=`./get_mac $SSV_WLAN | cut -d ':' -f 3,4,5 | sed -e s/://g`
ap_name=AP_$ap_name
cat hostapd.conf.AES.template | sed -s s/HOSTAPD_IF/$SSV_WLAN/g | sed -s s/TestAP/$ap_name/g > hostapd.conf
trap handle_stop INT
function handle_stop() {
nmcli nm wifi on
./unload_ap.sh
./unload.sh
echo AP mode stopped
}
/usr/sbin/hostapd hostapd.conf

View File

@ -0,0 +1,25 @@
#!/bin/bash
# ------------------------------
SSV_WLAN=`./find_ssv_wlan`
if [[ _$SSV_WLAN != _wlan* ]]; then
echo "No SSV WLAN device found."
exit 1;
fi
echo SSV device is $SSV_WLAN
nmcli nm wifi off
sudo rfkill unblock wlan
./unload_ap.sh
ifconfig $SSV_WLAN 192.168.33.1 netmask 255.255.255.0
dhcpd -c dhcpd.cfg -pf /var/run/dhcp-server/dhcpd.pid $SSV_WLAN
bash -c "echo 1 >/proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
cat hostapd.conf.NO_SEC.template | sed -s s/HOSTAPD_IF/$SSV_WLAN/g > hostapd.conf
hostapd hostapd.conf
nmcli nm wifi on
# ------------------------------------

View File

@ -0,0 +1,50 @@
#!/bin/bash
# ------------------------------
# Clean up first.
./unload_ap.sh
./unload.sh
./clean_log.sh
# Load driver for AP mode.
./ap.sh
sleep 2
# Check interface
if [[ _$1 = _wlan* ]]; then
SSV_WLAN=$1
else
SSV_WLAN=`./find_ssv_wlan`
if [[ _$SSV_WLAN != _wlan* ]]; then
echo "No SSV WLAN device found."
exit 1;
fi
fi
echo SSV device for AP mode is $SSV_WLAN
# Stop network manager from handling WiFi
nmcli nm wifi off
sudo rfkill unblock wlan
# Configure
ifconfig $SSV_WLAN 192.168.33.1 netmask 255.255.255.0
cp dhcpd.conf /tmp/dhcpd_$SSV_WLAN.conf
dhcpd -cf /tmp/dhcpd_$SSV_WLAN.conf -pf /var/run/dhcp-server/dhcpd.pid $SSV_WLAN
bash -c "echo 1 >/proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
cat hostapd.conf.TKIP.template | sed -s s/HOSTAPD_IF/$SSV_WLAN/g > hostapd.conf
trap handle_stop INT
function handle_stop() {
nmcli nm wifi on
./unload_ap.sh
./unload.sh
echo AP mode stopped
}
hostapd hostapd.conf

View File

@ -0,0 +1,40 @@
#!/bin/bash
echo "=================================================="
echo "1.Copy firmware"
echo "=================================================="
cp ../image/ssv6200-sw.bin /lib/firmware/
echo "=================================================="
echo "1.Unload Module"
echo "=================================================="
./unload.sh
echo "=================================================="
echo "2.Set Hardware Capability"
echo "=================================================="
eth0_local_mac=`ifconfig eth0 | grep HWaddr | sed -e 's/.*HWaddr //g' | sed -e 's/ //g' | cut -d ':' -f 4,5,6`
[ "$eth0_local_mac" == "" ] && eth0_local_mac="45:67:89"
local_mac=00:aa:bb:$eth0_local_mac
local_mac_2=00:00:00:00:00:00
echo WLAN MAC is $local_mac
cat sta.cfg.template | sed -e "s/MAC_ADDR/$local_mac/g" | sed -e "s/MAC2ADDR/$local_mac_2/g" > sta_local_mac.cfg
./ssvcfg.sh sta_local_mac.cfg
echo "=================================================="
echo "3.Load MMC Module"
echo "=================================================="
modprobe mmc_core sdiomaxclock=25000000
modprobe sdhci
modprobe sdhci-pci
modprobe mmc_block
echo "=================================================="
echo "4.Load SSV6200 Driver"
echo "=================================================="
echo 6 > /proc/sys/kernel/printk
modprobe ssv6200_sdio

View File

@ -0,0 +1,32 @@
#!/bin/bash
# ------------------------------
if [[ _$1 = _wlan* ]]; then
SSV_WLAN=$1
else
SSV_WLAN=`./find_ssv_wlan`
if [[ _$SSV_WLAN != _wlan* ]]; then
echo "No SSV WLAN device found."
exit 1;
fi
fi
echo SSV device for AP mode is $SSV_WLAN
#nmcli nm wifi off
#sudo rfkill unblock wlan
./unload_ap.sh
ifconfig $SSV_WLAN 192.168.33.1 netmask 255.255.255.0
cp dhcpd.conf /tmp/dhcpd_$SSV_WLAN.conf
dhcpd -cf /tmp/dhcpd_$SSV_WLAN.conf -pf /var/run/dhcp-server/dhcpd.pid $SSV_WLAN
bash -c "echo 1 >/proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
cat hostapd.conf.AES.template | sed -s s/HOSTAPD_IF/$SSV_WLAN/g > hostapd.conf
hostapd hostapd.conf
#nmcli nm wifi on
echo AP mode stopped
# ------------------------------------

Some files were not shown because too many files have changed in this diff Show More