Project

General

Profile

Issue #1954

Add support for the I9300 modem

Added by Denis 'GNUtoo' Carikli 3 months ago. Updated 2 months ago.

Status:
In Progress
Priority:
High
Category:
Telephony and mobile data
Target version:
Start date:
09/07/2019
Due date:
% Done:

0%

Estimated time:
Resolution:
Device:
Galaxy S 3 (I9300)

History

#1

Updated by Denis 'GNUtoo' Carikli 3 months ago

This enables to track the progress in more details and not spam the PortingToAndroid9 wiki page.

#2

Updated by Denis 'GNUtoo' Carikli 3 months ago

Here's how the log looks on Replicant 6.0:

 D use-Rlog/RLOG-RIL-IPC: Starting i9300 modem boot
 D use-Rlog/RLOG-RIL-IPC: Opened modem image device
 D use-Rlog/RLOG-RIL-IPC: Mapped modem image data to memory
 D use-Rlog/RLOG-RIL-IPC: Opened modem boot device
 D use-Rlog/RLOG-RIL-IPC: Opened modem link device
 D use-Rlog/RLOG-RIL-IPC: Turned the modem off
 D use-Rlog/RLOG-RIL-IPC: Turned the modem on
 D use-Rlog/RLOG-RIL-IPC: Waited for link connected
 D use-Rlog/RLOG-RIL-IPC: Wrote ATAT in ASCII
 D use-Rlog/RLOG-RIL-IPC: Reading boot ACK failed
 D use-Rlog/RLOG-RIL-IPC: Sending XMM626 HSIC PSI failed
 E use-Rlog/RLOG-RIL-IPC: Booting IPC FMT client failed
 E use-Rlog/RLOG-RIL: Opening IPC FMT client failed
 D use-Rlog/RLOG-RIL: Closed IPC FMT client
 D use-Rlog/RLOG-RIL-IPC: Starting i9300 modem boot
 D use-Rlog/RLOG-RIL-IPC: Opened modem image device
 D use-Rlog/RLOG-RIL-IPC: Mapped modem image data to memory
 D use-Rlog/RLOG-RIL-IPC: Opened modem boot device
 D use-Rlog/RLOG-RIL-IPC: Opened modem link device
 D use-Rlog/RLOG-RIL-IPC: Turned the modem off
 D use-Rlog/RLOG-RIL-IPC: Turned the modem on
 D use-Rlog/RLOG-RIL-IPC: Waited for link connected
 D use-Rlog/RLOG-RIL-IPC: Wrote ATAT in ASCII
 D use-Rlog/RLOG-RIL-IPC: Read chip id (0x16)
 D use-Rlog/RLOG-RIL-IPC: Wrote PSI header
 D use-Rlog/RLOG-RIL-IPC: Wrote PSI, CRC is 0xc8
 D use-Rlog/RLOG-RIL-IPC: Wrote PSI CRC (0xc8)
 D use-Rlog/RLOG-RIL-IPC: Read PSI CRC ACK
 D use-Rlog/RLOG-RIL-IPC: Read PSI ACK
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC PSI
 D use-Rlog/RLOG-RIL-IPC: Wrote EBL size
 D use-Rlog/RLOG-RIL-IPC: Wrote EBL, CRC is 0xb5
 D use-Rlog/RLOG-RIL-IPC: Wrote EBL CRC (0xb5)
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC EBL
 D use-Rlog/RLOG-RIL-IPC: Read port config
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC port config
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC SEC start
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC firmware
 D use-Rlog/RLOG-RIL-IPC: Checked nv_data path
 D use-Rlog/RLOG-RIL-IPC: Checked nv_data md5 path
 D use-Rlog/RLOG-RIL-IPC: Calculated nv_data md5: 50e04bd1ae13445977f3aec356ada08d
 D use-Rlog/RLOG-RIL-IPC: Read nv_data md5: 50e04bd1ae13445977f3aec356ada08d
 D use-Rlog/RLOG-RIL-IPC: Checked nv_data backup path
 D use-Rlog/RLOG-RIL-IPC: Loaded nv_data
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC nv_data
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC HW reset
 D use-Rlog/RLOG-RIL-IPC: Waiting for host wake failed
 D use-Rlog/RLOG-RIL-IPC: Waited for host wake
 D use-Rlog/RLOG-RIL-IPC: Waited for link connected
 D use-Rlog/RLOG-RIL: Opened IPC FMT client
 D use-Rlog/RLOG-RIL-IPC: 
 D use-Rlog/RLOG-RIL-IPC: xmm626_sec_modem_fmt_recv: Received FMT message
 D use-Rlog/RLOG-RIL-IPC: xmm626_sec_modem_fmt_recv: Message: aseq=0xff, command=IPC_PWR_PHONE_PWR_UP, type=IPC_TYPE_NOTI, size=0
 D use-Rlog/RLOG-RIL: Updating RIL radio state to 0
 [...]

