https://linux-sunxi.org/api.php?action=feedcontributions&user=Faruk&feedformat=atom
linux-sunxi.org - User contributions [en]
2024-03-28T09:09:40Z
User contributions
MediaWiki 1.35.8
https://linux-sunxi.org/index.php?title=Fex_Guide&diff=24166
Fex Guide
2021-05-06T12:31:30Z
<p>Faruk: Fixed wring write</p>
<hr />
<div>== FEX Description ==<br />
A FEX file defines various aspects of how the SoC works. It configures the GPIO pins and sets up DRAM, Display, etc parameters. It is Allwinners predecessor for the devicetree.<br />
<br />
Each line consists of a '''key''' = '''value''' pair combination under a '''[sectionheader]'''. All three, '''[sectionheader]''', '''key''' and '''value''' are case-sensitive. For comments a semi-colon (''';''') is used and everything following a semi-colon is ignored. The chip does not parse a textual version of a fex file, it gets cleaned and compiled by a fex-compiler. A reverse engineered open source version exists in the [[Sunxi-tools#sunxi-fexc_and_wrappers|sunxi-tools repository]]. Also a de-compiler which takes a binary ''script.bin'' and creates a textual ''script.fex''. Usually, ''script.bin'' can be found on the nanda boot partition on A10 devices.<br />
<br />
{{note|The [[Mainline_Kernel_Howto|mainline]] Linux kernel makes no use of FEX / [[Script.bin|script.bin]], and relies on the [[Device_Tree|device tree]] model instead (''.dtb'' files).}}<br />
<br />
== Port Definitions ==<br />
Description of the GPIO configuration in the form:<br />
<br />
:port:<port><mux feature><pullup/down><drive capability><output level><br />
<br />
where:<br />
<br />
:'''<port>''' is the port to configure (ie. PH15)<br />
<br />
:'''<mux feature>''' is the function to configure the port for, mux 0 is as input, mux 1 as output and for 2-7 see [[A10/PIO]], [[A13/PIO]], or [[A20/PIO]] for details.<br />
<br />
:'''<pullup/down>''' is 0 = disabled; 1 = pullup enabled; 2 = pulldown enabled (only valid when port is an input)<br />
<br />
:'''<drive capability>''' defines the output drive in mA, values are 0-3 corresponding to 10mA, 20mA, 30mA and 40mA.<br />
<br />
:'''<output level>''' sets the initial output level for the port; 0 = low; 1 = high (only valid for outputs)<br />
<br />
The '''<pullup/down>''' <drive capability> and <output level> can be set to <default> which means don't change. Any trailing <default> options can be omitted.<br />
<br />
This can also be used to specify various pins on the AXP PMIC. The syntax is "power:portN".<br />
<br />
{| class="wikitable"<br />
|-<br />
! Port !! AXP20x !! AXP22x / AXP8xx !!<br />
|-<br />
| 0 || GPIO0 || GPIO0<br />
|-<br />
| 1 || GPIO1 || GPIO1<br />
|-<br />
| 2 || GPIO2 || DC1SW<br />
|-<br />
| 3 || GPIO3 || CHGLED<br />
|-<br />
| 4 || || N_VBUSEN<br />
|-<br />
| 5 || || WAKEUP (slave PMIC)<br />
|-<br />
| 6 || || SWOUT (slave PMIC)<br />
|}<br />
<br />
== application ==<br />
=== [product] ===<br />
Product version and description. It seems all fex files at this moment are at version 1.0 and use the default evaluation board name. It doesn't appear to be used internally, but requires further investigation.<br />
<br />
* '''version''': string indicating fex file version.<br />
* '''machine''': string indicating the board name. ''"A10-EVB-V1.2"'' appears to be a common one, seemingly to refer to the A10 Evaluation board v1.2.<br />
<pre class="brush: ini"><br />
[product]<br />
version = "1.0"<br />
machine = "A10-EVB-V1.2"<br />
</pre><br />
<br />
== system configuration == <br />
=== [target] ===<br />
<br />
{{note|blue module chip pin configuration, the black module internal control configuration}}<br />
<br />
Configuration items to configure the meaning of<br />
* '''boot_clock''': Initial boot frequency in MHz.<br />
* '''dcdc2_vol''': Dcdc2 output voltage in mV.<br />
* '''dcdc3_vol''': Dcdc3 output voltage in mV.<br />
* '''ldo2_vol''': Ldo2 output voltage in mV.<br />
* '''ldo3_vol''': Ldo3 output voltage in mV.<br />
* '''ldo4_vol''': Ldo4 output voltage in mV.<br />
* '''power_start''': 0 or 1.<br />
* '''storage_type''': 0 = nand, 1 = SDCard, 2 = SPI-nor<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[target]<br />
boot_clock = 1008<br />
dcdc2_vol = 1400<br />
dcdc3_vol = 1250<br />
ldo2_vol = 3000<br />
ldo3_vol = 2800<br />
ldo4_vol = 2800<br />
pll4_freq = 960<br />
pll6_freq = 960<br />
power_start = 1<br />
storage_type = 0<br />
</pre><br />
<br />
=== [card_burn_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[card_burn_para]<br />
card_no = 0<br />
card_line = 4<br />
card_mode = 0<br />
sdc_d1 = port:PF00<2><1><default><default><br />
sdc_d0 = port:PF01<2><1><default><default><br />
sdc_clk = port:PF02<2><1><default><default><br />
sdc_cmd = port:PF03<2><1><default><default><br />
sdc_d3 = port:PF04<2><1><default><default><br />
sdc_d2 = port:PF05<2><1><default><default><br />
</pre><br />
<br />
=== [card_boot] ===<br />
<br />
* '''logical_start''': logical starting address when booting from SD-Card.<br />
* '''sprite_gpio0''':<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Card_boot]<br />
logical_start = 40960<br />
sprite_gpio0 =<br />
</pre><br />
<br />
=== [card_boot0_para] ===<br />
<br />
<br />
* '''card_ctrl''': card controller to be used<br />
* '''card_high_speed''': 0 for low speed, 1 for high-speed<br />
* '''card_line''': Number of card data lines<br />
* '''sdc_ cmd''': SD-Card command signals GPIO configuration<br />
* '''sdc_ clk''': SD-Card clock signal GPIO configuration<br />
* '''sdc_ d0''': SD-Card data 0 line signal GPIO configuration<br />
* '''sdc_ d1''': SD-Card data 1 line signal GPIO configuration<br />
* '''sdc_d2''': SD-Card data 2 line signal GPIO configuration<br />
* '''sdc_d3''': SD-Card data 3 line signal GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[card_boot0_para]<br />
card_ctrl = 0<br />
card_high_speed = 1<br />
card_line = 4<br />
sdc_d1 = port:PF00<2><1><default><default><br />
sdc_d0 = port:PF01<2><1><default><default><br />
sdc_clk = port:PF02<2><1><default><default><br />
sdc_cmd = port:PF03<2><1><default><default><br />
sdc_d3 = port:PF04<2><1><default><default><br />
sdc_d2 = port:PF05<2><1><default><default><br />
</pre><br />
<br />
=== [card_boot2_para] ===<br />
<br />
* '''card_ctrl''': card controller to be used<br />
* '''card_high_speed''': 0 for low speed, 1 for high-speed<br />
* '''card_line''': number of card data lines<br />
* '''sdc_ cmd''': SD-Card command signals GPIO configuration<br />
* '''sdc_ clk''': SD-Card clock signal GPIO configuration<br />
* '''sdc_ d0''': SD-Card data 0 line signal GPIO configuration<br />
* '''sdc_ d1''': SD-Card data 1 line signal GPIO configuration<br />
* '''sdc_d2''': SD-Card data 2 line signal GPIO configuration<br />
* '''sdc_d3''': SD-Card data 3 line signal GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[card_boot2_para]<br />
card_ctrl = 2<br />
card_high_speed = 1<br />
card_line = 4<br />
sdc_cmd = port:PC06<3><1><default><default><br />
sdc_clk = port:PC07<3><1><default><default><br />
sdc_d0 = port:PC08<3><1><default><default><br />
sdc_d1 = port:PC09<3><1><default><default><br />
sdc_d2 = port:PC10<3><1><default><default><br />
sdc_d3 = port:PC11<3><1><default><default><br />
</pre><br />
<br />
=== [twi_para] ===<br />
twi controller to enable during/for boot.<br />
<br />
* '''twi_port''': twi controller to configure<br />
* '''twi_scl''': twi Serial CLock line GPIO configuration<br />
* '''twi_sda''': = twi Serial DAta line GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[twi_para]<br />
twi_port = 0<br />
twi_scl = port:PB00<2><default><default><default><br />
twi_sda = port:PB01<2><default><default><default><br />
</pre><br />
<br />
=== [uart_para] ===<br />
Serial port to be enabled during/for boot.<br />
<br />
* '''uart_debug_port''': serial controller number<br />
* '''uart_debug_tx''': serial port TX line GPIO configuration<br />
* '''uart_debug_rx''': serial port RX line GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para]<br />
uart_debug_port = 0<br />
uart_debug_tx = port:PB22<2><br />
uart_debug_rx = port:PB23<2><br />
</pre><br />
<br />
=== [jtag_para] ===<br />
JTAG port to be enabled during/for boot.<br />
<br />
* '''jtag_enable''': 0 to disable JTAG, 1 to enable JTAG<br />
* '''jtag_ms''': JTAG Test Mode Select (TMS) GPIO configuration<br />
* '''jtag_ck''': JTAG Test Clock (TCK) GPIO configuration<br />
* '''jtag_do''': JTAG Test Data Output (TDO) GPIO configuration<br />
* '''jtag_di''': JTAG Test Data Input (TDI) GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[jtag_para]<br />
jtag_enable = 1<br />
jtag_ms = port:PB14<3><default><default><default><br />
jtag_ck = port:PB15<3>default><default><default><br />
jtag_do = port:PB16<3>default><default><default><br />
jtag_di = port:PB17<3>default><default><default><br />
</pre><br />
<br />
=== [system] ===<br />
* '''recovery_key''': recovery key GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini><br />
recovery_key = port:PH16<0><1><default><default><br />
</pre><br />
<br />
=== [gpio_para] ===<br />
* '''gpio_used''': 0 to disable; 1 to enable<br />
* '''gpio_num''': number mapped GPIO's<br />
* '''gpio_pin_1''': first GPIO pin<br />
<br />
Configuration example:<br />
<pre class="brush: ini><br />
gpio_used = 0<br />
gpio_num = 4<br />
gpio_pin_1 = port:PH10<1><default><default><0><br />
gpio_pin_2 = port:PH20<1><default><default><0><br />
gpio_pin_3 = port:PB03<0><default><default><default><br />
gpio_pin_4 = port:PH22<1><default><default><0><br />
</pre><br />
<br />
=== [gpio_init] ===<br />
* '''pin_1''': Initial pin 1 GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini><br />
pin_1 = port:PH10<1><default><default><0><br />
pin_2 = port:PH20<1><default><default><0><br />
</pre><br />
<br />
== SDRAM == <br />
=== [dram_para] === <br />
SD-Ram is usually configured via livesuit when flashing. Livesuit probes the hardware or knows about the hardware and its configuration and configures the SoC accordingly. This luxury is not available from Linux and thus sdram parameters have to be set up by hand.<br />
<br />
* '''dram_baseaddr''': DRAM physical start address, fixed at 0x40000000<br />
* '''dram_clk''': DRAM clock frequency in MHz; it must be an integer multiple of 24, minimally 120, maximally 480 MHz<br />
* '''dram_type''': DRAM type; Set to 2 for DDR2; 3 for DDR3<br />
* '''dram_rank_num''': DRAM chip select; 1 is a chip select; 2 election for two tablets<br />
* '''dram_chip_density''': monolithic DRAM capacity in Mbit<br />
* '''dram_io_width''': monolithic DRAM bus width in bits<br />
* '''dram_bus_width''': DRAM bus width in bits, such as two 16-bit DRAM banks make up a 32 bit bus width<br />
* '''dram_cas''': DRAM CAS latency<br />
* '''dram_zq''': DRAM controller internal parameters<br />
* '''dram_odt_en''': ODT 0 to disable; 1 to enable<br />
* '''dram_size''': DRAM total capacity in MB<br />
* '''dram_tpr0''': DRAM controller internal parameter<br />
* '''dram_tpr1''': DRAM controller internal parameter<br />
* '''dram_tpr2''': DRAM controller internal parameter<br />
* '''dram_tpr3''': DRAM controller internal parameter<br />
* '''dram_tpr4''': DRAM controller internal parameter<br />
* '''dram_tpr5''': DRAM controller internal parameter<br />
* '''dram_emr1''': DRAM controller internal parameter<br />
* '''dram_emr2''': DRAM controller internal parameter<br />
* '''dram_emr3''': DRAM controller internal parameter<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[dram_para]<br />
dram_baseaddr = 0x40000000<br />
dram_clk = 360<br />
dram_type = 3<br />
dram_rank_num = 1<br />
dram_chip_density = 2048<br />
dram_io_width = 16<br />
dram_bus_width = 32<br />
dram_cas = 6<br />
dram_zq = 0x7b<br />
dram_odt_en = 0<br />
dram_size = 512<br />
dram_tpr0 = 0x30926692<br />
dram_tpr1 = 0x1090<br />
dram_tpr2 = 0x1a0c8<br />
dram_tpr3 = 0x0<br />
dram_tpr4 = 0x0<br />
dram_tpr5 = 0x0<br />
dram_emr1 = 0x0<br />
dram_emr2 = 0x0<br />
dram_emr3 = 0x0<br />
</pre><br />
<br />
== mali configuration == <br />
[[Mali400|Mali]] is the name of the GPU on the A10, A10s, A13, A20, A23, and A33 SoC's<br />
<br />
=== [mali_para] ===<br />
<br />
* '''mali_used''': 0 to disable; 1 to enable Mali module<br />
* '''mali_clkdiv''': Mali clock divisor. Clock is obtained by devising PLL4 with ''mali_clkdiv''<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[mali_para]<br />
mali_used = 1<br />
mali_clkdiv = 3<br />
</pre><br />
<br />
=== [g2d_para] ===<br />
G2D is the 2D graphic display engine on the Allwinner SoC<br />
<br />
* '''g2d_used''': 0 to disable; 1 to enable the g2d module<br />
* '''g2d_size''': memory size for g2d<br />
<br />
<pre class="brush: ini"><br />
g2d_used = 1<br />
g2d_size = 0x1000000<br />
</pre><br />
<br />
== ethernet MAC configuration == <br />
=== [emac_para] === <br />
Ethernet configuration for the integrated ethernet IP. It still requires an external PHY<br />
<br />
* '''emac_used''': 0 to disable; 1 to enable the ethernet MAC<br />
* '''emac_rxd0''': RX data line 0 GPIO configuration<br />
* '''emac_rxd1''': RX data line 1 GPIO configuration<br />
* '''emac_rxd2''': RX data line 2 GPIO configuration<br />
* '''emac_rxd3''': RX data line 3 GPIO configuration<br />
* '''emac_txd0''': TX data line 0 GPIO configuration<br />
* '''emac_txd1''': TX data line 1 GPIO configuration<br />
* '''emac_txd2''': TX data line 2 GPIO configuration<br />
* '''emac_txd3''': TX data line 3 GPIO configuration<br />
* '''emac_rxclk''': RX clock GPIO configuration<br />
* '''emac_rxerr''': RX error GPIO configuration<br />
* '''emac_rxdV''': RX enabled GPIO configuration<br />
* '''emac_mdc''': MII clock GPIO configuration<br />
* '''emac_mdio''': MII data I/O GPIO configuration<br />
* '''emac_txen''': TX enabled GPIO configuration<br />
* '''emac_txclk''': TX clock GPIO configuration<br />
* '''emac_crs''': Carrier Status of GPIO configuration<br />
* '''emac_col''': Collision Detection GPIO configuration<br />
* '''emac_reset''': PHY reset signal GPIO configuration<br />
* '''emac_power''': <br />
* '''emac_link''': <br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Emac_para]<br />
emac_used = 1<br />
emac_rxd3 = port:PA00<2><default><default><default><br />
emac_rxd2 = port:PA01<2><default><default><default><br />
emac_rxd1 = port:PA02<2><default><default><default><br />
emac_rxd0 = port:PA03<2><default><default><default><br />
emac_txd3 = port:PA04<2><default><default><default><br />
emac_txd2 = port:PA05<2><default><default><default><br />
emac_txd1 = port:PA06<2><default><default><default><br />
emac_txd0 = port:PA07<2><default><default><default><br />
emac_rxclk = port:PA08<2><default><default><default><br />
emac_rxerr = port:PA09<2><default><default><default><br />
emac_rxdV = port:PA10<2><default><default><default><br />
emac_mdc = port:PA11<2><default><default><default><br />
emac_mdio = port:PA12<2><default><default><default><br />
emac_txen = port:PA13<2><default><default><default><br />
emac_txclk = port:PA14<2><default><default><default><br />
emac_crs = port:PA15<2><default><default><default><br />
emac_col = port:PA16<2><default><default><default><br />
emac_reset = port:PA17<1><default><default><default><br />
</pre><br />
<br />
== i2c configuration ==<br />
=== [twi0_para] === <br />
Two Wire Interface (i²c) configuration for TWI port 0<br />
<br />
* '''twi0_used''': 0 to disable; 1 to enable<br />
* '''twi0_scl''': TWI Serial CLock GPIO configuration<br />
* '''twi0_sda''': TWI Serial Data GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[twi0_para]<br />
twi0_used = 1<br />
twi0_scl = port:PB00<2><default><default><default><br />
twi0_sda = port:PB01<2><default><default><default><br />
</pre><br />
<br />
=== [twi1_para] === <br />
Two Wire Interface (i²c) configuration for TWI port 1<br />
<br />
* '''twi1_used''': 0 to disable; 1 to enable<br />
* '''twi1_scl''': TWI Serial CLock GPIO configuration<br />
* '''twi1_sda''': TWI Serial Data GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[tw1_para]<br />
twi1_used = 1<br />
twi1_scl = port:PB18<2><default><default><default><br />
twi1_sda = port:PB19<2><default><default><default><br />
</pre><br />
<br />
=== [twi2_para] === <br />
Two Wire Interface (i²c) configuration for TWI port 2<br />
<br />
* '''twi2_used''': 0 to disable; 1 to enable<br />
* '''twi2_scl''': TWI Serial CLock GPIO configuration<br />
* '''twi2_sda''': TWI Serial Data GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[twi2_para]<br />
twi2_used = 1<br />
twi2_scl = port:PB20<2><default><default><default><br />
twi2_sda = port:PB21<2><default><default><default><br />
</pre><br />
<br />
== uart configuration == <br />
Any of the 8 UART ports can be configured to be either 2 (Only TX/RX) wires, 4 wires (TX, RX, RTS and CTS) or 8 (Full function) ports.<br />
<br />
* '''uart_used''': 0 to disable; 1 to enable<br />
* '''uart_port''': UART port number<br />
* '''uart_type''': UART type, 2, 4 or 8 wires<br />
* '''uart_tx''': UART TX data line GPIO configuration<br />
* '''uart_rx''': UART RX data line GPIO configuration<br />
* '''uart_rts''': UART Ready to Send line GPIO configuration, only for 4 and 8 wire modes<br />
* '''uart_cts''': UART Clear to Send line GPIO configuration, only for 4 and 8 wire modes<br />
* '''uart_dtr''': UART Data Terminal Ready GPIO configuration, only for 8 wire modes<br />
* '''uart_dsr''': UART Data Set Ready GPIO configuration, only for 8 wire modes<br />
* '''uart_dcd''': UART Data Carrier Detect GPIO configuration, only for 8 wire modes<br />
* '''uart_ring''': UART Ring Indicator GPIO configuration, only for 8 wire modes<br />
<br />
=== [uart_para0] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para0]<br />
uart_used = 1<br />
uart_port = 0<br />
uart_tx = port:PB22<2><1><default><default><br />
uart_rx = port:PB23<2><1><default><default><br />
</pre><br />
<br />
=== [uart_para1] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para1]<br />
uart_used = 0<br />
uart_port = 1<br />
uart_type = 8<br />
uart_tx = port:PA10<4><1><default><default><br />
uart_rx = port:PA11<4><1><default><default><br />
uart_rts = port:PA12<4><1><default><default><br />
uart_cts = port:PA13<4><1><default><default><br />
uart_dtr = port:PA14<4><1><default><default><br />
uart_dsr = port:PA15<4><1><default><default><br />
uart_dcd = port:PA16<4><1><default><default><br />
uart_ring = port:PA17<4><1><default><default><br />
</pre><br />
<br />
=== [uart_para2] === <br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para2]<br />
uart_used = 0<br />
uart_port = 2<br />
uart_type = 4<br />
uart_tx = port:PI18<3><1><default><default><br />
uart_rx = port:PI19<3><1><default><default><br />
uart_rts = port:PI16<3><1><default><default><br />
uart_cts = port:PI17<3><1><default><default><br />
</pre><br />
<br />
=== [uart_para3] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para3]<br />
uart_used = 0<br />
uart_port = 3<br />
uart_type = 4<br />
uart_tx = port:PH00<4><1><default><default><br />
uart_rx = port:PH01<4><1><default><default><br />
uart_rts = port:PH02<4><1><default><default><br />
uart_cts = port:PH03<4><1><default><default><br />
</pre><br />
<br />
=== [uart_para4] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Uart_para4]<br />
uart_used = 0<br />
uart_port = 4<br />
uart_type = 2<br />
uart_tx = port:PH04<4><1><default><default><br />
uart_rx = port:PH05<4><1><default><default><br />
</pre><br />
<br />
=== [uart_para5] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para5]<br />
uart_used = 0<br />
uart_port = 5<br />
uart_type = 2<br />
uart_tx = port: PH06<4><1><default><default><br />
uart_rx = port: PH07<4><1><default><default><br />
</pre><br />
<br />
=== [uart_para6] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para6]<br />
uart_used = 0<br />
uart_port = 6<br />
uart_type = 2<br />
uart_tx = port:PA12<4><1><default><default><br />
uart_rx = port:PA13<4><1><default><default><br />
</pre><br />
<br />
=== [uart_para7] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[uart_para7]<br />
uart_used = 0<br />
uart_port = 7<br />
uart_type = 2<br />
uart_tx = port:PA14<4><1><default><default><br />
uart_rx = port:PA15<4><1><default><default><br />
</pre><br />
<br />
== spi configuration ==<br />
<br />
* '''spi_used''': 0 to disable; 1 to enable<br />
* '''spi_cs_bitmap''': 1 use cs0, 2 use cs1, 3 use cs0 & cs1<br />
* '''spi_cs0''': Chip Select bit 0 GPIO configuration<br />
* '''spi_cs1''': Chip Select bit 1 GPIO configuration<br />
* '''spi_sclk''': clock GPIO configuration<br />
* '''spi_mosi''': MOSI GPIO configuration<br />
* '''spi_miso''': MISO GPIO configuration<br />
<br />
{{note|Not all spi chip select bits are required to be set}}<br />
<br />
=== [spi0_para] ===<br />
Configuration example 1:<br />
<pre class="brush: ini"><br />
[spi0_para]<br />
spi_used = 0<br />
spi_cs_bitmap = 1<br />
spi_cs0 = port:PI10<3><default><default><default><br />
spi_sclk = port:PI11<3><default><default><default><br />
spi_mosi = port:PI12<3><default><default><default><br />
spi_miso = port:PI13<3><default><default><default><br />
spi_cs1 = port:PI14<3><default><default><default><br />
</pre><br />
<br />
Configuration example 2:<br />
<pre class="brush: ini"><br />
[spi0_para]<br />
spi_used = 0<br />
spi_cs_bitmap = 1<br />
spi_mosi = port:PC00<3><default><default><default><br />
spi_miso = port:PC01<3><default><default><default><br />
spi_sclk = port:PC02<3><default><default><default><br />
spi_cs0 = port:PC23<3><default><default><default><br />
</pre><br />
<br />
=== [spi1_para] ===<br />
Configuration example 1:<br />
<pre class="brush: ini"><br />
[spi1_para]<br />
spi_used = 0<br />
spi_cs_bitmap = 1<br />
spi_cs0 = port:PA00<3><default><default><default><br />
spi_sclk = port:PA01<3><default><default><default><br />
spi_mosi = port:PA02<3><default><default><default><br />
spi_miso = port:PA03<3><default><default><default><br />
spi_cs1 = port:PA04<3><default><default><default><br />
</pre><br />
Configuration example 2:<br />
<pre class="brush: ini"><br />
[spi1_para]<br />
spi_used = 0<br />
spi_cs_bitmap = 1<br />
spi_cs1 = port:PI15<2><default><default><default><br />
spi_cs0 = port:PI16<2><default><default><default><br />
spi_sclk = port:PI17<2><default><default><default><br />
spi_mosi = port:PI18<2><default><default><default><br />
spi_miso = port:PI19<2><default><default><default><br />
</pre><br />
<br />
=== [spi2_para] ===<br />
Configuration example 1:<br />
<pre class="brush: ini"><br />
[spi2_para]<br />
spi_used = 0<br />
spi_cs_bitmap = 1<br />
spi_cs1 = port:PB13<3><default><default><default><br />
spi_cs0 = port:PB14<3><default><default><default><br />
spi_sclk = port:PB15<3><default><default><default><br />
spi_mosi = port:PB16<3><default><default><default><br />
spi_miso = port:PB17<3><default><default><default><br />
</pre><br />
Configuration example 2:<br />
<pre class="brush: ini"><br />
[spi2_para]<br />
spi_used = 0<br />
spi_cs_bitmap = 1<br />
spi_cs0 = port:PC19<3><default><default><default><br />
spi_sclk = port:PC20<3><default><default><default><br />
spi_mosi = port:PC21<3><default><default><default><br />
spi_miso = port:PC23<3><default><default><default><br />
</pre><br />
<br />
=== [spi3_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[spi3_para]<br />
spi_used = 0<br />
spi_cs_bitmap = 1<br />
spi_cs0 = port:PA05<3><default><default><default><br />
spi_sclk = port:PA06<3><default><default><default><br />
spi_mosi = port:PA07<3><default><default><default><br />
spi_miso = port:PA08<3><default><default><default><br />
spi_cs1 = port:PA09<3><default><default><default><br />
</pre><br />
<br />
== external spi device configuration ==<br />
=== [spi_devices] ===<br />
* '''spi_dev_num''': number of external SPI devices connected to the SoC. For each external SPI device N, a board define ''[spi_boardM]'' with M = N - 1 needs to be created<br />
<br />
=== [spi_board0] ===<br />
* '''modalias''': Alias<br />
* '''max_speed_hz: Maximum speed in Hz<br />
* '''bus_num''': Bus number of SPI controller<br />
* '''mode''': SPI mode, bitfield defined in [http://git.kernel.org/cgit/linux/kernel/git/arm/arm-soc.git/tree/include/linux/spi/spi.h spi.h]<br />
* '''full_duplex''': 0 for half-duplex; 1 for full-duplex mode<br />
* '''manual_cs''': manually control Chip Select level (unsupported for now)<br />
* '''irq_gpio''': Some SPI boards should need a IRQ to work properly and register the irq handler inside the device driver<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[spi_board0]<br />
modalias = "External SPI connection"<br />
max_speed_hz = 12000000<br />
bus_num = 1<br />
chip_select = 0<br />
mode = 3<br />
full_duplex = 0<br />
manual_cs = 0<br />
irq_gpio = 1<br />
<br />
[gpio_para]<br />
gpio_used = 1<br />
gpio_num = 1<br />
gpio_pin_1 = port:PB04<6><default><default><default> <br />
</pre><br />
<br />
== resistive touch panel configuration ==<br />
=== [rtp_para] ===<br />
* '''rtp_used''': 0 to disable; 1 to enable<br />
* '''rtp_screen_size''': diagonal screen size rounded to full inches<br />
* '''rtp_regidity_level''': touchscreen regidty in 10 ms units<br />
* '''rtp_press_threshold_enable''': 0 to disable; 1 to enable<br />
* '''rtp_press_threshold''': defines the press-threshold sensitivity; (0x0 is least sensitive, 0xffffff is most sensitive) using TP Pressure Management threshold control (PRE_MEA_THRE_CNT register in [[A20#Documentation|A20 User Manual]])<br />
* '''rtp_sensitive_level''': defines the sensitivity (0x0 is least sensitive, 0xf is most sensitive) using internal pull-up resistor control (TP_SENSITIVE_ADJUST register in [[A20#Documentation|A20 User Manual]])<br />
* '''rtp_exchange_x_y_flag''': 0 for normal operation; 1 to flip X and Y coordinates<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
rtp_used = 0<br />
rtp_screen_size = 7<br />
rtp_regidity_level = 7<br />
rtp_press_threshold_enable = 0<br />
rtp_press_threshold = 0x1f40<br />
rtp_sensitive_level = 0xf<br />
rtp_exchange_x_y_flag = 0<br />
</pre><br />
<br />
== capacitive touch panel configuration ==<br />
<br />
=== [ctp_para] ===<br />
Several touch panel's can be configured. Their name must match to the linux ctp-driver!<br />
<br />
* '''ctp_used''': 0 to disable; 1 to enable<br />
* '''ctp_name''': Name of the touch panel driver to use<br />
* '''ctp_twi_id''': twi controller to use<br />
* '''ctp_twi_addr''': hardware specfic twi address in hex<br />
* '''ctp_screen_rotate''': 0 for normal operation; 1 for 180° rotation<br />
* '''ctp_screen_max_x''': Maximum X screen resolution<br />
* '''ctp_screen_max_y''': Maximum Y screen resolution<br />
* '''ctp_revert_x_flag''': 0 for normal operation; 1 to flip the X axis<br />
* '''ctp_revert_y_flag''': 0 for normal operation; 1 to flip the Y axis<br />
* '''ctp_havekey''': 0 for normal operation; 1 if the touch panel also has touch-''keys''.<br />
* '''ctp_int_port''': interrupt line GPIO configuration<br />
* '''ctp_wakeup''': screen wake up GPIO configuration<br />
* '''ctp_io_port''': I/O port GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[ctp_para]<br />
ctp_used = 1<br />
ctp_twi_id = 2<br />
ctp_name = "ft5x_ts"<br />
ctp_twi_addr = 0x38<br />
<br />
ctp1_used = 1<br />
ctp1_name = "Goodix-TS"<br />
ctp1_twi_addr = 0x55<br />
<br />
ctp2_used = 1<br />
ctp2_name = "ssd253x-ts"<br />
ctp2_twi_addr = 0x48<br />
<br />
ctp3_used = 1<br />
ctp3_name = "novatek-ts"<br />
ctp3_twi_addr = 0x09<br />
<br />
ctp4_used = 1<br />
ctp4_name = "zet622x-ts"<br />
ctp4_twi_addr = 0x76<br />
<br />
ctp5_used = 1<br />
ctp5_name = "byd693x-ts"<br />
ctp5_twi_addr = 0x52<br />
<br />
ctp6_used = 0<br />
ctp6_name = "gt82x"<br />
ctp6_twi_addr = 0x5d<br />
<br />
ctp7_used = 0<br />
ctp7_name = "px811"<br />
ctp7_twi_addr = 0x5c<br />
<br />
ctp_screen_rotate = 0<br />
ctp_screen_max_x = 800<br />
ctp_screen_max_y = 480<br />
ctp_revert_x_flag = 0<br />
ctp_revert_y_flag = 0<br />
ctp_exchange_x_y_flag = 0<br />
ctp_havekey = 0<br />
ctp_int_port = port: PH21<6><default><default><default><br />
ctp_wakeup = port: PB13<1><default><default><1><br />
ctp_io_port = port: PH21<0><default><default><default><br />
</pre><br />
<br />
== touch key configuration ==<br />
<br />
=== [tkey_para] ===<br />
Touch 'key', only for "hv_keypad" for now<br />
<br />
* '''tkey_used''': 0 to disable; 1 to enable<br />
* '''tkey_name''': driver name, must match linux driver name<br />
* '''tkey_twi_id''': twi controller to use<br />
* '''tkey_twi_addr''': hardware specfic twi address in hex<br />
* '''tkey_int''': interrupt line GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[tkey_para]<br />
tkey_used = 0<br />
tkey_name = "hv_keypad"<br />
tkey_twi_id = 2<br />
tkey_twi_addr = 0x62<br />
tkey_int = port: PI13<6><default><default><default><br />
</pre><br />
<br />
== tablet key configuration ==<br />
<br />
Configures tablet physical buttons - usually Vol+ and Vol-, may have Home, Back and others.<br />
<br />
Power key is usually handled by the AXP PMU. Buttons like reset and FEL are special and should work without a driver.<br />
<br />
=== [tabletkeys_para] ===<br />
* '''tabletkeys_used''': 0 to disable; 1 to enable<br />
* '''keyN_code''': numeric keycode - easily found with evtest. N seems to be 0-4 by default.<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[tabletkeys_para]<br />
tabletkeys_used=1<br />
key0_code = 114<br />
key1_code = 115<br />
</pre><br />
<br />
== motor configuration ==<br />
<br />
=== [motor_para] ===<br />
<br />
* '''motor_used''': 0 to disable; 1 to enable<br />
* '''motor_shake''': motor control pin GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[motor_para]<br />
motor_used = 0<br />
motor_shake = port:PB03<1><default><default><1><br />
</pre><br />
<br />
== lock configuration ==<br />
Locks are either very new or really old as nothing can be found in any fex file in git. It seems reasonable to believe that this would be a screen lock 'button'.<br />
<br />
=== [locks_para] ===<br />
* '''locks_used''': 0 to disable; 1 to enable<br />
* '''locks_gpio''': switch GPIO configuration<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[locks_para]<br />
locks_used = 0<br />
locks_gpio = port:PH00<0><default><default><0><br />
</pre><br />
<br />
== nand flash configuration ==<br />
<br />
=== [nand_para] ===<br />
<br />
* '''nand_used''': 0 to disable; 1 to enable<br />
* '''nand_we''': Write Enable GPIO configuration<br />
* '''nand_ale''': Address Latch Enable GPIO configuration<br />
* '''nand_cle''': Command Latch Enable GPIO configuration<br />
* '''nand_ce0''': Chip sElect bit 0 GPIO configuration<br />
* '''nand_ce1''': Chip sElect bit 1 GPIO configuration<br />
* '''nand_ce2''': Chip sElect bit 2 GPIO configuration<br />
* '''nand_ce3''': Chip sElect bit 3 GPIO configuration<br />
* '''nand_ce4''': Chip sElect bit 4 GPIO configuration<br />
* '''nand_ce5''': Chip sElect bit 5 GPIO configuration<br />
* '''nand_ce6''': Chip sElect bit 6 GPIO configuration<br />
* '''nand_ce7''': Chip sElect bit 7 GPIO configuration<br />
* '''nand_nre''': Nand Read Enable GPIO configuration<br />
* '''nand_rb0''': Read / Busy bit 0 GPIO configuration<br />
* '''nand_rb1''': Read / Busy bit 1 GPIO configuration<br />
* '''nand_d0''': data bus bit 0 GPIO configuration<br />
* '''nand_d1''': data bus bit 1 GPIO configuration<br />
* '''nand_d2''': data bus bit 2 GPIO configuration<br />
* '''nand_d3''': data bus bit 3 GPIO configuration<br />
* '''nand_d4''': data bus bit 4 GPIO configuration<br />
* '''nand_d5''': data bus bit 5 GPIO configuration<br />
* '''nand_d6''': data bus bit 6 GPIO configuration<br />
* '''nand_d7''': data bus bit 7 GPIO configuration<br />
* '''nand_wp''': Write Protect GPIO configuration<br />
* '''nand_spi''': SPI data line GPIO configuration<br />
* '''nand_ndqs''': nand ddr clock signal GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Nand_para]<br />
nand_used = 1<br />
nand_we = port:PC00<2><default><default><default><br />
nand_ale = port:PC01<2><default><default><default><br />
nand_cle = port:PC02<2><default><default><default><br />
nand_ce1 = port:PC03<2><default><default><default><br />
nand_ce0 = port:PC04<2><default><default><default><br />
nand_nre = port:PC05<2><default><default><default><br />
nand_rb0 = port:PC06<2><default><default><default><br />
nand_rb1 = port:PC07<2><default><default><default><br />
nand_d0 = port:PC08<2><default><default><default><br />
nand_d1 = port:PC09<2><default><default><default><br />
nand_d2 = port:PC10<2><default><default><default><br />
nand_d3 = port:PC11<2><default><default><default><br />
nand_d4 = port:PC12<2><default><default><default><br />
nand_d5 = port:PC13<2><default><default><default><br />
nand_d6 = port:PC14<2><default><default><default><br />
nand_d7 = port:PC15<2><default><default><default><br />
nand_wp = port:PC16<2><default><default><default><br />
nand_ce2 = port:PC17<2><default><default><default><br />
nand_ce3 = port:PC18<2><default><default><default><br />
nand_ce4 = port:PC19<2><default><default><default><br />
nand_ce5 = port:PC20<2><default><default><default><br />
nand_ce6 = port:PC21<2><default><default><default><br />
nand_ce7 = port:PC22<2><default><default><default><br />
nand_spi = port:PC23<3><default><default><default><br />
nand_ndqs = port:PC24<2><default><default><default><br />
</pre><br />
<br />
== boot disp configuration ==<br />
<br />
=== [boot_disp] ===<br />
<br />
This section can be found in vendor fex files for H3 devices and is only used by Allwinner's BSP u-boot (eg. to display a boot logo which might require [https://github.com/friendlyarm/h3_lichee/commit/729784191a2884426a8ff4ab04c885dff6da3a43#diff-f7adfeec6a53ab5df6164c5eae41b563 further patches])<br />
<br />
== disp init configuration ==<br />
<br />
=== [disp_init] ===<br />
<br />
* '''disp_init_enable''': 0 to disable; 1 to enable<br />
* '''disp_mode''': Display mode to use:<br />
:::{| class="wikitable"<br />
! mode<br />
! display mode<br />
|-<br />
|0<br />
|screen0(screen0, fb0)<br />
|-<br />
|1<br />
|screen1(screen1, fb0)<br />
|-<br />
|2<br />
|dualhead(screen0, screen1, fb0, fb1) (2 screens, 2 framebuffers)<br />
|-<br />
|3<br />
|xinerama(screen0, screen1, fb0) (2 screens, one big framebuffer)<br />
|-<br />
|4<br />
|clone(screen0, screen1, fb0) (2 screens, one standard framebuffer)<br />
|}<br />
* '''screen0_out_color_range''': Output color range for HDMI (applies to both screen0/screen1 - there is no screen1_out_color_range):<br />
:::{| class="wikitable"<br />
! type<br />
! output color range<br />
|-<br />
|0<br />
|16-255 Limited Range (Default)<br />
|-<br />
|1<br />
|0-255 Full Range - PC Level<br />
|-<br />
|2<br />
|16-235 Limited Range - Video Level<br />
|}<br />
* '''screen0_output_type''': Output type for screen0:<br />
* '''screen1_output_type''': Output type for screen1:<br />
:::{| class="wikitable"<br />
! type<br />
! Output type<br />
|-<br />
|0<br />
|NONE<br />
|-<br />
|1<br />
|LCD<br />
|-<br />
|2<br />
|TV<br />
|-<br />
|3<br />
|HDMI<br />
|-<br />
|4<br />
|VGA<br />
|}<br />
* '''screen0_output_mode''': Output mode for screen0:<br />
* '''screen1_output_mode''': Output mode for screen1:<br />
:::{| class="wikitable"<br />
! mode<br />
! used for tv/hdmi output<br />
! used for vga output<br />
|-<br />
|0<br />
|480i<br />
|1680*1050<br />
|-<br />
|1<br />
|576i<br />
|1440*900<br />
|-<br />
|2<br />
|480p<br />
|1360*768<br />
|-<br />
|3<br />
|576p<br />
|1280*1024<br />
|-<br />
|4<br />
|720p50<br />
|1024*768<br />
|-<br />
|5<br />
|720p60<br />
|800*600<br />
|-<br />
|6<br />
|1080i50<br />
|640*480<br />
|-<br />
|7<br />
|1080i60<br />
|<br />
|-<br />
|8<br />
|1080p24<br />
|<br />
|-<br />
|9<br />
|1080p50<br />
|<br />
|-<br />
|10<br />
|1080p60<br />
|1920*1080<br />
|-<br />
|11<br />
|pal<br />
|1280*720<br />
|-<br />
|14<br />
|ntsc<br />
|<br />
|}<br />
* '''fb0_framebuffer_num''': fb0 buffer number, use ''2'' for double buffering<br />
* '''fb1_framebuffer_num''': fb1 buffer number, use ''2'' for double buffering<br />
* '''fb0_format''': pixel format for fb0:<br />
* '''fb1_format''': pixel format for fb1:<br />
:::{| class="wikitable"<br />
! format<br />
! fb0_format<br />
|-<br />
|4<br />
|RGB655<br />
|-<br />
|5<br />
|RGB565<br />
|-<br />
|6<br />
|RGB556<br />
|-<br />
|7<br />
|ARGB1555<br />
|-<br />
|8<br />
|RGBA5551<br />
|-<br />
|9<br />
|RGB888<br />
|-<br />
|10<br />
|ARGB8888<br />
|-<br />
|12<br />
|ARGB4444<br />
|}<br />
* '''fb0_pixel_sequence''': fb0 pixel sequence (0 generally for linux, 2 for android):<br />
* '''fb1_pixel_sequence''': fb1 pixel sequence (0 generally for linux, 2 for android):<br />
:::{| class="wikitable"<br />
! sequence<br />
! fb0_pixel_sequence<br />
|-<br />
|0<br />
|ARGB<br />
|-<br />
|2<br />
|BGRA<br />
|}<br />
* '''fb0_scaler_mode_enable''': 0 to disable; 1 to enable<br />
* '''fb1_scaler_mode_enable''': 0 to disable; 1 to enable<br />
* '''lcd0_backlight''': value to 240 sets PWM rate on selected PWM gpio<br />
* '''lcd1_backlight''': value to 240 sets PWM rate on selected PWM gpio<br />
<br />
<br />
Configuration example for LCD:<br />
<pre class="brush: ini"><br />
[disp_init]<br />
disp_init_enable = 1<br />
disp_mode = 0<br />
<br />
screen0_output_type = 1<br />
screen0_output_mode = 4<br />
<br />
screen1_output_type = 1<br />
screen1_output_mode = 4<br />
<br />
fb0_framebuffer_num = 2<br />
fb0_format = 10<br />
fb0_pixel_sequence = 0<br />
fb0_scaler_mode_enable = 0<br />
<br />
fb1_framebuffer_num = 2<br />
fb1_format = 10<br />
fb1_pixel_sequence = 0<br />
fb1_scaler_mode_enable = 0<br />
</pre><br />
<br />
Configuration example for VGA:<br />
<pre class="brush: ini"><br />
[disp_init]<br />
disp_init_enable = 1<br />
disp_mode = 0<br />
<br />
screen0_output_type = 4<br />
screen0_output_mode = 4<br />
<br />
screen1_output_type = 2<br />
screen1_output_mode = 14<br />
<br />
fb0_framebuffer_num = 2<br />
fb0_format = 10<br />
fb0_pixel_sequence = 0<br />
fb0_scaler_mode_enable = 1<br />
<br />
fb1_framebuffer_num = 2<br />
fb1_format = 10<br />
fb1_pixel_sequence = 0<br />
fb1_scaler_mode_enable = 1<br />
</pre><br />
Configuration example for Composite TV on an old TV (PAL mode):<br />
<pre class="brush: ini"><br />
[disp_init]<br />
disp_init_enable = 1<br />
disp_mode = 0<br />
<br />
screen0_output_type = 2<br />
screen0_output_mode = 11<br />
<br />
screen1_output_type = 2<br />
screen1_output_mode = 11<br />
<br />
fb0_framebuffer_num = 2<br />
fb0_format = 10<br />
fb0_pixel_sequence = 0<br />
fb0_scaler_mode_enable = 1<br />
<br />
fb1_framebuffer_num = 2<br />
fb1_format = 10<br />
fb1_pixel_sequence = 0<br />
fb1_scaler_mode_enable = 1<br />
</pre><br />
<br />
== lcd[0/1] configuration ==<br />
<br />
lcd0 is used when lcd output is selected by display screen0, lcd1 by display screen1.<br />
<br />
* '''lcd_used''': 0 to disable; 1 to enable<br />
* '''lcd_pwm_not_used''': 0 to enable PWM; 1 to disable<br />
* '''lcd_pwm_ch''': PWM channel<br />
* '''lcd_pwm_freq''': PWM frequency in Hz<br />
* '''lcd_pwm_pol''': PWM polarity; 0 is pulse LOW for lcd[0|1]_backlight periods, 1 is pulse HIGH.<br />
* '''lcd_x''': X-axis active width<br />
* '''lcd_y''': Y-axis active height<br />
* '''lcd_dclk_freq''': pixel clock frequency in MHz<br />
* '''lcd_if''': lcd interface:<br />
:::{| class="wikitable"<br />
! interface<br />
! lcd_interface<br />
|-<br />
|0<br />
|hv (sync + de)<br />
|-<br />
|1<br />
|8080<br />
|-<br />
|2<br />
|ttl<br />
|-<br />
|3<br />
|lvds<br />
|-<br />
|4<br />
|dsi (on [[A20]] it means the use of [[SSD2828]] bridge chip, on [[A31]] it might really mean native DSI)<br />
|-<br />
|5<br />
|edp<br />
|-<br />
|6<br />
|external dsi (the use of [[SSD2828]] bridge chip on [[A31]] and onwards)<br />
|}<br />
* '''lcd_hbp''': hsync back porch<br />
* '''lcd_ht''': hsync total cycle<br />
* '''lcd_vbp''': vsync back porch<br />
* '''lcd_vt''': vsync total cycle * 2<br />
* '''lcd_hv_if''': 0 for parallel hv interface; 1: for serial hv interface<br />
* '''lcd_hv_smode''': 0 for RGB888 serial interface mode; 1 for CCIR656<br />
* '''lcd_hv_s888_if''': serial RGB format<br />
* '''lcd_hv_syuv_if''': serial YUV format<br />
* '''lcd_hv_vspw''': vysnc pulse width<br />
* '''lcd_hv_hspw''': hsync pulse width<br />
* '''lcd_hv_lde_used''': 0 to disable; 1 to enable<br />
* '''lcd_hv_lde_iovalue''': HV LDE iovalue<br />
* '''lcd_lvds_ch''': 0 for single channel; 1 for dual channel<br />
* '''lcd_lvds_mode''': 0 for NS mode; 1 for JEIDA mode<br />
* '''lcd_lvds_bitwidth''': 0 for 24 bit; 1 for 18 bit<br />
* '''lcd_io_cfg0''': lcd IO configuration<br />
* '''lcd_lvds_io_cross''': 0 for normal; 1 for pn cross<br />
* '''lcd_cpu_if''': cpu if mode:<br />
<br />
:::{| class="wikitable"<br />
! mode<br />
! cpu_if<br />
|-<br />
|0<br />
|18 bit<br />
|-<br />
|1<br />
|16 bit mode0<br />
|-<br />
|2<br />
|16 bit mode1<br />
|-<br />
|3<br />
|16 bit mode2<br />
|-<br />
|4<br />
|16 bit mode3<br />
|-<br />
|5<br />
|9 bit<br />
|-<br />
|6<br />
|8 bit, 256k<br />
|-<br />
|7<br />
|8 bit, 65k<br />
|}<br />
* '''lcd_gamma_correction_en''': 0 to disable; 1 to enable<br />
* '''lcd_gamma_tbl_[0-255]''': Gamma table 0 through 255<br />
* '''lcd_frm''': 0 to disable dither; 1 to enable enable rgb666 dither; 2 to enable rgb656 dither<br />
* '''lcd_io_cfg0''': lcd io inv<br />
* '''lcd_bl_en_used''': 0 to disable; 1 to enable<br />
* '''lcd_bl_en''': LCD BackLight GPIO configuration<br />
* '''lcd_power_used''': 0 to disable; 1 to enable<br />
* '''lcd_power''': LCD_VCC Voltage control GPIO configuration<br />
* '''lcd_pwm_used''': 0 to disable; 1 to enable<br />
* '''lcd_pwm''': lcd PWM, GPIO configuration (PWM0 fixed using the PB02 PWM1 fixed PI03 without user modification)<br />
* '''lcd_gpio_0''': 2/3-wire SCL GPIO configuration <br />
* '''lcd_gpio_1''': 2/3-wire SDA GPIO configuration<br />
* '''lcd_gpio_2''': 2/3-wire SCEN GPIO configuration<br />
* '''lcd_gpio_3''': LCD module RESET GPIO configuration<br />
* '''lcdd0''': data bit 0 GPIO configuration<br />
* '''lcdd1''': data bit 1 GPIO configuration<br />
* '''lcdd2''': data bit 2 GPIO configuration<br />
* '''lcdd3''': data bit 3 GPIO configuration<br />
* '''lcdd4''': data bit 4 GPIO configuration<br />
* '''lcdd5''': data bit 5 GPIO configuration<br />
* '''lcdd6''': data bit 6 GPIO configuration<br />
* '''lcdd7''': data bit 7 GPIO configuration<br />
* '''lcdd8''': data bit 8 GPIO configuration<br />
* '''lcdd9''': data bit 9 GPIO configuration<br />
* '''lcdd10''': data bit 10 GPIO configuration<br />
* '''lcdd11''': data bit 11 GPIO configuration<br />
* '''lcdd12''': data bit 12 GPIO configuration<br />
* '''lcdd13''': data bit 13 GPIO configuration<br />
* '''lcdd14''': data bit 14 GPIO configuration<br />
* '''lcdd15''': data bit 15 GPIO configuration<br />
* '''lcdd16''': data bit 16 GPIO configuration<br />
* '''lcdd17''': data bit 17 GPIO configuration<br />
* '''lcdd18''': data bit 18 GPIO configuration<br />
* '''lcdd19''': data bit 19 GPIO configuration<br />
* '''lcdd20''': data bit 20 GPIO configuration<br />
* '''lcdd21''': data bit 21 GPIO configuration<br />
* '''lcdd22''': data bit 22 GPIO configuration<br />
* '''lcdd23''': data bit 23 GPIO configuration<br />
* '''lcdclk''': LCD Clock GPIO configuration<br />
* '''lcdde''': LCD ''de'' GPIO configuration<br />
* '''lcdhsync''': H sync GPIO configuration<br />
* '''lcdvsync''': V sync GPIO configuration<br />
<br />
=== [lcd0_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[lcd0_para]<br />
lcd_used = 1<br />
lcd_x = 800<br />
lcd_y = 480<br />
lcd_dclk_freq = 33<br />
lcd_pwm_freq = 1000<br />
lcd_pwm_pol = 0<br />
lcd_swap = 0<br />
lcd_if = 0<br />
lcd_hbp = 215<br />
lcd_ht = 1055<br />
lcd_vbp = 34<br />
lcd_vt = 1050<br />
lcd_hv_if = 0<br />
lcd_hv_smode = 0<br />
lcd_hv_s888_if = 0<br />
lcd_hv_syuv_if = 0<br />
lcd_hv_vspw = 0<br />
lcd_hv_hspw = 0<br />
lcd_hv_lde_used = 0<br />
lcd_hv_lde_iovalue = 0<br />
lcd_lvds_ch = 0<br />
lcd_lvds_mode = 0<br />
lcd_lvds_bitwidth = 0<br />
lcd_lvds_io_cross = 0<br />
lcd_cpu_if = 0<br />
lcd_cpu_da = 0<br />
lcd_frm = 0<br />
lcd_io_cfg0 = 0x10000000<br />
lcd_io_cfg1 = 0<br />
lcd_io_strength = 0<br />
lcd_bl_en_used = 1<br />
lcd_bl_en = port: PH07<1><0><default><1><br />
lcd_power_used = 1<br />
lcd_power = port: PH08<1><0><default><1><br />
lcd_pwm_used = 1<br />
lcd_pwm = port:PB02<2><default><default><default><br />
lcd_gpio_0 =<br />
lcd_gpio_1 =<br />
lcd_gpio_2 =<br />
lcd_gpio_3 =<br />
lcdd0 = port:PD00<2><default><default><default><br />
lcdd1 = port:PD01<2><default><default><default><br />
lcdd2 = port:PD02<2><default><default><default><br />
lcdd3 = port:PD03<2><default><default><default><br />
lcdd4 = port:PD04<2><default><default><default><br />
lcdd5 = port:PD05<2><default><default><default><br />
lcdd6 = port:PD06<2><default><default><default><br />
lcdd7 = port:PD07<2><default><default><default><br />
lcdd8 = port:PD08<2><default><default><default><br />
lcdd9 = port:PD09<2><default><default><default><br />
lcdd10 = port:PD10<2><default><default><default><br />
lcdd11 = port:PD11<2><default><default><default><br />
lcdd12 = port:PD12<2><default><default><default><br />
lcdd13 = port:PD13<2><default><default><default><br />
lcdd14 = port:PD14<2><default><default><default><br />
lcdd15 = port:PD15<2><default><default><default><br />
lcdd16 = port:PD16<2><default><default><default><br />
lcdd17 = port:PD17<2><default><default><default><br />
lcdd18 = port:PD18<2><default><default><default><br />
lcdd19 = port:PD19<2><default><default><default><br />
lcdd20 = port:PD20<2><default><default><default><br />
lcdd21 = port:PD21<2><default><default><default><br />
lcdd22 = port:PD22<2><default><default><default><br />
lcdd23 = port:PD23<2><default><default><default><br />
lcdclk = port:PD24<2><default><default><default><br />
lcdde = port:PD25<2><default><default><default><br />
lcdhsync = port:PD26<2><default><default><default><br />
lcdvsync = port:PD27<2><default><default><default><br />
</pre><br />
<br />
Other configuration examples for certain panels:<br />
<pre class="brush: ini"><br />
;lvds 640x480 module name: SG0570EDG<br />
lcd_x = 640<br />
lcd_y = 480<br />
lcd_dclk_freq = 25<br />
lcd_if = 3<br />
lcd_hbp = 114<br />
lcd_ht = 800<br />
lcd_vt = 1050<br />
lcd_vbp = 34<br />
lcd_pwm_freq = 20000<br />
lcd_lvds_bitwidth = 1<br />
lcd_pwm_used = 1<br />
lcd_pwm = port:PB02<2><0><default><default><br />
lcd_pwm_pol = 0<br />
<br />
;RGB 800x480 module name: H-B070D-15C<br />
lcd_x = 800<br />
lcd_y = 480<br />
lcd_dclk_freq = 33<br />
lcd_if = 0<br />
lcd_hbp = 46<br />
lcd_ht = 1055<br />
lcd_vbp = 23<br />
lcd_vt = 1050<br />
<br />
;RGB 800x600 module name: H-B080D-24F<br />
lcd_x = 800<br />
lcd_y = 600<br />
lcd_dclk_freq = 40<br />
lcd_if = 0<br />
lcd_hbp = 46<br />
lcd_ht = 1056<br />
lcd_vbp = 23<br />
lcd_vt = 1270<br />
<br />
<br />
;RGB 480x272 module name: KD43G18-40NB-A11<br />
lcd_x = 480<br />
lcd_y = 272<br />
lcd_dclk_freq = 9<br />
lcd_if = 0<br />
lcd_hbp = 2<br />
lcd_ht = 525<br />
lcd_vbp = 2<br />
lcd_vt = 572<br />
<br />
;lvds 1024x600 module name: CLAP101NC01CW�<br />
lcd_x = 1024<br />
lcd_y = 600<br />
lcd_dclk_freq = 52<br />
lcd_if = 3<br />
lcd_hbp = 33<br />
lcd_ht = 1344<br />
lcd_vbp = 23<br />
lcd_vt = 1270<br />
<br />
;lvds 1024x768 module name: KD080D3-40NA-A2<br />
lcd_x = 1024<br />
lcd_y = 768<br />
lcd_dclk_freq = 65<br />
lcd_if = 3<br />
lcd_hbp = 160<br />
lcd_ht = 1344<br />
lcd_vbp = 23<br />
lcd_vt = 1612<br />
<br />
;lvds 1024x768 module name: LG-LP097X02<br />
lcd_x = 1024<br />
lcd_y = 768<br />
lcd_dclk_freq = 100<br />
lcd_if = 3<br />
lcd_hbp = 480<br />
lcd_ht = 2084<br />
lcd_vbp = 6<br />
lcd_vt = 1600<br />
lcd_lvds_bitwidth = 1<br />
lcd_io_cfg0 = 0x04000000<br />
lcd_frm = 1<br />
<br />
lcd_io_cfg0 = 0x10000000<br />
lcd_gamma_correction_en = 0<br />
lcd_gamma_tbl_0 = 0x00000000<br />
lcd_gamma_tbl_1 = 0x00010101<br />
;........<br />
lcd_gamma_tbl_255 = 0x00ffffff<br />
</pre><br />
<br />
=== [lcd1_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[lcd1_para]<br />
lcd_used = 0<br />
<br />
lcd_x = 0<br />
lcd_y = 0<br />
lcd_dclk_freq = 0<br />
lcd_pwm_not_used = 0<br />
lcd_pwm_ch = 0<br />
lcd_pwm_freq = 0<br />
lcd_pwm_pol = 0<br />
lcd_if = 0<br />
lcd_hbp = 0<br />
lcd_ht = 0<br />
lcd_vbp = 0<br />
lcd_vt = 0<br />
lcd_hv_if = 0<br />
lcd_hv_smode = 0<br />
lcd_hv_s888_if = 0<br />
lcd_hv_syuv_if = 0<br />
lcd_hv_vspw = 0<br />
lcd_hv_hspw = 0<br />
lcd_lvds_ch = 0<br />
lcd_lvds_mode = 0<br />
lcd_lvds_bitwidth = 0<br />
lcd_lvds_io_cross = 0<br />
lcd_cpu_if = 0<br />
lcd_frm = 0<br />
lcd_io_cfg0 = 0<br />
lcd_gamma_correction_en = 0<br />
lcd_gamma_tbl_0 = 0x00000000<br />
lcd_gamma_tbl_1 = 0x00010101<br />
;........<br />
lcd_gamma_tbl_255 = 0x00ffffff<br />
<br />
lcd_bl_en_used = 0<br />
lcd_bl_en =<br />
<br />
lcd_power_used = 0<br />
lcd_power = <br />
<br />
lcd_pwm_used = 0<br />
lcd_pwm = port:PI03<2><0><default><default><br />
<br />
lcd_gpio_0 = <br />
lcd_gpio_1 = <br />
lcd_gpio_2 = <br />
lcd_gpio_3 = <br />
<br />
lcdd0 = port:PH00<2><0><default><default><br />
lcdd1 = port:PH01<2><0><default><default><br />
lcdd2 = port:PH02<2><0><default><default><br />
lcdd3 = port:PH03<2><0><default><default><br />
lcdd4 = port:PH04<2><0><default><default><br />
lcdd5 = port:PH05<2><0><default><default><br />
lcdd6 = port:PH06<2><0><default><default><br />
lcdd7 = port:PH07<2><0><default><default><br />
lcdd8 = port:PH08<2><0><default><default><br />
lcdd9 = port:PH09<2><0><default><default><br />
lcdd10 = port:PH10<2><0><default><default><br />
lcdd11 = port:PH11<2><0><default><default><br />
lcdd12 = port:PH12<2><0><default><default><br />
lcdd13 = port:PH13<2><0><default><default><br />
lcdd14 = port:PH14<2><0><default><default><br />
lcdd15 = port:PH15<2><0><default><default><br />
lcdd16 = port:PH16<2><0><default><default><br />
lcdd17 = port:PH17<2><0><default><default><br />
lcdd18 = port:PH18<2><0><default><default><br />
lcdd19 = port:PH19<2><0><default><default><br />
lcdd20 = port:PH20<2><0><default><default><br />
lcdd21 = port:PH21<2><0><default><default><br />
lcdd22 = port:PH22<2><0><default><default><br />
lcdd23 = port:PH23<2><0><default><default><br />
lcdclk = port:PH24<2><0><default><default><br />
lcdde = port:PH25<2><0><default><default><br />
lcdhsync = port:PH26<2><0><default><default><br />
lcdvsync = port:PH27<2><0><default><default><br />
</pre><br />
<br />
== tv out dac configuration ==<br />
The TV-Out Digital Analog Converter (DAC) modules the framebuffer to a signal suitable for a TV<br />
=== [tv_out_dac_para] ===<br />
<br />
* '''dac_used''': 0 to disable; 1 to enable<br />
* '''dac0_src''': Output source for the DAC:<br />
* '''dac1_src''': Output source for the DAC:<br />
* '''dac2_src''': Output source for the DAC:<br />
* '''dac3_src''': Output source for the DAC:<br />
:::{| class="wikitable"<br />
! dac<br />
! Output source<br />
|-<br />
|0<br />
|Composite<br />
|-<br />
|1<br />
|Luma<br />
|-<br />
|2<br />
|Chroma<br />
|-<br />
|3<br />
|<br />
|-<br />
|4<br />
|Y<br />
|-<br />
|5<br />
|Pb<br />
|-<br />
|6<br />
|Pr<br />
|-<br />
|7<br />
|None<br />
|}<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[tv_out_dac_para]<br />
dac_used = 1<br />
dac0_src = 4<br />
dac1_src = 5<br />
dac2_src = 6<br />
dac3_src = 0<br />
</pre><br />
<br />
== csi gpio configuration ==<br />
<br />
<br />
* '''csi_used''': 0 to enable; 1 to disable<br />
* '''csi_mode''': 0 to sample one csi to one buffer; 1 to sample two csi to one buffer<br />
* '''csi_dev_qty''': Quantity of devices linked to the csi interface<br />
* '''csi_twi_id''': TWI controller to use<br />
* '''csi_twi_id_b''': TWI controller to use for second device<br />
* '''csi_mname''': Module name to match the csi device; currently known to work:<br />
* '''csi_mname_b''': Module name to match the second csi device; currently known to work:<br />
:::*ov7670<br />
:::*gc0308<br />
:::*gt2005<br />
:::*hi704<br />
:::*hi253<br />
* '''csi_twi_addr''': TWI address for the used camera<br />
* '''csi_twi_addr_b''': TWI address for the used camera for second device<br />
* '''csi_if''': interface:<br />
* '''csi_if_b''': interface for second device:<br />
:::{| class="wikitable"<br />
! if<br />
! csi interface<br />
|-<br />
|0<br />
|hv_8bit<br />
|-<br />
|1<br />
|hv_16bit<br />
|-<br />
|2<br />
|hv_24bit<br />
|-<br />
|3<br />
|bt656 1ch<br />
|-<br />
|4<br />
|bt656 2ch<br />
|-<br />
|5<br />
|bt656 4ch<br />
|}<br />
* '''csi_pck''': ''p'' clock GPIO configuration<br />
* '''csi_ck''': clock GPIO configuration<br />
* '''csi_hsync''': H-sync GPIO configuration<br />
* '''csi_vsync''': V-sync GPIO configuration<br />
* '''csi_hflip''': Horizontal frame flip<br />
* '''csi_hflip_b''': Horizontal frame flip for second device<br />
* '''csi_vflip''': Vertical frame flip<br />
* '''csi_vflip_b''': Vertical frame flip for second device<br />
* '''csi_d0''': data bit 0 GPIO configuration<br />
* '''csi_d1''': data bit 1 GPIO configuration<br />
* '''csi_d2''': data bit 2 GPIO configuration<br />
* '''csi_d3''': data bit 3 GPIO configuration<br />
* '''csi_d4''': data bit 4 GPIO configuration<br />
* '''csi_d5''': data bit 5 GPIO configuration<br />
* '''csi_d6''': data bit 6 GPIO configuration<br />
* '''csi_d7''': data bit 7 GPIO configuration<br />
* '''csi_d8''': data bit 8 GPIO configuration<br />
* '''csi_d9''': data bit 9 GPIO configuration<br />
* '''csi_d10''': data bit 10 GPIO configuration<br />
* '''csi_d11''': data bit 11 GPIO configuration<br />
* '''csi_d12''': data bit 12 GPIO configuration<br />
* '''csi_d13''': data bit 13 GPIO configuration<br />
* '''csi_d14''': data bit 14 GPIO configuration<br />
* '''csi_d15''': data bit 15 GPIO configuration<br />
* '''csi_reset''': Camera reset; the default value, high or low ,depends on the module<br />
* '''csi_power_en''': Power enable GPIO configuration<br />
* '''csi_stby''': Camera standby GPIO configuration; the default value, high or low ,depends on the module<br />
* '''csi_stby_b''': Camera standby GPIO configuration for second device; the default value, high or low ,depends on the module<br />
* '''csi_stby_mode''': 0 to not shutdown power at standby; 1 shutdown power at standby<br />
* '''csi_facing''': Tells the device if the camera is facing or otherwise. 0 for the back, 1 for the front camera.<br />
* '''csi_facing_b''': Same as above.<br />
* '''csi_vflip''': Vertical flip; 0: disabled, 1: enabled<br />
* '''csi_hflip''': Horizontal flip; 0: disabled, 1: enabled<br />
* '''csi_flash''': Camera Flash GPIO configuration<br />
* '''csi_flash_b''': Camera Flash GPIO configuration for second device<br />
* '''csi_flash_pol''': Flash polarity of flash light; 0 for active low; 1 for active high<br />
* '''csi_flash_pol_b''': Flash polarity of flash light for second device; 0 for active low; 1 for active high<br />
* '''csi_af_en''': Autofocus enable GPIO configuration<br />
* '''csi_iovdd''': Camera module IO power, PMU power supply<br />
* '''csi_iovdd_b''': Camera module IO power, PMU power supply for second device<br />
* '''csi_avdd''': Camera analog power, PMU power supply<br />
* '''csi_avdd_b''': Camera analog power, PMU power supply for second device<br />
* '''csi_dvdd''': Camera digital power, PMU power supply<br />
* '''csi_dvdd_b''': Camera digital power, PMU power supply for second device<br />
* '''pmu_ldo3''': "axp20_pll" or leave empty empty when not using any PMU power supply<br />
* '''pmu_ldo4''': "axp20_hdmi" or empty when not using any PMU power supply<br />
<br />
=== [csi0_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[csi0_para]<br />
csi_used = 1<br />
csi_mode = 0<br />
csi_dev_qty = 1<br />
csi_stby_mode = 1<br />
<br />
csi_mname = "gc0308"<br />
csi_twi_id = 1<br />
csi_twi_addr =0x42<br />
csi_if = 0<br />
csi_vflip = 0<br />
csi_hflip = 1<br />
csi_iovdd = ""<br />
csi_avdd = ""<br />
csi_dvdd = ""<br />
csi_flash_pol = 1<br />
<br />
csi_mname_b = "gt2005"<br />
csi_twi_id_b = 1<br />
csi_twi_addr_b = 0x78<br />
csi_if_b = 0<br />
csi_vflip_b = 0<br />
csi_hflip_b = 0<br />
csi_iovdd_b = ""<br />
csi_avdd_b = ""<br />
csi_dvdd_b = ""<br />
csi_flash_pol_b = 1<br />
<br />
csi_pck = port:PE00<3><default><default><default><br />
csi_ck = port:PE01<3><default><default><default><br />
csi_hsync = port:PE02<3><default><default><default><br />
csi_vsync= port:PE03<3><default><default><default><br />
csi_d0 = port:PE04<3><default><default><default><br />
csi_d1 = port:PE05<3><default><default><default><br />
csi_d2 = port:PE06<3><default><default><default><br />
csi_d3 = port:PE07<3><default><default><default><br />
csi_d4 = port:PE08<3><default><default><default><br />
csi_d5 = port:PE09<3><default><default><default><br />
csi_d6 = port:PE10<3><default><default><default><br />
csi_d7 = port:PE11<3><default><default><default><br />
csi_d8 = port:PG04<5><default><default><default><br />
csi_d9 = port:PG05<5><default><default><default><br />
csi_d10 = port:PG06<5><default><default><default><br />
csi_d11 = port:PG07<5><default><default><default><br />
csi_d12 = port:PG08<5><default><default><default><br />
csi_d13 = port:PG09<5><default><default><default><br />
csi_d14 = port:PG10<5><default><default><default><br />
csi_d15 = port:PG11<5><default><default><default><br />
csi_reset = port:PH13<1><default><default><0><br />
csi_power_en = port:PH16<1><default><default><0><br />
csi_stby = port:PH18<1><default><default><0><br />
csi_flash = <br />
csi_af_en = <br />
csi_reset_b = port:PH13<1><default><default><0><br />
csi_power_en_b = port:PH16<1><default><default><0><br />
csi_stby_b = port:PH19<1><default><default><0><br />
csi_flash_b = <br />
csi_af_en_b = <br />
</pre><br />
<br />
=== [csi1_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[csi1_para]<br />
csi_used = 1<br />
csi_mode = 0<br />
csi_dev_qty = 1<br />
csi_stby_mode = 1<br />
<br />
csi_mname = "gc0308"<br />
csi_twi_id = 1<br />
csi_twi_addr =0x42<br />
csi_if = 0<br />
csi_vflip = 0<br />
csi_hflip = 1<br />
csi_iovdd = ""<br />
csi_avdd = ""<br />
csi_dvdd = ""<br />
csi_flash_pol = 1<br />
<br />
csi_mname_b = "gt2005"<br />
csi_twi_id_b = 1<br />
csi_twi_addr_b = 0x78<br />
csi_if_b = 0<br />
csi_vflip_b = 0<br />
csi_hflip_b = 0<br />
csi_iovdd_b = ""<br />
csi_avdd_b = ""<br />
csi_dvdd_b = ""<br />
csi_flash_pol_b = 1<br />
<br />
csi_pck = port:PG00<3><default><default><default><br />
csi_ck = port:PG01<3><default><default><default><br />
csi_d0 = port:PH00<7><default><default><default><br />
csi_d1 = port:PH01<7><default><default><default><br />
csi_d2 = port:PH02<7><default><default><default><br />
csi_d3 = port:PH03<7><default><default><default><br />
csi_d4 = port:PH04<7><default><default><default><br />
csi_d5 = port:PH05<7><default><default><default><br />
csi_d6 = port:PH06<7><default><default><default><br />
csi_d7 = port:PH07<7><default><default><default><br />
csi_d8 = port:PH08<7><default><default><default><br />
csi_d9 = port:PH09<7><default><default><default><br />
csi_d10 = port:PH10<7><default><default><default><br />
csi_d11 = port:PH11<7><default><default><default><br />
csi_d12 = port:PH12<7><default><default><default><br />
csi_d13 = port:PH13<7><default><default><default><br />
csi_d14 = port:PH14<7><default><default><default><br />
csi_d15 = port:PH15<7><default><default><default><br />
csi_d16 = port:PH16<7><default><default><default><br />
csi_d17 = port:PH17<7><default><default><default><br />
csi_d18 = port:PH18<7><default><default><default><br />
csi_d19 = port:PH19<7><default><default><default><br />
csi_d20 = port:PH20<7><default><default><default><br />
csi_d21 = port:PH21<7><default><default><default><br />
csi_d22 = port:PH22<7><default><default><default><br />
csi_d23 = port:PH23<7><default><default><default><br />
csi_hsync = port:PH26<7><default><default><default><br />
csi_vsync= port:PH27<7><default><default><default><br />
csi_reset = port:PG13<1><default><default><0><br />
csi_power_en = port:PG16<1><default><default><0><br />
csi_stby = port:PG18<1><default><default><0><br />
csi_flash = <br />
csi_af_en = <br />
csi_reset_b = port:PG13<1><default><default><0><br />
csi_power_en_b = port:PG16<1><default><default><0><br />
csi_stby_b = port:PG19<1><default><default><0><br />
csi_flash_b = <br />
csi_af_en_b =<br />
</pre><br />
<br />
== tv configuration ==<br />
<br />
=== [tvout_para] ===<br />
<br />
* '''tvout_used''': 0 to disable; 1 to enable<br />
* '''tvout_channel_num''': Channel number<br />
* '''tv_en''': TV encoder GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
tvout_used = 1<br />
tvout_channel_num = 1<br />
tv_en = port:PI12<1><default><default><0><br />
</pre><br />
<br />
=== [tvin_para] ===<br />
* '''tvin_used''': 0 to disable; 1 to enable<br />
* '''tvin_channel_num''': channel number<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
tvin_used = 1<br />
tvin_channel_num = 4<br />
</pre><br />
<br />
== sata configuration ==<br />
<br />
=== [sata_para] ===<br />
* '''sata_used''': 0 to disable; 1 to enable<br />
* '''sata_power_en''': Sata power enable GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
sata_used = 1<br />
sata_power_en = port:PB08<1><default><default><0><br />
</pre><br />
<br />
== sdmmc configuration ==<br />
There are several things to notice when configuring the sdmmc controller.<br />
* '''sdc_used''': 0 to disable; 1 to enable;(0=不使用,1=使用)<br />
* '''sdc_detmode''': detection mode (卡检测模式):<br />
:::{| class="wikitable"<br />
! mode<br />
! detection mode<br />
! note<br />
|-<br />
|0<br />
|<br />
|<br />
|-<br />
|1<br />
|GPIO detection<br />
|Also configure '''sdc_det''' to map to a GPIO (GPIO检测模式,需在sdc_det配置一个GPIO口)<br />
|-<br />
|2<br />
|sdc_d3 detection<br />
|'''sdc_d3''' must be configured as HiZ GPIO and have an external 1 MΩ pull-down resistor (SD卡D3数据口检测模式,需配置GPIO口为高阻,并使用1M欧下拉)<br />
|-<br />
|3<br />
|polling (card cannot be swapped)<br />
|不检测,卡常在<br />
|-<br />
|4<br />
|manually (via the proc file system node)<br />
|<br />
|}<br />
* '''bus_width''': 1 for 1bit; 4 for 4bit (may also be called sdc_bwid?!? verify please)<br />
* '''sdc_d0''': data line 0 GPIO configuration<br />
* '''sdc_d1''': data line 1 GPIO configuration<br />
* '''sdc_d2''': data line 2 GPIO configuration<br />
* '''sdc_d3''': data line 3 GPIO configuration<br />
* '''sdc_clk''': CLK GPIO configuration<br />
* '''sdc_cmd''': CMD GPIO configuration<br />
* '''sdc_det''': DET GPIO configuration<br />
* '''sdc_use_wp''': 0 is normal operation; 1 is write protect<br />
* '''sdc_wp''': Write Protect the GPIO configuration<br />
<br />
=== [mmc0_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[mmc0_para]<br />
sdc_used = 1<br />
sdc_detmode = 1<br />
bus_width = 4<br />
sdc_d1 = port:PF00<2><1><default><default><br />
sdc_d0 = port:PF01<2><1><default><default><br />
sdc_clk = port:PF02<2><1><default><default><br />
sdc_cmd = port:PF03<2><1><default><default><br />
sdc_d3 = port:PF04<2><1><default><default><br />
sdc_d2 = port:PF05<2><1><default><default><br />
sdc_det = port:PH01<0><1><default><default><br />
sdc_use_wp = 0<br />
sdc_wp =<br />
</pre><br />
<br />
=== [mmc1_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[mmc1_para] <br />
sdc_used = 1<br />
sdc_detmode = 1<br />
bus_width = 4<br />
sdc_cmd = port:PH22<5><1><2><default><br />
sdc_clk = port:PH23<5><1><2><default><br />
sdc_d0 = port:PH24<5><1><2><default><br />
sdc_d1 = port:PH25<5><1><2><default><br />
sdc_d2 = port:PH26<5><1><2><default><br />
sdc_d3 = port:PH27<5><1><2><default><br />
sdc_det = port:PH2<0><1><default><default><br />
sdc_use_wp = 0<br />
sdc_wp =<br />
</pre><br />
<br />
=== [mmc2_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[mmc2_para] <br />
sdc_used = 0<br />
</pre><br />
<br />
=== [mmc3_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"> <br />
[mmc3_para] <br />
sdc_used = 1<br />
sdc_detmode = 4<br />
bus_width = 4<br />
sdc_cmd = port:PI04<2><1><2><default><br />
sdc_clk = port:PI05<2><1><2><default><br />
sdc_d0 = port:PI06<2><1><2><default><br />
sdc_d1 = port:PI07<2><1><2><default><br />
sdc_d2 = port:PI08<2><1><2><default><br />
sdc_d3 = port:PI09<2><1><2><default><br />
sdc_det = <br />
sdc_use_wp = 0<br />
sdc_wp =<br />
</pre><br />
<br />
== memory stick configuration ==<br />
<br />
=== [ms_para] ===<br />
* '''ms_used''': 0 to disable; 1 to enable<br />
* '''ms_bs''': Bus State signal GPIO configuration<br />
* '''ms_clk''': Clock GPIO configuration<br />
* '''ms_d0''': Data line 0 GPIO Configuration<br />
* '''ms_d1''': Data line 1 GPIO Configuration<br />
* '''ms_d2''': Data line 2 GPIO Configuration<br />
* '''ms_d3''': Data line 3 GPIO Configuration<br />
* '''ms_det''': Stick detection GPIO Configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[ms_para]<br />
ms_used = 1<br />
ms_bs = port:PH06<5><default><default><default><br />
ms_clk = port:PH07<5><default><default><default><br />
ms_d0 = port:PH08<5><default><default><default><br />
ms_d1 = port:PH09<5><default><default><default><br />
ms_d2 = port:PH10<5><default><default><default><br />
ms_d3 = port:PH11<5><default><default><default><br />
ms_det = port:PH2<0><1><default><default><br />
</pre><br />
<br />
== sim card configuration ==<br />
<br />
=== [smc_para] ===<br />
* '''smc_used''': 0 to disable; 1 to enable<br />
* '''smc_rst''': Reset GPIO configuration<br />
* '''smc_vppen''': VPP enable GPIO configuration<br />
* '''smc_vppp''': Programming VPP GPIO configuration<br />
* '''smc_det''': SIM Card detect GPIO configuration<br />
* '''smc_vccen''': VCC enable GPIO configuration<br />
* '''smc_sck''': Serial clock GPIO configuration<br />
* '''smc_sda''': Serial data GPIO configurion<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[smc_para]<br />
smc_used = 1<br />
smc_rst = port:PH13<5><default><default><default><br />
smc_vppen = port:PH14<5><default><default><default><br />
smc_vppp = port:PH15<5><default><default><default><br />
smc_det = port:PH16<5><default><default><default><br />
smc_vccen = port:PH17<5><default><default><default><br />
smc_sck = port:PH18<5><default><default><default><br />
smc_sda = port:PH19<5><default><default><default><br />
</pre><br />
<br />
== ps2 configuration ==<br />
<br />
=== [ps2_0_para] ===<br />
<br />
* '''ps2_used''': 0 to disable; 1 to enable<br />
* '''ps2_scl''': Serial clock GPIO configuration<br />
* '''ps2_sda''': Serial data GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[ps2_0_para]<br />
ps2_used = 1<br />
ps2_scl = port:PI20<2><1><default><default><br />
ps2_sda = port:PI21<2><1><default><default><br />
</pre><br />
<br />
=== [ps2_1_para] ===<br />
<br />
* '''ps2_used''': 0 to disable; 1 to enable<br />
* '''ps2_scl''': Serial clock GPIO configuration<br />
* '''ps2_sda''': Serial data GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[ps2_1_para]<br />
ps2_used = 1<br />
ps2_scl = port:PI20<2><1><default><default><br />
ps2_sda = port:PI21<2><1><default><default><br />
</pre><br />
<br />
== can bus configuration ==<br />
<br />
=== [can_para] ===<br />
<br />
* '''can_used''': 0 to disable; 1 to enable it<br />
* '''can_tx''': transmit GPIO Configuration<br />
* '''can_rx''': receive GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Can_para]<br />
can_used = 1<br />
can_tx = port:PA16<3><default><default><default><br />
can_rx = port:PA17<3><default><default><default><br />
</pre><br />
<br />
== matrix keyboard ==<br />
<br />
== 23.1 [keypad_para] == <br />
<br />
* '''kp_used''': 0 to disable; 1 to enable<br />
* '''kp_in_size''': column width<br />
* '''kp_out_size''': row width<br />
* '''kp_in0''': column 0 GPIO Configuration<br />
* '''kp_in1''': column 1 GPIO Configuration<br />
* '''kp_in2''': column 2 GPIO Configuration<br />
* '''kp_in3''': column 3 GPIO Configuration<br />
* '''kp_in4''': column 4 GPIO configuration<br />
* '''kp_in5''': column 5 GPIO configuration<br />
* '''kp_in6''': column 6 GPIO Configuration<br />
* '''kp_in7''': column 7 GPIO configuration<br />
* '''kp_out0''': row 0 GPIO Configuration<br />
* '''kp_out1''': row 1 GPIO Configuration<br />
* '''kp_out2''': row 2 GPIO Configuration<br />
* '''kp_out3''': row 3 GPIO Configuration<br />
* '''kp_out4''': row 4 GPIO configuration<br />
* '''kp_out5''': row 5 GPIO configuration<br />
* '''kp_out6''': row 6 GPIO Configuration<br />
* '''kp_out7''': row 7 GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Keypad_para]<br />
kp_used = 1<br />
kp_in_size = 8<br />
kp_out_size = 8<br />
kp_in0 = port:PH08<4><1><default><default><br />
kp_in1 = port:PH09<4><1><default><default><br />
kp_in2 = port:PH10<4><1><default><default><br />
kp_in3 = port:PH11<4><1><default><default><br />
kp_in4 = port:PH14<4><1><default><default><br />
kp_in5 = port:PH15<4><1><default><default><br />
kp_in6 = port:PH16<4><1><default><default><br />
kp_in7 = port:PH17<4><1><default><default><br />
kp_out0 = port:PH18<4><1><default><default><br />
kp_out1 = port:PH19<4><1><default><default><br />
kp_out2 = port:PH22<4><1><default><default><br />
kp_out3 = port:PH23<4><1><default><default><br />
kp_out4 = port:PH24<4><1><default><default><br />
kp_out5 = port:PH25<4><1><default><default><br />
kp_out6 = port:PH26<4><1><default><default><br />
kp_out7 = port:PH27<4><1><default><default><br />
</pre><br />
<br />
== USB control flags ==<br />
<br />
* '''usb_used''': 0 to disable; 1 to enable<br />
* '''usb_port_type''': USB port type:<br />
:::{| class="wikitable"<br />
! type<br />
! usb port type<br />
|-<br />
|0<br />
|device only<br />
|-<br />
|1<br />
|host only<br />
|-<br />
|2<br />
|OTG<br />
|}<br />
* '''usb_detect_type''': 0 = no checking; 1 = VBus / id check<br />
* '''usb_controller_type''': USB controller type:<br />
:::{| class="wikitable"<br />
! type<br />
! usb controller type<br />
|-<br />
|0<br />
|Unknown<br />
|-<br />
|1<br />
|EHCI<br />
|-<br />
|2<br />
|OHCI<br />
|}<br />
* '''usb_id_gpio''':USB ID pin GPIO configuration<br />
* '''usb_det_vbus_gpio''': USB detect VBus pin GPIO configuration (VBus is USB speak for the +5V line)<br />
* '''usb_drv_vbus_gpio''': USB drive VBus pin GPIO configuration<br />
* '''usb_restrict_gpio''': <br />
* '''usb_host_init_state''': In host only mode, host port initialization state; 0 do not initialize; 1 initializatie USB<br />
* '''usb_restric_flag''': <br />
<br />
=== [usbc0] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[usbc0]<br />
usb_used = 1<br />
usb_port_type = 2<br />
usb_detect_type = 1<br />
usb_id_gpio = port:PH04<0><1><default><default><br />
usb_det_vbus_gpio = port:PH05<0><0><default><default><br />
usb_drv_vbus_gpio = port:PB09<1><0><default><0><br />
usb_host_init_state = 0<br />
</pre><br />
<br />
=== [usbc1] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[usbc1]<br />
usb_used = 1<br />
usb_port_type = 1<br />
usb_detect_type = 0<br />
usb_id_gpio =<br />
usb_det_vbus_gpio =<br />
usb_drv_vbus_gpio = port:PH06<1><0><default><0><br />
usb_host_init_state = 1<br />
</pre><br />
<br />
=== [usbc2] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[usbc2]<br />
usb_used = 1<br />
usb_port_type = 1<br />
usb_detect_type = 0<br />
usb_id_gpio =<br />
usb_det_vbus_gpio =<br />
usb_drv_vbus_gpio = port:PH03<1><0><default><0><br />
usb_host_init_state = 1<br />
</pre><br />
<br />
== USB Device ==<br />
<br />
=== [usb_feature] ===<br />
* '''vendor_id''': vendor ID<br />
* '''mass_storage_id''': mass storage ID<br />
* '''adb_id''': android debug bridge ID<br />
* '''manufacturer_name''': vendor name<br />
* '''product_name''': = product name<br />
* '''serial_number''': = serial number<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[usb_feature]<br />
vendor_id = 0x18d1<br />
mass_storage_id = 0x0001<br />
adb_id = 0x0002<br />
manufacturer_name = "USB Developer"<br />
product_name = "Android"<br />
serial_number = "20080411"<br />
</pre><br />
<br />
=== [msc_feature] ===<br />
* '''vendor_name''': vendor name<br />
* '''product_name''': product name<br />
* '''release''': release version<br />
* '''luns''': number of logical units<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[msc_feature]<br />
vendor_name = "USB 2.0"<br />
product_name = "USB Flash Driver"<br />
release = 100<br />
luns = 2<br />
</pre><br />
<br />
== G Sensor configuration ==<br />
<br />
=== [gsensor_para] ===<br />
* '''gsensor_used''': 0 to disable; 1 to enable<br />
* '''gsensor_name''': linux kernel module name to match configuration<br />
* '''gsensor_twi_id''': TWI bus ID<br />
* '''gsensor_twi_addr''': TWI address<br />
* '''gsensor_int1''': interrupt 1 GPIO configuration<br />
* '''gsensor_int2''': interrupt 2 GPIO configuration<br />
* '''gsensor_revert_x_flag''': (untested)<br />
* '''gsensor_revert_y_flag''': (untested)<br />
* '''gsensor_revert_z_flag''': (untested)<br />
* '''gsensor_exchange_x_y_flag''': (untested)<br />
<br />
Configuration example 1:<br />
<pre class="brush: ini"><br />
[Gsensor_para]<br />
gsensor_used = 1<br />
gsenser_name = "bma250"<br />
gsensor_twi_id = 1<br />
gsensor_twi_addr = 0x18<br />
gsensor_int1 = port:PH00<6><1><default><default><br />
gsensor_int2 = port:PI10<6><1><default><default><br />
</pre><br />
<br />
Configuration example 2:<br />
<pre class="brush: ini"><br />
[Gsensor_para]<br />
gsensor_used = 1<br />
gsenser_name = "bma222"<br />
gsensor_twi_id = 1<br />
gsensor_twi_addr = 0x08<br />
gsensor_int1 = port:PH00<6><1><default><default><br />
gsensor_int2 = port:PI10<6><1><default><default><br />
</pre><br />
<br />
Configuration example 3:<br />
<pre class="brush: ini"><br />
[Gsensor_para]<br />
gsensor_used = 1<br />
gsenser_name = "mma7660"<br />
gsensor_twi_id = 1<br />
gsensor_twi_addr = 0x4c<br />
gsensor_int1 = port:PH00<6><1><default><default><br />
gsensor_int2 = port:PI10<6><1><default><default><br />
</pre><br />
<br />
== gps gpio configuration ==<br />
<br />
=== [gps_para] ===<br />
* '''gps_used''': 0 to disable; 1 to enable<br />
* '''gps_spi_id''': SPI controller; 0 - 2 for SPI0, SPI1 or SPI2; 15 if no SPI is used<br />
* '''gps_spi_cs_num''': chip select SPI controller; 0 = SPI0, 1 = SPI1<br />
* '''gps_lradc''': 0 or 1 for Low Rate ADC Format; 2 for no Low Rate ADC Format<br />
* '''gps_clk''': Clock GPIO configuration<br />
* '''gps_sign''': GPS sign GPIO configuration<br />
* '''gps_mag''': GPS Magnitude GPIO configuration<br />
* '''gps_vcc_en''': GPS VCC enable GPIO configuration<br />
* '''gps_osc_en''': GPS Oscillator enable GPIO configuration<br />
* '''gps_rx_en''': GPS receive enable GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[gps_para]<br />
gps_used = 0<br />
gps_spi_id = 2<br />
gps_spi_cs_num = 0<br />
gps_lradc = 1<br />
gps_clk = port:PI00<2><default><default><default><br />
gps_sign = port:PI01<2><default><default><default><br />
gps_mag = port:PI02<2><default><default><default><br />
gps_vcc_en = port:PC22<1><default><default><0><br />
gps_osc_en = port:PI14<1><default><default><0><br />
gps_rx_en = port:PI15<1><default><default><0><br />
</pre><br />
<br />
== sdio wifi configuration ==<br />
<br />
=== [sdio_wifi_para] ===<br />
* '''sdio_wifi_used''': 0 to disable; 1 to enable<br />
* '''sdio_wifi_sdc_id''': SD controller ID to use<br />
* '''sdio_wifi_mod_sel''': SDI module selection (see [https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.4/drivers/mmc/mmc-pm/mmc_pm.c mmc_pm.c] ):<br />
:::{| class="wikitable"<br />
! mode<br />
! wifi selection mode<br />
! note<br />
|-<br />
|0<br />
|none<br />
|<br />
|-<br />
|1<br />
|swl-n20<br />
|WiFi<br />
|-<br />
|2<br />
|usi bm-01<br />
|WiFi - Bluetooth - FM radio<br />
|-<br />
|3<br />
|ar6302qfn<br />
|<br />
|-<br />
|4<br />
|apm6xxx<br />
|<br />
|-<br />
|5<br />
|swb b23<br />
|WiFi - Bluetooth - FM radio<br />
|-<br />
|6<br />
|hw-mw269x<br />
|Huawei wifi driver<br />
|-<br />
|7<br />
|bcm40181<br />
|-<br />
|8<br />
|bcm40183<br />
|BCM40183(BCM4330)<br />
|-<br />
|9 <br />
|rtl8723as<br />
|RTL8723AS(RF-SM02B)<br />
|-<br />
|10<br />
|rtl8189es<br />
|RTL8189ES(SM89E00)<br />
|}<br />
* '''sdio_wifi_shdn''': SHDN GPIO configuration<br />
* '''sdio_wifi_host_wakeup''': WiFi wakeup GPIO Configuration<br />
* '''sdio_wifi_vdd_en''': VDD enable GPIO configuration<br />
* '''sdio_wifi_vcc_en''': VCC enable GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Sdio_wifi_para]<br />
sdio_wifi_used = 1<br />
sdio_wifi_sdc_id = 3<br />
sdio_wifi_mod_sel = 1<br />
<br />
sdio_wifi_shdn = port:PH09<1><default><default><0><br />
sdio_wifi_host_wakeup = port:PH10<1><default><default><1><br />
sdio_wifi_vdd_en = port:PH11<1><default><default><0><br />
sdio_wifi_vcc_en = port:PH12<1><default><default><0><br />
</pre><br />
<br />
Optionally the following parameters can be used when other/multiple transceivers are installed.<br />
<pre class="brush: ini"><br />
; 1 - samsung swl-n20 sdio wifi gpio config<br />
swl_n20_shdn = port:PH09<1><default><default><0><br />
swl_n20_host_wakeup = port:PH10<1><default><default><1><br />
swl_n20_vdd_en = port:PH11<1><default><default><0><br />
swl_n20_vcc_en = port:PH12<1><default><default><0><br />
<br />
; 2 - usi bm01a sdio wifi gpio config<br />
usi_bm01a_wl_pwr = port:PH12<1><default><default><0><br />
usi_bm01a_wlbt_regon = port:PI11<1><default><default><0><br />
usi_bm01a_wl_rst = port:PI10<1><default><default><0><br />
usi_bm01a_wl_wake = port:PI12<1><default><default><0><br />
usi_bm01a_bt_rst = port:PB05<1><default><default><0><br />
usi_bm01a_bt_wake = port:PI20<1><default><default><0><br />
usi_bm01a_bt_hostwake = port:PI21<0><default><default><0><br />
<br />
; 3 - ar6302qfn sdio wifi gpio config<br />
ar6302_qfn_pwr = port:PH12<1><default><default><0><br />
ar6302_qfn_shdn_n = port:PH09<1><default><default><0><br />
<br />
; 4 - apm sdio wifi gpio config<br />
apm_6981_vcc_en = port:PA09<1><default><default><0><br />
apm_6981_vdd_en = port:PA10<1><default><default><0><br />
apm_6981_wakeup = port:PA11<1><default><default><0><br />
apm_6981_rst_n = port:PA12<1><default><default><0><br />
apm_6981_pwd_n = port:PA13<1><default><default><0><br />
<br />
; 6 - huawei mw269x(v1/v2) sdio wifi gpio config<br />
hw_mw269x_wl_pwr = port:PH12<1><default><default><0><br />
hw_mw269x_wl_enb = port:PH11<1><default><default><0><br />
hw_mw269x_wl_hostwake = port:PH10<0><default><default><0><br />
hw_mw269x_wl_wake = port:PH09<1><default><default><0><br />
hw_mw269x_bt_enb = port:PB05<1><default><default><0><br />
hw_mw269x_bt_wake = port:PI20<1><default><default><0><br />
hw_mw269x_bt_hostwake = port:PI21<0><default><default><0><br />
</pre><br />
<br />
== us wifi configuration ==<br />
<br />
=== [usb_wifi_para] ===<br />
* '''usb_wifi_used''': 0 to disable; 1 to enable<br />
* '''usb_wifi_usbc_num''': USB controller to which USB wifi module is connected<br />
* '''usb_host_init_state''': used together, such as xx = 2. Then usbc2 the usb_host_init_state 0<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[usb_wifi_para]<br />
usb_wifi_used = 0<br />
usb_wifi_usbc_num = 2<br />
</pre><br />
<br />
== 3G configuration ==<br />
<br />
=== [3g_para] ===<br />
* '''3g_used''': 0 to disable; 1 to enable<br />
* '''3g_usbc_num''': USB controller to which the 3G module is connected<br />
* '''3g_uart_num''': UART controller to which the 3G module is connected<br />
* '''3g_pwr''': power enable GPIO configuration<br />
* '''3g_wakeup''': wakeup GPIO configuration<br />
* '''3g_int''': interrupt GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
3g_used = 1<br />
3g_usbc_num = 2<br />
3g_uart_num = 0<br />
3g_pwr = port:PH09<1><default><default><1><br />
3g_wakeup = port:PH10<1><default><default><1><br />
3g_int = port:PH11<1><default><default><1><br />
</pre><br />
<br />
== gyroscope ==<br />
<br />
=== [gy_para] ===<br />
* '''gy_used''': 0 to disable; 1 to enable<br />
* '''gy_twi_id''': TWI controller to use<br />
* '''gy_twi_addr''': TWI address to use<br />
* '''gy_int1''': interrupt 1 GPIO configuration<br />
* '''gy_int2''': interrupt 2 GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[gy_para]<br />
gy_used = 1<br />
gy_twi_id = 1<br />
gy_twi_addr = 0x0a<br />
gy_int1 = port:PH18<6><1><default><default><br />
gy_int2 = port:PH19<6><1><default><default><br />
</pre><br />
<br />
== light sensor ==<br />
<br />
=== [ls_para] ===<br />
* '''ls_used''': 0 to disable; 1 to enable<br />
* '''ls_twi_id''': TWI controller to use<br />
* '''ls_twi_addr''': TWI address<br />
* '''ls_int''': interrupt GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[ls_para]<br />
ls_used = 1<br />
ls_twi_id = 1<br />
ls_twi_addr = 0x0c<br />
ls_int = port:PH20<6><1><default><default><br />
</pre><br />
<br />
== compass ==<br />
<br />
=== [compass_para] ===<br />
* '''compass_used''': 0 to disable; 1 to enable<br />
* '''compass_twi_id''': TWI controller to use<br />
* '''compass_twi_addr''': TWI address to use<br />
* '''compass_int''': interrupt GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[compass_para]<br />
compass_used = 0<br />
compass_twi_id = 1<br />
compass_twi_addr = 0x0d<br />
compass_int = port:PI13<6><1><default><default><br />
</pre><br />
<br />
== blue tooth ==<br />
<br />
=== [bt_para] ===<br />
* '''bt_used''': 0 to disable; 1 to enable<br />
* '''bt_uart_id''': UART controller to use<br />
* '''bt_wakeup''': wakeup GPIO configuration<br />
* '''bt_gpio''': optional bluetooth pin GPIO configuration<br />
* '''bt_rst''': = reset GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[Bt_para]<br />
bt_used = 1<br />
bt_uart_id = 2<br />
bt_wakeup = port:PI20<1><default><default><default><br />
bt_gpio = port:PI21<1><default><default><default><br />
bt_rst = port:PB05<1><default><default><default><br />
</pre><br />
<br />
== i2s configuration ==<br />
<br />
=== [i2s_para] ===<br />
* '''i2s_used''': 0 to disable; 1 to enable<br />
* '''i2s_channel''': channel control; 1 for one, 2 for two channels<br />
* '''i2s_mclk''': master clock signal GPIO configuration<br />
* '''i2s_bclk''': bit clock signal GPIO configuration<br />
* '''i2s_lrclk''': word clock (left/right) signal GPIO configuration<br />
* '''i2s_dout0''': digital out 0 GPIO configuration<br />
* '''i2s_dout1''': (optional) digital out 1 GPIO configuration<br />
* '''i2s_dout2''': (optional) digital out 2 GPIO configuration<br />
* '''i2s_dout3''': (optional) digital out 3 GPIO configuration<br />
* '''i2s_din''': multiplexed in signal GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[i2s_para]<br />
i2s_used = 1<br />
i2s_channel = 2<br />
i2s_mclk = port:PB05<2><1><default><default><br />
i2s_bclk = port:PB06<2><1><default><default><br />
i2s_lrclk = port:PB07<2><1><default><default><br />
i2s_dout0 = port:PB08<2><1><default><default><br />
i2s_dout1 =<br />
i2s_dout2 =<br />
i2s_dout3 =<br />
i2s_din = port:PB12<2><1><default><default><br />
</pre><br />
<br />
== spdif configuration ==<br />
<br />
=== [spdif_para] ===<br />
* '''spdif_used''': 0 to disable; 1 to enable<br />
* '''spdif_mclk''': optional master clock GPIO configuration<br />
* '''spdif_dout''': digital out GPIO configuration<br />
* '''spdif_din''': digital in GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[spdif_para]<br />
spdif_used = 1<br />
spdif_mclk =<br />
spdif_dout = port:PB13<4><1><default><default><br />
spdif_din =<br />
</pre><br />
<br />
== audio configuration ==<br />
=== [audio_para] ===<br />
* '''audio_used''': 0 to disable; 1 to enable<br />
* '''audio_pa_ctrl''': External Amp shutdown GPIO configuration<br />
* '''audio_lr_change''': 0 for normal operation; 1 to swap left and right channels<br />
* '''playback_used''': 0 to disable; 1 to enable '''''This is a linux-sunxi specific extention'''''<br />
* '''capture_used''': 0 to dissable; 1 to enable '''''This is a linux-sunxi specific extention'''''<br />
<br />
Some extra settings were introduced with the A31:<br />
* '''audio_mute_ctrl''': External Amp mute GPIO configuration<br />
* '''cap_vol''': ???<br />
* '''headphone_vol''': Internal headphone amp volume (0 ~ 0x3f: 0 .. -62 dB)<br />
* '''headphone_direct_used''': 1 for headphone DC direct drive (no coupling capacitors)<br />
* '''headset_mic_vol''': Headset microphone boost gain (0 ~ 0x7: 0 dB, 24 .. 42 dB)<br />
* '''main_mic_vol''': Main microphone boost gain (0 ~ 0x7: 0 dB, 24 .. 42 dB)<br />
* '''pa_double_used''': 0 for mono differential output; 1 for stereo output<br />
* '''pa_double_vol''': Line out volume for '''''Stereo''''' output mode<br />
* '''pa_single_vol''': Line out volume for '''''Mono differential''''' output mode<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[audio_para]<br />
audio_used = 1<br />
audio_pa_ctrl = port:PH15<1><default><default><0><br />
audio_lr_change = 0<br />
playback_used = 1<br />
capture_used = 1<br />
</pre><br />
<br />
== infrared remote configuration ==<br />
=== [ir_para] ===<br />
* '''ir_used''': 0 to disable; 1 to enable<br />
* '''ir0_rx''': receiver GPIO configuration<br />
* '''ir0_tx''': transmitter GPIO configuration<br />
* '''ir1_rx''': receiver GPIO configuration<br />
* '''ir1_tx''': transmitter GPIO configuration<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
ir_used = 1<br />
ir0_tx = port:PB03<2>default<default><default><br />
ir0_rx = port:PB04<2>default<default><default><br />
<br />
ir1_tx = port:PB22<2>default<default><default><br />
ir1_rx = port:PB23<2>default<default><default><br />
</pre><br />
<br />
== pmu configuration == <br />
=== [pmu_para] ===<br />
* '''pmu_used''': 0 to disable; 1 to enable<br />
* '''pmu_used2''': 0 to disable; 1 to enable secondary PMU<br />
* '''pmu_twi_id''': TWI controller to use<br />
* '''pmu_twi_addr''': TWI address to use<br />
* '''pmu_irq_id''': interrupt to use; 0 = NMI; 1 - 15 = interrupt 1 to 15<br />
* '''pmu_battery_rdc''': battery internal resistance in mΩ<br />
* '''pmu_battery_cap''': battery capacity in mAh<br />
* '''pmu_init_chgcur''': initial charging current in mA; 300, 400 ... 1800<br />
* '''pmu_init_chgcur2''': initial charging current in mA for secondary PMU; 300, 400 ... 1800<br />
* '''pmu_earlysuspend_chgcur2''' early suspend charging current in mA; 300, 400 ... 1800<br />
* '''pmu_suspend_chgcur''': suspended charging current in mA; 300, 400 ... 1800<br />
* '''pmu_suspend_chgcur2''': suspended charging current in mA for secondary PMU; 300, 400 ... 1800<br />
* '''pmu_resume_chgcur''': normal charging current in mA; 300, 400 ... 1800<br />
* '''pmu_resume_chgcur2''': normal charging current in mA for secondary PMU; 300, 400 ... 1800<br />
* '''pmu_shutdown_chgcur''': powered down charge current in mA; 300, 400 ... 1800<br />
* '''pmu_shutdown_chgcur2''': powered down charge current in mA for secondary PMU; 300, 400 ... 1800<br />
* '''pmu_init_chgvol''': initial charging target voltage in mV; 4100/4150/4200/4360<br />
* '''pmu_init_chgend_rate''': initial charging current ratio in %; 10, 15<br />
* '''pmu_init_chg_enabled''': 0 to disable; 1 to enable<br />
* '''pmu_init_adc_freq''': initial ADC sampling rate in Hz; 25/50/100/200<br />
* '''pmu_init_adc_freqc''': initial ADC coulomb meter sampling rate in Hz; 25/50/100/200<br />
* '''pmu_init_chg_pretime''': initial precharge timeout in minutes; 40/50/60/70<br />
* '''pmu_init_chg_csttime''': initial constant charging current timeout in minutes; 360/480/600/720<br />
* '''pmu_bat_para1''': = battery charge LUT in %<br />
* '''pmu_bat_para2''': = battery charge LUT in %<br />
* '''pmu_bat_para3''': = battery charge LUT in %<br />
* '''pmu_bat_para4''': = battery charge LUT in %<br />
* '''pmu_bat_para5''': = battery charge LUT in %<br />
* '''pmu_bat_para6''': = battery charge LUT in %<br />
* '''pmu_bat_para7''': = battery charge LUT in %<br />
* '''pmu_bat_para8''': = battery charge LUT in %<br />
* '''pmu_bat_para9''': = battery charge LUT in %<br />
* '''pmu_bat_para10''': = battery charge LUT in %<br />
* '''pmu_bat_para11''': = battery charge LUT in %<br />
* '''pmu_bat_para12''': = battery charge LUT in %<br />
* '''pmu_bat_para13''': = battery charge LUT in %<br />
* '''pmu_bat_para14''': = battery charge LUT in %<br />
* '''pmu_bat_para15''': = battery charge LUT in %<br />
* '''pmu_bat_para16''': = battery charge LUT in %; should always be 100<br />
* '''pmu_usbvol_limit''': 0 no USB voltage limiter; 1 = limit USB voltage<br />
* '''pmu_usbvol''': USB voltage limit in mV; 4000, 4100 ... 4700<br />
* '''pmu_usbcur_limit''': 0 no USB current limiter; 1 = limit USB current<br />
* '''pmu_usbcur''': USB current limit in mA; 100/500/900<br />
* '''pmu_pwroff_vol''': boot hardware protection voltage in mV; 2600, 2700 ... 3300<br />
* '''pmu_pwron_vol''': running hardware protection voltage in mV; 2600, 2700 ... 3300<br />
* '''pmu_pekoff_time''': Power Enable Key, short power button off delay in ms; 4000, 6000, 8000, 10000<br />
* '''pmu_pekoff_en''': 0 to disable; 1 to enable power button power off<br />
* '''pmu_peklong_time''': long power off button delay in ms; 1000, 1500, 2000, 2500<br />
* '''pmu_pekon_time''': power on button delay in ms; 128, 1000, 2000, 3000<br />
* '''pmu_pwrok_time''': power 'ok' delay in ms; 8, 64<br />
* '''pmu_pwrnoe_time''': n_oe from low to high shutdown delay time in ms; 128, 1000, 2000, 3000<br />
* '''pmu_intotp_en''': 0 to disable; 1 to enable over temperature protection<br />
* '''pmu_suspendpwroff_vol''': shutdown voltage when suspended and battery is low<br />
* '''pmu_batdeten''': Battery detection enabled<br />
* '''pmu_adpdet''': adapter detect GPIO configuration<br />
* '''pmu_backupen''': 1 to enable RTC/backup battery charging<br />
<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[pmu_para]<br />
pmu_used = 1<br />
pmu_twi_addr = 0x34<br />
pmu_twi_id = 0<br />
pmu_irq_id = 0<br />
pmu_battery_rdc = 200<br />
pmu_battery_cap = 2600<br />
pmu_init_chgcur = 300<br />
pmu_suspend_chgcur = 1000<br />
pmu_resume_chgcur = 300<br />
pmu_shutdown_chgcur = 1000<br />
pmu_init_chgvol = 4200<br />
pmu_init_chgend_rate = 15<br />
pmu_init_chg_enabled = 1<br />
pmu_init_adc_freq = 100<br />
pmu_init_adc_freqc = 100<br />
pmu_init_chg_pretime = 50<br />
pmu_init_chg_csttime = 720<br />
pmu_bat_para1 = 0<br />
pmu_bat_para2 = 0<br />
pmu_bat_para3 = 1<br />
pmu_bat_para4 = 5<br />
pmu_bat_para5 = 7<br />
pmu_bat_para6 = 13<br />
pmu_bat_para7 = 16<br />
pmu_bat_para8 = 26<br />
pmu_bat_para9 = 36<br />
pmu_bat_para10 = 46<br />
pmu_bat_para11 = 53<br />
pmu_bat_para12 = 61<br />
pmu_bat_para13 = 73<br />
pmu_bat_para14 = 84<br />
pmu_bat_para15 = 92<br />
pmu_bat_para16 = 100<br />
pmu_usbvol_limit = 1<br />
pmu_usbvol = 4400<br />
pmu_usbcur_limit = 1<br />
pmu_usbcur = 900<br />
pmu_pwroff_vol = 3300<br />
pmu_pwron_vol = 2900<br />
pmu_pekoff_time = 6000<br />
pmu_pekoff_en = 1<br />
pmu_peklong_time = 1500<br />
pmu_pekon_time = 1000<br />
pmu_pwrok_time = 64<br />
pmu_pwrnoe_time = 2000<br />
pmu_intotp_en = 1<br />
pmu_adpdet = port:PH02<0><default><default><default><br />
pmu_batdeten = 1<br />
pmu_suspendpwroff_vol = 3500<br />
<br />
pmu_used2 = 0<br />
pmu_init_chgcur2 = 400<br />
pmu_suspend_chgcur2 = 1200<br />
pmu_resume_chgcur2 = 400<br />
pmu_shutdown_chgcur2 = 1200<br />
</pre><br />
<br />
== recovery key configuration ==<br />
=== [recovery_key] ===<br />
* '''key_min''': minimal length for the key to be depressed in seconds<br />
* '''key_max''': maximal length for the key to be depressed in seconds<br />
<br />
Example configuration:<br />
<pre class="brush: ini"><br />
key_min = 4<br />
key_max = 32<br />
</pre><br />
<br />
== dvfs voltage-frequency table configuration ==<br />
Define at which frequency what voltage should be set. Recommended defaults:<br />
{| class="wikitable"<br />
! voltage<br />
! frequency range<br />
|-<br />
|1.50 v<br />
|1008 MHz - 1056 MHz<br />
|-<br />
|1.40 v<br />
|912 MHz - 1008 MHz<br />
|-<br />
|1.35 v<br />
|864 MHz - 912 MHz<br />
|-<br />
|1.30 v<br />
|624 MHz - 864 MHz<br />
|-<br />
|1.25 v<br />
|60 MHz - 624 MHz<br />
|}<br />
=== [dvfs_table] ===<br />
* '''max_freq''': cpu maximum frequency in Hz; can not be more than 1008 MHz<br />
* '''min_freq''': cpu minimum frequency in Hz; can not be less than 60 MHz<br />
* '''lv_count''': number of lv_freq/lv_volt pairs; must be < 16<br />
* '''lv1_freq''': state 1 frequency<br />
* '''lv1_volt''': state 1 voltage<br />
<br />
<pre class="brush: ini"><br />
[dvfs_table]<br />
max_freq = 1008000000<br />
min_freq = 60000000<br />
lv_count = 5<br />
<br />
lv1_freq = 1056000000<br />
lv1_volt = 1500<br />
<br />
lv2_freq = 1008000000<br />
lv2_volt = 1400<br />
<br />
lv3_freq = 912000000<br />
lv3_volt = 1350<br />
<br />
lv4_freq = 864000000<br />
lv4_volt = 1300<br />
<br />
lv5_freq = 624000000<br />
lv5_volt = 1250<br />
</pre><br />
<br />
== led configuration ==<br />
LEDs are accessible via sys-fs; for example on the cubietruck you can find the following directory:<br />
/sys/class/leds/blue\:ph21\:led1<br />
`cat` the file trigger to see the triggers that can be set in .fex files. Currently these are<br />
* none (kinda defeats the purpose of setting a trigger)<br />
* rfkill0<br />
* battery-charging-or-full<br />
* battery-charging<br />
* battery-full<br />
* battery-charging-blink-full-solid<br />
* ac-online<br />
* usb-online<br />
* mmc0<br />
* mmc1<br />
* timer<br />
* heartbeat<br />
* cpu0<br />
* cpu1<br />
* default-on<br />
* rfkill1<br />
* rfkill2<br />
<br />
How much they make sense - experiment. I'd be especially curious about the effects of rfkill settings. <br />
<br />
Please note that depending on the trigger in question the sysfs will be populated with even more pseudo files. When you choose timer for example then you get a constant blinking led and two more files: delay_on and delay_off with which you can specify how many milliseconds will the LED stay in on/off state. Very convenient to indicate eg. disk usage or average load with higher blinking frequency and stuff like that.<br />
<br />
=== [leds_para] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[leds_para]<br />
leds_used = 1<br />
leds_num = 3<br />
leds_pin_1 = port:PH20<1><default><default><0><br />
leds_name_1 = "ph20:green:led1"<br />
leds_trigger_1 = "heartbeat"<br />
leds_pin_2 = port:PH21<1><default><default><0><br />
leds_name_2 = "ph21:blue:led2"<br />
leds_trigger_2 = "cpu0"<br />
leds_pin_3 = port:PI12<1><default><default><0><br />
leds_name_3 = "red:pi12:led3"<br />
leds_trigger_3 = "cpu1"<br />
</pre><br />
<br />
=== external leds ===<br />
<br />
External LEDs that are connected to one of the GPIO pins (don't forget to add a resistor!) can also be defined in the fex file and used like internal ones afterwards. You have to check which GPIO pin is connected to which SoC pin and use this in the definition. As an example a 3rd led on a Banana Pro connected to GPIO pin 19 (PI12) in the config above. This will lead to a sysfs entry /sys/class/leds/red:pi12:led3 where everything works just like with internal leds.<br />
<br />
== dynamic configuration ==<br />
=== [dynamic] ===<br />
Configuration example:<br />
<pre class="brush: ini"><br />
[dynamic]<br />
MAC = "000000000000"<br />
</pre><br />
<br />
[[Category:Software]]</div>
Faruk
https://linux-sunxi.org/index.php?title=USB_Gadget/Mass_storage&diff=24108
USB Gadget/Mass storage
2021-04-15T11:11:43Z
<p>Faruk: /* Kernel support */ The parts that could be wrong were deleted.</p>
<hr />
<div>= USB storage support =<br />
<br />
This allows your devices act as a USB mass storage like external hard drive or thumb drive.<br />
<br />
== Kernel support ==<br />
<br />
Currently, the g_mass_storage module is not compiled as part of default kernel configuration.<br />
<br />
To enable this, follow same kernel building information as previous section [[USB_Gadget#Kernel_support|USB Ethernet support]] but instead of compiling "Ethernet Gadget", select the following to "m":<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
USB Gadget Support ---><br />
<M> Mass Storage Gadget<br />
</pre><br />
<br />
Please set '''dr_mode = "otg"''' in .dts file and check USB mode in kernel.<br />
<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
Inventra Highspeed Dual Role Controller ---><br />
MUSB Mode Selection ---><br />
<X> Dual Role Mode<br />
</pre><br />
<br />
You can now continue following [[Manual_build_howto|manual build howto]] to continue kernel compilation and installation.<br />
<br />
== Preparing shared storage device ==<br />
<br />
See "[http://www.linux-usb.org/gadget/file_storage.html Backing Storage for the Mass Storage Gadget]" for full instructions and recommendations.<br />
<br />
Be aware that shared storage cannot be used in "read write" mode if both systems (device and host) are using it at same time except if you accept to corrupt your data...<br />
<br />
An existing physical partition or a logical volume can be used as shared storage device; another option is to use a flat file as shared storage.<br />
<br />
[https://www.digi.com/resources/documentation/digidocs/embedded/dey/2.6/cc6/bsp_r_usb-device#mass-storage-gadget Here] you can find useful some information.<br />
<br />
=== Creating a sparse file ===<br />
<br />
Use "dd" command's "count" and "seek" options to create a 1GB file that will not use storage until it is used:<br />
<br />
<pre><br />
# dd if=/dev/zero of=/mass_storage bs=1M seek=1024 count=0<br />
# ls -l /mass_storage <br />
-rw-r--r-- 1 root root 1073741824 Feb 15 16:40 /mass_storage<br />
# du -hs /mass_storage <br />
0 /mass_storage<br />
</pre><br />
<br />
=== Partitioning and formatting sparse file ===<br />
<br />
To be recognized by most Operating Systems, create a single FAT type partition and format it as DOS filesystem using Linux loop device driver.<br />
<br />
==== Create a single partition ====<br />
<br />
<pre><br />
# cat <<EOT | sfdisk -L -uS /mass_storage <br />
,,c<br />
EOT<br />
</pre><br />
<br />
==== Find partition offset ====<br />
<br />
<pre><br />
# fdisk -lu /mass_storage <br />
<br />
Disk /mass_storage: 1073 MB, 1073741824 bytes<br />
139 heads, 8 sectors/track, 1885 cylinders, total 2097152 sectors<br />
Units = sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0x00000000<br />
<br />
Device Boot Start End Blocks Id System<br />
/mass_storage1 1 2097151 1048575+ c W95 FAT32 (LBA)<br />
</pre><br />
<br />
First partition starts at first sector: offset = 1 * 512 = 512 bytes<br />
<br />
==== Set up loop device ====<br />
<br />
<pre><br />
# losetup -o512 /dev/loop0 /mass_storage<br />
# losetup -a<br />
/dev/loop0: [b302]:14867 (/mass_storage), offset 512<br />
</pre><br />
<br />
==== Format device ====<br />
<br />
<pre><br />
# apt-get install dosfstools<br />
# mkdosfs /dev/loop0<br />
</pre><br />
<br />
<br />
==== Test device ====<br />
<br />
<pre><br />
# mount -t vfat /dev/loop0 /mnt/<br />
# df -h /mnt<br />
Filesystem Size Used Avail Use% Mounted on<br />
/dev/loop0 1022M 4.0K 1022M 1% /mnt<br />
# mount | grep mnt<br />
/dev/loop0 on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)<br />
</pre><br />
<br />
==== Release device ====<br />
<br />
<pre><br />
# umount /mnt/<br />
# losetup -d /dev/loop0 <br />
# losetup -a<br />
</pre><br />
<br />
As we can see below, 1GB sparse file is only using 2.1MB storage (size of filesystem metadata):<br />
<br />
<pre><br />
# du -sh /mass_storage <br />
2.1M /mass_storage<br />
# ls -lh /mass_storage <br />
-rw-r--r-- 1 root root 1.0G Feb 15 16:54 /mass_storage<br />
</pre><br />
<br />
== Exporting mass storage / Loading the driver (on the device) ==<br />
<br />
It looks like g_mass_storage conflicts with g_ether, remove g_ether first (if previously loaded):<br />
<br />
<pre><br />
# modprobe -r g_ether<br />
</pre><br />
<br />
Load g_mass_storage specifying storage to share (can also be a physical partition or a logical volume):<br />
<br />
<pre><br />
# modprobe g_mass_storage file=/mass_storage<br />
</pre><br />
<br />
We can now plug device to another host and use it as USB connected storage.<br />
<br />
Notes: Surprisingly it works well my Mac OS hosts (device automatically appears in Finder, I can copy and read files) but not with my Linux hosts (device appears and disappears constantly and cannot be mounted). Not tested with Windows hosts.<br />
<br />
== Emulating a USB CD-ROM ==<br />
<br />
The ''g_mass_storage'' module can also present an optical drive to the USB host. For this, your backing storage should be a suitable filesystem image - usually an .ISO file. Pass a "cdrom" module option like this: <br />
<br />
<pre><br />
# modprobe g_mass_storage file=/path/to/your-image-file.iso cdrom=y<br />
</pre><br />
<br />
(This can be useful with old PCs where the BIOS may have trouble starting from USB sticks, but supports booting via USB-CDROM.)<br />
<br />
{{note|As of Linux v4.7-rc2, the ''g_mass_storage'' driver can only emulate CD-ROM drives, not DVD-ROMs.}}<br />
:That means some restrictions, especially a hardcoded limit on the size of a backing (.iso) file. In case the file size exceeds 1152000 2KiB blocks (approx. 2.36GB / 2.2GiB), the driver will complain "''file too big''" and limit the usable range (sector count). If the filesystem driver on the USB host requests any sector beyond that, it will encounter I/O errors ("''attempt to access beyond end of device''").<br />
<br />
:In order to use larger images and properly emulate DVD media, the ''g_mass_storage'' would have to be extended. Some ideas and patches for that have been around for a while, e.g. https://lkml.org/lkml/2015/3/7/388 and http://linuxehacking.blogspot.de/2013/07/how-to-emulatore-dvd-rom-hardware-usb.html.<br />
<br />
[[Category:USB OTG]]<br />
[[Category:Tutorial]]</div>
Faruk
https://linux-sunxi.org/index.php?title=USB_Gadget/Mass_storage&diff=24107
USB Gadget/Mass storage
2021-04-15T07:04:27Z
<p>Faruk: /* Preparing shared storage device */ Added information link</p>
<hr />
<div>= USB storage support =<br />
<br />
This allows your devices act as a USB mass storage like external hard drive or thumb drive.<br />
<br />
== Kernel support ==<br />
<br />
Currently, the g_mass_storage module is not compiled as part of default kernel configuration.<br />
<br />
To enable this, follow same kernel building information as previous section [[USB_Gadget#Kernel_support|USB Ethernet support]] but instead of compiling "Ethernet Gadget", select the following to "m":<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
USB Gadget Support ---><br />
<M> Mass Storage Gadget<br />
</pre><br />
<br />
Please set '''dr_mode = "otg"''' in .dts file and check USB mode in kernel. If usb mode is host, the device acts as both host and device and you cannot see the device connected to your computer. In this case, the device is not connected to the computer but to linux where the file `file = /mass_storage` was created. <br />
<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
Inventra Highspeed Dual Role Controller ---><br />
MUSB Mode Selection ---><br />
<X> Dual Role Mode<br />
</pre><br />
<br />
You can now continue following [[Manual_build_howto|manual build howto]] to continue kernel compilation and installation.<br />
<br />
<br />
== Preparing shared storage device ==<br />
<br />
See "[http://www.linux-usb.org/gadget/file_storage.html Backing Storage for the Mass Storage Gadget]" for full instructions and recommendations.<br />
<br />
Be aware that shared storage cannot be used in "read write" mode if both systems (device and host) are using it at same time except if you accept to corrupt your data...<br />
<br />
An existing physical partition or a logical volume can be used as shared storage device; another option is to use a flat file as shared storage.<br />
<br />
[https://www.digi.com/resources/documentation/digidocs/embedded/dey/2.6/cc6/bsp_r_usb-device#mass-storage-gadget Here] you can find useful some information.<br />
<br />
=== Creating a sparse file ===<br />
<br />
Use "dd" command's "count" and "seek" options to create a 1GB file that will not use storage until it is used:<br />
<br />
<pre><br />
# dd if=/dev/zero of=/mass_storage bs=1M seek=1024 count=0<br />
# ls -l /mass_storage <br />
-rw-r--r-- 1 root root 1073741824 Feb 15 16:40 /mass_storage<br />
# du -hs /mass_storage <br />
0 /mass_storage<br />
</pre><br />
<br />
=== Partitioning and formatting sparse file ===<br />
<br />
To be recognized by most Operating Systems, create a single FAT type partition and format it as DOS filesystem using Linux loop device driver.<br />
<br />
==== Create a single partition ====<br />
<br />
<pre><br />
# cat <<EOT | sfdisk -L -uS /mass_storage <br />
,,c<br />
EOT<br />
</pre><br />
<br />
==== Find partition offset ====<br />
<br />
<pre><br />
# fdisk -lu /mass_storage <br />
<br />
Disk /mass_storage: 1073 MB, 1073741824 bytes<br />
139 heads, 8 sectors/track, 1885 cylinders, total 2097152 sectors<br />
Units = sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0x00000000<br />
<br />
Device Boot Start End Blocks Id System<br />
/mass_storage1 1 2097151 1048575+ c W95 FAT32 (LBA)<br />
</pre><br />
<br />
First partition starts at first sector: offset = 1 * 512 = 512 bytes<br />
<br />
==== Set up loop device ====<br />
<br />
<pre><br />
# losetup -o512 /dev/loop0 /mass_storage<br />
# losetup -a<br />
/dev/loop0: [b302]:14867 (/mass_storage), offset 512<br />
</pre><br />
<br />
==== Format device ====<br />
<br />
<pre><br />
# apt-get install dosfstools<br />
# mkdosfs /dev/loop0<br />
</pre><br />
<br />
<br />
==== Test device ====<br />
<br />
<pre><br />
# mount -t vfat /dev/loop0 /mnt/<br />
# df -h /mnt<br />
Filesystem Size Used Avail Use% Mounted on<br />
/dev/loop0 1022M 4.0K 1022M 1% /mnt<br />
# mount | grep mnt<br />
/dev/loop0 on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)<br />
</pre><br />
<br />
==== Release device ====<br />
<br />
<pre><br />
# umount /mnt/<br />
# losetup -d /dev/loop0 <br />
# losetup -a<br />
</pre><br />
<br />
As we can see below, 1GB sparse file is only using 2.1MB storage (size of filesystem metadata):<br />
<br />
<pre><br />
# du -sh /mass_storage <br />
2.1M /mass_storage<br />
# ls -lh /mass_storage <br />
-rw-r--r-- 1 root root 1.0G Feb 15 16:54 /mass_storage<br />
</pre><br />
<br />
== Exporting mass storage / Loading the driver (on the device) ==<br />
<br />
It looks like g_mass_storage conflicts with g_ether, remove g_ether first (if previously loaded):<br />
<br />
<pre><br />
# modprobe -r g_ether<br />
</pre><br />
<br />
Load g_mass_storage specifying storage to share (can also be a physical partition or a logical volume):<br />
<br />
<pre><br />
# modprobe g_mass_storage file=/mass_storage<br />
</pre><br />
<br />
We can now plug device to another host and use it as USB connected storage.<br />
<br />
Notes: Surprisingly it works well my Mac OS hosts (device automatically appears in Finder, I can copy and read files) but not with my Linux hosts (device appears and disappears constantly and cannot be mounted). Not tested with Windows hosts.<br />
<br />
== Emulating a USB CD-ROM ==<br />
<br />
The ''g_mass_storage'' module can also present an optical drive to the USB host. For this, your backing storage should be a suitable filesystem image - usually an .ISO file. Pass a "cdrom" module option like this: <br />
<br />
<pre><br />
# modprobe g_mass_storage file=/path/to/your-image-file.iso cdrom=y<br />
</pre><br />
<br />
(This can be useful with old PCs where the BIOS may have trouble starting from USB sticks, but supports booting via USB-CDROM.)<br />
<br />
{{note|As of Linux v4.7-rc2, the ''g_mass_storage'' driver can only emulate CD-ROM drives, not DVD-ROMs.}}<br />
:That means some restrictions, especially a hardcoded limit on the size of a backing (.iso) file. In case the file size exceeds 1152000 2KiB blocks (approx. 2.36GB / 2.2GiB), the driver will complain "''file too big''" and limit the usable range (sector count). If the filesystem driver on the USB host requests any sector beyond that, it will encounter I/O errors ("''attempt to access beyond end of device''").<br />
<br />
:In order to use larger images and properly emulate DVD media, the ''g_mass_storage'' would have to be extended. Some ideas and patches for that have been around for a while, e.g. https://lkml.org/lkml/2015/3/7/388 and http://linuxehacking.blogspot.de/2013/07/how-to-emulatore-dvd-rom-hardware-usb.html.<br />
<br />
[[Category:USB OTG]]<br />
[[Category:Tutorial]]</div>
Faruk
https://linux-sunxi.org/index.php?title=USB_Gadget/Mass_storage&diff=24106
USB Gadget/Mass storage
2021-04-15T06:52:20Z
<p>Faruk: sf disk does not support --in-order and -uM</p>
<hr />
<div>= USB storage support =<br />
<br />
This allows your devices act as a USB mass storage like external hard drive or thumb drive.<br />
<br />
== Kernel support ==<br />
<br />
Currently, the g_mass_storage module is not compiled as part of default kernel configuration.<br />
<br />
To enable this, follow same kernel building information as previous section [[USB_Gadget#Kernel_support|USB Ethernet support]] but instead of compiling "Ethernet Gadget", select the following to "m":<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
USB Gadget Support ---><br />
<M> Mass Storage Gadget<br />
</pre><br />
<br />
Please set '''dr_mode = "otg"''' in .dts file and check USB mode in kernel. If usb mode is host, the device acts as both host and device and you cannot see the device connected to your computer. In this case, the device is not connected to the computer but to linux where the file `file = /mass_storage` was created. <br />
<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
Inventra Highspeed Dual Role Controller ---><br />
MUSB Mode Selection ---><br />
<X> Dual Role Mode<br />
</pre><br />
<br />
You can now continue following [[Manual_build_howto|manual build howto]] to continue kernel compilation and installation.<br />
<br />
<br />
== Preparing shared storage device ==<br />
<br />
See "[http://www.linux-usb.org/gadget/file_storage.html Backing Storage for the Mass Storage Gadget]" for full instructions and recommendations.<br />
<br />
Be aware that shared storage cannot be used in "read write" mode if both systems (device and host) are using it at same time except if you accept to corrupt your data...<br />
<br />
An existing physical partition or a logical volume can be used as shared storage device; another option is to use a flat file as shared storage.<br />
<br />
=== Creating a sparse file ===<br />
<br />
Use "dd" command's "count" and "seek" options to create a 1GB file that will not use storage until it is used:<br />
<br />
<pre><br />
# dd if=/dev/zero of=/mass_storage bs=1M seek=1024 count=0<br />
# ls -l /mass_storage <br />
-rw-r--r-- 1 root root 1073741824 Feb 15 16:40 /mass_storage<br />
# du -hs /mass_storage <br />
0 /mass_storage<br />
</pre><br />
<br />
=== Partitioning and formatting sparse file ===<br />
<br />
To be recognized by most Operating Systems, create a single FAT type partition and format it as DOS filesystem using Linux loop device driver.<br />
<br />
==== Create a single partition ====<br />
<br />
<pre><br />
# cat <<EOT | sfdisk -L -uS /mass_storage <br />
,,c<br />
EOT<br />
</pre><br />
<br />
==== Find partition offset ====<br />
<br />
<pre><br />
# fdisk -lu /mass_storage <br />
<br />
Disk /mass_storage: 1073 MB, 1073741824 bytes<br />
139 heads, 8 sectors/track, 1885 cylinders, total 2097152 sectors<br />
Units = sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0x00000000<br />
<br />
Device Boot Start End Blocks Id System<br />
/mass_storage1 1 2097151 1048575+ c W95 FAT32 (LBA)<br />
</pre><br />
<br />
First partition starts at first sector: offset = 1 * 512 = 512 bytes<br />
<br />
==== Set up loop device ====<br />
<br />
<pre><br />
# losetup -o512 /dev/loop0 /mass_storage<br />
# losetup -a<br />
/dev/loop0: [b302]:14867 (/mass_storage), offset 512<br />
</pre><br />
<br />
==== Format device ====<br />
<br />
<pre><br />
# apt-get install dosfstools<br />
# mkdosfs /dev/loop0<br />
</pre><br />
<br />
<br />
==== Test device ====<br />
<br />
<pre><br />
# mount -t vfat /dev/loop0 /mnt/<br />
# df -h /mnt<br />
Filesystem Size Used Avail Use% Mounted on<br />
/dev/loop0 1022M 4.0K 1022M 1% /mnt<br />
# mount | grep mnt<br />
/dev/loop0 on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)<br />
</pre><br />
<br />
==== Release device ====<br />
<br />
<pre><br />
# umount /mnt/<br />
# losetup -d /dev/loop0 <br />
# losetup -a<br />
</pre><br />
<br />
As we can see below, 1GB sparse file is only using 2.1MB storage (size of filesystem metadata):<br />
<br />
<pre><br />
# du -sh /mass_storage <br />
2.1M /mass_storage<br />
# ls -lh /mass_storage <br />
-rw-r--r-- 1 root root 1.0G Feb 15 16:54 /mass_storage<br />
</pre><br />
<br />
<br />
== Exporting mass storage / Loading the driver (on the device) ==<br />
<br />
It looks like g_mass_storage conflicts with g_ether, remove g_ether first (if previously loaded):<br />
<br />
<pre><br />
# modprobe -r g_ether<br />
</pre><br />
<br />
Load g_mass_storage specifying storage to share (can also be a physical partition or a logical volume):<br />
<br />
<pre><br />
# modprobe g_mass_storage file=/mass_storage<br />
</pre><br />
<br />
We can now plug device to another host and use it as USB connected storage.<br />
<br />
Notes: Surprisingly it works well my Mac OS hosts (device automatically appears in Finder, I can copy and read files) but not with my Linux hosts (device appears and disappears constantly and cannot be mounted). Not tested with Windows hosts.<br />
<br />
== Emulating a USB CD-ROM ==<br />
<br />
The ''g_mass_storage'' module can also present an optical drive to the USB host. For this, your backing storage should be a suitable filesystem image - usually an .ISO file. Pass a "cdrom" module option like this: <br />
<br />
<pre><br />
# modprobe g_mass_storage file=/path/to/your-image-file.iso cdrom=y<br />
</pre><br />
<br />
(This can be useful with old PCs where the BIOS may have trouble starting from USB sticks, but supports booting via USB-CDROM.)<br />
<br />
{{note|As of Linux v4.7-rc2, the ''g_mass_storage'' driver can only emulate CD-ROM drives, not DVD-ROMs.}}<br />
:That means some restrictions, especially a hardcoded limit on the size of a backing (.iso) file. In case the file size exceeds 1152000 2KiB blocks (approx. 2.36GB / 2.2GiB), the driver will complain "''file too big''" and limit the usable range (sector count). If the filesystem driver on the USB host requests any sector beyond that, it will encounter I/O errors ("''attempt to access beyond end of device''").<br />
<br />
:In order to use larger images and properly emulate DVD media, the ''g_mass_storage'' would have to be extended. Some ideas and patches for that have been around for a while, e.g. https://lkml.org/lkml/2015/3/7/388 and http://linuxehacking.blogspot.de/2013/07/how-to-emulatore-dvd-rom-hardware-usb.html.<br />
<br />
[[Category:USB OTG]]<br />
[[Category:Tutorial]]</div>
Faruk
https://linux-sunxi.org/index.php?title=USB_Gadget/Mass_storage&diff=24105
USB Gadget/Mass storage
2021-04-15T06:49:01Z
<p>Faruk: Important points have been added in kernel and .dts file.</p>
<hr />
<div>= USB storage support =<br />
<br />
This allows your devices act as a USB mass storage like external hard drive or thumb drive.<br />
<br />
== Kernel support ==<br />
<br />
Currently, the g_mass_storage module is not compiled as part of default kernel configuration.<br />
<br />
To enable this, follow same kernel building information as previous section [[USB_Gadget#Kernel_support|USB Ethernet support]] but instead of compiling "Ethernet Gadget", select the following to "m":<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
USB Gadget Support ---><br />
<M> Mass Storage Gadget<br />
</pre><br />
<br />
Please set '''dr_mode = "otg"''' in .dts file and check USB mode in kernel. If usb mode is host, the device acts as both host and device and you cannot see the device connected to your computer. In this case, the device is not connected to the computer but to linux where the file `file = /mass_storage` was created. <br />
<br />
<pre><br />
Device Drivers ---><br />
USB support ---><br />
Inventra Highspeed Dual Role Controller ---><br />
MUSB Mode Selection ---><br />
<X> Dual Role Mode<br />
</pre><br />
<br />
You can now continue following [[Manual_build_howto|manual build howto]] to continue kernel compilation and installation.<br />
<br />
<br />
== Preparing shared storage device ==<br />
<br />
See "[http://www.linux-usb.org/gadget/file_storage.html Backing Storage for the Mass Storage Gadget]" for full instructions and recommendations.<br />
<br />
Be aware that shared storage cannot be used in "read write" mode if both systems (device and host) are using it at same time except if you accept to corrupt your data...<br />
<br />
An existing physical partition or a logical volume can be used as shared storage device; another option is to use a flat file as shared storage.<br />
<br />
=== Creating a sparse file ===<br />
<br />
Use "dd" command's "count" and "seek" options to create a 1GB file that will not use storage until it is used:<br />
<br />
<pre><br />
# dd if=/dev/zero of=/mass_storage bs=1M seek=1024 count=0<br />
# ls -l /mass_storage <br />
-rw-r--r-- 1 root root 1073741824 Feb 15 16:40 /mass_storage<br />
# du -hs /mass_storage <br />
0 /mass_storage<br />
</pre><br />
<br />
=== Partitioning and formatting sparse file ===<br />
<br />
To be recognized by most Operating Systems, create a single FAT type partition and format it as DOS filesystem using Linux loop device driver.<br />
<br />
==== Create a single partition ====<br />
<br />
<pre><br />
# cat <<EOT | sfdisk --in-order -L -uM /mass_storage <br />
,,c<br />
EOT<br />
</pre><br />
<br />
==== Find partition offset ====<br />
<br />
<pre><br />
# fdisk -lu /mass_storage <br />
<br />
Disk /mass_storage: 1073 MB, 1073741824 bytes<br />
139 heads, 8 sectors/track, 1885 cylinders, total 2097152 sectors<br />
Units = sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0x00000000<br />
<br />
Device Boot Start End Blocks Id System<br />
/mass_storage1 1 2097151 1048575+ c W95 FAT32 (LBA)<br />
</pre><br />
<br />
First partition starts at first sector: offset = 1 * 512 = 512 bytes<br />
<br />
==== Set up loop device ====<br />
<br />
<pre><br />
# losetup -o512 /dev/loop0 /mass_storage<br />
# losetup -a<br />
/dev/loop0: [b302]:14867 (/mass_storage), offset 512<br />
</pre><br />
<br />
==== Format device ====<br />
<br />
<pre><br />
# apt-get install dosfstools<br />
# mkdosfs /dev/loop0<br />
</pre><br />
<br />
<br />
==== Test device ====<br />
<br />
<pre><br />
# mount -t vfat /dev/loop0 /mnt/<br />
# df -h /mnt<br />
Filesystem Size Used Avail Use% Mounted on<br />
/dev/loop0 1022M 4.0K 1022M 1% /mnt<br />
# mount | grep mnt<br />
/dev/loop0 on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)<br />
</pre><br />
<br />
==== Release device ====<br />
<br />
<pre><br />
# umount /mnt/<br />
# losetup -d /dev/loop0 <br />
# losetup -a<br />
</pre><br />
<br />
As we can see below, 1GB sparse file is only using 2.1MB storage (size of filesystem metadata):<br />
<br />
<pre><br />
# du -sh /mass_storage <br />
2.1M /mass_storage<br />
# ls -lh /mass_storage <br />
-rw-r--r-- 1 root root 1.0G Feb 15 16:54 /mass_storage<br />
</pre><br />
<br />
<br />
== Exporting mass storage / Loading the driver (on the device) ==<br />
<br />
It looks like g_mass_storage conflicts with g_ether, remove g_ether first (if previously loaded):<br />
<br />
<pre><br />
# modprobe -r g_ether<br />
</pre><br />
<br />
Load g_mass_storage specifying storage to share (can also be a physical partition or a logical volume):<br />
<br />
<pre><br />
# modprobe g_mass_storage file=/mass_storage<br />
</pre><br />
<br />
We can now plug device to another host and use it as USB connected storage.<br />
<br />
Notes: Surprisingly it works well my Mac OS hosts (device automatically appears in Finder, I can copy and read files) but not with my Linux hosts (device appears and disappears constantly and cannot be mounted). Not tested with Windows hosts.<br />
<br />
== Emulating a USB CD-ROM ==<br />
<br />
The ''g_mass_storage'' module can also present an optical drive to the USB host. For this, your backing storage should be a suitable filesystem image - usually an .ISO file. Pass a "cdrom" module option like this: <br />
<br />
<pre><br />
# modprobe g_mass_storage file=/path/to/your-image-file.iso cdrom=y<br />
</pre><br />
<br />
(This can be useful with old PCs where the BIOS may have trouble starting from USB sticks, but supports booting via USB-CDROM.)<br />
<br />
{{note|As of Linux v4.7-rc2, the ''g_mass_storage'' driver can only emulate CD-ROM drives, not DVD-ROMs.}}<br />
:That means some restrictions, especially a hardcoded limit on the size of a backing (.iso) file. In case the file size exceeds 1152000 2KiB blocks (approx. 2.36GB / 2.2GiB), the driver will complain "''file too big''" and limit the usable range (sector count). If the filesystem driver on the USB host requests any sector beyond that, it will encounter I/O errors ("''attempt to access beyond end of device''").<br />
<br />
:In order to use larger images and properly emulate DVD media, the ''g_mass_storage'' would have to be extended. Some ideas and patches for that have been around for a while, e.g. https://lkml.org/lkml/2015/3/7/388 and http://linuxehacking.blogspot.de/2013/07/how-to-emulatore-dvd-rom-hardware-usb.html.<br />
<br />
[[Category:USB OTG]]<br />
[[Category:Tutorial]]</div>
Faruk
https://linux-sunxi.org/index.php?title=CSI&diff=23774
CSI
2020-11-30T12:37:22Z
<p>Faruk: Explained how to enable in buildroot the required packages for media-ctl and v4l2-ctl command to be used.</p>
<hr />
<div>= CSI on mainline Linux with v4l2 =<br />
<br />
The CSI (CMOS Sensor Interface) hardware block is partially supported in mainline Linux.<br />
Support for the hardware block found on [[A31]] and later generations is already upstream,<br />
while the one found on [[A10]]/[[A20]] is being worked on, as of 2019/04/12.<br />
<br />
Currently parallel and BT.656 (embedded sync) interfaces are supported. MIPI CSI-2 is not.<br />
<br />
The mainline driver uses v4l2 with the sub-device API and media controller API.<br />
<br />
== Kernel config options ==<br />
To enable the driver, please first check if you have the '''VIDEO_DEV''', '''MEDIA_CONTROLLER''' and<br />
'''VIDEO_V4L2_SUBDEV_API''' Kconfig options enabled.<br />
<br />
Then once you enable '''V4L_PLATFORM_DRIVERS''' you should be able to enable '''VIDEO_SUN6I_CSI''' for the A31 CSI driver.<br />
For the A10/A20 CSI driver, enable '''VIDEO_SUN4I_CSI'''. (Provided you have the patches applied.)<br />
<br />
== Userspace configuration ==<br />
It is recommended to use an up-to-date version of v4l-utils, as older versions, such as the one in Debian Stable (1.12.x)<br />
has some bugs, and doesn't understand all formats or knobs.<br />
<br />
The usage of the media controller and sub-device API means configuration of the capture options<br />
is slightly complicated. The '''media-ctl''' and '''v4l2-ctl''' are used.<br />
<br />
If you are using buildroot, enable '''BR2_PACKAGE_LIBV4L''' and '''BR2_PACKAGE_LIBV4L_UTILS''' in the make menuconfig to be able to use '''media-ctl''' and '''v4l2-ctl'''. media-ctl source and development have been moved to v4l-utils since June 2014.<br />
<br />
=== Media bus and capture formats ===<br />
To see the current settings of the media bus, use<br />
<br />
<nowiki><br />
$ media-ctl --print-topology<br />
<br />
Media controller API version 5.1.0<br />
<br />
Media device information<br />
------------------------<br />
driver sun6i-csi<br />
model Allwinner Video Capture Device<br />
serial<br />
bus info<br />
hw revision 0x0<br />
driver version 5.1.0<br />
<br />
Device topology<br />
- entity 1: sun6i-csi (1 pad, 1 link)<br />
type Node subtype V4L flags 0<br />
device node name /dev/video0<br />
pad0: Sink<br />
<- "ov5640 1-003c":0 [ENABLED,IMMUTABLE]<br />
<br />
- entity 5: ov5640 1-003c (1 pad, 1 link)<br />
type V4L2 subdev subtype Sensor flags 0<br />
device node name /dev/v4l-subdev0<br />
pad0: Source<br />
[fmt:UYVY8_2X8/640x480 field:none]<br />
-> "sun6i-csi":0 [ENABLED,IMMUTABLE]<br />
</nowiki><br />
<br />
On systems with the Cedrus driver enabled, the media device may not be the default one, in which case you should use<br />
<br />
$ media-ctl --device /dev/mediaN --print-topology<br />
<br />
To set the capture format (including the bus format and capture size), you specify the properties of the source pad.<br />
<br />
$ media-ctl --set-v4l2 '"ov5640 1-003c":0[fmt:UYVY8_2X8/720x480]'<br />
<br />
Here the entity name '''"ov5640 1-003c"''' can also be replaced with the entity ID '''5'''.<br />
<br />
This configures a capture size of 720x480 pixels with the UYVY8_2X8 bus format, which is YUV 4:2:0.<br />
See [https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/subdev-formats.html Media Bus Formats] for a list and description of formats.<br />
<br />
The capture resolution specified here must match what is requested by the capture application,<br />
otherwise the kernel driver will report an error and refuse to capture.<br />
<br />
=== Sensor sub-device configuration ===<br />
Sensors can have a number of control knobs that can be configured from userspace. These range from image orientation to power line frequency to test patterns.<br />
<br />
To see the full list of control knobs along with menu item descriptions, use<br />
<br />
<nowiki><br />
$ v4l2-ctl --list-ctrls-menus<br />
<br />
User Controls<br />
<br />
contrast (int) : min=0 max=255 step=1 default=0 value=0 flags=slider<br />
saturation (int) : min=0 max=255 step=1 default=64 value=64 flags=slider<br />
hue (int) : min=0 max=359 step=1 default=0 value=0 flags=slider<br />
white_balance_automatic (bool) : default=1 value=1 flags=update<br />
red_balance (int) : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider<br />
blue_balance (int) : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider<br />
exposure (int) : min=0 max=65535 step=1 default=0 value=885 flags=inactive, volatile<br />
gain_automatic (bool) : default=1 value=1 flags=update<br />
gain (int) : min=0 max=1023 step=1 default=0 value=248 flags=inactive, volatile<br />
horizontal_flip (bool) : default=0 value=0<br />
vertical_flip (bool) : default=0 value=0<br />
power_line_frequency (menu) : min=0 max=3 default=1 value=1<br />
0: Disabled<br />
1: 50 Hz<br />
2: 60 Hz<br />
3: Auto<br />
<br />
Camera Controls<br />
<br />
auto_exposure (menu) : min=0 max=1 default=0 value=0 flags=update<br />
0: Auto Mode<br />
1: Manual Mode<br />
<br />
Image Processing Controls<br />
<br />
test_pattern (menu) : min=0 max=4 default=0 value=0<br />
0: Disabled<br />
1: Color bars<br />
2: Color bars w/ rolling bar<br />
3: Color squares<br />
4: Color squares w/ rolling bar<br />
</nowiki><br />
<br />
Note that if the system has multiple video devices, you may need to specify which one to use:<br />
<br />
$ v4l2-ctl --device=/dev/videoN --list-ctrls-menus<br />
<br />
To set an option, use<br />
<br />
$ v4l2-ctl --set-ctrl=vertical_flip=1<br />
<br />
Or multiple options at once<br />
<br />
$ v4l2-ctl --set-ctrl=power_line_frequency=2,vertical_flip=1,horizontal_flip=1<br />
<br />
== Capturing Images ==<br />
<br />
=== FFMpeg ===<br />
FFMpeg supports capturing from v4l2 devices. However it does not support configuration of the media bus or sub-devices.<br />
Please use the commands shown in the previous sections instead.<br />
<br />
To capture from the first video device, use<br />
<br />
$ ffmpeg -s WxH -i /dev/video0 output.mjpg<br />
<br />
This captures and encodes a video of W by H pixels from the first video device to an M-JPEG file.<br />
<br />
Note that W and H must match what you previously set with '''media-ctl'''. The system default is 640x480.<br />
<br />
If you also specified a different bus format, such as JPEG_1X8, you will need to tell FFMpeg as well, using<br />
<br />
$ ffmpeg -input_format mjpeg -s WxH -i /dev/video0 output.mjpg<br />
<br />
<br />
== Caveats / TODOs ==<br />
<br />
=== JPEG media bus format buffers ===<br />
The JPEG media bus format support in the driver does not trim the returned buffer.<br />
In other words, the full buffer is passed back to userspace, with trailing zeros.<br />
This means the user will end up with enormous JPEG files without post-processing.<br />
<br />
There are already several JPEG parsers in the kernel. A proposal was made to combine<br />
and generalize them, which could then be used in our CSI driver to detect the end<br />
of the JPEG stream. This has not been implemented yet.<br />
<br />
=== MIPI CSI-2 ===<br />
While a few Allwinner SoCs support MIPI CSI-2, details on the hardware is sparse.<br />
No one has attempted to support this yet.<br />
<br />
= BSP kernel supported camera's sensors table =<br />
{| class="wikitable"<br />
|-<br />
! scope="row" | Vendor !! Part Number !! Pixels !! Type !! Specification !! Focus !! AVDD !! DOVDD !! DVDD !! AFVCC !! NOTE<br />
|-<br />
| OmniVision || OV7670 || 0.3M || Photo/Video || 640*480@30fps<br />352*176@30fps<br />320*240@30fps<br />176*144@30fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| OmniVision || OV2655 || 2M || Photo/Video || 1600*1200<br />800*600@30fps<br />640*480@30fps || Fixed focus || 2.8 || 2.8 || 1.5 || NC || Basic image can fine tune the effect<br />
|-<br />
| OmniVision || OV2643 || 2M || Photo/Video || 1600*1200<br />1280*760@30fps<br />640*480@30fps || Fixed focus || 2.8 || 2.8 || 1.5 || NC || Module FPC needs to be as short as possible <br />
|-<br />
| OmniVision || OV3660 || 3M || Photo/Video || 2048*1536@5fps<br />1600*1200@5fps<br />1280*720@30fps<br />640*480@30fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| OmniVision || OV5640 || 5M || Photo/Video || 2592*1936@5fps<br />2048*1536@5fps<br />1600*1200@5fps<br />1280*960@5fps<br />1024*768@5fps<br />1920*1080@30fps<br />1280*720@30fps<br />640*480@30fps || Fixed focus/Autofocus || 2.8 || 2.8 || 1.5 || 2.8~3 || 1.OV5640 drive capability module selection FPC.<br />Need to be as short as possible.<br />2. Recommendation module model effects and auto-focus function is fine.<br />If the election of the other modules, and does not guarantee results.<br />
|-<br />
| OmniVision || OV5647 || 5M || Photo/Video || 5M@15fps<br />1080p@30fps<br />720p@30fps || Autofocus || 2.8 || 2.8 || 1.5 || 2.8 || <br />
|-<br />
| Micron || MT9V112 || 0.3M || Photo/Video || 640*480@30fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Micron || MT9M112 || 1.3M || Photo/Video || 1280*1024@15fps<br />640*512@30fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Micron || MT9M113 || 1.3M || Photo/Video || 1280*1024@15fps<br />640*512@30fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Micron || MT9D112 || 1.3M || Photo/Video || 1600*1200@15fps<br />640*480@30fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Galaxy Core || GC0307 || 0.3M || Video || 640*480@15fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Galaxy Core || GC0308 || 0.3M || Video || 640*480@15fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Galaxy Core || GC0309 || 0.3M || Video || 640*480@15fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Galaxy Core || GC0329 || 0.3M || Video || 640*480@15fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Galaxy Core || GT2005 || 2M || Photo/Video || 1600*1200@15fps<br />1280*720@15fps<br />800*600@30fps<br />640*480@30fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Galaxy Core || GT2035 || 2M || Photo/Video || 1600*1200@2fps<br />1280*720@10fps<br />800*600@10fps<br />640*480@10fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Galaxy Core || GC2015 || 2M || Photo/Video || 1600*1200@2fps<br />1280*1024@2fps<br />1024*768@2fps<br />800*600@8fps<br />640*480@8fps || Fixed focus || 2.8 || 2.8 || 2.8 || NC || <br />
|-<br />
| Hynix || HI704 || 0.3M || Video || 640*480@20fps || Fixed focus || 2.8 || 2.8 || 2.8 || NC || I2C and other devices share may be a conflict<br />
|-<br />
| Hynix || HI253 || 6M || Photo/Video || 1600*1200<br />1280*720@15fps<br />800*600@30fps<br />640*480@30fps<br />320*240@30fps || Fixed focus/Autofocus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| SETi || SIV121D || 0.3M || YUV || 640x480@30fps || Fixed focus || 2.8 || 1.8/2.8 || internal || NC || based on SIV121C datasheet<br />
|-<br />
| Superpix || SP0838 || 0.3M || Video || 640*480@20fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Superpix || SP2518 || 2M || Video || 1600*1200@15fps || Fixed focus || 2.8 || 2.8 || 1.8 || NC || <br />
|-<br />
| Samsung || S5K4EC || 5M || Photo/Video || 2560*1920@7.5fps<br />2048*1536@7.5fps<br />1920*1080@15fps<br />1280*720@30fps<br />640*480@30fps || Autofocus || 2.8 || 2.8 || 1.2 || 2.8~3 || <br />
|-<br />
| TOSHIBA || T8ET5 || 5M || Video || 5M@15fps<br />2048*1536@7.5fps<br />1080p@30fps<br />720p@30fps || Autofocus || 2.8 || 2.8 || 1.5 || 2.8 || <br />
|}<br />
<br />
==Reference==<br />
<strike>*[http://service.awbase.com:8000/faq/index.php/%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8] Allwinnertech Wiki</strike><br />
<br />
[[Category:Hardware]]<br />
[[Category:Tutorial]]</div>
Faruk
https://linux-sunxi.org/index.php?title=Audio_Codec&diff=23587
Audio Codec
2020-10-07T13:46:42Z
<p>Faruk: Added ALSA documentation</p>
<hr />
<div>== Sound / Audio ==<br />
<br />
The [[A10]] supports two audio outputs and two audio inputs:<br />
<br />
# HDMI digital audio output (through HDMI port)<br />
# Analog stereo (jack) audio output<br />
# Analog Line-In (stereo) audio input<br />
# Microphone audio input<br />
<br />
=== Configuring the analog output as default ===<br />
<br />
By default, if you install a Linux image, the HDMI (digital) audio output is the first audio output device. Thus, if you try to play a sound file without specifying the output device, the sound will be send to the HDMI output.<br />
*But in last Cubian,by default, the Analog stereo (jack) audio output is the first audio output device.<br />
In order to configure the ALSA sound subsystem to use the analog (jack) audio output, add the following file /etc/asound.conf<br />
<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
}<br />
<br />
=== Testing the sound ===<br />
<br />
You can test the sound output by running the command<br />
<br />
speaker-test -twav -c2<br />
<br />
You will hear a voice saying in turns ''Left'' and ''Right'', and the sound for each word will come from each<br />
The default device will be selected. You can use the -D parameter to select the other sound output device. <br />
With '''aplay -l''' you can view the available audio output devices.<br />
<br />
=== Troubleshooting ===<br />
<br />
Mainline kernel (4.5-rc3)/[[A20]]: if audio doesn't play remember to ENABLE both in alsamixer: "Power Amplifier DAC" and "Power Amplifier Mute".<br />
<br />
== Technical details ==<br />
<br />
'''PDF Documentation:''' More information can be found in the document here: https://mchehab.fedorapeople.org/kernel_docs_latex/sound.pdf<br />
<br />
'''Works with:''' A10 with mainline and sunxi kernels, {more details here}.<br />
<br />
'''Playback:''' (internal 24 bits Digital to Analog Converter)<br />
<br />
* HPL Headphone Left channel output AO<br />
* HPR Headphone Right channel output AO<br />
* HPCOM Headphone amplifier output A<br />
* HPCOM_FB Headphone amplifier Feedback A<br />
<br />
<br />
'''Recorder:''' (internal 24 bits Analog to Digital Converter)<br />
<br />
* FMINL Audio ADC(24bit) Input for Left channel of FM radio AI<br />
* FMINR Audio ADC(24bit) Input for Right channel of FM radio AI<br />
* LINEINL Audio ADC(24bit) Input for Left channel of Line In AI<br />
* LINEINR Audio ADC(24bit) Input for Right channel of Line In AI<br />
* MICINL Audio ADC(24bit) Input for Left channel of Microphone AI<br />
* MICINR Audio ADC(24bit) Input for Right channel of Microphone AI<br />
<br />
micin has an internal pre-amplifier.<br />
<br />
Only one 2-channel input port can be used at the same time.<br />
<br />
To select the intput port you have to set the mixer control called '''ADC Input Mux'''<br />
{| class="wikitable"<br />
|-<br />
| '''ADC Input Mux Value:''' || 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7<br />
|-<br />
| '''Input Port''' || linein || fmin || mic1 || mic2 || mic1,mic2 || mic1+mic2 || output mixer || linein,mic1<br />
|}<br />
<br />
To change the ADC muxer you have to use the amixer tool from the "alsa-utils" package:<br />
<br />
'''amixer -c <"card"> cset numid=<"control#"> <"input_port">'''<br />
<br />
<br />
where: <br />
<br />
<"card"> is the card, 0 for the sunxi-codec and 1 for the hdmi audio output<br />
<br />
<"input_port"> is the input port from the table<br />
<br />
<"control#"> is the control # showed using: aximer contents<br />
<br />
<br />
To install the alsa-utils from debian based distros: "apt-get install alsa-utils". Inside the package you have the aplay and arecord tools to test it.<br />
<br />
<br />
<br />
Command example to use the linein port:<br />
<br />
'''amixer -c 0 cset numid=16 0'''<br />
<br />
<br />
Use '''"amixer contents"''' to get the contents and controls of your Alsa driver:<br />
<br />
numid=1,iface=MIXER,name='Master Playback Volume'<br />
; type=INTEGER,access=rw------,values=1,min=0,max=63,step=0<br />
: values=51<br />
numid=10,iface=MIXER,name='LineL Switch'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=on<br />
numid=11,iface=MIXER,name='LineR Switch'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=on<br />
numid=5,iface=MIXER,name='Line Volume'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=on<br />
numid=15,iface=MIXER,name='Mic Input Mux'<br />
; type=INTEGER,access=rw------,values=1,min=0,max=15,step=0<br />
: values=0<br />
numid=6,iface=MIXER,name='MicL Volume'<br />
; type=INTEGER,access=rw------,values=1,min=0,max=3,step=0<br />
: values=1<br />
numid=7,iface=MIXER,name='MicR Volume'<br />
; type=INTEGER,access=rw------,values=1,min=0,max=3,step=0<br />
: values=2<br />
numid=16,iface=MIXER,name='ADC Input Mux'<br />
; type=INTEGER,access=rw------,values=1,min=0,max=7,step=0<br />
: values=0<br />
numid=3,iface=MIXER,name='Capture Volume'<br />
; type=INTEGER,access=rw------,values=1,min=0,max=7,step=0<br />
: values=7<br />
numid=2,iface=MIXER,name='Playback Switch'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=off<br />
numid=4,iface=MIXER,name='Fm Volume'<br />
; type=INTEGER,access=rw------,values=1,min=0,max=7,step=0<br />
: values=3<br />
numid=8,iface=MIXER,name='FmL Switch'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=off<br />
numid=9,iface=MIXER,name='FmR Switch'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=off<br />
numid=12,iface=MIXER,name='Ldac Left Mixer'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=off<br />
numid=14,iface=MIXER,name='Ldac Right Mixer'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=off<br />
numid=13,iface=MIXER,name='Rdac Right Mixer'<br />
; type=BOOLEAN,access=rw------,values=1<br />
: values=off<br />
<br />
[[Category:Tutorial]]</div>
Faruk
https://linux-sunxi.org/index.php?title=U-Boot&diff=23385
U-Boot
2020-06-24T11:04:19Z
<p>Faruk: command line has marked</p>
<hr />
<div>Support for sunxi devices is increasingly available from [http://www.denx.de/wiki/U-Boot upstream U-Boot]. This page describes that support.<br />
<br />
To know if your device is supported in U-Boot, check out [[:Category:Devices|the respective device page.]] Here is [[:Category:Mainline_U-Boot|the list of all devices supporting mainline U-Boot.]]<br />
<br />
[[U-Boot/Changelog | A changelog is available here]].<br />
<br />
We have a separate page for [[U-Boot/Legacy U-Boot|the legacy sunxi branch of U-Boot]].<br />
<br />
This document is mainly for 32bits ARM device. Differences for ARM64 are only mentioned in the [[#Compile U-Boot|Compile U-Boot]] section. For more info see directly board/sunxi/README.sunxi64 in uboot sources.<br />
<br />
= Status Matrix =<br />
<br />
The goal of this matrix is to give an easy view of work on each SoC worked on by linux-sunxi.<br />
<br />
{| class="wikitable" style="text-align: center; width: 100%;"<br />
|-<br />
! style="width: 13%; text-align: left;" colspan="2" | Model<br />
! [[F1C100s|F1C-<br>100s]]<br />
! [[A10]]<br />
! [[A10s]]<br />
! [[A13]]<br>[[R8]]<br />
! [[A20]]<br />
! [[A23]]<br />
! [[A31]]<br />
! [[A33]]<br>[[R16]]<br />
! [[A64]]<br />
! [[A80]]<br />
! [[A83T]]<br />
! [[GR8]]<br />
! [[H3]]<br />
! [[H5]]<br />
! [[H6]]<br />
! [[R40]]<br>[[T3]]<br />
! [[V3]]<br>[[V3s]]<br>[[S3L]]<br />
<br />
|-<br />
! style="text-align: left;" colspan="2" | MMC<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
<br />
|-<br />
! style="text-align: left;" colspan="2" | USB<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: red;" | NO<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
<br />
|-<br />
! style="text-align: left;" colspan="2" | NET<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: red;" | NO<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: red;" | NO<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
<br />
|-<br />
! style="text-align: left;" colspan="2" | HDMI<br />
| | N/A<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| | N/A<br />
| style="background: lightgreen;" | ?<br />
| | N/A<br />
| style="background: lightgreen;" | ?<br />
| | N/A<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| | N/A<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: red;" | NO<br />
| style="background: lightgreen;" | ?<br />
| | N/A<br />
<br />
|-<br />
! style="text-align: left;" colspan="2" | UART<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen" | ?<br />
| style="background: grey; color: white;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: lightgreen;" | ?<br />
| style="background: grey; color: white;" | ?<br />
<br />
|}<br />
<br />
* MMC is for ability to boot from sdcard<br />
* USB is ability to connect USB devices (like ethernet dongle)<br />
* NET is ability to boot from TFTP<br />
* HDMI is ability see the boot screen through HDMI<br />
* UART is ability see the a boot screen through serial console<br />
<br />
{| class="wikitable" style="text-align: center;"<br />
|-<br />
! Legend<br />
|-<br />
| style="background: lightgreen;" | In U-Boot mainline since version x<br />
|-<br />
| style="background: darkgreen;" | Nobody works on it, but it should be compatible with already done drivers<br />
|-<br />
| style="background: orange;" | Somebody works on it<br />
|-<br />
| style="background: red;" | No support, nobody works on it<br />
|-<br />
| style="background: black; color: white;" | support impossible<br />
|-<br />
| style="background: grey; color: white;" | Status is unknown/to be completed<br />
|}<br />
<br />
= Compile U-Boot =<br />
<br />
== Get a toolchain ==<br />
<br />
If you haven't done so before, get a suitable [[toolchain]] installed and added to your PATH.<br />
<br />
You may also need to add some additional packages to build U-Boot:<br />
<pre>apt-get install swig python-dev</pre><br />
<br />
== Get the Device-tree Compiler ==<br />
<br />
Depending on your desired U-Boot version, a sufficiently up-to-date ''dtc'' may be required. (The build process will error on an outdated ''dtc'', and request you to upgrade it.) The installation of dtc is described in the [[Device_Tree#Get_the_Device-tree_Compiler|Device tree article]].<br />
<br />
If you are going to build a Linux kernel alongside U-Boot, it might also be worth to examine the kernel sources - as they come with ''dtc'' included under <code>${KERNEL_DIR}/scripts/dtc/</code>.<br />
<br />
== Clone the repository ==<br />
<br />
You can clone the u-boot repository by running:<br />
<pre>git clone git://git.denx.de/u-boot.git</pre><br />
<br />
{{alert|You should prefer using a stable release, unless you're testing recently added boards or experimental features that have not yet made into stable release:<br />
<br />
git checkout v2019.10 # or whatever is latest<br />
}}<br />
<br />
== Determine build target ==<br />
<br />
Go to your u-boot tree and search in the directory ''configs/'' for your board, the file name looks like ''<board_name>_defconfig''.<br />
<br />
So, if your device is [[Cubietech Cubieboard2|Cubieboard2]] your build target is ''Cubieboard2_defconfig''.<br />
<br />
== Build ==<br />
'''Arm Trusted Firmware (arm64)'''<br />
<br />
In order to build U-Boot for a arm64 device you need to build Arm Trusted Firmware (ATF) as a prerequisite first. Change <platform> to your needs. ''PLAT=sun50i_a64'' for example is suitable for H5 and A64 devices. (See board/sunxi/README.sunxi64 in uboot sources for more infos.)<br />
<pre>git clone https://github.com/ARM-software/arm-trusted-firmware.git<br />
cd arm-trusted-firmware<br />
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=<platform> DEBUG=1 bl31</pre><br />
<br />
When you have determined what <board_name> just configure U-Boot with a suitable default configuration. Use menuconfing to play with the settings if you feel like it and then just build it:<br />
<br />
'''armhf'''<br />
<pre>make CROSS_COMPILE=arm-linux-gnueabihf- <board_name>_defconfig<br />
make CROSS_COMPILE=arm-linux-gnueabihf- menuconfig<br />
make CROSS_COMPILE=arm-linux-gnueabihf-</pre><br />
'''arm64'''<br />
<pre>make CROSS_COMPILE=aarch64-linux-gnu- BL31=<path_to_arm-trusted-firmware>/build/sun50i_a64/debug/bl31.bin <board_name>_defconfig<br />
make CROSS_COMPILE=aarch64-linux-gnu- BL31=<path_to_arm-trusted-firmware>/build/sun50i_a64/debug/bl31.bin menuconfig<br />
make CROSS_COMPILE=aarch64-linux-gnu- BL31=<path_to_arm-trusted-firmware>/build/sun50i_a64/debug/bl31.bin</pre><br />
<br />
(When compiling natively, omit the <kbd>CROSS_COMPILE=…</kbd>)<br />
<br />
When the build has completed, there will be ''u-boot-sunxi-with-spl.bin'' available in your u-boot tree. The installation step will instruct how to install this on the installation media (e.g. a SD card), but first U-Boot needs to be configured.<br />
<br />
= Configure U-Boot =<br />
<br />
This article provides a collection of various scenarios for booting with U-Boot. <br />
<br />
== Boot ==<br />
<br />
For getting these bits loaded onto the hardware, please refer to the respective howto:<br />
* [[Bootable_SD_card#Bootloader | SD Card]]<br />
* [[Mainline_NAND_Howto#Booting_from_NAND|NAND]]<br />
* [[Bootable SPI flash | SPI NOR Flash]]<br />
* [[FEL/USBBoot | USB OTG]]<br />
* [[How_to_boot_the_A10_or_A20_over_the_network | Ethernet]]<br />
* [[Fastboot]]<br />
<br />
=== Booting with boot.cmd ===<br />
For booting from SD with mainline U-Boot, the recommended way is:<br />
<br />
* create a file ''boot.cmd'' on the first partition (also check [[Kernel arguments]] for extra 'bootargs' options):<br />
<br />
{| class="wikitable"<br />
! mainline kernel<br />
! sunxi-3.4 kernel<br />
|-<br />
|<br />
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10<br />
load mmc 0:1 0x43000000 ${fdtfile} || load mmc 0:1 0x43000000 boot/${fdtfile}<br />
load mmc 0:1 0x42000000 uImage || load mmc 0:1 0x42000000 boot/uImage<br />
bootm 0x42000000 - 0x43000000<br />
||<br />
setenv bootm_boot_mode sec<br />
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10<br />
load mmc 0:1 0x43000000 script.bin || load mmc 0:1 0x43000000 boot/script.bin<br />
load mmc 0:1 0x42000000 uImage || load mmc 0:1 0x42000000 boot/uImage<br />
bootm 0x42000000<br />
|}<br />
* If you also want to use an initramfs, please refer to the [[Initial Ramdisk]] article for details.<br />
:{{info|If you're wondering why setting '''bootm_boot_mode''' might be necessary for older kernels, have a look at the details of [[PSCI]].}}<br />
<br />
:{{note|Directly using a '''zImage''' is also supported by U-Boot for the sunxi platform.}} Substitute ''zImage'' in place of ''uImage'' in the commands above, and then use the '''bootz''' command instead of ''bootm''.<br />
:{{note|In order to boot your newly created '''arm64''' kernel, remember to use ''Image'' instead of ''uImage/zImage''. You also have to load it with ''booti'' instead of ''bootm/bootz''. So you have to adopt the corresponding lines in the boot.cmd file.}}<br />
<br />
* ''boot.cmd'' isn't used directly, but needs to be wrapped with uboot header with the command:<br />
<pre>mkimage -C none -A arm -T script -d boot.cmd boot.scr</pre><br />
<br />
=== Booting with extlinux.conf ===<br />
Mainline U-Boot also use syslinux/extlinux as payload.<br />
<br />
You need to install the boot configuration file extlinux.conf in an ext2/3/4 partition of SD card and U-Boot will find and execute it. This is conceptually identical to creating a GRUB configuration file on a desktop PC.<br />
<br />
Example extlinux.conf:<br />
<pre><br />
TIMEOUT 100<br />
DEFAULT default<br />
MENU TITLE Boot menu<br />
<br />
LABEL default<br />
MENU LABEL Default<br />
LINUX /zImage<br />
FDT /sun4i-a10-marsboard.dtb<br />
APPEND root=/dev/sda1 rootwait console=tty0 console=ttyS0,115200n8<br />
<br />
LABEL exit<br />
MENU LABEL Local boot script (boot.scr)<br />
LOCALBOOT 1<br />
</pre><br />
<br />
== Setting u-boot environment variables ==<br />
<br />
There is a difference in setting environment variables between the boot script and the U-Boot shell.<br />
<br />
Inside the shell you would set, for instance:<br />
<pre>setenv root /dev/sda1</pre><br />
<br />
But in the script you would use:<br />
<pre>root=/dev/sda1</pre><br />
<br />
== NAND ==<br />
Example U-Boot environment, as found in <code>uEnv.txt</code> from a stock android U-Boot environment partition<br />
<br />
<pre>bootdelay=0<br />
bootcmd=run setargs boot_normal<br />
console=ttyS0,115200<br />
nand_root=/dev/nandc<br />
mmc_root=/dev/mmcblk0p4<br />
init=/init<br />
loglevel=8<br />
setargs=setenv bootargs console=${console} root=${nand_root} init=${init} loglevel=${loglevel}<br />
boot_normal=nand read 40007800 boot;boota 40007800<br />
boot_recovery=nand read 40007800 recovery;boota 40007800<br />
boot_fastboot=fastboot</pre><br />
<br />
== NFS ==<br />
<br />
Recent version of U-Boot are able to boot from NFS as well as TFTP, but you have to get rid of the automatic setup of FTP. Check [[How_to_boot_the_A10_or_A20_over_the_network | Ethernet]] for more information.<br />
<br />
{{Note|on the A20 based cubieboards, this only seems to work on the stable kernel, not on stage.}}<br />
<br />
== FB console ==<br />
<br />
To get U-Boot output shown on the built-in framebuffer driver (currently, HDMI only at 1024x768), add the following to your boot.cmd:<br />
<pre>setenv stdout=serial,vga<br />
setenv stderr=serial,vga</pre><br />
The default environment has these values set as well.<br />
<br />
== LCD Settings ==<br />
<br />
There is a [[LCD|separate wiki page about configuring LCD]] in U-Boot.<br />
<br />
= Install U-Boot =<br />
<br />
* Convert the ''boot.cmd'' to ''boot.scr'' using [[U-Boot/Tools#mkimage|mkimage]]:<br />
<br />
'''armhf'''<br />
mkimage -C none -A arm -T script -d boot.cmd boot.scr<br />
'''arm64'''<br />
mkimage -C none -A arm64 -T script -d boot.cmd boot.scr<br />
* Copy the bootloader to the installation media<br />
<br />
dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8<br />
<br />
* copy kernel files to the first partition<br />
** For a 3.4 kernel you need ''uImage'' (linux kernel) and ''script.bin'' (binary representation of [[Fex Guide|FEX]]).<br />
** For a device tree based kernel ("mainline", 4.x) you need the kernel image (''uImage'', ''zImage'' or ''Image'') and the device-specific ''.dtb'' file (the one referenced in the ''${fdtfile}'' above) that is generated as part of your kernel compilation.<br />
<br />
Look at [[Manual build howto]] for more details.<br />
<br />
= Troubleshooting =<br />
<br />
== USB 1.x, USB keyboards (U-Boot < v2015.07) ==<br />
<br />
'''U-Boot v2015.07 and later shouldn't have problems supporting mixed USB 1.x/2.0 devices.''' OHCI and EHCI no longer conflict with each other (after the switch to device model).<br />
<br />
Previous U-Boot versions (v2015.04 and older) have a problem supporting both USB 1.x (OHCI) and USB 2.0 (EHCI) at the same time - the latter includes the ''SUNXI_EHCI'' driver for Allwinner boards.<br />
<br />
:Unfortunately, this also affects many '''USB HID / keyboard''' devices which would not be detected properly by U-Boot. The typical message in this case is "''cannot reset port N!?''", where ''N'' is whichever USB port those devices were attached to.<br />
<br />
{{info|A possible workaround is to place an external USB 2.0 hub between your board and these USB devices.}}<br />
<br />
See: http://lists.denx.de/pipermail/u-boot/2015-January/200162.html.<br />
<br />
== U-Boot 2015.07+ won't start ==<br />
If you're using a recent (device model based) U-Boot, and the SPL just hangs after initializing the DRAM (<code>CPU: 912000000Hz, AXI/AHB/APB: 3/2/2</code> or something similar), chances are that your main U-Boot binary may be missing DTB information / a proper [[device tree]]. Depending on the (possibly outdated) instructions you followed: double-check that you're not incorrectly using ''u-boot.bin'' instead of ''u-boot'''-dtb'''.bin'', or ''u-boot.img'' instead of ''u-boot'''-dtb'''.img''.<br />
<br />
== Legacy kernel won't start ==<br />
* If your 3.4.x kernel refuses to boot / gets stuck right after ''"Starting kernel ..."'':<br />
** Double-check that '''bootm_boot_mode''' is set to "'''sec'''"! (see [[#Boot|above]])<br />
** For U-Boot 2018.09-rc1 or later, set CONFIG_ARMV7_LPAE=n in .config or apply https://patchwork.ozlabs.org/patch/1058338/<br />
* If you don't have a serial console and only use VGA/HDMI/LCD, then it might be also the case of "Unrecognized/unsupported machine ID" (see [[#Unrecognized.2Funsupported_machine_ID|below]]).<br />
<br />
== Unrecognized/unsupported machine ID ==<br />
The sunxi-3.4 kernel may fail to boot with one of the following error messages on the serial console (but this message is not visible on a HDMI monitor or a LCD display!):<br />
<pre><br />
Error: unrecognized/unsupported machine ID (r1 = 0x10001008).<br />
Error: unrecognized/unsupported machine ID (r1 = 0x1000102a).<br />
Error: unrecognized/unsupported machine ID (r1 = 0x100010bb).<br />
</pre><br />
In this case either upgrade to a recent ''stage/sunxi-3.4'' kernel ([https://github.com/linux-sunxi/linux-sunxi/tree/stage/sunxi-3.4 github branch]) - or try to '''"Enable workarounds for booting old kernels"''' in U-Boot:<br />
:<code>make menuconfig</code> or <code>make CROSS_COMPILE=arm-linux-gnueabihf- menuconfig</code>, the option is located under "ARM architecture". (Make sure to rebuild your U-Boot after changing it.)<br />
<br />
If upgrading to ''stage/sunxi-3.4'' is not an option (i.e. using some old and very much diverged<br />
sunxi-3.4 fork is really necessary), then the following patches can be cherry-picked (=&nbsp;selectively merged <u>as a set</u>):<br />
<pre><br />
wget https://github.com/linux-sunxi/linux-sunxi/commit/5052b83aa44dc16d6662d8d9d936166c139ad8c5.patch<br />
wget https://github.com/linux-sunxi/linux-sunxi/commit/9a1cd034181af628d4145202289e1993c1687db6.patch<br />
wget https://github.com/linux-sunxi/linux-sunxi/commit/c4c4664ed1a2f35e54a33ae4e65f517721ff43b5.patch<br />
wget https://github.com/linux-sunxi/linux-sunxi/commit/ade08aa6e5249a9e75a97393e86c250b2bcb3ec8.patch<br />
wget https://github.com/linux-sunxi/linux-sunxi/commit/16b25a95327f45a995f6efcf3e9d83a414231af9.patch<br />
wget https://github.com/linux-sunxi/linux-sunxi/commit/dea62f21deb177053b84b15a519dff6c74d061d9.patch<br />
wget https://github.com/linux-sunxi/linux-sunxi/commit/d47d367036be38c5180632ec8a3ad169a4593a88.patch<br />
git am 5052b83aa44dc16d6662d8d9d936166c139ad8c5.patch<br />
git am 9a1cd034181af628d4145202289e1993c1687db6.patch<br />
git am c4c4664ed1a2f35e54a33ae4e65f517721ff43b5.patch<br />
git am ade08aa6e5249a9e75a97393e86c250b2bcb3ec8.patch<br />
git am 16b25a95327f45a995f6efcf3e9d83a414231af9.patch<br />
git am dea62f21deb177053b84b15a519dff6c74d061d9.patch<br />
git am d47d367036be38c5180632ec8a3ad169a4593a88.patch<br />
</pre><br />
{{warn|It is required to apply '''all''' of them, as they contain important stability/safety changes. The last patch in this series only takes care of the safety guard, which exists there specifically to block booting problematic kernels. Just removing the safety guard alone without applying all the bugfixes will lead to obscure runtime problems, please don't be tempted to do this.|}}<br />
<br />
<br />
== ImportError: No module named _libfdt ==<br />
<br />
If you see the following error when compiling on Arch Linux arm<br />
<pre><br />
ImportError: No module named _libfdt<br />
</pre><br />
<br />
install dtc<br />
<pre><br />
sudo pacman -S dtc<br />
</pre><br />
<br />
= Adding a new device to upstream U-Boot =<br />
<br />
http://lists.denx.de/pipermail/u-boot/2014-December/199351.html<br />
<br />
== DRAM Settings ==<br />
<br />
=== Failsafe DRAM settings, based on standard JEDEC timings ===<br />
<br />
Each device has DRAM settings configured in its defconfig file in the U-Boot "configs" directory (here is [http://git.denx.de/?p=u-boot.git;a=blob;f=configs/Cubietruck_defconfig;h=b64f84f2b8d2d48bed3130aecd31d220013061f0;hb=HEAD an example for the Cubietruck board]). The slow failsafe DRAM settings for an A10/A13/A20 device may look like:<br />
<pre style="background-color: lightgreen;"><br />
+S:CONFIG_DRAM_CLK=360<br />
+S:CONFIG_DRAM_ZQ=123<br />
+S:CONFIG_DRAM_EMR1=4<br />
+S:CONFIG_DRAM_TIMINGS_DDR3_800E_1066G_1333J=y<br />
</pre><br />
<br />
A more complete set of available Kconfig options and their descriptions can be found here: http://git.denx.de/?p=u-boot.git;a=blob;f=board/sunxi/Kconfig;h=e1d4ab148f0838d746889775cfbab5bed57838bf;hb=a705ebc81b7f91bbd0ef7c634284208342901149#l177<br />
<br />
=== The settings from the Android firmware ===<br />
<br />
Somewhat better settings can be retrieved by the [[Retrieving_device_information#Reading_memory_information_from_registers|meminfo tool]] from the stock Android or GNU/Linux system, provided by the device manufacturer. It still makes sense to [[Hardware_Reliability_Tests#DRAM|test the reliability]] of the resulting DRAM configuration. Because some vendors are providing poor configuration for ZQ or EMR1, but nevertheless trying to optimistically set the DRAM clock speed too high.<br />
<br />
=== Performance optimized DRAM settings ===<br />
<br />
Tuning DRAM setting for each individual board can provide much better performance than the failsafe defaults. This involves trial and error testing of different settings using a tool until an optimal combination is found. The [[DRAM_Controller|DRAM Controller page]] provides links to start researching this topic. This approach will be time consuming, so a satisfactory solution using one of the other approaches may be best to start with.<br />
<br />
= See also =<br />
* [[Mainline Kernel Howto]]<br />
* [[:Category:Mainline_U-Boot|Mainline U-Boot supported devices]]<br />
* [[U-Boot/Changelog]]<br />
<br />
[[Category:Tutorial]]<br />
[[Category:Software]]<br />
[[Category:Development]]<br />
[[Category:Boot]]</div>
Faruk