18c2ecf20Sopenharmony_ciMPC5200 Device Tree Bindings
28c2ecf20Sopenharmony_ci----------------------------
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci(c) 2006-2009 Secret Lab Technologies Ltd
58c2ecf20Sopenharmony_ciGrant Likely <grant.likely@secretlab.ca>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciNaming conventions
88c2ecf20Sopenharmony_ci------------------
98c2ecf20Sopenharmony_ciFor mpc5200 on-chip devices, the format for each compatible value is
108c2ecf20Sopenharmony_ci<chip>-<device>[-<mode>].  The OS should be able to match a device driver
118c2ecf20Sopenharmony_cito the device based solely on the compatible value.  If two drivers
128c2ecf20Sopenharmony_cimatch on the compatible list; the 'most compatible' driver should be
138c2ecf20Sopenharmony_ciselected.
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciThe split between the MPC5200 and the MPC5200B leaves a bit of a
168c2ecf20Sopenharmony_ciconundrum.  How should the compatible property be set up to provide
178c2ecf20Sopenharmony_cimaximum compatibility information; but still accurately describe the
188c2ecf20Sopenharmony_cichip?  For the MPC5200; the answer is easy.  Most of the SoC devices
198c2ecf20Sopenharmony_cioriginally appeared on the MPC5200.  Since they didn't exist anywhere
208c2ecf20Sopenharmony_cielse; the 5200 compatible properties will contain only one item;
218c2ecf20Sopenharmony_ci"fsl,mpc5200-<device>".
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciThe 5200B is almost the same as the 5200, but not quite.  It fixes
248c2ecf20Sopenharmony_cisilicon bugs and it adds a small number of enhancements.  Most of the
258c2ecf20Sopenharmony_cidevices either provide exactly the same interface as on the 5200.  A few
268c2ecf20Sopenharmony_cidevices have extra functions but still have a backwards compatible mode.
278c2ecf20Sopenharmony_ciTo express this information as completely as possible, 5200B device trees
288c2ecf20Sopenharmony_cishould have two items in the compatible list:
298c2ecf20Sopenharmony_ci	compatible = "fsl,mpc5200b-<device>","fsl,mpc5200-<device>";
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciIt is *strongly* recommended that 5200B device trees follow this convention
328c2ecf20Sopenharmony_ci(instead of only listing the base mpc5200 item).
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciie. ethernet on mpc5200: compatible = "fsl,mpc5200-fec";
358c2ecf20Sopenharmony_ci    ethernet on mpc5200b: compatible = "fsl,mpc5200b-fec", "fsl,mpc5200-fec";
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciModal devices, like PSCs, also append the configured function to the
388c2ecf20Sopenharmony_ciend of the compatible field.  ie. A PSC in i2s mode would specify
398c2ecf20Sopenharmony_ci"fsl,mpc5200-psc-i2s", not "fsl,mpc5200-i2s".  This convention is chosen to
408c2ecf20Sopenharmony_ciavoid naming conflicts with non-psc devices providing the same
418c2ecf20Sopenharmony_cifunction.  For example, "fsl,mpc5200-spi" and "fsl,mpc5200-psc-spi" describe
428c2ecf20Sopenharmony_cithe mpc5200 simple spi device and a PSC spi mode respectively.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciAt the time of writing, exact chip may be either 'fsl,mpc5200' or
458c2ecf20Sopenharmony_ci'fsl,mpc5200b'.
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciThe soc node
488c2ecf20Sopenharmony_ci------------
498c2ecf20Sopenharmony_ciThis node describes the on chip SOC peripherals.  Every mpc5200 based
508c2ecf20Sopenharmony_ciboard will have this node, and as such there is a common naming
518c2ecf20Sopenharmony_ciconvention for SOC devices.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciRequired properties:
548c2ecf20Sopenharmony_ciname			description
558c2ecf20Sopenharmony_ci----			-----------
568c2ecf20Sopenharmony_ciranges			Memory range of the internal memory mapped registers.
578c2ecf20Sopenharmony_ci			Should be <0 [baseaddr] 0xc000>
588c2ecf20Sopenharmony_cireg			Should be <[baseaddr] 0x100>
598c2ecf20Sopenharmony_cicompatible		mpc5200: "fsl,mpc5200-immr"
608c2ecf20Sopenharmony_ci			mpc5200b: "fsl,mpc5200b-immr"
618c2ecf20Sopenharmony_cisystem-frequency	'fsystem' frequency in Hz; XLB, IPB, USB and PCI
628c2ecf20Sopenharmony_ci			clocks are derived from the fsystem clock.
638c2ecf20Sopenharmony_cibus-frequency		IPB bus frequency in Hz.  Clock rate
648c2ecf20Sopenharmony_ci			used by most of the soc devices.
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_cisoc child nodes
678c2ecf20Sopenharmony_ci---------------
688c2ecf20Sopenharmony_ciAny on chip SOC devices available to Linux must appear as soc5200 child nodes.
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciNote: The tables below show the value for the mpc5200.  A mpc5200b device
718c2ecf20Sopenharmony_citree should use the "fsl,mpc5200b-<device>","fsl,mpc5200-<device>" form.
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciRequired soc5200 child nodes:
748c2ecf20Sopenharmony_ciname				compatible		Description
758c2ecf20Sopenharmony_ci----				----------		-----------
768c2ecf20Sopenharmony_cicdm@<addr>			fsl,mpc5200-cdm		Clock Distribution
778c2ecf20Sopenharmony_ciinterrupt-controller@<addr>	fsl,mpc5200-pic		need an interrupt
788c2ecf20Sopenharmony_ci							controller to boot
798c2ecf20Sopenharmony_cibestcomm@<addr>			fsl,mpc5200-bestcomm	Bestcomm DMA controller
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ciRecommended soc5200 child nodes; populate as needed for your board
828c2ecf20Sopenharmony_ciname		compatible		Description
838c2ecf20Sopenharmony_ci----		----------		-----------
848c2ecf20Sopenharmony_citimer@<addr>	fsl,mpc5200-gpt		 General purpose timers
858c2ecf20Sopenharmony_cigpio@<addr>	fsl,mpc5200-gpio	 MPC5200 simple gpio controller
868c2ecf20Sopenharmony_cigpio@<addr>	fsl,mpc5200-gpio-wkup	 MPC5200 wakeup gpio controller
878c2ecf20Sopenharmony_cirtc@<addr>	fsl,mpc5200-rtc		 Real time clock
888c2ecf20Sopenharmony_cimscan@<addr>	fsl,mpc5200-mscan	 CAN bus controller
898c2ecf20Sopenharmony_cipci@<addr>	fsl,mpc5200-pci		 PCI bridge
908c2ecf20Sopenharmony_ciserial@<addr>	fsl,mpc5200-psc-uart	 PSC in serial mode
918c2ecf20Sopenharmony_cii2s@<addr>	fsl,mpc5200-psc-i2s	 PSC in i2s mode
928c2ecf20Sopenharmony_ciac97@<addr>	fsl,mpc5200-psc-ac97	 PSC in ac97 mode
938c2ecf20Sopenharmony_cispi@<addr>	fsl,mpc5200-psc-spi	 PSC in spi mode
948c2ecf20Sopenharmony_ciirda@<addr>	fsl,mpc5200-psc-irda	 PSC in IrDA mode
958c2ecf20Sopenharmony_cispi@<addr>	fsl,mpc5200-spi		 MPC5200 spi device
968c2ecf20Sopenharmony_ciethernet@<addr>	fsl,mpc5200-fec		 MPC5200 ethernet device
978c2ecf20Sopenharmony_ciata@<addr>	fsl,mpc5200-ata		 IDE ATA interface
988c2ecf20Sopenharmony_cii2c@<addr>	fsl,mpc5200-i2c		 I2C controller
998c2ecf20Sopenharmony_ciusb@<addr>	fsl,mpc5200-ohci,ohci-be USB controller
1008c2ecf20Sopenharmony_cixlb@<addr>	fsl,mpc5200-xlb		 XLB arbitrator
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cifsl,mpc5200-gpt nodes
1038c2ecf20Sopenharmony_ci---------------------
1048c2ecf20Sopenharmony_ciOn the mpc5200 and 5200b, GPT0 has a watchdog timer function.  If the board
1058c2ecf20Sopenharmony_cidesign supports the internal wdt, then the device node for GPT0 should
1068c2ecf20Sopenharmony_ciinclude the empty property 'fsl,has-wdt'.  Note that this does not activate
1078c2ecf20Sopenharmony_cithe watchdog.  The timer will function as a GPT if the timer api is used, and
1088c2ecf20Sopenharmony_ciit will function as watchdog if the watchdog device is used.  The watchdog
1098c2ecf20Sopenharmony_cimode has priority over the gpt mode, i.e. if the watchdog is activated, any
1108c2ecf20Sopenharmony_cigpt api call to this timer will fail with -EBUSY.
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciIf you add the property
1138c2ecf20Sopenharmony_ci	fsl,wdt-on-boot = <n>;
1148c2ecf20Sopenharmony_ciGPT0 will be marked as in-use watchdog, i.e. blocking every gpt access to it.
1158c2ecf20Sopenharmony_ciIf n>0, the watchdog is started with a timeout of n seconds.  If n=0, the
1168c2ecf20Sopenharmony_ciconfiguration of the watchdog is not touched.  This is useful in two cases:
1178c2ecf20Sopenharmony_ci- just mark GPT0 as watchdog, blocking gpt accesses, and configure it later;
1188c2ecf20Sopenharmony_ci- do not touch a configuration assigned by the boot loader which supervises
1198c2ecf20Sopenharmony_ci  the boot process itself.
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ciThe watchdog will respect the CONFIG_WATCHDOG_NOWAYOUT option.
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ciAn mpc5200-gpt can be used as a single line GPIO controller.  To do so,
1248c2ecf20Sopenharmony_ciadd the following properties to the gpt node:
1258c2ecf20Sopenharmony_ci	gpio-controller;
1268c2ecf20Sopenharmony_ci	#gpio-cells = <2>;
1278c2ecf20Sopenharmony_ciWhen referencing the GPIO line from another node, the first cell must always
1288c2ecf20Sopenharmony_cibe zero and the second cell represents the gpio flags and described in the
1298c2ecf20Sopenharmony_cigpio device tree binding.
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ciAn mpc5200-gpt can be used as a single line edge sensitive interrupt
1328c2ecf20Sopenharmony_cicontroller.  To do so, add the following properties to the gpt node:
1338c2ecf20Sopenharmony_ci	interrupt-controller;
1348c2ecf20Sopenharmony_ci	#interrupt-cells = <1>;
1358c2ecf20Sopenharmony_ciWhen referencing the IRQ line from another node, the cell represents the
1368c2ecf20Sopenharmony_cisense mode; 1 for edge rising, 2 for edge falling.
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_cifsl,mpc5200-psc nodes
1398c2ecf20Sopenharmony_ci---------------------
1408c2ecf20Sopenharmony_ciThe PSCs should include a cell-index which is the index of the PSC in
1418c2ecf20Sopenharmony_cihardware.  cell-index is used to determine which shared SoC registers to
1428c2ecf20Sopenharmony_ciuse when setting up PSC clocking.  cell-index number starts at '0'.  ie:
1438c2ecf20Sopenharmony_ci	PSC1 has 'cell-index = <0>'
1448c2ecf20Sopenharmony_ci	PSC4 has 'cell-index = <3>'
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ciPSC in i2s mode:  The mpc5200 and mpc5200b PSCs are not compatible when in
1478c2ecf20Sopenharmony_cii2s mode.  An 'mpc5200b-psc-i2s' node cannot include 'mpc5200-psc-i2s' in the
1488c2ecf20Sopenharmony_cicompatible field.
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_cifsl,mpc5200-gpio and fsl,mpc5200-gpio-wkup nodes
1528c2ecf20Sopenharmony_ci------------------------------------------------
1538c2ecf20Sopenharmony_ciEach GPIO controller node should have the empty property gpio-controller and
1548c2ecf20Sopenharmony_ci#gpio-cells set to 2. First cell is the GPIO number which is interpreted
1558c2ecf20Sopenharmony_ciaccording to the bit numbers in the GPIO control registers. The second cell
1568c2ecf20Sopenharmony_ciis for flags which is currently unused.
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_cifsl,mpc5200-fec nodes
1598c2ecf20Sopenharmony_ci---------------------
1608c2ecf20Sopenharmony_ciThe FEC node can specify one of the following properties to configure
1618c2ecf20Sopenharmony_cithe MII link:
1628c2ecf20Sopenharmony_ci- fsl,7-wire-mode - An empty property that specifies the link uses 7-wire
1638c2ecf20Sopenharmony_ci                    mode instead of MII
1648c2ecf20Sopenharmony_ci- current-speed   - Specifies that the MII should be configured for a fixed
1658c2ecf20Sopenharmony_ci                    speed.  This property should contain two cells.  The
1668c2ecf20Sopenharmony_ci                    first cell specifies the speed in Mbps and the second
1678c2ecf20Sopenharmony_ci                    should be '0' for half duplex and '1' for full duplex
1688c2ecf20Sopenharmony_ci- phy-handle      - Contains a phandle to an Ethernet PHY.
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ciInterrupt controller (fsl,mpc5200-pic) node
1718c2ecf20Sopenharmony_ci-------------------------------------------
1728c2ecf20Sopenharmony_ciThe mpc5200 pic binding splits hardware IRQ numbers into two levels.  The
1738c2ecf20Sopenharmony_cisplit reflects the layout of the PIC hardware itself, which groups
1748c2ecf20Sopenharmony_ciinterrupts into one of three groups; CRIT, MAIN or PERP.  Also, the
1758c2ecf20Sopenharmony_ciBestcomm dma engine has it's own set of interrupt sources which are
1768c2ecf20Sopenharmony_cicascaded off of peripheral interrupt 0, which the driver interprets as a
1778c2ecf20Sopenharmony_cifourth group, SDMA.
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ciThe interrupts property for device nodes using the mpc5200 pic consists
1808c2ecf20Sopenharmony_ciof three cells; <L1 L2 level>
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci    L1 := [CRIT=0, MAIN=1, PERP=2, SDMA=3]
1838c2ecf20Sopenharmony_ci    L2 := interrupt number; directly mapped from the value in the
1848c2ecf20Sopenharmony_ci          "ICTL PerStat, MainStat, CritStat Encoded Register"
1858c2ecf20Sopenharmony_ci    level := [LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3]
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ciFor external IRQs, use the following interrupt property values (how to
1888c2ecf20Sopenharmony_cispecify external interrupts is a frequently asked question):
1898c2ecf20Sopenharmony_ciExternal interrupts:
1908c2ecf20Sopenharmony_ci	external irq0:	interrupts = <0 0 n>;
1918c2ecf20Sopenharmony_ci	external irq1:	interrupts = <1 1 n>;
1928c2ecf20Sopenharmony_ci	external irq2:	interrupts = <1 2 n>;
1938c2ecf20Sopenharmony_ci	external irq3:	interrupts = <1 3 n>;
1948c2ecf20Sopenharmony_ci'n' is sense (0: level high, 1: edge rising, 2: edge falling 3: level low)
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cifsl,mpc5200-mscan nodes
1978c2ecf20Sopenharmony_ci-----------------------
1988c2ecf20Sopenharmony_ciSee file Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
199