On Replicant 9.0 we have:


 # adb shell
 # /system/bin/xmm6262_boot0.sh 
 # exit
 # adb logcat -b radio
 [...] D use-Rlog/RLOG-RIL-IPC: Starting generic modem boot
 D use-Rlog/RLOG-RIL-IPC: Opened modem image device
 D use-Rlog/RLOG-RIL-IPC: Mapped modem image data to memory
 D use-Rlog/RLOG-RIL-IPC: Turned the modem off
 D use-Rlog/RLOG-RIL-IPC: Turned the modem on
 D use-Rlog/RLOG-RIL-IPC: Opened modem boot device
 D use-Rlog/RLOG-RIL-IPC: Wrote ATAT in ASCII
 D use-Rlog/RLOG-RIL-IPC: Read chip id (0x16)
 D use-Rlog/RLOG-RIL-IPC: Wrote PSI header
 D use-Rlog/RLOG-RIL-IPC: Wrote PSI, CRC is 0xc8
 D use-Rlog/RLOG-RIL-IPC: Wrote PSI CRC (0xc8)
 D use-Rlog/RLOG-RIL-IPC: Read PSI CRC ACK
 D use-Rlog/RLOG-RIL-IPC: Read PSI ACK
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC PSI
 D use-Rlog/RLOG-RIL-IPC: Wrote EBL size
 D use-Rlog/RLOG-RIL-IPC: Wrote EBL, CRC is 0xb5
 D use-Rlog/RLOG-RIL-IPC: Wrote EBL CRC (0xb5)
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC EBL
 D use-Rlog/RLOG-RIL-IPC: Read port config
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC port config
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC SEC start
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC firmware
 D use-Rlog/RLOG-RIL-IPC: ipc_nv_data_path_check: nv_data path: /efs/nv_data.bin
 D use-Rlog/RLOG-RIL-IPC: ipc_nv_data_path_check: nv_data size: 2097152
 D use-Rlog/RLOG-RIL-IPC: Checked nv_data path
 D use-Rlog/RLOG-RIL-IPC: Checked nv_data md5 path
 D use-Rlog/RLOG-RIL-IPC: Calculated nv_data md5: 50e04bd1ae13445977f3aec356ada08d
 D use-Rlog/RLOG-RIL-IPC: Read nv_data md5: 50e04bd1ae13445977f3aec356ada08d
 D use-Rlog/RLOG-RIL-IPC: Checked nv_data backup path
 D use-Rlog/RLOG-RIL-IPC: Loaded nv_data
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC nv_data
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC SEC end
 D use-Rlog/RLOG-RIL-IPC: Sent XMM626 HSIC HW reset
 D use-Rlog/RLOG-RIL-IPC: Waited for host wake
 D use-Rlog/RLOG-RIL-IPC: Waited for link connected
 E use-Rlog/RLOG-RIL-IPC: Opening IPC FMT client failed
 E use-Rlog/RLOG-RIL: Opening IPC FMT client failed
 [...]

Under Parabola with the same kernel and ipc-test we get a similar log.

After some investigations, loading the modem firmware has been validated.

However after the firmware has been loaded, the software stack is supposed to reset the HSIC link and after some messing with the modem GPIOs through sysfs, new USB descriptors are supposed to appear. Right now they don't appear.

#3

Updated by Denis 'GNUtoo' Carikli 3 months ago

TODO:
  • Investigate how the XMM626_SEC_HOSTWAKE_PATH is supposed to work. I also modified the driver to remove the IRQ related to that as it was conflicting with other uses of that GPIO.
  • Investigate what exactly the other modem sysfs nodes are supposed to do.
  • Investigate more the EHCI reset hack

Also note that this modem code has not been validated either on older kernel versions.

#4

Updated by Denis 'GNUtoo' Carikli 2 months ago

The modem finally booted:

