u-boot/arch/arm/mach-snapdragon
Stephan Gerhold 548b89f8ad arm: mach-snapdragon: pinctrl: Place pin_name in .data section
According to arch/arm/lib/crt0_64.S, the BSS section is "UNAVAILABLE"
and uninitialized before relocation. Also, it overlaps with the
appended DTB before relocation, so writing data into a variable
in the BSS section might corrupt the appended DTB.

Unfortunately, pinctrl-apq8016.c and pinctrl-apq8096.c do place the
"pin_name" variable in the BSS section (since it's uninitialized).
It's also used before relocation, when setting up the pinctrl for
the serial driver.

On DB410c this causes "GPIO_5" to be written into some part of an
appended DTB, e.g.:

80111820: edfe0dd0 9f100000 38000000 c00e0000    ...........8....
80111830: 28000000 11000000 10000000 00000000    ...(............
80111840: 4f495047 8800355f 00000000 00000000    GPIO_5..........
80111850: 00000000 00000000 01000000 00000000    ................
80111860: 03000000 04000000 00000000 02000000    ................
80111870: 03000000 04000000 0f000000 02000000    ................
80111880: 03000000 2d000000 1b000000 6c617551    .......-....Qual
80111890: 6d6d6f63 63655420 6c6f6e68 6569676f    comm Technologie

Depending on the part of the DTB that is corrupted this might not
cause any problems, but it can also result in strange reboots
without any serial output.

Fortunately, in practice this does not cause issues on DB410c yet
because board_fdt_blob_setup() in dragonboard410c.c currently
overrides the appended DTB with the one passed by the previous
bootloader (LK) (which does not get corrupted).

DB820c does not have board_fdt_blob_setup() so I would expect it to
be affected by this problem. Perhaps everyone was just fortunate to
not compile an U-Boot configuration where the pin_name corrupts an
important part of the DTB.

Make sure "pin_name" is explicitly placed in the .data section
instead of .bss to fix this.

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-07-14 16:48:01 -04:00
..
include/mach arm: snapdragon: Use correct GICC register on APQ8016 2021-07-06 14:12:15 -04:00
clock-apq8016.c mach-snapdragon: Fix UART clock flow 2018-05-26 18:19:11 -04:00
clock-apq8096.c arm: mach-snapdragon: db820c: Actually init PLL for serial 2019-01-25 12:12:55 -05:00
clock-snapdragon.c arm: snapdragon: Fix typo in clk_bcr_update() 2021-07-06 14:12:15 -04:00
clock-snapdragon.h mach-snapdragon: Fix UART clock flow 2018-05-26 18:19:11 -04:00
dram.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
Kconfig db410c: serial# env using msm board serial 2018-09-30 13:00:35 -04:00
Makefile arm: mach-snapdragon: add pinctrl driver for db820c 2019-01-25 12:12:55 -05:00
misc.c mach-snapdragon: Fix overwriting last digit of serial number 2020-04-03 11:47:47 -04:00
pinctrl-apq8016.c arm: mach-snapdragon: pinctrl: Place pin_name in .data section 2021-07-14 16:48:01 -04:00
pinctrl-apq8096.c arm: mach-snapdragon: pinctrl: Place pin_name in .data section 2021-07-14 16:48:01 -04:00
pinctrl-snapdragon.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
pinctrl-snapdragon.h common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
sysmap-apq8016.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sysmap-apq8096.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00