Kernel Porting Guide
====================

This document provides instructions for porting Marvell Linux package to a customer's board.

Relevant Devices
----------------
	- Armada-80x0
	- Armada-70x0
	- Armada-37x0
	- Armada-38x

Introduction
------------
The device-tree includes runtime configuration for the Linux Kernel.
In addition, the device-tree enables passing configuration parameters to drivers.

For general information about the device-tree please refer to:
http://elinux.org/Device_Tree


Device-Tree Files
-----------------
Marvell's device-tree files are located in the following locations:
- arch/arm64/boot/dts/marvell for 64-bit devices (A37x0, A80x0 and A70x0)
- arch/arm/boot/dts for 32-bit devices (A38x and A39x).

Marvell device-trees consists of 2 types of file:
	- ``*.dtsi`` -	These files represents the SoC. Each available interface
			has a node which holds the SoC information.
	- ``*.dts``  -	These files holds the configuration of the board itself,
			enabling/disabling nodes from SoCs, adding board information
			to each node (if required).

Porting Procedure
-----------------
	1. Choose one of the existing device tree for Marvell boards (for the SoC in use):

		Copy the selected file, change the name and place the file in the correct folder, for example:
		- arch/arm64/boot/dts/marvell/armada-8040-<new_name>.dts
		- arch/arm/boot/dts/armada-38x-<new_name>.dts

	2. Add the new device-tree file to the corresponding Makefile:
		- arch/arm64/boot/dts/marvell/Makefile (A80x0, A70x0, A37x0)
		- arch/arm/boot/dts/Makefile		 (A38x, A39x)

		For example: ``dtb-$(CONFIG_ARCH_MVEBU) += armada-8040-<new_name>.dtb``

	3. Look for "UPDATE" comments in the device tree and update board specific information:
		- Model: "Customer board model"
		- Compatible: "customer-board-compatible"
		- Memory size: Update "memory" node properties
		- MPPs: pinctrl-0 = <handle>
		- PHY addresses for network nodes
		- COMPHY handles for network nodes
		- SPI flash (if needed)
		- I2c devices (if needed)


Device-Tree Bindings
--------------------
In order to make the porting of the drivers easier, each Linux driver
has a device tree binding document which explains the usage of the driver.
All binding documents are located in: Documentation/devicetree/bindings.

The tables below list the binding documents for Marvell's drivers.

Common Drivers
~~~~~~~~~~~~~~
	+---------------------------------------+-----------------------------------------------+
	| Driver				| Binding file					|
	+=======================================+===============================================+
	| Marvell SATA driver			| ata/ahci-platform.txt				|
	+---------------------------------------+-----------------------------------------------+
	| USB xHCI controller			| usb/usb-xhci.txt				|
	+---------------------------------------+-----------------------------------------------+
	| USB device controller			| usb/marvell-u3d.txt, usb/marvell-udc.txt	|
	+---------------------------------------+-----------------------------------------------+
	| Marvell Xenon SDHCI driver		| mmc/marvell,xenon-sdhci.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell MDIO ethernet driver		| net/marvell-orion-mdio.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell PCIe driver			| pci/armada8k-pcie.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell eHCI driver			| usb/ehci-orion.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell XOR engines driver		| dma/mv-xor.txt				|
	+---------------------------------------+-----------------------------------------------+

A80x0/A70x0
~~~~~~~~~~~
	+---------------------------------------+-----------------------------------------------+
	| Driver				| Binding file					|
	+=======================================+===============================================+
	| Marvell A80x0/A70x0 Pinctrl driver	| pinctrl/marvell,armada-ap806-pinctrl.txt	|
	|					|						|
	|					| pinctrl/marvell,armada-cp110-pinctrl.txt	|
	+---------------------------------------+-----------------------------------------------+
	| Marvell Comphy driver			| phy/phy-mvebu-comphy.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell Telephony driver		| telephony/mvebu-phone.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell PPv2x ethernet driver		| net/marvell-pp2x.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell EIP197 security driver	| crypto/mv_eip197.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell AP806 CPU Clock Driver	| clock/mvebu-armada-ap806-cpu-clock.txt	|
	+---------------------------------------+-----------------------------------------------+
	| Marvell SPI driver			| spi/spi-orion.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell I2c driver			| i2c/i2c-mv64xxx.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell EIP197 crypto driver		| crypto/inside_secure_eip.txt			|
	+---------------------------------------+-----------------------------------------------+

A37x0
~~~~~
	+---------------------------------------+-----------------------------------------------+
	| Driver				| Binding file					|
	+=======================================+===============================================+
	| Marvell A37x0 Pinctrl driver		| pinctrl/marvell,armada-3700-pinctrl.txt	|
	+---------------------------------------+-----------------------------------------------+
	| Marvell Neta Ethernet controller	| net/marvell-armada-370-neta.txt		|
	+---------------------------------------+-----------------------------------------------+
	| Marvell A37x0 i2c driver		| i2c/i2c-pxa.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell A37x0 SPI driver		| spi/spi-armada-3700.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell A37x0 UART driver		| tty/serial/mvebu-uart.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell A37x0 Clock driver		| clock/mvebu-armada3700-clock.txt		|
	+---------------------------------------+-----------------------------------------------+
	| Marvell A37x0 GPIO driver		| gpio/gpio-armada-3700.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell A37x0 PCIe driver		| pci/aardvark-pci.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell A37x0 USB OTG PHY driver	| usb/armada3700-otg-phy.txt			|
	+---------------------------------------+-----------------------------------------------+

A38x
~~~~
	+---------------------------------------+-----------------------------------------------+
	| Driver				| Binding file					|
	+=======================================+===============================================+
	| Marvell A38x Pinctrl driver		| pinctrl/marvell,armada-38x-pinctrl.txt	|
	+---------------------------------------+-----------------------------------------------+
	| Marvell Telephony driver		| telephony/mvebu-phone.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell Neta Ethernet controller	| marvell-armada-370-neta.txt			|
	+---------------------------------------+-----------------------------------------------+
	| Marvell SPI driver			| spi/spi-orion.txt				|
	+---------------------------------------+-----------------------------------------------+
	| Marvell I2c driver			| i2c/i2c-mv64xxx.txt				|
	+---------------------------------------+-----------------------------------------------+
