Jump to content

Samsung Galaxy Xcover 3 (samsung-xcover3lte)

From postmarketOS Wiki
Revision as of 18:06, 9 August 2023 by LegoLivesMatter (talk | contribs) (Correct and update mainline driver support)
Samsung Galaxy Xcover 3
Xcover 3 running XFCE
Xcover 3 running XFCE
Manufacturer Samsung
Name Galaxy Xcover 3
Codename samsung-xcover3lte
Released 2015
Type handset
Hardware
Chipset Marvell PXA1908
CPU Quad-core 1.2 GHz Cortex-A53
GPU Vivante GC7000UL
Display 480x800
Storage 8 GB
Memory 1.5 GB
Architecture aarch64
Software
Original software Android
Original version 4.4.4
postmarketOS
Category testing
Pre-built images no
Mainline partial
postmarketOS kernel 3.14.27
Unixbench Whet/Dhry score 1137.7
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Works
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Broken
Audio
Partial
Camera
No data
Camera Flash
No data
Connectivity
WiFi
Works
Bluetooth
No data
GPS
No data
NFC
No data
Modem
Calls
No data
SMS
No data
Mobile data
No data
Miscellaneous
FDE
No data
USB OTG
Works
HDMI/DP
No data
Sensors
Accelerometer
Partial
Magnetometer
Works
Ambient Light
No data
Proximity
Works
Haptics
No data
Barometer
No data


Contributors

  • Blacksilver

Users owning this device


How to enter flash mode

Volume Down + Home + Power

How to enter recovery mode

Volume Up + Home + Power

What works

  • XFCE
  • Weston
  • TTYEscape
  • fbkeyboard
  • MUIC/UART

What doesn't work

  • Blanking and Unblanking leads to framebuffer flickering, which stays after reboot and even battery-removal for some time.
  • Only kernels built with GCC4 will boot downstream.
  • AlsaUCM profile must be reapplied before each audio play.
  • LEDs

Installation

Flash the boot-image

$ pmbootstrap flash flash_kernel

Installation of rootfs can be be done either to SD-card

$ pmbootstrap install --sdcard=/dev/XXXXX

This makes manual dual boot (by replacing boot-image) possible.

Alternatively installation can be done via recovery to USER partition (5.3GB). The system partition is rather small (1536M) for postmarketos with UI.

For installation to USER partition via android-recovery-zip you need a TWRP recovery (codename xcover3ltexx). The latest TWRP recovery isn't flash-able after update to latest vendor version (Android 5.0). A "Hackish TWRP" alternative recovery image can be found in XDA forum.

$ pmbootstrap install --android-recovery-zip --recovery-install-partition USER
$ cp /tmp/postmarketOS-export/pmos-samsung-xcover3lte.zip ...

Boot image

The created pxa-bootimage contains a legacy uImage which is slightly different from vendor one. Despite having keyword postmarketos and missing extra gzip compression, it boots as well.

Debugging

To enable ramoops the kernel cmdline must be extended by these module parameters. See also ramoops

ramoops.mem_size=0x40000 ramoops.mem_address=0x8100000 ramoops.record_size=0x8000 ramoops.console_size=0x30000 ramoops.dump_oops=1

After kernel panic the console can be extracted in e.g. recovery.

$ hexdump -C -s 0x8108000 /dev/mem | less

UART

You can get serial console with a microUSB/Carkit_debug_cable and 619KΩ resistor. The phone will boot when plugging the cable in, after the phone has been powered off or battery inserted. Might take several attempts. 150KΩ will start the phone in flash mode.

Audio

The Alsa UCM usecase must be set before each play, e.g.

alsaucm -c map_asoc set _verb HiFi set _enadev Speaker

Mainline

Mainline boots with patch below.

$ envkernel
$ make defconfig
$ cp minimal-kernel-5-18-config-xcover3lte .output/.config
$ make menuconfig
$ make -j5
$ make marvell/pxa1908-xcover3lte-rev07.dtb

Create post-make.sh which executes the DTB combiner.

