162306a36Sopenharmony_ciMPC5200 Device Tree Bindings
262306a36Sopenharmony_ci----------------------------
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci(c) 2006-2009 Secret Lab Technologies Ltd
562306a36Sopenharmony_ciGrant Likely <grant.likely@secretlab.ca>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciNaming conventions
862306a36Sopenharmony_ci------------------
962306a36Sopenharmony_ciFor mpc5200 on-chip devices, the format for each compatible value is
1062306a36Sopenharmony_ci<chip>-<device>[-<mode>].  The OS should be able to match a device driver
1162306a36Sopenharmony_cito the device based solely on the compatible value.  If two drivers
1262306a36Sopenharmony_cimatch on the compatible list; the 'most compatible' driver should be
1362306a36Sopenharmony_ciselected.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciThe split between the MPC5200 and the MPC5200B leaves a bit of a
1662306a36Sopenharmony_ciconundrum.  How should the compatible property be set up to provide
1762306a36Sopenharmony_cimaximum compatibility information; but still accurately describe the
1862306a36Sopenharmony_cichip?  For the MPC5200; the answer is easy.  Most of the SoC devices
1962306a36Sopenharmony_cioriginally appeared on the MPC5200.  Since they didn't exist anywhere
2062306a36Sopenharmony_cielse; the 5200 compatible properties will contain only one item;
2162306a36Sopenharmony_ci"fsl,mpc5200-<device>".
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciThe 5200B is almost the same as the 5200, but not quite.  It fixes
2462306a36Sopenharmony_cisilicon bugs and it adds a small number of enhancements.  Most of the
2562306a36Sopenharmony_cidevices either provide exactly the same interface as on the 5200.  A few
2662306a36Sopenharmony_cidevices have extra functions but still have a backwards compatible mode.
2762306a36Sopenharmony_ciTo express this information as completely as possible, 5200B device trees
2862306a36Sopenharmony_cishould have two items in the compatible list:
2962306a36Sopenharmony_ci	compatible = "fsl,mpc5200b-<device>","fsl,mpc5200-<device>";
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciIt is *strongly* recommended that 5200B device trees follow this convention
3262306a36Sopenharmony_ci(instead of only listing the base mpc5200 item).
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciie. ethernet on mpc5200: compatible = "fsl,mpc5200-fec";
3562306a36Sopenharmony_ci    ethernet on mpc5200b: compatible = "fsl,mpc5200b-fec", "fsl,mpc5200-fec";
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciModal devices, like PSCs, also append the configured function to the
3862306a36Sopenharmony_ciend of the compatible field.  ie. A PSC in i2s mode would specify
3962306a36Sopenharmony_ci"fsl,mpc5200-psc-i2s", not "fsl,mpc5200-i2s".  This convention is chosen to
4062306a36Sopenharmony_ciavoid naming conflicts with non-psc devices providing the same
4162306a36Sopenharmony_cifunction.  For example, "fsl,mpc5200-spi" and "fsl,mpc5200-psc-spi" describe
4262306a36Sopenharmony_cithe mpc5200 simple spi device and a PSC spi mode respectively.
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciAt the time of writing, exact chip may be either 'fsl,mpc5200' or
4562306a36Sopenharmony_ci'fsl,mpc5200b'.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciThe soc node
4862306a36Sopenharmony_ci------------
4962306a36Sopenharmony_ciThis node describes the on chip SOC peripherals.  Every mpc5200 based
5062306a36Sopenharmony_ciboard will have this node, and as such there is a common naming
5162306a36Sopenharmony_ciconvention for SOC devices.
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciRequired properties:
5462306a36Sopenharmony_ciname			description
5562306a36Sopenharmony_ci----			-----------
5662306a36Sopenharmony_ciranges			Memory range of the internal memory mapped registers.
5762306a36Sopenharmony_ci			Should be <0 [baseaddr] 0xc000>
5862306a36Sopenharmony_cireg			Should be <[baseaddr] 0x100>
5962306a36Sopenharmony_cicompatible		mpc5200: "fsl,mpc5200-immr"
6062306a36Sopenharmony_ci			mpc5200b: "fsl,mpc5200b-immr"
6162306a36Sopenharmony_cisystem-frequency	'fsystem' frequency in Hz; XLB, IPB, USB and PCI
6262306a36Sopenharmony_ci			clocks are derived from the fsystem clock.
6362306a36Sopenharmony_cibus-frequency		IPB bus frequency in Hz.  Clock rate
6462306a36Sopenharmony_ci			used by most of the soc devices.
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_cisoc child nodes
6762306a36Sopenharmony_ci---------------
6862306a36Sopenharmony_ciAny on chip SOC devices available to Linux must appear as soc5200 child nodes.
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciNote: The tables below show the value for the mpc5200.  A mpc5200b device
7162306a36Sopenharmony_citree should use the "fsl,mpc5200b-<device>","fsl,mpc5200-<device>" form.
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ciRequired soc5200 child nodes:
7462306a36Sopenharmony_ciname				compatible		Description
7562306a36Sopenharmony_ci----				----------		-----------
7662306a36Sopenharmony_cicdm@<addr>			fsl,mpc5200-cdm		Clock Distribution
7762306a36Sopenharmony_ciinterrupt-controller@<addr>	fsl,mpc5200-pic		need an interrupt
7862306a36Sopenharmony_ci							controller to boot
7962306a36Sopenharmony_cibestcomm@<addr>			fsl,mpc5200-bestcomm	Bestcomm DMA controller
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ciRecommended soc5200 child nodes; populate as needed for your board
8262306a36Sopenharmony_ciname		compatible		Description
8362306a36Sopenharmony_ci----		----------		-----------
8462306a36Sopenharmony_citimer@<addr>	fsl,mpc5200-gpt		 General purpose timers
8562306a36Sopenharmony_cigpio@<addr>	fsl,mpc5200-gpio	 MPC5200 simple gpio controller
8662306a36Sopenharmony_cigpio@<addr>	fsl,mpc5200-gpio-wkup	 MPC5200 wakeup gpio controller
8762306a36Sopenharmony_cirtc@<addr>	fsl,mpc5200-rtc		 Real time clock
8862306a36Sopenharmony_cimscan@<addr>	fsl,mpc5200-mscan	 CAN bus controller
8962306a36Sopenharmony_cipci@<addr>	fsl,mpc5200-pci		 PCI bridge
9062306a36Sopenharmony_ciserial@<addr>	fsl,mpc5200-psc-uart	 PSC in serial mode
9162306a36Sopenharmony_cii2s@<addr>	fsl,mpc5200-psc-i2s	 PSC in i2s mode
9262306a36Sopenharmony_ciac97@<addr>	fsl,mpc5200-psc-ac97	 PSC in ac97 mode
9362306a36Sopenharmony_cispi@<addr>	fsl,mpc5200-psc-spi	 PSC in spi mode
9462306a36Sopenharmony_ciirda@<addr>	fsl,mpc5200-psc-irda	 PSC in IrDA mode
9562306a36Sopenharmony_cispi@<addr>	fsl,mpc5200-spi		 MPC5200 spi device
9662306a36Sopenharmony_ciethernet@<addr>	fsl,mpc5200-fec		 MPC5200 ethernet device
9762306a36Sopenharmony_ciata@<addr>	fsl,mpc5200-ata		 IDE ATA interface
9862306a36Sopenharmony_cii2c@<addr>	fsl,mpc5200-i2c		 I2C controller
9962306a36Sopenharmony_ciusb@<addr>	fsl,mpc5200-ohci,ohci-be USB controller
10062306a36Sopenharmony_cixlb@<addr>	fsl,mpc5200-xlb		 XLB arbitrator
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_cifsl,mpc5200-gpt nodes
10362306a36Sopenharmony_ci---------------------
10462306a36Sopenharmony_ciOn the mpc5200 and 5200b, GPT0 has a watchdog timer function.  If the board
10562306a36Sopenharmony_cidesign supports the internal wdt, then the device node for GPT0 should
10662306a36Sopenharmony_ciinclude the empty property 'fsl,has-wdt'.  Note that this does not activate
10762306a36Sopenharmony_cithe watchdog.  The timer will function as a GPT if the timer api is used, and
10862306a36Sopenharmony_ciit will function as watchdog if the watchdog device is used.  The watchdog
10962306a36Sopenharmony_cimode has priority over the gpt mode, i.e. if the watchdog is activated, any
11062306a36Sopenharmony_cigpt api call to this timer will fail with -EBUSY.
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciIf you add the property
11362306a36Sopenharmony_ci	fsl,wdt-on-boot = <n>;
11462306a36Sopenharmony_ciGPT0 will be marked as in-use watchdog, i.e. blocking every gpt access to it.
11562306a36Sopenharmony_ciIf n>0, the watchdog is started with a timeout of n seconds.  If n=0, the
11662306a36Sopenharmony_ciconfiguration of the watchdog is not touched.  This is useful in two cases:
11762306a36Sopenharmony_ci- just mark GPT0 as watchdog, blocking gpt accesses, and configure it later;
11862306a36Sopenharmony_ci- do not touch a configuration assigned by the boot loader which supervises
11962306a36Sopenharmony_ci  the boot process itself.
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ciThe watchdog will respect the CONFIG_WATCHDOG_NOWAYOUT option.
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ciAn mpc5200-gpt can be used as a single line GPIO controller.  To do so,
12462306a36Sopenharmony_ciadd the following properties to the gpt node:
12562306a36Sopenharmony_ci	gpio-controller;
12662306a36Sopenharmony_ci	#gpio-cells = <2>;
12762306a36Sopenharmony_ciWhen referencing the GPIO line from another node, the first cell must always
12862306a36Sopenharmony_cibe zero and the second cell represents the gpio flags and described in the
12962306a36Sopenharmony_cigpio device tree binding.
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciAn mpc5200-gpt can be used as a single line edge sensitive interrupt
13262306a36Sopenharmony_cicontroller.  To do so, add the following properties to the gpt node:
13362306a36Sopenharmony_ci	interrupt-controller;
13462306a36Sopenharmony_ci	#interrupt-cells = <1>;
13562306a36Sopenharmony_ciWhen referencing the IRQ line from another node, the cell represents the
13662306a36Sopenharmony_cisense mode; 1 for edge rising, 2 for edge falling.
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_cifsl,mpc5200-psc nodes
13962306a36Sopenharmony_ci---------------------
14062306a36Sopenharmony_ciThe PSCs should include a cell-index which is the index of the PSC in
14162306a36Sopenharmony_cihardware.  cell-index is used to determine which shared SoC registers to
14262306a36Sopenharmony_ciuse when setting up PSC clocking.  cell-index number starts at '0'.  ie:
14362306a36Sopenharmony_ci	PSC1 has 'cell-index = <0>'
14462306a36Sopenharmony_ci	PSC4 has 'cell-index = <3>'
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ciPSC in i2s mode:  The mpc5200 and mpc5200b PSCs are not compatible when in
14762306a36Sopenharmony_cii2s mode.  An 'mpc5200b-psc-i2s' node cannot include 'mpc5200-psc-i2s' in the
14862306a36Sopenharmony_cicompatible field.
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_cifsl,mpc5200-gpio and fsl,mpc5200-gpio-wkup nodes
15262306a36Sopenharmony_ci------------------------------------------------
15362306a36Sopenharmony_ciEach GPIO controller node should have the empty property gpio-controller and
15462306a36Sopenharmony_ci#gpio-cells set to 2. First cell is the GPIO number which is interpreted
15562306a36Sopenharmony_ciaccording to the bit numbers in the GPIO control registers. The second cell
15662306a36Sopenharmony_ciis for flags which is currently unused.
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_cifsl,mpc5200-fec nodes
15962306a36Sopenharmony_ci---------------------
16062306a36Sopenharmony_ciThe FEC node can specify one of the following properties to configure
16162306a36Sopenharmony_cithe MII link:
16262306a36Sopenharmony_ci- fsl,7-wire-mode - An empty property that specifies the link uses 7-wire
16362306a36Sopenharmony_ci                    mode instead of MII
16462306a36Sopenharmony_ci- current-speed   - Specifies that the MII should be configured for a fixed
16562306a36Sopenharmony_ci                    speed.  This property should contain two cells.  The
16662306a36Sopenharmony_ci                    first cell specifies the speed in Mbps and the second
16762306a36Sopenharmony_ci                    should be '0' for half duplex and '1' for full duplex
16862306a36Sopenharmony_ci- phy-handle      - Contains a phandle to an Ethernet PHY.
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ciInterrupt controller (fsl,mpc5200-pic) node
17162306a36Sopenharmony_ci-------------------------------------------
17262306a36Sopenharmony_ciThe mpc5200 pic binding splits hardware IRQ numbers into two levels.  The
17362306a36Sopenharmony_cisplit reflects the layout of the PIC hardware itself, which groups
17462306a36Sopenharmony_ciinterrupts into one of three groups; CRIT, MAIN or PERP.  Also, the
17562306a36Sopenharmony_ciBestcomm dma engine has its own set of interrupt sources which are
17662306a36Sopenharmony_cicascaded off of peripheral interrupt 0, which the driver interprets as a
17762306a36Sopenharmony_cifourth group, SDMA.
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ciThe interrupts property for device nodes using the mpc5200 pic consists
18062306a36Sopenharmony_ciof three cells; <L1 L2 level>
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci    L1 := [CRIT=0, MAIN=1, PERP=2, SDMA=3]
18362306a36Sopenharmony_ci    L2 := interrupt number; directly mapped from the value in the
18462306a36Sopenharmony_ci          "ICTL PerStat, MainStat, CritStat Encoded Register"
18562306a36Sopenharmony_ci    level := [LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3]
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ciFor external IRQs, use the following interrupt property values (how to
18862306a36Sopenharmony_cispecify external interrupts is a frequently asked question):
18962306a36Sopenharmony_ciExternal interrupts:
19062306a36Sopenharmony_ci	external irq0:	interrupts = <0 0 n>;
19162306a36Sopenharmony_ci	external irq1:	interrupts = <1 1 n>;
19262306a36Sopenharmony_ci	external irq2:	interrupts = <1 2 n>;
19362306a36Sopenharmony_ci	external irq3:	interrupts = <1 3 n>;
19462306a36Sopenharmony_ci'n' is sense (0: level high, 1: edge rising, 2: edge falling 3: level low)
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_cifsl,mpc5200-mscan nodes
19762306a36Sopenharmony_ci-----------------------
19862306a36Sopenharmony_ciSee file Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
199