From ebc076bc15d6501674b9db772557a0eadfb4a5e2 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Wed, 25 Jul 2007 13:12:38 +0000 Subject: [PATCH] Remove the hack which read the ipod hardware revision from flash in the bootloader and passed it to Rockbox via a fixed address in SDRAM. Rockbox now remaps flash and so can just read the value itself. Also clean up the debug menu a little - only display the hw revision for ipods, and add the lcd_type variable to indicate the type of LCD (0 or 1) for ipod Color/Photo. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13986 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 20 +++++++++++++++----- bootloader/ipod.c | 11 +---------- firmware/export/hwcompat.h | 8 ++++++++ firmware/target/arm/ipod/lcd-color_nano.c | 6 +++--- firmware/target/arm/system-pp5002.c | 2 -- firmware/target/arm/system-pp502x.c | 6 ------ firmware/target/arm/system-target.h | 1 - 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 452abe59e5..3755ba83be 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -630,6 +630,7 @@ static bool dbg_hw_info(void) return false; } #elif defined(CPU_PP502x) + int line = 0; char buf[32]; char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff, (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff, @@ -640,16 +641,25 @@ static bool dbg_hw_info(void) lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); - lcd_puts(0, 0, "[Hardware info]"); + lcd_puts(0, line++, "[Hardware info]"); - snprintf(buf, sizeof(buf), "HW rev: 0x%08x", ipod_hw_rev); - lcd_puts(0, 1, buf); +#ifdef IPOD_ARCH + snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION); + lcd_puts(0, line++, buf); +#endif + +#ifdef IPOD_COLOR + extern int lcd_type; /* Defined in lcd-colornano.c */ + + snprintf(buf, sizeof(buf), "LCD type: %d", lcd_type); + lcd_puts(0, line++, buf); +#endif snprintf(buf, sizeof(buf), "PP version: %s", pp_version); - lcd_puts(0, 2, buf); + lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck()); - lcd_puts(0, 3, buf); + lcd_puts(0, line++, buf); lcd_update(); diff --git a/bootloader/ipod.c b/bootloader/ipod.c index 680331cd3e..a35dd33cf1 100644 --- a/bootloader/ipod.c +++ b/bootloader/ipod.c @@ -40,6 +40,7 @@ #include "power.h" #include "file.h" #include "common.h" +#include "hwcompat.h" #define XSC(X) #X #define SC(X) XSC(X) @@ -55,12 +56,6 @@ unsigned char *loadbuffer = (unsigned char *)DRAM_START; /* Bootloader version */ char version[] = APPSVERSION; -#define IPOD_HW_REVISION (*((volatile unsigned long*)(0x00002084))) - -/* We copy the hardware revision to the last four bytes of SDRAM and then - re-read it after we have re-mapped SDRAM to 0x0 in Rockbox */ -#define TMP_IPOD_HW_REVISION (*((volatile unsigned long*)(0x11fffffc))) - #define BUTTON_LEFT 1 #define BUTTON_MENU 2 #define BUTTON_RIGHT 3 @@ -240,9 +235,6 @@ void* main(void) __backlight_on(); - TMP_IPOD_HW_REVISION = IPOD_HW_REVISION; - ipod_hw_rev = IPOD_HW_REVISION; - system_init(); kernel_init(); lcd_init(); @@ -300,7 +292,6 @@ void* main(void) printf("Partition 1: 0x%02x %ld MB", pinfo->type, pinfo->size / 2048); - if (button_was_held || (btn==BUTTON_MENU)) { /* If either the hold switch was on, or the Menu button was held, then try the Apple firmware */ diff --git a/firmware/export/hwcompat.h b/firmware/export/hwcompat.h index 2261a91a36..b75ea81c8c 100644 --- a/firmware/export/hwcompat.h +++ b/firmware/export/hwcompat.h @@ -53,4 +53,12 @@ static inline int tuner_detect_type(void) bool is_new_player(void); #endif +#ifdef IPOD_ARCH +#ifdef BOOTLOADER +#define IPOD_HW_REVISION (*((unsigned long*)(0x00002084))) +#else +#define IPOD_HW_REVISION (*((unsigned long*)(0x20002084))) +#endif +#endif + #endif /* HWCOMPAT_H */ diff --git a/firmware/target/arm/ipod/lcd-color_nano.c b/firmware/target/arm/ipod/lcd-color_nano.c index 6a29cbe680..c17b99b859 100644 --- a/firmware/target/arm/ipod/lcd-color_nano.c +++ b/firmware/target/arm/ipod/lcd-color_nano.c @@ -28,7 +28,7 @@ #include "lcd.h" #include "kernel.h" #include "system.h" - +#include "hwcompat.h" /* check if number of useconds has past */ static inline bool timer_check(int clock_start, int usecs) @@ -46,7 +46,7 @@ static inline bool timer_check(int clock_start, int usecs) #define LCD_CNTL_VERT_RAM_ADDR_POS 0x45 /*** globals ***/ -static int lcd_type = 1; /* 0 = "old" Color/Photo, 1 = "new" Color & Nano */ +int lcd_type = 1; /* 0 = "old" Color/Photo, 1 = "new" Color & Nano */ static void lcd_wait_write(void) { @@ -109,7 +109,7 @@ void lcd_set_flip(bool yesno) void lcd_init_device(void) { #if CONFIG_LCD == LCD_IPODCOLOR - if (ipod_hw_rev == 0x60000) { + if (IPOD_HW_REVISION == 0x60000) { lcd_type = 0; } else { int gpio_a01, gpio_a04; diff --git a/firmware/target/arm/system-pp5002.c b/firmware/target/arm/system-pp5002.c index 25e1f700eb..8ed6592694 100644 --- a/firmware/target/arm/system-pp5002.c +++ b/firmware/target/arm/system-pp5002.c @@ -18,7 +18,6 @@ ****************************************************************************/ #include "system.h" -unsigned int ipod_hw_rev; #ifndef BOOTLOADER extern void TIMER1(void); extern void TIMER2(void); @@ -149,7 +148,6 @@ void system_init(void) MMAP3_LOGICAL = 0x20000000 | 0x3a00; MMAP3_PHYSICAL = 0x00000000 | 0x3f84; - ipod_hw_rev = (*((volatile unsigned long*)(0x01fffffc))); outl(-1, 0xcf00101c); outl(-1, 0xcf001028); outl(-1, 0xcf001038); diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c index 4fca84600b..e2497c92e2 100644 --- a/firmware/target/arm/system-pp502x.c +++ b/firmware/target/arm/system-pp502x.c @@ -19,8 +19,6 @@ #include "system.h" #include "thread.h" -unsigned int ipod_hw_rev; - #if NUM_CORES > 1 struct mutex boostctrl_mtx NOCACHEBSS_ATTR; #endif @@ -240,10 +238,6 @@ void system_init(void) MMAP3_LOGICAL = 0x20000000 | 0x3a00; MMAP3_PHYSICAL = 0x00000000 | 0x3f84; - /* The hw revision is written to the last 4 bytes of SDRAM by the - bootloader - we save it before Rockbox overwrites it. */ - ipod_hw_rev = (*((volatile unsigned long*)(0x01fffffc))); - /* disable all irqs */ COP_HI_INT_CLR = -1; CPU_HI_INT_CLR = -1; diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h index afb1ce7314..2a06ee471f 100644 --- a/firmware/target/arm/system-target.h +++ b/firmware/target/arm/system-target.h @@ -28,7 +28,6 @@ #define outb(a,b) (*(volatile unsigned char *) (b) = (a)) #define inw(a) (*(volatile unsigned short *) (a)) #define outw(a,b) (*(volatile unsigned short *) (b) = (a)) -extern unsigned int ipod_hw_rev; static inline void udelay(unsigned usecs) {