iDroid-Project/openiBoot — Issue #26: Cannot printf uart with iphone 3G
Author: saidelike
Created: 2012-02-22 12:57:40+00:00
State: open

Hey,

The uart cable does not printf correct bytes with current sources from git. Instead, it printf random bytes meaning there is a problem of frequency or similar.

http://cdn.idroidproject.org/release/openiboot/0.2/iPhone1,2/openiboot.img3 => ok
git clone http://github.com/iDroid-Project/openiBoot.git & PLATFORM=IPHONE3G make => problem
git clone https://github.com/planetbeing/iphonelinux.git & PLATFORM=3G make openiboot.img3 => ok

Diffing both files shows that there might be a problem between peripheral and fixed frequencies.

$ diff iphonelinux2/openiboot/uart.c iDroid-Project-openiBoot-769a555/openiboot/plat-s5l8900/uart.c
111c122
<	uint32_t clockFrequency = (UARTs[ureg].clock == UART_CLOCK_PCLK) ? PeripheralFrequency : FixedFrequency;
---
>	uint32_t clockFrequency = (UARTs[ureg].clock == UART_CLOCK_PCLK) ? clock_get_frequency(FrequencyBaseFixed) : clock_get_frequency(FrequencyBasePeripheral);

Changing the line to :
uint32_t clockFrequency = (UARTs[ureg].clock == UART_CLOCK_PCLK) ? clock_get_frequency(FrequencyBasePeripheral) : clock_get_frequency(FrequencyBaseFixed);
fixes the problem.

Regards,
saidelike