ARM: renesas: Propagate RPC-IF enablement to subsequent software
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 29 Mar 2022 12:19:08 +0000 (14:19 +0200)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Fri, 2 Sep 2022 11:25:01 +0000 (13:25 +0200)
commit33aca1c86856e4cd303dad3701fe7b3589fb805e
treeaf482213abef0619843c558ac13ea27f8074ef28
parente17205d067e0304d8d59e25c0d2fe5f3c10c1b56
ARM: renesas: Propagate RPC-IF enablement to subsequent software

As the Renesas Reduced Pin Count Interface may be locked by TF-A, it is
disabled by default[1].  When unlocked, TF-A passes a DT fragment to
enable it, which is applied to the U-Boot DT[2].

Unlike the memory layout, the RPC-IF enablement is not propagated to
subsequent software.  Hence e.g. Linux cannot know if the RPC-IF is
locked or not, and will lock-up when trying to access the RPC-IF when
locked.

Fix this by checking if the RPC-IF is enabled in the TF-A DT fragment, and
setting the status of the RPC-IF device node in the target DT, if
present, to "okay".  Do this only when a "flash" subnode is found, to
avoid errors in subsequent software when the RPC-IF is not intended to
be used.

Note that this requires the status of the RPC-IF node to be set to
"disabled" in the target DT, just like in the U-Boot DT.

[1] commit 3d5f45c95c9db73d ("ARM: dts: rmobile: Disable RPC HF by
    default")
[2] commit 361377dbdbc9f0f5 ("ARM: rmobile: Merge prior-stage firmware
    DT fragment into U-Boot DT on Gen3")

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
board/renesas/rcar-common/common.c