Samsung Galaxy A5 2017 (samsung-a5y17lte)

Contributors

 * dsankouski

How to enter flash mode
When the device is fully powered off, hold Power, Volume Down and Home for a few seconds.

A (turquoise) download mode warning screen should appear, press Volume Up to confirm.

Installation
It is recommended to sideload an android recovery zip through TWRP for the easiest process, since heimdall freaks out about the subpartitions in SYSTEM and won't move past ~7%. You can use  and then use netcat or similar to flash SYSTEM, but this is a longer and more redundant method.

USB
Device is equipped with usb type-c receptacle. No UART JIG mode cable schematic available as of 04.01.2020. However, it is possible to use chainloaded u-boot to get uart on usb. See u-boot port readme for instructions

Available MUIC info:


 * The receptacle is managed by s2mu004 kernel module. Module is capable to manage non type-c receptacles (see CONFIG_MUIC_S2MU004_NON_USB_C_TYPE option)
 * Receptacle has non standard pinout: B12 (considering, A row facing top, B row facing bottom side of the phone) pin is not connected to the ground.
 * Device can detect water in usb receptacle, by measuring resistance between B12 pin and ground.
 * Device can detect plug attach, with ALL pins unconnected, including GND and VBUS pins. How?
 * Attaching 619K resistor to B12 pin results in ADC_JIG_UART_ON value in ADC register, during water detection sequence.
 * Enter UART mode by attaching resistors should be possible in NON type-c mode. (file s2mu004-muic.c ,lines 2835,2797)
 * Device has no USB type-c debug accessory mode(tried both with rd/rd and rp/rp resistors)
 * UART mode detection most likely is implemented in muic firmware, if exists, or chip logic.

Open questions:
 * How device can detect plug attach, when ALL plug pins are unconnected.
 * How device detects UART debug cable attach?

Muic driver sysfs attributes are in  folder

Wlan
wifi module gets initialized after 180 seconds. This is due to missing firmware files, and 60 secs timeout.

To connect, use wpa_supplicant:

Create wpa supplicant config
/etc/wpa_supplicant/wpa_supplicant.conf ctrl_interface=/run/wpa_supplicant update_config=1

Add wlan access point authentication
wpa_passphrase >> /etc/wpa_supplicant/wpa_supplicant.conf

Launch wpa supplicant
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf sudo dhclient wlan0

UART cable
Attention: Author is not responsible for any damage to your devices. Signal level is 1.8V. You may fry your board, using standard 3.3V - 5V UART.

It is possible to connect to UART port(/dev/ttySAC2) on the mainboard. It is located on of the test port, and used by bootloader to log loading process.

Bill of materials

 * Adhesive tape
 * Precise soldering equipment
 * USB - UART converter (you need also level shifter, if converter does not support 1.8V signals. I used schematic on two transistors)
 * Breadboard
 * Wires
 * Thermal glue

Downstream kernel

 * Build kernel with options:
 * CONFIG_CMDLINE="earlycon=exynos,0x13820000,115200n8 console=ttySAC2,115200"
 * CONFIG_CMDLINE_EXTEND=y
 * Optional (enable login console on ttySAC2):

UART USB-debug cable schematic
Currently there's no automatic way to switch MUIC on debug uart. It may be done with u-boot custom port.

Exynos calibration table driver (ect_parser.c)
Exynos calibration table driver - simple driver, that reads and parses predefined cpu address range. It has voltage, cpu, gpu frequency tables, and more.

Legacy driver uses __raw_read macro to access data. Calibration table resides in volatile cpu address region (probably loaded there by bootloader into RAM?). One can write to ect cpu address region

U-boot
Has support in main tree. See also u-boot docs