powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS
Subsystems (3)
PATCH 1/1 powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS
In order to enable the DIU video controller on the P1022DS, the FPGA needs to be switched to "indirect mode", where the localbus is disabled and the FPGA is accessed via writes to localbus chip select signals CS0 and CS1.
To obtain the address of CS0 and CS1, the platform driver uses an "indirect pixis mode" device tree node. This node assumes that the localbus 'ranges' property is sorted in chip-select order. That is, reg value 0 maps to CS0, reg value 1 maps to CS1, etc. This is how the 'ranges' property is supposed to be arranged.
Unfortunately, the 'ranges' property is often mis-arranged, and not just on the P1022DS. Linux normally does not care, since it does not program the localbus. But the indirect-mode code on the P1022DS does care.
The "proper" fix is to have U-Boot fix the 'ranges' property, but this would be too cumbersome. The names and 'reg' properties of all the localbus devices would also need to be updated, and determining which localbus device maps to which chip select is board-specific.
Instead, we determine the CS0/CS1 base addresses the same way that U-boot does -- by reading the BRx registers directly and mapping them to physical addresses. This code is simpler and more reliable, and it does not require a U-boot or device tree change.
Since the indirect pixis device tree node is no longer needed, the node is deleted from the DTS.
--- arch/powerpc/boot/dts/p1022ds.dtsi | 16 ----- arch/powerpc/platforms/85xx/p1022_ds.c | 106 ++++++++++++++++++++++++++++---- 2 files changed, 93 insertions(+), 29 deletions(-)
arch/powerpc/boot/dts/p1022ds.dtsi +0 -16
@@ -33,22 +33,6 @@ */ &board_lbc { - /* - * This node is used to access the pixis via "indirect" mode, - * which is done by writing the pixis register index to chip - * select 0 and the value to/from chip select 1. Indirect - * mode is the only way to access the pixis when DIU video - * is enabled. Note that this assumes that the first column - * of the 'ranges' property above is the chip select number. - */ - board-control@0,0 { - compatible = "fsl,p1022ds-indirect-pixis"; - reg = <0x0 0x0 1 /* CS0 */ - 0x1 0x0 1>; /* CS1 */ - interrupt-parent = <&mpic>; - interrupts = <8 0 0 0>; - }; - nor@0,0 { #address-cells = <1>; #size-cells = <1>;
arch/powerpc/platforms/85xx/p1022_ds.c +93 -13
151 lines not on this page · raw message
Signature · 1 line
1.7.3.4
Kumar Gala
AppliedQuoted 1 line · Timur Tabi
In order to enable the DIU video controller on the P1022DS, the FPGA =
needs
Quoted 2 lines
to be switched to "indirect mode", where the localbus is disabled and the FPGA is accessed via writes to localbus chip select signals CS0 =
and CS1.
Quoted 2 lines
=20
To obtain the address of CS0 and CS1, the platform driver uses an =
"indirect
Quoted 1 line
pixis mode" device tree node. This node assumes that the localbus =
'ranges'
Quoted 2 lines
property is sorted in chip-select order. That is, reg value 0 maps to CS0, reg value 1 maps to CS1, etc. This is how the 'ranges' property =
is
Quoted 3 lines
supposed to be arranged.
=20
Unfortunately, the 'ranges' property is often mis-arranged, and not =
just on
Quoted 1 line
the P1022DS. Linux normally does not care, since it does not program =
the
Quoted 3 lines
localbus. But the indirect-mode code on the P1022DS does care. =20
The "proper" fix is to have U-Boot fix the 'ranges' property, but this =
would
Quoted 2 lines
be too cumbersome. The names and 'reg' properties of all the localbus devices would also need to be updated, and determining which localbus =
device
Quoted 3 lines
maps to which chip select is board-specific.
=20
Instead, we determine the CS0/CS1 base addresses the same way that =
U-boot
Quoted 1 line
does -- by reading the BRx registers directly and mapping them to =
physical
Quoted 1 line
addresses. This code is simpler and more reliable, and it does not =
require
Quoted 3 lines
a U-boot or device tree change.
=20
Since the indirect pixis device tree node is no longer needed, the =
node is
Quoted 6 lines
deleted from the DTS.
=20Signed-off-by Timur Tabi <[email protected]>---
arch/powerpc/boot/dts/p1022ds.dtsi| 16 -----arch/powerpc/platforms/85xx/p1022_ds.c| 106 =
++++++++++++++++++++++++++++----
Quoted 1 line
2 files changed, 93 insertions(+), 29 deletions(-)
applied to next
- k=