r1693 - in trunk
dslinux_amadeus at dslinux.in-berlin.de
dslinux_amadeus at dslinux.in-berlin.de
Sun Mar 18 12:35:11 CET 2007
Author: amadeus
Date: 2007-03-18 12:35:06 +0100 (Sun, 18 Mar 2007)
New Revision: 1693
Log:
support of opera memory expansion added
Modified: trunk/linux-2.6.x/arch/arm/mach-nds/arch.c
===================================================================
--- trunk/linux-2.6.x/arch/arm/mach-nds/arch.c 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/linux-2.6.x/arch/arm/mach-nds/arch.c 2007-03-18 11:35:06 UTC (rev 1693)
@@ -80,6 +80,21 @@
mi->bank[0].node = 0;
mi->nr_banks = 1;
#ifdef CONFIG_NDS_ROM8BIT
+#ifdef CONFIG_NDS_DLDI
+ {
+ /* test for opera RAM extension.
+ If OK, continue to enabling the RAM.
+ If not, simply return. */
+ volatile u16 *test = (volatile u16 *) 0x09000000;
+ u16 old = *test;
+ u16 new;
+ *test = 0xF00D;
+ new = *test;
+ *test = old;
+ if (new != 0xF00D)
+ return;
+ }
+#endif
mi->bank[1].start = CONFIG_FLASH_MEM_BASE;
mi->bank[1].size = CONFIG_FLASH_SIZE;
mi->bank[1].node = 0;
Modified: trunk/linux-2.6.x/arch/arm/mach-nds/head.S
===================================================================
--- trunk/linux-2.6.x/arch/arm/mach-nds/head.S 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/linux-2.6.x/arch/arm/mach-nds/head.S 2007-03-18 11:35:06 UTC (rev 1693)
@@ -211,6 +211,9 @@
#if defined(CONFIG_MMC_M3SD) || defined(CONFIG_IDE_NDS_M3) || defined(CONFIG_NDS_BLK_M3CF)
m3_set_ram @ switch to RAM mode
#endif
+#ifdef CONFIG_NDS_DLDI
+ op_set_ram @ switch to RAM mode
+#endif
@ more activation for other cards here
#endif
@@ -285,6 +288,17 @@
@ NOTE: this code must be synchronous with include/asm-arm/arch-nds/gbarom-macros.S
#ifdef CONFIG_NDS_ROM8BIT
ldr r0,=0b10000010
+#ifdef CONFIG_NDS_DLDI
+ @ test if there is actually a RAM-based card in the GBA slot.
+ @ Only enable data cache if there is RAM, because we would totally disable
+ @ the DLDI drivers for non-ram-based slot2 devices.
+ ldr r1,=0x09000000
+ ldr r2,=0xF00D
+ strh r2, [r1]
+ ldrh r3, [r1]
+ cmp r2, r3
+ ldrne r0,=0b00000010
+#endif
#else
ldr r0,=0b00000010
#endif
Modified: trunk/linux-2.6.x/drivers/block/dldi_c.c
===================================================================
--- trunk/linux-2.6.x/drivers/block/dldi_c.c 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/linux-2.6.x/drivers/block/dldi_c.c 2007-03-18 11:35:06 UTC (rev 1693)
@@ -46,12 +46,21 @@
extern struct IO_INTERFACE_STRUCT _io_dldi;
-/* This is the major number of /dev/hda */
-static int dldi_major = 3;
+struct dldi_params {
+ void *oldstack;
+ void *oldlink;
+ long para1;
+ long para2;
+ long para3;
+ void *function;
+};
-/* We don't know how big the medium is. So we take some big number, */
-static int nsectors = (2*1024*1024*2); /* 2 GBytes */
+extern struct dldi_params _param_dldi;
+extern int _call_dldi(void);
+
+extern char _buf_dldi[];
+
/*
* Minor number.
*/
@@ -61,6 +70,14 @@
#define REQ_SIZE 64
+#define BUF_SIZE 2048
+
+/* This is the major number of /dev/hda */
+static int dldi_major = 3;
+
+/* We don't know how big the medium is. So we take some big number, */
+static int nsectors = (2*1024*1024*2); /* 2 GBytes */
+
/*
* The internal representation of our device.
*/
@@ -75,6 +92,7 @@
static struct dldi_dev *Devices = NULL;
+
/*
* Handle an I/O request.
*/
@@ -82,19 +100,37 @@
unsigned long nsect, char *buffer, int write)
{
int ret = 0;
+ unsigned long sectors;
+ while (nsect > 0) {
+ sectors = nsect;
+ if (sectors > (BUF_SIZE/SECTOR_SIZE))
+ sectors = (BUF_SIZE/SECTOR_SIZE);
+
+ _param_dldi.para1 = sector;
+ _param_dldi.para2 = sectors;
+ _param_dldi.para3 = (long)_buf_dldi;
- if (write) {
- // printk(KERN_ERR "Write Sector %ld, %ld Blocks\n", sector, nsect);
- ret = _io_dldi.fn_writeSectors(sector, nsect, buffer);
- } else {
- // printk(KERN_ERR "Read Sector %ld, %ld Blocks\n", sector, nsect);
- ret = _io_dldi.fn_readSectors(sector, nsect, buffer);
+ if (write) {
+ // printk(KERN_ERR "Write Sector %ld, %ld Blocks\n", sector, nsect);
+ memcpy(_buf_dldi, buffer, sectors * SECTOR_SIZE);
+ _param_dldi.function = _io_dldi.fn_writeSectors;
+ } else {
+ // printk(KERN_ERR "Read Sector %ld, %ld Blocks\n", sector, nsect);
+ _param_dldi.function = _io_dldi.fn_readSectors;
+ }
+ ret = _call_dldi();
+ if (ret == 0) {
+ printk(KERN_ERR "dldi_transfer failure\n");
+ } else {
+ // printk(KERN_ERR "all OK\n");
+ }
+ if (!write)
+ memcpy(buffer, _buf_dldi, sectors * SECTOR_SIZE);
+
+ sector += sectors;
+ nsect -= sectors;
+ buffer += (sectors * SECTOR_SIZE);
}
- if (ret == 0) {
- printk(KERN_ERR "dldi_transfer failure\n");
- } else {
- // printk(KERN_ERR "all OK\n");
- }
}
/*
@@ -337,9 +373,10 @@
return -ENOMEM;
}
setup_device(Devices, 0);
-
+
/* Start the interface */
- ret = _io_dldi.fn_startup();
+ _param_dldi.function = _io_dldi.fn_startup;
+ ret = _call_dldi();
if (ret == 0) {
printk(KERN_ERR "dldi: fn_startup failure\n");
if (Devices->gd) {
@@ -364,7 +401,8 @@
cancel_delayed_work(&dev->dldi_work);
/* Shutdown the interface */
- ret = _io_dldi.fn_shutdown();
+ _param_dldi.function = _io_dldi.fn_shutdown;
+ ret = _call_dldi();
if (ret == 0) {
printk(KERN_ERR "dldi: fn_shutdown failure\n");
}
Modified: trunk/linux-2.6.x/drivers/block/dldi_s.S
===================================================================
--- trunk/linux-2.6.x/drivers/block/dldi_s.S 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/linux-2.6.x/drivers/block/dldi_s.S 2007-03-18 11:35:06 UTC (rev 1693)
@@ -2,11 +2,16 @@
.align 4
.arm
.global _io_dldi
+ .global _param_dldi
+ .global _call_dldi
+ .global _buf_dldi
+
@---------------------------------------------------------------------------------
.equ FEATURE_MEDIUM_CANREAD, 0x00000001
.equ FEATURE_MEDIUM_CANWRITE, 0x00000002
.equ FEATURE_SLOT_GBA, 0x00000010
.equ FEATURE_SLOT_NDS, 0x00000020
+.equ NDS_IME, 0x04000208
_dldi_start:
@@ -68,5 +73,43 @@
.space 32632 @ Fill to 32KiB
_dldi_end:
+
+ at ---------------------------------------------------------------------------------
+
+ .align
+_param_dldi:
+ .space 6*4
+
+ .align
+_call_dldi:
+ @ Disable interrupts (problems with stack switching without)
+ ldr r3, =NDS_IME @ interrupt mask register
+ mov ip, #0 @ 0 = disable
+ strh ip, [r3]
+ ldr ip,=_param_dldi @ ip = IO parameter block
+ str sp,[ip] @ store old stack pointer
+ str lr,[ip,#4] @ store old link register
+ ldr r0,[ip,#8] @ read parameter 1
+ ldr r1,[ip,#12] @ read parameter 2
+ ldr r2,[ip,#16] @ read parameter 3
+ ldr r3,[ip,#20] @ read pointer to function
+ ldr sp,=_stack_dldi @ set new stack
+ blx r3 @ execute the function
+ ldr ip,=_param_dldi @ ip = IO parameter block
+ ldr sp,[ip] @ restore stack
+ ldr lr,[ip,#4] @ restore link register
+ @ enable interrupts
+ ldr r3, =NDS_IME @ interrupt mask register
+ mov ip, #1 @ 1 = enable
+ strh ip, [r3]
+ bx lr @ return
+
+ .pool
+ .align
+ .space 1024 @ allows for allocating 1 sector on stack
+_stack_dldi:
+ .space 4 @ for safety
+_buf_dldi:
+ .space 2048 @ allows for 1 physical sector on NAND flash
.end
@---------------------------------------------------------------------------------
Modified: trunk/linux-2.6.x/include/asm-arm/arch-nds/gbarom-macro.S
===================================================================
--- trunk/linux-2.6.x/include/asm-arm/arch-nds/gbarom-macro.S 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/linux-2.6.x/include/asm-arm/arch-nds/gbarom-macro.S 2007-03-18 11:35:06 UTC (rev 1693)
@@ -1,7 +1,7 @@
/*
* include/asm-arm/arch-nds/gbarom-macro.S - GBA ROM switching macros
*
- * Copyright (C) 2006 Amadeus, All Rights Reserved.
+ * Copyright (C) 2007 Amadeus, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -194,3 +194,20 @@
.endm
/*****************************************************************************/
+/*
+ * Opera memory expansion pack Disk/RAM switching.
+ */
+
+ .macro op_set_disk
+ ldr r3, =0x08240000
+ mov ip, #0x0000
+ strh ip, [r3]
+ .endm
+
+ .macro op_set_ram
+ ldr r3, =0x08240000
+ mov ip, #0x0001
+ strh ip, [r3]
+ .endm
+
+/*****************************************************************************/
Modified: trunk/vendors/Nintendo/DLDI/Makefile
===================================================================
--- trunk/vendors/Nintendo/DLDI/Makefile 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/vendors/Nintendo/DLDI/Makefile 2007-03-18 11:35:06 UTC (rev 1693)
@@ -6,17 +6,12 @@
ROMFSIMG = $(IMAGEDIR)/romfs.img
ELFIMAGE = $(IMAGEDIR)/image.elf
-ifdef CONFIG_XIP_KERNEL
-IMAGE = $(IMAGEDIR)/dslinux.ds.gba
-else
-IMAGE = $(IMAGEDIR)/dslinux.nds.gba
-endif
FATFS = media
ROMFS_DIRS = boot dev proc sbin $(FATFS)/linux
-FS_DIRS = etc/rc.d home lib usr/bin usr/games usr/lib usr/share/udhcpc var/tmp var/run etc etc/rc.d
+FS_DIRS = etc/rc.d home lib usr/bin usr/games usr/lib usr/share/udhcpc var/tmp var/run
DEVICES = \
tty,c,5,0 console,c,5,1 cua0,c,5,64 cua1,c,5,65 \
@@ -33,6 +28,7 @@
dsp,c,14,3\
\
fb0,c,29,0\
+ fb1,c,29,1\
\
psaux,c,10,1 mouse0,c,13,32\
\
@@ -78,12 +74,13 @@
$(ROMFSINST) -s /var/tmp /tmp
$(ROMFSINST) /boot/rc
$(ROMFSINST) /boot/inittab
- $(ROMFSINST) /etc/issue
+ $(ROMFSINST) /$(FATFS)/linux/etc/issue
$(ROMFSINST) $(NDS_COMMON)/rc.common /$(FATFS)/linux/etc/rc.common
$(ROMFSINST) $(NDS_COMMON)/rc.defaults /$(FATFS)/linux/etc/rc.defaults
for f in $(NDS_COMMON)/rc.d/*; do \
[ -d $$f ] || $(ROMFSINST) $$f /$(FATFS)/linux/etc/rc.d/ ; \
done
+
$(ROMFSINST) -p +x $(NDS_COMMON)/default.script /usr/share/udhcpc/default.script
echo "$(VERSIONSTR) -- " `date` > $(ROMFSDIR)/etc/version
@@ -103,36 +100,29 @@
-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/login $(ROMFSDIR)/bin
-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/init $(ROMFSDIR)/bin
-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/autologin $(ROMFSDIR)/bin
+ # move MADPLAY into internal RAM and make it XIP, to gain the processing power
+ # for undisturbed audio.
+ -mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/madplay $(ROMFSDIR)/bin
+ $(CROSS)flthdr -R $(ROMFSDIR)/bin/madplay
$(CROSS_COMPILE)flthdr -Z $(ROMFSDIR)/bin/*
-rm -r $(IMAGEDIR)/linux
mv $(ROMFSDIR)/$(FATFS)/linux $(IMAGEDIR)
genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)
- if [ "$(CONFIG_XIP_KERNEL)" != "y" ]; then \
- BSS=`$(CROSS_COMPILE)objdump --headers $(ROOTDIR)/$(LINUXDIR)/linux | \
- grep .bss` && \
- BSSADDR=`set -- $${BSS} ; echo 0x$${4}` && \
- BSSSIZE=`set -- $${BSS} ; echo 0x$${3}` && \
- ADDR=`echo $${BSSADDR} $${BSSSIZE} | \
- perl -ane 'printf "0x%x\n",hex($$F[0]) + hex($$F[1])' ` && \
- echo "BSS=$${BSSADDR},$${BSSSIZE} ADDR=$${ADDR}" && \
- $(CROSS_COMPILE)objcopy --add-section=.romfs=$(ROMFSIMG) \
- --adjust-section-vma=.romfs=$${ADDR} --no-adjust-warnings \
- --set-section-flags=.romfs=alloc,load,data \
- $(ROOTDIR)/$(LINUXDIR)/linux $(ELFIMAGE) 2> /dev/null && \
- $(CROSS_COMPILE)objcopy -O binary $(ELFIMAGE) $(IMAGEDIR)/arm9.bin && \
- ndstool -c $(IMAGEDIR)/dslinux.nds -9 $(IMAGEDIR)/arm9.bin \
- -r9 0x02000000 -e9 0x02000000 \
- -7 $(ROOTDIR)/$(LINUXDIR)/arch/arm/mach-nds/arm7.bin \
- -r7 0x03800000 -e7 0x03800000 \
- -b $(NDS_COMMON)/tux.bmp "DSLinux;Port of Linux;to the DS!" && \
- ( cd $(IMAGEDIR); tar -cvzf dslinux-dldi.tgz linux dslinux.nds ) ;\
- else \
- $(CROSS_COMPILE)objcopy -O binary \
- --remove-section=.text --remove-section=.init \
- $(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data && \
- $(CROSS_COMPILE)objcopy -O binary \
- -j .init -j .text \
- $(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.text && \
- cat $(IMAGEDIR)/linux.text $(IMAGEDIR)/linux.data $(ROMFSIMG) > $(IMAGE) ; \
- fi
-
+ BSS=`$(CROSS_COMPILE)objdump --headers $(ROOTDIR)/$(LINUXDIR)/linux | \
+ grep .bss` && \
+ BSSADDR=`set -- $${BSS} ; echo 0x$${4}` && \
+ BSSSIZE=`set -- $${BSS} ; echo 0x$${3}` && \
+ ADDR=`echo $${BSSADDR} $${BSSSIZE} | \
+ perl -ane 'printf "0x%x\n",hex($$F[0]) + hex($$F[1])' ` && \
+ echo "BSS=$${BSSADDR},$${BSSSIZE} ADDR=$${ADDR}" && \
+ $(CROSS_COMPILE)objcopy --add-section=.romfs=$(ROMFSIMG) \
+ --adjust-section-vma=.romfs=$${ADDR} --no-adjust-warnings \
+ --set-section-flags=.romfs=alloc,load,data \
+ $(ROOTDIR)/$(LINUXDIR)/linux $(ELFIMAGE) 2> /dev/null && \
+ $(CROSS_COMPILE)objcopy -O binary $(ELFIMAGE) $(IMAGEDIR)/arm9.bin && \
+ ndstool -c $(IMAGEDIR)/dslinux.nds -9 $(IMAGEDIR)/arm9.bin \
+ -r9 0x02000000 -e9 0x02000000 \
+ -7 $(ROOTDIR)/$(LINUXDIR)/arch/arm/mach-nds/arm7.bin \
+ -r7 0x03800000 -e7 0x03800000 \
+ -b $(NDS_COMMON)/tux.bmp "DSLinux;Port of Linux;to the DS!" && \
+ ( cd $(IMAGEDIR); tar -cvzf dslinux-dldi.tgz linux dslinux.nds ) ;
\ No newline at end of file
Modified: trunk/vendors/Nintendo/DLDI/config.arch
===================================================================
--- trunk/vendors/Nintendo/DLDI/config.arch 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/vendors/Nintendo/DLDI/config.arch 2007-03-18 11:35:06 UTC (rev 1693)
@@ -1,2 +1,14 @@
-# VENDOR_CFLAGS := -mswp-byte-writes -DCONFIG_NDS_ROM8BIT
-include $(ROOTDIR)/vendors/Nintendo/common/common-config.arch
+.EXPORT_ALL_VARIABLES:
+
+NDS_COMMON = $(ROOTDIR)/vendors/Nintendo/common
+
+CONSOLE_BAUD_RATE = 115200
+
+# CPUFLAGS :=
+VENDOR_CFLAGS := -mswp-byte-writes -DCONFIG_NDS_ROM8BIT -mcpu=arm946e-s -mfpu=fpe3
+LD_OPTION := -mswp-byte-writes
+# DISABLE_XIP := 1
+DISABLE_MOVE_RODATA := 1
+DISABLE_SHARED_LIBS := 1
+
+include $(ROOTDIR)/vendors/config/armnommu/config.arch
Modified: trunk/vendors/Nintendo/DLDI/config.linux-2.6.x
===================================================================
--- trunk/vendors/Nintendo/DLDI/config.linux-2.6.x 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/vendors/Nintendo/DLDI/config.linux-2.6.x 2007-03-18 11:35:06 UTC (rev 1693)
@@ -89,8 +89,8 @@
# CONFIG_SET_MEM_PARAM is not set
CONFIG_DRAM_BASE=0x02000000
CONFIG_DRAM_SIZE=0x00400000
-CONFIG_FLASH_MEM_BASE=0x08000000
-CONFIG_FLASH_SIZE=0x02000000
+CONFIG_FLASH_MEM_BASE=0x09000000
+CONFIG_FLASH_SIZE=0x00800000
#
# Nintendo DS Options
@@ -98,7 +98,7 @@
# CONFIG_NDS_TEXT_CONSOLE is not set
# CONFIG_NDS_FASTGBA is not set
# CONFIG_NDS_SOUNDTEST is not set
-# CONFIG_NDS_ROM8BIT is not set
+CONFIG_NDS_ROM8BIT=y
# CONFIG_NDS_BLK_M3CF is not set
# CONFIG_NDS_BLK_SCCF is not set
Modified: trunk/vendors/Nintendo/DLDI/inittab
===================================================================
--- trunk/vendors/Nintendo/DLDI/inittab 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/vendors/Nintendo/DLDI/inittab 2007-03-18 11:35:06 UTC (rev 1693)
@@ -1,2 +1,4 @@
tty1::linux:/usr/bin/agetty -n -l /bin/autologin 38400 tty1
+tty2::linux:/usr/bin/agetty -n -l /bin/autologin 38400 tty2
+tty3::linux:/usr/bin/agetty -n -l /bin/autologin 38400 tty3
Modified: trunk/vendors/Nintendo/RAM/Makefile
===================================================================
--- trunk/vendors/Nintendo/RAM/Makefile 2007-03-16 21:44:17 UTC (rev 1692)
+++ trunk/vendors/Nintendo/RAM/Makefile 2007-03-18 11:35:06 UTC (rev 1693)
@@ -106,10 +106,6 @@
-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/login $(ROMFSDIR)/bin
-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/init $(ROMFSDIR)/bin
-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/autologin $(ROMFSDIR)/bin
- # move MADPLAY into internal RAM and make it XIP, to gain the processing power
- # for undisturbed audio.
- -mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/madplay $(ROMFSDIR)/bin
- $(CROSS)flthdr -R $(ROMFSDIR)/bin/madplay
$(CROSS_COMPILE)flthdr -Z $(ROMFSDIR)/bin/*
-rm -r $(IMAGEDIR)/linux
mv $(ROMFSDIR)/$(FATFS)/linux $(IMAGEDIR)
More information about the dslinux-commit
mailing list