You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
(82) |
Jun
(72) |
Jul
(39) |
Aug
(104) |
Sep
(61) |
Oct
(55) |
Nov
(101) |
Dec
(48) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(52) |
Feb
(67) |
Mar
(18) |
Apr
(16) |
May
(33) |
Jun
(12) |
Jul
(102) |
Aug
(168) |
Sep
(65) |
Oct
(60) |
Nov
(43) |
Dec
(121) |
2002 |
Jan
(69) |
Feb
(32) |
Mar
(90) |
Apr
(59) |
May
(45) |
Jun
(43) |
Jul
(33) |
Aug
(21) |
Sep
(11) |
Oct
(20) |
Nov
(26) |
Dec
(3) |
2003 |
Jan
(12) |
Feb
(18) |
Mar
(11) |
Apr
(11) |
May
(41) |
Jun
(76) |
Jul
(77) |
Aug
(15) |
Sep
(38) |
Oct
(56) |
Nov
(19) |
Dec
(39) |
2004 |
Jan
(17) |
Feb
(52) |
Mar
(36) |
Apr
(34) |
May
(48) |
Jun
(85) |
Jul
(38) |
Aug
(42) |
Sep
(41) |
Oct
(77) |
Nov
(27) |
Dec
(19) |
2005 |
Jan
(32) |
Feb
(35) |
Mar
(29) |
Apr
(8) |
May
(7) |
Jun
(31) |
Jul
(46) |
Aug
(93) |
Sep
(65) |
Oct
(85) |
Nov
(219) |
Dec
(47) |
2006 |
Jan
(170) |
Feb
(103) |
Mar
(49) |
Apr
(43) |
May
(45) |
Jun
(29) |
Jul
(77) |
Aug
(82) |
Sep
(43) |
Oct
(45) |
Nov
(26) |
Dec
(85) |
2007 |
Jan
(42) |
Feb
(48) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(53) |
Jul
(175) |
Aug
(212) |
Sep
(91) |
Oct
(103) |
Nov
(110) |
Dec
(5) |
2008 |
Jan
(20) |
Feb
(11) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(5) |
Sep
(3) |
Oct
(12) |
Nov
|
Dec
|
From: Mike F. <va...@ge...> - 2007-08-29 11:25:27
|
On Wednesday 29 August 2007, Adrian McMenamin wrote: > On Tue, 2007-08-28 at 21:36 -0400, Mike Frysinger wrote: > > On Tuesday 28 August 2007, Adrian McMenamin wrote: > > > Please find this patch below - they said it would never be done! > > > > very cool! > > Pleased to say most of your comments related to bits of code I copied > from the old drivers and not the new stuff I'd written. > > Will refactor and resend in due course. > > Please note, though, that the PVR2 change is essential. Wothout it the > maplebus driver will fail as it will not be able to hook the VBL > interrupt. might want to include that in your commit message then ;) -mike |
From: Adrian M. <ad...@ne...> - 2007-08-29 09:27:16
|
On Wed, August 29, 2007 2:36 am, Mike Frysinger wrote: > On Tuesday 28 August 2007, Adrian McMenamin wrote: > general note ... looks like your e-mail client word wrapped things and you > took the "80 cols" rule a little too seriously (or you just ran Lindent > and > didnt check the results) ... imo, breaking across things like pointers to > structures is excessive: > kbd-> > old[i] > I was a bit OTT on that, it's true. And I'll post the refactored patch as an attachment next time. > be nice if more funcs had overview comments, but i'd make that lower > priority ;) > Will add some. A couple of points that clarification would be useful on... >> --- /dev/null >> +++ b/drivers/input/keyboard/maple_keyb.c >> @@ -0,0 +1,210 @@ >> +/* >> + * SEGA Dreamcast keyboard driver >> + * Based on drivers/usb/usbkbd.c >> + * Copyright YAEGASHI Takeshi, 2001 >> + * Porting to 2.6 Copyright Adrian McMenamin, 2007 >> + * Licensed under the GPL > > you mean GPL-2 [or later] ? > Actually, I don't know. The original just said "GPL" and as it was submitted to the kernel we can assume it's at least v2 but there was no additional specification given. Shall I just leave it as is? >> +static struct maple_driver dc_kbd_driver = { >> + .function = MAPLE_FUNC_KEYBOARD, >> + .connect = dc_kbd_connect, >> + .disconnect = dc_kbd_disconnect, >> + .drv = { >> + .name = "Dreamcast_keyboard", >> + .bus = &maple_bus_type, >> + .probe = probe_maple_kbd,}, > > that last "}," shouldnt be cuddled like that > Really? It's what i've used before and it has been accepted into the kernel. Should it be .probe = probe_maple_kbd, }, then? >> +/* use init call to ensure bus is registered ahead of devices */ >> +fs_initcall(maple_bus_init); > > thought subsys_initcall() was what you wanted ? > I thought it would be better behaved to use a later call and as this is fs related (sys) it seemed appropriate. If this a faux pas I can change it... |
From: Paul M. <le...@li...> - 2007-08-29 09:11:18
|
On Tue, Aug 28, 2007 at 08:03:50PM -0700, Kristoffer Ericson wrote: > The hd64461 have two slots (CF/PCMCIA) but since CF is handled by > libata (and initial start in hd64461.c) should this driver be able to > handle both CF and PCMCIA? > > Personally i feel it would make more sense if it only controlled the > pcmcia. Anyone wanting CF support could easily add that for their > platform. > > Before we never used the CF slot but instead let ide-sh handle it. > I'm not sure I understand your question. HD64461 is a multi-function device, meaning that you have a driver for each defined function. Usually these need to chain in to the MFD driver for things like IRQ demux and things like that, but each function is generally wholly isolated. See things like drivers/mfd/sm501.c and friends for how to work with this sort of stuff from the driver model. The PCMCIA function of HD64461 has nothing to do with the CF/pata_platform integration, and it's handled through an entirely different driver. HD64465 is the same. |
From: Paul M. <le...@li...> - 2007-08-29 07:08:26
|
On Wed, Aug 29, 2007 at 08:01:58AM +0100, Adrian McMenamin wrote: > On Tue, 2007-08-28 at 21:36 -0400, Mike Frysinger wrote: > > On Tuesday 28 August 2007, Adrian McMenamin wrote: > > > Please find this patch below - they said it would never be done! > > > > very cool! > > > Pleased to say most of your comments related to bits of code I copied > from the old drivers and not the new stuff I'd written. > > Will refactor and resend in due course. > > Please note, though, that the PVR2 change is essential. Wothout it the > maplebus driver will fail as it will not be able to hook the VBL > interrupt. That's fine, but as Mike pointed out, it's just unrelated to the rest of the code. Please send the pvr2 thing by itself, the maple bits can be applied on top of that as they're conceptually unrelated. |
From: Adrian M. <ad...@ne...> - 2007-08-29 07:02:27
|
On Tue, 2007-08-28 at 21:36 -0400, Mike Frysinger wrote: > On Tuesday 28 August 2007, Adrian McMenamin wrote: > > Please find this patch below - they said it would never be done! > > very cool! > Pleased to say most of your comments related to bits of code I copied from the old drivers and not the new stuff I'd written. Will refactor and resend in due course. Please note, though, that the PVR2 change is essential. Wothout it the maplebus driver will fail as it will not be able to hook the VBL interrupt. |
From: Mike F. <va...@ge...> - 2007-08-29 01:35:05
|
On Tuesday 28 August 2007, Adrian McMenamin wrote: > Please find this patch below - they said it would never be done! very cool! general note ... looks like your e-mail client word wrapped things and you= =20 took the "80 cols" rule a little too seriously (or you just ran Lindent and= =20 didnt check the results) ... imo, breaking across things like pointers to=20 structures is excessive: kbd-> old[i] be nice if more funcs had overview comments, but i'd make that lower=20 priority ;) > --- a/arch/sh/Kconfig > +++ b/arch/sh/Kconfig > @@ -694,8 +694,20 @@ config CF_AREA5 > config CF_AREA6 > bool "Area6" > > + > endchoice spurious newline > +config MAPLE > + bool "Maple Bus Support" > + depends on SH_DREAMCAST > + ---help--- most people just use "help" i think, but not it really matters ;) > + The Maple Bus is SEGA's serial communication bus for peripherals - > + a bit like USB for your Dreamcast. Without this bus support you > + won't be able to get your Dreamcast keyboard etc to work, so you > + probably want to say 'Y' here, though if you are just running > + the Dreamcast via a serial cable or network connection you may > + not need this. help text should be indented via a tab and two spaces ... also, when=20 describing the Y/N, the wording tends to be inverted from what you have her= e,=20 so something like: The Maple Bus is SEGA's serial communication bus for peripherals - a bit li= ke=20 USB for your Dreamcast. Your Dreamcast keyboard/mouse/etc... need this in= =20 order to work. If you want to run a serial cable or network connection, yo= u=20 may not need this. If unsure, say 'Y' here. > --- a/drivers/input/keyboard/Kconfig > +++ b/drivers/input/keyboard/Kconfig > +config KEYBOARD_MAPLE > + tristate "Maple bus keyboard" > + depends on SH_DREAMCAST && MAPLE > + help > + Say Y here if you have a DreamCast console running Linux and have funny caps in Dreamcast > --- /dev/null > +++ b/drivers/input/keyboard/maple_keyb.c > @@ -0,0 +1,210 @@ > +/* > + * SEGA Dreamcast keyboard driver > + * Based on drivers/usb/usbkbd.c > + * Copyright YAEGASHI Takeshi, 2001 > + * Porting to 2.6 Copyright Adrian McMenamin, 2007 > + * Licensed under the GPL you mean GPL-2 [or later] ? > +MODULE_AUTHOR > + ("YAEGASHI Takeshi <t...@ke...>, Adrian McMenamin > <ad...@mc..."); that's a weird wrapping > +static void dc_scan_kbd(struct dc_kbd *kbd) > ... > + printk > + ("Unknown key (scancode %#x) released.", > + kbd->old[i]); > ... > + printk > + ("Unknown key (scancode %#x) pressed.", missing kern log level > +static int dc_kbd_connect(struct maple_device *dev) > ... > + kbd =3D kmalloc(sizeof(struct dc_kbd), GFP_KERNEL); > + if (unlikely(!kbd)) > + return -1; you mean -ENOMEM ? > + memset(kbd, 0, sizeof(struct dc_kbd)); just use kzalloc() rather than kmalloc(); memset(0); > +static struct maple_driver dc_kbd_driver =3D { > + .function =3D MAPLE_FUNC_KEYBOARD, > + .connect =3D dc_kbd_connect, > + .disconnect =3D dc_kbd_disconnect, > + .drv =3D { > + .name =3D "Dreamcast_keyboard", > + .bus =3D &maple_bus_type, > + .probe =3D probe_maple_kbd,}, that last "}," shouldnt be cuddled like that > --- /dev/null > +++ b/drivers/sh/maple/maplebus.c > +void maple_add_packet(struct mapleq *mq) > +{ > + unsigned long flags; > + > + local_irq_save(flags); > + list_add((struct list_head *) mq, &maple_waitq); > + local_irq_restore(flags); > +} ugh, this is what locking mechanisms (like semaphores) are for > +static void maple_detach_driver(struct maple_device *dev) > +{ > + if (!dev) > + return; > + if (likely(dev->driver)) { > + if (likely(dev->driver->disconnect)) > + dev->driver->disconnect(dev); > + } some people would just make this one if statement ... > + dev->driver =3D NULL; > + if (likely(&dev->registered)) mmm is that even possible to be NULL ? > +static void maple_attach_driver(struct maple_device *dev) > +{ > + char *p; > + > + char *recvbuf; > + unsigned long function; > + int matched, retval; > + > + recvbuf =3D dev->mq->recvbuf; > + memcpy(&dev->devinfo, recvbuf + 4, sizeof(dev->devinfo)); > + memcpy(dev->product_name, dev->devinfo.product_name, 30); > + memcpy(dev->product_licence, dev->devinfo.product_licence, 60); > + dev->product_name[29] =3D '\0'; > + dev->product_licence[59] =3D '\0'; isnt there a snprintf() func ? > + for (p =3D dev->product_name + 28; dev->product_name <=3D p; p--) > + if (*p =3D=3D ' ') > + *p =3D '\0'; > + else > + break; > + > + for (p =3D dev->product_licence + 58; dev->product_licence <=3D p; p--) > + if (*p =3D=3D ' ') > + *p =3D '\0'; > + else > + break; be nice if these string constants didnt exist ... maybe abuse sizeof() so o= nly=20 the structure definition has the actual sizes ... > +static struct maple_driver maple_basic_driver =3D { > + .drv =3D { > + .name =3D "Maple_bus_basic_driver", > + .bus =3D &maple_bus_type,}, funky cuddling of }, again > +static struct device maple_bus =3D { > + .bus_id =3D "maple0", > + .release =3D maple_bus_release, > +}; what's that 0 for ? > +static int __init maple_bus_init(void) > ... > +cleanup: > + printk(KERN_INFO "Maple bus registration failed\n"); shouldnt that be a WARN or ERR or somethin ? > +/* use init call to ensure bus is registered ahead of devices */ > +fs_initcall(maple_bus_init); thought subsys_initcall() was what you wanted ? > +module_exit(maple_bus_exit); not sure how useful this is since the func already has the __exit attribute= =20 and you cant build the code as a module ... it doesnt have a detrimental=20 affect though > --- a/drivers/video/pvr2fb.c > +++ b/drivers/video/pvr2fb.c > @@ -890,7 +890,7 @@ static int __init pvr2fb_dc_init(void) > pvr2_fix.mmio_start =3D 0xa05f8000; /* registers start here */ > pvr2_fix.mmio_len =3D 0x2000; > > - if (request_irq(HW_EVENT_VSYNC, pvr2fb_interrupt, 0, > + if (request_irq(HW_EVENT_VSYNC, pvr2fb_interrupt, IRQF_SHARED, > "pvr2 VBL handler", fb_info)) { > return -EBUSY; > } mmm not relevant to this patch ? > --- /dev/null > +++ b/include/linux/maple.h > +/* Maple Bus command and response codes */ > + > +#define MAPLE_RESPONSE_FILEERR -5 > +#define MAPLE_RESPONSE_AGAIN -4 /* request should be retransmitted */ > +#define MAPLE_RESPONSE_BADCMD -3 > +#define MAPLE_RESPONSE_BADFUNC -2 > +#define MAPLE_RESPONSE_NONE -1 /* unit didn't respond at all */ > +#define MAPLE_COMMAND_DEVINFO 1 > +#define MAPLE_COMMAND_ALLINFO 2 > +#define MAPLE_COMMAND_RESET 3 > +#define MAPLE_COMMAND_KILL 4 > +#define MAPLE_RESPONSE_DEVINFO 5 > +#define MAPLE_RESPONSE_ALLINFO 6 > +#define MAPLE_RESPONSE_OK 7 > +#define MAPLE_RESPONSE_DATATRF 8 > +#define MAPLE_COMMAND_GETCOND 9 > +#define MAPLE_COMMAND_GETMINFO 10 > +#define MAPLE_COMMAND_BREAD 11 > +#define MAPLE_COMMAND_BWRITE 12 > +#define MAPLE_COMMAND_SETCOND 14 if actual numeric value doesnt have meaning, an enum might be appropriate .= =2E. =2Dmike |
From: Adrian M. <ad...@ne...> - 2007-08-28 22:14:41
|
Please find this patch below - they said it would never be done! Anyway, this adds new maplebus support to the kernel and a maple keyboard driver is also attached. There a couple of minor and consequential patches to other kernel subsystems attached that are required to get this to work (eg make the PVR2 VBLANK interrupt shareable). Any and all comments and testers welcome and/or required. Signed-off by Adrian McMenamin <ad...@mc...> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 54878f0..42e3d95 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -694,8 +694,20 @@ config CF_AREA5 config CF_AREA6 bool "Area6" + endchoice +config MAPLE + bool "Maple Bus Support" + depends on SH_DREAMCAST + ---help--- + The Maple Bus is SEGA's serial communication bus for peripherals - + a bit like USB for your Dreamcast. Without this bus support you + won't be able to get your Dreamcast keyboard etc to work, so you + probably want to say 'Y' here, though if you are just running + the Dreamcast via a serial cable or network connection you may + not need this. + config CF_BASE_ADDR hex depends on CF_ENABLER diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index c97d5eb..1689f73 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -253,4 +253,14 @@ config KEYBOARD_GPIO To compile this driver as a module, choose M here: the module will be called gpio-keys. + +config KEYBOARD_MAPLE + tristate "Maple bus keyboard" + depends on SH_DREAMCAST && MAPLE + help + Say Y here if you have a DreamCast console running Linux and have + a keyboard attached to its Maple bus. + + To compile this driver as a module, choose M here: the + module will be called maple_keyb. endif diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 28d211b..3f775ed 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -21,4 +21,5 @@ obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o +obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c new file mode 100644 index 0000000..3aae3aa --- /dev/null +++ b/drivers/input/keyboard/maple_keyb.c @@ -0,0 +1,210 @@ +/* + * SEGA Dreamcast keyboard driver + * Based on drivers/usb/usbkbd.c + * Copyright YAEGASHI Takeshi, 2001 + * Porting to 2.6 Copyright Adrian McMenamin, 2007 + * Licensed under the GPL + */ + +#include <linux/kernel.h> +#include <linux/slab.h> +#include <linux/input.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/timer.h> +#include <linux/maple.h> + +MODULE_AUTHOR + ("YAEGASHI Takeshi <t...@ke...>, Adrian McMenamin <ad...@mc..."); +MODULE_DESCRIPTION("SEGA Dreamcast keyboard driver"); +MODULE_LICENSE("GPL"); + +static unsigned char dc_kbd_keycode[256] = { + 0, 0, 0, 0, 30, 48, 46, 32, + 18, 33, 34, 35, 23, 36, 37, 38, + 50, 49, 24, 25, 16, 19, 31, 20, + 22, 47, 17, 45, 21, 44, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 28, + 1, 14, 15, 57, 12, 13, 26, + 27, 43, 43, 39, 40, 41, 51, + 52, 53, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 87, 88, 99, + 70, 119, 110, 102, 104, 111, + 107, 109, 106, 105, 108, 103, + 69, 98, 55, 74, 78, 96, 79, 80, + 81, 75, 76, 77, 71, 72, 73, 82, 83, + 86, 127, 116, 117, 183, 184, 185, + 186, 187, 188, 189, 190, + 191, 192, 193, 194, 134, 138, 130, 132, + 128, 129, 131, 137, 133, 135, 136, 113, + 115, 114, 0, 0, 0, 121, 0, 89, 93, 124, + 92, 94, 95, 0, 0, 0, + 122, 123, 90, 91, 85, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 29, 42, 56, 125, 97, 54, 100, 126, + 164, 166, 165, 163, 161, 115, 114, 113, + 150, 158, 159, 128, 136, 177, 178, 176, 142, + 152, 173, 140 +}; + +struct dc_kbd { + struct input_dev *dev; + unsigned char new[8]; + unsigned char old[8]; +}; + +static void dc_scan_kbd(struct dc_kbd *kbd) +{ + int i; + struct input_dev *dev = kbd->dev; + for (i = 0; i < 8; i++) + input_report_key(dev, + dc_kbd_keycode[i + 224], + (kbd->new[0] >> i) & 1); + + for (i = 2; i < 8; i++) { + + if (kbd->old[i] > 3 + && memchr(kbd->new + 2, kbd->old[i], 6) == NULL) { + if (dc_kbd_keycode[kbd->old[i]]) + input_report_key(dev, + dc_kbd_keycode[kbd-> + old[i]], + 0); + else + printk + ("Unknown key (scancode %#x) released.", + kbd->old[i]); + } + + if (kbd->new[i] > 3 + && memchr(kbd->old + 2, kbd->new[i], 6) != NULL) { + if (dc_kbd_keycode[kbd->new[i]]) + input_report_key(dev, + dc_kbd_keycode[kbd-> + new[i]], + 1); + else + printk + ("Unknown key (scancode %#x) pressed.", + kbd->new[i]); + } + } + + input_sync(dev); + + memcpy(kbd->old, kbd->new, 8); +} + +static void dc_kbd_callback(struct mapleq *mq) +{ + struct maple_device *mapledev = mq->dev; + struct dc_kbd *kbd = mapledev->private_data; + unsigned long *buf = mq->recvbuf; + if (buf[1] == mapledev->function) { + memcpy(kbd->new, buf + 2, 8); + dc_scan_kbd(kbd); + } +} + +static int dc_kbd_connect(struct maple_device *dev) +{ + int i; + unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]); + struct dc_kbd *kbd; + if (dev->function != MAPLE_FUNC_KEYBOARD) + return -EINVAL; + + kbd = kmalloc(sizeof(struct dc_kbd), GFP_KERNEL); + if (unlikely(!kbd)) + return -1; + memset(kbd, 0, sizeof(struct dc_kbd)); + + dev->private_data = kbd; + + kbd->dev = input_allocate_device(); + kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); + + for (i = 0; i < 255; i++) + set_bit(dc_kbd_keycode[i], kbd->dev->keybit); + + clear_bit(0, kbd->dev->keybit); + + kbd->dev->private = kbd; + + kbd->dev->name = dev->product_name; + kbd->dev->id.bustype = BUS_MAPLE; + + input_register_device(kbd->dev); + + maple_getcond_callback(dev, dc_kbd_callback, (62 * HZ) / 1000, + MAPLE_FUNC_KEYBOARD); + + printk(KERN_INFO "input: keyboard(0x%lx): %s\n", data, + kbd->dev->name); + + return 0; +} + +static void dc_kbd_disconnect(struct maple_device *dev) +{ + struct dc_kbd *kbd = dev->private_data; + + input_unregister_device(kbd->dev); + kfree(kbd); +} + +/* allow the keyboard to be used */ +static int probe_maple_kbd(struct device *dev) +{ + struct maple_device *mdev; + struct maple_driver *mdrv; + int proberes; + + mdev = to_maple_dev(dev); + mdrv = to_maple_driver(dev->driver); + + proberes = dc_kbd_connect(mdev); + if (unlikely(proberes)) + return proberes; + mdev->driver = mdrv; + mdev->registered = 1; + return 0; +} + + +static struct maple_driver dc_kbd_driver = { + .function = MAPLE_FUNC_KEYBOARD, + .connect = dc_kbd_connect, + .disconnect = dc_kbd_disconnect, + .drv = { + .name = "Dreamcast_keyboard", + .bus = &maple_bus_type, + .probe = probe_maple_kbd,}, +}; + +static int __init dc_kbd_init(void) +{ + int retval; + retval = driver_register(&dc_kbd_driver.drv); + if (retval) + return retval; + printk(KERN_INFO "Registered Dreamcast keyboard driver\n"); + return 0; +} + +static void __exit dc_kbd_exit(void) +{ + driver_unregister(&dc_kbd_driver.drv); +} + +module_init(dc_kbd_init); +module_exit(dc_kbd_exit); diff --git a/drivers/sh/Makefile b/drivers/sh/Makefile index 8a14389..f0a1f4f 100644 --- a/drivers/sh/Makefile +++ b/drivers/sh/Makefile @@ -3,4 +3,5 @@ # obj-$(CONFIG_SUPERHYWAY) += superhyway/ +obj-$(CONFIG_MAPLE) += maple/ diff --git a/drivers/sh/maple/Makefile b/drivers/sh/maple/Makefile new file mode 100644 index 0000000..f8c39f2 --- /dev/null +++ b/drivers/sh/maple/Makefile @@ -0,0 +1,3 @@ +#Makefile for Maple Bus + +obj-y := maplebus.o diff --git a/drivers/sh/maple/maplebus.c b/drivers/sh/maple/maplebus.c new file mode 100644 index 0000000..fc27543 --- /dev/null +++ b/drivers/sh/maple/maplebus.c @@ -0,0 +1,641 @@ +/* maplebus.c + * Core maple bus functionality + * Core code copyright + * Paul Mundt, M. R. Brown and others + * Porting to 2.6 Copyright Adrian McMenamin, 2007 + * Licence: GNU GPL version 2 + * http://www.gnu.org + */ + +#include <linux/init.h> +#include <linux/device.h> +#include <linux/moduleparam.h> +#include <linux/interrupt.h> +#include <linux/list.h> +#include <linux/io.h> +#include <linux/maple.h> +#include <asm/cacheflush.h> +#include <asm/dma.h> +#include <asm/dreamcast/sysasic.h> + +MODULE_AUTHOR("Paul Mundt, MR Brown, Adrian McMenamin"); +MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); +MODULE_LICENSE("GPL"); +MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}"); + +static void maple_dma_handler(struct work_struct *work); +static void maple_vblank_handler(struct work_struct *work); + +static DECLARE_WORK(maple_dma_process, maple_dma_handler); +static DECLARE_WORK(maple_vblank_process, maple_vblank_handler); + +static LIST_HEAD(maple_waitq); +static LIST_HEAD(maple_sentq); + +static struct maple_driver maple_basic_driver; +static struct device maple_bus; +static int subdevice_map[MAPLE_PORTS]; +unsigned long *maple_sendbuf, *maple_sendptr, *maple_lastptr; +unsigned long maple_pnp_time; +static int started; +static int scanning; + + +void maple_getcond_callback(struct maple_device *dev, + void (*callback) (struct mapleq *mq), + unsigned long interval, unsigned long function) +{ + dev->callback = callback; + dev->interval = interval; + dev->function = cpu_to_be32(function); + dev->when = 0; +} + +EXPORT_SYMBOL(maple_getcond_callback); + +static void maple_release_device(struct device *dev) +{ + if (likely(dev->type)) { + if (likely(dev->type->name)) + kfree(dev->type->name); + kfree(dev->type); + } +} + +void maple_add_packet(struct mapleq *mq) +{ + unsigned long flags; + + local_irq_save(flags); + list_add((struct list_head *) mq, &maple_waitq); + local_irq_restore(flags); +} + +static struct mapleq *maple_allocq(struct maple_device *dev) +{ + unsigned long buf; + struct mapleq *mq; + + mq = kmalloc(sizeof(*mq), GFP_KERNEL); + if (unlikely(!mq)) + return NULL; + + mq->dev = dev; + buf = (unsigned long) mq->buf; + buf = (buf + 31) & ~31; + mq->recvbuf = (void *) P2SEGADDR(buf); + + return mq; +} + +static struct maple_device *maple_alloc_dev(int port, int unit) +{ + struct maple_device *dev; + + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (unlikely(!dev)) + return NULL; + + dev->port = port; + dev->unit = unit; + dev->mq = maple_allocq(dev); + + if (unlikely(!dev->mq)) { + kfree(dev); + return NULL; + } + + return dev; +} + +static void maple_free_dev(struct maple_device *mdev) +{ + if (!mdev) + return; + if (likely(mdev->registered)) + maple_release_device(&mdev->dev); + kfree(mdev->mq); + kfree(mdev); +} + +static int maple_dma_done(void) +{ + return (ctrl_inl(MAPLE_STATE) & 1) == 0; +} + +static void maple_build_block(struct mapleq *mq) +{ + int port, unit, from, to, len; + unsigned long *lsendbuf = mq->sendbuf; + + port = mq->dev->port & 3; + unit = mq->dev->unit; + len = mq->length; + + from = port << 6; + to = (port << 6) | (unit > 0 ? (1 << (unit - 1)) & 0x1f : 0x20); + + *maple_lastptr &= 0x7fffffff; + maple_lastptr = maple_sendptr; + + *maple_sendptr++ = (port << 16) | len | 0x80000000; + *maple_sendptr++ = PHYSADDR(mq->recvbuf); + *maple_sendptr++ = + mq->command | (to << 8) | (from << 16) | (len << 24); + + while (len-- > 0) + *maple_sendptr++ = *lsendbuf++; +} + +void maple_send(void) +{ + int i; + int maple_packets; + struct mapleq *mq, *nmq; + unsigned long flags; + + if (!list_empty(&maple_sentq)) + return; + if (list_empty(&maple_waitq) || !maple_dma_done()) + return; + maple_packets = 0; + maple_sendptr = maple_lastptr = maple_sendbuf; + list_for_each_entry_safe(mq, nmq, &maple_waitq, list) { + maple_build_block(mq); + local_irq_save(flags); + list_move(&mq->list, &maple_sentq); + local_irq_restore(flags); + if (unlikely(maple_packets++ > MAPLE_MAXPACKETS)) + break; + } + if (maple_packets > 0) { + for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++) + dma_cache_wback_inv(maple_sendbuf + i * PAGE_SIZE, + PAGE_SIZE); + } +} + +static int attach_matching_maple_driver(struct device_driver *driver, + void *devptr) +{ + struct maple_driver *maple_drv; + struct maple_device *mdev; + + mdev = devptr; + maple_drv = to_maple_driver(driver); + if (unlikely + (mdev->devinfo.function & be32_to_cpu(maple_drv->function))) { + if (likely(maple_drv->connect(mdev) == 0)) { + mdev->driver = maple_drv; + return 1; + } + } + return 0; +} + +static void maple_detach_driver(struct maple_device *dev) +{ + if (!dev) + return; + if (likely(dev->driver)) { + if (likely(dev->driver->disconnect)) + dev->driver->disconnect(dev); + } + dev->driver = NULL; + if (likely(&dev->registered)) + device_unregister(&dev->dev); + dev->registered = 0; + maple_free_dev(dev); +} + +static void maple_attach_driver(struct maple_device *dev) +{ + char *p; + + char *recvbuf; + unsigned long function; + int matched, retval; + + recvbuf = dev->mq->recvbuf; + memcpy(&dev->devinfo, recvbuf + 4, sizeof(dev->devinfo)); + memcpy(dev->product_name, dev->devinfo.product_name, 30); + memcpy(dev->product_licence, dev->devinfo.product_licence, 60); + dev->product_name[29] = '\0'; + dev->product_licence[59] = '\0'; + + for (p = dev->product_name + 28; dev->product_name <= p; p--) + if (*p == ' ') + *p = '\0'; + else + break; + + for (p = dev->product_licence + 58; dev->product_licence <= p; p--) + if (*p == ' ') + *p = '\0'; + else + break; + + function = be32_to_cpu(dev->devinfo.function); + + if (unlikely(function == 0xFFFFFFFF)) { + /* Do this silently - as not a real device */ + function = 0; + dev->driver = &maple_basic_driver; + sprintf(dev->dev.bus_id, "%d:0.port", dev->port); + } else { + printk(KERN_INFO + "Maple bus at (%d, %d): Connected function 0x%lX\n", + dev->port, dev->unit, function); + + matched = + bus_for_each_drv(&maple_bus_type, NULL, dev, + attach_matching_maple_driver); + + if (matched == 0) { + /* Driver does not exist yet */ + printk(KERN_INFO + "No maple driver found for this device\n"); + dev->driver = &maple_basic_driver; + } + + sprintf(dev->dev.bus_id, "%d:0%d.%lX", dev->port, + dev->unit, function); + } + dev->function = function; + dev->dev.bus = &maple_bus_type; + dev->dev.parent = &maple_bus; + dev->dev.release = &maple_release_device; + retval = device_register(&dev->dev); + if (retval) { + printk(KERN_INFO + "Maple bus: Attempt to register device (%x, %x) failed.\n", + dev->port, dev->unit); + maple_free_dev(dev); + } + dev->registered = 1; + +} + +static int detach_maple_device(struct device *device, void *portptr) +{ + struct device_specify *ds; + struct maple_device *mdev; + + ds = portptr; + mdev = to_maple_dev(device); + if (unlikely(mdev->port == ds->port && mdev->unit == ds->unit)) + return 1; + return 0; +} +static int setup_maple_commands(struct device *device, void *ignored) +{ + struct maple_device *maple_dev = to_maple_dev(device); + + if (unlikely(maple_dev->event)) + return 0; + if (likely(maple_dev->interval > 0)) { + if (likely(jiffies > maple_dev->when)) { + maple_dev->when = jiffies + maple_dev->interval; + maple_dev->mq->command = MAPLE_COMMAND_GETCOND; + maple_dev->mq->sendbuf = &maple_dev->function; + maple_dev->mq->length = 1; + maple_add_packet(maple_dev->mq); + INIT_LIST_HEAD(&maple_sentq); + } + } else { + if (jiffies >= maple_pnp_time) { + maple_dev->mq->command = MAPLE_COMMAND_DEVINFO; + maple_dev->mq->length = 0; + maple_add_packet(maple_dev->mq); + INIT_LIST_HEAD(&maple_sentq); + + } + } + + return 0; +} + +static void maple_vblank_handler(struct work_struct *work) +{ + bus_for_each_dev(&maple_bus_type, NULL, NULL, + setup_maple_commands); + if (jiffies >= maple_pnp_time) + maple_pnp_time = jiffies + MAPLE_PNP_INTERVAL; + maple_send(); +} + +static void maple_map_subunits(struct maple_device *mdev, int submask) +{ + int retval, k, devcheck; + struct maple_device *mdev_add; + struct device_specify ds; + + for (k = 0; k < 5; k++) { + ds.port = mdev->port; + ds.unit = k + 1; + retval = + bus_for_each_dev(&maple_bus_type, NULL, &ds, + detach_maple_device); + if (retval) { + submask = submask >> 1; + continue; + } + devcheck = submask & 0x01; + if (unlikely(devcheck)) { + mdev_add = maple_alloc_dev(mdev->port, k + 1); + mdev_add->mq->command = MAPLE_COMMAND_DEVINFO; + mdev_add->mq->length = 0; + maple_add_packet(mdev_add->mq); + scanning = 1; + } + submask = submask >> 1; + } +} + +static void maple_clean_submap(struct maple_device *mdev) +{ + int killbit; + + killbit = (mdev->unit > 0 ? (1 << (mdev->unit - 1)) & 0x1f : 0x20); + killbit = ~killbit; + killbit &= 0xFF; + subdevice_map[mdev->port] = subdevice_map[mdev->port] & killbit; +} + +static void maple_dma_handler(struct work_struct *work) +{ + struct mapleq *mq; + struct maple_device *dev; + char *recvbuf; + char submask; + int code; + + /* Be extra cautious and check new DMA cycle not already underway */ + if (!list_empty(&maple_sentq) && maple_dma_done()) { + list_for_each_entry(mq, &maple_sentq, list) { + recvbuf = mq->recvbuf; + code = recvbuf[0]; + dev = mq->dev; + + switch (code) { + case MAPLE_RESPONSE_NONE: + if (unlikely(!started)) { + maple_attach_driver(dev); + break; + } + if (unlikely(dev->unit != 0)) + maple_detach_driver(dev); + maple_clean_submap(dev); + break; + + case MAPLE_RESPONSE_DEVINFO: + dev->event = 0; + if ((unlikely(!started)) + || (unlikely(scanning == 2))) { + maple_attach_driver(dev); + break; + } + if (likely(dev->unit == 0)) { + submask = recvbuf[2] & 0x1F; + /* Test if subunits have been added or removed */ + if (unlikely + (submask ^ + subdevice_map[dev->port])) { + maple_map_subunits(dev, + submask); + subdevice_map[dev->port] = + submask; + } + } + break; + + case MAPLE_RESPONSE_DATATRF: + if (dev->callback) + dev->callback(mq); + break; + + default: + break; + } + } + + INIT_LIST_HEAD(&maple_sentq); + + if (unlikely(scanning == 1)) { + maple_send(); + scanning = 2; + } else + scanning = 0; + + if (unlikely(started == 0)) + started = 1; + } +} + +static irqreturn_t maplebus_dma_interrupt(int irq, void *dev_id) +{ + /* Load everything into the bottom half */ + schedule_work(&maple_dma_process); + return IRQ_HANDLED; +} + +static irqreturn_t maplebus_vblank_interrupt(int irq, void *dev_id) +{ + schedule_work(&maple_vblank_process); + return IRQ_HANDLED; +} + +static struct irqaction maple_dma_irq = { + .name = "maple bus DMA handler", + .handler = maplebus_dma_interrupt, + .flags = IRQF_SHARED, +}; + +static struct irqaction maple_vblank_irq = { + .name = "maple bus VBLANK handler", + .handler = maplebus_vblank_interrupt, + .flags = IRQF_SHARED, +}; + +static void maplebus_init_hardware(void) +{ + ctrl_outl(MAPLE_MAGIC, MAPLE_RESET); + /* set trig type to 0 for software trigger, 1 for hardware (VBLANK) */ + ctrl_outl(1, MAPLE_TRIGTYPE); + ctrl_outl(MAPLE_2MBPS | MAPLE_TIMEOUT(50000), MAPLE_SPEED); + ctrl_outl(PHYSADDR(maple_sendbuf), MAPLE_DMAADDR); + ctrl_outl(1, MAPLE_ENABLE); +} + +static int maple_set_dma_interrupt_handler(void) +{ + return setup_irq(HW_EVENT_MAPLE_DMA, &maple_dma_irq); +} + +static int maple_set_vblank_interrupt_handler(void) +{ + return setup_irq(HW_EVENT_VSYNC, &maple_vblank_irq); +} + + +static int maple_get_dma_buffer(void) +{ + maple_sendbuf = + (void *) __get_dma_pages(GFP_KERNEL, MAPLE_DMA_PAGES); + if (unlikely(!maple_sendbuf)) + return -ENOMEM; + memset(maple_sendbuf, 0, MAPLE_DMA_SIZE); + return 0; +} + +static int match_maple_bus_driver(struct device *devptr, + struct device_driver *drvptr) +{ + struct maple_driver *maple_drv; + struct maple_device *maple_dev; + + maple_drv = container_of(drvptr, struct maple_driver, drv); + maple_dev = container_of(devptr, struct maple_device, dev); + + if (unlikely + (maple_dev->devinfo. + function & be32_to_cpu(maple_drv->function))) + return 1; + return 0; +} + +static int maple_bus_uevent(struct device *dev, char **envp, + int num_envp, char *buffer, int buffer_size) +{ + return 0; +} + +static void maple_bus_release(struct device *dev) +{ + printk(KERN_INFO "Releasing maple bus device\n"); +} + +static struct maple_driver maple_basic_driver = { + .drv = { + .name = "Maple_bus_basic_driver", + .bus = &maple_bus_type,}, +}; + +struct bus_type maple_bus_type = { + .name = "maple", + .match = match_maple_bus_driver, + .uevent = maple_bus_uevent, +}; + +EXPORT_SYMBOL(maple_bus_type); + +static struct device maple_bus = { + .bus_id = "maple0", + .release = maple_bus_release, +}; + +static int __init maple_bus_init(void) +{ + int retval, i; + struct maple_device *mdev; + ctrl_outl(0, MAPLE_STATE); + + retval = device_register(&maple_bus); + if (unlikely(retval)) + goto cleanup; + + retval = bus_register(&maple_bus_type); + if (unlikely(retval)) + goto cleanup_device; + + printk(KERN_INFO "Maple bus core now registered.\n"); + + retval = driver_register(&maple_basic_driver.drv); + if (unlikely(retval)) + goto cleanup_bus; + + /* allocate memory for maple bus dma */ + retval = maple_get_dma_buffer(); + if (unlikely(retval)) { + printk(KERN_INFO + "Maple bus: Failed to allocate Maple DMA buffers\n"); + goto cleanup_basic; + } + + /* set up DMA interrupt handler */ + retval = maple_set_dma_interrupt_handler(); + if (unlikely(retval)) { + printk(KERN_INFO + "Maple bus: Failed to grab maple DMA IRQ\n"); + goto cleanup_dma; + } + + /* set up VBLANK interrupt handler */ + retval = maple_set_vblank_interrupt_handler(); + if (unlikely(retval)) { + printk(KERN_INFO "Maple bus: Failed to grab VBLANK IRQ\n"); + goto cleanup_irq; + } + + + /* setup maple ports */ + for (i = 0; i < MAPLE_PORTS; i++) { + mdev = maple_alloc_dev(i, 0); + mdev->registered = 0; + if (unlikely(!mdev)) + goto cleanup_bothirqs; + mdev->mq->command = MAPLE_COMMAND_DEVINFO; + mdev->mq->length = 0; + maple_add_packet(mdev->mq); + subdevice_map[i] = 0; + } + + /* setup maplebus hardware */ + maplebus_init_hardware(); + + /* initial detection */ + maple_send(); + + + maple_pnp_time = 0; + + return 0; + +cleanup_bothirqs: + free_irq(HW_EVENT_VSYNC, 0); + +cleanup_irq: + free_irq(HW_EVENT_MAPLE_DMA, 0); + +cleanup_dma: + free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES); + +cleanup_basic: + driver_unregister(&maple_basic_driver.drv); + +cleanup_bus: + bus_unregister(&maple_bus_type); + +cleanup_device: + device_unregister(&maple_bus); + +cleanup: + printk(KERN_INFO "Maple bus registration failed\n"); + return retval; +} + +static void __exit maple_bus_exit(void) +{ + driver_unregister(&maple_basic_driver.drv); + bus_unregister(&maple_bus_type); + + if (likely(maple_sendbuf)) + free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES); + + free_irq(HW_EVENT_MAPLE_DMA, 0); + free_irq(HW_EVENT_VSYNC, 0); +} + +/* use init call to ensure bus is registered ahead of devices */ +fs_initcall(maple_bus_init); +module_exit(maple_bus_exit); diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c index 7d6c298..13de07f 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/pvr2fb.c @@ -890,7 +890,7 @@ static int __init pvr2fb_dc_init(void) pvr2_fix.mmio_start = 0xa05f8000; /* registers start here */ pvr2_fix.mmio_len = 0x2000; - if (request_irq(HW_EVENT_VSYNC, pvr2fb_interrupt, 0, + if (request_irq(HW_EVENT_VSYNC, pvr2fb_interrupt, IRQF_SHARED, "pvr2 VBL handler", fb_info)) { return -EBUSY; } diff --git a/include/linux/input.h b/include/linux/input.h index e02c6a6..2e65c88 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -688,6 +688,7 @@ struct input_absinfo { #define BUS_HOST 0x19 #define BUS_GSC 0x1A #define BUS_ATARI 0x1B +#define BUS_MAPLE 0x1C /* * Values describing the status of a force-feedback effect diff --git a/include/linux/maple.h b/include/linux/maple.h new file mode 100644 index 0000000..72d31ca --- /dev/null +++ b/include/linux/maple.h @@ -0,0 +1,125 @@ +/** + * maple.h + * + * porting to 2.6 driver model + * copyright Adrian McMenamin, 2007 + * + */ + +extern struct bus_type maple_bus_type; + +#define MAPLE_PORTS 4 +#define MAPLE_PNP_INTERVAL HZ +#define MAPLE_MAXPACKETS 8 +#define MAPLE_DMA_ORDER 14 +#define MAPLE_DMA_SIZE (1 << MAPLE_DMA_ORDER) +#define MAPLE_DMA_PAGES ((MAPLE_DMA_ORDER > PAGE_SHIFT) ? MAPLE_DMA_ORDER - PAGE_SHIFT : 0) + + +/* Maple Bus registers */ + +#define MAPLE_BASE 0xa05f6c00 +#define MAPLE_DMAADDR (MAPLE_BASE+0x04) +#define MAPLE_TRIGTYPE (MAPLE_BASE+0x10) +#define MAPLE_ENABLE (MAPLE_BASE+0x14) +#define MAPLE_STATE (MAPLE_BASE+0x18) +#define MAPLE_SPEED (MAPLE_BASE+0x80) +#define MAPLE_RESET (MAPLE_BASE+0x8c) + +#define MAPLE_MAGIC 0x6155404f +#define MAPLE_2MBPS 0 +#define MAPLE_TIMEOUT(n) ((n)<<16) + + +/* Maple Bus command and response codes */ + +#define MAPLE_RESPONSE_FILEERR -5 +#define MAPLE_RESPONSE_AGAIN -4 /* request should be retransmitted */ +#define MAPLE_RESPONSE_BADCMD -3 +#define MAPLE_RESPONSE_BADFUNC -2 +#define MAPLE_RESPONSE_NONE -1 /* unit didn't respond at all */ +#define MAPLE_COMMAND_DEVINFO 1 +#define MAPLE_COMMAND_ALLINFO 2 +#define MAPLE_COMMAND_RESET 3 +#define MAPLE_COMMAND_KILL 4 +#define MAPLE_RESPONSE_DEVINFO 5 +#define MAPLE_RESPONSE_ALLINFO 6 +#define MAPLE_RESPONSE_OK 7 +#define MAPLE_RESPONSE_DATATRF 8 +#define MAPLE_COMMAND_GETCOND 9 +#define MAPLE_COMMAND_GETMINFO 10 +#define MAPLE_COMMAND_BREAD 11 +#define MAPLE_COMMAND_BWRITE 12 +#define MAPLE_COMMAND_SETCOND 14 + + +/* Function codes */ + +#define MAPLE_FUNC_CONTROLLER 0x001 +#define MAPLE_FUNC_MEMCARD 0x002 +#define MAPLE_FUNC_LCD 0x004 +#define MAPLE_FUNC_CLOCK 0x008 +#define MAPLE_FUNC_MICROPHONE 0x010 +#define MAPLE_FUNC_ARGUN 0x020 +#define MAPLE_FUNC_KEYBOARD 0x040 +#define MAPLE_FUNC_LIGHTGUN 0x080 +#define MAPLE_FUNC_PURUPURU 0x100 +#define MAPLE_FUNC_MOUSE 0x200 + + +struct mapleq { + struct list_head list; + struct maple_device *dev; + void *sendbuf, *recvbuf; + unsigned char command, length; + unsigned char buf[1024 + 32]; +}; + +struct maple_devinfo { + unsigned long function; + unsigned long function_data[3]; + unsigned char area_code; + unsigned char connector_directon; + char product_name[30]; + char product_licence[60]; + unsigned short standby_power; + unsigned short max_power; +}; + +struct maple_device { + struct maple_driver *driver; + struct mapleq *mq; + void *private_data; + void (*callback) (struct mapleq * mq); + unsigned long when, interval, function; + int event; + struct maple_devinfo devinfo; + unsigned char port, unit; + char product_name[32]; + char product_licence[64]; + int registered; + struct device dev; +}; + +struct maple_driver { + unsigned long function; + int (*connect) (struct maple_device * dev); + void (*disconnect) (struct maple_device * dev); + struct device_driver drv; +}; + +struct device_specify { + int port; + int unit; +}; + + +void maple_getcond_callback(struct maple_device *dev, + void (*callback) (struct mapleq * mq), + unsigned long interval, + unsigned long function); + +void maple_setup_port_rescan(struct maple_device *mdev); + +#define to_maple_dev(n) container_of(n, struct maple_device, dev) +#define to_maple_driver(n) container_of(n, struct maple_driver, drv) |
From: Kristoffer E. <kri...@gm...> - 2007-08-28 18:04:02
|
Paul, Im fixing up the hd64461 pcmcia driver. Got a quick question. The hd64461 have two slots (CF/PCMCIA) but since CF is handled by libata (and initial start in hd64461.c) should this driver be able to handle both CF and PCMCIA? Personally i feel it would make more sense if it only controlled the pcmcia. Anyone wanting CF support could easily add that for their platform. Before we never used the CF slot but instead let ide-sh handle it. Best wishes Kristoffer |
From: EXTERNAL B. M. (P. ST-FIR/Eng) <ext...@de...> - 2007-08-28 13:03:16
|
On Tue, Aug 28, 2007 at 02:13, Paul Mundt wrote: > If this is an area where you're interested in working in, I have dozens > of different patches for work in this area you might want to play around > with. ... This is my last week at Bosch, so I' don't have the time to start work on new things. I will keep reading the list and my code will be maintained in future by Mark Jonas <to...@gm...>, because I don't have access to the hardware anymore. Unfortunatelly he only has a limited amount of time for this project. Hopefully there will be a successor for me soon, so the development can continue at full speed. Best wishes Markus |
From: Paul M. <le...@li...> - 2007-08-28 00:14:51
|
On Mon, Aug 27, 2007 at 02:22:20PM +0200, EXTERNAL Brunner Markus (Praktikant; ST-FIR/Eng) wrote: > I enabled the SH7705_CACHE_32KB option, but it seems to be broken. I had > to include <linux/fs.h> in pg-sh7705.c to make it compile. > The kernel reportet an CRC error when tried to loaded the initrd. This > time it didn't even work with writethrough. > > Why is there so much code for the cache handling for the 32KB mode > (pg-sh7705.c)? > What has to be done else than writing CCR3 to enable 32kb cache? > Why doesn't writeback work with 32KB cache? > The problem with this extended mode is that it ends up behaving a lot more like an SH-4 style dcache, including the cache aliases and everything that entails. As far as why there are special ops for 7705, I've never had one to test one, so this is a difficult thing to answer. The main thing really is that while this extended 32kB mode provides the 7705 with an aliasing dcache, the icache bits are still very much the same as the rest of the SH-3, so that doesn't require any special handling. We are rather at the point now where the SH-4 icache and dcache handling ops have to be decoupled from the cache-sh4/pg-sh4 implementation precisely for things like the SH-X3 cores which do full dcache coherency but still have traditional SH-4 style icaches that aren't snooped. Once there's a decoupling of the SH-4 I/D cache handling, we can probably rip out most of the SH7705 32kB special casing and just wrap in to that directly. Now that we are using kmap_coherent()/kunmap_coherent() and the fixmap slots for page colouring, this is something that can be nopped out on stock SH-3 and only enabled for the extended cache, which should allow us to consolidate most of the page copying/clearing. The only thing that's really a problem here is the PG_mapped bit and the lazy dcache write-back. Flipping this to PG_dcache_dirty and reversing the logic would allow us to share a common update_mmu_cache() across all of the SH-3/SH-4 variants regardless of cache configuration, but we aren't quite at that point yet. And there was some fallout the last time we tried to go that route, it's still something that's going to need a bit of debugging before we can enable it across the board. If this is an area where you're interested in working in, I have dozens of different patches for work in this area you might want to play around with. Getting the kmap_coherent()/kunmap_coherent() bits implemented and reclaiming the vmalloc space in P3 without hosing some of the more obscure SH-4 variants was a start towards this, but it is still slow going. |
From: EXTERNAL B. M. (P. ST-FIR/Eng) <ext...@de...> - 2007-08-27 12:22:33
|
Hi, I played a bit with the cache of my SH7720 a bit today. It is the same as the one of SH7705, 4-way 16Kb/32kb. I enabled the 32 kb cache by writing to CCR3. This worked well for write through mode and with a little speed benefit. In writeback mode the kernel did mount the initrd, but did not run any executeables on it. I enabled the SH7705_CACHE_32KB option, but it seems to be broken. I had to include <linux/fs.h> in pg-sh7705.c to make it compile.=20 The kernel reportet an CRC error when tried to loaded the initrd. This time it didn't even work with writethrough. Why is there so much code for the cache handling for the 32KB mode (pg-sh7705.c)? What has to be done else than writing CCR3 to enable 32kb cache? Why doesn't writeback work with 32KB cache? Regards Markus |
From: Kristoffer E. <kri...@gm...> - 2007-08-26 13:51:34
|
On Sun, 26 Aug 2007 03:03:25 -0400 (EDT) "Robert P. J. Day" <rp...@mi...> wrote: > > > On Sat, 25 Aug 2007, Kristoffer Ericson wrote: > > > > > > > Greetings, > > > > > > > > Using menuconfig the option cramfs doesn't show up in pseudo > > > > filesystems, this is because there's no text after 'bool'. A > > > > simple 'bool cramfs-support' would do the trick. Since its > > > > default y, there's currently no way to deselect it, so bug or > > > > intentional? > > we just had a brief but animated thread about this over at LKML, where > i submitted a patch to make RAMFS selectable, and that turned out very > badly (for me, that is :-). AFAICT, you *need* RAMFS for building a > kernel, so you can't choose to leave it out. > > if that's truly the case, i can at least send in a patch to remove the > misleading help text for that Kconfig entry which suggests it can be > selected as a module. lol, yeah really misleading text. Big thanks for clearing this up Robert. > > rday > -- > ======================================================================== > Robert P. J. Day > Linux Consulting, Training and Annoying Kernel Pedantry > Waterloo, Ontario, CANADA > > http://crashcourse.ca > ======================================================================== -- Kristoffer Ericson <Kri...@Gm...> |
From: Robert P. J. D. <rp...@mi...> - 2007-08-26 11:07:07
|
On Sun, 26 Aug 2007, Kristoffer Ericson wrote: > On Sun, 26 Aug 2007 03:03:25 -0400 (EDT) > "Robert P. J. Day" <rp...@mi...> wrote: > > > > > On Sat, 25 Aug 2007, Kristoffer Ericson wrote: > > > > > > > > > Greetings, > > > > > > > > > > Using menuconfig the option cramfs doesn't show up in pseudo > > > > > filesystems, this is because there's no text after 'bool'. A > > > > > simple 'bool cramfs-support' would do the trick. Since its > > > > > default y, there's currently no way to deselect it, so bug > > > > > or intentional? > > > > we just had a brief but animated thread about this over at LKML, > > where i submitted a patch to make RAMFS selectable, and that > > turned out very badly (for me, that is :-). AFAICT, you *need* > > RAMFS for building a kernel, so you can't choose to leave it out. > > > > if that's truly the case, i can at least send in a patch to remove > > the misleading help text for that Kconfig entry which suggests it > > can be selected as a module. > > lol, yeah really misleading text. Big thanks for clearing this up > Robert. actually, i'm not sure i cleared it up so much as i confused myself even further. i'm going to post about this on the kernel newbies list shortly but, in a nutshell, *shouldn't* RAMFS be a selectable option? according to al viro, you absolutely need RAMFS to build a kernel, and he's not sure why it's even an option, even a forced one. but, after some cursory perusal, it seems like there's a messy linkage between initrd and initramfs and ramfs, to the point where i'm not really sure what should and what shouldn't be user selectable. shouldn't i be allowed to build a kernel without initrd support? or ramfs support? or neither? i just started reading up on this, so i'm still unsure. rday -- ======================================================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://crashcourse.ca ======================================================================== |
From: Mike F. <va...@ge...> - 2007-08-26 10:45:26
|
On many SuperH machines, `uname` outputs things like "sh4" rather than just "sh". Thus we need to normalize the uname output like so many other architectures. Signed-off-by: Mike Frysinger <va...@ge...> --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index f3229a4..91861c1 100644 --- a/Makefile +++ b/Makefile @@ -159,7 +159,7 @@ export srctree objtree VPATH TOPDIR # SUBARCH is subsequently ignored. SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh[2-5].*/sh/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) -- 1.5.3.rc5 |
From: Mike F. <va...@ge...> - 2007-08-26 10:44:30
|
On Saturday 25 August 2007, Paul Mundt wrote: > Probably a good idea, but that'll break sh64. Should probably be > s/sh[234].*$/sh/ or so. something was itchin me that it was too aggressive but i couldnt place it .= =2E.=20 guess i should have looked at like config.sub :) =2Dmike |
From: Robert P. J. D. <rp...@mi...> - 2007-08-26 07:13:35
|
> > On Sat, 25 Aug 2007, Kristoffer Ericson wrote: > > > > > Greetings, > > > > > > Using menuconfig the option cramfs doesn't show up in pseudo > > > filesystems, this is because there's no text after 'bool'. A > > > simple 'bool cramfs-support' would do the trick. Since its > > > default y, there's currently no way to deselect it, so bug or > > > intentional? we just had a brief but animated thread about this over at LKML, where i submitted a patch to make RAMFS selectable, and that turned out very badly (for me, that is :-). AFAICT, you *need* RAMFS for building a kernel, so you can't choose to leave it out. if that's truly the case, i can at least send in a patch to remove the misleading help text for that Kconfig entry which suggests it can be selected as a module. rday -- ======================================================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://crashcourse.ca ======================================================================== |
From: Paul M. <le...@li...> - 2007-08-26 03:27:38
|
On Sat, Aug 25, 2007 at 07:26:46PM -0400, Mike Frysinger wrote: > On many SuperH machines, `uname` outputs things like "sh4" rather than > just "sh". Thus we need to normalize the uname output like so many other > architectures. > > Signed-off-by: Mike Frysinger <va...@ge...> > --- > Makefile | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/Makefile b/Makefile > index f3229a4..91861c1 100644 > --- a/Makefile > +++ b/Makefile > @@ -159,7 +159,7 @@ export srctree objtree VPATH TOPDIR > # SUBARCH is subsequently ignored. > > SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ > - -e s/arm.*/arm/ -e s/sa110/arm/ \ > + -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh.*/sh/ \ > -e s/s390x/s390/ -e s/parisc64/parisc/ \ > -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) > Probably a good idea, but that'll break sh64. Should probably be s/sh[234].*$/sh/ or so. |
From: Mike F. <va...@ge...> - 2007-08-25 23:25:32
|
On many SuperH machines, `uname` outputs things like "sh4" rather than just "sh". Thus we need to normalize the uname output like so many other architectures. Signed-off-by: Mike Frysinger <va...@ge...> --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index f3229a4..91861c1 100644 --- a/Makefile +++ b/Makefile @@ -159,7 +159,7 @@ export srctree objtree VPATH TOPDIR # SUBARCH is subsequently ignored. SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh.*/sh/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) -- 1.5.3.rc5 |
From: Kristoffer E. <kri...@gm...> - 2007-08-25 19:43:12
|
Ah, we are talking about different things sorry. I mean RAMFS, not CRAMFS... :( Sorry about that. On Sat, 25 Aug 2007 15:08:05 -0400 (EDT) "Robert P. J. Day" <rp...@mi...> wrote: > On Sat, 25 Aug 2007, Kristoffer Ericson wrote: > > > Greetings, > > > > Using menuconfig the option cramfs doesn't show up in pseudo > > filesystems, this is because there's no text after 'bool'. A simple > > 'bool cramfs-support' would do the trick. Since its default y, > > there's currently no way to deselect it, so bug or intentional? > > i'm confused -- CRAMFS isn't listed under Pseudo filesystems, it's > under Miscellaneous filesystems, and it displays nicely. > > rday > -- > ======================================================================== > Robert P. J. Day > Linux Consulting, Training and Annoying Kernel Pedantry > Waterloo, Ontario, CANADA > > http://crashcourse.ca > ======================================================================== -- Kristoffer Ericson <Kri...@Gm...> |
From: Kristoffer E. <kri...@gm...> - 2007-08-25 19:41:27
|
On Sat, 25 Aug 2007 15:08:05 -0400 (EDT) "Robert P. J. Day" <rp...@mi...> wrote: > On Sat, 25 Aug 2007, Kristoffer Ericson wrote: > > > Greetings, > > > > Using menuconfig the option cramfs doesn't show up in pseudo > > filesystems, this is because there's no text after 'bool'. A simple > > 'bool cramfs-support' would do the trick. Since its default y, > > there's currently no way to deselect it, so bug or intentional? > > i'm confused -- CRAMFS isn't listed under Pseudo filesystems, it's > under Miscellaneous filesystems, and it displays nicely. > > rday Now you got me confused, in my lethal.git setup its inside pseudo and doesn't display unless bool got a string after it. I double checked just to be sure. > -- > ======================================================================== > Robert P. J. Day > Linux Consulting, Training and Annoying Kernel Pedantry > Waterloo, Ontario, CANADA > > http://crashcourse.ca > ======================================================================== -- Kristoffer Ericson <Kri...@Gm...> |
From: Robert P. J. D. <rp...@mi...> - 2007-08-25 19:35:34
|
On Sat, 25 Aug 2007, Kristoffer Ericson wrote: > Ah, we are talking about different things sorry. I mean RAMFS, not > CRAMFS... :( Sorry about that. ah, then you're right, it clearly isn't selectable. but there's more -- even though it's typed as a bool, its help suggests it can be built as a module. not good. i can at least submit a quick patch to LKML to make it selectable, and fix the help info, but i'll take a closer look at it to see if there's anything else about it that's out of whack. rday -- ======================================================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://crashcourse.ca ======================================================================== |
From: Robert P. J. D. <rp...@mi...> - 2007-08-25 19:19:15
|
On Sat, 25 Aug 2007, Kristoffer Ericson wrote: > Greetings, > > Using menuconfig the option cramfs doesn't show up in pseudo > filesystems, this is because there's no text after 'bool'. A simple > 'bool cramfs-support' would do the trick. Since its default y, > there's currently no way to deselect it, so bug or intentional? i'm confused -- CRAMFS isn't listed under Pseudo filesystems, it's under Miscellaneous filesystems, and it displays nicely. rday -- ======================================================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://crashcourse.ca ======================================================================== |
From: Kristoffer E. <kri...@gm...> - 2007-08-25 19:08:35
|
Greetings, Using menuconfig the option cramfs doesn't show up in pseudo filesystems, this is because there's no text after 'bool'. A simple 'bool cramfs-support' would do the trick. Since its default y, there's currently no way to deselect it, so bug or intentional? -- Kristoffer Ericson <Kri...@Gm...> |
From: Paul M. <le...@li...> - 2007-08-25 17:26:45
|
On Sat, Aug 25, 2007 at 05:58:16PM +0100, Adrian McMenamin wrote: > The driver causes an oops when being initialised as a built in - because > afaics the chain goes: > > driver_register -> bus_add_driver -> get_bus when, because the maple bus > has not yet been registered with the system a NULL is returned and an > oops is thrown (incidentally it looks like there is a bug in > bus_add_driver as it returns a 0 and not an error in this case). > > So, how do I ensure the bus gets registered before the driver? > > (I could try using the keyboard driver as a module but the hotplugging > issues get in the way here atm) > bus_register() needs to happen first, you can ensure this by using a higher initcall level. Doing the registration from a subsys_initcall() should be sufficient for this, you can see the varying initcall levels in linux/init.h with comments. SuperHyway uses core_initcall() as it's needed by some other subsystems, but you should be able to avoid that with maple and defer it to subsys time. |
From: Adrian M. <ad...@ne...> - 2007-08-25 16:59:00
|
Sorry for the generality of this, but I haven't been able to google this one... I have got a maple bus driver for the Dreamcast that is about 80% there - though it still has some hotplugging issues to be sorted. The driver resides in drivers/sh/maple To test it further I have now ported the old maple keyboard driver over to work with the new bus driver. This lives in drivers/input/keyboard The driver causes an oops when being initialised as a built in - because afaics the chain goes: driver_register -> bus_add_driver -> get_bus when, because the maple bus has not yet been registered with the system a NULL is returned and an oops is thrown (incidentally it looks like there is a bug in bus_add_driver as it returns a 0 and not an error in this case). So, how do I ensure the bus gets registered before the driver? (I could try using the keyboard driver as a module but the hotplugging issues get in the way here atm) |