LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Vojtech Pavlik @ 2006-01-13  7:47 UTC (permalink / raw)
  To: Michael Hanselmann
  Cc: linux-kernel, Dmitry Torokhov, linux-kernel, linuxppc-dev,
	linux-input
In-Reply-To: <20060113065302.GA3458@hansmi.ch>

On Fri, Jan 13, 2006 at 07:53:02AM +0100, Michael Hanselmann wrote:
 
> It indeed is. Fixed.

It gets better all the time. ;)

> New patch:
> 
> This patch implements support for the fn key on Apple PowerBooks using
> USB based keyboards.
> 
> Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
> Acked-by: Rene Nussbaumer <linux-kernel@killerfox.forkbomb.ch>
> Acked-by: Johannes Berg <johannes@sipsolutions.net>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> ---

> @@ -325,7 +459,27 @@ static void hidinput_configure_usage(str
>  
>  			set_bit(EV_REP, input->evbit);
>  			switch(usage->hid & HID_USAGE) {
> -				case 0x003: map_key_clear(KEY_FN);		break;
> +#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
> +				/* The fn key on Apple PowerBooks */
> +				case 0x0003: {
> +					struct hidinput_key_translation *trans;
> +
> +					map_key_clear(KEY_FN);
> +
> +					set_bit(KEY_FN, input->keybit);

The set_bit(KEY_FN, input->keybit) is superfluous here, right?
map_key_clear(KEY_FN); will take care of that further down.

> +					set_bit(KEY_NUMLOCK, input->keybit);
> +
> +					/* Enable all needed keys */
> +					for(trans = powerbook_fn_keys; trans->from; trans++)
> +						set_bit(trans->to, input->keybit);
> +
> +					for(trans = powerbook_numlock_keys; trans->from; trans++)
> +						set_bit(trans->to, input->keybit);
> +
> +					goto ignore;
> +				}
> +#endif
> +
>  				default:    goto ignore;
>  			}
>  			break;

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply

* Re: Can ELDK 3.1.1 compile Linux 2.6 Kernel?
From: Ron Kellam @ 2006-01-13  6:18 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <20060111083657.77699.qmail@web53707.mail.yahoo.com>

I have the DENX 2.6.14 kernel quite happily compiling using ELDK
3.1.1, and it runs fine.  My platform is a custom MPC8247 (ppc) system
with serial, ethernet, I2C & SPI drivers all working fine under
2.6.14.

I had no luck compiling any of the 2.6.15rcX or 2.6.denx trees under
ELDK 3.1.1 - same compile probs as yours.

Regards,
Ron

^ permalink raw reply

* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Michael Hanselmann @ 2006-01-13  6:53 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-kernel, linux-kernel, linuxppc-dev, Vojtech Pavlik,
	linux-input
In-Reply-To: <200601122312.05210.dtor_core@ameritech.net>

On Thu, Jan 12, 2006 at 11:12:04PM -0500, Dmitry Torokhov wrote:
> Also, since this is for compatibility with ADB, why do we have 3
> options? Doesn't ADB have only 2?

Some people want to use the fn key without having the translations. I'm
not sure wether the ADB hardware even supported this. So far, it's at
least not useless.

> I thought is was agreed that we'd avoid "inlines" in .c files?

I wasn't sure if that all got trough yet.

> > +	return (trans->from?trans:NULL);

> I'd prefer liberal amount of spaces applied here </extreme nitpick mode>

Hopefully fixed in a Dmitry-compatible way. :-)

