arm: mvebu: turris_omnia: Fixup SATA or PCIe nodes at runtime in DT blob
authorPali Rohár <pali@kernel.org>
Mon, 10 Jan 2022 10:47:18 +0000 (11:47 +0100)
committerStefan Roese <sr@denx.de>
Thu, 20 Jan 2022 10:35:29 +0000 (11:35 +0100)
commite3f92093d71d12399d239d0e6321dfba7bd5fef7
tree1209a4529ead22481484f7261c35bd625e965f6d
parent3058e283b885d80fbaaaaed6f597a068188be948
arm: mvebu: turris_omnia: Fixup SATA or PCIe nodes at runtime in DT blob

On of the MiniPCIe ports on Turris Omnia is also a mSATA port. Whether
it works in SATA or PCIe mode is determined by a strapping pin, which
value is read from the MCU.

We already determine which type of card is connected when configuring
SerDeses.

But until now we left both SATA and PCIe port 0 nodes in device tree
enabled, and so the SATA driver is probed in U-Boot / Linux even if we
know there is no mSATA card, and similarly PCIe driver tries to link on
port 0 even if we know there is mSATA card, not a PCIe card.

Fixup device tree blob to disable SATA node if mSATA card is not
present, and to disable PCIe port 0 node if mSATA card is present.

Do this for U-Boot's DT blob before relocation and also for kernel DT
blob before booting.

This ensures that software does not try to use SATA or PCIe HW when
corresponding PHY is not configured.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored and fixed some issues ]
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
board/CZ.NIC/turris_omnia/turris_omnia.c
configs/turris_omnia_defconfig