summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-07-25 13:12:38 +0000
committerDave Chapman <dave@dchapman.com>2007-07-25 13:12:38 +0000
commitebc076bc15d6501674b9db772557a0eadfb4a5e2 (patch)
treea49e4460708d78c76ea25669afded36c3c631f04
parented095235d44a9427e76f05f9f6d35325ddf1d4d9 (diff)
downloadrockbox-ebc076bc15d6501674b9db772557a0eadfb4a5e2.tar.gz
rockbox-ebc076bc15d6501674b9db772557a0eadfb4a5e2.zip
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
-rw-r--r--apps/debug_menu.c20
-rw-r--r--bootloader/ipod.c11
-rw-r--r--firmware/export/hwcompat.h8
-rw-r--r--firmware/target/arm/ipod/lcd-color_nano.c6
-rw-r--r--firmware/target/arm/system-pp5002.c2
-rw-r--r--firmware/target/arm/system-pp502x.c6
-rw-r--r--firmware/target/arm/system-target.h1
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)
630 return false; 630 return false;
631 } 631 }
632#elif defined(CPU_PP502x) 632#elif defined(CPU_PP502x)
633 int line = 0;
633 char buf[32]; 634 char buf[32];
634 char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff, 635 char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff,
635 (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff, 636 (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff,
@@ -640,16 +641,25 @@ static bool dbg_hw_info(void)
640 lcd_setfont(FONT_SYSFIXED); 641 lcd_setfont(FONT_SYSFIXED);
641 lcd_clear_display(); 642 lcd_clear_display();
642 643
643 lcd_puts(0, 0, "[Hardware info]"); 644 lcd_puts(0, line++, "[Hardware info]");
644 645
645 snprintf(buf, sizeof(buf), "HW rev: 0x%08x", ipod_hw_rev); 646#ifdef IPOD_ARCH
646 lcd_puts(0, 1, buf); 647 snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
648 lcd_puts(0, line++, buf);
649#endif
650
651#ifdef IPOD_COLOR
652 extern int lcd_type; /* Defined in lcd-colornano.c */
653
654 snprintf(buf, sizeof(buf), "LCD type: %d", lcd_type);
655 lcd_puts(0, line++, buf);
656#endif
647 657
648 snprintf(buf, sizeof(buf), "PP version: %s", pp_version); 658 snprintf(buf, sizeof(buf), "PP version: %s", pp_version);
649 lcd_puts(0, 2, buf); 659 lcd_puts(0, line++, buf);
650 660
651 snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck()); 661 snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
652 lcd_puts(0, 3, buf); 662 lcd_puts(0, line++, buf);
653 663
654 lcd_update(); 664 lcd_update();
655 665
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 @@
40#include "power.h" 40#include "power.h"
41#include "file.h" 41#include "file.h"
42#include "common.h" 42#include "common.h"
43#include "hwcompat.h"
43 44
44#define XSC(X) #X 45#define XSC(X) #X
45#define SC(X) XSC(X) 46#define SC(X) XSC(X)
@@ -55,12 +56,6 @@ unsigned char *loadbuffer = (unsigned char *)DRAM_START;
55/* Bootloader version */ 56/* Bootloader version */
56char version[] = APPSVERSION; 57char version[] = APPSVERSION;
57 58
58#define IPOD_HW_REVISION (*((volatile unsigned long*)(0x00002084)))
59
60/* We copy the hardware revision to the last four bytes of SDRAM and then
61 re-read it after we have re-mapped SDRAM to 0x0 in Rockbox */
62#define TMP_IPOD_HW_REVISION (*((volatile unsigned long*)(0x11fffffc)))
63
64#define BUTTON_LEFT 1 59#define BUTTON_LEFT 1
65#define BUTTON_MENU 2 60#define BUTTON_MENU 2
66#define BUTTON_RIGHT 3 61#define BUTTON_RIGHT 3
@@ -240,9 +235,6 @@ void* main(void)
240 235
241 __backlight_on(); 236 __backlight_on();
242 237
243 TMP_IPOD_HW_REVISION = IPOD_HW_REVISION;
244 ipod_hw_rev = IPOD_HW_REVISION;
245
246 system_init(); 238 system_init();
247 kernel_init(); 239 kernel_init();
248 lcd_init(); 240 lcd_init();
@@ -300,7 +292,6 @@ void* main(void)
300 printf("Partition 1: 0x%02x %ld MB", 292 printf("Partition 1: 0x%02x %ld MB",
301 pinfo->type, pinfo->size / 2048); 293 pinfo->type, pinfo->size / 2048);
302 294
303
304 if (button_was_held || (btn==BUTTON_MENU)) { 295 if (button_was_held || (btn==BUTTON_MENU)) {
305 /* If either the hold switch was on, or the Menu button was held, then 296 /* If either the hold switch was on, or the Menu button was held, then
306 try the Apple firmware */ 297 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)
53bool is_new_player(void); 53bool is_new_player(void);
54#endif 54#endif
55 55
56#ifdef IPOD_ARCH
57#ifdef BOOTLOADER
58#define IPOD_HW_REVISION (*((unsigned long*)(0x00002084)))
59#else
60#define IPOD_HW_REVISION (*((unsigned long*)(0x20002084)))
61#endif
62#endif
63
56#endif /* HWCOMPAT_H */ 64#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 @@
28#include "lcd.h" 28#include "lcd.h"
29#include "kernel.h" 29#include "kernel.h"
30#include "system.h" 30#include "system.h"
31 31#include "hwcompat.h"
32 32
33/* check if number of useconds has past */ 33/* check if number of useconds has past */
34static inline bool timer_check(int clock_start, int usecs) 34static inline bool timer_check(int clock_start, int usecs)
@@ -46,7 +46,7 @@ static inline bool timer_check(int clock_start, int usecs)
46#define LCD_CNTL_VERT_RAM_ADDR_POS 0x45 46#define LCD_CNTL_VERT_RAM_ADDR_POS 0x45
47 47
48/*** globals ***/ 48/*** globals ***/
49static int lcd_type = 1; /* 0 = "old" Color/Photo, 1 = "new" Color & Nano */ 49int lcd_type = 1; /* 0 = "old" Color/Photo, 1 = "new" Color & Nano */
50 50
51static void lcd_wait_write(void) 51static void lcd_wait_write(void)
52{ 52{
@@ -109,7 +109,7 @@ void lcd_set_flip(bool yesno)
109void lcd_init_device(void) 109void lcd_init_device(void)
110{ 110{
111#if CONFIG_LCD == LCD_IPODCOLOR 111#if CONFIG_LCD == LCD_IPODCOLOR
112 if (ipod_hw_rev == 0x60000) { 112 if (IPOD_HW_REVISION == 0x60000) {
113 lcd_type = 0; 113 lcd_type = 0;
114 } else { 114 } else {
115 int gpio_a01, gpio_a04; 115 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 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "system.h" 19#include "system.h"
20 20
21unsigned int ipod_hw_rev;
22#ifndef BOOTLOADER 21#ifndef BOOTLOADER
23extern void TIMER1(void); 22extern void TIMER1(void);
24extern void TIMER2(void); 23extern void TIMER2(void);
@@ -149,7 +148,6 @@ void system_init(void)
149 MMAP3_LOGICAL = 0x20000000 | 0x3a00; 148 MMAP3_LOGICAL = 0x20000000 | 0x3a00;
150 MMAP3_PHYSICAL = 0x00000000 | 0x3f84; 149 MMAP3_PHYSICAL = 0x00000000 | 0x3f84;
151 150
152 ipod_hw_rev = (*((volatile unsigned long*)(0x01fffffc)));
153 outl(-1, 0xcf00101c); 151 outl(-1, 0xcf00101c);
154 outl(-1, 0xcf001028); 152 outl(-1, 0xcf001028);
155 outl(-1, 0xcf001038); 153 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 @@
19#include "system.h" 19#include "system.h"
20#include "thread.h" 20#include "thread.h"
21 21
22unsigned int ipod_hw_rev;
23
24#if NUM_CORES > 1 22#if NUM_CORES > 1
25struct mutex boostctrl_mtx NOCACHEBSS_ATTR; 23struct mutex boostctrl_mtx NOCACHEBSS_ATTR;
26#endif 24#endif
@@ -240,10 +238,6 @@ void system_init(void)
240 MMAP3_LOGICAL = 0x20000000 | 0x3a00; 238 MMAP3_LOGICAL = 0x20000000 | 0x3a00;
241 MMAP3_PHYSICAL = 0x00000000 | 0x3f84; 239 MMAP3_PHYSICAL = 0x00000000 | 0x3f84;
242 240
243 /* The hw revision is written to the last 4 bytes of SDRAM by the
244 bootloader - we save it before Rockbox overwrites it. */
245 ipod_hw_rev = (*((volatile unsigned long*)(0x01fffffc)));
246
247 /* disable all irqs */ 241 /* disable all irqs */
248 COP_HI_INT_CLR = -1; 242 COP_HI_INT_CLR = -1;
249 CPU_HI_INT_CLR = -1; 243 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 @@
28#define outb(a,b) (*(volatile unsigned char *) (b) = (a)) 28#define outb(a,b) (*(volatile unsigned char *) (b) = (a))
29#define inw(a) (*(volatile unsigned short *) (a)) 29#define inw(a) (*(volatile unsigned short *) (a))
30#define outw(a,b) (*(volatile unsigned short *) (b) = (a)) 30#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
31extern unsigned int ipod_hw_rev;
32 31
33static inline void udelay(unsigned usecs) 32static inline void udelay(unsigned usecs)
34{ 33{