From: <pal...@us...> - 2005-01-08 22:46:56
|
Update of /cvsroot/gc-linux/linux/arch/ppc/platforms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32197/arch/ppc/platforms Modified Files: gamecube.c gcn-dvdcover.c gcn-rtc.c Log Message: Initial EXI framework check-in, including BBA changes Index: gamecube.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/gamecube.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- gamecube.c 8 Jan 2005 14:09:53 -0000 1.30 +++ gamecube.c 8 Jan 2005 22:46:47 -0000 1.31 @@ -40,7 +40,7 @@ return GCN_MEM_SIZE; } -static void __init gamecube_map_io(void) +static void gamecube_map_io(void) { /* all RAM and more ??? */ io_block_mapping(0xd0000000, 0, 0x02000000, _PAGE_IO); @@ -66,7 +66,7 @@ gamecube_restart(NULL); } -static void __init gamecube_calibrate_decr(void) +static void gamecube_calibrate_decr(void) { int freq, divisor; freq = 162000000; @@ -120,7 +120,7 @@ .end = flipper_end_irq, }; -static void __init gamecube_init_IRQ(void) +static void gamecube_init_IRQ(void) { int i; @@ -146,7 +146,7 @@ return 0; } -static void __init gamecube_setup_arch(void) +static void gamecube_setup_arch(void) { #ifdef CONFIG_GAMECUBE_CONSOLE #if (GCN_XFB_START <= 0x00fffe00) @@ -201,14 +201,14 @@ ppc_md.find_end_of_memory = gamecube_find_end_of_memory; ppc_md.setup_io_mappings = gamecube_map_io; - ppc_md.time_init = gcn_time_init; - ppc_md.set_rtc_time = gcn_set_rtc_time; - ppc_md.get_rtc_time = gcn_get_rtc_time; - #ifdef CONFIG_KEXEC ppc_md.machine_shutdown = gamecube_shutdown; ppc_md.machine_kexec_prepare = gamecube_kexec_prepare; ppc_md.machine_kexec = machine_kexec_simple; #endif /* CONFIG_KEXEC */ + /* no RTC driver, too slow */ + ppc_md.time_init = NULL; + ppc_md.set_rtc_time = NULL; + ppc_md.get_rtc_time = NULL; } Index: gcn-dvdcover.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/gcn-dvdcover.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gcn-dvdcover.c 6 Jan 2005 20:04:20 -0000 1.2 +++ gcn-dvdcover.c 8 Jan 2005 22:46:47 -0000 1.3 @@ -16,7 +16,6 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> -#include <linux/interrupt.h> #include <asm/io.h> @@ -62,44 +61,9 @@ #define di_printk(level, format, arg...) \ printk(level PFX format , ## arg) -typedef enum { - OPENED = 0, - CLOSED, - UNKNOWN, -} gcn_dvdcover_state_t; - -gcn_dvdcover_state_t gcn_dvdcover_state = UNKNOWN; - -/** - * - */ -static irqreturn_t gcn_dvdcover_handler(int this_irq, void *dev_id, - struct pt_regs *regs) -{ - unsigned long reason = readl(DI_DICVR); - - gcn_dvdcover_state = (readl(DI_DICVR) & DI_DICVR_CVR)? - OPENED:CLOSED; - - di_printk(KERN_INFO, "DVD cover was %s.\n", - (gcn_dvdcover_state == OPENED) ? - "opened" : "closed"); - - /* handle only DVD cover interrupts here */ - if (reason & DI_DICVR_CVRINT) { - writel(reason | DI_DICVR_CVRINT, DI_DICVR); - return IRQ_HANDLED; - } - return IRQ_NONE; -} - -/** - * - */ static int gcn_dvdcover_init(void) { unsigned long outval; - int err; /* clear pending DI interrupts and mask new ones */ /* this prevents an annoying bug while we lack a complete DVD driver */ @@ -111,16 +75,6 @@ writel(DI_CMD_STOP << 24, DI_DICMDBUF0); writel(DI_DICR_TSTART, DI_DICR); - err = request_irq(DVD_IRQ, gcn_dvdcover_handler, 0, - "Nintendo GameCube DVD", 0); - if (err) { - di_printk(KERN_ERR, "request of irq%d failed\n", DVD_IRQ); - return err; - } - - /* enable DVD cover interrupts */ - writel(readl(DI_DICVR) | DI_DICVR_CVRINTMASK, DI_DICVR); - return 0; } @@ -129,7 +83,7 @@ */ static void gcn_dvdcover_exit(void) { - free_irq(DVD_IRQ, 0); + } module_init(gcn_dvdcover_init); Index: gcn-rtc.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/gcn-rtc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gcn-rtc.c 19 Oct 2004 22:58:36 -0000 1.1 +++ gcn-rtc.c 8 Jan 2005 22:46:47 -0000 1.2 @@ -17,10 +17,6 @@ #include <linux/time.h> #include <linux/exi.h> -#ifndef EXI_LITE -#error Sorry, this driver needs currently the gcn-exi-lite framework. -#endif - /* * The EXI functions that we use are guaranteed to work by the gcn-exi-lite * framework even if exi_lite_init() has not been called. @@ -28,12 +24,28 @@ #define RTC_OFFSET 946684800L +static int rtc_probe(struct exi_device *); +static void rtc_remove(struct exi_device *); + static int bias = 0; +static int initialized = 0; +static struct exi_driver rtc_exi_driver = { + .name = "RTC/SRAM", + .eid = { + .channel = 0, + .device = 1, + .id = 0xFFFF1698 + }, + .frequency = 3, + .probe = rtc_probe, + .remove = rtc_remove +}; +#if 0 static void read_sram(unsigned char *abuf) { unsigned long a; - + /* select the SRAM device */ exi_select(0, 1, 3); @@ -87,34 +99,63 @@ /* Deselect the RTC device */ exi_deselect(0); } - +#endif /** * */ -long __init gcn_time_init(void) +unsigned long gcn_get_rtc_time(void) { - char sram[64]; - int *pbias = (int *)&sram[0xC]; - read_sram(sram); - bias = *pbias; + static int i=0; + if (i++ == 0) { + printk(KERN_INFO "Get RTC time\n"); + } + if (initialized) { + //return get_rtc() + bias + RTC_OFFSET; + } return 0; } /** * */ -unsigned long gcn_get_rtc_time(void) +int gcn_set_rtc_time(unsigned long nowtime) { - return get_rtc() + bias + RTC_OFFSET; + printk(KERN_INFO "Set RTC time %lu\n",nowtime); + if (initialized) { + //set_rtc(nowtime - RTC_OFFSET - bias); + return 0; + } + + return 0; +} + +static int rtc_probe(struct exi_device *dev) +{ + /* nothing to probe, hardware is always there */ + initialized = 1; + + return 0; +} + +static void rtc_remove(struct exi_device *dev) +{ + initialized = 0; } /** * */ -int gcn_set_rtc_time(unsigned long nowtime) +long gcn_time_init(void) { - set_rtc(nowtime - RTC_OFFSET - bias); - - return 1; + printk(KERN_INFO "gcn_time_init\n"); + initialized = 0; + return 0; + //return exi_register_driver(&rtc_exi_driver); } + /* +char sram[64]; + int *pbias = (int *)&sram[0xC]; + read_sram(sram); + bias = *pbias; + return 0; */ |