iPod Classic: HW preliminary initialization for bootloader

When the bootloader starts, most of HW never has been initialized.
This patch includes all code needed to perform the preliminary
initialization on SYSCON, GPIO, i2c, and MIU.

The code is based on emCORE and OF reverse engineering, ported to
C for readability.

Change-Id: I9ecf2c3e8b1b636241a211dbba8735137accd05c
This commit is contained in:
Cástor Muñoz 2016-02-04 22:49:01 +01:00
parent c31fcddd98
commit 1aefd9ea41
10 changed files with 429 additions and 4 deletions

View file

@ -214,3 +214,22 @@ void ICODE_ATTR INT_EXT6(void)
gpio_handler(0);
}
#endif
#ifdef BOOTLOADER
static uint32_t gpio_data[16] =
{
0x5322222F, 0xEEEEEE00, 0x2332EEEE, 0x3333E222,
0x33333333, 0x33333333, 0x3F000E33, 0xEEEEEEEE,
0xEEEEEEEE, 0xEEEEEEEE, 0xE0EEEEEE, 0xEE00EE0E,
0xEEEE0EEE, 0xEEEEEEEE, 0xEE2222EE, 0xEEEE0EEE
};
void gpio_preinit(void)
{
for (int i = 0; i < 16; i++) {
PCON(i) = gpio_data[i];
PUNB(i) = 0;
PUNC(i) = 0;
}
}
#endif