[root@u-boot-i9300 ~]# ipc-test 
ENTER ipc_client_create
ipc_client_create: IPC_CLIENT_TYPE_FMT
ipc_client_create: complete
ipc_client_create: return client
main: ipc_client_create(IPC_CLIENT_TYPE_FMT) => 0
main: ipc_client_log_callback_register(client, log_callback, NULL) => 0
main: ipc_client_data_create(client) => 0
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] Starting generic modem boot
[ipc] Opened modem image device
[ipc] Mapped modem image data to memory
[ipc] Turned the modem off
generic_boot: xmm626_sec_modem_power(NULL, 1) = 0
generic_boot: xmm626_sec_modem_hci_power(1) = 0
[ipc] Turned the modem on
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] Opened modem boot device
Bus 001 Device 002: ID 058b:0041 Infineon Technologies Flash Loader utility
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] Wrote ATAT in ASCII
[ipc] Read chip id (0x16)
[ipc] Wrote PSI header
[ipc] Wrote PSI, CRC is 0xc8
[ipc] Wrote PSI CRC (0xc8)
[ipc] Read PSI CRC ACK
[ipc] Read PSI ACK
[ipc] Sent XMM626 HSIC PSI
[ipc] Wrote EBL size
[ipc] Wrote EBL, CRC is 0xb5
[ipc] Wrote EBL CRC (0xb5)
[ipc] Sent XMM626 HSIC EBL
[ipc] Read port config
[ipc] Sent XMM626 HSIC port config
Bus 001 Device 002: ID 058b:0041 Infineon Technologies Flash Loader utility
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] Sent XMM626 HSIC SEC start
[ipc] Sent XMM626 HSIC firmware
Bus 001 Device 002: ID 058b:0041 Infineon Technologies Flash Loader utility
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] ipc_nv_data_path_check: nv_data path: /efs/nv_data.bin
[ipc] ipc_nv_data_path_check: nv_data size: 2097152
[ipc] Checked nv_data path
[ipc] Checked nv_data md5 path
[ipc] Calculated nv_data md5: 50e04bd1ae13445977f3aec356ada08d
[ipc] Read nv_data md5: 50e04bd1ae13445977f3aec356ada08d
[ipc] Checked nv_data backup path
[ipc] Loaded nv_data
[ipc] Sent XMM626 HSIC nv_data
[ipc] Sent XMM626 HSIC SEC end
Bus 001 Device 002: ID 058b:0041 Infineon Technologies Flash Loader utility
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] Sent XMM626 HSIC HW reset
Bus 001 Device 002: ID 058b:0041 Infineon Technologies Flash Loader utility
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
xmm626_sec_modem_link_get_hostwake_wait: i=0 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=1 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=2 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=3 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=4 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=5 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=6 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=7 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=8 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=9 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
[ipc] Waited for host wake
Bus 001 Device 002: ID 058b:0041 Infineon Technologies Flash Loader utility
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] Turned off the modem
xmm626_sec_modem_link_get_hostwake_wait: i=0 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=1 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=2 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=3 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=4 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=5 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=6 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=7 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=8 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
xmm626_sec_modem_link_get_hostwake_wait: i=9 read(/sys/devices/platform/xmm6262/hostwake) => status: 0
[ipc] Waited for host wake
[ipc] Turned the modem on
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ipc] generic_boot complete
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[root@u-boot-i9300 ~]# lsusb
Bus 001 Device 002: ID 1519:0020 Comneon HSIC Device
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

And the corresponding dmesg:

