162306a36Sopenharmony_ci#
262306a36Sopenharmony_ci# Copyright 2011-2020 NXP
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# This software file (the "File") is distributed by NXP
562306a36Sopenharmony_ci# under the terms of the GNU General Public License Version 2, June 1991
662306a36Sopenharmony_ci# (the "License").  You may use, redistribute and/or modify this File in
762306a36Sopenharmony_ci# accordance with the terms and conditions of the License, a copy of which
862306a36Sopenharmony_ci# is available by writing to the Free Software Foundation, Inc.,
962306a36Sopenharmony_ci# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
1062306a36Sopenharmony_ci# worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
1162306a36Sopenharmony_ci#
1262306a36Sopenharmony_ci# THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
1362306a36Sopenharmony_ci# IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
1462306a36Sopenharmony_ci# ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
1562306a36Sopenharmony_ci# this warranty disclaimer.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci===============================================================================
1962306a36Sopenharmony_ci			U S E R  M A N U A L
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci1) FOR DRIVER INSTALL
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci	a) Copy sd8787.bin to /lib/firmware/mrvl/ directory,
2462306a36Sopenharmony_ci	   create the directory if it doesn't exist.
2562306a36Sopenharmony_ci	b) Install WLAN driver,
2662306a36Sopenharmony_ci		insmod mwifiex.ko
2762306a36Sopenharmony_ci	c) Uninstall WLAN driver,
2862306a36Sopenharmony_ci		ifconfig mlanX down
2962306a36Sopenharmony_ci		rmmod mwifiex
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci2) FOR DRIVER CONFIGURATION AND INFO
3362306a36Sopenharmony_ci	The configurations can be done either using the 'iw' user space
3462306a36Sopenharmony_ci	utility or debugfs.
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	a) 'iw' utility commands
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci	Following are some useful iw commands:-
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciiw dev mlan0 scan
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	This command will trigger a scan.
4362306a36Sopenharmony_ci	The command will then display the scan table entries
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciiw dev mlan0 connect -w <SSID> [<freq in MHz>] [<bssid>] [key 0:abcde d:1123456789a]
4662306a36Sopenharmony_ci	The above command can be used to connect to an AP with a particular SSID.
4762306a36Sopenharmony_ci	Ap's operating frequency can be specified or even the bssid. If the AP is using
4862306a36Sopenharmony_ci	WEP encryption, wep keys can be specified in the command.
4962306a36Sopenharmony_ci	Note: Every time before connecting to an AP scan command (iw dev mlan0 scan) should be used by user.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciiw dev mlan0 disconnect
5262306a36Sopenharmony_ci	This command will be used to disconnect from an AP.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciiw dev mlan0 ibss join <SSID> <freq in MHz> [fixed-freq] [fixed-bssid] [key 0:abcde]
5662306a36Sopenharmony_ci	The command will be used to join or create an ibss. Optionally, operating frequency,
5762306a36Sopenharmony_ci	bssid and the security related parameters can be specified while joining/creating
5862306a36Sopenharmony_ci	and ibss.
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciiw dev mlan0 ibss leave
6162306a36Sopenharmony_ci	The command will be used to leave an ibss network.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciiw dev mlan0 link
6462306a36Sopenharmony_ci	The command will be used to get the connection status. The command will return parameters
6562306a36Sopenharmony_ci	such as SSID, operating frequency, rx/tx packets, signal strength, tx bitrate.
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	Apart from the iw utility all standard configurations using the 'iwconfig' utility are also supported.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci	b) Debugfs interface
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci	The debugfs interface can be used for configurations and for getting
7262306a36Sopenharmony_ci	some useful information from the driver.
7362306a36Sopenharmony_ci	The section below explains the configurations that can be
7462306a36Sopenharmony_ci	done.
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci	Mount debugfs to /debugfs mount point:
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci		mkdir /debugfs
7962306a36Sopenharmony_ci		mount -t debugfs debugfs /debugfs
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci	The information is provided in /debugfs/mwifiex/mlanX/:
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ciiw reg set <country code>
8462306a36Sopenharmony_ci	The command will be used to change the regulatory domain.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciiw reg get
8762306a36Sopenharmony_ci	The command will be used to get current regulatory domain.
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ciinfo
9062306a36Sopenharmony_ci	This command is used to get driver info.
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci	Usage:
9362306a36Sopenharmony_ci		cat info
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci	driver_name = "mwifiex"
9662306a36Sopenharmony_ci	driver_version = <driver_name, driver_version, (firmware_version)>
9762306a36Sopenharmony_ci	interface_name = "mlanX"
9862306a36Sopenharmony_ci	bss_mode = "Ad-hoc" | "Managed" | "Auto" | "Unknown"
9962306a36Sopenharmony_ci	media_state = "Disconnected" | "Connected"
10062306a36Sopenharmony_ci	mac_address = <6-byte adapter MAC address>
10162306a36Sopenharmony_ci	multicase_count = <multicast address count>
10262306a36Sopenharmony_ci	essid = <current SSID>
10362306a36Sopenharmony_ci	bssid = <current BSSID>
10462306a36Sopenharmony_ci	channel = <current channel>
10562306a36Sopenharmony_ci	region_code = <current region code>
10662306a36Sopenharmony_ci	multicasr_address[n] = <multicast address>
10762306a36Sopenharmony_ci	num_tx_bytes = <number of bytes sent to device>
10862306a36Sopenharmony_ci	num_rx_bytes = <number of bytes received from device and sent to kernel>
10962306a36Sopenharmony_ci	num_tx_pkts = <number of packets sent to device>
11062306a36Sopenharmony_ci	num_rx_pkts = <number of packets received from device and sent to kernel>
11162306a36Sopenharmony_ci	num_tx_pkts_dropped = <number of Tx packets dropped by driver>
11262306a36Sopenharmony_ci	num_rx_pkts_dropped = <number of Rx packets dropped by driver>
11362306a36Sopenharmony_ci	num_tx_pkts_err = <number of Tx packets failed to send to device>
11462306a36Sopenharmony_ci	num_rx_pkts_err = <number of Rx packets failed to receive from device>
11562306a36Sopenharmony_ci	carrier "on" | "off"
11662306a36Sopenharmony_ci	tx queue "stopped" | "started"
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci	The following debug info are provided in /debugfs/mwifiex/mlanX/debug:
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci	int_counter = <interrupt count, cleared when interrupt handled>
12162306a36Sopenharmony_ci	wmm_ac_vo = <number of packets sent to device from WMM AcVo queue>
12262306a36Sopenharmony_ci	wmm_ac_vi = <number of packets sent to device from WMM AcVi queue>
12362306a36Sopenharmony_ci	wmm_ac_be = <number of packets sent to device from WMM AcBE queue>
12462306a36Sopenharmony_ci	wmm_ac_bk = <number of packets sent to device from WMM AcBK queue>
12562306a36Sopenharmony_ci	tx_buf_size = <current Tx buffer size>
12662306a36Sopenharmony_ci	curr_tx_buf_size = <current Tx buffer size>
12762306a36Sopenharmony_ci	ps_mode = <0/1, CAM mode/PS mode>
12862306a36Sopenharmony_ci	ps_state = <0/1/2/3, full power state/awake state/pre-sleep state/sleep state>
12962306a36Sopenharmony_ci	is_deep_sleep = <0/1, not deep sleep state/deep sleep state>
13062306a36Sopenharmony_ci	wakeup_dev_req = <0/1, wakeup device not required/required>
13162306a36Sopenharmony_ci	wakeup_tries = <wakeup device count, cleared when device awake>
13262306a36Sopenharmony_ci	hs_configured = <0/1, host sleep not configured/configured>
13362306a36Sopenharmony_ci	hs_activated = <0/1, extended host sleep not activated/activated>
13462306a36Sopenharmony_ci	num_tx_timeout = <number of Tx timeout>
13562306a36Sopenharmony_ci	is_cmd_timedout = <0/1 command timeout not occurred/occurred>
13662306a36Sopenharmony_ci	timeout_cmd_id = <command id of the last timeout command>
13762306a36Sopenharmony_ci	timeout_cmd_act = <command action of the last timeout command>
13862306a36Sopenharmony_ci	last_cmd_id = <command id of the last several commands sent to device>
13962306a36Sopenharmony_ci	last_cmd_act = <command action of the last several commands sent to device>
14062306a36Sopenharmony_ci	last_cmd_index = <0 based last command index>
14162306a36Sopenharmony_ci	last_cmd_resp_id = <command id of the last several command responses received from device>
14262306a36Sopenharmony_ci	last_cmd_resp_index = <0 based last command response index>
14362306a36Sopenharmony_ci	last_event = <event id of the last several events received from device>
14462306a36Sopenharmony_ci	last_event_index = <0 based last event index>
14562306a36Sopenharmony_ci	num_cmd_h2c_fail = <number of commands failed to send to device>
14662306a36Sopenharmony_ci	num_cmd_sleep_cfm_fail = <number of sleep confirm failed to send to device>
14762306a36Sopenharmony_ci	num_tx_h2c_fail = <number of data packets failed to send to device>
14862306a36Sopenharmony_ci	num_evt_deauth = <number of deauthenticated events received from device>
14962306a36Sopenharmony_ci	num_evt_disassoc = <number of disassociated events received from device>
15062306a36Sopenharmony_ci	num_evt_link_lost = <number of link lost events received from device>
15162306a36Sopenharmony_ci	num_cmd_deauth = <number of deauthenticate commands sent to device>
15262306a36Sopenharmony_ci	num_cmd_assoc_ok = <number of associate commands with success return>
15362306a36Sopenharmony_ci	num_cmd_assoc_fail = <number of associate commands with failure return>
15462306a36Sopenharmony_ci	cmd_sent = <0/1, send command resources available/sending command to device>
15562306a36Sopenharmony_ci	data_sent = <0/1, send data resources available/sending data to device>
15662306a36Sopenharmony_ci	mp_rd_bitmap = <SDIO multi-port read bitmap>
15762306a36Sopenharmony_ci	mp_wr_bitmap = <SDIO multi-port write bitmap>
15862306a36Sopenharmony_ci	cmd_resp_received = <0/1, no cmd response to process/response received and yet to process>
15962306a36Sopenharmony_ci	event_received = <0/1, no event to process/event received and yet to process>
16062306a36Sopenharmony_ci	cmd_pending = <number of cmd pending>
16162306a36Sopenharmony_ci	tx_pending = <number of Tx packet pending>
16262306a36Sopenharmony_ci	rx_pending = <number of Rx packet pending>
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci3) FOR DRIVER CONFIGURATION
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ciregrdwr
16862306a36Sopenharmony_ci	This command is used to read/write the adapter register.
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci	Usage:
17162306a36Sopenharmony_ci		echo " <type> <offset> [value]" > regrdwr
17262306a36Sopenharmony_ci		cat regrdwr
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci	where the parameters are,
17562306a36Sopenharmony_ci		<type>:     1:MAC/SOC, 2:BBP, 3:RF, 4:PMIC, 5:CAU
17662306a36Sopenharmony_ci		<offset>:   offset of register
17762306a36Sopenharmony_ci		[value]:    value to be written
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci	Examples:
18062306a36Sopenharmony_ci		echo "1 0xa060" > regrdwr           : Read the MAC register
18162306a36Sopenharmony_ci		echo "1 0xa060 0x12" > regrdwr      : Write the MAC register
18262306a36Sopenharmony_ci		echo "1 0xa794 0x80000000" > regrdwr
18362306a36Sopenharmony_ci		                                    : Write 0x80000000 to MAC register
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_cimemrw
18662306a36Sopenharmony_ci	This command is used to read/write the firmware memory.
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci	Usage:
18962306a36Sopenharmony_ci		1) For reading firmware memory location.
19062306a36Sopenharmony_ci			echo r <address> 0 > /sys/kernel/debug/mwifiex/mlan0/memrw
19162306a36Sopenharmony_ci			cat /sys/kernel/debug/mwifiex/mlan0/memrw
19262306a36Sopenharmony_ci		2) For writing value to firmware memory location.
19362306a36Sopenharmony_ci			echo w <address> [value] > /sys/kernel/debug/mwifiex/mlan0/memrw
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci	where the parameters are,
19662306a36Sopenharmony_ci		<address>:  memory address
19762306a36Sopenharmony_ci		[value]:    value to be written
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci	Examples:
20062306a36Sopenharmony_ci		echo r 0x4cf70 0 > /sys/kernel/debug/mwifiex/mlan0/memrw
20162306a36Sopenharmony_ci		cat /sys/kernel/debug/mwifiex/mlan0/memrw
20262306a36Sopenharmony_ci						: Read memory address 0x4cf70
20362306a36Sopenharmony_ci		iwpriv mlan0 memrdwr -0x7fff6000 -0x40000000
20462306a36Sopenharmony_ci		echo w 0x8000a000 0xc0000000 > /sys/kernel/debug/mwifiex/mlan0/memrw
20562306a36Sopenharmony_ci						: Write 0xc0000000 to memory address 0x8000a000
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_cirdeeprom
20862306a36Sopenharmony_ci	This command is used to read the EEPROM contents of the card.
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci	Usage:
21162306a36Sopenharmony_ci		echo "<offset> <length>" > rdeeprom
21262306a36Sopenharmony_ci		cat rdeeprom
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci	where the parameters are,
21562306a36Sopenharmony_ci		<offset>:   multiples of 4
21662306a36Sopenharmony_ci		<length>:   4-20, multiples of 4
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci	Example:
21962306a36Sopenharmony_ci		echo "0 20" > rdeeprom      : Read 20 bytes of EEPROM data from offset 0
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_cihscfg
22262306a36Sopenharmony_ci	This command is used to debug/simulate host sleep feature using
22362306a36Sopenharmony_ci	different configuration parameters.
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci	Usage:
22662306a36Sopenharmony_ci		echo "<condition> [GPIO# [gap]]]" > hscfg
22762306a36Sopenharmony_ci		cat hscfg
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci	where the parameters are,
23062306a36Sopenharmony_ci		<condition>: bit 0 = 1   -- broadcast data
23162306a36Sopenharmony_ci			     bit 1 = 1   -- unicast data
23262306a36Sopenharmony_ci			     bit 2 = 1   -- mac event
23362306a36Sopenharmony_ci			     bit 3 = 1   -- multicast data
23462306a36Sopenharmony_ci		[GPIO#]: pin number of GPIO used to wakeup the host.
23562306a36Sopenharmony_ci			 GPIO pin# (e.g. 0-7) or 0xff (interface, e.g. SDIO
23662306a36Sopenharmony_ci			 will be used instead).
23762306a36Sopenharmony_ci		[gap]:   the gap in milliseconds between wakeup signal and
23862306a36Sopenharmony_ci			 wakeup event or 0xff for special setting (host
23962306a36Sopenharmony_ci			 acknowledge required) when GPIO is used to wakeup host.
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci	Examples:
24262306a36Sopenharmony_ci		echo "-1" > hscfg        : Cancel host sleep mode
24362306a36Sopenharmony_ci		echo "3" > hscfg         : Broadcast and unicast data;
24462306a36Sopenharmony_ci					   Use GPIO and gap set previously
24562306a36Sopenharmony_ci		echo "2 3" > hscfg       : Unicast data and GPIO 3;
24662306a36Sopenharmony_ci					   Use gap set previously
24762306a36Sopenharmony_ci		echo "2 1 160" > hscfg   : Unicast data, GPIO 1 and gap 160 ms
24862306a36Sopenharmony_ci		echo "2 1 0xff" > hscfg  : Unicast data, GPIO 1; Wait for host
24962306a36Sopenharmony_ci					   to ack before sending wakeup event
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_cigetlog
25262306a36Sopenharmony_ci        This command is used to get the statistics available in the station.
25362306a36Sopenharmony_ci	Usage:
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci	cat getlog
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_cidevice_dump
25862306a36Sopenharmony_ci	This command is used to dump driver information and firmware memory
25962306a36Sopenharmony_ci	segments.
26062306a36Sopenharmony_ci	Usage:
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci	cat fw_dump
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_civerext
26562306a36Sopenharmony_ci	This command is used to get extended firmware version string using
26662306a36Sopenharmony_ci	different configuration parameters.
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci	Usage:
26962306a36Sopenharmony_ci		echo "[version_str_sel]" > verext
27062306a36Sopenharmony_ci		cat verext
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci		[version_str_sel]: firmware support several extend version
27362306a36Sopenharmony_ci				   string cases, include 0/1/10/20/21/99
27462306a36Sopenharmony_ci===============================================================================
275