Skip to contentSkip to conversation

Add initial support for exynos5420-chagallwifi

PATCH Superseded Henrik Grimler 3 participants 6 messages Jan 15, 2022 – Feb 7, 2022

Subsystems (5)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add initial support for exynos5420-chagallwifi

Samsung's tablet Galaxy Tab S 10.5" (wifi) has codename chagallwifi and is one of several tablets released in 2013 - 2014 based on Exynos 5420. This initial devicetree adds support for accessing device over USB or UART, and allows using a rootfs in either the internal eMMC or an external sdcard. 4 out of 8 CPUs are brought up when device boots, which is the same as on the somewhat similar device exynos5420-arndale-octa.

Patch 2 is necessary after a secure-firmware node is added, otherwise device hangs during the CPU1BOOT secure monitor call. Without the secure-firmware node we are not able to bring up any secondary CPUs.

Changes since v1
================

Fix mmc_0 and usbdrd in patch 3:
* Remove extra, non supported, options from mmc_0 node
* Do not set usbdrd supplies. Usb networking does not work with them specified, but it works fine with dummy regulators

Henrik Grimler (3):
dt-bindings: arm: samsung: document chagallwifi board binding
ARM: exynos: only do SMC_CMD_CPU1BOOT call on Exynos4
ARM: dts: Add support for Samsung Chagallwifi

 .../bindings/arm/samsung/samsung-boards.yaml  |   1 +
 arch/arm/boot/dts/Makefile                    |   1 +
 arch/arm/boot/dts/exynos5420-chagallwifi.dts  |  57 ++
 .../dts/exynos5420-galaxy-tab-common.dtsi     | 633 ++++++++++++++++++
 arch/arm/mach-exynos/firmware.c               |   4 +-
 5 files changed, 695 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/exynos5420-chagallwifi.dts
 create mode 100644 arch/arm/boot/dts/exynos5420-galaxy-tab-common.dtsi
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/3 dt-bindings: arm: samsung: document chagallwifi board binding

Add binding for Samsung Galaxy Tab S 10.5", based on Exynos 5420 with codename chagallwifi. It was released in 2014 and has several siblings with similar hardware.

---
 .../devicetree/bindings/arm/samsung/samsung-boards.yaml          | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/samsung/samsung-boards.yaml +1 -0
index 052cd94113d4..3f2ffb0d7b46 100644
@@ -140,6 +140,7 @@ properties:
         items:
           - enum:
               - insignal,arndale-octa           # Insignal Arndale Octa
+              - samsung,chagallwifi             # Samsung SM-T800
               - samsung,smdk5420                # Samsung SMDK5420 eval
           - const: samsung,exynos5420
           - const: samsung,exynos5
Signature · 1 line
2.34.1
maintainer Acked-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: arm: samsung: document chagallwifi board binding

Quoted 9 lines · Henrik Grimler

Add binding for Samsung Galaxy Tab S 10.5", based on Exynos 5420 with codename chagallwifi. It was released in 2014 and has several siblings with similar hardware.

---
 .../devicetree/bindings/arm/samsung/samsung-boards.yaml          | 1 +
 1 file changed, 1 insertion(+)
#3 lore raw

PATCH v2 2/3 ARM: exynos: only do SMC_CMD_CPU1BOOT call on Exynos4

In reply to Henrik Grimler

On Exynos5 the call is simply ignored by most variants of the trustzone firmware. However, on some devices it instead causes the device to hang, so let's avoid the call for the SoCs where it should not be needed.

To see that the call is ignored, we can look into sboot/tzsw. On most of the Exynos{4,5} devices the part of sboot/tzsw that seem to handle the secure monitor calls is quite easy to recognise, the SMC number is compared to known ones, and if equal it branches to the relevant function. In assembly this looks something like:

;-- handle_smc:

0x00000514      650070e3       cmn r0, 0x65
0x00000518      0a00000a       beq loc.smc_cmd_reg
0x0000051c      010070e3       cmn r0, 1
0x00000520      6c00000a       beq loc.smc_cmd_init
0x00000524      020070e3       cmn r0, 2
0x00000528      6b00000a       beq loc.smc_cmd_info
0x0000052c      030070e3       cmn r0, 3
0x00000530      6e00000a       beq loc.smc_cmd_sleep
0x00000534      060070e3       cmn r0, 6
0x00000538      ae00000a       beq loc.smc_cmd_save_state
0x0000053c      070070e3       cmn r0, 7
0x00000540      b400000a       beq loc.smc_cmd_standby
0x00000544      2b01001a       bne loc.smc_return_minus1

