From 7d4fed53cc1e8b0e5aa250ebea3a1b53fc3a50b2 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Mon, 5 Sep 2011 11:29:32 +0000 Subject: imx233:fuze+: major memory and usb rework - now identity map dram uncached and have a cached and buffered virtual alias - rework dma to handle virtual to physical pointers conversion - fix lcd frame pointer - implement usb detection properly - implement bootloader usb properly - allow the bootloader to disable MMC windowing (useful for recovery) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30432 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config.h | 2 +- firmware/export/config/sansafuzeplus.h | 2 +- firmware/export/imx233.h | 30 ++++++++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/config.h b/firmware/export/config.h index 57e6bb8a59..e1ce15a562 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -937,7 +937,7 @@ Lyre prototype 1 */ #endif /* CPU_PP */ -#if CONFIG_CPU == IMX31L +#if CONFIG_CPU == IMX31L || CONFIG_CPU == IMX233 #define NOCACHEBSS_ATTR __attribute__((section(".ncbss"),nocommon)) #define NOCACHEDATA_ATTR __attribute__((section(".ncdata"),nocommon)) #endif diff --git a/firmware/export/config/sansafuzeplus.h b/firmware/export/config/sansafuzeplus.h index 971ff019b6..13ad3af8ed 100644 --- a/firmware/export/config/sansafuzeplus.h +++ b/firmware/export/config/sansafuzeplus.h @@ -172,7 +172,7 @@ #define USB_VENDOR_ID 0x0781 #define USB_PRODUCT_ID 0x74e1 #define HAVE_USB_HID_MOUSE -//#define HAVE_BOOTLOADER_USB_MODE +#define HAVE_BOOTLOADER_USB_MODE /* The fuze+ actually interesting partition table does not use 512-byte sector * (usually 2048 logical sector size) */ diff --git a/firmware/export/imx233.h b/firmware/export/imx233.h index d9ea06a420..2a2097b5d7 100644 --- a/firmware/export/imx233.h +++ b/firmware/export/imx233.h @@ -21,17 +21,41 @@ #ifndef __IMX233_H__ #define __IMX233_H__ +/* + * Chip Memory Map: + * 0x00000000 - 0x00007fff: on chip ram + * 0x40000000 - 0x5fffffff: dram (512Mb max) + * 0x80000000 - 0x80100000: memory mapped registers + * We use the following map: + * 0x60000000 - 0x7fffffff: dram (cached) + * 0x90000000 - 0xafffffff: dram (buffered) + * everything else : identity mapped (uncached) + * + * As a side note it's important to notice that uncached dram is identity mapped + */ + #define IRAM_ORIG 0 #define IRAM_SIZE 0x8000 #define DRAM_ORIG 0x40000000 #define DRAM_SIZE (MEMORYSIZE * 0x100000) +#define UNCACHED_DRAM_ADDR 0x40000000 +#define CACHED_DRAM_ADDR 0x60000000 +#define BUFFERED_DRAM_ADDR 0x90000000 +#define CACHEALIGN_SIZE 32 + +#define PHYSICAL_ADDR(a) \ + ((typeof(a))((uintptr_t)(a) >= CACHED_DRAM_ADDR ? \ + ((uintptr_t)(a) - CACHED_DRAM_ADDR + UNCACHED_DRAM_ADDR) \ + :(uintptr_t)(a))) +#define UNCACHED_ADDR(a) PHYSICAL_ADDR(a) + #define TTB_BASE_ADDR (DRAM_ORIG + DRAM_SIZE - TTB_SIZE) #define TTB_SIZE 0x4000 #define TTB_BASE ((unsigned long *)TTB_BASE_ADDR) #define FRAME_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_DEPTH / 8) -#define LCD_FRAME_ADDR (DRAM_ORIG + DRAM_SIZE - TTB_SIZE - FRAME_SIZE) -#define FRAME ((unsigned short *)LCD_FRAME_ADDR) +#define FRAME_PHYS_ADDR (DRAM_ORIG + DRAM_SIZE - TTB_SIZE - FRAME_SIZE) +#define FRAME ((void *)(FRAME_PHYS_ADDR - UNCACHED_DRAM_ADDR + BUFFERED_DRAM_ADDR)) /* USBOTG */ #define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(2048))) @@ -52,5 +76,7 @@ #define CACHEALIGN_BITS 4 +#define __XTRACT(reg, field) ((reg & reg##__##field##_BM) >> reg##__##field##_BP) +#define __XTRACT_EX(val, field) (((val) & field##_BM) >> field##_BP) #endif /* __IMX233_H__ */ -- cgit v1.2.3