[root@u-boot-i9300 ~]# dmesg
[   26.085293] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
[   26.094458] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
[   31.270306] gpiohack xmm6262: new state: 0
[   31.273001] exynos-ehci 12580000.ehci: Powering off EHCI
[   31.280444] exynos-ehci 12580000.ehci: remove, state 1
[   31.284112] usb usb1: USB disconnect, device number 1
[   31.295131] exynos-ehci 12580000.ehci: USB bus 1 deregistered
[   31.350218] gpiohack xmm6262: link active? 0
[   31.353441] gpiohack xmm6262: new state: 1
[   31.625132] gpiohack xmm6262: pda active => 1
[   31.628647] exynos-ehci 12580000.ehci: Powering on EHCI
[   31.633557] exynos-ehci 12580000.ehci: EHCI Host Controller
[   31.639063] exynos-ehci 12580000.ehci: new USB bus registered, assigned bus number 1
[   31.647179] exynos-ehci 12580000.ehci: irq 58, io mem 0x12580000
[   31.674509] exynos-ehci 12580000.ehci: USB 2.0 started, EHCI 1.00
[   31.679459] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.03
[   31.687484] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   31.694655] usb usb1: Product: EHCI Host Controller
[   31.699461] usb usb1: Manufacturer: Linux 5.3.0-rc8+ ehci_hcd
[   31.705222] usb usb1: SerialNumber: 12580000.ehci
[   31.712308] hub 1-0:1.0: USB hub found
[   31.714653] hub 1-0:1.0: 3 ports detected
[   31.770222] gpiohack xmm6262: link active? 1
[   32.084589] usb 1-2: new high-speed USB device number 2 using exynos-ehci
[   32.286228] usb 1-2: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 255, changing to 11
[   32.295155] usb 1-2: New USB device found, idVendor=058b, idProduct=0041, bcdDevice= 0.00
[   32.303184] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[   32.317235] xmm6262_boot 1-2:1.0: ENTER xmm6262_probe
[   32.321529] xmm6262_boot 1-2:1.0: Loaded XMM6262 boot serial device!
[   32.325300] ENTER xmm6262_boot_open
[   32.332038] xmm6262_boot 1-2:1.0: xmm6262_boot_open: got dev
[   32.336375] xmm6262_boot 1-2:1.0: xmm6262_boot_open: return 0;
[   39.166477] xmm6262_boot 1-2:1.0: nonzero bulk read status: -71
[   39.228235] gpiohack xmm6262: phone_active: cp_reset=1, phone_active=1, cp_dump=0
[   39.234260] gpiohack xmm6262: BOOTING
[   44.425149] exynos-ehci 12580000.ehci: Powering off EHCI
[   44.429111] exynos-ehci 12580000.ehci: remove, state 1
[   44.434106] usb usb1: USB disconnect, device number 1
[   44.442866] usb 1-2: USB disconnect, device number 2
[   44.451825] exynos-ehci 12580000.ehci: USB bus 1 deregistered
[   44.508775] gpiohack xmm6262: link active? 0
[   49.609709] gpiohack xmm6262: pda active => 1
[   49.612682] exynos-ehci 12580000.ehci: Powering on EHCI
[   49.620936] exynos-ehci 12580000.ehci: EHCI Host Controller
[   49.625160] exynos-ehci 12580000.ehci: new USB bus registered, assigned bus number 1
[   49.633296] exynos-ehci 12580000.ehci: irq 58, io mem 0x12580000
[   49.664542] exynos-ehci 12580000.ehci: USB 2.0 started, EHCI 1.00
[   49.669652] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.03
[   49.677442] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   49.684628] usb usb1: Product: EHCI Host Controller
[   49.689455] usb usb1: Manufacturer: Linux 5.3.0-rc8+ ehci_hcd
[   49.695295] usb usb1: SerialNumber: 12580000.ehci
[   49.700947] hub 1-0:1.0: USB hub found
[   49.703867] hub 1-0:1.0: 3 ports detected
[   49.758596] gpiohack xmm6262: link active? 1
[   50.074668] usb 1-2: new high-speed USB device number 2 using exynos-ehci
[   50.291938] usb 1-2: New USB device found, idVendor=1519, idProduct=0020, bcdDevice=12.74
[   50.298812] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   50.305913] usb 1-2: Product: HSIC Device
[   50.309758] usb 1-2: Manufacturer: Comneon
[   50.313847] usb 1-2: SerialNumber: 0123456789

libsamsung-ipc: 5a1f981743c0df1d1686632e8897d455b9da18a9
Linux: f72efb034be201930826bf5b04239f9cf3c529f8

#5

Updated by Denis 'GNUtoo' Carikli 2 months ago

We now can receive samsung-ipc messages:

[ipc] generic_boot complete
Bus 001 Device 002: ID 1519:0020 Comneon HSIC Device
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
main: ipc_client_boot(client) => 0
main: ipc_client_power_on(client) => 0
[ipc] ipc_client_open: client: 0x487598 client->handlers: 0x4875b8 client->handlers->open: 0xb6ed0090
[ipc] ipc_client_open: ->open(client->handlers->transport_data:0x4875f8, client->type:(nil)
generic_open: data: 0x4875f8, type: (nil)
ENTER xmm626_sec_modem_open
xmm626_sec_modem_open: type: 0
generic_open: return 0;
main: ipc_client_open(client) => 0
poll returns 1
[ipc] 

[ipc] xmm626_sec_modem_fmt_recv: Received FMT message
[ipc] xmm626_sec_modem_fmt_recv: Message: aseq=0xff, command=IPC_PWR_PHONE_PWR_UP, type=IPC_TYPE_NOTI, size=0
poll returns 1
[ipc] 

[ipc] xmm626_sec_modem_fmt_recv: Received FMT message
[ipc] xmm626_sec_modem_fmt_recv: Message: aseq=0x00, command=IPC_MISC_ME_IMSI, type=IPC_TYPE_NOTI, size=16

Also available in: Atom PDF