From 1f0d06f085453a3d0a9b1e94bb2821c9ab314e57 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 7 Oct 2007 16:44:55 +0000 Subject: [PATCH] * Use proper definitions for the PP (mono) LCD bridge. * Clean up pp5002.h a bit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15018 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/pp5002.h | 22 +++++++------- firmware/export/pp5020.h | 7 +++++ firmware/target/arm/ipod/lcd-gray.c | 29 +++++-------------- .../target/arm/sandisk/sansa-c200/lcd-c200.c | 21 +++++--------- 4 files changed, 34 insertions(+), 45 deletions(-) diff --git a/firmware/export/pp5002.h b/firmware/export/pp5002.h index 730e42b66d..c4baa7cfd3 100644 --- a/firmware/export/pp5002.h +++ b/firmware/export/pp5002.h @@ -22,16 +22,14 @@ /* Much info gleaned and/or copied from the iPodLinux project. */ #define DRAM_START 0x28000000 -#define PROCESSOR_ID (*(volatile unsigned long *)(0xc4000000)) +/* LCD bridge */ +#define LCD1_BASE (*(volatile unsigned long *)(0xc0001000)) +#define LCD1_CMD (*(volatile unsigned long *)(0xc0001008)) +#define LCD1_DATA (*(volatile unsigned long *)(0xc0001010)) -#define IPOD_LCD_BASE 0xc0001000 - -/* Processor ID */ -#define PROCESSOR_ID (*(volatile unsigned long *)(0xc4000000)) - -#define PROC_ID_CPU 0x55 -#define PROC_ID_COP 0xaa +#define LCD1_BUSY_MASK 0x8000 +/* I2S controller */ #define IISCONFIG (*(volatile unsigned long *)(0xc0002500)) #define IISFIFO_CFG (*(volatile unsigned long *)(0xc000251c)) #define IISFIFO_WR (*(volatile unsigned long *)(0xc0002540)) @@ -46,8 +44,6 @@ #define IIS_IRQTX_REG IISFIFO_CFG #define IIS_IRQTX (1 << 9) -#define I2C_BASE 0xc0008000 - #define IDE_BASE 0xc0003000 #define IDE_CFG_STATUS (*(volatile unsigned long *)(0xc0003024)) @@ -56,6 +52,12 @@ #define I2C_BASE 0xc0008000 +/* Processor ID */ +#define PROCESSOR_ID (*(volatile unsigned long *)(0xc4000000)) + +#define PROC_ID_CPU 0x55 +#define PROC_ID_COP 0xaa + #define GPIOA_ENABLE (*(volatile unsigned char *)(0xcf000000)) #define GPIOB_ENABLE (*(volatile unsigned char *)(0xcf000004)) #define GPIOC_ENABLE (*(volatile unsigned char *)(0xcf000008)) diff --git a/firmware/export/pp5020.h b/firmware/export/pp5020.h index 2f49c50bad..df8c8fb058 100644 --- a/firmware/export/pp5020.h +++ b/firmware/export/pp5020.h @@ -399,6 +399,13 @@ /* Note: didn't bother to see of levels 0 and 16 actually work */ +/* First ("mono") LCD bridge */ +#define LCD1_BASE (*(volatile unsigned long *)(0x70003000)) +#define LCD1_CMD (*(volatile unsigned long *)(0x70003008)) +#define LCD1_DATA (*(volatile unsigned long *)(0x70003010)) + +#define LCD1_BUSY_MASK 0x8000 + /* Serial Controller */ #define SERIAL0 (*(volatile unsigned long*)(0x70006000)) #define SERIAL1 (*(volatile unsigned long*)(0x70006040)) diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c index 707075b701..bea1ed46ed 100644 --- a/firmware/target/arm/ipod/lcd-gray.c +++ b/firmware/target/arm/ipod/lcd-gray.c @@ -30,19 +30,6 @@ #include "system.h" #include "hwcompat.h" - -/*** hardware configuration ***/ - -#if CONFIG_CPU == PP5002 -#define IPOD_LCD_BASE 0xc0001000 -#else /* PP502x */ -#define IPOD_LCD_BASE 0x70003000 -#endif - -#define LCD_BUSY_MASK 0x00008000 -#define LCD_CMD 0x08 -#define LCD_DATA 0x10 - /* LCD command codes for HD66753 */ #define R_START_OSC 0x00 @@ -97,7 +84,7 @@ static const unsigned char dibits[16] ICONST_ATTR = { /* wait for LCD with timeout */ static inline void lcd_wait_write(void) { - while (inl(IPOD_LCD_BASE) & LCD_BUSY_MASK); + while (LCD1_BASE & LCD1_BUSY_MASK); } /* send LCD data */ @@ -109,11 +96,11 @@ static void lcd_send_data(unsigned data) { lcd_wait_write(); #ifdef IPOD_MINI2G - outl(data | 0x760000, IPOD_LCD_BASE+8); + LCD1_CMD = data | 0x760000; #else - outl(data >> 8, IPOD_LCD_BASE + LCD_DATA); + LCD1_DATA = data >> 8; lcd_wait_write(); - outl(data & 0xff, IPOD_LCD_BASE + LCD_DATA); + LCD1_DATA = data & 0xff; #endif } @@ -122,11 +109,11 @@ static void lcd_prepare_cmd(unsigned cmd) { lcd_wait_write(); #ifdef IPOD_MINI2G - outl(cmd | 0x740000, IPOD_LCD_BASE+8); + LCD1_CMD = cmd | 0x740000; #else - outl(0x0, IPOD_LCD_BASE + LCD_CMD); + LCD1_CMD = 0; lcd_wait_write(); - outl(cmd, IPOD_LCD_BASE + LCD_CMD); + LCD1_CMD = cmd; #endif } @@ -168,7 +155,7 @@ void lcd_init_device(void) power_reg_h = 0x1100; #elif defined IPOD_MINI2G lcd_wait_write(); - outl((inl(IPOD_LCD_BASE) & ~0x1f00000) | 0x1700000, IPOD_LCD_BASE); + LCD1_BASE = (LCD1_BASE & ~0x1f00000) | 0x1700000; #endif lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc); diff --git a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c index 37f15836fd..ef336b46c0 100644 --- a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c +++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c @@ -22,12 +22,6 @@ #include "kernel.h" #include "system.h" -#define LCD_BASE (*(volatile unsigned long *)(0x70003000)) -#define LCD_CMD (*(volatile unsigned long *)(0x70003008)) -#define LCD_DATA (*(volatile unsigned long *)(0x70003010)) - -#define LCD_BUSY 0x8000 - /* LCD command set for Samsung S6B33B2 */ #define R_OSCILLATION_MODE 0x02 @@ -68,24 +62,23 @@ /* wait for LCD */ static inline void lcd_wait_write(void) { - while (LCD_BASE & LCD_BUSY); + while (LCD1_BASE & LCD1_BUSY_MASK); } /* send LCD data */ static void lcd_send_data(unsigned data) { lcd_wait_write(); - LCD_DATA = data >> 8; - + LCD1_DATA = data >> 8; lcd_wait_write(); - LCD_DATA = data & 0xff; + LCD1_DATA = data & 0xff; } /* send LCD command */ static void lcd_send_command(unsigned cmd) { lcd_wait_write(); - LCD_CMD = cmd; + LCD1_CMD = cmd; } /* LCD init */ @@ -98,13 +91,13 @@ void lcd_init_device(void) DEV_INIT &= ~0x400; udelay(10000); - LCD_BASE &= ~0x4; + LCD1_BASE &= ~0x4; udelay(15); - LCD_BASE |= 0x4; + LCD1_BASE |= 0x4; udelay(10); - LCD_BASE = 0x4687; + LCD1_BASE = 0x4687; udelay(10000); lcd_send_command(R_STANDBY_OFF);