Leif,
2017-01-11 14:00 GMT+01:00 Leif Lindholm leif.lindholm@linaro.org:
On Thu, Jan 05, 2017 at 12:03:38PM +0100, Marcin Wojtas wrote:
This patch enables per-interface configuration of used power supply. For this purpose new PCD is added (PcdXenon1v8Enable). Implementation required obtaining current controller global index, with help of a PCD already used by PciEmulation driver (PcdPciESdhci), which indicates enabled controllers.
Porting guide documentation for XenonDxe was introduced.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marcin Wojtas mw@semihalf.com
Documentation/Marvell/PortingGuide/Xenon.txt | 21 +++++++++++++++ Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c | 40 ++++++++++++++++++++++++---- Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.inf | 5 ++++ Platforms/Marvell/Marvell.dec | 3 +++ 4 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 Documentation/Marvell/PortingGuide/Xenon.txt
diff --git a/Documentation/Marvell/PortingGuide/Xenon.txt b/Documentation/Marvell/PortingGuide/Xenon.txt new file mode 100644 index 0000000..566884b --- /dev/null +++ b/Documentation/Marvell/PortingGuide/Xenon.txt @@ -0,0 +1,21 @@ +XenonDxe porting guide +-------------------- +XenonDxe is a driver supporting SdMmc interface on Marvell platforms. +Following PCDs are required to operate:
- gMarvellTokenSpaceGuid.PcdPciESdhci
+Indication of enabled Xenon controllers. It is common PCD with Marvell +PciEmulation driver (see Documentation/Marvell/PortingGuide/PciEmulation.txt):
- gMarvellTokenSpaceGuid.PcdXenon1v8Enable
+Indicates, whether the interface is supplied with 1.8V.
+Examples +-------- +Assuming we want to enable both SdMmc ports on Armada 70x0 board, first one is +supplied with 3.3V and second one with 1.8V:
- gMarvellTokenSpaceGuid.PcdPciESdhci|{ 0x1, 0x1 }
- gMarvellTokenSpaceGuid.PcdXenon1v8Enable|{0x0, 0x1}
diff --git a/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c b/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c index 981eab5..f8a1772 100644 --- a/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c +++ b/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c @@ -91,6 +91,17 @@ EMMC_DEVICE_PATH mEmmcDpTemplate = { };
// +// Device global index +// +STATIC UINT8 XenonIdx;
+// +// Tables with used Xenon instances and their configuration +// +STATIC UINT8 * CONST XenonDevEnabled = FixedPcdGetPtr (PcdPciESdhci); +STATIC UINT8 * CONST Xenon1v8Enabled = FixedPcdGetPtr (PcdXenon1v8Enable);
Actually, I missed these (they stick out more when subsequent patches add additional ones).
This is not a good way to do this. Map these into a local struct, and call a function initialising the struct from InitializeSdMmcPciHcDxe().
Ok. When initializing fields of the structure, do you suggest to use FixedPcdGetPtr or PcdGetPtr?
Marcin