where above example is from exynos5420-arndale-octa. As can be seen the case where r0 is 4 (i.e. SMC_CMD_CPU1BOOT) is not handled. The annotations are taken from github.com/hsnaves/exynos5410-firmware, where a large part of the exynos5410 trustzone firmware has been reverse-engineered.

---
Sent previously as RFC

---
 arch/arm/mach-exynos/firmware.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/firmware.c +3 -1
index 2eaf2dbb8e81..2da5b60b59e2 100644
@@ -60,8 +60,10 @@ static int exynos_cpu_boot(int cpu)
 	/*
 	 * Exynos3250 doesn't need to send smc command for secondary CPU boot
 	 * because Exynos3250 removes WFE in secure mode.
+	 *
+	 * On Exynos5 devices the call is ignored by trustzone firmware.
 	 */
-	if (soc_is_exynos3250())
+	if (!soc_is_exynos4210() && !soc_is_exynos4412())
 		return 0;
 
 	/*
Signature · 1 line
2.34.1
#4 lore raw

PATCH v2 3/3 ARM: dts: Add support for Samsung Chagallwifi

In reply to Henrik Grimler

Chagallwifi, with product name Samsung Galaxy Tab S 10.5", is based on Exynos 5420. This device is one of several tablet models released in 2013 - 2014 based on Exynos 5420.

The device tree added here contains support for:

- UART
- eMMC
- SD card
- USB

CCI has been disabled in the hardware, enabling it would require (de-)soldering a resistor on the board. Trying to boot with it enabled in kernel makes the device hang when CCI is probed. Exynos5420-arndale-octa also has had CCI disabled due to issues [1].

To successfully boot the mainline kernel with the stock bootloader (SBOOT), an additional hack is needed [2]. The same hack is also needed to boot exynos4412-i9300 with stock bootloader, and probably other Samsung devices of similar age.

[1] https://marc.info/?l=linux-arm-kernel&m=141718639200624
[2] https://lore.kernel.org/all/[email protected]/

---
 arch/arm/boot/dts/Makefile                    |   1 +
 arch/arm/boot/dts/exynos5420-chagallwifi.dts  |  57 ++
 .../dts/exynos5420-galaxy-tab-common.dtsi     | 633 ++++++++++++++++++
 3 files changed, 691 insertions(+)
 create mode 100644 arch/arm/boot/dts/exynos5420-chagallwifi.dts
 create mode 100644 arch/arm/boot/dts/exynos5420-galaxy-tab-common.dtsi
arch/arm/boot/dts/Makefile +1 -0
index 0de64f237cd8..be7a493ff1a1 100644
@@ -220,6 +220,7 @@ dtb-$(CONFIG_ARCH_EXYNOS5) += \
 	exynos5420-arndale-octa.dtb \
 	exynos5420-peach-pit.dtb \
 	exynos5420-smdk5420.dtb \
+	exynos5420-chagallwifi.dtb \
 	exynos5422-odroidhc1.dtb \
 	exynos5422-odroidxu3.dtb \
 	exynos5422-odroidxu3-lite.dtb \
arch/arm/boot/dts/exynos5420-chagallwifi.dts new file +57 -0

57 lines not on this page · raw message

arch/arm/boot/dts/exynos5420-galaxy-tab-common.dtsi new file +633 -0

633 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw
In reply to Henrik Grimler
Quoted 12 lines · Henrik Grimler

Samsung's tablet Galaxy Tab S 10.5" (wifi) has codename chagallwifi and is one of several tablets released in 2013 - 2014 based on Exynos 5420. This initial devicetree adds support for accessing device over USB or UART, and allows using a rootfs in either the internal eMMC or an external sdcard. 4 out of 8 CPUs are brought up when device boots, which is the same as on the somewhat similar device exynos5420-arndale-octa.

Patch 2 is necessary after a secure-firmware node is added, otherwise device hangs during the CPU1BOOT secure monitor call. Without the secure-firmware node we are not able to bring up any secondary CPUs.

Quoted 7 lines

Changes since v1
================

Fix mmc_0 and usbdrd in patch 3:
* Remove extra, non supported, options from mmc_0 node
* Do not set usbdrd supplies. Usb networking does not work with them specified, but it works fine with dummy regulators

Re-try with supplies after fixing the regulators (my comment to v1). These should work, unless your regulators are wrongly configured or you used wrong supplies.

I just sent a review for v1, so please go through it.

Best regards,
Krzysztof