mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-29 01:51:55 +00:00
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:
parent
6c49c22846
commit
45dbb4dd23
2 changed files with 106 additions and 88 deletions
|
@ -12,3 +12,4 @@ Driver Model
|
||||||
i2c-howto
|
i2c-howto
|
||||||
livetree
|
livetree
|
||||||
migration
|
migration
|
||||||
|
of-plat
|
||||||
|
|
|
@ -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
|
Introduction
|
||||||
|
@ -78,6 +80,8 @@ How it works
|
||||||
The feature is enabled by CONFIG OF_PLATDATA. This is only available in
|
The feature is enabled by CONFIG OF_PLATDATA. This is only available in
|
||||||
SPL/TPL and should be tested with:
|
SPL/TPL and should be tested with:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
|
|
||||||
A new tool called 'dtoc' converts a device tree file either into a set of
|
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
|
U_BOOT_DEVICE() declarations along with the actual platform data for each
|
||||||
device. As an example, consider this MMC node:
|
device. As an example, consider this MMC node:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
sdmmc: dwmmc@ff0c0000 {
|
sdmmc: dwmmc@ff0c0000 {
|
||||||
compatible = "rockchip,rk3288-dw-mshc";
|
compatible = "rockchip,rk3288-dw-mshc";
|
||||||
clock-freq-min-max = <400000 150000000>;
|
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
|
CONFIG_OF_SPL_REMOVE_PROPS option. The rest are processed. This will produce
|
||||||
the following C struct declaration:
|
the following C struct declaration:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
struct dtd_rockchip_rk3288_dw_mshc {
|
struct dtd_rockchip_rk3288_dw_mshc {
|
||||||
fdt32_t bus_width;
|
fdt32_t bus_width;
|
||||||
bool cap_mmc_highspeed;
|
bool cap_mmc_highspeed;
|
||||||
|
@ -129,6 +137,8 @@ struct dtd_rockchip_rk3288_dw_mshc {
|
||||||
|
|
||||||
and the following device declaration:
|
and the following device declaration:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
static struct dtd_rockchip_rk3288_dw_mshc dtv_dwmmc_at_ff0c0000 = {
|
static struct dtd_rockchip_rk3288_dw_mshc dtv_dwmmc_at_ff0c0000 = {
|
||||||
.fifo_depth = 0x100,
|
.fifo_depth = 0x100,
|
||||||
.cap_sd_highspeed = true,
|
.cap_sd_highspeed = true,
|
||||||
|
@ -147,6 +157,7 @@ static struct dtd_rockchip_rk3288_dw_mshc dtv_dwmmc_at_ff0c0000 = {
|
||||||
.reg = {0xff0c0000, 0x4000},
|
.reg = {0xff0c0000, 0x4000},
|
||||||
.card_detect_delay = 0xc8,
|
.card_detect_delay = 0xc8,
|
||||||
};
|
};
|
||||||
|
|
||||||
U_BOOT_DEVICE(dwmmc_at_ff0c0000) = {
|
U_BOOT_DEVICE(dwmmc_at_ff0c0000) = {
|
||||||
.name = "rockchip_rk3288_dw_mshc",
|
.name = "rockchip_rk3288_dw_mshc",
|
||||||
.platdata = &dtv_dwmmc_at_ff0c0000,
|
.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
|
The device is then instantiated at run-time and the platform data can be
|
||||||
accessed using:
|
accessed using:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
struct dtd_rockchip_rk3288_dw_mshc *plat = dev_get_platdata(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
|
Where a node has multiple compatible strings, a #define is used to make them
|
||||||
equivalent, e.g.:
|
equivalent, e.g.:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
#define dtd_rockchip_rk3299_dw_mshc dtd_rockchip_rk3288_dw_mshc
|
#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:
|
For example:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
#include <dt-structs.h>
|
#include <dt-structs.h>
|
||||||
|
|
||||||
struct mmc_platdata {
|
struct mmc_platdata {
|
||||||
|
@ -317,8 +334,8 @@ Future work
|
||||||
- Complete the phandle feature
|
- Complete the phandle feature
|
||||||
- Move to using a full Python libfdt module
|
- Move to using a full Python libfdt module
|
||||||
|
|
||||||
--
|
|
||||||
Simon Glass <sjg@chromium.org>
|
.. Simon Glass <sjg@chromium.org>
|
||||||
Google, Inc
|
.. Google, Inc
|
||||||
6/6/16
|
.. 6/6/16
|
||||||
Updated Independence Day 2016
|
.. Updated Independence Day 2016
|
Loading…
Add table
Add a link
Reference in a new issue