From: Albert H. <he...@us...> - 2005-11-07 21:40:29
|
Update of /cvsroot/gc-linux/linux/arch/ppc/platforms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17691/arch/ppc/platforms Modified Files: gcn-rtc.c Log Message: rtc driver rewrite using the most recent exi framework. We use here the "try" version of the channel allocation functions as we can be called wildly from irq context. Index: gcn-rtc.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/gcn-rtc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gcn-rtc.c 25 Apr 2005 19:34:48 -0000 1.4 +++ gcn-rtc.c 7 Nov 2005 21:40:20 -0000 1.5 @@ -23,7 +23,7 @@ #define DRV_DESCRIPTION "Nintendo GameCube RTC/SRAM driver" #define DRV_AUTHOR "Albert Herranz" -static char rtc_driver_version[] = "1.0"; +static char rtc_driver_version[] = "1.4"; #define rtc_printk(level, format, arg...) \ printk(level DRV_MODULE_NAME ": " format , ## arg) @@ -70,8 +70,10 @@ struct gcn_sram *sram = &priv->sram; u32 req; - /* select the SRAM device */ - if (exi_dev_select(dev) == 0) { + if (exi_dev_try_take(dev) == 0) { + /* select the SRAM device */ + exi_dev_select(dev); + /* send the appropriate command */ req = 0x20000100; exi_dev_write(dev, &req, sizeof(req)); @@ -81,6 +83,8 @@ /* deselect the SRAM device */ exi_dev_deselect(dev); + + exi_dev_give(dev); } return; @@ -94,8 +98,10 @@ { unsigned long a = 0; - /* select the RTC device */ - if (exi_dev_select(dev) == 0) { + if (exi_dev_try_take(dev) == 0) { + /* select the SRAM device */ + exi_dev_select(dev); + /* send the appropriate command */ a = 0x20000000; exi_dev_write(dev, &a, sizeof(a)); @@ -105,6 +111,8 @@ /* deselect the RTC device */ exi_dev_deselect(dev); + + exi_dev_give(dev); } return a; @@ -126,9 +134,11 @@ * interrupt code is prepared to deal with such case. */ - /* select the RTC device */ - retval = exi_dev_select(dev); + retval = exi_dev_try_take(dev); if (!retval) { + /* select the RTC device */ + exi_dev_select(dev); + /* send the appropriate command */ req = 0xa0000000; exi_dev_write(dev, &req, sizeof(req)); @@ -138,6 +148,8 @@ /* deselect the RTC device */ exi_dev_deselect(dev); + + exi_dev_give(dev); } return retval; } |