#!/bin/sh
_carch=arm64
_outdir=.output
pxa1908-dtbTool -p "$_outdir"/scripts/dtc/ -o "$_outdir/arch/$_carch/boot"/dt.img "$_outdir/arch/$_carch/boot/dts/marvell/"

After flashing the phone must be powered off, best by battery removal.

$ run-script post-make.sh && pmbootstrap build --envkernel linux-samsung-xcover3lte && pmbootstrap flasher flash_kernel
$ screen -L /dev/ttyUSB0 115200

Plugging UART cable in should lead to this output:

...
[    3.5957] setting param.cmdline = panic_debug uart_dma user_debug=31 earlyprintk=uart8250-32bit,0xd4017000 ddr_mode=1 rw rootfstype=ramfs ...
[    3.6523] Loading Device Tree to 0x8200000, end 0x8200832 ...
Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd032]
[    0.000000] Linux version 5.18.0 (pmos@mypad) (aarch64-alpine-linux-musl-gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, GNU ld (GNU Binutils) 2.38) #6 SMP PREEMPT Tue Jul 12 15:36:21 UTC 2022
[    0.000000] Machine model: Samsung Galaxy Xcover 3 Rev 07
[    0.000000] earlycon: early_pxa0 at MMIO32 0x00000000d4017000 (options '')
[    0.000000] printk: bootconsole [early_pxa0] enabled
[    0.000000] printk: debug: skip boot console de-registration.
...

Required kernel config options for booting. The kernel size limit is unknown.

CONFIG_CMDLINE="earlycon=early_pxa,mmio32,0xd4017000 keep_bootcon loglevel=7"
CONFIG_CMDLINE_FORCE=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_PXA=y
CONFIG_ARCH_MMP=y

Mainline changes and reduced DT.

diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 30b123cde02c..f114504b81cf 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -166,6 +166,13 @@ config ARCH_MESON
 	  This enables support for the arm64 based Amlogic SoCs
 	  such as the s905, S905X/D, S912, A113X/D or S905X/D2
 
+config ARCH_MMP
+	bool "Marvell MMP SoC Family"
+	select PINCTRL
+	select PINCTRL_SINGLE
+	help
+	  This enables support for the Marvell MMP family.
+
 config ARCH_MVEBU
 	bool "Marvell EBU SoC Family"
 	select ARMADA_AP806_SYSCON
diff --git a/arch/arm64/boot/dts/marvell/Makefile b/arch/arm64/boot/dts/marvell/Makefile
index 1c794cdcb8e6..56b349e058d2 100644
--- a/arch/arm64/boot/dts/marvell/Makefile
+++ b/arch/arm64/boot/dts/marvell/Makefile
@@ -24,3 +24,6 @@ dtb-$(CONFIG_ARCH_MVEBU) += cn9132-db.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += cn9132-db-B.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += cn9130-crb-A.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += cn9130-crb-B.dtb
+
+# MMP SoC Family
+dtb-$(CONFIG_ARCH_MMP) += pxa1908-xcover3lte-rev07.dts
diff --git a/arch/arm64/boot/dts/marvell/pxa1908-xcover3lte-rev07.dts b/arch/arm64/boot/dts/marvell/pxa1908-xcover3lte-rev07.dts
new file mode 100644
index 000000000000..7a45bf0f2ee2
--- /dev/null
+++ b/arch/arm64/boot/dts/marvell/pxa1908-xcover3lte-rev07.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+/memreserve/ 0x05000000 0x3000000; // CP memory
+/memreserve/ 0x0a000000 0x80000; // CM3 shared buffer memory
+/memreserve/ 0x0a080000 0x177000; // FB
+/memreserve/ 0x09000000 0x1000000; // GPU
+/memreserve/ 0x6f800000 0x800000; // CMA
+#include "pxa1908.dtsi"
+/ {
+	compatible = "samsung,xcover3lte", "marvell,pxa1908";
+	model = "Samsung Galaxy Xcover 3 Rev 07";
+	pxa,rev-id = <3923 7>; // required by pxa1908-dtbTool
+};
diff --git a/arch/arm64/boot/dts/marvell/pxa1908.dtsi b/arch/arm64/boot/dts/marvell/pxa1908.dtsi
new file mode 100644
index 000000000000..e2d05df2183c
--- /dev/null
+++ b/arch/arm64/boot/dts/marvell/pxa1908.dtsi
@@ -0,0 +1,45 @@
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+/ {
+	compatible = "marvell,pxa1908";
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+	// memory and chosen are expected by bootloader
+	memory {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x0>; // bootloader populates the memory node
+	};
+	chosen {
+	};
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+		};
+	};
+	psci {
+		compatible = "arm,psci-0.2";
+		method = "smc";
+		cpu_off = <0x85000001>;
+		cpu_on = <0x85000002>;
+	};
+	gic: interrupt-controller@d1df9000 {
+		compatible = "arm,gic-400";
+		reg = <0x0 0xd1df9000 0x0 0x1000>,
+		      <0x0 0xd1dfa000 0x0 0x2000>;
+		interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+		interrupt-controller;
+		#interrupt-cells = <3>;
+	};
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13
+			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14
+			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+	};
+};