> > +		try_translate = test_bit(usage->code, usbhid_pb_numlock)?1:
> > +				test_bit(LED_NUML, input->led);
> > +		if (try_translate) {

> Isn't this the same as 

> 		if (test_bit(usage->code, usbhid_pb_numlock) || test_bit(LED_NUML, input->led))

> but harder to read?

It indeed is. Fixed.

New patch:

This patch implements support for the fn key on Apple PowerBooks using
USB based keyboards.

Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Acked-by: Rene Nussbaumer <linux-kernel@killerfox.forkbomb.ch>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

---
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-core.c linux-2.6.15/drivers/usb/input/hid-core.c
--- linux-2.6.15.orig/drivers/usb/input/hid-core.c	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-core.c	2006-01-08 11:53:36.000000000 +0100
@@ -1580,6 +1580,14 @@ static struct hid_blacklist {
 	{ USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD },
 	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
 
+	{ USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN },
+
 	{ 0, 0 }
 };
 
diff -upr linux-2.6.15.orig/drivers/usb/input/hid.h linux-2.6.15/drivers/usb/input/hid.h
--- linux-2.6.15.orig/drivers/usb/input/hid.h	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid.h	2006-01-13 00:15:10.000000000 +0100
@@ -246,6 +246,8 @@ struct hid_item {
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5		0x100
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON		0x200
 #define HID_QUIRK_2WHEEL_POWERMOUSE		0x400
+#define HID_QUIRK_POWERBOOK_HAS_FN		0x00000800
+#define HID_QUIRK_POWERBOOK_FN_ON		0x00001000
 
 /*
  * This is the global environment of the parser. This information is
@@ -431,6 +433,11 @@ struct hid_device {							/* device repo
 	void (*ff_exit)(struct hid_device*);                            /* Called by hid_exit_ff(hid) */
 	int (*ff_event)(struct hid_device *hid, struct input_dev *input,
 			unsigned int type, unsigned int code, int value);
+
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+	unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
+	unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
+#endif
 };
 
 #define HID_GLOBAL_STACK_SIZE 4
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-input.c linux-2.6.15/drivers/usb/input/hid-input.c
--- linux-2.6.15.orig/drivers/usb/input/hid-input.c	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-input.c	2006-01-13 07:45:00.000000000 +0100
@@ -63,6 +63,65 @@ static struct {
 	__s32 y;
 }  hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
 
+struct hidinput_key_translation {
+	u16 from;
+	u16 to;
+	u8 flags;
+};
+
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+
+#define POWERBOOK_FLAG_FKEY 0x01
+
+static struct hidinput_key_translation powerbook_fn_keys[] = {
+	{ KEY_BACKSPACE, KEY_DELETE },
+	{ KEY_F1,	KEY_BRIGHTNESSDOWN,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F2,	KEY_BRIGHTNESSUP,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F3,	KEY_MUTE,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F4,	KEY_VOLUMEDOWN,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F5,	KEY_VOLUMEUP,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F6,	KEY_NUMLOCK,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F7,	KEY_SWITCHVIDEOMODE,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F8,	KEY_KBDILLUMTOGGLE,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F9,	KEY_KBDILLUMDOWN,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F10,	KEY_KBDILLUMUP,		POWERBOOK_FLAG_FKEY },
+	{ KEY_UP,	KEY_PAGEUP },
+	{ KEY_DOWN,	KEY_PAGEDOWN },
+	{ KEY_LEFT,	KEY_HOME },
+	{ KEY_RIGHT,	KEY_END },
+	{ }
+};
+
+static struct hidinput_key_translation powerbook_numlock_keys[] = {
+	{ KEY_J,	KEY_KP1 },
+	{ KEY_K,	KEY_KP2 },
+	{ KEY_L,	KEY_KP3 },
+	{ KEY_U,	KEY_KP4 },
+	{ KEY_I,	KEY_KP5 },
+	{ KEY_O,	KEY_KP6 },
+	{ KEY_7,	KEY_KP7 },
+	{ KEY_8,	KEY_KP8 },
+	{ KEY_9,	KEY_KP9 },
+	{ KEY_M,	KEY_KP0 },
+	{ KEY_DOT,	KEY_KPDOT },
+	{ KEY_SLASH,	KEY_KPPLUS },
+	{ KEY_SEMICOLON, KEY_KPMINUS },
+	{ KEY_P,	KEY_KPASTERISK },
+	{ KEY_MINUS,	KEY_KPEQUAL },
+	{ KEY_0,	KEY_KPSLASH },
+	{ KEY_F6,	KEY_NUMLOCK },
+	{ KEY_KPENTER,	KEY_KPENTER },
+	{ KEY_BACKSPACE, KEY_BACKSPACE },
+	{ }
+};
+
+static int usbhid_pb_fnmode = 1;
+module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
+MODULE_PARM_DESC(pb_fnmode,
+	"Mode of fn key on PowerBooks (0 = disabled, "
+	"1 = fkeyslast, 2 = fkeysfirst)");
+#endif
+
 #define map_abs(c)	do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0)
 #define map_rel(c)	do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0)
 #define map_key(c)	do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0)
@@ -73,6 +132,81 @@ static struct {
 #define map_key_clear(c)	do { map_key(c); clear_bit(c, bit); } while (0)
 #define map_ff_effect(c)	do { set_bit(c, input->ffbit); } while (0)
 
+static struct hidinput_key_translation *find_translation(
+	struct hidinput_key_translation *table, u16 from)
+{
+	struct hidinput_key_translation *trans;
+
+	/* Look for the translation */
+	for(trans = table;
+	    trans->from && (trans->from != from);
+	    trans++);
+
+	return (trans->from? trans : NULL);
+}
+
+static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
+	struct hid_usage *usage, __s32 value)
+{
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+	struct hidinput_key_translation *trans;
+
+	if (usage->code == KEY_FN) {
+		if (value) hid->quirks |=  HID_QUIRK_POWERBOOK_FN_ON;
+		else       hid->quirks &= ~HID_QUIRK_POWERBOOK_FN_ON;
+
+		input_event(input, usage->type, usage->code, value);
+
+		return 1;
+	}
+
+	if (usbhid_pb_fnmode) {
+		int do_translate;
+
+		trans = find_translation(powerbook_fn_keys, usage->code);
+		if (trans) {
+			if (test_bit(usage->code, hid->pb_pressed_fn))
+				do_translate = 1;
+			else if (trans->flags & POWERBOOK_FLAG_FKEY)
+				do_translate =
+					(usbhid_pb_fnmode == 2 &&  (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
+					(usbhid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
+			else
+				do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
+
+			if (do_translate) {
+				if (value)
+					set_bit(usage->code, hid->pb_pressed_fn);
+				else
+					clear_bit(usage->code, hid->pb_pressed_fn);
+
+				input_event(input, usage->type, trans->to, value);
+
+				return 1;
+			}
+		}
+
+		if (test_bit(usage->code, hid->pb_pressed_numlock) ||
+		    test_bit(LED_NUML, input->led)) {
+			trans = find_translation(powerbook_numlock_keys, usage->code);
+
+			if (trans) {
+				if (value)
+					set_bit(usage->code, hid->pb_pressed_numlock);
+				else
+					clear_bit(usage->code, hid->pb_pressed_numlock);
+
+				input_event(input, usage->type, trans->to, value);
+			}
+
+			return 1;
+		}
+	}
+#endif
+
+	return 0;
+}
+
 static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,
 				     struct hid_usage *usage)
 {
@@ -325,7 +459,27 @@ static void hidinput_configure_usage(str
 
 			set_bit(EV_REP, input->evbit);
 			switch(usage->hid & HID_USAGE) {
-				case 0x003: map_key_clear(KEY_FN);		break;
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+				/* The fn key on Apple PowerBooks */
+				case 0x0003: {
+					struct hidinput_key_translation *trans;
+
+					map_key_clear(KEY_FN);
+
+					set_bit(KEY_FN, input->keybit);
+					set_bit(KEY_NUMLOCK, input->keybit);
+
+					/* Enable all needed keys */
+					for(trans = powerbook_fn_keys; trans->from; trans++)
+						set_bit(trans->to, input->keybit);
+
+					for(trans = powerbook_numlock_keys; trans->from; trans++)
+						set_bit(trans->to, input->keybit);
+
+					goto ignore;
+				}
+#endif
+
 				default:    goto ignore;
 			}
 			break;
@@ -482,6 +636,10 @@ void hidinput_hid_event(struct hid_devic
 		return;
 	}
 
+	if ((hid->quirks & HID_QUIRK_POWERBOOK_HAS_FN) &&
+	    hidinput_pb_event(hid, input, usage, value))
+		return;
+
 	if (usage->hat_min < usage->hat_max || usage->hat_dir) {
 		int hat_dir = usage->hat_dir;
 		if (!hat_dir)
diff -upr linux-2.6.15.orig/drivers/usb/input/Kconfig linux-2.6.15/drivers/usb/input/Kconfig
--- linux-2.6.15.orig/drivers/usb/input/Kconfig	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/Kconfig	2006-01-08 11:53:35.000000000 +0100
@@ -37,6 +37,16 @@ config USB_HIDINPUT
 
 	  If unsure, say Y.
 
+config USB_HIDINPUT_POWERBOOK
+	bool "Enable support for iBook/PowerBook special keys"
+	default n
+	depends on USB_HIDINPUT
+	help
+	  Say Y here if you want support for the special keys (Fn, Numlock) on
+	  Apple iBooks and PowerBooks.
+
+	  If unsure, say N.
+
 config HID_FF
 	bool "Force feedback support (EXPERIMENTAL)"
 	depends on USB_HIDINPUT && EXPERIMENTAL

^ permalink raw reply

* PPC440EP/Yosemite PCI misbehavior
From: David Hawkins @ 2006-01-13  4:14 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all,

I'm getting what I believe is incorrect behavior from
the Yosemite 440EP PCI bus.

My setup is:
    - Yosemite board
    - PCI-to-cPCI adapter
    - cPCI bus analyzer (Agilent 1680A logic analyzer,
      with a FuturePlus FS3020 cPCI analyzer board)
    - custom cPCI board containing a PLX-9054 PCI
      bridge

I first built the test driver and ran tests on the PCI
peripheral boards using an x86 host (both PCI and cPCI
environments). In a cPCI crate with two cPCI peripheral
boards, I used Linux to read the PCI configuration space
and get the PCI addresses of boards, and then I performed
PCI transactions between the boards, i.e., no OS was
involved and I had full control over which PCI commands
were being issued during a read or write. The results of
those tests, and the driver source, are here:

http://www.ovro.caltech.edu/~dwh/correlator/software/driver_design.tar.gz
http://www.ovro.caltech.edu/~dwh/correlator/pdf/LNX-723-Hawkins.pdf

The stuff of interest in the document, is the section on PCI
drivers, and the generic PCI I/O driver is the pci_io.c
driver in the source code. I've written some Yosemite specific
build notes below for anyone who is interested.

Now for the tests on the Yosemite board....

First, the hardware. The PLX-9054 on the custom boards presents
two memory regions:

    BAR[0] 256-bytes non-prefetchable
    BAR[1] 8MB       prefetchable

Here's the observations/issues:

1. Using read()/write() to BAR[0] operates as one would expect;

    a) read uses a PCI memory read (MEM_RD) command, with FRAME#
       asserted for one clock per word, i.e., no bursting.

    b) write uses a PCI memory write (MEM_WR) command, with FRAME#
       asserted for one clock per word.

       read/write are implemented using memcpy_fromio/toio in the
       driver source


2. Using read()/write() to BAR[1] operates the same as to BAR[0].

    However, since this memory is prefetchable, it would be possible
    for the CPU to use a burst-read. The x86 architecture does
    not do it in this situation either, but the tests in the
    PDF show that both MEM_RD and MEM_WR commands are burstable.

    (This is more of an observation than a complaint)

3. Using mmap() on BAR[0] does not work correctly.

    a) a read prefetches 8 32-bits words using a memory read-line
       (MEMRDL) PCI command (FRAME# is asserted for multiple clocks)

    b) a write first prefetches 8 32-bits words (using MEMRDL), and
       then a discernable time later the data is flushed back to the
       hardware via a MEM_WR.

    BAR[0] is marked in the PCI configuration space as non-prefetchable,
    so this behaviour is wrong. Its also inconsistent with what
    happened during tests on an x86 - where read always produced single
    MEM_RDs and writes produced single MEM_WRs.

4. Using mmap() on BAR[1] exhibits the same result at BAR[1], however,
    since that region is marked as prefetchable, the use of a MEMRDL
    during read is legitimate. However, the write operation still
    appears wrong (i.e., cached).

So, it appears that for mmap() the processor considers PCI memory
both prefetchable and cacheable (regardless of its PCI configuration
space memory flag specification). I checked my mmap code and the
VMA flags VM_RESERVED and VM_IO are set prior to the call to
map the PCI memory.


5. I have another PCI device with a PLX-9054 PCI bridge in its
    default configuration, i.e., BAR[0] is 256-bytes non-prefetchable
    memory, and BAR[1] is 256-bytes I/O ports (same registers).
    Testing on an x86 works fine with the pci_io.c driver and
    the pci_debug.c or pci_transaction.c user-space tests.

    However, on the Yosemite board, access to PCI I/O space
    causes a machine check exception.

    There's a chance that the driver is at fault though.
    For example, lspci shows that the I/O ports are assigned
    to PCI I/O port address 0xFF00. When I insmod the pci_io.ko
    driver, the kernel address after ioport_map() is
    0xFDFFEF00. However, the default memory map of the 440EP
    would put this PCI I/O address in the region starting
    E800_0000, eg. E800_FF00, so I would not have been
    surprized if I saw that kernel address, or some offset
    relative to that address. But of course, I'm not sure if
    the kernel TLBs setup the PCI kernel addresses to
    match the 440EP physical addresses.

    However, the code is exercised during a test on an x86, its
    just the implementation of the ioport_map() etc that will
    be different ... so I think the 440EP port is the source
    of the error.

    I don't plan on designing hardware that uses PCI I/O
    regions, so I'm less concerned about this issue. But if
    someone wants me to send them any debug info, let me know.

Whew!! If you've read this far, thanks!!

This is the first time I have used a PowerPC, and the first
time I've really had to debug what appear to be kernel
errors (I've really just written drivers).

I'll try and debug these issues, but I wanted to see if anyone else
had run into these problems. If anyone can tell me where to start
looking, I'd appreciate it. I figure that since read()/write()
appear to work and use memcpy_fromio/toio I'd check into the
implementation of those functions first, and see how the differ
from a mmap implementation.

I've been building with the ELDK 3.1.1 kit that comes with the
Yosemite board, and I have tested with the 2.6.13 kernel that
came with the board, and the 2.6.14 kernel from Denx. I'll
test the 2.6.15 kernel as soon as the ELDK 4.0 iso's are
released and I can build a 2.6.15 kernel.

Cheers
Dave Hawkins
Caltech.



------------- Driver build notes ----------------------------------

Here's how I build the driver:

export PATH=$PATH:/opt/eldk-3.1.1/bin:/opt/eldk-3.1.1/usr/bin
export ARCH=ppc
export CROSS_COMPILE=ppc_4xxFP-
export KERNEL_DIR=/home/dwh/yosemite/linux-2.6.13-build-ppc
make

Then on the Yosemite target, I mount the build area as an NFS
mount, and then change directory into the area the driver was
built. Installing the module is:

insmod pci_io.ko
mknod /dev/pci_00\:0c.0_0 c 254 0
mknod /dev/pci_00\:0c.0_1 c 254 1
mknod /dev/pci_00\:0c.0_2 c 254 2
mknod /dev/pci_00\:0c.0_3 c 254 3
mknod /dev/pci_00\:0c.0_4 c 254 4
mknod /dev/pci_00\:0c.0_5 c 254 5

i.e., the PCI slot is at 00:0c.0 per lspci, and the device
nodes for the generic PCI I/O driver are named after that
with the BAR number as an extension.

To run tests;

1. open BAR 0 using read()/write() (memcopy_from/toio)

./pci_debug -s 00:0c.0 -b 0

2. open BAR 0 using mmap()

./pci_debug -s 00:0c.0 -b 0 -m


and so on for other BAR regions.

^ permalink raw reply

* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Dmitry Torokhov @ 2006-01-13  4:12 UTC (permalink / raw)
  To: Michael Hanselmann
  Cc: linux-kernel, linux-kernel, linuxppc-dev, Vojtech Pavlik,
	linux-input
In-Reply-To: <20060112000830.GB10142@hansmi.ch>

On Wednesday 11 January 2006 19:08, Michael Hanselmann wrote:
> On Thu, Jan 12, 2006 at 10:41:40AM +1100, Benjamin Herrenschmidt wrote:
> > I don't understand the comment above ? You are adding this to all struct
> > hid_device ? There can be only one of those keyboards plugged at one
> > point in time, I don't think there is any problem having the above
> > static in the driver rather than in the hid_device structure.
> 
> While I don't agree on that, I still modified the patch.
>

I disagree as well, but if we get semantics right we can merge it in
this form and adjust later. 
 
> +static int usbhid_pb_fnmode = 1;
> +module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
> +MODULE_PARM_DESC(usbhid_pb_fnmode,
> +	"Mode of fn key on PowerBooks (0 = disabled, "
> +	"1 = fkeyslast, 2 = fkeysfirst)");
> +#endif
> +

That should be "MODULE_PARM_DESC(pb_fn_mode, ...)". Also, since this is
for compatibility with ADB, why do we have 3 options? Doesn't ADB have
only 2?

>  #define map_abs(c)	do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0)
>  #define map_rel(c)	do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0)
>  #define map_key(c)	do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0)
> @@ -73,6 +135,80 @@ static struct {
>  #define map_key_clear(c)	do { map_key(c); clear_bit(c, bit); } while (0)
>  #define map_ff_effect(c)	do { set_bit(c, input->ffbit); } while (0)
>  
> +static inline struct hidinput_key_translation *find_translation(

I thought is was agreed that we'd avoid "inlines" in .c files?

> +	struct hidinput_key_translation *table, u16 from)
> +{
> +	struct hidinput_key_translation *trans;
> +
> +	/* Look for the translation */
> +	for(trans = table; trans->from && (trans->from != from); trans++);
> +
> +	return (trans->from?trans:NULL);
> +}

I'd prefer liberal amount of spaces applied here </extreme nitpick mode>

> +
> +static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
> +	struct hid_usage *usage, __s32 value)
> +{
> +#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
> +	struct hidinput_key_translation *trans;
> +
> +	if (usage->code == KEY_FN) {
> +		if (value) hid->quirks |=  HID_QUIRK_POWERBOOK_FN_ON;
> +		else       hid->quirks &= ~HID_QUIRK_POWERBOOK_FN_ON;
> +
> +		input_event(input, usage->type, usage->code, value);
> +
> +		return 1;
> +	}
> +
> +	if (usbhid_pb_fnmode) {
> +		int try_translate, do_translate;
> +
> +		trans = find_translation(powerbook_fn_keys, usage->code);
> +		if (trans) {
> +			if (test_bit(usage->code, usbhid_pb_fn))
> +				do_translate = 1;
> +			else if (trans->flags & POWERBOOK_FLAG_FKEY)
> +				do_translate =
> +					(usbhid_pb_fnmode == 2 &&  (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
> +					(usbhid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
> +			else
> +				do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
> +
> +			if (do_translate) {
> +				if (value)
> +					set_bit(usage->code, usbhid_pb_fn);
> +				else
> +					clear_bit(usage->code, usbhid_pb_fn);
> +
> +				input_event(input, usage->type, trans->to, value);
> +
> +				return 1;
> +			}
> +		}
> +
> +		try_translate = test_bit(usage->code, usbhid_pb_numlock)?1:
> +				test_bit(LED_NUML, input->led);
> +		if (try_translate) {

Isn't this the same as 

		if (test_bit(usage->code, usbhid_pb_numlock) || test_bit(LED_NUML, input->led))

but harder to read?

-- 
Dmitry

^ permalink raw reply

* [PATCH] powerpc: Updated platforms that use gianfar to match driver
From: Kumar Gala @ 2006-01-13  3:04 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, linuxppc-embedded

The gianfar driver changed how it required MDIO bus and phy id's
to be pasted to it. Also, it no longer passes the physical address
of the MDIO bus.  Instead we have a proper platform device.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

---
commit 66c0ddd1284ef56bfeb41374b51edfd0c8a980a8
tree 9e1b4052a8930d4c6607eebeb37b8102b1972466
parent 7b621e6ea21564548a09abbf1c2944b41ce55185
author Kumar Gala <galak@kernel.crashing.org> Thu, 12 Jan 2006 21:09:35 -0600
committer Kumar Gala <galak@kernel.crashing.org> Thu, 12 Jan 2006 21:09:35 -0600

 arch/ppc/platforms/83xx/mpc834x_sys.c        |   10 ++++------
 arch/ppc/platforms/85xx/mpc8540_ads.c        |   14 ++++++--------
 arch/ppc/platforms/85xx/mpc8560_ads.c        |   11 ++++-------
 arch/ppc/platforms/85xx/mpc85xx_cds_common.c |   16 ++++++++--------
 arch/ppc/platforms/85xx/sbc8560.c            |   10 ++++------
 arch/ppc/platforms/85xx/stx_gp3.c            |   10 ++++------
 arch/ppc/platforms/85xx/tqm85xx.c            |   16 ++++++----------
 arch/ppc/syslib/mpc83xx_devices.c            |   10 ++++++++--
 arch/ppc/syslib/mpc85xx_devices.c            |   10 ++++++++--
 9 files changed, 52 insertions(+), 55 deletions(-)

diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index 04bdc39..012e1e6 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -51,9 +51,6 @@
 
 #include <syslib/ppc83xx_setup.h>
 
-static const char *GFAR_PHY_0 = "phy0:0";
-static const char *GFAR_PHY_1 = "phy0:1";
-
 #ifndef CONFIG_PCI
 unsigned long isa_io_base = 0;
 unsigned long isa_mem_base = 0;
@@ -129,20 +126,21 @@ mpc834x_sys_setup_arch(void)
 	mdata->irq[1] = MPC83xx_IRQ_EXT2;
 	mdata->irq[2] = -1;
 	mdata->irq[31] = -1;
-	mdata->paddr += binfo->bi_immr_base;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_0;
+		pdata->bus_id = 0;
+		pdata->phy_id = 0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_1;
+		pdata->bus_id = 0;
+		pdata->phy_id = 1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index c5cde97..2eceb1e 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -52,10 +52,6 @@
 
 #include <syslib/ppc85xx_setup.h>
 
-static const char *GFAR_PHY_0 = "phy0:0";
-static const char *GFAR_PHY_1 = "phy0:1";
-static const char *GFAR_PHY_3 = "phy0:3";
-
 /* ************************************************************************
  *
  * Setup the architecture
@@ -102,27 +98,29 @@ mpc8540ads_setup_arch(void)
 	mdata->irq[2] = -1;
 	mdata->irq[3] = MPC85xx_IRQ_EXT5;
 	mdata->irq[31] = -1;
-	mdata->paddr += binfo->bi_immr_base;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_0;
+		pdata->bus_id = 0;
+		pdata->phy_id = 0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_1;
+		pdata->bus_id = 0;
+		pdata->phy_id = 1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
 	if (pdata) {
 		pdata->board_flags = 0;
-		pdata->bus_id = GFAR_PHY_3;
+		pdata->bus_id = 0;
+		pdata->phy_id = 3;
 		memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index 8e39a55..442c7ff 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -56,10 +56,6 @@
 #include <syslib/ppc85xx_setup.h>
 
 
-static const char *GFAR_PHY_0 = "phy0:0";
-static const char *GFAR_PHY_1 = "phy0:1";
-static const char *GFAR_PHY_3 = "phy0:3";
-
 /* ************************************************************************
  *
  * Setup the architecture
@@ -99,20 +95,21 @@ mpc8560ads_setup_arch(void)
 	mdata->irq[2] = -1;
 	mdata->irq[3] = MPC85xx_IRQ_EXT5;
 	mdata->irq[31] = -1;
-	mdata->paddr += binfo->bi_immr_base;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_0;
+		pdata->bus_id = 0;
+		pdata->phy_id = 0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_1;
+		pdata->bus_id = 0;
+		pdata->phy_id = 1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index 2959e3c..b332eba 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -395,9 +395,6 @@ mpc85xx_cds_pcibios_fixup(void)
 
 TODC_ALLOC();
 
-static const char *GFAR_PHY_0 = "phy0:0";
-static const char *GFAR_PHY_1 = "phy0:1";
-
 /* ************************************************************************
  *
  * Setup the architecture
@@ -461,34 +458,37 @@ mpc85xx_cds_setup_arch(void)
 	mdata->irq[2] = -1;
 	mdata->irq[3] = -1;
 	mdata->irq[31] = -1;
-	mdata->paddr += binfo->bi_immr_base;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_0;
+		pdata->bus_id = 0;
+		pdata->phy_id = 0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_1;
+		pdata->bus_id = 0;
+		pdata->phy_id = 1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_0;
+		pdata->bus_id = 0;
+		pdata->phy_id = 0;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_1;
+		pdata->bus_id = 0;
+		pdata->phy_id = 1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index 45a5b81..e777ba8 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -91,9 +91,6 @@ sbc8560_early_serial_map(void)
 }
 #endif
 
-static const char *GFAR_PHY_25 = "phy0:25";
-static const char *GFAR_PHY_26 = "phy0:26";
-
 /* ************************************************************************
  *
  * Setup the architecture
@@ -136,20 +133,21 @@ sbc8560_setup_arch(void)
 	mdata->irq[25] = MPC85xx_IRQ_EXT6;
 	mdata->irq[26] = MPC85xx_IRQ_EXT7;
 	mdata->irq[31] = -1;
-	mdata->paddr += binfo->bi_immr_base;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_25;
+		pdata->bus_id = 0;
+		pdata->phy_id = 25;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_26;
+		pdata->bus_id = 0;
+		pdata->phy_id = 26;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index 15ce9d0..061bb7c 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -93,9 +93,6 @@ static u8 gp3_openpic_initsenses[] __ini
 	0x0,				/* External 11: */
 };
 
-static const char *GFAR_PHY_2 = "phy0:2";
-static const char *GFAR_PHY_4 = "phy0:4";
-
 /*
  * Setup the architecture
  */
@@ -130,20 +127,21 @@ gp3_setup_arch(void)
 	mdata->irq[2] = MPC85xx_IRQ_EXT5;
 	mdata->irq[4] = MPC85xx_IRQ_EXT5;
 	mdata->irq[31] = -1;
-	mdata->paddr += binfo->bi_immr_base;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 	/*	pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
-		pdata->bus_id = GFAR_PHY_2;
+		pdata->bus_id = 0;
+		pdata->phy_id = 2;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 	/*	pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
-		pdata->bus_id = GFAR_PHY_4;
+		pdata->bus_id = 0;
+		pdata->phy_id = 4;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
diff --git a/arch/ppc/platforms/85xx/tqm85xx.c b/arch/ppc/platforms/85xx/tqm85xx.c
index c6dfd8f..b436f4d 100644
--- a/arch/ppc/platforms/85xx/tqm85xx.c
+++ b/arch/ppc/platforms/85xx/tqm85xx.c
@@ -91,12 +91,6 @@ static u_char tqm85xx_openpic_initsenses
 	0x0,				/* External 11: */
 };
 
-static const char *GFAR_PHY_0 = "phy0:2";
-static const char *GFAR_PHY_1 = "phy0:1";
-#ifdef CONFIG_MPC8540
-static const char *GFAR_PHY_3 = "phy0:3";
-#endif
-
 /* ************************************************************************
  *
  * Setup the architecture
@@ -149,20 +143,21 @@ tqm85xx_setup_arch(void)
 	mdata->irq[2] = -1;
 	mdata->irq[3] = MPC85xx_IRQ_EXT8;
 	mdata->irq[31] = -1;
-	mdata->paddr += binfo->bi_immr_base;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_0;
+		pdata->bus_id = 0;
+		pdata->phy_id = 2;
 		memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
 	}
 
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
 	if (pdata) {
 		pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
-		pdata->bus_id = GFAR_PHY_1;
+		pdata->bus_id = 0;
+		pdata->phy_id = 1;
 		memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
 	}
 
@@ -170,7 +165,8 @@ tqm85xx_setup_arch(void)
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
 	if (pdata) {
 		pdata->board_flags = 0;
-		pdata->bus_id = GFAR_PHY_3;
+		pdata->bus_id = 0;
+		pdata->phy_id = 3;
 		memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
 	}
 #endif
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
index 847df44..f9b95de 100644
--- a/arch/ppc/syslib/mpc83xx_devices.c
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -28,7 +28,6 @@
  */
 
 struct gianfar_mdio_data mpc83xx_mdio_pdata = {
-	.paddr = 0x24520,
 };
 
 static struct gianfar_platform_data mpc83xx_tsec1_pdata = {
@@ -226,7 +225,14 @@ struct platform_device ppc_sys_platform_
 		.name = "fsl-gianfar_mdio",
 		.id = 0,
 		.dev.platform_data = &mpc83xx_mdio_pdata,
-		.num_resources = 0,
+		.num_resources = 1,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x24520,
+				.end	= 0x2453f,
+				.flags	= IORESOURCE_MEM,
+			},
+		},
 	},
 };
 
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
index 69949d2..00e9b6f 100644
--- a/arch/ppc/syslib/mpc85xx_devices.c
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -26,7 +26,6 @@
  * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup
  */
 struct gianfar_mdio_data mpc85xx_mdio_pdata = {
-	.paddr = MPC85xx_MIIM_OFFSET,
 };
 
 static struct gianfar_platform_data mpc85xx_tsec1_pdata = {
@@ -720,7 +719,14 @@ struct platform_device ppc_sys_platform_
 		.name = "fsl-gianfar_mdio",
 		.id = 0,
 		.dev.platform_data = &mpc85xx_mdio_pdata,
-		.num_resources = 0,
+		.num_resources = 1,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x24520,
+				.end	= 0x2453f,
+				.flags	= IORESOURCE_MEM,
+			},
+		},
 	},
 };
 

^ permalink raw reply related

* Suggestions for a PPC440 board?
From: David Hawkins @ 2006-01-13  1:40 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all,

I'm evaluating the Yosemite 440EP board at the moment,
with the intention of using it on custom compactPCI
boards. I've got a few questions to ask the group, but
I'll leave those for another email.

In the final system, the cPCI host will be an x86 CPU
(since I already have them), and the cPCI peripherals
will be the 440EP custom boards --- so my intended
target for the 440EP is as a peripheral, whereas the
Yosemite is a host-only development platform (but,
still I have a lot to learn, so its a good place to
start).

To help with the development of PCI drivers, I was thinking
of getting a pre-existing 440-based cPCI board. I haven't
found any 440EP boards, but there are a few 440GP and
440GX boards out there. I need the 440EP FPU in the
real system, but for driver development, one of these
machines would do.

So I have located a few boards, mostly designed as
PMC carrier baseboards. Has anyone used these?

Actis computer       CSBC-6440        440GP
Momentum Computer    Civet-C          440GP
Extreme Engineering  XChange1100/2/4  440GX

Since these boards are designed as carrier boards,
they all use a 21555 transparent/or non-transparent
PCI-to-PCI bridge. I was planning to connect the
440EP directly to the cPCI bus (or at least via
3.3V/5V buffers), so the driver designed against one
of these carrier boards would not quite be identical
(since the host would talk to the 21555 bridge,
not the 440 bridge). So, I might not follow this
route. Alternatively, I could use a PMC, or PrPMC
board, and develop the drivers that way, eg.

Extreme Engineering    Xpedite1000/1  440GX
Artisyn Technologies   PmPPC          440GP

So - anyone have a favorite?

Cheers
Dave Hawkins
Caltech.

^ permalink raw reply

* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Benjamin Herrenschmidt @ 2006-01-13  1:53 UTC (permalink / raw)
  To: Michael Hanselmann
  Cc: linux-kernel, dtor_core, linux-kernel, linuxppc-dev,
	Vojtech Pavlik, linux-input
In-Reply-To: <20060112233951.GA31258@hansmi.ch>

On Fri, 2006-01-13 at 00:39 +0100, Michael Hanselmann wrote:
> On Thu, Jan 12, 2006 at 10:07:33AM +0100, Vojtech Pavlik wrote:
> > I think having it in struct hid_device is safer. We might want to
> > dynamically allocate only for PowerBook keyboards, though, to save
> > memory.
> 
> These two arrays take 128 Bytes. I don't think it's possible to write
> the code to allocate and set them in such short code. Beside of that, it
> would affect more code than only hid-input.c, at least hid-core.c would
> need modifications, too.
> 
> Benjamin Herrenschmidt had the idea of a private field which each device
> can use for its own purposes. That's a task for another patch, tough.
> 
> This patch implements support for the fn key on Apple PowerBooks using
> USB based keyboards.

Dimitri, I think the patch is good enough now and should go in for
2.6.16.

Thanks !
Ben.

^ permalink raw reply

* Re: init does not run on 405GP system
From: Wolfgang Denk @ 2006-01-13  1:19 UTC (permalink / raw)
  To: Kabir Ahsan-r9aahw; +Cc: linuxppc-dev
In-Reply-To: <351763BE49AC8743AFCCF925821FF6BE04A503@az33exm22.fsl.freescale.net>

In message <351763BE49AC8743AFCCF925821FF6BE04A503@az33exm22.fsl.freescale.net> you wrote:
> 
> I found this thread on the web. The reason I am writing is that I am
> also seeing some problem with my /sbin/init. Can you elaborate on the
> solution? You mentioned that "The On Chip Memory was mapped to an
> address below 0x8000'0000 - what we didn't know was that this is a
> _virtual_ address, because the OCM is not simply located "behind" the
> MMU."=20
> What do you mean by OCM? What do you mean by address below 0x80000000?

OCM = On Chip Memory (this should be obvious from the previous text).

And address "below 0x80000000" is  one  in  the  address  range  from
0x0000 up to and including 0x7FFFFFFF (this should be obvious, too).

> So you had to redefine your MMU definition to get through this error?

No, just fix your memory map.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The use of anthropomorphic terminology when  dealing  with  computing
systems is a symptom of professional immaturity.   -- Edsger Dijkstra

^ permalink raw reply

* [PATCH powerpc.git] Better use defaultimage-
From: Tom Rini @ 2006-01-12 23:55 UTC (permalink / raw)
  To: linuxppc64-dev, linuxppc-dev

[ Please disregard the patch to make zImage & uImage the default, Paul
has NAK'd this on IRC ]

The following reworks how defaultimage- is used.  We default to zImage
here and then override it on platforms that need something more (uImage
in the future) or less (vmlinux on iSeries).

Signed-off-by: Tom Rini <trini@kernel.crashing.org>

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 5f80e58..cb6e3ca 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -140,8 +140,8 @@ drivers-$(CONFIG_CPM2)		+= arch/ppc/8260
 
 drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
 
-defaultimage-$(CONFIG_PPC32)	:= zImage
+# Default to zImage, override when needed
+defaultimage-y			:= zImage
 defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
-defaultimage-$(CONFIG_PPC_PSERIES) := zImage
 KBUILD_IMAGE := $(defaultimage-y)
 all: $(KBUILD_IMAGE)
 
 
-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply related

* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Michael Hanselmann @ 2006-01-12 23:39 UTC (permalink / raw)
  To: Vojtech Pavlik
  Cc: linux-kernel, dtor_core, linux-kernel, linuxppc-dev, linux-input
In-Reply-To: <20060112090733.GA7627@midnight.suse.cz>

On Thu, Jan 12, 2006 at 10:07:33AM +0100, Vojtech Pavlik wrote:
> I think having it in struct hid_device is safer. We might want to
> dynamically allocate only for PowerBook keyboards, though, to save
> memory.

These two arrays take 128 Bytes. I don't think it's possible to write
the code to allocate and set them in such short code. Beside of that, it
would affect more code than only hid-input.c, at least hid-core.c would
need modifications, too.

Benjamin Herrenschmidt had the idea of a private field which each device
can use for its own purposes. That's a task for another patch, tough.

This patch implements support for the fn key on Apple PowerBooks using
USB based keyboards.

Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Acked-by: Rene Nussbaumer <linux-kernel@killerfox.forkbomb.ch>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

---
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-core.c linux-2.6.15/drivers/usb/input/hid-core.c
--- linux-2.6.15.orig/drivers/usb/input/hid-core.c	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-core.c	2006-01-08 11:53:36.000000000 +0100
@@ -1580,6 +1580,14 @@ static struct hid_blacklist {
 	{ USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD },
 	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
 
+	{ USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN },
+
 	{ 0, 0 }
 };
 
diff -upr linux-2.6.15.orig/drivers/usb/input/hid.h linux-2.6.15/drivers/usb/input/hid.h
--- linux-2.6.15.orig/drivers/usb/input/hid.h	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid.h	2006-01-13 00:15:10.000000000 +0100
@@ -246,6 +246,8 @@ struct hid_item {
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5		0x100
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON		0x200
 #define HID_QUIRK_2WHEEL_POWERMOUSE		0x400
+#define HID_QUIRK_POWERBOOK_HAS_FN		0x00000800
+#define HID_QUIRK_POWERBOOK_FN_ON		0x00001000
 
 /*
  * This is the global environment of the parser. This information is
@@ -431,6 +433,11 @@ struct hid_device {							/* device repo
 	void (*ff_exit)(struct hid_device*);                            /* Called by hid_exit_ff(hid) */
 	int (*ff_event)(struct hid_device *hid, struct input_dev *input,
 			unsigned int type, unsigned int code, int value);
+
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+	unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
+	unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
+#endif
 };
 
 #define HID_GLOBAL_STACK_SIZE 4
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-input.c linux-2.6.15/drivers/usb/input/hid-input.c
--- linux-2.6.15.orig/drivers/usb/input/hid-input.c	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-input.c	2006-01-13 00:25:57.000000000 +0100
@@ -63,6 +63,65 @@ static struct {
 	__s32 y;
 }  hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
 
+struct hidinput_key_translation {
+	u16 from;
+	u16 to;
+	u8 flags;
+};
+
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+
+#define POWERBOOK_FLAG_FKEY 0x01
+
+static struct hidinput_key_translation powerbook_fn_keys[] = {
+	{ KEY_BACKSPACE, KEY_DELETE },
+	{ KEY_F1,	KEY_BRIGHTNESSDOWN,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F2,	KEY_BRIGHTNESSUP,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F3,	KEY_MUTE,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F4,	KEY_VOLUMEDOWN,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F5,	KEY_VOLUMEUP,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F6,	KEY_NUMLOCK,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F7,	KEY_SWITCHVIDEOMODE,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F8,	KEY_KBDILLUMTOGGLE,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F9,	KEY_KBDILLUMDOWN,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F10,	KEY_KBDILLUMUP,		POWERBOOK_FLAG_FKEY },
+	{ KEY_UP,	KEY_PAGEUP },
+	{ KEY_DOWN,	KEY_PAGEDOWN },
+	{ KEY_LEFT,	KEY_HOME },
+	{ KEY_RIGHT,	KEY_END },
+	{ }
+};
+
+static struct hidinput_key_translation powerbook_numlock_keys[] = {
+	{ KEY_J,	KEY_KP1 },
+	{ KEY_K,	KEY_KP2 },
+	{ KEY_L,	KEY_KP3 },
+	{ KEY_U,	KEY_KP4 },
+	{ KEY_I,	KEY_KP5 },
+	{ KEY_O,	KEY_KP6 },
+	{ KEY_7,	KEY_KP7 },
+	{ KEY_8,	KEY_KP8 },
+	{ KEY_9,	KEY_KP9 },
+	{ KEY_M,	KEY_KP0 },
+	{ KEY_DOT,	KEY_KPDOT },
+	{ KEY_SLASH,	KEY_KPPLUS },
+	{ KEY_SEMICOLON, KEY_KPMINUS },
+	{ KEY_P,	KEY_KPASTERISK },
+	{ KEY_MINUS,	KEY_KPEQUAL },
+	{ KEY_0,	KEY_KPSLASH },
+	{ KEY_F6,	KEY_NUMLOCK },
+	{ KEY_KPENTER,	KEY_KPENTER },
+	{ KEY_BACKSPACE, KEY_BACKSPACE },
+	{ }
+};
+
+static int usbhid_pb_fnmode = 1;
+module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
+MODULE_PARM_DESC(usbhid_pb_fnmode,
+	"Mode of fn key on PowerBooks (0 = disabled, "
+	"1 = fkeyslast, 2 = fkeysfirst)");
+#endif
+
 #define map_abs(c)	do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0)
 #define map_rel(c)	do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0)
 #define map_key(c)	do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0)
@@ -73,6 +132,80 @@ static struct {
 #define map_key_clear(c)	do { map_key(c); clear_bit(c, bit); } while (0)
 #define map_ff_effect(c)	do { set_bit(c, input->ffbit); } while (0)
 
+static inline struct hidinput_key_translation *find_translation(
+	struct hidinput_key_translation *table, u16 from)
+{
+	struct hidinput_key_translation *trans;
+
+	/* Look for the translation */
+	for(trans = table; trans->from && (trans->from != from); trans++);
+
+	return (trans->from?trans:NULL);
+}
+
+static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
+	struct hid_usage *usage, __s32 value)
+{
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+	struct hidinput_key_translation *trans;
+
+	if (usage->code == KEY_FN) {
+		if (value) hid->quirks |=  HID_QUIRK_POWERBOOK_FN_ON;
+		else       hid->quirks &= ~HID_QUIRK_POWERBOOK_FN_ON;
+
+		input_event(input, usage->type, usage->code, value);
+
+		return 1;
+	}
+
+	if (usbhid_pb_fnmode) {
+		int try_translate, do_translate;
+
+		trans = find_translation(powerbook_fn_keys, usage->code);
+		if (trans) {
+			if (test_bit(usage->code, hid->pb_pressed_fn))
+				do_translate = 1;
+			else if (trans->flags & POWERBOOK_FLAG_FKEY)
+				do_translate =
+					(usbhid_pb_fnmode == 2 &&  (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
+					(usbhid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
+			else
+				do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
+
+			if (do_translate) {
+				if (value)
+					set_bit(usage->code, hid->pb_pressed_fn);
+				else
+					clear_bit(usage->code, hid->pb_pressed_fn);
+
+				input_event(input, usage->type, trans->to, value);
+
+				return 1;
+			}
+		}
+
+		try_translate = test_bit(usage->code, hid->pb_pressed_numlock)?1:
+				test_bit(LED_NUML, input->led);
+		if (try_translate) {
+			trans = find_translation(powerbook_numlock_keys, usage->code);
+
+			if (trans) {
+				if (value)
+					set_bit(usage->code, hid->pb_pressed_numlock);
+				else
+					clear_bit(usage->code, hid->pb_pressed_numlock);
+
+				input_event(input, usage->type, trans->to, value);
+			}
+
+			return 1;
+		}
+	}
+#endif
+
+	return 0;
+}
+
 static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,
 				     struct hid_usage *usage)
 {
@@ -325,7 +458,27 @@ static void hidinput_configure_usage(str
 
 			set_bit(EV_REP, input->evbit);
 			switch(usage->hid & HID_USAGE) {
-				case 0x003: map_key_clear(KEY_FN);		break;
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+				/* The fn key on Apple PowerBooks */
+				case 0x0003: {
+					struct hidinput_key_translation *trans;
+
+					map_key_clear(KEY_FN);
+
+					set_bit(KEY_FN, input->keybit);
+					set_bit(KEY_NUMLOCK, input->keybit);
+
+					/* Enable all needed keys */
+					for(trans = powerbook_fn_keys; trans->from; trans++)
+						set_bit(trans->to, input->keybit);
+
+					for(trans = powerbook_numlock_keys; trans->from; trans++)
+						set_bit(trans->to, input->keybit);
+
+					goto ignore;
+				}
+#endif
+
 				default:    goto ignore;
 			}
 			break;
@@ -482,6 +635,10 @@ void hidinput_hid_event(struct hid_devic
 		return;
 	}
 
+	if ((hid->quirks & HID_QUIRK_POWERBOOK_HAS_FN) &&
+	    hidinput_pb_event(hid, input, usage, value))
+		return;
+
 	if (usage->hat_min < usage->hat_max || usage->hat_dir) {
 		int hat_dir = usage->hat_dir;
 		if (!hat_dir)
diff -upr linux-2.6.15.orig/drivers/usb/input/Kconfig linux-2.6.15/drivers/usb/input/Kconfig
--- linux-2.6.15.orig/drivers/usb/input/Kconfig	2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/Kconfig	2006-01-08 11:53:35.000000000 +0100
@@ -37,6 +37,16 @@ config USB_HIDINPUT
 
 	  If unsure, say Y.
 
+config USB_HIDINPUT_POWERBOOK
+	bool "Enable support for iBook/PowerBook special keys"
+	default n
+	depends on USB_HIDINPUT
+	help
+	  Say Y here if you want support for the special keys (Fn, Numlock) on
+	  Apple iBooks and PowerBooks.
+
+	  If unsure, say N.
+
 config HID_FF
 	bool "Force feedback support (EXPERIMENTAL)"
 	depends on USB_HIDINPUT && EXPERIMENTAL

^ permalink raw reply

* init does not run on 405GP system
From: Kabir Ahsan-r9aahw @ 2006-01-12 22:51 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]

Hi
I found this thread on the web. The reason I am writing is that I am
also seeing some problem with my /sbin/init. Can you elaborate on the
solution? You mentioned that "The On Chip Memory was mapped to an
address below 0x8000'0000 - what we didn't know was that this is a
_virtual_ address, because the OCM is not simply located "behind" the
MMU." 
What do you mean by OCM? What do you mean by address below 0x80000000?
So you had to redefine your MMU definition to get through this error?
Regard,
Ahsan
 
On Tue, Jun 10, 2003 at 04:10:47PM +0200, Robert Schwebel wrote:
> Nevertheless, the kernel runs smoothly. I can ping the machine, I can
> even floodping it with 0% packet loss. Only that there is no
userspace> running.
>
> Has anybody seen something like this before?

It is solved. The On Chip Memory was mapped to an address below
0x8000'0000 - what we didn't know was that this is a _virtual_ address,
because the OCM is not simply located "behind" the MMU. After changing
the mapping it works smoothly now.

Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
<http://www.pengutronix.de/> 
Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/




[-- Attachment #2: Type: text/html, Size: 2321 bytes --]

^ permalink raw reply

* Re: mv643xx_eth.c: Multicast and IPv6 support
From: Dale Farnsworth @ 2006-01-12 21:28 UTC (permalink / raw)
  To: Wolfram Joost; +Cc: linuxppc-dev
In-Reply-To: <200601122216.18481@mail.frokaschwei.de>

On Thu, Jan 12, 2006 at 10:16:18PM +0100, Wolfram Joost wrote:
> > > currently, the driver mv643xx_eth.c doesn't support receiving of
> 
> > Thanks.  On December 28th, I posted a patch to netdev@vger.kernel.org that
> > adds multicast support to the mv643xx driver.  I'll ping jgarzik
> > about it.
> 
> Oh, didn't find that patch yesterday.
> 
> > The IPv6 changes look good.  Would you please re-submit these without
> > the multicast changes and with a Signed-off-by line?
> 
> Here it comes. However, IPv6 uses multicasting for address resolution
> (replacement for ARP), so IPv6 doesn't work until the multicast patch is applied, too.

Thanks Wolfram.  I'll put it in my queue for testing and if all goes well,
I'll forward it to Jeff Garzik this weekend.

-Dale

^ permalink raw reply

* [PATCH] Remove bzImage target
From: Tom Rini @ 2006-01-12 21:25 UTC (permalink / raw)
  To: linuxppc64-dev, linuxppc-dev

Since the documentation no longer tells people to 'make bzImage', and
with the previous patch nothing more than 'make' is required to get the
right bootable images (just like on i386 now), this removes the bzImage
-> zImage target redirect on ARCH=powerpc

Signed-off-by: Tom Rini <trini@kernel.crashing.org>

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 5f80e58..ad19028 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -148,9 +150,6 @@ all: $(KBUILD_IMAGE)
 
 CPPFLAGS_vmlinux.lds	:= -Upowerpc
 
-# All the instructions talk about "make bzImage".
-bzImage: zImage
-
 BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage
 
 .PHONY: $(BOOT_TARGETS)

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply related

* [PATCH] Add zImage / uImage to default builds
From: Tom Rini @ 2006-01-12 21:23 UTC (permalink / raw)
  To: linuxppc64-dev, linuxppc-dev

This adds uImage and zImage to the list of default build targets on
ARCH=powerpc to match ARCH=ppc

Signed-off-by: Tom Rini <trini@kernel.crashing.org>

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 5f80e58..ad19028 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -60,6 +60,8 @@ endif
 
 LDFLAGS_vmlinux	:= -Bstatic
 
+all: uImage zImage
+
 # The -Iarch/$(ARCH)/include is temporary while we are merging
 CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include
 AFLAGS-$(CONFIG_PPC32)	:= -Iarch/$(ARCH)

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply related

* Re: mv643xx_eth.c: Multicast and IPv6 support
From: Wolfram Joost @ 2006-01-12 21:16 UTC (permalink / raw)
  To: Dale Farnsworth, linuxppc-dev
In-Reply-To: <20060112190900.23594.qmail@farnsworth.org>

Hello,

> > currently, the driver mv643xx_eth.c doesn't support receiving of

> Thanks.  On December 28th, I posted a patch to netdev@vger.kernel.org that
> adds multicast support to the mv643xx driver.  I'll ping jgarzik
> about it.

Oh, didn't find that patch yesterday.

> The IPv6 changes look good.  Would you please re-submit these without
> the multicast changes and with a Signed-off-by line?

Here it comes. However, IPv6 uses multicasting for address resolution
(replacement for ARP), so IPv6 doesn't work until the multicast patch is applied, too.

Wolfram.

---
This patch removes the NETIF_F_HW_CSUM flag to be able to use other protocols
than IPv4. Hardware checksums for IPv4 should continue to work.
The sanity-check has been enhanced to check the used protocol and to not
access skb->iph for non-ipv4-packets.

Signed-off-by: Wolfram Joost <pegasos@frokaschwei.de>
---
diff -up linux-2.6.15/drivers/net/mv643xx_eth.c linux-2.6.15.patched/drivers/net/mv643xx_eth.c
--- linux-2.6.15/drivers/net/mv643xx_eth.c	2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.15.patched/drivers/net/mv643xx_eth.c	2006-01-12 21:52:32.000000000 +0100
@@ -1151,25 +1151,28 @@ linear:
 			pkt_info.l4i_chk = 0;
 		} else {
 
-			pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
-					   ETH_TX_FIRST_DESC |
-					   ETH_TX_LAST_DESC |
-					   ETH_GEN_TCP_UDP_CHECKSUM |
-					   ETH_GEN_IP_V_4_CHECKSUM |
-					   skb->nh.iph->ihl << ETH_TX_IHL_SHIFT;
 			/* CPU already calculated pseudo header checksum. */
-			if (skb->nh.iph->protocol == IPPROTO_UDP) {
-				pkt_info.cmd_sts |= ETH_UDP_FRAME;
+			if ( (skb->protocol == ETH_P_IP) &&
+			     (skb->nh.iph->protocol == IPPROTO_UDP) ) {
+				pkt_info.cmd_sts = ETH_UDP_FRAME;
 				pkt_info.l4i_chk = skb->h.uh->check;
-			} else if (skb->nh.iph->protocol == IPPROTO_TCP)
+			} else if ( (skb->protocol == ETH_P_IP) &&
+				    (skb->nh.iph->protocol == IPPROTO_TCP) ) {
+				pkt_info.cmd_sts = 0;
 				pkt_info.l4i_chk = skb->h.th->check;
-			else {
+			} else {
 				printk(KERN_ERR
-					"%s: chksum proto != TCP or UDP\n",
+					"%s: chksum proto != IPv4 TCP or UDP\n",
 					dev->name);
 				spin_unlock_irqrestore(&mp->lock, flags);
 				return 1;
 			}
+			pkt_info.cmd_sts |= ETH_TX_ENABLE_INTERRUPT |
+					    ETH_TX_FIRST_DESC |
+					    ETH_TX_LAST_DESC |
+					    ETH_GEN_TCP_UDP_CHECKSUM |
+					    ETH_GEN_IP_V_4_CHECKSUM |
+					    skb->nh.iph->ihl << ETH_TX_IHL_SHIFT;
 		}
 		pkt_info.byte_cnt = skb->len;
 		pkt_info.buf_ptr = dma_map_single(NULL, skb->data, skb->len,
@@ -1216,23 +1219,26 @@ linear:
 			pkt_info.cmd_sts = ETH_TX_FIRST_DESC |
 					   5 << ETH_TX_IHL_SHIFT;
 		else {
-			pkt_info.cmd_sts = ETH_TX_FIRST_DESC |
-					   ETH_GEN_TCP_UDP_CHECKSUM |
-					   ETH_GEN_IP_V_4_CHECKSUM |
-					   skb->nh.iph->ihl << ETH_TX_IHL_SHIFT;
 			/* CPU already calculated pseudo header checksum. */
-			if (skb->nh.iph->protocol == IPPROTO_UDP) {
-				pkt_info.cmd_sts |= ETH_UDP_FRAME;
+			if ( (skb->protocol == ETH_P_IP) &&
+			     (skb->nh.iph->protocol == IPPROTO_UDP) ) {
+				pkt_info.cmd_sts = ETH_UDP_FRAME;
 				pkt_info.l4i_chk = skb->h.uh->check;
-			} else if (skb->nh.iph->protocol == IPPROTO_TCP)
+			} else if ( (skb->protocol == ETH_P_IP) &&
+				    (skb->nh.iph->protocol == IPPROTO_TCP) ) {
+				pkt_info.cmd_sts = 0;
 				pkt_info.l4i_chk = skb->h.th->check;
-			else {
+			} else {
 				printk(KERN_ERR
-					"%s: chksum proto != TCP or UDP\n",
+					"%s: chksum proto != IPv4 TCP or UDP\n",
 					dev->name);
 				spin_unlock_irqrestore(&mp->lock, flags);
 				return 1;
 			}
+			pkt_info.cmd_sts |= ETH_TX_FIRST_DESC |
+					    ETH_GEN_TCP_UDP_CHECKSUM |
+					    ETH_GEN_IP_V_4_CHECKSUM |
+					    skb->nh.iph->ihl << ETH_TX_IHL_SHIFT;
 		}
 
 		status = eth_port_send(mp, &pkt_info);
@@ -1441,7 +1447,7 @@ static int mv643xx_eth_probe(struct plat
 	 * Zero copy can only work if we use Discovery II memory. Else, we will
 	 * have to map the buffers to ISA memory which is only 16 MB
 	 */
-	dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_HW_CSUM;
+	dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
 #endif
 #endif
 

^ permalink raw reply

* Re: AGPGART driver for ArticiaS - ioremap() problem
From: Gerhard Pircher @ 2006-01-12 19:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, debian-powerpc
In-Reply-To: <1137041067.7774.25.camel@localhost.localdomain>

Hi,

> --- Ursprüngliche Nachricht ---
> Von: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> An: Gerhard Pircher <gerhard_stamer@gmx.net>
> Kopie: linuxppc-dev@ozlabs.org, debian-powerpc@lists.debian.org
> Betreff: Re: AGPGART driver for ArticiaS - ioremap() problem
> Datum: Thu, 12 Jan 2006 15:44:27 +1100
> 
> On Wed, 2006-01-11 at 22:00 +0100, Gerhard Pircher wrote:
> > Hi,
> > 
> > David Bentam and I are trying to get a AGPGART driver working for the  >
> AmigaOne and the Pegasos1. The driver detects the aperture size of the
> > ArticiaS AGP bridge, but fails at the ioremap() function in the generic
> > GATT table create function. Does the PowerPC platform behaves
> > differently for the mapping of address location for AGP operation than >
> the x86 platform? Is it possible to use a mask to relocate the AGP
> > address space to a specific location?
> 
> Well, what value are you passing to ioremap ?
> 
> Ben.

I added some debug code to the agp_generic_create_gatt_table() function.
This is the debug output of it (function renamed to
articias_create_gatt_table()):

 agpgart: [ARTICIAS] articias_fetch_size()
agpgart: [ARTICIAS] * non masked temp = 0x1
agpgart: [ARTICIAS] * aperature size loop index #0
agpgart: [ARTICIAS] * values[0].size_value = 1
agpgart: [ARTICIAS] * masked temp = 0x1
agpgart: [ARTICIAS] * values[0].size = 4
agpgart: [ARTICIAS] * current_size->size = 4
agpgart: [ARTICIAS] * current_size->page_order = 1
agpgart: [ARTICIAS] * current_size->num_entries = 1024
agpgart: [ARTICIAS] * current_size->size_value = 1
agpgart: [ARTICIAS] articias_create_gatt_table()
agpgart: [ARTICIAS] * table address = 0xdfad2000
agpgart: [ARTICIAS] * table end address = 0xdfad3fff
agpgart: [ARTICIAS] * page = 0xc08f9a80
agpgart: [ARTICIAS] * gatt_table_real = 0xdfad2000
agpgart: [ARTICIAS] * agp_gatt_table = 0xdfad2000
agpgart: [ARTICIAS] * virt_to_gart(table) = 0x1fad2000
__ioremap(): phys addr 1fad2000 is RAM lr c000ec3c
agpgart: [ARTICIAS] * gatt_table_real = 0x0
agpgart: unable to get memory for graphics translation table.
agpgart: agp_backend_initialize() failed.
agpgart-articias: probe of 0000:00:00.0 failed with error -12

As far as I can see, the physical address of the table is in the PCI memory
range, right?

Any ideas?

Thanks!

Regards,

Gerhard

-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner

^ permalink raw reply

* Re: mv643xx_eth.c: Multicast and IPv6 support
From: Dale Farnsworth @ 2006-01-12 19:09 UTC (permalink / raw)
  To: pegasos, linuxppc-dev
In-Reply-To: <200601121329.11693@mail.frokaschwei.de>

In article <200601121329.11693@mail.frokaschwei.de>
pegasos@frokaschwei.de writes:
> currently, the driver mv643xx_eth.c doesn't support receiving of multicast and 
> sending of IPv6 packets.
> I found a piece of code in the u-boot bootloader which supports multicast 
> receiving and did some cut and paste. Now receiving multicast packets works 
> for me.
> To be able to send IPv6 packets I had to remove the NETIF_F_HW_CSUM flag. 
> Hardware checksumming for IPv4 should continue to work because of the 
> NETIF_F_IP_CSUM flag.
> 
> I attach a diff against 2.6.15.

Thanks.  On December 28th, I posted a patch to netdev@vger.kernel.org that
adds multicast support to the mv643xx driver.  I'll ping jgarzik
about it.

The IPv6 changes look good.  Would you please re-submit these without
the multicast changes and with a Signed-off-by line?

-Dale

^ permalink raw reply

* Re: [PATCH 08/10] ML300 & ML403 need embed_config.o linked in
From: Andrei Konovalov @ 2006-01-12 17:29 UTC (permalink / raw)
  To: grant.likely; +Cc: glikely, dhlii, gnathita, linuxppc-embedded
In-Reply-To: <11367955811900-git-send-email-grant.likely@secretlab.ca>

grant.likely@secretlab.ca wrote:
> Signed-off-by: Grant C. Likely <grant.likely@secretlab.ca>
> 
> ---
> 
>  arch/ppc/boot/simple/Makefile |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> a39144d5708c207f58964000baf56fa9cfb18628
> diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
> index f3e9c53..7abd772 100644
> --- a/arch/ppc/boot/simple/Makefile
> +++ b/arch/ppc/boot/simple/Makefile
> @@ -188,6 +188,8 @@ OBJCOPY_ARGS			:= -O elf32-powerpc
>  boot-y				:= head.o relocate.o $(extra.o-y) $(misc-y)
>  boot-$(CONFIG_REDWOOD_5)	+= embed_config.o
>  boot-$(CONFIG_REDWOOD_6)	+= embed_config.o
> +boot-$(CONFIG_XILINX_ML300)	+= embed_config.o
> +boot-$(CONFIG_XILINX_ML403)	+= embed_config.o
>  boot-$(CONFIG_8xx)		+= embed_config.o
>  boot-$(CONFIG_8260)		+= embed_config.o
>  boot-$(CONFIG_BSEIP)		+= iic.o

Tested OK on ML300.

^ permalink raw reply

* Re: [PATCH 02/10] Make Virtex-II Pro support generic for all Virtex devices
From: Andrei Konovalov @ 2006-01-12 17:28 UTC (permalink / raw)
  To: grant.likely; +Cc: glikely, dhlii, gnathita, linuxppc-embedded
In-Reply-To: <1136795579525-git-send-email-grant.likely@secretlab.ca>

grant.likely@secretlab.ca wrote:
> The PPC405 hard core is used in both the Virtex-II Pro and Virtex 4 FX
> FPGAs.  This patch cleans up the Virtex naming convention to reflect more
> than just the Virtex-II Pro.
> 
> Rename files virtex-ii_pro.[ch] to virtex.[ch]
> Rename config value VIRTEX_II_PRO to XILINX_VIRTEX
> 
> Signed-off-by: Grant C. Likely <grant.likely@secretlab.ca>
> 
> ---

Here is a misprint:
> 
...
> diff --git a/arch/ppc/platforms/4xx/virtex.c b/arch/ppc/platforms/4xx/virtex.c
> new file mode 100644
> index 0000000..1de7a27
> --- /dev/null
> +++ b/arch/ppc/platforms/4xx/virtex.c
> @@ -0,0 +1,60 @@
> +/*
> + * arch/ppc/platforms/4xx/virtex.c
> + *
> + * Author: MontaVista Software, Inc.
> + *         source@mvista.com
> + *
> + * 2002-2004 (c) MontaVista Software, Inc.  This file is licensed under the
> + * terms of the GNU General Public License version 2.  This program is licensed
> + * "as is" without any warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/config.h>
> +#include <linux/init.h>
> +#include <asm/ocp.h>
> +#include <platform/4xx/virtex.h>

Should be
#include <platforms/4xx/virtex.h>

Otherwise tested OK on ML300

^ permalink raw reply

* Re: [PATCH 01/10] Move xparameters.h into xilinx virtex device specific path
From: Andrei Konovalov @ 2006-01-12 17:26 UTC (permalink / raw)
  To: grant.likely; +Cc: glikely, dhlii, gnathita, linuxppc-embedded
In-Reply-To: <1136795579724-git-send-email-grant.likely@secretlab.ca>

grant.likely@secretlab.ca wrote:
> xparameters should not be needed by anything but virtex platform code.
> Move it from include/asm-ppc/ to platforms/4xx/xparameters/
> 
> This is preparing for work to remove xparameters from the dependancy tree
> for most c files.  xparam changes should not cause a recompile of the world.
> Instead, drivers should get device info from the platform bus (populated
> by the boot code)
> 
> Signed-off-by: Grant C. Likely <grant.likely@secretlab.ca>


Tested on ML300: OK

^ permalink raw reply

* Re: [PATCH] powerpc oprofile G4 clashes with wacom driver
From: Andy Whitcroft @ 2006-01-12 15:52 UTC (permalink / raw)
  To: Kumar Gala; +Cc: akpm, linuxppc-dev
In-Reply-To: <65FBDB60-D4A5-40DF-BA73-AB6388A9368B@kernel.crashing.org>

Kumar Gala wrote:

> How about a different prefix than POT_.  POT_ doesn't make me think  of
> PPC oprofile at all.  How about PPC_OPROFILE_ or POWERPC_OPROFILE_

Paul?  I am ambivalent about the prefix, and it can be trivially changed
to any that you feel approriate.

-apw

^ permalink raw reply

* Re: [PATCH] powerpc: generalize PPC44x_PIN_SIZE
From: Matt Porter @ 2006-01-12 15:31 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-ppc-embedded
In-Reply-To: <20051229204040.GA9751@dmt.cnet>

On Thu, Dec 29, 2005 at 06:40:40PM -0200, Marcelo Tosatti wrote:
> 
> Hi, 
> 
> The following patch generalizes PPC44x_PIN_SIZE by changing it to
> PPC_PIN_SIZE, which can be defined by any board to automatically adjust
> VMALLOC_START, avoiding conflicts with pinned virtual space.
> 
> Also define it for 8xx.
> 
> Matt, please review.

ACK, looks good to me.

-Matt

^ permalink raw reply

* Re: [PATCH] powerpc oprofile G4 clashes with wacom driver
From: Kumar Gala @ 2006-01-12 15:16 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: akpm, linuxppc-dev
In-Reply-To: <20060112144437.GA15923@shadowen.org>

On Jan 12, 2006, at 8:44 AM, Andy Whitcroft wrote:

> powerpc: oprofile G4 clashes with wacom driver
>
> In 2.6.15-git6 a change was commited in the oprofile support in
> the powerpc architecture.  It introduced the powerpc_oprofile_type
> which contains the define G4.  This causes a name clash with the
> existing wacom usb tablet driver.
>
>       CC [M]  drivers/usb/input/wacom.o
>     drivers/usb/input/wacom.c:98: error: conflicting types for `G4'
>     include/asm/cputable.h:37: error: previous declaration of `G4'
>       CC [M]  drivers/usb/mon/mon_text.o
>     make[3]: *** [drivers/usb/input/wacom.o] Error 1
>     make[2]: *** [drivers/usb/input] Error 2
>
> The elements of an enum declared in global scope are effectivly
> global identifiers themselves.  As such we need to ensure the names
> are unique.  This patch updates the later oprofile support to use
> unique names.
>
> Signed-off-by: Andy Whitcroft <apw@shadowen.org>

How about a different prefix than POT_.  POT_ doesn't make me think  
of PPC oprofile at all.  How about PPC_OPROFILE_ or POWERPC_OPROFILE_

- kumar

> ---
>  arch/powerpc/kernel/cputable.c |   52 +++++++++++++++++++ 
> +---------------------
>  arch/powerpc/oprofile/common.c |    8 +++---
>  include/asm-powerpc/cputable.h |   10 +++----
>  3 files changed, 35 insertions(+), 35 deletions(-)
> diff -upN reference/arch/powerpc/kernel/cputable.c current/arch/ 
> powerpc/kernel/cputable.c
> --- reference/arch/powerpc/kernel/cputable.c
> +++ current/arch/powerpc/kernel/cputable.c
> @@ -79,7 +79,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power3,
>  		.oprofile_cpu_type	= "ppc64/power3",
> -		.oprofile_type		= RS64,
> +		.oprofile_type		= POT_RS64,
>  	},
>  	{	/* Power3+ */
>  		.pvr_mask		= 0xffff0000,
> @@ -92,7 +92,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power3,
>  		.oprofile_cpu_type	= "ppc64/power3",
> -		.oprofile_type		= RS64,
> +		.oprofile_type		= POT_RS64,
>  	},
>  	{	/* Northstar */
>  		.pvr_mask		= 0xffff0000,
> @@ -105,7 +105,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power3,
>  		.oprofile_cpu_type	= "ppc64/rs64",
> -		.oprofile_type		= RS64,
> +		.oprofile_type		= POT_RS64,
>  	},
>  	{	/* Pulsar */
>  		.pvr_mask		= 0xffff0000,
> @@ -118,7 +118,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power3,
>  		.oprofile_cpu_type	= "ppc64/rs64",
> -		.oprofile_type		= RS64,
> +		.oprofile_type		= POT_RS64,
>  	},
>  	{	/* I-star */
>  		.pvr_mask		= 0xffff0000,
> @@ -131,7 +131,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power3,
>  		.oprofile_cpu_type	= "ppc64/rs64",
> -		.oprofile_type		= RS64,
> +		.oprofile_type		= POT_RS64,
>  	},
>  	{	/* S-star */
>  		.pvr_mask		= 0xffff0000,
> @@ -144,7 +144,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power3,
>  		.oprofile_cpu_type	= "ppc64/rs64",
> -		.oprofile_type		= RS64,
> +		.oprofile_type		= POT_RS64,
>  	},
>  	{	/* Power4 */
>  		.pvr_mask		= 0xffff0000,
> @@ -157,7 +157,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power4,
>  		.oprofile_cpu_type	= "ppc64/power4",
> -		.oprofile_type		= POWER4,
> +		.oprofile_type		= POT_POWER4,
>  	},
>  	{	/* Power4+ */
>  		.pvr_mask		= 0xffff0000,
> @@ -170,7 +170,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_power4,
>  		.oprofile_cpu_type	= "ppc64/power4",
> -		.oprofile_type		= POWER4,
> +		.oprofile_type		= POT_POWER4,
>  	},
>  	{	/* PPC970 */
>  		.pvr_mask		= 0xffff0000,
> @@ -184,7 +184,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_ppc970,
>  		.oprofile_cpu_type	= "ppc64/970",
> -		.oprofile_type		= POWER4,
> +		.oprofile_type		= POT_POWER4,
>  	},
>  #endif /* CONFIG_PPC64 */
>  #if defined(CONFIG_PPC64) || defined(CONFIG_POWER4)
> @@ -204,7 +204,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 8,
>  		.cpu_setup		= __setup_cpu_ppc970,
>  		.oprofile_cpu_type	= "ppc64/970",
> -		.oprofile_type		= POWER4,
> +		.oprofile_type		= POT_POWER4,
>  	},
>  #endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */
>  #ifdef CONFIG_PPC64
> @@ -219,7 +219,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.dcache_bsize		= 128,
>  		.cpu_setup		= __setup_cpu_ppc970,
>  		.oprofile_cpu_type	= "ppc64/970",
> -		.oprofile_type		= POWER4,
> +		.oprofile_type		= POT_POWER4,
>  	},
>  	{	/* Power5 GR */
>  		.pvr_mask		= 0xffff0000,
> @@ -232,7 +232,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_power4,
>  		.oprofile_cpu_type	= "ppc64/power5",
> -		.oprofile_type		= POWER4,
> +		.oprofile_type		= POT_POWER4,
>  	},
>  	{	/* Power5 GS */
>  		.pvr_mask		= 0xffff0000,
> @@ -245,7 +245,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_power4,
>  		.oprofile_cpu_type	= "ppc64/power5+",
> -		.oprofile_type		= POWER4,
> +		.oprofile_type		= POT_POWER4,
>  	},
>  	{	/* Cell Broadband Engine */
>  		.pvr_mask		= 0xffff0000,
> @@ -521,7 +521,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7450 2.1 */
>  		.pvr_mask		= 0xffffffff,
> @@ -534,7 +534,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7450 2.3 and newer */
>  		.pvr_mask		= 0xffff0000,
> @@ -547,7 +547,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7455 rev 1.x */
>  		.pvr_mask		= 0xffffff00,
> @@ -560,7 +560,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7455 rev 2.0 */
>  		.pvr_mask		= 0xffffffff,
> @@ -573,7 +573,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7455 others */
>  		.pvr_mask		= 0xffff0000,
> @@ -586,7 +586,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7447/7457 Rev 1.0 */
>  		.pvr_mask		= 0xffffffff,
> @@ -599,7 +599,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7447/7457 Rev 1.1 */
>  		.pvr_mask		= 0xffffffff,
> @@ -612,7 +612,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7447/7457 Rev 1.2 and later */
>  		.pvr_mask		= 0xffff0000,
> @@ -625,7 +625,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7447A */
>  		.pvr_mask		= 0xffff0000,
> @@ -638,7 +638,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 7448 */
>  		.pvr_mask		= 0xffff0000,
> @@ -651,7 +651,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.num_pmcs		= 6,
>  		.cpu_setup		= __setup_cpu_745x,
>  		.oprofile_cpu_type      = "ppc/7450",
> -		.oprofile_type		= G4,
> +		.oprofile_type		= POT_G4,
>  	},
>  	{	/* 82xx (8240, 8245, 8260 are all 603e cores) */
>  		.pvr_mask		= 0x7fff0000,
> @@ -976,7 +976,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.dcache_bsize		= 32,
>  		.num_pmcs		= 4,
>  		.oprofile_cpu_type	= "ppc/e500",
> -		.oprofile_type		= BOOKE,
> +		.oprofile_type		= POT_BOOKE,
>  	},
>  	{	/* e500v2 */
>  		.pvr_mask		= 0xffff0000,
> @@ -991,7 +991,7 @@ struct cpu_spec	cpu_specs[] = {
>  		.dcache_bsize		= 32,
>  		.num_pmcs		= 4,
>  		.oprofile_cpu_type	= "ppc/e500",
> -		.oprofile_type		= BOOKE,
> +		.oprofile_type		= POT_BOOKE,
>  	},
>  #endif
>  #if !CLASSIC_PPC
> diff -upN reference/arch/powerpc/oprofile/common.c current/arch/ 
> powerpc/oprofile/common.c
> --- reference/arch/powerpc/oprofile/common.c
> +++ current/arch/powerpc/oprofile/common.c
> @@ -140,19 +140,19 @@ int __init oprofile_arch_init(struct opr
>
>  	switch (cur_cpu_spec->oprofile_type) {
>  #ifdef CONFIG_PPC64
> -		case RS64:
> +		case POT_RS64:
>  			model = &op_model_rs64;
>  			break;
> -		case POWER4:
> +		case POT_POWER4:
>  			model = &op_model_power4;
>  			break;
>  #else
> -		case G4:
> +		case POT_G4:
>  			model = &op_model_7450;
>  			break;
>  #endif
>  #ifdef CONFIG_FSL_BOOKE
> -		case BOOKE:
> +		case POT_BOOKE:
>  			model = &op_model_fsl_booke;
>  			break;
>  #endif
> diff -upN reference/include/asm-powerpc/cputable.h current/include/ 
> asm-powerpc/cputable.h
> --- reference/include/asm-powerpc/cputable.h
> +++ current/include/asm-powerpc/cputable.h
> @@ -31,11 +31,11 @@ struct cpu_spec;
>  typedef	void (*cpu_setup_t)(unsigned long offset, struct cpu_spec*  
> spec);
>
>  enum powerpc_oprofile_type {
> -	INVALID = 0,
> -	RS64 = 1,
> -	POWER4 = 2,
> -	G4 = 3,
> -	BOOKE = 4,
> +	POT_INVALID = 0,
> +	POT_RS64 = 1,
> +	POT_POWER4 = 2,
> +	POT_G4 = 3,
> +	POT_BOOKE = 4,
>  };
>
>  struct cpu_spec {
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* [PATCH] powerpc oprofile G4 clashes with wacom driver
From: Andy Whitcroft @ 2006-01-12 14:44 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: akpm, linuxppc-dev

powerpc: oprofile G4 clashes with wacom driver

In 2.6.15-git6 a change was commited in the oprofile support in
the powerpc architecture.  It introduced the powerpc_oprofile_type
which contains the define G4.  This causes a name clash with the
existing wacom usb tablet driver.

      CC [M]  drivers/usb/input/wacom.o
    drivers/usb/input/wacom.c:98: error: conflicting types for `G4'
    include/asm/cputable.h:37: error: previous declaration of `G4'
      CC [M]  drivers/usb/mon/mon_text.o
    make[3]: *** [drivers/usb/input/wacom.o] Error 1
    make[2]: *** [drivers/usb/input] Error 2

The elements of an enum declared in global scope are effectivly
global identifiers themselves.  As such we need to ensure the names
are unique.  This patch updates the later oprofile support to use
unique names.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
 arch/powerpc/kernel/cputable.c |   52 ++++++++++++++++++++---------------------
 arch/powerpc/oprofile/common.c |    8 +++---
 include/asm-powerpc/cputable.h |   10 +++----
 3 files changed, 35 insertions(+), 35 deletions(-)
diff -upN reference/arch/powerpc/kernel/cputable.c current/arch/powerpc/kernel/cputable.c
--- reference/arch/powerpc/kernel/cputable.c
+++ current/arch/powerpc/kernel/cputable.c
@@ -79,7 +79,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power3,
 		.oprofile_cpu_type	= "ppc64/power3",
-		.oprofile_type		= RS64,
+		.oprofile_type		= POT_RS64,
 	},
 	{	/* Power3+ */
 		.pvr_mask		= 0xffff0000,
@@ -92,7 +92,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power3,
 		.oprofile_cpu_type	= "ppc64/power3",
-		.oprofile_type		= RS64,
+		.oprofile_type		= POT_RS64,
 	},
 	{	/* Northstar */
 		.pvr_mask		= 0xffff0000,
@@ -105,7 +105,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power3,
 		.oprofile_cpu_type	= "ppc64/rs64",
-		.oprofile_type		= RS64,
+		.oprofile_type		= POT_RS64,
 	},
 	{	/* Pulsar */
 		.pvr_mask		= 0xffff0000,
@@ -118,7 +118,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power3,
 		.oprofile_cpu_type	= "ppc64/rs64",
-		.oprofile_type		= RS64,
+		.oprofile_type		= POT_RS64,
 	},
 	{	/* I-star */
 		.pvr_mask		= 0xffff0000,
@@ -131,7 +131,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power3,
 		.oprofile_cpu_type	= "ppc64/rs64",
-		.oprofile_type		= RS64,
+		.oprofile_type		= POT_RS64,
 	},
 	{	/* S-star */
 		.pvr_mask		= 0xffff0000,
@@ -144,7 +144,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power3,
 		.oprofile_cpu_type	= "ppc64/rs64",
-		.oprofile_type		= RS64,
+		.oprofile_type		= POT_RS64,
 	},
 	{	/* Power4 */
 		.pvr_mask		= 0xffff0000,
@@ -157,7 +157,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power4,
 		.oprofile_cpu_type	= "ppc64/power4",
-		.oprofile_type		= POWER4,
+		.oprofile_type		= POT_POWER4,
 	},
 	{	/* Power4+ */
 		.pvr_mask		= 0xffff0000,
@@ -170,7 +170,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_power4,
 		.oprofile_cpu_type	= "ppc64/power4",
-		.oprofile_type		= POWER4,
+		.oprofile_type		= POT_POWER4,
 	},
 	{	/* PPC970 */
 		.pvr_mask		= 0xffff0000,
@@ -184,7 +184,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
-		.oprofile_type		= POWER4,
+		.oprofile_type		= POT_POWER4,
 	},
 #endif /* CONFIG_PPC64 */
 #if defined(CONFIG_PPC64) || defined(CONFIG_POWER4)
@@ -204,7 +204,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
-		.oprofile_type		= POWER4,
+		.oprofile_type		= POT_POWER4,
 	},
 #endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */
 #ifdef CONFIG_PPC64
@@ -219,7 +219,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.cpu_setup		= __setup_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
-		.oprofile_type		= POWER4,
+		.oprofile_type		= POT_POWER4,
 	},
 	{	/* Power5 GR */
 		.pvr_mask		= 0xffff0000,
@@ -232,7 +232,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_power4,
 		.oprofile_cpu_type	= "ppc64/power5",
-		.oprofile_type		= POWER4,
+		.oprofile_type		= POT_POWER4,
 	},
 	{	/* Power5 GS */
 		.pvr_mask		= 0xffff0000,
@@ -245,7 +245,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_power4,
 		.oprofile_cpu_type	= "ppc64/power5+",
-		.oprofile_type		= POWER4,
+		.oprofile_type		= POT_POWER4,
 	},
 	{	/* Cell Broadband Engine */
 		.pvr_mask		= 0xffff0000,
@@ -521,7 +521,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7450 2.1 */
 		.pvr_mask		= 0xffffffff,
@@ -534,7 +534,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7450 2.3 and newer */
 		.pvr_mask		= 0xffff0000,
@@ -547,7 +547,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7455 rev 1.x */
 		.pvr_mask		= 0xffffff00,
@@ -560,7 +560,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7455 rev 2.0 */
 		.pvr_mask		= 0xffffffff,
@@ -573,7 +573,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7455 others */
 		.pvr_mask		= 0xffff0000,
@@ -586,7 +586,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7447/7457 Rev 1.0 */
 		.pvr_mask		= 0xffffffff,
@@ -599,7 +599,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7447/7457 Rev 1.1 */
 		.pvr_mask		= 0xffffffff,
@@ -612,7 +612,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7447/7457 Rev 1.2 and later */
 		.pvr_mask		= 0xffff0000,
@@ -625,7 +625,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7447A */
 		.pvr_mask		= 0xffff0000,
@@ -638,7 +638,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 7448 */
 		.pvr_mask		= 0xffff0000,
@@ -651,7 +651,7 @@ struct cpu_spec	cpu_specs[] = {
 		.num_pmcs		= 6,
 		.cpu_setup		= __setup_cpu_745x,
 		.oprofile_cpu_type      = "ppc/7450",
-		.oprofile_type		= G4,
+		.oprofile_type		= POT_G4,
 	},
 	{	/* 82xx (8240, 8245, 8260 are all 603e cores) */
 		.pvr_mask		= 0x7fff0000,
@@ -976,7 +976,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
 		.oprofile_cpu_type	= "ppc/e500",
-		.oprofile_type		= BOOKE,
+		.oprofile_type		= POT_BOOKE,
 	},
 	{	/* e500v2 */
 		.pvr_mask		= 0xffff0000,
@@ -991,7 +991,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
 		.oprofile_cpu_type	= "ppc/e500",
-		.oprofile_type		= BOOKE,
+		.oprofile_type		= POT_BOOKE,
 	},
 #endif
 #if !CLASSIC_PPC
diff -upN reference/arch/powerpc/oprofile/common.c current/arch/powerpc/oprofile/common.c
--- reference/arch/powerpc/oprofile/common.c
+++ current/arch/powerpc/oprofile/common.c
@@ -140,19 +140,19 @@ int __init oprofile_arch_init(struct opr
 
 	switch (cur_cpu_spec->oprofile_type) {
 #ifdef CONFIG_PPC64
-		case RS64:
+		case POT_RS64:
 			model = &op_model_rs64;
 			break;
-		case POWER4:
+		case POT_POWER4:
 			model = &op_model_power4;
 			break;
 #else
-		case G4:
+		case POT_G4:
 			model = &op_model_7450;
 			break;
 #endif
 #ifdef CONFIG_FSL_BOOKE
-		case BOOKE:
+		case POT_BOOKE:
 			model = &op_model_fsl_booke;
 			break;
 #endif
diff -upN reference/include/asm-powerpc/cputable.h current/include/asm-powerpc/cputable.h
--- reference/include/asm-powerpc/cputable.h
+++ current/include/asm-powerpc/cputable.h
@@ -31,11 +31,11 @@ struct cpu_spec;
 typedef	void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
 
 enum powerpc_oprofile_type {
-	INVALID = 0,
-	RS64 = 1,
-	POWER4 = 2,
-	G4 = 3,
-	BOOKE = 4,
+	POT_INVALID = 0,
+	POT_RS64 = 1,
+	POT_POWER4 = 2,
+	POT_G4 = 3,
+	POT_BOOKE = 4,
 };
 
 struct cpu_spec {

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox