xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/wimax/i2400m.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. include:: <isonum.txt>
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun====================================================
4*4882a593SmuzhiyunDriver for the Intel Wireless Wimax Connection 2400m
5*4882a593Smuzhiyun====================================================
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun:Copyright: |copy| 2008 Intel Corporation < linux-wimax@intel.com >
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun   This provides a driver for the Intel Wireless WiMAX Connection 2400m
10*4882a593Smuzhiyun   and a basic Linux kernel WiMAX stack.
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun1. Requirements
13*4882a593Smuzhiyun===============
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun     * Linux installation with Linux kernel 2.6.22 or newer (if building
16*4882a593Smuzhiyun       from a separate tree)
17*4882a593Smuzhiyun     * Intel i2400m Echo Peak or Baxter Peak; this includes the Intel
18*4882a593Smuzhiyun       Wireless WiMAX/WiFi Link 5x50 series.
19*4882a593Smuzhiyun     * build tools:
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun          + Linux kernel development package for the target kernel; to
22*4882a593Smuzhiyun            build against your currently running kernel, you need to have
23*4882a593Smuzhiyun            the kernel development package corresponding to the running
24*4882a593Smuzhiyun            image installed (usually if your kernel is named
25*4882a593Smuzhiyun            linux-VERSION, the development package is called
26*4882a593Smuzhiyun            linux-dev-VERSION or linux-headers-VERSION).
27*4882a593Smuzhiyun          + GNU C Compiler, make
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun2. Compilation and installation
30*4882a593Smuzhiyun===============================
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun2.1. Compilation of the drivers included in the kernel
33*4882a593Smuzhiyun------------------------------------------------------
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun   Configure the kernel; to enable the WiMAX drivers select Drivers >
36*4882a593Smuzhiyun   Networking Drivers > WiMAX device support. Enable all of them as
37*4882a593Smuzhiyun   modules (easier).
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun   If USB or SDIO are not enabled in the kernel configuration, the options
40*4882a593Smuzhiyun   to build the i2400m USB or SDIO drivers will not show. Enable said
41*4882a593Smuzhiyun   subsystems and go back to the WiMAX menu to enable the drivers.
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun   Compile and install your kernel as usual.
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun2.2. Compilation of the drivers distributed as an standalone module
46*4882a593Smuzhiyun-------------------------------------------------------------------
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun   To compile::
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun	$ cd source/directory
51*4882a593Smuzhiyun	$ make
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun   Once built you can load and unload using the provided load.sh script;
54*4882a593Smuzhiyun   load.sh will load the modules, load.sh u will unload them.
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun   To install in the default kernel directories (and enable auto loading
57*4882a593Smuzhiyun   when the device is plugged)::
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun	$ make install
60*4882a593Smuzhiyun	$ depmod -a
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun   If your kernel development files are located in a non standard
63*4882a593Smuzhiyun   directory or if you want to build for a kernel that is not the
64*4882a593Smuzhiyun   currently running one, set KDIR to the right location::
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun	$ make KDIR=/path/to/kernel/dev/tree
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun   For more information, please contact linux-wimax@intel.com.
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun3. Installing the firmware
71*4882a593Smuzhiyun--------------------------
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun   The firmware can be obtained from http://linuxwimax.org or might have
74*4882a593Smuzhiyun   been supplied with your hardware.
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun   It has to be installed in the target system::
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun	$ cp FIRMWAREFILE.sbcf /lib/firmware/i2400m-fw-BUSTYPE-1.3.sbcf
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun     * NOTE: if your firmware came in an .rpm or .deb file, just install
81*4882a593Smuzhiyun       it as normal, with the rpm (rpm -i FIRMWARE.rpm) or dpkg
82*4882a593Smuzhiyun       (dpkg -i FIRMWARE.deb) commands. No further action is needed.
83*4882a593Smuzhiyun     * BUSTYPE will be usb or sdio, depending on the hardware you have.
84*4882a593Smuzhiyun       Each hardware type comes with its own firmware and will not work
85*4882a593Smuzhiyun       with other types.
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun4. Design
88*4882a593Smuzhiyun=========
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun   This package contains two major parts: a WiMAX kernel stack and a
91*4882a593Smuzhiyun   driver for the Intel i2400m.
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun   The WiMAX stack is designed to provide for common WiMAX control
94*4882a593Smuzhiyun   services to current and future WiMAX devices from any vendor; please
95*4882a593Smuzhiyun   see README.wimax for details.
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun   The i2400m kernel driver is broken up in two main parts: the bus
98*4882a593Smuzhiyun   generic driver and the bus-specific drivers. The bus generic driver
99*4882a593Smuzhiyun   forms the drivercore and contain no knowledge of the actual method we
100*4882a593Smuzhiyun   use to connect to the device. The bus specific drivers are just the
101*4882a593Smuzhiyun   glue to connect the bus-generic driver and the device. Currently only
102*4882a593Smuzhiyun   USB and SDIO are supported. See drivers/net/wimax/i2400m/i2400m.h for
103*4882a593Smuzhiyun   more information.
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun   The bus generic driver is logically broken up in two parts: OS-glue and
106*4882a593Smuzhiyun   hardware-glue. The OS-glue interfaces with Linux. The hardware-glue
107*4882a593Smuzhiyun   interfaces with the device on using an interface provided by the
108*4882a593Smuzhiyun   bus-specific driver. The reason for this breakup is to be able to
109*4882a593Smuzhiyun   easily reuse the hardware-glue to write drivers for other OSes; note
110*4882a593Smuzhiyun   the hardware glue part is written as a native Linux driver; no
111*4882a593Smuzhiyun   abstraction layers are used, so to port to another OS, the Linux kernel
112*4882a593Smuzhiyun   API calls should be replaced with the target OS's.
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun5. Usage
115*4882a593Smuzhiyun========
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun   To load the driver, follow the instructions in the install section;
118*4882a593Smuzhiyun   once the driver is loaded, plug in the device (unless it is permanently
119*4882a593Smuzhiyun   plugged in). The driver will enumerate the device, upload the firmware
120*4882a593Smuzhiyun   and output messages in the kernel log (dmesg, /var/log/messages or
121*4882a593Smuzhiyun   /var/log/kern.log) such as::
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun	...
124*4882a593Smuzhiyun	i2400m_usb 5-4:1.0: firmware interface version 8.0.0
125*4882a593Smuzhiyun	i2400m_usb 5-4:1.0: WiMAX interface wmx0 (00:1d:e1:01:94:2c) ready
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun   At this point the device is ready to work.
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun   Current versions require the Intel WiMAX Network Service in userspace
130*4882a593Smuzhiyun   to make things work. See the network service's README for instructions
131*4882a593Smuzhiyun   on how to scan, connect and disconnect.
132*4882a593Smuzhiyun
133*4882a593Smuzhiyun5.1. Module parameters
134*4882a593Smuzhiyun----------------------
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun   Module parameters can be set at kernel or module load time or by
137*4882a593Smuzhiyun   echoing values::
138*4882a593Smuzhiyun
139*4882a593Smuzhiyun	$ echo VALUE > /sys/module/MODULENAME/parameters/PARAMETERNAME
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun   To make changes permanent, for example, for the i2400m module, you can
142*4882a593Smuzhiyun   also create a file named /etc/modprobe.d/i2400m containing::
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun	options i2400m idle_mode_disabled=1
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun   To find which parameters are supported by a module, run::
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun	$ modinfo path/to/module.ko
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun   During kernel bootup (if the driver is linked in the kernel), specify
151*4882a593Smuzhiyun   the following to the kernel command line::
152*4882a593Smuzhiyun
153*4882a593Smuzhiyun	i2400m.PARAMETER=VALUE
154*4882a593Smuzhiyun
155*4882a593Smuzhiyun5.1.1. i2400m: idle_mode_disabled
156*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun   The i2400m module supports a parameter to disable idle mode. This
159*4882a593Smuzhiyun   parameter, once set, will take effect only when the device is
160*4882a593Smuzhiyun   reinitialized by the driver (eg: following a reset or a reconnect).
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun5.2. Debug operations: debugfs entries
163*4882a593Smuzhiyun--------------------------------------
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun   The driver will register debugfs entries that allow the user to tweak
166*4882a593Smuzhiyun   debug settings. There are three main container directories where
167*4882a593Smuzhiyun   entries are placed, which correspond to the three blocks a i2400m WiMAX
168*4882a593Smuzhiyun   driver has:
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun     * /sys/kernel/debug/wimax:DEVNAME/ for the generic WiMAX stack
171*4882a593Smuzhiyun       controls
172*4882a593Smuzhiyun     * /sys/kernel/debug/wimax:DEVNAME/i2400m for the i2400m generic
173*4882a593Smuzhiyun       driver controls
174*4882a593Smuzhiyun     * /sys/kernel/debug/wimax:DEVNAME/i2400m-usb (or -sdio) for the
175*4882a593Smuzhiyun       bus-specific i2400m-usb or i2400m-sdio controls).
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun   Of course, if debugfs is mounted in a directory other than
178*4882a593Smuzhiyun   /sys/kernel/debug, those paths will change.
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun5.2.1. Increasing debug output
181*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun   The files named *dl_* indicate knobs for controlling the debug output
184*4882a593Smuzhiyun   of different submodules::
185*4882a593Smuzhiyun
186*4882a593Smuzhiyun	# find /sys/kernel/debug/wimax\:wmx0 -name \*dl_\*
187*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_tx
188*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_rx
189*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_notif
190*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_fw
191*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_usb
192*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_tx
193*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_rx
194*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_rfkill
195*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_netdev
196*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_fw
197*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_debugfs
198*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_driver
199*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/i2400m/dl_control
200*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/wimax_dl_stack
201*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/wimax_dl_op_rfkill
202*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/wimax_dl_op_reset
203*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/wimax_dl_op_msg
204*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/wimax_dl_id_table
205*4882a593Smuzhiyun	/sys/kernel/debug/wimax:wmx0/wimax_dl_debugfs
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun   By reading the file you can obtain the current value of said debug
208*4882a593Smuzhiyun   level; by writing to it, you can set it.
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun   To increase the debug level of, for example, the i2400m's generic TX
211*4882a593Smuzhiyun   engine, just write::
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun	$ echo 3 > /sys/kernel/debug/wimax:wmx0/i2400m/dl_tx
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun   Increasing numbers yield increasing debug information; for details of
216*4882a593Smuzhiyun   what is printed and the available levels, check the source. The code
217*4882a593Smuzhiyun   uses 0 for disabled and increasing values until 8.
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun5.2.2. RX and TX statistics
220*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun   The i2400m/rx_stats and i2400m/tx_stats provide statistics about the
223*4882a593Smuzhiyun   data reception/delivery from the device::
224*4882a593Smuzhiyun
225*4882a593Smuzhiyun	$ cat /sys/kernel/debug/wimax:wmx0/i2400m/rx_stats
226*4882a593Smuzhiyun	45 1 3 34 3104 48 480
227*4882a593Smuzhiyun
228*4882a593Smuzhiyun   The numbers reported are:
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun     * packets/RX-buffer: total, min, max
231*4882a593Smuzhiyun     * RX-buffers: total RX buffers received, accumulated RX buffer size
232*4882a593Smuzhiyun       in bytes, min size received, max size received
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun   Thus, to find the average buffer size received, divide accumulated
235*4882a593Smuzhiyun   RX-buffer / total RX-buffers.
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun   To clear the statistics back to 0, write anything to the rx_stats file::
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun	$ echo 1 > /sys/kernel/debug/wimax:wmx0/i2400m_rx_stats
240*4882a593Smuzhiyun
241*4882a593Smuzhiyun   Likewise for TX.
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun   Note the packets this debug file refers to are not network packet, but
244*4882a593Smuzhiyun   packets in the sense of the device-specific protocol for communication
245*4882a593Smuzhiyun   to the host. See drivers/net/wimax/i2400m/tx.c.
246*4882a593Smuzhiyun
247*4882a593Smuzhiyun5.2.3. Tracing messages received from user space
248*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249*4882a593Smuzhiyun
250*4882a593Smuzhiyun   To echo messages received from user space into the trace pipe that the
251*4882a593Smuzhiyun   i2400m driver creates, set the debug file i2400m/trace_msg_from_user to
252*4882a593Smuzhiyun   1::
253*4882a593Smuzhiyun
254*4882a593Smuzhiyun	$ echo 1 > /sys/kernel/debug/wimax:wmx0/i2400m/trace_msg_from_user
255*4882a593Smuzhiyun
256*4882a593Smuzhiyun5.2.4. Performing a device reset
257*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun   By writing a 0, a 1 or a 2 to the file
260*4882a593Smuzhiyun   /sys/kernel/debug/wimax:wmx0/reset, the driver performs a warm (without
261*4882a593Smuzhiyun   disconnecting from the bus), cold (disconnecting from the bus) or bus
262*4882a593Smuzhiyun   (bus specific) reset on the device.
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun5.2.5. Asking the device to enter power saving mode
265*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266*4882a593Smuzhiyun
267*4882a593Smuzhiyun   By writing any value to the /sys/kernel/debug/wimax:wmx0 file, the
268*4882a593Smuzhiyun   device will attempt to enter power saving mode.
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun6. Troubleshooting
271*4882a593Smuzhiyun==================
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun6.1. Driver complains about ``i2400m-fw-usb-1.2.sbcf: request failed``
274*4882a593Smuzhiyun----------------------------------------------------------------------
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun   If upon connecting the device, the following is output in the kernel
277*4882a593Smuzhiyun   log::
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun	i2400m_usb 5-4:1.0: fw i2400m-fw-usb-1.3.sbcf: request failed: -2
280*4882a593Smuzhiyun
281*4882a593Smuzhiyun   This means that the driver cannot locate the firmware file named
282*4882a593Smuzhiyun   /lib/firmware/i2400m-fw-usb-1.2.sbcf. Check that the file is present in
283*4882a593Smuzhiyun   the right location.
284