diff mbox series

[v3,1/5] doc: board: colibri_imx7: add readme.rst

Message ID 20200211151955.8203-1-igor.opaniuk@gmail.com
State Superseded
Headers show
Series [v3,1/5] doc: board: colibri_imx7: add readme.rst | expand

Commit Message

Igor Opaniuk Feb. 11, 2020, 3:19 p.m. UTC
From: Igor Opaniuk <igor.opaniuk at toradex.com>

- add initial index for toradex boards reST documentation
- add initial readme.rst file which provides all needed information
for obtaining a workable image ready for flashing
for both eMMC/NAND versions of Colibri iMX7.

Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
---

 doc/board/index.rst                |   1 +
 doc/board/toradex/colibri_imx7.rst | 128 +++++++++++++++++++++++++++++
 doc/board/toradex/index.rst        |   9 ++
 3 files changed, 138 insertions(+)
 create mode 100644 doc/board/toradex/colibri_imx7.rst
 create mode 100644 doc/board/toradex/index.rst

Comments

Heinrich Schuchardt Feb. 11, 2020, 5:04 p.m. UTC | #1
On 2/11/20 4:19 PM, Igor Opaniuk wrote:
> From: Igor Opaniuk <igor.opaniuk at toradex.com>
>
> - add initial index for toradex boards reST documentation
> - add initial readme.rst file which provides all needed information
> for obtaining a workable image ready for flashing
> for both eMMC/NAND versions of Colibri iMX7.

Please, run checkpatch on your patch set:

ERROR: trailing whitespace
#196: FILE: doc/board/toradex/colibri_imx7.rst:66:
+* ``877ff400`` - IVT self address^M$

ERROR: DOS line endings
#273: FILE: doc/board/toradex/index.rst:9:
+   colibri_imx7^M$

Best regards

Heinrich

