On Mon, Oct 05, 2026 at 08:46:32AM +0000, Vencislav Atanasov wrote:

> Port U-Boot to the Samsung S5L87xx SoC family, which is used by the
> Apple iPod nano (2nd to 7th generation), iPod classic (6th generation)
> and iPod touch (2nd generation) digital audio players.
> 
> ---
> As there is no official documentation or datasheets available from the
> manufacturer, all peripherals have been reverse-engineered in the span
> of more than 18 years, initially by the Linux4Nano project, which was
> later renamed to freemyipod.
> 
> The current code can be built and booted on the iPod nano series,
> from 2nd to 7th generation inclusive, and on the iPod classic (6th
> generation). While the iPod touch (2nd generation) uses the same SoC
> as the iPod nano (4th generation), support for the former is not
> currently included.
> 
> On those supported devices, U-Boot's console works over UART, using
> either the 30-pin connector's UART pins, or the UART pins on the
> Lightning connector for iPod nano (7th generation). USB 2.0 works
> in device mode, and U-Boot can successfully enumerate as a DFU device
> and launch a firmware image - either another copy of U-Boot, or a
> Linux FDT image.
> 
> U-Boot can be chain loaded from Apple's bootloader or from Rockbox.
> Since Apple's bootloader verifies and decrypts all DFU images, an
> additional tool is needed to generate a suitable image from u-boot.bin.
> 
> There are a couple issues, still being worked on:
> - The timer on iPod nano (2nd generation) is not exact, there's a
>   drift of about 5 seconds every 5 minutes.
> - The S5L8702 devices (iPod nano 3rd generation and iPod classic
>   6th generation) use a different UART baud rate - 57600. In addition,
>   the latter's UART interface is not stable when receiving data from
>   the computer.
> - The iPod classic (6th generation) is currently using a wrong clock
>   for keeping time in U-Boot, so the sleep command is slower.
> - The iPod nano (5th generation) build does not boot because of wrong
>   DTB alignment. The tool which launches U-Boot does not use a 8-byte
>   aligned address, which became a requirement since 0535e46d55d7.
> 
> This patch is the combined work of several developers:
> iPod nano (2nd generation): Franz-Josef Haider <[email protected]>
> iPod nano (3rd generation): Tucker Osman <[email protected]>
> iPod nano (4th generation): Vencislav Atanasov
>                               <[email protected]>
> iPod nano (5th generation): Serge Bazanski <[email protected]>
> iPod nano (6th generation): Vencislav Atanasov
>                               <[email protected]>
> iPod nano (7th generation): Martí Guasch <[email protected]>
> iPod classic (6th generation): Vencislav Atanasov
>                               <[email protected]>
> 
> Links/resources:
> - https://freemyipod.org/ - main project wiki
> - https://github.com/freemyipod/u-boot - development repository
> - https://freemyipod.org/wiki/U-Boot - building/running instructions
> - https://freemyipod.org/wiki/Hardware - device and spec list
> 
> Signed-off-by: Vencislav Atanasov <[email protected]>

It's very nice to see this. For the next iteration, please reword this
so there's more information, and also the attributions, above the first
"---" so git doesn't omit it.

[snip]
> diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
> index d3ab5928eee..3e82676456d 100644
> --- a/arch/arm/cpu/arm1176/start.S
> +++ b/arch/arm/cpu/arm1176/start.S
> @@ -37,6 +37,41 @@ reset:
>       b       save_boot_params
>  .globl       save_boot_params_ret
>  save_boot_params_ret:
> +#ifdef CONFIG_POSITION_INDEPENDENT
> +    /*
> +     * Fix .rela.dyn relocations. This allows U-Boot to loaded to and
> +     * executed at a different address than it was linked at.
> +     */
> +pie_fixup:
> +    adr r0, reset   /* r0 <- Runtime value of reset label */

Globally, there are spacing issues where the changes don't match the
rest of the file, please fix those. Similarly, please run checkpatch.pl
and make sure there's not other fixes like that to do as well.

[snip]
> diff --git a/arch/arm/dts/s5l8701-n36.dts b/arch/arm/dts/s5l8701-n36.dts
> new file mode 100644
> index 00000000000..f8d6cdc8dba
> --- /dev/null
> +++ b/arch/arm/dts/s5l8701-n36.dts
> @@ -0,0 +1,26 @@
> +// SPDX-License-Identifier: GPL-2.0+ OR MIT
> +/*
> + * Apple iPod nano (2nd generation)
> + *
> + * target-type: N36
> + *
> + * Copyright (C) 2026 The freemyipod team (freemyipod.org)
> + */
> +
> +/dts-v1/;
> +
> +#include "s5l8701.dtsi"
> +#include "s5l87xx-nxx.dtsi"

For all of these dts files, have you submitted them upstream?