Attempt to add mainline support for pxa1908 aka iap140 was done in 2017 https://lore.kernel.org/linux-arm-kernel/20170222022929.10540-1-afaerber@suse.de/

Mainline driver support

Component Model Downstream Driver Mainline Notes
Charger/MUIC Silicon Mitus SM5504 Y
PMIC Marvell 88pm860 N
PMIC Marvell 88pm886 N Attempt: https://lkml.org/lkml/2015/6/12/200
Touchscreen Cypress cyttsp5 cyttsp5_i2c_adapter Y https://lwn.net/ml/linux-kernel/20220227123318.313009-1-alistair@alistair23.me/
Display Backlight KTD2801 ktd2801_bl N Similar KTD253 is supported
Wifi/Bluetooth Marvell Avastar® 88W8777 WLAN + Bluetooth 4.0 + NFC + FM SD8777 N Adding SD8777 support to mwifiex & btmrvl_sdio might be straightforward, based on downstream comparsion of wlan/mbtc-driver diff between SD8777 and SD8787
Front camera Siliconfile SR200PC20 sr200 N
Back camera Siliconfile SR544 sr544 N
Gyroscope/Accelerometer STM K2HH k2hh N /sys/class/sensors/accelerometer_sensor/raw_data , see https://wiki.tizen.org/SamsungZ3#Sensors
Magnetometer AKM ak09911c Y /sys/class/sensors/magnetic_sensor/raw_data
Light/Proximity sensor Sharp GP2A Y /sys/bus/iio/devices/proximity_sensor/enable, /sys/class/sensors/proximity_sensor/state
NFC ST21NFCA Y
GNSS Marvell 88L2000 R N
Vibrator echo 200 > /sys/class/timed_output/vibrator/enable

Partitions

Disk /dev/block/mmcblk0: 15269888 sectors, 3360M
Logical sector size: 512
Disk identifier (GUID):
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 15269854

Number  Start (sector)    End (sector)  Size       Code  Name
   1            8192            9215        512K   0700  MRD
   2            9216           10239        512K   0700  MRD1
   3           10240           24575       7168K   0700  MEP2
   4           24576           28671       2048K   0700  LOKE2ND
   5           28672           32767       2048K   0700  LOKE1ST
   6           32768           65535       16.0M   0700  EFS
   7           65536           73727       4096K   0700  PARAM
   8           73728          106495       16.0M   0700  RECOVERY
   9          106496          139263       16.0M   0700  KERNEL
  10          139264          196607       28.0M   0700  MODEM
  11          196608          262143       32.0M   0700  SSTD
  12          262144          264191       1024K   0700  OTA
  13          264192          313343       24.0M   0700  NVM
  14          313344         3459071       1536M   0700  SYSTEM
  15         3459072         3868671        200M   0700  CACHE
  16         3868672         4073471        100M   0700  HIDDEN
  17         4073472        15267839       5466M   0700  USER

Similar devices

The following devices are similar to SM-G388F.

See also