[U-Boot] [PATCH v1 07/14] pinctrl: imx: Replace static soc info definitions with run time allocations
Lukasz Majewski
lukma at denx.de
Tue Jan 1 23:37:38 UTC 2019
This commit is necessary to be able to re-use the pinctrl code in early
SPL to properly configure pins.
The problem is that those "static" structures are placed in the SDRAM
area, which corresponds to u-boot proper (not even SPL). Hence, when
one wants to configure pins before relocation via DTS/DM, the board
hangs (imx6q SoC powered one) as only OCRAM area is available (0x009xxxxx).
It is also safe to use calloc in this case, as the early SPL code provides
it - either full or trimmed version. The allocated memory is also correct
in respect to the memory area in which the SoC is currently running (OCRAM
vs. SDRAM).
Signed-off-by: Lukasz Majewski <lukma at denx.de>
---
drivers/pinctrl/nxp/pinctrl-imx6.c | 39 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/drivers/pinctrl/nxp/pinctrl-imx6.c b/drivers/pinctrl/nxp/pinctrl-imx6.c
index d7c95bb738..876049b39b 100644
--- a/drivers/pinctrl/nxp/pinctrl-imx6.c
+++ b/drivers/pinctrl/nxp/pinctrl-imx6.c
@@ -10,34 +10,33 @@
#include "pinctrl-imx.h"
-static struct imx_pinctrl_soc_info imx6_pinctrl_soc_info;
-
-/* FIXME Before reloaction, BSS is overlapped with DT area */
-static struct imx_pinctrl_soc_info imx6ul_pinctrl_soc_info = {
- .flags = ZERO_OFFSET_VALID,
-};
-
-static struct imx_pinctrl_soc_info imx6_snvs_pinctrl_soc_info = {
- .flags = ZERO_OFFSET_VALID,
-};
-
static int imx6_pinctrl_probe(struct udevice *dev)
{
struct imx_pinctrl_soc_info *info =
- (struct imx_pinctrl_soc_info *)dev_get_driver_data(dev);
+ calloc(1, sizeof(struct imx_pinctrl_soc_info));
+
+ if (!info) {
+ printf("%s: Not enough memory!\n", __func__);
+ return -ENOMEM;
+ }
+
+ if (device_is_compatible(dev, "fsl,imx6sll-iomuxc-snvs") ||
+ device_is_compatible(dev, "fsl,imx6ull-iomuxc-snvs") ||
+ device_is_compatible(dev, "fsl,imx6ul-iomuxc"))
+ info->flags = ZERO_OFFSET_VALID;
return imx_pinctrl_probe(dev, info);
}
static const struct udevice_id imx6_pinctrl_match[] = {
- { .compatible = "fsl,imx6q-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
- { .compatible = "fsl,imx6dl-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
- { .compatible = "fsl,imx6sl-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
- { .compatible = "fsl,imx6sll-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info },
- { .compatible = "fsl,imx6sll-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
- { .compatible = "fsl,imx6sx-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
- { .compatible = "fsl,imx6ul-iomuxc", .data = (ulong)&imx6ul_pinctrl_soc_info },
- { .compatible = "fsl,imx6ull-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info },
+ { .compatible = "fsl,imx6q-iomuxc" },
+ { .compatible = "fsl,imx6dl-iomuxc" },
+ { .compatible = "fsl,imx6sl-iomuxc" },
+ { .compatible = "fsl,imx6sll-iomuxc-snvs" },
+ { .compatible = "fsl,imx6sll-iomuxc" },
+ { .compatible = "fsl,imx6sx-iomuxc" },
+ { .compatible = "fsl,imx6ul-iomuxc" },
+ { .compatible = "fsl,imx6ull-iomuxc-snvs" },
{ /* sentinel */ }
};
--
2.11.0
More information about the U-Boot
mailing list