[snip]
> diff --git a/arch/arm/include/asm/arch-s5l8701/uart.h 
> b/arch/arm/include/asm/arch-s5l8701/uart.h
> new file mode 100644
> index 00000000000..da07b296b6d
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-s5l8701/uart.h
> @@ -0,0 +1,29 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * (C) Copyright 2009 Samsung Electronics
> + * Minkyu Kang <[email protected]>
> + * Heungjun Kim <[email protected]>
> + */
> +
> +#ifndef __ASM_ARCH_UART_H_
> +#define __ASM_ARCH_UART_H_
> +
> +#ifndef __ASSEMBLY__
> +
> +struct s5p_uart {
> +     unsigned int    ulcon;
> +     unsigned int    ucon;
> +     unsigned int    ufcon;
> +     unsigned int    umcon;
> +     unsigned int    utrstat;
> +     unsigned int    uerstat;
> +     unsigned int    ufstat;
> +     unsigned int    umstat;
> +     unsigned int    utxh;
> +     unsigned int    urxh;
> +     unsigned int    ubrdiv;
> +};
> +
> +#endif       /* __ASSEMBLY__ */
> +
> +#endif

Can we figure out a way to share includes? It seems like this one for
example is cp'd a few times. Maybe arch-s5l8xxx ?

[snip]
> diff --git a/arch/arm/mach-s5l87xx/Kconfig b/arch/arm/mach-s5l87xx/Kconfig
> new file mode 100644
> index 00000000000..81485943d00
> --- /dev/null
> +++ b/arch/arm/mach-s5l87xx/Kconfig
> @@ -0,0 +1,53 @@
> +if ARCH_S5L87XX
> +
> +config S5L8701
> +     bool "S5L8701"
> +     # Actually an ARM940T
> +     select CPU_ARM920T
> +     help
> +       The Samsung S5L8701 is an ARM-based SoC with a single core ARM940T.
> +       Peripherals include USB2 device, USB1.1 OTG, I2C, I2S, UART and SPI.
> +
> +config S5L8702
> +     bool "S5L8702"
> +     select CPU_ARM926EJS
> +     help
> +       The Samsung S5L8702 is an ARM-based SoC with a single core ARM926EJ-S.
> +       Peripherals include USB2 device, USB1.1 OTG, I2C, I2S, UART and SPI.
> +
> +config S5L8720
> +     bool "S5L8720"
> +     select CPU_ARM1176
> +     help
> +       The Samsung S5L8720 is an ARM-based SoC with a single core 
> ARM1176JZF-S.
> +       Peripherals include USB2 device, USB1.1 OTG, I2C, I2S, UART and SPI.
> +
> +config S5L8723
> +     bool "S5L8723"
> +     select CPU_ARM1176
> +     help
> +       The Samsung S5L8723 is an ARM-based SoC with a single core 
> ARM1176JZF-S.
> +       Peripherals include USB2 device, USB1.1 OTG, I2C, I2S, UART and SPI.
> +
> +config S5L8730
> +     bool "S5L8730"
> +     select CPU_ARM1176
> +     help
> +       The Samsung S5L8730 is an ARM-based SoC with a single core 
> ARM1176JZF-S.
> +       Peripherals include USB2 device, USB1.1 OTG, I2C, I2S, UART and SPI.
> +
> +config S5L8740
> +     bool "S5L8740"
> +     select CPU_V7A
> +     help
> +       The Samsung S5L8740 is an ARM-based SoC with a single core ARM Cortex 
> A5.
> +       Peripherals include USB2 device, USB1.1 OTG, I2C, I2S, UART and SPI.

We should probably handle this as a "choice" statement

[snip]
> +#obj-$(CONFIG_S5L8730) += s5l87xx-buscon.o

Commented out lines should be removed unless there's a very good reason
to keep them (and in code, it should probably become some debug
statement that'll be optimized out normally).

[snip]
> diff --git a/arch/arm/mach-s5l87xx/s5l8730.c b/arch/arm/mach-s5l87xx/s5l8730.c
> new file mode 100644
> index 00000000000..91e6abfb03d
> --- /dev/null
> +++ b/arch/arm/mach-s5l87xx/s5l8730.c
> @@ -0,0 +1,23 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2026 The freemyipod team (freemyipod.org)
> + */
> +
> +#include <init.h>
> +
> +int print_cpuinfo(void)
> +{
> +     printf("CPU:   Samsung S5L8730 (ARM1176JZF-S)\n");
> +     return 0;
> +}
> +
> +void lowlevel_init(void)
> +{
> +     // unused
> +}

Empty functions like this should mean we just need to turn off a Kconfig
symbol instead.

[snip]
> diff --git a/configs/apple_n20_defconfig b/configs/apple_n20_defconfig
> new file mode 100644
> index 00000000000..79ca75bb7b7
> --- /dev/null
> +++ b/configs/apple_n20_defconfig
> @@ -0,0 +1,35 @@
> +CONFIG_ARM=y

I can see this (and presumably the rest) weren't done via "make
savedefconfig", so please do that for v2.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to