Trying to boot custom kernel on Wink Hub (i.MX28)

Rogan Dawes rogan at dawes.za.net
Mon Sep 25 11:52:28 CEST 2023


Hi Fabio,

I used the following diff with "make mx28evk_defconfig", but unfortunately
still get absolutely nothing on the DUART when running "mxsloader u-boot.sb".
In fact, mxsloader returns immediately on trying to load my own u-boot.sb,
whereas it hangs when running the vendor u-boot.sb, I assume because the
CALL never returns. Additionally, there is no need to reset the board
between attempting a custom u-boot and the vendor u-boot, indicating that
the ROM-based SDP protocol handler is still running. This suggests that
there is something wrong with the format of the u-boot.sb file which the
ROM-based SDP protocol handler is rejecting, I would think?

I did confirm that the correct DTB file is being used, as the dts/dt.dtb
file is identical to arch/arm/dts/imx28-wink-hub-v1.dtb.
$ diff dts/dt.dtb arch/arm/dts/imx28-wink-hub-v1.dtb
$ grep -i wink .config
CONFIG_DEFAULT_DEVICE_TREE="imx28-wink-hub-v1"
CONFIG_OF_LIST="imx28-wink-hub-v1"

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
index a94803ee93..f4d6cac878 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
@@ -29,7 +29,7 @@ __weak uint32_t mxs_dram_vals[] = {
  0x00000000, 0x00000100, 0x00000000, 0x00000000,
  0x00000000, 0x00000000, 0x00000000, 0x00000000,
  0x00000000, 0x00000000, 0x00010101, 0x01010101,
- 0x000f0f01, 0x0f02020a, 0x00000000, 0x00010101,
+ 0x000f0f01, 0x0f02020a, 0x00000000, 0x00000101,
  0x00000100, 0x00000100, 0x00000000, 0x00000002,
  0x01010000, 0x07080403, 0x06005003, 0x0a0000c8,
  0x02009c40, 0x0002030c, 0x0036a609, 0x031a0612,
diff --git a/arch/arm/dts/imx28-wink-hub-v1.dts
b/arch/arm/dts/imx28-wink-hub-v1.dts
new file mode 100644
index 0000000000..b0bddebce8
--- /dev/null
+++ b/arch/arm/dts/imx28-wink-hub-v1.dts
@@ -0,0 +1,206 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (C) 2023 Fabio Estevam <festevam at gmail.com>
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include "imx28.dtsi"
+/ {
+ model = "i.MX28 Wink Hub v1";
+ compatible = "wink,imx28-wink-hub-v1", "fsl,imx28";
+
+ memory at 40000000 {
+ device_type = "memory";
+ reg = <0x40000000 0>; /* will be filled in by U-Boot */
+ };
+
+ reg_wifi: regulator-wifi {
+ compatible = "regulator-fixed";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wifi_enable>;
+ regulator-name = "wifi";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ pwmleds {
+ compatible = "pwm-leds";
+
+ led-red {
+ label = "red";
+ max-brightness = <255>;
+ pwms = <&pwm 0 500000>;
+ };
+
+ led-green {
+ label = "green";
+ max-brightness = <255>;
+ pwms = <&pwm 1 500000>;
+ };
+
+ led-blue {
+ label = "blue";
+ max-brightness = <255>;
+ pwms = <&pwm 3 500000>;
+ };
+ };
+};
+
+&auart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&auart0_pins_a>;
+ uart-has-rtscts;
+ status = "okay";
+};
+
+&auart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&auart1_2pins_a>;
+ status = "okay";
+};
+
+&auart2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&auart2_2pins_a>;
+ status = "okay";
+};
+
+&auart3 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&auart3_2pins_a>;
+ status = "okay";
+};
+
+&auart4 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&auart4_pins_a>;
+ uart-has-rtscts;
+ status = "okay";
+};
+
+&duart {
+ pinctrl-names = "default";
+ pinctrl-0 = <&duart_pins_c>;
+ status = "okay";
+};
+
+&gpmi {
+ pinctrl-names = "default";
+ pinctrl-0 = <&gpmi_pins_a &gpmi_pins_extra>;
+ status = "okay";
+
+ partition at 0 {
+ label = "gpmi-nfc-0-boot";
+ reg = <0x0000000 0x300000>;
+ read-only;
+        };
+
+ partition at 300000 {
+ label = "updater-kernel";
+ reg = <0x0300000 0x400000>;
+ };
+
+ partition at 700000 {
+ label = "updater-rootfs";
+ reg = <0x0700000 0x1c00000>;
+        };
+
+ partition at 2300000 {
+ label = "database";
+ reg = <0x2300000 0x0800000>;
+ };
+
+ partition at 2b00000 {
+ label = "app-kernel";
+ reg = <0x2b00000 0x0800000>;
+        };
+
+ partition at 3300000 {
+ label = "gpmi-nfc-general-use";
+ reg = <0x3300000 0x4d00000>;
+        };
+};
+
+&pwm {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm0_pins_a &pwm1_pins_a &pwm3_pins_a>;
+ status = "okay";
+};
+
+&ssp0 {
+ compatible = "fsl,imx28-mmc";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc0_4bit_pins_a &mmc0_sck_cfg>;
+ vmmc-supply = <&reg_wifi>;
+ bus-width = <4>;
+ status = "okay";
+};
+
+&ssp3 {
+ compatible = "fsl,imx28-spi";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi3_pins_b>;
+ status = "okay";
+
+ spidev at 0 {
+ /* Generic compatible to make spidev happy */
+ compatible = "rohm,dh2228fv";
+ reg = <0>;
+ spi-max-frequency = <24000000>;
+ };
+};
+
+&usb0 {
+ dr_mode = "peripheral";
+ status = "okay";
+};
+
+&usbphy0  {
+ status = "okay";
+};
+
+&pinctrl {
+ pinctrl-names = "default";
+ pinctrl-0 = <&hog_pins_a>;
+
+ hog_pins_a: hog at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX28_PAD_LCD_D07__GPIO_1_7 /*  Z-Wave reset connection high output */
+ MX28_PAD_LCD_D08__GPIO_1_8 /* Lutron Clear-Connect button  */
+ MX28_PAD_LCD_D09__GPIO_1_9 /*  Zigbee reset */
+ MX28_PAD_LCD_D10__GPIO_1_10 /* Lutron reset */
+ MX28_PAD_LCD_D12__GPIO_1_12 /* Input Zigbee interrupt */
+ MX28_PAD_LCD_D14__GPIO_1_14 /*  BT  power down */
+ MX28_PAD_LCD_D15__GPIO_1_15 /* Kidde Reset */
+ MX28_PAD_LCD_D16__GPIO_1_16 /* Kidde Data */
+ MX28_PAD_LCD_D19__GPIO_1_19 /* Kidde RF Clock */
+ MX28_PAD_LCD_D20__GPIO_1_20 /* Kidde GPIO */
+ >;
+ fsl,drive-strength = <MXS_DRIVE_4mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_DISABLE>;
+ };
+
+ gpmi_pins_extra: gpmi-pins-extra at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX28_PAD_GPMI_CE1N__GPMI_CE1N
+ MX28_PAD_GPMI_RDY1__GPMI_READY1
+ >;
+ fsl,drive-strength = <MXS_DRIVE_4mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_DISABLE>;
+ };
+
+ wifi_enable: wifi-enable at 1 {
+ reg = <1>;
+ fsl,pinmux-ids = <
+ MX28_PAD_LCD_D13__GPIO_1_13
+ >;
+ fsl,drive-strength = <MXS_DRIVE_4mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_DISABLE>;
+ };
+};
diff --git a/arch/arm/dts/imx28.dtsi b/arch/arm/dts/imx28.dtsi
index 130b4145af..b4e2c8ec05 100644
--- a/arch/arm/dts/imx28.dtsi
+++ b/arch/arm/dts/imx28.dtsi
@@ -239,6 +239,17 @@
  fsl,pull-up = <MXS_PULL_DISABLE>;
  };