>
> Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
> ---
>
>   doc/board/index.rst                |   1 +
>   doc/board/toradex/colibri_imx7.rst | 128 +++++++++++++++++++++++++++++
>   doc/board/toradex/index.rst        |   9 ++
>   3 files changed, 138 insertions(+)
>   create mode 100644 doc/board/toradex/colibri_imx7.rst
>   create mode 100644 doc/board/toradex/index.rst
>
> diff --git a/doc/board/index.rst b/doc/board/index.rst
> index 00e72f57cd..f2f5907b8c 100644
> --- a/doc/board/index.rst
> +++ b/doc/board/index.rst
> @@ -15,4 +15,5 @@ Board-specific doc
>      intel/index
>      renesas/index
>      sifive/index
> +   toradex/index
>      xilinx/index
> diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst
> new file mode 100644
> index 0000000000..9d770251af
> --- /dev/null
> +++ b/doc/board/toradex/colibri_imx7.rst
> @@ -0,0 +1,128 @@
> +.. SPDX-License-Identifier: GPL-2.0+
> +
> +Colibri iMX7
> +=======================
> +
> +Quick Start
> +-----------
> +
> +- Build U-Boot
> +- NAND IMX image adjustments before flashing
> +- Flashing manually U-Boot to eMMC
> +- Flashing manually U-Boot to NAND
> +- Using ``update_uboot`` script
> +
> +Build U-Boot
> +------------
> +
> +.. code-block:: bash
> +
> +    $ export CROSS_COMPILE=arm-linux-gnueabi-
> +    $ export ARCH=arm
> +    $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
> +    $ make
> +
> +After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific
> +image, ready for flashing (but check next section for additional
> +adjustments).
> +
> +Final IMX program image includes (section ``6.6.7`` from `IMX7DRM
> +<https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
> +
> +* **Image vector table** (IVT) for BootROM
> +* **Boot data** -indicates the program image location, program image size
> +  in bytes, and the plugin flag.
> +* **Device configuration data**
> +* **User image**: U-Boot image (``u-boot-dtb.bin``)
> +
> +
> +IMX image adjustments prior to flashing
> +--------------------------------------------
> +
> +1. U-Boot for both Colibri iMX7 NAND and eMMC versions
> +is built with HABv4 support (`AN4581.pdf
> +<https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
> +enabled by default, which requires to generate a proper
> +Command Sequence File (CSF) by srktool from NXP (not included in the
> +U-Boot tree, check additional details in introduction_habv4.txt)
> +and concatenate it to the final ``u-boot-dtb.imx``.
> +
> +2. In case if you don't want to generate a proper ``CSF`` (for any reason),
> +you still need to pad the IMX image so i has the same size as specified in
> +in **Boot Data** section of IMX image.
> +To obtain this value, run:
> +
> +.. code-block:: bash
> +
> +    $ od -X -N 0x30 u-boot-dtb.imx
> +    0000000    402000d1 87800000 00000000 877ff42c
> +    0000020    877ff420 877ff400 878a5000 00000000
> +                        ^^^^^^^^
> +    0000040    877ff000 000a8060 00000000 40b401d2
> +               ^^^^^^^^ ^^^^^^^^
> +
> +Where:
> +
> +* ``877ff400`` - IVT self address
> +* ``877ff000`` - Program image address
> +* ``000a8060`` - Program image size
> +
> +To calculate the padding:
> +
> +* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
> +* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
> +
> +and then pad the image:
> +
> +.. code-block:: bash
> +
> +    $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
> +        u-boot-dtb.imx u-boot-dtb.imx.zero-padded
> +
> +3. Also, according to requirement from ``6.6.7.1``, the final image
> +should have ``0x400`` offset for initial IVT table.
> +
> +For eMMC setup we handle this by flashing it to ``0x400``, howewer
> +for NAND setup we adjust the image prior to flashing, adding padding in the
> +beginning of the image.
> +
> +.. code-block:: bash
> +
> +    $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
> +
> +Flash U-Boot IMX image to eMMC
> +------------------------------
> +
> +Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
> +boot area partition:
> +
> +.. code-block:: bash
> +
> +
> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
> +    => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
> +    => mmc dev 0 1
> +    => mmc write ${loadaddr} 0x2 ${blkcnt}
> +
> +Flash U-Boot IMX image to NAND
> +------------------------------
> +
> +.. code-block:: bash
> +
> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> +    => nand erase.part u-boot1
> +    => nand write ${loadaddr} u-boot1 ${filesize}
> +    => nand erase.part u-boot2
> +    => nand write ${loadaddr} u-boot2 ${filesize}
> +
> +Using update_uboot script
> +-------------------------
> +
> +You can also usb U-Boot env update_uboot script,
> +which wraps all eMMC/NAND specific command invocation:
> +
> +.. code-block:: bash
> +
> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> +    => run update_uboot
> +
> diff --git a/doc/board/toradex/index.rst b/doc/board/toradex/index.rst
> new file mode 100644
> index 0000000000..aa418d6bad
> --- /dev/null
> +++ b/doc/board/toradex/index.rst
> @@ -0,0 +1,9 @@
> +.. SPDX-License-Identifier: GPL-2.0+
> +
> +Toradex
> +=======
> +
> +.. toctree::
> +   :maxdepth: 2
> +
> +   colibri_imx7
>
Igor Opaniuk Feb. 11, 2020, 7:37 p.m. UTC | #2
Hi Heinrich,

On Tue, Feb 11, 2020 at 7:04 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 2/11/20 4:19 PM, Igor Opaniuk wrote:
> > From: Igor Opaniuk <igor.opaniuk at toradex.com>
> >
> > - add initial index for toradex boards reST documentation
> > - add initial readme.rst file which provides all needed information
> > for obtaining a workable image ready for flashing
> > for both eMMC/NAND versions of Colibri iMX7.
>
> Please, run checkpatch on your patch set:
>
I did, and this is strange, because in my case it didn't report anything.
I do use patman, so checkpatch is forced everytime,
so I would definitely catch these issues.

In my case it was just 4 warnings:
Interesting thing is that it does report also 4 warnings and that's it
for this 5 patches:
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
checkpatch.pl found 0 error(s), 4 warning(s), 0 checks(s)

Magic?

> ERROR: trailing whitespace
> #196: FILE: doc/board/toradex/colibri_imx7.rst:66:
> +* ``877ff400`` - IVT self address^M$
>
> ERROR: DOS line endings
> #273: FILE: doc/board/toradex/index.rst:9:
> +   colibri_imx7^M$
>
> Best regards
>
> Heinrich
>
> >
> > Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
> > ---
> >
> >   doc/board/index.rst                |   1 +
> >   doc/board/toradex/colibri_imx7.rst | 128 +++++++++++++++++++++++++++++
> >   doc/board/toradex/index.rst        |   9 ++
> >   3 files changed, 138 insertions(+)
> >   create mode 100644 doc/board/toradex/colibri_imx7.rst
> >   create mode 100644 doc/board/toradex/index.rst
> >
> > diff --git a/doc/board/index.rst b/doc/board/index.rst
> > index 00e72f57cd..f2f5907b8c 100644
> > --- a/doc/board/index.rst
> > +++ b/doc/board/index.rst
> > @@ -15,4 +15,5 @@ Board-specific doc
> >      intel/index
> >      renesas/index
> >      sifive/index
> > +   toradex/index
> >      xilinx/index
> > diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst
> > new file mode 100644
> > index 0000000000..9d770251af
> > --- /dev/null
> > +++ b/doc/board/toradex/colibri_imx7.rst
> > @@ -0,0 +1,128 @@
> > +.. SPDX-License-Identifier: GPL-2.0+
> > +
> > +Colibri iMX7
> > +=======================
> > +
> > +Quick Start
> > +-----------
> > +
> > +- Build U-Boot
> > +- NAND IMX image adjustments before flashing
> > +- Flashing manually U-Boot to eMMC
> > +- Flashing manually U-Boot to NAND
> > +- Using ``update_uboot`` script
> > +
> > +Build U-Boot
> > +------------
> > +
> > +.. code-block:: bash
> > +
> > +    $ export CROSS_COMPILE=arm-linux-gnueabi-
> > +    $ export ARCH=arm
> > +    $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
> > +    $ make
> > +
> > +After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific
> > +image, ready for flashing (but check next section for additional
> > +adjustments).
> > +
> > +Final IMX program image includes (section ``6.6.7`` from `IMX7DRM
> > +<https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
> > +
> > +* **Image vector table** (IVT) for BootROM
> > +* **Boot data** -indicates the program image location, program image size
> > +  in bytes, and the plugin flag.
> > +* **Device configuration data**
> > +* **User image**: U-Boot image (``u-boot-dtb.bin``)
> > +
> > +
> > +IMX image adjustments prior to flashing
> > +--------------------------------------------
> > +
> > +1. U-Boot for both Colibri iMX7 NAND and eMMC versions
> > +is built with HABv4 support (`AN4581.pdf
> > +<https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
> > +enabled by default, which requires to generate a proper
> > +Command Sequence File (CSF) by srktool from NXP (not included in the
> > +U-Boot tree, check additional details in introduction_habv4.txt)
> > +and concatenate it to the final ``u-boot-dtb.imx``.
> > +
> > +2. In case if you don't want to generate a proper ``CSF`` (for any reason),
> > +you still need to pad the IMX image so i has the same size as specified in
> > +in **Boot Data** section of IMX image.
> > +To obtain this value, run:
> > +
> > +.. code-block:: bash
> > +
> > +    $ od -X -N 0x30 u-boot-dtb.imx
> > +    0000000    402000d1 87800000 00000000 877ff42c
> > +    0000020    877ff420 877ff400 878a5000 00000000
> > +                        ^^^^^^^^
> > +    0000040    877ff000 000a8060 00000000 40b401d2
> > +               ^^^^^^^^ ^^^^^^^^
> > +
> > +Where:
> > +
> > +* ``877ff400`` - IVT self address
> > +* ``877ff000`` - Program image address
> > +* ``000a8060`` - Program image size
> > +
> > +To calculate the padding:
> > +
> > +* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
> > +* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
> > +
> > +and then pad the image:
> > +
> > +.. code-block:: bash
> > +
> > +    $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
> > +        u-boot-dtb.imx u-boot-dtb.imx.zero-padded
> > +
> > +3. Also, according to requirement from ``6.6.7.1``, the final image
> > +should have ``0x400`` offset for initial IVT table.
> > +
> > +For eMMC setup we handle this by flashing it to ``0x400``, howewer
> > +for NAND setup we adjust the image prior to flashing, adding padding in the
> > +beginning of the image.
> > +
> > +.. code-block:: bash
> > +
> > +    $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
> > +
> > +Flash U-Boot IMX image to eMMC
> > +------------------------------
> > +
> > +Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
> > +boot area partition:
> > +
> > +.. code-block:: bash
> > +
> > +
> > +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
> > +    => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
> > +    => mmc dev 0 1
> > +    => mmc write ${loadaddr} 0x2 ${blkcnt}
> > +
> > +Flash U-Boot IMX image to NAND
> > +------------------------------
> > +
> > +.. code-block:: bash
> > +
> > +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> > +    => nand erase.part u-boot1
> > +    => nand write ${loadaddr} u-boot1 ${filesize}
> > +    => nand erase.part u-boot2
> > +    => nand write ${loadaddr} u-boot2 ${filesize}
> > +
> > +Using update_uboot script
> > +-------------------------
> > +
> > +You can also usb U-Boot env update_uboot script,
> > +which wraps all eMMC/NAND specific command invocation:
> > +
> > +.. code-block:: bash
> > +
> > +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> > +    => run update_uboot
> > +
> > diff --git a/doc/board/toradex/index.rst b/doc/board/toradex/index.rst
> > new file mode 100644
> > index 0000000000..aa418d6bad
> > --- /dev/null
> > +++ b/doc/board/toradex/index.rst
> > @@ -0,0 +1,9 @@
> > +.. SPDX-License-Identifier: GPL-2.0+
> > +
> > +Toradex
> > +=======
> > +
> > +.. toctree::
> > +   :maxdepth: 2
> > +
> > +   colibri_imx7
> >
>
Igor Opaniuk Feb. 11, 2020, 7:56 p.m. UTC | #3
Heinrich,

On Tue, Feb 11, 2020 at 9:37 PM Igor Opaniuk <igor.opaniuk at gmail.com> wrote:
>
> Hi Heinrich,
>
> On Tue, Feb 11, 2020 at 7:04 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> >
> > On 2/11/20 4:19 PM, Igor Opaniuk wrote:
> > > From: Igor Opaniuk <igor.opaniuk at toradex.com>
> > >
> > > - add initial index for toradex boards reST documentation
> > > - add initial readme.rst file which provides all needed information
> > > for obtaining a workable image ready for flashing
> > > for both eMMC/NAND versions of Colibri iMX7.
> >
> > Please, run checkpatch on your patch set:
> >
> I did, and this is strange, because in my case it didn't report anything.
> I do use patman, so checkpatch is forced everytime,
> so I would definitely catch these issues.
>
> In my case it was just 4 warnings:
> Interesting thing is that it does report also 4 warnings and that's it
> for this 5 patches:
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> checkpatch.pl found 0 error(s), 4 warning(s), 0 checks(s)
>
> Magic?

u-boot-imx.git$ ./scripts/checkpatch.pl --no-tree -f doc/board/toradex/*
---------------------------------
doc/board/toradex/apalix-imx8.rst
---------------------------------
total: 0 errors, 0 warnings, 0 checks, 83 lines checked

doc/board/toradex/apalix-imx8.rst has no obvious style problems and is
ready for submission.
----------------------------------
doc/board/toradex/colibri_imx7.rst
----------------------------------
total: 0 errors, 0 warnings, 0 checks, 128 lines checked

doc/board/toradex/colibri_imx7.rst has no obvious style problems and
is ready for submission.
-----------------------------------
doc/board/toradex/colibri-imx8x.rst
-----------------------------------
total: 0 errors, 0 warnings, 0 checks, 82 lines checked

doc/board/toradex/colibri-imx8x.rst has no obvious style problems and
is ready for submission.
---------------------------
doc/board/toradex/index.rst
---------------------------
total: 0 errors, 0 warnings, 0 checks, 12 lines checked

doc/board/toradex/index.rst has no obvious style problems and is ready
for submission.
-----------------------------------
doc/board/toradex/verdin-imx8mm.rst
-----------------------------------
total: 0 errors, 0 warnings, 0 checks, 112 lines checked

doc/board/toradex/verdin-imx8mm.rst has no obvious style problems and
is ready for submission.

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE
PREFER_ETHER_ADDR_COPY USLEEP_RANGE

>
> > ERROR: trailing whitespace
> > #196: FILE: doc/board/toradex/colibri_imx7.rst:66:
> > +* ``877ff400`` - IVT self address^M$
> >
> > ERROR: DOS line endings
> > #273: FILE: doc/board/toradex/index.rst:9:
> > +   colibri_imx7^M$
> >
> > Best regards
> >
> > Heinrich
> >
> > >
> > > Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
> > > ---
> > >
> > >   doc/board/index.rst                |   1 +
> > >   doc/board/toradex/colibri_imx7.rst | 128 +++++++++++++++++++++++++++++
> > >   doc/board/toradex/index.rst        |   9 ++
> > >   3 files changed, 138 insertions(+)
> > >   create mode 100644 doc/board/toradex/colibri_imx7.rst
> > >   create mode 100644 doc/board/toradex/index.rst
> > >
> > > diff --git a/doc/board/index.rst b/doc/board/index.rst
> > > index 00e72f57cd..f2f5907b8c 100644
> > > --- a/doc/board/index.rst
> > > +++ b/doc/board/index.rst
> > > @@ -15,4 +15,5 @@ Board-specific doc
> > >      intel/index
> > >      renesas/index
> > >      sifive/index
> > > +   toradex/index
> > >      xilinx/index
> > > diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst
> > > new file mode 100644
> > > index 0000000000..9d770251af
> > > --- /dev/null
> > > +++ b/doc/board/toradex/colibri_imx7.rst
> > > @@ -0,0 +1,128 @@
> > > +.. SPDX-License-Identifier: GPL-2.0+
> > > +
> > > +Colibri iMX7
> > > +=======================
> > > +
> > > +Quick Start
> > > +-----------
> > > +
> > > +- Build U-Boot
> > > +- NAND IMX image adjustments before flashing
> > > +- Flashing manually U-Boot to eMMC
> > > +- Flashing manually U-Boot to NAND
> > > +- Using ``update_uboot`` script
> > > +
> > > +Build U-Boot
> > > +------------
> > > +
> > > +.. code-block:: bash
> > > +
> > > +    $ export CROSS_COMPILE=arm-linux-gnueabi-
> > > +    $ export ARCH=arm
> > > +    $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
> > > +    $ make
> > > +
> > > +After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific
> > > +image, ready for flashing (but check next section for additional
> > > +adjustments).
> > > +
> > > +Final IMX program image includes (section ``6.6.7`` from `IMX7DRM
> > > +<https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
> > > +
> > > +* **Image vector table** (IVT) for BootROM
> > > +* **Boot data** -indicates the program image location, program image size
> > > +  in bytes, and the plugin flag.
> > > +* **Device configuration data**
> > > +* **User image**: U-Boot image (``u-boot-dtb.bin``)
> > > +
> > > +
> > > +IMX image adjustments prior to flashing
> > > +--------------------------------------------
> > > +
> > > +1. U-Boot for both Colibri iMX7 NAND and eMMC versions
> > > +is built with HABv4 support (`AN4581.pdf
> > > +<https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
> > > +enabled by default, which requires to generate a proper
> > > +Command Sequence File (CSF) by srktool from NXP (not included in the
> > > +U-Boot tree, check additional details in introduction_habv4.txt)
> > > +and concatenate it to the final ``u-boot-dtb.imx``.
> > > +
> > > +2. In case if you don't want to generate a proper ``CSF`` (for any reason),
> > > +you still need to pad the IMX image so i has the same size as specified in
> > > +in **Boot Data** section of IMX image.
> > > +To obtain this value, run:
> > > +
> > > +.. code-block:: bash
> > > +
> > > +    $ od -X -N 0x30 u-boot-dtb.imx
> > > +    0000000    402000d1 87800000 00000000 877ff42c
> > > +    0000020    877ff420 877ff400 878a5000 00000000
> > > +                        ^^^^^^^^
> > > +    0000040    877ff000 000a8060 00000000 40b401d2
> > > +               ^^^^^^^^ ^^^^^^^^
> > > +
> > > +Where:
> > > +
> > > +* ``877ff400`` - IVT self address
> > > +* ``877ff000`` - Program image address
> > > +* ``000a8060`` - Program image size
> > > +
> > > +To calculate the padding:
> > > +
> > > +* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
> > > +* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
> > > +
> > > +and then pad the image:
> > > +
> > > +.. code-block:: bash
> > > +
> > > +    $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
> > > +        u-boot-dtb.imx u-boot-dtb.imx.zero-padded
> > > +
> > > +3. Also, according to requirement from ``6.6.7.1``, the final image
> > > +should have ``0x400`` offset for initial IVT table.
> > > +
> > > +For eMMC setup we handle this by flashing it to ``0x400``, howewer
> > > +for NAND setup we adjust the image prior to flashing, adding padding in the
> > > +beginning of the image.
> > > +
> > > +.. code-block:: bash
> > > +
> > > +    $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
> > > +
> > > +Flash U-Boot IMX image to eMMC
> > > +------------------------------
> > > +
> > > +Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
> > > +boot area partition:
> > > +
> > > +.. code-block:: bash
> > > +
> > > +
> > > +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
> > > +    => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
> > > +    => mmc dev 0 1
> > > +    => mmc write ${loadaddr} 0x2 ${blkcnt}
> > > +
> > > +Flash U-Boot IMX image to NAND
> > > +------------------------------
> > > +
> > > +.. code-block:: bash
> > > +
> > > +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> > > +    => nand erase.part u-boot1
> > > +    => nand write ${loadaddr} u-boot1 ${filesize}
> > > +    => nand erase.part u-boot2
> > > +    => nand write ${loadaddr} u-boot2 ${filesize}
> > > +
> > > +Using update_uboot script
> > > +-------------------------
> > > +
> > > +You can also usb U-Boot env update_uboot script,
> > > +which wraps all eMMC/NAND specific command invocation:
> > > +
> > > +.. code-block:: bash
> > > +
> > > +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> > > +    => run update_uboot
> > > +
> > > diff --git a/doc/board/toradex/index.rst b/doc/board/toradex/index.rst
> > > new file mode 100644
> > > index 0000000000..aa418d6bad
> > > --- /dev/null
> > > +++ b/doc/board/toradex/index.rst
> > > @@ -0,0 +1,9 @@
> > > +.. SPDX-License-Identifier: GPL-2.0+
> > > +
> > > +Toradex
> > > +=======
> > > +
> > > +.. toctree::
> > > +   :maxdepth: 2
> > > +
> > > +   colibri_imx7
> > >
> >
>
>
> --
> Best regards - Freundliche Grüsse - Meilleures salutations
>
> Igor Opaniuk
>
> mailto: igor.opaniuk at gmail.com
> skype: igor.opanyuk
> +380 (93) 836 40 67
> http://ua.linkedin.com/in/iopaniuk
Heinrich Schuchardt Feb. 11, 2020, 9:32 p.m. UTC | #4
On 2/11/20 8:56 PM, Igor Opaniuk wrote:
> Heinrich,
>
> On Tue, Feb 11, 2020 at 9:37 PM Igor Opaniuk <igor.opaniuk at gmail.com> wrote:
>>
>> Hi Heinrich,
>>
>> On Tue, Feb 11, 2020 at 7:04 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>>>
>>> On 2/11/20 4:19 PM, Igor Opaniuk wrote:
>>>> From: Igor Opaniuk <igor.opaniuk at toradex.com>
>>>>
>>>> - add initial index for toradex boards reST documentation
>>>> - add initial readme.rst file which provides all needed information
>>>> for obtaining a workable image ready for flashing
>>>> for both eMMC/NAND versions of Colibri iMX7.
>>>
>>> Please, run checkpatch on your patch set:
>>>
>> I did, and this is strange, because in my case it didn't report anything.
>> I do use patman, so checkpatch is forced everytime,
>> so I would definitely catch these issues.
>>
>> In my case it was just 4 warnings:
>> Interesting thing is that it does report also 4 warnings and that's it
>> for this 5 patches:
>> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
>> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
>> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
>> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
>> checkpatch.pl found 0 error(s), 4 warning(s), 0 checks(s)
>>
>> Magic?
>
> u-boot-imx.git$ ./scripts/checkpatch.pl --no-tree -f doc/board/toradex/*
> ---------------------------------
> doc/board/toradex/apalix-imx8.rst
> ---------------------------------
> total: 0 errors, 0 warnings, 0 checks, 83 lines checked
>
> doc/board/toradex/apalix-imx8.rst has no obvious style problems and is
> ready for submission.
> ----------------------------------
> doc/board/toradex/colibri_imx7.rst
> ----------------------------------
> total: 0 errors, 0 warnings, 0 checks, 128 lines checked
>
> doc/board/toradex/colibri_imx7.rst has no obvious style problems and
> is ready for submission.
> -----------------------------------
> doc/board/toradex/colibri-imx8x.rst
> -----------------------------------
> total: 0 errors, 0 warnings, 0 checks, 82 lines checked
>
> doc/board/toradex/colibri-imx8x.rst has no obvious style problems and
> is ready for submission.
> ---------------------------
> doc/board/toradex/index.rst
> ---------------------------
> total: 0 errors, 0 warnings, 0 checks, 12 lines checked
>
> doc/board/toradex/index.rst has no obvious style problems and is ready
> for submission.
> -----------------------------------
> doc/board/toradex/verdin-imx8mm.rst
> -----------------------------------
> total: 0 errors, 0 warnings, 0 checks, 112 lines checked
>
> doc/board/toradex/verdin-imx8mm.rst has no obvious style problems and
> is ready for submission.
>
> NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE
> PREFER_ETHER_ADDR_COPY USLEEP_RANGE
>
>>
>>> ERROR: trailing whitespace
>>> #196: FILE: doc/board/toradex/colibri_imx7.rst:66:
>>> +* ``877ff400`` - IVT self address^M$
>>>
>>> ERROR: DOS line endings
>>> #273: FILE: doc/board/toradex/index.rst:9:
>>> +   colibri_imx7^M$
>>>
>>> Best regards
>>>
>>> Heinrich
>>>
>>>>
>>>> Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
>>>> ---
>>>>
>>>>    doc/board/index.rst                |   1 +
>>>>    doc/board/toradex/colibri_imx7.rst | 128 +++++++++++++++++++++++++++++
>>>>    doc/board/toradex/index.rst        |   9 ++
>>>>    3 files changed, 138 insertions(+)
>>>>    create mode 100644 doc/board/toradex/colibri_imx7.rst
>>>>    create mode 100644 doc/board/toradex/index.rst
>>>>
>>>> diff --git a/doc/board/index.rst b/doc/board/index.rst
>>>> index 00e72f57cd..f2f5907b8c 100644
>>>> --- a/doc/board/index.rst
>>>> +++ b/doc/board/index.rst
>>>> @@ -15,4 +15,5 @@ Board-specific doc
>>>>       intel/index
>>>>       renesas/index
>>>>       sifive/index
>>>> +   toradex/index
>>>>       xilinx/index
>>>> diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst
>>>> new file mode 100644
>>>> index 0000000000..9d770251af
>>>> --- /dev/null
>>>> +++ b/doc/board/toradex/colibri_imx7.rst
>>>> @@ -0,0 +1,128 @@
>>>> +.. SPDX-License-Identifier: GPL-2.0+
>>>> +
>>>> +Colibri iMX7
>>>> +=======================
>>>> +
>>>> +Quick Start
>>>> +-----------
>>>> +
>>>> +- Build U-Boot
>>>> +- NAND IMX image adjustments before flashing
>>>> +- Flashing manually U-Boot to eMMC
>>>> +- Flashing manually U-Boot to NAND
>>>> +- Using ``update_uboot`` script
>>>> +
>>>> +Build U-Boot
>>>> +------------
>>>> +
>>>> +.. code-block:: bash
>>>> +
>>>> +    $ export CROSS_COMPILE=arm-linux-gnueabi-
>>>> +    $ export ARCH=arm
>>>> +    $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
>>>> +    $ make
>>>> +
>>>> +After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific
>>>> +image, ready for flashing (but check next section for additional
>>>> +adjustments).
>>>> +
>>>> +Final IMX program image includes (section ``6.6.7`` from `IMX7DRM
>>>> +<https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
>>>> +
>>>> +* **Image vector table** (IVT) for BootROM
>>>> +* **Boot data** -indicates the program image location, program image size
>>>> +  in bytes, and the plugin flag.
>>>> +* **Device configuration data**
>>>> +* **User image**: U-Boot image (``u-boot-dtb.bin``)
>>>> +
>>>> +
>>>> +IMX image adjustments prior to flashing
>>>> +--------------------------------------------
>>>> +
>>>> +1. U-Boot for both Colibri iMX7 NAND and eMMC versions
>>>> +is built with HABv4 support (`AN4581.pdf
>>>> +<https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
>>>> +enabled by default, which requires to generate a proper
>>>> +Command Sequence File (CSF) by srktool from NXP (not included in the
>>>> +U-Boot tree, check additional details in introduction_habv4.txt)
>>>> +and concatenate it to the final ``u-boot-dtb.imx``.
>>>> +
>>>> +2. In case if you don't want to generate a proper ``CSF`` (for any reason),
>>>> +you still need to pad the IMX image so i has the same size as specified in
>>>> +in **Boot Data** section of IMX image.
>>>> +To obtain this value, run:
>>>> +
>>>> +.. code-block:: bash
>>>> +
>>>> +    $ od -X -N 0x30 u-boot-dtb.imx
>>>> +    0000000    402000d1 87800000 00000000 877ff42c
>>>> +    0000020    877ff420 877ff400 878a5000 00000000
>>>> +                        ^^^^^^^^
>>>> +    0000040    877ff000 000a8060 00000000 40b401d2
>>>> +               ^^^^^^^^ ^^^^^^^^
>>>> +
>>>> +Where:
>>>> +
>>>> +* ``877ff400`` - IVT self address
>>>> +* ``877ff000`` - Program image address
>>>> +* ``000a8060`` - Program image size
>>>> +
>>>> +To calculate the padding:
>>>> +
>>>> +* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
>>>> +* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
>>>> +
>>>> +and then pad the image:
>>>> +
>>>> +.. code-block:: bash
>>>> +
>>>> +    $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
>>>> +        u-boot-dtb.imx u-boot-dtb.imx.zero-padded
>>>> +
>>>> +3. Also, according to requirement from ``6.6.7.1``, the final image
>>>> +should have ``0x400`` offset for initial IVT table.
>>>> +
>>>> +For eMMC setup we handle this by flashing it to ``0x400``, howewer
>>>> +for NAND setup we adjust the image prior to flashing, adding padding in the
>>>> +beginning of the image.
>>>> +
>>>> +.. code-block:: bash
>>>> +
>>>> +    $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
>>>> +
>>>> +Flash U-Boot IMX image to eMMC
>>>> +------------------------------
>>>> +
>>>> +Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
>>>> +boot area partition:
>>>> +
>>>> +.. code-block:: bash
>>>> +
>>>> +
>>>> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
>>>> +    => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
>>>> +    => mmc dev 0 1
>>>> +    => mmc write ${loadaddr} 0x2 ${blkcnt}
>>>> +
>>>> +Flash U-Boot IMX image to NAND
>>>> +------------------------------
>>>> +
>>>> +.. code-block:: bash
>>>> +
>>>> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
>>>> +    => nand erase.part u-boot1
>>>> +    => nand write ${loadaddr} u-boot1 ${filesize}
>>>> +    => nand erase.part u-boot2
>>>> +    => nand write ${loadaddr} u-boot2 ${filesize}
>>>> +
>>>> +Using update_uboot script
>>>> +-------------------------
>>>> +
>>>> +You can also usb U-Boot env update_uboot script,
>>>> +which wraps all eMMC/NAND specific command invocation:
>>>> +
>>>> +.. code-block:: bash
>>>> +
>>>> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
>>>> +    => run update_uboot
>>>> +
>>>> diff --git a/doc/board/toradex/index.rst b/doc/board/toradex/index.rst
>>>> new file mode 100644
>>>> index 0000000000..aa418d6bad
>>>> --- /dev/null
>>>> +++ b/doc/board/toradex/index.rst
>>>> @@ -0,0 +1,9 @@
>>>> +.. SPDX-License-Identifier: GPL-2.0+
>>>> +
>>>> +Toradex
>>>> +=======
>>>> +
>>>> +.. toctree::
>>>> +   :maxdepth: 2
>>>> +
>>>> +   colibri_imx7
>>>>
>>>
>>
>>
>> --
>> Best regards - Freundliche Grüsse - Meilleures salutations
>>
>> Igor Opaniuk

I guess my failure was to run the checkpacht.pl directly on the saved
mail messages and not first apply the patches and then to use git
format-patch to get the cleaned form.

After git am and git format-patch this patch checkpatch.pl does not
complain any more.

The only message I see when reapplying the patch is:

git am 0001-doc-board-colibri_imx7-add-readme.rst.patch
Applying: doc: board: colibri_imx7: add readme.rst
.git/rebase-apply/patch:152: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

due to a blank line at the end of
doc/board/toradex/colibri_imx7.rst

Best regards

Heinrich

>>
>> mailto: igor.opaniuk at gmail.com
>> skype: igor.opanyuk
>> +380 (93) 836 40 67
>> http://ua.linkedin.com/in/iopaniuk
>
>
>
Igor Opaniuk Feb. 12, 2020, 2:47 p.m. UTC | #5
Hi Heinrich,

On Tue, Feb 11, 2020 at 11:32 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 2/11/20 8:56 PM, Igor Opaniuk wrote:
> > Heinrich,
> >
> > On Tue, Feb 11, 2020 at 9:37 PM Igor Opaniuk <igor.opaniuk at gmail.com> wrote:
> >>
> >> Hi Heinrich,
> >>
> >> On Tue, Feb 11, 2020 at 7:04 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> >>>
> >>> On 2/11/20 4:19 PM, Igor Opaniuk wrote:
> >>>> From: Igor Opaniuk <igor.opaniuk at toradex.com>
> >>>>
> >>>> - add initial index for toradex boards reST documentation
> >>>> - add initial readme.rst file which provides all needed information
> >>>> for obtaining a workable image ready for flashing
> >>>> for both eMMC/NAND versions of Colibri iMX7.
> >>>
> >>> Please, run checkpatch on your patch set:
> >>>
> >> I did, and this is strange, because in my case it didn't report anything.
> >> I do use patman, so checkpatch is forced everytime,
> >> so I would definitely catch these issues.
> >>
> >> In my case it was just 4 warnings:
> >> Interesting thing is that it does report also 4 warnings and that's it
> >> for this 5 patches:
> >> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> >> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> >> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> >> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> >> checkpatch.pl found 0 error(s), 4 warning(s), 0 checks(s)
> >>
> >> Magic?
> >
> > u-boot-imx.git$ ./scripts/checkpatch.pl --no-tree -f doc/board/toradex/*
> > ---------------------------------
> > doc/board/toradex/apalix-imx8.rst
> > ---------------------------------
> > total: 0 errors, 0 warnings, 0 checks, 83 lines checked
> >
> > doc/board/toradex/apalix-imx8.rst has no obvious style problems and is
> > ready for submission.
> > ----------------------------------
> > doc/board/toradex/colibri_imx7.rst
> > ----------------------------------
> > total: 0 errors, 0 warnings, 0 checks, 128 lines checked
> >
> > doc/board/toradex/colibri_imx7.rst has no obvious style problems and
> > is ready for submission.
> > -----------------------------------
> > doc/board/toradex/colibri-imx8x.rst
> > -----------------------------------
> > total: 0 errors, 0 warnings, 0 checks, 82 lines checked
> >
> > doc/board/toradex/colibri-imx8x.rst has no obvious style problems and
> > is ready for submission.
> > ---------------------------
> > doc/board/toradex/index.rst
> > ---------------------------
> > total: 0 errors, 0 warnings, 0 checks, 12 lines checked
> >
> > doc/board/toradex/index.rst has no obvious style problems and is ready
> > for submission.
> > -----------------------------------
> > doc/board/toradex/verdin-imx8mm.rst
> > -----------------------------------
> > total: 0 errors, 0 warnings, 0 checks, 112 lines checked
> >
> > doc/board/toradex/verdin-imx8mm.rst has no obvious style problems and
> > is ready for submission.
> >
> > NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> > MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE
> > PREFER_ETHER_ADDR_COPY USLEEP_RANGE
> >
> >>
> >>> ERROR: trailing whitespace
> >>> #196: FILE: doc/board/toradex/colibri_imx7.rst:66:
> >>> +* ``877ff400`` - IVT self address^M$
> >>>
> >>> ERROR: DOS line endings
> >>> #273: FILE: doc/board/toradex/index.rst:9:
> >>> +   colibri_imx7^M$
> >>>
> >>> Best regards
> >>>
> >>> Heinrich
> >>>
> >>>>
> >>>> Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
> >>>> ---
> >>>>
> >>>>    doc/board/index.rst                |   1 +
> >>>>    doc/board/toradex/colibri_imx7.rst | 128 +++++++++++++++++++++++++++++
> >>>>    doc/board/toradex/index.rst        |   9 ++
> >>>>    3 files changed, 138 insertions(+)
> >>>>    create mode 100644 doc/board/toradex/colibri_imx7.rst
> >>>>    create mode 100644 doc/board/toradex/index.rst
> >>>>
> >>>> diff --git a/doc/board/index.rst b/doc/board/index.rst
> >>>> index 00e72f57cd..f2f5907b8c 100644
> >>>> --- a/doc/board/index.rst
> >>>> +++ b/doc/board/index.rst
> >>>> @@ -15,4 +15,5 @@ Board-specific doc
> >>>>       intel/index
> >>>>       renesas/index
> >>>>       sifive/index
> >>>> +   toradex/index
> >>>>       xilinx/index
> >>>> diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst
> >>>> new file mode 100644
> >>>> index 0000000000..9d770251af
> >>>> --- /dev/null
> >>>> +++ b/doc/board/toradex/colibri_imx7.rst
> >>>> @@ -0,0 +1,128 @@
> >>>> +.. SPDX-License-Identifier: GPL-2.0+
> >>>> +
> >>>> +Colibri iMX7
> >>>> +=======================
> >>>> +
> >>>> +Quick Start
> >>>> +-----------
> >>>> +
> >>>> +- Build U-Boot
> >>>> +- NAND IMX image adjustments before flashing
> >>>> +- Flashing manually U-Boot to eMMC
> >>>> +- Flashing manually U-Boot to NAND
> >>>> +- Using ``update_uboot`` script
> >>>> +
> >>>> +Build U-Boot
> >>>> +------------
> >>>> +
> >>>> +.. code-block:: bash
> >>>> +
> >>>> +    $ export CROSS_COMPILE=arm-linux-gnueabi-
> >>>> +    $ export ARCH=arm
> >>>> +    $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
> >>>> +    $ make
> >>>> +
> >>>> +After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific
> >>>> +image, ready for flashing (but check next section for additional
> >>>> +adjustments).
> >>>> +
> >>>> +Final IMX program image includes (section ``6.6.7`` from `IMX7DRM
> >>>> +<https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
> >>>> +
> >>>> +* **Image vector table** (IVT) for BootROM
> >>>> +* **Boot data** -indicates the program image location, program image size
> >>>> +  in bytes, and the plugin flag.
> >>>> +* **Device configuration data**
> >>>> +* **User image**: U-Boot image (``u-boot-dtb.bin``)
> >>>> +
> >>>> +
> >>>> +IMX image adjustments prior to flashing
> >>>> +--------------------------------------------
> >>>> +
> >>>> +1. U-Boot for both Colibri iMX7 NAND and eMMC versions
> >>>> +is built with HABv4 support (`AN4581.pdf
> >>>> +<https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
> >>>> +enabled by default, which requires to generate a proper
> >>>> +Command Sequence File (CSF) by srktool from NXP (not included in the
> >>>> +U-Boot tree, check additional details in introduction_habv4.txt)
> >>>> +and concatenate it to the final ``u-boot-dtb.imx``.
> >>>> +
> >>>> +2. In case if you don't want to generate a proper ``CSF`` (for any reason),
> >>>> +you still need to pad the IMX image so i has the same size as specified in
> >>>> +in **Boot Data** section of IMX image.
> >>>> +To obtain this value, run:
> >>>> +
> >>>> +.. code-block:: bash
> >>>> +
> >>>> +    $ od -X -N 0x30 u-boot-dtb.imx
> >>>> +    0000000    402000d1 87800000 00000000 877ff42c
> >>>> +    0000020    877ff420 877ff400 878a5000 00000000
> >>>> +                        ^^^^^^^^
> >>>> +    0000040    877ff000 000a8060 00000000 40b401d2
> >>>> +               ^^^^^^^^ ^^^^^^^^
> >>>> +
> >>>> +Where:
> >>>> +
> >>>> +* ``877ff400`` - IVT self address
> >>>> +* ``877ff000`` - Program image address
> >>>> +* ``000a8060`` - Program image size
> >>>> +
> >>>> +To calculate the padding:
> >>>> +
> >>>> +* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
> >>>> +* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
> >>>> +
> >>>> +and then pad the image:
> >>>> +
> >>>> +.. code-block:: bash
> >>>> +
> >>>> +    $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
> >>>> +        u-boot-dtb.imx u-boot-dtb.imx.zero-padded
> >>>> +
> >>>> +3. Also, according to requirement from ``6.6.7.1``, the final image
> >>>> +should have ``0x400`` offset for initial IVT table.
> >>>> +
> >>>> +For eMMC setup we handle this by flashing it to ``0x400``, howewer
> >>>> +for NAND setup we adjust the image prior to flashing, adding padding in the
> >>>> +beginning of the image.
> >>>> +
> >>>> +.. code-block:: bash
> >>>> +
> >>>> +    $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
> >>>> +
> >>>> +Flash U-Boot IMX image to eMMC
> >>>> +------------------------------
> >>>> +
> >>>> +Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
> >>>> +boot area partition:
> >>>> +
> >>>> +.. code-block:: bash
> >>>> +
> >>>> +
> >>>> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
> >>>> +    => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
> >>>> +    => mmc dev 0 1
> >>>> +    => mmc write ${loadaddr} 0x2 ${blkcnt}
> >>>> +
> >>>> +Flash U-Boot IMX image to NAND
> >>>> +------------------------------
> >>>> +
> >>>> +.. code-block:: bash
> >>>> +
> >>>> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> >>>> +    => nand erase.part u-boot1
> >>>> +    => nand write ${loadaddr} u-boot1 ${filesize}
> >>>> +    => nand erase.part u-boot2
> >>>> +    => nand write ${loadaddr} u-boot2 ${filesize}
> >>>> +
> >>>> +Using update_uboot script
> >>>> +-------------------------
> >>>> +
> >>>> +You can also usb U-Boot env update_uboot script,
> >>>> +which wraps all eMMC/NAND specific command invocation:
> >>>> +
> >>>> +.. code-block:: bash
> >>>> +
> >>>> +    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
> >>>> +    => run update_uboot
> >>>> +
> >>>> diff --git a/doc/board/toradex/index.rst b/doc/board/toradex/index.rst
> >>>> new file mode 100644
> >>>> index 0000000000..aa418d6bad
> >>>> --- /dev/null
> >>>> +++ b/doc/board/toradex/index.rst
> >>>> @@ -0,0 +1,9 @@
> >>>> +.. SPDX-License-Identifier: GPL-2.0+
> >>>> +
> >>>> +Toradex
> >>>> +=======
> >>>> +
> >>>> +.. toctree::
> >>>> +   :maxdepth: 2
> >>>> +
> >>>> +   colibri_imx7
> >>>>
> >>>
> >>
> >>
> >> --
> >> Best regards - Freundliche Gr?sse - Meilleures salutations
> >>
> >> Igor Opaniuk
>
> I guess my failure was to run the checkpacht.pl directly on the saved
> mail messages and not first apply the patches and then to use git
> format-patch to get the cleaned form.
>
> After git am and git format-patch this patch checkpatch.pl does not
> complain any more.
>
> The only message I see when reapplying the patch is:
>
> git am 0001-doc-board-colibri_imx7-add-readme.rst.patch
> Applying: doc: board: colibri_imx7: add readme.rst
> .git/rebase-apply/patch:152: new blank line at EOF.
> +
> warning: 1 line adds whitespace errors.
>
> due to a blank line at the end of
> doc/board/toradex/colibri_imx7.rst
Thanks for reporting, fixed that and sent v4.

Thanks!
>
> Best regards
>
> Heinrich
>
> >>
> >> mailto: igor.opaniuk at gmail.com
> >> skype: igor.opanyuk
> >> +380 (93) 836 40 67
> >> http://ua.linkedin.com/in/iopaniuk
> >
> >
> >
>
diff mbox series

Patch

diff --git a/doc/board/index.rst b/doc/board/index.rst
index 00e72f57cd..f2f5907b8c 100644
--- a/doc/board/index.rst
+++ b/doc/board/index.rst
@@ -15,4 +15,5 @@  Board-specific doc
    intel/index
    renesas/index
    sifive/index
+   toradex/index
    xilinx/index
diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst
new file mode 100644
index 0000000000..9d770251af
--- /dev/null
+++ b/doc/board/toradex/colibri_imx7.rst
@@ -0,0 +1,128 @@ 
+.. SPDX-License-Identifier: GPL-2.0+
+
+Colibri iMX7
+=======================
+
+Quick Start
+-----------
+
+- Build U-Boot
+- NAND IMX image adjustments before flashing
+- Flashing manually U-Boot to eMMC
+- Flashing manually U-Boot to NAND
+- Using ``update_uboot`` script
+
+Build U-Boot
+------------
+
+.. code-block:: bash
+
+    $ export CROSS_COMPILE=arm-linux-gnueabi-
+    $ export ARCH=arm
+    $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
+    $ make
+
+After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific
+image, ready for flashing (but check next section for additional
+adjustments).
+
+Final IMX program image includes (section ``6.6.7`` from `IMX7DRM
+<https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
+
+* **Image vector table** (IVT) for BootROM
+* **Boot data** -indicates the program image location, program image size
+  in bytes, and the plugin flag.
+* **Device configuration data**
+* **User image**: U-Boot image (``u-boot-dtb.bin``)
+
+
+IMX image adjustments prior to flashing
+--------------------------------------------
+
+1. U-Boot for both Colibri iMX7 NAND and eMMC versions
+is built with HABv4 support (`AN4581.pdf
+<https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
+enabled by default, which requires to generate a proper
+Command Sequence File (CSF) by srktool from NXP (not included in the
+U-Boot tree, check additional details in introduction_habv4.txt)
+and concatenate it to the final ``u-boot-dtb.imx``.
+
+2. In case if you don't want to generate a proper ``CSF`` (for any reason),
+you still need to pad the IMX image so i has the same size as specified in
+in **Boot Data** section of IMX image.
+To obtain this value, run:
+
+.. code-block:: bash
+
+    $ od -X -N 0x30 u-boot-dtb.imx
+    0000000    402000d1 87800000 00000000 877ff42c
+    0000020    877ff420 877ff400 878a5000 00000000
+                        ^^^^^^^^
+    0000040    877ff000 000a8060 00000000 40b401d2
+               ^^^^^^^^ ^^^^^^^^
+
+Where:
+
+* ``877ff400`` - IVT self address
+* ``877ff000`` - Program image address
+* ``000a8060`` - Program image size
+
+To calculate the padding:
+
+* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
+* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
+
+and then pad the image:
+
+.. code-block:: bash
+
+    $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
+        u-boot-dtb.imx u-boot-dtb.imx.zero-padded
+
+3. Also, according to requirement from ``6.6.7.1``, the final image
+should have ``0x400`` offset for initial IVT table.
+
+For eMMC setup we handle this by flashing it to ``0x400``, howewer
+for NAND setup we adjust the image prior to flashing, adding padding in the
+beginning of the image.
+
+.. code-block:: bash
+
+    $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
+
+Flash U-Boot IMX image to eMMC
+------------------------------
+
+Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
+boot area partition:
+
+.. code-block:: bash
+
+
+    => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
+    => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
+    => mmc dev 0 1
+    => mmc write ${loadaddr} 0x2 ${blkcnt}
+
+Flash U-Boot IMX image to NAND
+------------------------------
+
+.. code-block:: bash
+
+    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
+    => nand erase.part u-boot1
+    => nand write ${loadaddr} u-boot1 ${filesize}
+    => nand erase.part u-boot2
+    => nand write ${loadaddr} u-boot2 ${filesize}
+
+Using update_uboot script
+-------------------------
+
+You can also usb U-Boot env update_uboot script,
+which wraps all eMMC/NAND specific command invocation:
+
+.. code-block:: bash
+
+    => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
+    => run update_uboot
+
diff --git a/doc/board/toradex/index.rst b/doc/board/toradex/index.rst
new file mode 100644
index 0000000000..aa418d6bad
--- /dev/null
+++ b/doc/board/toradex/index.rst
@@ -0,0 +1,9 @@ 
+.. SPDX-License-Identifier: GPL-2.0+
+
+Toradex
+=======
+
+.. toctree::
+   :maxdepth: 2
+
+   colibri_imx7