summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s3c2440
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2007-04-21 04:48:20 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2007-04-21 04:48:20 +0000
commit8a1fd8c686d2a4b8be36754e545338a476150e6a (patch)
treef69fd8be012099a8de228bd197346e4b11cf8e4a /firmware/target/arm/s3c2440
parentdd0f1c7db1e73859805f9d9aa343bb6e04dd739e (diff)
Commit FS#6929 - Gigabeat bootloader improvements by Barry Wardell and myself. This build fixes the problems seen with the latest builds on the Gigabeat X. Added View IO Ports under the Debug menu for the Gigabeat. Make sure you grab the latest bootloader from the Wiki as the old bootloader will not work properly with new builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13225 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/s3c2440')
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c4
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c17
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c17
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h2
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c2
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c2
6 files changed, 38 insertions, 6 deletions
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
index bc2b53d776..34fbc2b2ac 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
@@ -52,8 +52,8 @@ void ata_enable(bool on)
else
USB_ATA_ENABLE;
- GPBCON=( GPGCON&~(1<<11) ) | (1<<10); /* Make the pin an output */
-// GPBUP|=1<<5; /* Disable pullup in SOC as we are now driving */
+ GPBCON=( GPBCON&~(1<<11) ) | (1<<10); /* Make the pin an output */
+ GPBUP|=1<<5; /* Disable pullup in SOC as we are now driving */
}
bool ata_is_coldstart(void)
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
index 1bb68f9686..11edcfecb1 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
@@ -53,6 +53,23 @@ unsigned int LCDBASEL(unsigned int address)
/* LCD init */
void lcd_init_device(void)
{
+#ifdef BOOTLOADER
+ /* When the Rockbox bootloader starts, we are changing framebuffer address,
+ but we don't want what's shown on the LCD to change until we do an
+ lcd_update(), so copy the data from the old framebuffer to the new one */
+ int i;
+ unsigned short *buf = (unsigned short*)FRAME;
+
+ memcpy(FRAME, (short *)((LCDSADDR1)<<1), 320*240*2);
+
+ /* The Rockbox bootloader is transitioning from RGB555I to RGB565 mode
+ so convert the frambuffer data accordingly */
+ for(i=0; i< 320*240; i++){
+ *buf = ((*buf>>1) & 0x1F) | (*buf & 0xffc0);
+ buf++;
+ }
+#endif
+
LCDSADDR1 = (LCDBANK((unsigned)FRAME) << 21) | (LCDBASEU((unsigned)FRAME));
LCDSADDR2 = LCDBASEL((unsigned)FRAME);
LCDSADDR3 = 0x000000F0;
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c
index 6142213f0c..c47c1330bc 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c
@@ -3,7 +3,6 @@
#include "mmu-meg-fx.h"
#include "panic.h"
-void map_memory(void);
static void enable_mmu(void);
static void set_ttb(void);
static void set_page_tables(void);
@@ -15,7 +14,7 @@ static void map_section(unsigned int pa, unsigned int va, int mb, int cache_flag
#define BUFFERED (1 << 2)
#define MB (1 << 20)
-void map_memory(void) {
+void memory_init(void) {
set_ttb();
set_page_tables();
enable_mmu();
@@ -69,6 +68,20 @@ void map_section(unsigned int pa, unsigned int va, int mb, int cache_flags) {
}
static void enable_mmu(void) {
+ int regread;
+
+ asm volatile(
+ "MRC p15, 0, %r0, c1, c0, 0\n" /* Read reg1, control register */
+ : /* outputs */
+ "=r"(regread)
+ : /* inputs */
+ : /* clobbers */
+ "r0"
+ );
+
+ if ( !(regread & 0x04) || !(regread & 0x00001000) ) /* Was the ICache or DCache Enabled? */
+ clean_dcache(); /* If so we need to clean the DCache before invalidating below */
+
asm volatile("mov r0, #0\n"
"mcr p15, 0, r0, c8, c7, 0\n" /* invalidate TLB */
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h
index 71b1b83801..524978852d 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h
@@ -32,4 +32,4 @@ void dump_dcache_range(const void *base, unsigned int size);
/* Cleans entire DCache */
void clean_dcache(void);
-
+void memory_init(void);
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c
index b7e59e66ea..6c5e35f0d5 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c
@@ -1,6 +1,7 @@
#include "kernel.h"
#include "system.h"
#include "panic.h"
+#include "mmu-meg-fx.h"
#include "lcd.h"
#include <stdio.h>
@@ -11,6 +12,7 @@ const int DMA0_MASK = (1 << 17);
const int DMA1_MASK = (1 << 18);
const int DMA2_MASK = (1 << 19);
const int DMA3_MASK = (1 << 20);
+const int ALARM_MASK = (1 << 30);
int system_memory_guard(int newmode)
{
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c
index 3aed8c3256..af66e2a60c 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c
@@ -44,7 +44,7 @@ inline bool usb_detect(void)
void usb_init_device(void)
{
/* Input is the default configuration, only pullups need to be disabled */
- GPFUP|=0x02;
+/* GPFUP|=0x02; */
USB_VPLUS_PWR_ASSERT;
GPBCON=( GPBCON&~(1<<13) ) | (1 << 12);