18c2ecf20Sopenharmony_ci# Copyright (C) 2011-2014, Marvell International Ltd.
28c2ecf20Sopenharmony_ci#
38c2ecf20Sopenharmony_ci# This software file (the "File") is distributed by Marvell International
48c2ecf20Sopenharmony_ci# Ltd. under the terms of the GNU General Public License Version 2, June 1991
58c2ecf20Sopenharmony_ci# (the "License").  You may use, redistribute and/or modify this File in
68c2ecf20Sopenharmony_ci# accordance with the terms and conditions of the License, a copy of which
78c2ecf20Sopenharmony_ci# is available by writing to the Free Software Foundation, Inc.,
88c2ecf20Sopenharmony_ci# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
98c2ecf20Sopenharmony_ci# worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
108c2ecf20Sopenharmony_ci#
118c2ecf20Sopenharmony_ci# THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
128c2ecf20Sopenharmony_ci# IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
138c2ecf20Sopenharmony_ci# ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
148c2ecf20Sopenharmony_ci# this warranty disclaimer.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci===============================================================================
188c2ecf20Sopenharmony_ci			U S E R  M A N U A L
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci1) FOR DRIVER INSTALL
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci	a) Copy sd8787.bin to /lib/firmware/mrvl/ directory,
238c2ecf20Sopenharmony_ci	   create the directory if it doesn't exist.
248c2ecf20Sopenharmony_ci	b) Install WLAN driver,
258c2ecf20Sopenharmony_ci		insmod mwifiex.ko
268c2ecf20Sopenharmony_ci	c) Uninstall WLAN driver,
278c2ecf20Sopenharmony_ci		ifconfig mlanX down
288c2ecf20Sopenharmony_ci		rmmod mwifiex
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci2) FOR DRIVER CONFIGURATION AND INFO
328c2ecf20Sopenharmony_ci	The configurations can be done either using the 'iw' user space
338c2ecf20Sopenharmony_ci	utility or debugfs.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	a) 'iw' utility commands
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	Following are some useful iw commands:-
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciiw dev mlan0 scan
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	This command will trigger a scan.
428c2ecf20Sopenharmony_ci	The command will then display the scan table entries
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciiw dev mlan0 connect -w <SSID> [<freq in MHz>] [<bssid>] [key 0:abcde d:1123456789a]
458c2ecf20Sopenharmony_ci	The above command can be used to connect to an AP with a particular SSID.
468c2ecf20Sopenharmony_ci	Ap's operating frequency can be specified or even the bssid. If the AP is using
478c2ecf20Sopenharmony_ci	WEP encryption, wep keys can be specified in the command.
488c2ecf20Sopenharmony_ci	Note: Every time before connecting to an AP scan command (iw dev mlan0 scan) should be used by user.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciiw dev mlan0 disconnect
518c2ecf20Sopenharmony_ci	This command will be used to disconnect from an AP.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciiw dev mlan0 ibss join <SSID> <freq in MHz> [fixed-freq] [fixed-bssid] [key 0:abcde]
558c2ecf20Sopenharmony_ci	The command will be used to join or create an ibss. Optionally, operating frequency,
568c2ecf20Sopenharmony_ci	bssid and the security related parameters can be specified while joining/creating
578c2ecf20Sopenharmony_ci	and ibss.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciiw dev mlan0 ibss leave
608c2ecf20Sopenharmony_ci	The command will be used to leave an ibss network.
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciiw dev mlan0 link
638c2ecf20Sopenharmony_ci	The command will be used to get the connection status. The command will return parameters
648c2ecf20Sopenharmony_ci	such as SSID, operating frequency, rx/tx packets, signal strength, tx bitrate.
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	Apart from the iw utility all standard configurations using the 'iwconfig' utility are also supported.
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci	b) Debugfs interface
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	The debugfs interface can be used for configurations and for getting
718c2ecf20Sopenharmony_ci	some useful information from the driver.
728c2ecf20Sopenharmony_ci	The section below explains the configurations that can be
738c2ecf20Sopenharmony_ci	done.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	Mount debugfs to /debugfs mount point:
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci		mkdir /debugfs
788c2ecf20Sopenharmony_ci		mount -t debugfs debugfs /debugfs
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci	The information is provided in /debugfs/mwifiex/mlanX/:
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ciiw reg set <country code>
838c2ecf20Sopenharmony_ci	The command will be used to change the regulatory domain.
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ciiw reg get
868c2ecf20Sopenharmony_ci	The command will be used to get current regulatory domain.
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ciinfo
898c2ecf20Sopenharmony_ci	This command is used to get driver info.
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	Usage:
928c2ecf20Sopenharmony_ci		cat info
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci	driver_name = "mwifiex"
958c2ecf20Sopenharmony_ci	driver_version = <driver_name, driver_version, (firmware_version)>
968c2ecf20Sopenharmony_ci	interface_name = "mlanX"
978c2ecf20Sopenharmony_ci	bss_mode = "Ad-hoc" | "Managed" | "Auto" | "Unknown"
988c2ecf20Sopenharmony_ci	media_state = "Disconnected" | "Connected"
998c2ecf20Sopenharmony_ci	mac_address = <6-byte adapter MAC address>
1008c2ecf20Sopenharmony_ci	multicase_count = <multicast address count>
1018c2ecf20Sopenharmony_ci	essid = <current SSID>
1028c2ecf20Sopenharmony_ci	bssid = <current BSSID>
1038c2ecf20Sopenharmony_ci	channel = <current channel>
1048c2ecf20Sopenharmony_ci	region_code = <current region code>
1058c2ecf20Sopenharmony_ci	multicasr_address[n] = <multicast address>
1068c2ecf20Sopenharmony_ci	num_tx_bytes = <number of bytes sent to device>
1078c2ecf20Sopenharmony_ci	num_rx_bytes = <number of bytes received from device and sent to kernel>
1088c2ecf20Sopenharmony_ci	num_tx_pkts = <number of packets sent to device>
1098c2ecf20Sopenharmony_ci	num_rx_pkts = <number of packets received from device and sent to kernel>
1108c2ecf20Sopenharmony_ci	num_tx_pkts_dropped = <number of Tx packets dropped by driver>
1118c2ecf20Sopenharmony_ci	num_rx_pkts_dropped = <number of Rx packets dropped by driver>
1128c2ecf20Sopenharmony_ci	num_tx_pkts_err = <number of Tx packets failed to send to device>
1138c2ecf20Sopenharmony_ci	num_rx_pkts_err = <number of Rx packets failed to receive from device>
1148c2ecf20Sopenharmony_ci	carrier "on" | "off"
1158c2ecf20Sopenharmony_ci	tx queue "stopped" | "started"
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	The following debug info are provided in /debugfs/mwifiex/mlanX/debug:
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	int_counter = <interrupt count, cleared when interrupt handled>
1208c2ecf20Sopenharmony_ci	wmm_ac_vo = <number of packets sent to device from WMM AcVo queue>
1218c2ecf20Sopenharmony_ci	wmm_ac_vi = <number of packets sent to device from WMM AcVi queue>
1228c2ecf20Sopenharmony_ci	wmm_ac_be = <number of packets sent to device from WMM AcBE queue>
1238c2ecf20Sopenharmony_ci	wmm_ac_bk = <number of packets sent to device from WMM AcBK queue>
1248c2ecf20Sopenharmony_ci	tx_buf_size = <current Tx buffer size>
1258c2ecf20Sopenharmony_ci	curr_tx_buf_size = <current Tx buffer size>
1268c2ecf20Sopenharmony_ci	ps_mode = <0/1, CAM mode/PS mode>
1278c2ecf20Sopenharmony_ci	ps_state = <0/1/2/3, full power state/awake state/pre-sleep state/sleep state>
1288c2ecf20Sopenharmony_ci	is_deep_sleep = <0/1, not deep sleep state/deep sleep state>
1298c2ecf20Sopenharmony_ci	wakeup_dev_req = <0/1, wakeup device not required/required>
1308c2ecf20Sopenharmony_ci	wakeup_tries = <wakeup device count, cleared when device awake>
1318c2ecf20Sopenharmony_ci	hs_configured = <0/1, host sleep not configured/configured>
1328c2ecf20Sopenharmony_ci	hs_activated = <0/1, extended host sleep not activated/activated>
1338c2ecf20Sopenharmony_ci	num_tx_timeout = <number of Tx timeout>
1348c2ecf20Sopenharmony_ci	is_cmd_timedout = <0/1 command timeout not occurred/occurred>
1358c2ecf20Sopenharmony_ci	timeout_cmd_id = <command id of the last timeout command>
1368c2ecf20Sopenharmony_ci	timeout_cmd_act = <command action of the last timeout command>
1378c2ecf20Sopenharmony_ci	last_cmd_id = <command id of the last several commands sent to device>
1388c2ecf20Sopenharmony_ci	last_cmd_act = <command action of the last several commands sent to device>
1398c2ecf20Sopenharmony_ci	last_cmd_index = <0 based last command index>
1408c2ecf20Sopenharmony_ci	last_cmd_resp_id = <command id of the last several command responses received from device>
1418c2ecf20Sopenharmony_ci	last_cmd_resp_index = <0 based last command response index>
1428c2ecf20Sopenharmony_ci	last_event = <event id of the last several events received from device>
1438c2ecf20Sopenharmony_ci	last_event_index = <0 based last event index>
1448c2ecf20Sopenharmony_ci	num_cmd_h2c_fail = <number of commands failed to send to device>
1458c2ecf20Sopenharmony_ci	num_cmd_sleep_cfm_fail = <number of sleep confirm failed to send to device>
1468c2ecf20Sopenharmony_ci	num_tx_h2c_fail = <number of data packets failed to send to device>
1478c2ecf20Sopenharmony_ci	num_evt_deauth = <number of deauthenticated events received from device>
1488c2ecf20Sopenharmony_ci	num_evt_disassoc = <number of disassociated events received from device>
1498c2ecf20Sopenharmony_ci	num_evt_link_lost = <number of link lost events received from device>
1508c2ecf20Sopenharmony_ci	num_cmd_deauth = <number of deauthenticate commands sent to device>
1518c2ecf20Sopenharmony_ci	num_cmd_assoc_ok = <number of associate commands with success return>
1528c2ecf20Sopenharmony_ci	num_cmd_assoc_fail = <number of associate commands with failure return>
1538c2ecf20Sopenharmony_ci	cmd_sent = <0/1, send command resources available/sending command to device>
1548c2ecf20Sopenharmony_ci	data_sent = <0/1, send data resources available/sending data to device>
1558c2ecf20Sopenharmony_ci	mp_rd_bitmap = <SDIO multi-port read bitmap>
1568c2ecf20Sopenharmony_ci	mp_wr_bitmap = <SDIO multi-port write bitmap>
1578c2ecf20Sopenharmony_ci	cmd_resp_received = <0/1, no cmd response to process/response received and yet to process>
1588c2ecf20Sopenharmony_ci	event_received = <0/1, no event to process/event received and yet to process>
1598c2ecf20Sopenharmony_ci	cmd_pending = <number of cmd pending>
1608c2ecf20Sopenharmony_ci	tx_pending = <number of Tx packet pending>
1618c2ecf20Sopenharmony_ci	rx_pending = <number of Rx packet pending>
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci3) FOR DRIVER CONFIGURATION
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ciregrdwr
1678c2ecf20Sopenharmony_ci	This command is used to read/write the adapter register.
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci	Usage:
1708c2ecf20Sopenharmony_ci		echo " <type> <offset> [value]" > regrdwr
1718c2ecf20Sopenharmony_ci		cat regrdwr
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci	where the parameters are,
1748c2ecf20Sopenharmony_ci		<type>:     1:MAC/SOC, 2:BBP, 3:RF, 4:PMIC, 5:CAU
1758c2ecf20Sopenharmony_ci		<offset>:   offset of register
1768c2ecf20Sopenharmony_ci		[value]:    value to be written
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	Examples:
1798c2ecf20Sopenharmony_ci		echo "1 0xa060" > regrdwr           : Read the MAC register
1808c2ecf20Sopenharmony_ci		echo "1 0xa060 0x12" > regrdwr      : Write the MAC register
1818c2ecf20Sopenharmony_ci		echo "1 0xa794 0x80000000" > regrdwr
1828c2ecf20Sopenharmony_ci		                                    : Write 0x80000000 to MAC register
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_cimemrw
1858c2ecf20Sopenharmony_ci	This command is used to read/write the firmware memory.
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	Usage:
1888c2ecf20Sopenharmony_ci		1) For reading firmware memory location.
1898c2ecf20Sopenharmony_ci			echo r <address> 0 > /sys/kernel/debug/mwifiex/mlan0/memrw
1908c2ecf20Sopenharmony_ci			cat /sys/kernel/debug/mwifiex/mlan0/memrw
1918c2ecf20Sopenharmony_ci		2) For writing value to firmware memory location.
1928c2ecf20Sopenharmony_ci			echo w <address> [value] > /sys/kernel/debug/mwifiex/mlan0/memrw
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci	where the parameters are,
1958c2ecf20Sopenharmony_ci		<address>:  memory address
1968c2ecf20Sopenharmony_ci		[value]:    value to be written
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci	Examples:
1998c2ecf20Sopenharmony_ci		echo r 0x4cf70 0 > /sys/kernel/debug/mwifiex/mlan0/memrw
2008c2ecf20Sopenharmony_ci		cat /sys/kernel/debug/mwifiex/mlan0/memrw
2018c2ecf20Sopenharmony_ci						: Read memory address 0x4cf70
2028c2ecf20Sopenharmony_ci		iwpriv mlan0 memrdwr -0x7fff6000 -0x40000000
2038c2ecf20Sopenharmony_ci		echo w 0x8000a000 0xc0000000 > /sys/kernel/debug/mwifiex/mlan0/memrw
2048c2ecf20Sopenharmony_ci						: Write 0xc0000000 to memory address 0x8000a000
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_cirdeeprom
2078c2ecf20Sopenharmony_ci	This command is used to read the EEPROM contents of the card.
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci	Usage:
2108c2ecf20Sopenharmony_ci		echo "<offset> <length>" > rdeeprom
2118c2ecf20Sopenharmony_ci		cat rdeeprom
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci	where the parameters are,
2148c2ecf20Sopenharmony_ci		<offset>:   multiples of 4
2158c2ecf20Sopenharmony_ci		<length>:   4-20, multiples of 4
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci	Example:
2188c2ecf20Sopenharmony_ci		echo "0 20" > rdeeprom      : Read 20 bytes of EEPROM data from offset 0
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_cihscfg
2218c2ecf20Sopenharmony_ci	This command is used to debug/simulate host sleep feature using
2228c2ecf20Sopenharmony_ci	different configuration parameters.
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	Usage:
2258c2ecf20Sopenharmony_ci		echo "<condition> [GPIO# [gap]]]" > hscfg
2268c2ecf20Sopenharmony_ci		cat hscfg
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	where the parameters are,
2298c2ecf20Sopenharmony_ci		<condition>: bit 0 = 1   -- broadcast data
2308c2ecf20Sopenharmony_ci			     bit 1 = 1   -- unicast data
2318c2ecf20Sopenharmony_ci			     bit 2 = 1   -- mac event
2328c2ecf20Sopenharmony_ci			     bit 3 = 1   -- multicast data
2338c2ecf20Sopenharmony_ci		[GPIO#]: pin number of GPIO used to wakeup the host.
2348c2ecf20Sopenharmony_ci			 GPIO pin# (e.g. 0-7) or 0xff (interface, e.g. SDIO
2358c2ecf20Sopenharmony_ci			 will be used instead).
2368c2ecf20Sopenharmony_ci		[gap]:   the gap in milliseconds between wakeup signal and
2378c2ecf20Sopenharmony_ci			 wakeup event or 0xff for special setting (host
2388c2ecf20Sopenharmony_ci			 acknowledge required) when GPIO is used to wakeup host.
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	Examples:
2418c2ecf20Sopenharmony_ci		echo "-1" > hscfg        : Cancel host sleep mode
2428c2ecf20Sopenharmony_ci		echo "3" > hscfg         : Broadcast and unicast data;
2438c2ecf20Sopenharmony_ci					   Use GPIO and gap set previously
2448c2ecf20Sopenharmony_ci		echo "2 3" > hscfg       : Unicast data and GPIO 3;
2458c2ecf20Sopenharmony_ci					   Use gap set previously
2468c2ecf20Sopenharmony_ci		echo "2 1 160" > hscfg   : Unicast data, GPIO 1 and gap 160 ms
2478c2ecf20Sopenharmony_ci		echo "2 1 0xff" > hscfg  : Unicast data, GPIO 1; Wait for host
2488c2ecf20Sopenharmony_ci					   to ack before sending wakeup event
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_cigetlog
2518c2ecf20Sopenharmony_ci        This command is used to get the statistics available in the station.
2528c2ecf20Sopenharmony_ci	Usage:
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci	cat getlog
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_cidevice_dump
2578c2ecf20Sopenharmony_ci	This command is used to dump driver information and firmware memory
2588c2ecf20Sopenharmony_ci	segments.
2598c2ecf20Sopenharmony_ci	Usage:
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci	cat fw_dump
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_civerext
2648c2ecf20Sopenharmony_ci	This command is used to get extended firmware version string using
2658c2ecf20Sopenharmony_ci	different configuration parameters.
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci	Usage:
2688c2ecf20Sopenharmony_ci		echo "[version_str_sel]" > verext
2698c2ecf20Sopenharmony_ci		cat verext
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci		[version_str_sel]: firmware support several extend version
2728c2ecf20Sopenharmony_ci				   string cases, include 0/1/10/20/21/99
2738c2ecf20Sopenharmony_ci===============================================================================
274