doc: driver-model: Convert of-plat.txt to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Bin Meng 2019-07-18 00:33:55 -07:00 committed by Tom Rini
parent 6c49c22846
commit 45dbb4dd23
2 changed files with 106 additions and 88 deletions

View file

@ -12,3 +12,4 @@ Driver Model
i2c-howto
livetree
migration
of-plat

View file

@ -1,5 +1,7 @@
Driver Model Compiled-in Device Tree / Platform Data
====================================================
.. SPDX-License-Identifier: GPL-2.0+
Compiled-in Device Tree / Platform Data
=======================================
Introduction
@ -78,6 +80,8 @@ How it works
The feature is enabled by CONFIG OF_PLATDATA. This is only available in
SPL/TPL and should be tested with:
.. code-block:: c
#if CONFIG_IS_ENABLED(OF_PLATDATA)
A new tool called 'dtoc' converts a device tree file either into a set of
@ -85,6 +89,8 @@ struct declarations, one for each compatible node, and a set of
U_BOOT_DEVICE() declarations along with the actual platform data for each
device. As an example, consider this MMC node:
.. code-block:: none
sdmmc: dwmmc@ff0c0000 {
compatible = "rockchip,rk3288-dw-mshc";
clock-freq-min-max = <400000 150000000>;
@ -112,6 +118,8 @@ Some of these properties are dropped by U-Boot under control of the
CONFIG_OF_SPL_REMOVE_PROPS option. The rest are processed. This will produce
the following C struct declaration:
.. code-block:: c
struct dtd_rockchip_rk3288_dw_mshc {
fdt32_t bus_width;
bool cap_mmc_highspeed;
@ -129,6 +137,8 @@ struct dtd_rockchip_rk3288_dw_mshc {
and the following device declaration:
.. code-block:: c
static struct dtd_rockchip_rk3288_dw_mshc dtv_dwmmc_at_ff0c0000 = {
.fifo_depth = 0x100,
.cap_sd_highspeed = true,
@ -147,6 +157,7 @@ static struct dtd_rockchip_rk3288_dw_mshc dtv_dwmmc_at_ff0c0000 = {
.reg = {0xff0c0000, 0x4000},
.card_detect_delay = 0xc8,
};
U_BOOT_DEVICE(dwmmc_at_ff0c0000) = {
.name = "rockchip_rk3288_dw_mshc",
.platdata = &dtv_dwmmc_at_ff0c0000,
@ -156,6 +167,8 @@ U_BOOT_DEVICE(dwmmc_at_ff0c0000) = {
The device is then instantiated at run-time and the platform data can be
accessed using:
.. code-block:: c
struct udevice *dev;
struct dtd_rockchip_rk3288_dw_mshc *plat = dev_get_platdata(dev);
@ -173,6 +186,8 @@ each 'compatible' string.
Where a node has multiple compatible strings, a #define is used to make them
equivalent, e.g.:
.. code-block:: c
#define dtd_rockchip_rk3299_dw_mshc dtd_rockchip_rk3288_dw_mshc
@ -204,6 +219,8 @@ ofdata_to_platdata() method and wrapped with #if.
For example:
.. code-block:: c
#include <dt-structs.h>
struct mmc_platdata {
@ -317,8 +334,8 @@ Future work
- Complete the phandle feature
- Move to using a full Python libfdt module
--
Simon Glass <sjg@chromium.org>
Google, Inc
6/6/16
Updated Independence Day 2016
.. Simon Glass <sjg@chromium.org>
.. Google, Inc
.. 6/6/16
.. Updated Independence Day 2016