From: Albert H. <he...@us...> - 2008-02-24 18:06:00
|
Update of /cvsroot/gc-linux/linux/drivers/exi In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4818/drivers/exi Modified Files: exi-driver.c exi-hw.c exi-hw.h Log Message: Merged 2.6.24. Added usbgecko driver. Added fixes for: exi, gcn-sd, gcn-mic, gcn-gqr. Adapted: gcn-bba, gcn-gqr, gcn-rtc. Added very primitive support for the Nintendo Wii. Index: exi-driver.c =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/exi/exi-driver.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- exi-driver.c 17 Feb 2007 23:43:41 -0000 1.13 +++ exi-driver.c 24 Feb 2008 18:05:31 -0000 1.14 @@ -2,10 +2,10 @@ * drivers/exi/exi-driver.c * * Nintendo GameCube Expansion Interface support. Driver model routines. - * Copyright (C) 2004-2006 The GameCube Linux Team + * Copyright (C) 2004-2008 The GameCube Linux Team * Copyright (C) 2004 Arthur Othieno <a.o...@bl...> * Copyright (C) 2004,2005 Todd Jeffreys <to...@vo...> - * Copyright (C) 2005,2006 Albert Herranz + * Copyright (C) 2005,2006,2007,2008 Albert Herranz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,7 +36,7 @@ }; -static void exi_device_release(struct device *dev); +static void exi_bus_device_release(struct device *dev); static int exi_bus_match(struct device *dev, struct device_driver *drv); @@ -48,17 +48,17 @@ static struct device exi_bus_devices[EXI_MAX_CHANNELS] = { [0] = { .bus_id = "exi0", - .release = exi_device_release, + .release = exi_bus_device_release, .parent = NULL }, [1] = { .bus_id = "exi1", - .release = exi_device_release, + .release = exi_bus_device_release, .parent = NULL }, [2] = { .bus_id = "exi2", - .release = exi_device_release, + .release = exi_bus_device_release, .parent = NULL }, }; @@ -152,12 +152,15 @@ } /* - * Internal. Device release. + * Internal. Bus device release. */ -static void exi_device_release(struct device *dev) +static void exi_bus_device_release(struct device *dev) { + exi_printk(KERN_WARNING, "exi_bus_device_release called!\n"); } +static void exi_device_release(struct device *dev); + /* * Internal. Initialize an exi_device structure. */ @@ -175,11 +178,25 @@ exi_device->dev.parent = &exi_bus_devices[channel]; exi_device->dev.bus = &exi_bus_type; - sprintf(exi_device->dev.bus_id, "%01x:%01x", channel, device); + sprintf(exi_device->dev.bus_id, "exi%01x:%01x", channel, device); exi_device->dev.platform_data = to_exi_channel(channel); exi_device->dev.release = exi_device_release; } +/* + * Internal. Device release. + */ +static void exi_device_release(struct device *dev) +{ + struct exi_device *exi_device = to_exi_device(dev); + unsigned int channel, device; + + channel = exi_device->eid.channel; + device = exi_device->eid.device; + + exi_device_init(exi_device, channel, device); +} + /** * exi_device_get - Increments the reference count of the exi device * @exi_device: device being referenced @@ -258,9 +275,6 @@ if (exi_driver->remove) exi_driver->remove(exi_device); - if (!exi_is_dying(exi_device)) - exi_device->eid.id = EXI_ID_INVALID; - return 0; } @@ -302,30 +316,28 @@ { unsigned int id; - /* do nothing if the device is marked to die */ - if (exi_is_dying(exi_device)) - return; - /* now ID the device */ id = exi_get_id(exi_device); if (exi_device->eid.id != EXI_ID_INVALID) { /* device removed or changed */ - exi_printk(KERN_INFO, "removed [%s] id=0x%08x %s\n", + exi_printk(KERN_INFO, "about to remove [%s] id=0x%08x %s\n", exi_device->dev.bus_id, exi_device->eid.id, exi_name_id(exi_device->eid.id)); device_unregister(&exi_device->dev); + exi_printk(KERN_INFO, "remove completed\n"); exi_device->eid.id = EXI_ID_INVALID; } if (id != EXI_ID_INVALID) { /* a new device has been found */ - exi_printk(KERN_INFO, "added [%s] id=0x%08x %s\n", + exi_printk(KERN_INFO, "about to add [%s] id=0x%08x %s\n", exi_device->dev.bus_id, id, exi_name_id(id)); exi_device->eid.id = id; device_register(&exi_device->dev); + exi_printk(KERN_INFO, "add completed\n"); } exi_update_ext_status(exi_get_exi_channel(exi_device)); Index: exi-hw.h =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/exi/exi-hw.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- exi-hw.h 14 Nov 2007 23:08:49 -0000 1.8 +++ exi-hw.h 24 Feb 2008 18:05:31 -0000 1.9 @@ -2,9 +2,9 @@ * drivers/exi/exi-hw.h * * Nintendo GameCube EXpansion Interface support. Hardware routines. - * Copyright (C) 2004-2007 The GameCube Linux Team + * Copyright (C) 2004-2008 The GameCube Linux Team * Copyright (C) 2004,2005 Todd Jeffreys <to...@vo...> - * Copyright (C) 2005,2006,2007 Albert Herranz + * Copyright (C) 2005,2006,2007,2008 Albert Herranz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -20,6 +20,7 @@ #include <asm/atomic.h> #include <linux/exi.h> +#include <platforms/gamecube.h> #define exi_printk(level, format, arg...) \ printk(level "exi: " format , ## arg) @@ -49,7 +50,7 @@ #define EXI_DMA_ALIGN 0x1f /* 32 bytes */ -#define EXI_BASE 0xcc006800 +#define EXI_BASE (GCN_IO2_BASE+0x6800) #define EXI_SIZE 0x40 #define EXI_CHANNEL_SPACING 0x14 @@ -161,7 +162,7 @@ * information currently stored there is leaked to the \ * MOSI line, confusing some hardware. \ */ \ - if ((mode & EXI_OP_WRITE)) \ + if (((mode&0xf) != EXI_OP_READ)) /* write or read-write */ \ _on_write; \ out_be32(data_reg, _val); \ \ Index: exi-hw.c =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/exi/exi-hw.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- exi-hw.c 14 Nov 2007 23:08:49 -0000 1.15 +++ exi-hw.c 24 Feb 2008 18:05:31 -0000 1.16 @@ -2,9 +2,9 @@ * drivers/exi/exi-hw.c * * Nintendo GameCube EXpansion Interface support. Hardware routines. - * Copyright (C) 2004-2007 The GameCube Linux Team + * Copyright (C) 2004-2008 The GameCube Linux Team * Copyright (C) 2004,2005 Todd Jeffreys <to...@vo...> - * Copyright (C) 2005,2006,2007 Albert Herranz + * Copyright (C) 2005,2006,2007,2008 Albert Herranz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -226,7 +226,7 @@ * @exi_channel: channel * @data: pointer to data being read/writen * @len: length of data - * @mode: direction of transfer (EXI_OP_READ or EXI_OP_WRITE) + * @mode: direction of transfer (EXI_OP_{READ,READWRITE,WRITE}) * * Read or write data on a given EXI channel. * @@ -376,6 +376,8 @@ u32 __iomem *cr_reg = exi_channel->io_base + EXI_CR; u32 __iomem *csr_reg = exi_channel->io_base + EXI_CSR; unsigned long flags; + unsigned long deadline = jiffies + 2*HZ; + int borked = 0; /* we don't want TCINTs to disturb us while waiting */ spin_lock_irqsave(&exi_channel->io_lock, flags); @@ -383,8 +385,15 @@ spin_unlock_irqrestore(&exi_channel->io_lock, flags); /* busy-wait for transfer complete */ - while(in_be32(cr_reg) & EXI_CR_TSTART) + while((in_be32(cr_reg)&EXI_CR_TSTART) && !borked) { cpu_relax(); + borked = time_after(jiffies, deadline); + } + + if (borked) { + exi_printk(KERN_ERR, "exi transfer took too long, " + "is your hardware ok?"); + } /* ack the Transfer Complete interrupt */ spin_lock_irqsave(&exi_channel->io_lock, flags); @@ -805,6 +814,7 @@ exi_deselect_raw(exi_channel); break; case EXI_OP_READ: + case EXI_OP_READWRITE: case EXI_OP_WRITE: spin_lock_irqsave(&exi_channel->lock, flags); result = exi_cmd_transfer(cmd); @@ -918,7 +928,7 @@ * @exi_channel: channel * @data: pointer to data being read/written * @len: length of data - * @opcode: operation code (EXI_OP_READ or EXI_OP_WRITE) + * @opcode: operation code (EXI_OP_{READ,READWRITE,WRITE}) * * Read or write data on a given EXI channel. */ |