+ duart_pins_c: duart at 2 {
+ reg = <2>;
+ fsl,pinmux-ids = <
+ MX28_PAD_I2C0_SCL__DUART_RX
+ MX28_PAD_I2C0_SDA__DUART_TX
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_DISABLE>;
+ };
+
  duart_4pins_a: duart-4pins at 0 {
  reg = <0>;
  fsl,pinmux-ids = <
@@ -404,6 +415,20 @@
  fsl,pull-up = <MXS_PULL_DISABLE>;
  };

+ auart4_pins_a: auart4-4pins at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX28_PAD_SAIF0_BITCLK__AUART4_RX
+ MX28_PAD_SAIF0_SDATA0__AUART4_TX
+ MX28_PAD_SAIF0_MCLK__AUART4_CTS
+ MX28_PAD_SAIF0_LRCLK__AUART4_RTS
+ >;
+ fsl,drive-strength = <MXS_DRIVE_4mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_DISABLE>;
+ };
+
+
  auart4_2pins_a: auart4 at 0 {
  reg = <0>;
  fsl,pinmux-ids = <
@@ -719,6 +744,16 @@
  fsl,pull-up = <MXS_PULL_DISABLE>;
  };

+ pwm1_pins_a: pwm1 at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX28_PAD_PWM1__PWM_1
+ >;
+ fsl,drive-strength = <MXS_DRIVE_4mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_DISABLE>;
+ };
+
  pwm2_pins_a: pwm2 at 0 {
  reg = <0>;
  fsl,pinmux-ids = <
diff --git a/board/freescale/mx28evk/iomux.c
b/board/freescale/mx28evk/iomux.c
index cc0c858854..1e9ba07f8f 100644
--- a/board/freescale/mx28evk/iomux.c
+++ b/board/freescale/mx28evk/iomux.c
@@ -22,8 +22,8 @@

 const iomux_cfg_t iomux_setup[] = {
  /* DUART */
- MX28_PAD_PWM0__DUART_RX,
- MX28_PAD_PWM1__DUART_TX,
+ MX28_PAD_I2C0_SCL__DUART_RX,
+ MX28_PAD_I2C0_SDA__DUART_TX,

  /* MMC0 */
  MX28_PAD_SSP0_DATA0__SSP0_D0 | MUX_CONFIG_SSP0,

On Mon, 25 Sept 2023 at 01:38, Fabio Estevam <festevam at gmail.com> wrote:

> Hi Rogan,
>
> On Sun, Sep 24, 2023 at 5:16 PM Rogan Dawes <rogan at dawes.za.net> wrote:
> >
> > Hi folks,
> >
> > I eventually decided that I did need to figure out the DRAM timings for
> the Micron chip on my board, but I found an easier way than actually
> "understanding what I'm doing"! :-)
> >
> > I pulled the vendor U-Boot image off the flash, skipped the appropriate
> number of bytes until I was actually dealing with a u-boot.sb formatted
> image (looking for the STMP signature I found in the compiled mainline
> u-boot), then used the Rockbox project's sbtoelf tool to convert the SB
> back to two ELF files, the SPL.elf and the u-boot.elf. From there I loaded
> the SPL.elf into ghidra, then went looking for byte sequences found in
> arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c to see if I could locate them in
> the vendor blob. I did, right at the end of the binary, then converted
> bytes into uint32 sequences so that I could compare with the mxs_dram_vals
> for CONFIG_MX28.
> >
> > Did the compare and found a single bit that is different between the two
> sequences of initialisation values. Literally a 1 to a 0, and that is all.
> So I built mainline with that change, and an updated iomux_setup because
> the Wink Hub v1 uses MX28_PAD_I2C0_SCL__DUART_RX and
> MX28_PAD_I2C0_SDA__DUART_TX for its console pins. i was hoping to see it
> boot via mxsldr, but unfortunately, I got nothing.
>
> Ideally, you should create a new imx28-wink_defconfig.
>
> For a quick test, besides changing iomux_setup, please make sure that
> arch/arm/dts/imx28-evk.dts also has the duart pins changed.
>
> > How can I get the SPL to emit something on the console to confirm it is
> running? i.e. before the DRAM initialisation?
>
> SPL runs from the internal RAM, and should print something to the
> console prior to the DRAM init.
>


More information about the U-Boot mailing list