LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [kernel-2.6.15] Fix PCI irq mapping for lite5200
From: Andrey Volkov @ 2006-01-12  8:34 UTC (permalink / raw)
  To: Sylvain Munaut; +Cc: LKML, ML linuxppc-embedded

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

Hi Sylvain,

This patch fix problem of PCI boards irq mapping on lite5200
(raised after your changes of MPC52xx_IRQ0 number)

--
Regards
Andrey Volkov

[-- Attachment #2: 01-lite5200_map_irq-fix.diff --]
[-- Type: text/plain, Size: 678 bytes --]

	lite5200_map_irq: Fix irq mapping for external PCI boards

Signed-off-by: Andrey Volkov <avolkov@varma-el.com>
---

 arch/ppc/platforms/lite5200.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
index 7ed52dc..cd4acb3 100644
--- a/arch/ppc/platforms/lite5200.c
+++ b/arch/ppc/platforms/lite5200.c
@@ -73,7 +73,8 @@ lite5200_show_cpuinfo(struct seq_file *m
 static int
 lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
 {
-	return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
+	/* Only INTA supported */
+	return (pin == 1) ? MPC52xx_IRQ0 : -1;
 }
 #endif
 

^ permalink raw reply related

* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Vojtech Pavlik @ 2006-01-12  9:07 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: dtor_core, linux-kernel, linux-kernel, linuxppc-dev, linux-input
In-Reply-To: <1137022900.5138.66.camel@localhost.localdomain>

On Thu, Jan 12, 2006 at 10:41:40AM +1100, Benjamin Herrenschmidt wrote:
> On Thu, 2006-01-12 at 00:26 +0100, Michael Hanselmann wrote:
> 
> >   * This is the global environment of the parser. This information is
> > @@ -431,6 +433,14 @@ 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
> > +	/* We do this here because it's only relevant for the
> > +	 * USB devices, not for all input_dev's.
> > +	 */
> > +	unsigned long pb_fn[NBITS(KEY_MAX)];
> > +	unsigned long pb_numlock[NBITS(KEY_MAX)];
> > +#endif
> >  };
> 
> 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.

I think having it in struct hid_device is safer. We might want to
dynamically allocate only for PowerBook keyboards, though, to save
memory.

> 
>   .../...
> 
> >  
> > +	if ((hid->quirks & HID_QUIRK_POWERBOOK_HAS_FN) &&
> > +	    hidinput_pb_event(hid, input, usage, value)) {
> > +		return;
> > +	}
> > +
> 
> Dimitry might disagree but it's generally considered bad taste to have
> { and } for a single statement :)

I do agree, though.


-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply

* Re: Ethernet not initialized: Help req
From: Txema Lopez @ 2006-01-12  9:31 UTC (permalink / raw)
  To: batsayan.das; +Cc: Linuxppc-embedded
In-Reply-To: <20060112073922.05CCA353CCD@atlas.denx.de>

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

Wolfgang Denk wrote:

>In message <OF08F91C71.313412E8-ON652570F4.001BB5F4-652570F4.001CF070@tcs.com> you wrote:
>  
>
>>BTW, is there any tool/test case available to test the ethernet driver for 
>>a long period of time? 
>>    
>>
>
>Mount the root file system over NFS, and compile the Linux kernel  on
>the target. Repeat for as long as you like.
>
>Best regards,
>
>Wolfgang Denk
>
>  
>
We are implementing an ethernet test for the U-Boot in a MPC5200 
architecture, but the test is easyly extensible to other architectures 
because it's based on the U-Boot ethernet driver (I don't know how 
portable is the test for the linux kernel).  To do the test you need to 
build a loopback cable and connect it in the ethernet connector of your 
board. I supply the cable schematic and the test.

Best regards,
Jose Maria Lopez.

[-- Attachment #2: graphic56.gif --]
[-- Type: image/gif, Size: 1873 bytes --]

[-- Attachment #3: ether.c --]
[-- Type: text/x-csrc, Size: 3468 bytes --]

/*
 * (C) Copyright 2002
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#include <common.h>

/*
 * Ethernet test
 *
 * The Serial Communication Controllers (SCC) listed in ctlr_list array below
 * are tested in the loopback ethernet mode.
 * The controllers are configured accordingly and several packets
 * are transmitted. The configurable test parameters are:
 *   MIN_PACKET_LENGTH - minimum size of packet to transmit
 *   MAX_PACKET_LENGTH - maximum size of packet to transmit
 *   TEST_NUM - number of tests
 */

#ifdef CONFIG_POST

#include <post.h>
#include <mpc5xxx.h>
#include <net.h>


#if CONFIG_POST & CFG_POST_ETHER

#define MIN_PACKET_LENGTH	64
#define MAX_PACKET_LENGTH	1500
#define TEST_NUM		5

#define VERBOSE		1
  /*
   * Test routines
   */

   
static void packet_set_address(char * packet, char *enetaddr)
{
	char *tmp, *end;
	int i;
	
	tmp = enetaddr;
	
	if (tmp) {
		for (i = 0; i < 6; i++) {
			packet[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
			if (tmp)
				tmp = (*end) ? end+1 : end;
		}
	}
	else
	{
		for (i = 0; i < 6; i++)
		{
			packet[i] = 0xFF;
		}	
	}	
}
   
static void packet_fill (char *packet, int length)
{
	char c = (char) length;
	int i;


	for (i = 6; i < length; i++) {
		packet[i] = c++;
	}
}

static int packet_check (char *packet, int length)
{
	char c = (char) length;
	int i;

	for (i = 6; i < length; i++) {
		if (packet[i] != c++)
			return -1;
	}

	return 0;
}

int ether_post_test(void)
{
        DECLARE_GLOBAL_DATA_PTR;
	int res = 0;
	char packet_send[MAX_PACKET_LENGTH];
	char packet_recv[MAX_PACKET_LENGTH];
	int i,l,length;
	int timeout;
	struct eth_device *dev= eth_get_dev();
		
	dev->init(dev, gd->bd);
	
	packet_set_address(packet_send, getenv("ethaddr"));
			
	for ( i = 0; i < TEST_NUM; i++) {
#ifdef VERBOSE			
		printf("\n\tDoing ethernet test(%d) ",i);
#endif			
		for (l = MIN_PACKET_LENGTH; l <= MAX_PACKET_LENGTH; l++) {
			packet_fill (packet_send, l);
#ifdef VERBOSE			
			if(((l+1)&0x3f) == 0)
				printf(".");
#endif			
			if (dev->send(dev, packet_send, l) != 0) {
				post_log("Error sending packet.\n",l);
				res = 1;
				break;
			}	
			timeout = 5000;
			do {
				udelay(1000);
				length = dev->recv_packet(dev, packet_recv);
				if(timeout-- == 0) {
					post_log("Timeout receiving packet.\n");
					res = 1;
					break;
				}	
			}while(length == 0);
			if((length != l) || (packet_check (packet_recv, length) < 0)){
				post_log("Packet rejected: (%d) bytes transmitted (%d) bytes received.\n",l,length);
				res = 1;
				break;
			}	
			if(res)
				break;
		}
	}
	
	dev->halt(dev);
	return res;
}

#endif /* CONFIG_POST & CFG_POST_ETHER */

#endif /* CONFIG_POST */

[-- Attachment #4: fec.c --]
[-- Type: text/x-csrc, Size: 27088 bytes --]

/*
 * (C) Copyright 2003-2005
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * This file is based on mpc4200fec.c,
 * (C) Copyright Motorola, Inc., 2000
 */

#include <common.h>
#include <mpc5xxx.h>
#include <malloc.h>
#include <net.h>
#include <miiphy.h>
#include "sdma.h"
#include "fec.h"
#include <post.h>

/* #define DEBUG	0x28 */

#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
	defined(CONFIG_MPC5xxx_FEC)

#if !(defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII))
#error "CONFIG_MII has to be defined!"
#endif

#if (DEBUG & 0x60)
static void tfifo_print(char *devname, mpc5xxx_fec_priv *fec);
static void rfifo_print(char *devname, mpc5xxx_fec_priv *fec);
#endif /* DEBUG */

#if (DEBUG & 0x40)
static uint32 local_crc32(char *string, unsigned int crc_value, int len);
#endif

typedef struct {
    uint8 data[1500];           /* actual data */
    int length;                 /* actual length */
    int used;                   /* buffer in use or not */
    uint8 head[16];             /* MAC header(6 + 6 + 2) + 2(aligned) */
} NBUF;

int fec5xxx_miiphy_read(char *devname, uint8 phyAddr, uint8 regAddr, uint16 * retVal);
int fec5xxx_miiphy_write(char *devname, uint8 phyAddr, uint8 regAddr, uint16 data);

/********************************************************************/
#if (DEBUG & 0x2)
static void mpc5xxx_fec_phydump (char *devname)
{
	uint16 phyStatus, i;
	uint8 phyAddr = CONFIG_PHY_ADDR;
	uint8 reg_mask[] = {
#if CONFIG_PHY_TYPE == 0x79c874	/* AMD Am79C874 */
		/* regs to print: 0...7, 16...19, 21, 23, 24 */
		1, 1, 1, 1,  1, 1, 1, 1,     0, 0, 0, 0,  0, 0, 0, 0,
		1, 1, 1, 1,  0, 1, 0, 1,     1, 0, 0, 0,  0, 0, 0, 0,
#else
		/* regs to print: 0...8, 16...20 */
		1, 1, 1, 1,  1, 1, 1, 1,     1, 0, 0, 0,  0, 0, 0, 0,
		1, 1, 1, 1,  1, 0, 0, 0,     0, 0, 0, 0,  0, 0, 0, 0,
#endif
	};

	for (i = 0; i < 32; i++) {
		if (reg_mask[i]) {
			miiphy_read(devname, phyAddr, i, &phyStatus);
			printf("Mii reg %d: 0x%04x\n", i, phyStatus);
		}
	}
}
#endif

/********************************************************************/
static int mpc5xxx_fec_rbd_init(mpc5xxx_fec_priv *fec)
{
	int ix;
	char *data;
	static int once = 0;

	for (ix = 0; ix < FEC_RBD_NUM; ix++) {
		if (!once) {
			data = (char *)malloc(FEC_MAX_PKT_SIZE);
			if (data == NULL) {
				printf ("RBD INIT FAILED\n");
				return -1;
			}
			fec->rbdBase[ix].dataPointer = (uint32)data;
		}
		fec->rbdBase[ix].status = FEC_RBD_EMPTY;
		fec->rbdBase[ix].dataLength = 0;
	}
	once ++;

	/*
	 * have the last RBD to close the ring
	 */
	fec->rbdBase[ix - 1].status |= FEC_RBD_WRAP;
	fec->rbdIndex = 0;

	return 0;
}

/********************************************************************/
static void mpc5xxx_fec_tbd_init(mpc5xxx_fec_priv *fec)
{
	int ix;

	for (ix = 0; ix < FEC_TBD_NUM; ix++) {
		fec->tbdBase[ix].status = 0;
	}

	/*
	 * Have the last TBD to close the ring
	 */
	fec->tbdBase[ix - 1].status |= FEC_TBD_WRAP;

	/*
	 * Initialize some indices
	 */
	fec->tbdIndex = 0;
	fec->usedTbdIndex = 0;
	fec->cleanTbdNum = FEC_TBD_NUM;
}

/********************************************************************/
static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, volatile FEC_RBD * pRbd)
{
	/*
	 * Reset buffer descriptor as empty
	 */
	if ((fec->rbdIndex) == (FEC_RBD_NUM - 1))
		pRbd->status = (FEC_RBD_WRAP | FEC_RBD_EMPTY);
	else
		pRbd->status = FEC_RBD_EMPTY;

	pRbd->dataLength = 0;

	/*
	 * Now, we have an empty RxBD, restart the SmartDMA receive task
	 */
	SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);

	/*
	 * Increment BD count
	 */
	fec->rbdIndex = (fec->rbdIndex + 1) % FEC_RBD_NUM;
}

/********************************************************************/
static void mpc5xxx_fec_tbd_scrub(mpc5xxx_fec_priv *fec)
{
	volatile FEC_TBD *pUsedTbd;

#if (DEBUG & 0x1)
	printf ("tbd_scrub: fec->cleanTbdNum = %d, fec->usedTbdIndex = %d\n",
		fec->cleanTbdNum, fec->usedTbdIndex);
#endif

	/*
	 * process all the consumed TBDs
	 */
	while (fec->cleanTbdNum < FEC_TBD_NUM) {
		pUsedTbd = &fec->tbdBase[fec->usedTbdIndex];
		if (pUsedTbd->status & FEC_TBD_READY) {
#if (DEBUG & 0x20)
			printf("Cannot clean TBD %d, in use\n", fec->cleanTbdNum);
#endif
			return;
		}

		/*
		 * clean this buffer descriptor
		 */
		if (fec->usedTbdIndex == (FEC_TBD_NUM - 1))
			pUsedTbd->status = FEC_TBD_WRAP;
		else
			pUsedTbd->status = 0;

		/*
		 * update some indeces for a correct handling of the TBD ring
		 */
		fec->cleanTbdNum++;
		fec->usedTbdIndex = (fec->usedTbdIndex + 1) % FEC_TBD_NUM;
	}
}

/********************************************************************/
static void mpc5xxx_fec_set_hwaddr(mpc5xxx_fec_priv *fec, char *mac)
{
	uint8 currByte;			/* byte for which to compute the CRC */
	int byte;			/* loop - counter */
	int bit;			/* loop - counter */
	uint32 crc = 0xffffffff;	/* initial value */

	/*
	 * The algorithm used is the following:
	 * we loop on each of the six bytes of the provided address,
	 * and we compute the CRC by left-shifting the previous
	 * value by one position, so that each bit in the current
	 * byte of the address may contribute the calculation. If
	 * the latter and the MSB in the CRC are different, then
	 * the CRC value so computed is also ex-ored with the
	 * "polynomium generator". The current byte of the address
	 * is also shifted right by one bit at each iteration.
	 * This is because the CRC generatore in hardware is implemented
	 * as a shift-register with as many ex-ores as the radixes
	 * in the polynomium. This suggests that we represent the
	 * polynomiumm itself as a 32-bit constant.
	 */
	for (byte = 0; byte < 6; byte++) {
		currByte = mac[byte];
		for (bit = 0; bit < 8; bit++) {
			if ((currByte & 0x01) ^ (crc & 0x01)) {
				crc >>= 1;
				crc = crc ^ 0xedb88320;
			} else {
				crc >>= 1;
			}
			currByte >>= 1;
		}
	}

	crc = crc >> 26;

	/*
	 * Set individual hash table register
	 */
	if (crc >= 32) {
		fec->eth->iaddr1 = (1 << (crc - 32));
		fec->eth->iaddr2 = 0;
	} else {
		fec->eth->iaddr1 = 0;
		fec->eth->iaddr2 = (1 << crc);
	}

	/*
	 * Set physical address
	 */
	fec->eth->paddr1 = (mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3];
	fec->eth->paddr2 = (mac[4] << 24) + (mac[5] << 16) + 0x8808;
}

/********************************************************************/
static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
{
	DECLARE_GLOBAL_DATA_PTR;
	mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
	struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;

#if (DEBUG & 0x1)
	printf ("mpc5xxx_fec_init... Begin\n");
#endif

	/*
	 * Initialize RxBD/TxBD rings
	 */
	mpc5xxx_fec_rbd_init(fec);
	mpc5xxx_fec_tbd_init(fec);

	/*
	 * Clear FEC-Lite interrupt event register(IEVENT)
	 */
	fec->eth->ievent = 0xffffffff;

	/*
	 * Set interrupt mask register
	 */
	fec->eth->imask = 0x00000000;

	/*
	 * Set FEC-Lite receive control register(R_CNTRL):
	 */
	if (fec->xcv_type == SEVENWIRE) {
		/*
		 * Frame length=1518; 7-wire mode
		 */
		fec->eth->r_cntrl = 0x05ee0020;	/*0x05ee0000;FIXME */
	} else {
		/*
		 * Frame length=1518; MII mode;
		 */
		fec->eth->r_cntrl = 0x05ee0024;	/*0x05ee0004;FIXME */
	}

	fec->eth->x_cntrl = 0x00000000;	/* half-duplex, heartbeat disabled */
	if (fec->xcv_type != SEVENWIRE) {
		/*
		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
		 * and do not drop the Preamble.
		 */
		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1);	/* No MII for 7-wire mode */
	}

	/*
	 * Set Opcode/Pause Duration Register
	 */
	fec->eth->op_pause = 0x00010020;	/*FIXME0xffff0020; */

	/*
	 * Set Rx FIFO alarm and granularity value
	 */
	fec->eth->rfifo_cntrl = 0x0c000000
				| (fec->eth->rfifo_cntrl & ~0x0f000000);
	fec->eth->rfifo_alarm = 0x0000030c;
#if (DEBUG & 0x22)
	if (fec->eth->rfifo_status & 0x00700000 ) {
		printf("mpc5xxx_fec_init() RFIFO error\n");
	}
#endif

	/*
	 * Set Tx FIFO granularity value
	 */
	fec->eth->tfifo_cntrl = 0x0c000000
				| (fec->eth->tfifo_cntrl & ~0x0f000000);
#if (DEBUG & 0x2)
	printf("tfifo_status: 0x%08x\n", fec->eth->tfifo_status);
	printf("tfifo_alarm: 0x%08x\n", fec->eth->tfifo_alarm);
#endif

	/*
	 * Set transmit fifo watermark register(X_WMRK), default = 64
	 */
	fec->eth->tfifo_alarm = 0x00000080;
	fec->eth->x_wmrk = 0x2;

	/*
	 * Set individual address filter for unicast address
	 * and set physical address registers.
	 */
	mpc5xxx_fec_set_hwaddr(fec, (char *)dev->enetaddr);

	/*
	 * Set multicast address filter
	 */
	fec->eth->gaddr1 = 0x00000000;
	fec->eth->gaddr2 = 0x00000000;

	/*
	 * Turn ON cheater FSM: ????
	 */
	fec->eth->xmit_fsm = 0x03000000;

#if defined(CONFIG_MPC5200)
	/*
	 * Turn off COMM bus prefetch in the MGT5200 BestComm. It doesn't
	 * work w/ the current receive task.
	 */
	 sdma->PtdCntrl |= 0x00000001;
#endif

	/*
	 * Set priority of different initiators
	 */
	sdma->IPR0 = 7;		/* always */
	sdma->IPR3 = 6;		/* Eth RX */
	sdma->IPR4 = 5;		/* Eth Tx */

	/*
	 * Clear SmartDMA task interrupt pending bits
	 */
	SDMA_CLEAR_IEVENT(FEC_RECV_TASK_NO);

	/*
	 * Initialize SmartDMA parameters stored in SRAM
	 */
	*(volatile int *)FEC_TBD_BASE = (int)fec->tbdBase;
	*(volatile int *)FEC_RBD_BASE = (int)fec->rbdBase;
	*(volatile int *)FEC_TBD_NEXT = (int)fec->tbdBase;
	*(volatile int *)FEC_RBD_NEXT = (int)fec->rbdBase;

	/*
	 * Enable FEC-Lite controller
	 */
	fec->eth->ecntrl |= 0x00000006;

#if (DEBUG & 0x2)
	if (fec->xcv_type != SEVENWIRE)
		mpc5xxx_fec_phydump ();
#endif

	/*
	 * Enable SmartDMA receive task
	 */
	SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);

#if (DEBUG & 0x1)
	printf("mpc5xxx_fec_init... Done \n");
#endif

	return 1;
}

/********************************************************************/
static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
{
	DECLARE_GLOBAL_DATA_PTR;
	mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
	const uint8 phyAddr = CONFIG_PHY_ADDR;	/* Only one PHY */

#if (DEBUG & 0x1)
	printf ("mpc5xxx_fec_init_phy... Begin\n");
#endif

	/*
	 * Initialize GPIO pins
	 */
	if (fec->xcv_type == SEVENWIRE) {
		/*  10MBit with 7-wire operation */
#if defined(CONFIG_TOTAL5200)
		/* 7-wire and USB2 on Ethernet */
		*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00030000;
#else	/* !CONFIG_TOTAL5200 */
		/* 7-wire only */
		*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000;
#endif	/* CONFIG_TOTAL5200 */
	} else {
		/* 100MBit with MD operation */
		*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000;
	}

	/*
	 * Clear FEC-Lite interrupt event register(IEVENT)
	 */
	fec->eth->ievent = 0xffffffff;

	/*
	 * Set interrupt mask register
	 */
	fec->eth->imask = 0x00000000;

	if (fec->xcv_type != SEVENWIRE) {
		/*
		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
		 * and do not drop the Preamble.
		 */
		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1);	/* No MII for 7-wire mode */
	}

	if (fec->xcv_type != SEVENWIRE) {
		/*
		 * Initialize PHY(LXT971A):
		 *
		 *   Generally, on power up, the LXT971A reads its configuration
		 *   pins to check for forced operation, If not cofigured for
		 *   forced operation, it uses auto-negotiation/parallel detection
		 *   to automatically determine line operating conditions.
		 *   If the PHY device on the other side of the link supports
		 *   auto-negotiation, the LXT971A auto-negotiates with it
		 *   using Fast Link Pulse(FLP) Bursts. If the PHY partner does not
		 *   support auto-negotiation, the LXT971A automatically detects
		 *   the presence of either link pulses(10Mbps PHY) or Idle
		 *   symbols(100Mbps) and sets its operating conditions accordingly.
		 *
		 *   When auto-negotiation is controlled by software, the following
		 *   steps are recommended.
		 *
		 * Note:
		 *   The physical address is dependent on hardware configuration.
		 *
		 */
		int timeout = 1;
		uint16 phyStatus;

		/*
		 * Reset PHY, then delay 300ns
		 */
		miiphy_write(dev->name, phyAddr, 0x0, 0x8000);
		udelay(1000);

		if (fec->xcv_type == MII10) {
			/*
			 * Force 10Base-T, FDX operation
			 */
#if (DEBUG & 0x2)
			printf("Forcing 10 Mbps ethernet link... ");
#endif
			miiphy_read(dev->name, phyAddr, 0x1, &phyStatus);
			/*
			miiphy_write(dev->name, fec, phyAddr, 0x0, 0x0100);
			*/
			miiphy_write(dev->name, phyAddr, 0x0, 0x0180);

			timeout = 20;
			do {	/* wait for link status to go down */
				udelay(10000);
				if ((timeout--) == 0) {
#if (DEBUG & 0x2)
					printf("hmmm, should not have waited...");
#endif
					break;
				}
				miiphy_read(dev->name, phyAddr, 0x1, &phyStatus);
#if (DEBUG & 0x2)
				printf("=");
#endif
			} while ((phyStatus & 0x0004));	/* !link up */

			timeout = 1000;
			do {	/* wait for link status to come back up */
				udelay(10000);
				if ((timeout--) == 0) {
					printf("failed. Link is down.\n");
					break;
				}
				miiphy_read(dev->name, phyAddr, 0x1, &phyStatus);
#if (DEBUG & 0x2)
				printf("+");
#endif
			} while (!(phyStatus & 0x0004));	/* !link up */

#if (DEBUG & 0x2)
			printf ("done.\n");
#endif
		} else {	/* MII100 */
			/*
			 * Set the auto-negotiation advertisement register bits
			 */
			miiphy_write(dev->name, phyAddr, 0x4, 0x01e1);

			/*
			 * Set MDIO bit 0.12 = 1(&& bit 0.9=1?) to enable auto-negotiation
			 */
			miiphy_write(dev->name, phyAddr, 0x0, 0x1200);

			/*
			 * Wait for AN completion
			 */
			timeout = 5000;
			do {
				udelay(1000);

				if ((timeout--) == 0) {
#if (DEBUG & 0x2)
					printf("PHY auto neg 0 failed...\n");
#endif
					return -1;
				}

				if (miiphy_read(dev->name, phyAddr, 0x1, &phyStatus) != 0) {
#if (DEBUG & 0x2)
					printf("PHY auto neg 1 failed 0x%04x...\n", phyStatus);
#endif
					return -1;
				}
			} while (!(phyStatus & 0x0004));

#if (DEBUG & 0x2)
			printf("PHY auto neg complete! \n");
#endif
		}

	}

#if (DEBUG & 0x2)
	if (fec->xcv_type != SEVENWIRE)
		mpc5xxx_fec_phydump (dev->name);
#endif


#if (DEBUG & 0x1)
	printf("mpc5xxx_fec_init_phy... Done \n");
#endif

	return 1;
}

/********************************************************************/
static void mpc5xxx_fec_halt(struct eth_device *dev)
{
#if defined(CONFIG_MPC5200)
	struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;
#endif
	mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
	int counter = 0xffff;

#if (DEBUG & 0x2)
	if (fec->xcv_type != SEVENWIRE)
		mpc5xxx_fec_phydump ();
#endif

	/*
	 * mask FEC chip interrupts
	 */
	fec->eth->imask = 0;

	/*
	 * issue graceful stop command to the FEC transmitter if necessary
	 */
	fec->eth->x_cntrl |= 0x00000001;

	/*
	 * wait for graceful stop to register
	 */
	while ((counter--) && (!(fec->eth->ievent & 0x10000000))) ;

	/*
	 * Disable SmartDMA tasks
	 */
	SDMA_TASK_DISABLE (FEC_XMIT_TASK_NO);
	SDMA_TASK_DISABLE (FEC_RECV_TASK_NO);

#if defined(CONFIG_MPC5200)
	/*
	 * Turn on COMM bus prefetch in the MGT5200 BestComm after we're
	 * done. It doesn't work w/ the current receive task.
	 */
	 sdma->PtdCntrl &= ~0x00000001;
#endif

	/*
	 * Disable the Ethernet Controller
	 */
	fec->eth->ecntrl &= 0xfffffffd;

	/*
	 * Clear FIFO status registers
	 */
	fec->eth->rfifo_status &= 0x00700000;
	fec->eth->tfifo_status &= 0x00700000;

	fec->eth->reset_cntrl = 0x01000000;

	/*
	 * Issue a reset command to the FEC chip
	 */
	fec->eth->ecntrl |= 0x1;

	/*
	 * wait at least 16 clock cycles
	 */
	udelay(10);

#if (DEBUG & 0x3)
	printf("Ethernet task stopped\n");
#endif
}

#if (DEBUG & 0x60)
/********************************************************************/

static void tfifo_print(char *devname, mpc5xxx_fec_priv *fec)
{
	uint16 phyAddr = CONFIG_PHY_ADDR;
	uint16 phyStatus;

	if ((fec->eth->tfifo_lrf_ptr != fec->eth->tfifo_lwf_ptr)
		|| (fec->eth->tfifo_rdptr != fec->eth->tfifo_wrptr)) {

		miiphy_read(devname, phyAddr, 0x1, &phyStatus);
		printf("\nphyStatus: 0x%04x\n", phyStatus);
		printf("ecntrl:   0x%08x\n", fec->eth->ecntrl);
		printf("ievent:   0x%08x\n", fec->eth->ievent);
		printf("x_status: 0x%08x\n", fec->eth->x_status);
		printf("tfifo: status  0x%08x\n", fec->eth->tfifo_status);

		printf("       control 0x%08x\n", fec->eth->tfifo_cntrl);
		printf("       lrfp    0x%08x\n", fec->eth->tfifo_lrf_ptr);
		printf("       lwfp    0x%08x\n", fec->eth->tfifo_lwf_ptr);
		printf("       alarm   0x%08x\n", fec->eth->tfifo_alarm);
		printf("       readptr 0x%08x\n", fec->eth->tfifo_rdptr);
		printf("       writptr 0x%08x\n", fec->eth->tfifo_wrptr);
	}
}

static void rfifo_print(char *devname, mpc5xxx_fec_priv *fec)
{
	uint16 phyAddr = CONFIG_PHY_ADDR;
	uint16 phyStatus;

	if ((fec->eth->rfifo_lrf_ptr != fec->eth->rfifo_lwf_ptr)
		|| (fec->eth->rfifo_rdptr != fec->eth->rfifo_wrptr)) {

		miiphy_read(devname, phyAddr, 0x1, &phyStatus);
		printf("\nphyStatus: 0x%04x\n", phyStatus);
		printf("ecntrl:   0x%08x\n", fec->eth->ecntrl);
		printf("ievent:   0x%08x\n", fec->eth->ievent);
		printf("x_status: 0x%08x\n", fec->eth->x_status);
		printf("rfifo: status  0x%08x\n", fec->eth->rfifo_status);

		printf("       control 0x%08x\n", fec->eth->rfifo_cntrl);
		printf("       lrfp    0x%08x\n", fec->eth->rfifo_lrf_ptr);
		printf("       lwfp    0x%08x\n", fec->eth->rfifo_lwf_ptr);
		printf("       alarm   0x%08x\n", fec->eth->rfifo_alarm);
		printf("       readptr 0x%08x\n", fec->eth->rfifo_rdptr);
		printf("       writptr 0x%08x\n", fec->eth->rfifo_wrptr);
	}
}
#endif /* DEBUG */

/********************************************************************/

static int mpc5xxx_fec_send(struct eth_device *dev, volatile void *eth_data,
		int data_length)
{
	/*
	 * This routine transmits one frame.  This routine only accepts
	 * 6-byte Ethernet addresses.
	 */
	mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
	volatile FEC_TBD *pTbd;

#if (DEBUG & 0x20)
	printf("tbd status: 0x%04x\n", fec->tbdBase[0].status);
	tfifo_print(dev->name, fec);
#endif

	/*
	 * Clear Tx BD ring at first
	 */
	mpc5xxx_fec_tbd_scrub(fec);

	/*
	 * Check for valid length of data.
	 */
	if ((data_length > 1500) || (data_length <= 0)) {
		return -1;
	}

	/*
	 * Check the number of vacant TxBDs.
	 */
	if (fec->cleanTbdNum < 1) {
#if (DEBUG & 0x20)
		printf("No available TxBDs ...\n");
#endif
		return -1;
	}

	/*
	 * Get the first TxBD to send the mac header
	 */
	pTbd = &fec->tbdBase[fec->tbdIndex];
	pTbd->dataLength = data_length;
	pTbd->dataPointer = (uint32)eth_data;
	pTbd->status |= FEC_TBD_LAST | FEC_TBD_TC | FEC_TBD_READY;
	fec->tbdIndex = (fec->tbdIndex + 1) % FEC_TBD_NUM;

#if (DEBUG & 0x100)
	printf("SDMA_TASK_ENABLE, fec->tbdIndex = %d \n", fec->tbdIndex);
#endif

	/*
	 * Kick the MII i/f
	 */
	if (fec->xcv_type != SEVENWIRE) {
		uint16 phyStatus;
		miiphy_read(dev->name, 0, 0x1, &phyStatus);
	}

	/*
	 * Enable SmartDMA transmit task
	 */

#if (DEBUG & 0x20)
	tfifo_print(dev->name, fec);
#endif
	SDMA_TASK_ENABLE (FEC_XMIT_TASK_NO);
#if (DEBUG & 0x20)
	tfifo_print(dev->name, fec);
#endif
#if (DEBUG & 0x8)
	printf( "+" );
#endif

	fec->cleanTbdNum -= 1;

#if (DEBUG & 0x129) && (DEBUG & 0x80000000)
	printf ("smartDMA ethernet Tx task enabled\n");
#endif
	/*
	 * wait until frame is sent .
	 */
	while (pTbd->status & FEC_TBD_READY) {
		udelay(10);
#if (DEBUG & 0x8)
		printf ("TDB status = %04x\n", pTbd->status);
#endif
	}

	return 0;
}


/********************************************************************/
static int mpc5xxx_fec_recv(struct eth_device *dev)
{
	/*
	 * This command pulls one frame from the card
	 */
	mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
	volatile FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
	unsigned long ievent;
	int frame_length, len = 0;
	NBUF *frame;
	uchar buff[FEC_MAX_PKT_SIZE];

#if (DEBUG & 0x1)
	printf ("mpc5xxx_fec_recv %d Start...\n", fec->rbdIndex);
#endif
#if (DEBUG & 0x8)
	printf( "-" );
#endif

	/*
	 * Check if any critical events have happened
	 */
	ievent = fec->eth->ievent;
	fec->eth->ievent = ievent;
	if (ievent & 0x20060000) {
		/* BABT, Rx/Tx FIFO errors */
		mpc5xxx_fec_halt(dev);
		mpc5xxx_fec_init(dev, NULL);
		return 0;
	}
	if (ievent & 0x80000000) {
		/* Heartbeat error */
		fec->eth->x_cntrl |= 0x00000001;
	}
	if (ievent & 0x10000000) {
		/* Graceful stop complete */
		if (fec->eth->x_cntrl & 0x00000001) {
			mpc5xxx_fec_halt(dev);
			fec->eth->x_cntrl &= ~0x00000001;
			mpc5xxx_fec_init(dev, NULL);
		}
	}

	if (!(pRbd->status & FEC_RBD_EMPTY)) {
		if ((pRbd->status & FEC_RBD_LAST) && !(pRbd->status & FEC_RBD_ERR) &&
			((pRbd->dataLength - 4) > 14)) {

			/*
			 * Get buffer address and size
			 */
			frame = (NBUF *)pRbd->dataPointer;
			frame_length = pRbd->dataLength - 4;

#if (DEBUG & 0x20)
			{
				int i;
				printf("recv data hdr:");
				for (i = 0; i < 14; i++)
					printf("%x ", *(frame->head + i));
				printf("\n");
			}
#endif
			/*
			 *  Fill the buffer and pass it to upper layers
			 */
			memcpy(buff, frame->head, 14);
			memcpy(buff + 14, frame->data, frame_length);
			NetReceive(buff, frame_length);
			len = frame_length;
		}
		/*
		 * Reset buffer descriptor as empty
		 */
		mpc5xxx_fec_rbd_clean(fec, pRbd);
	}
	SDMA_CLEAR_IEVENT (FEC_RECV_TASK_NO);
	return len;
}
#if CONFIG_POST & CFG_POST_ETHER
static int mpc5xxx_fec_recv_packet(struct eth_device *dev, void *packet)
{
	/*
	 * This command pulls one frame from the card
	 */
	mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
	volatile FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
	unsigned long ievent;
	int frame_length, len = 0;
	NBUF *frame;
	char buff[FEC_MAX_PKT_SIZE];

#if (DEBUG & 0x1)
	printf ("mpc5xxx_fec_recv %d Start...\n", fec->rbdIndex);
#endif
#if (DEBUG & 0x8)
	printf( "-" );
#endif

	/*
	 * Check if any critical events have happened
	 */
	ievent = fec->eth->ievent;
	fec->eth->ievent = ievent;
	if (ievent & 0x20060000) {
		/* BABT, Rx/Tx FIFO errors */
		mpc5xxx_fec_halt(dev);
		mpc5xxx_fec_init(dev, NULL);
		return 0;
	}
	if (ievent & 0x80000000) {
		/* Heartbeat error */
		fec->eth->x_cntrl |= 0x00000001;
	}
	if (ievent & 0x10000000) {
		/* Graceful stop complete */
		if (fec->eth->x_cntrl & 0x00000001) {
			mpc5xxx_fec_halt(dev);
			fec->eth->x_cntrl &= ~0x00000001;
			mpc5xxx_fec_init(dev, NULL);
		}
	}

	if (!(pRbd->status & FEC_RBD_EMPTY)) {
		if ((pRbd->status & FEC_RBD_LAST) && !(pRbd->status & FEC_RBD_ERR) &&
			((pRbd->dataLength - 4) > 14)) {

			/*
			 * Get buffer address and size
			 */
			frame = (NBUF *)pRbd->dataPointer;
			frame_length = pRbd->dataLength - 4;

#if (DEBUG & 0x20)
			{
				int i;
				printf("recv data hdr:");
				for (i = 0; i < 14; i++)
					printf("%x ", *(frame->head + i));
				printf("\n");
			}
#endif
			/*
			 *  Fill the buffer and pass it to upper layers
			 */
			memcpy(buff, frame->head, 14);
			memcpy(buff + 14, frame->data, frame_length);
			memcpy(packet, buff, frame_length);
			len = frame_length;
		}
		/*
		 * Reset buffer descriptor as empty
		 */
		mpc5xxx_fec_rbd_clean(fec, pRbd);
	}
	SDMA_CLEAR_IEVENT (FEC_RECV_TASK_NO);
	return len;
}
#endif
/********************************************************************/
int mpc5xxx_fec_initialize(bd_t * bis)
{
	mpc5xxx_fec_priv *fec;
	struct eth_device *dev;
	char *tmp, *end;
	char env_enetaddr[6];
	int i;

	fec = (mpc5xxx_fec_priv *)malloc(sizeof(*fec));
	dev = (struct eth_device *)malloc(sizeof(*dev));
   	memset(dev, 0, sizeof *dev);

	fec->eth = (ethernet_regs *)MPC5XXX_FEC;
	fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
	fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));
#if defined(CONFIG_CANMB)   || defined(CONFIG_HMI1001)	|| \
    defined(CONFIG_ICECUBE) || defined(CONFIG_INKA4X0)	|| \
    defined(CONFIG_PM520)   || defined(CONFIG_TOP5200)	|| \
    defined(CONFIG_TQM5200) || defined(CONFIG_O2DNT)
# ifndef CONFIG_FEC_10MBIT
	fec->xcv_type = MII100;
# else
	fec->xcv_type = MII10;
# endif
#elif defined(CONFIG_TOTAL5200)
	fec->xcv_type = SEVENWIRE;
#else
#error fec->xcv_type not initialized.
#endif

	dev->priv = (void *)fec;
	dev->iobase = MPC5XXX_FEC;
	dev->init = mpc5xxx_fec_init;
	dev->halt = mpc5xxx_fec_halt;
	dev->send = mpc5xxx_fec_send;
	dev->recv = mpc5xxx_fec_recv;
#if CONFIG_POST & CFG_POST_ETHER
	dev->recv_packet = mpc5xxx_fec_recv_packet;
#endif

	sprintf(dev->name, "FEC ETHERNET");
	eth_register(dev);

#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
	miiphy_register (dev->name,
			fec5xxx_miiphy_read, fec5xxx_miiphy_write);
#endif

	/*
	 * Try to set the mac address now. The fec mac address is
	 * a garbage after reset. When not using fec for booting
	 * the Linux fec driver will try to work with this garbage.
	 */
	tmp = getenv("ethaddr");
	if (tmp) {
		for (i=0; i<6; i++) {
			env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
			if (tmp)
				tmp = (*end) ? end+1 : end;
		}
		mpc5xxx_fec_set_hwaddr(fec, env_enetaddr);
	}

	mpc5xxx_fec_init_phy(dev, bis);

	return 1;
}

/* MII-interface related functions */
/********************************************************************/
int fec5xxx_miiphy_read(char *devname, uint8 phyAddr, uint8 regAddr, uint16 * retVal)
{
	ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC;
	uint32 reg;		/* convenient holder for the PHY register */
	uint32 phy;		/* convenient holder for the PHY */
	int timeout = 0xffff;

	/*
	 * reading from any PHY's register is done by properly
	 * programming the FEC's MII data register.
	 */
	reg = regAddr << FEC_MII_DATA_RA_SHIFT;
	phy = phyAddr << FEC_MII_DATA_PA_SHIFT;

	eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA | phy | reg);

	/*
	 * wait for the related interrupt
	 */
	while ((timeout--) && (!(eth->ievent & 0x00800000))) ;

	if (timeout == 0) {
#if (DEBUG & 0x2)
		printf ("Read MDIO failed...\n");
#endif
		return -1;
	}

	/*
	 * clear mii interrupt bit
	 */
	eth->ievent = 0x00800000;

	/*
	 * it's now safe to read the PHY's register
	 */
	*retVal = (uint16) eth->mii_data;

	return 0;
}

/********************************************************************/
int fec5xxx_miiphy_write(char *devname, uint8 phyAddr, uint8 regAddr, uint16 data)
{
	ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC;
	uint32 reg;		/* convenient holder for the PHY register */
	uint32 phy;		/* convenient holder for the PHY */
	int timeout = 0xffff;

	reg = regAddr << FEC_MII_DATA_RA_SHIFT;
	phy = phyAddr << FEC_MII_DATA_PA_SHIFT;

	eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR |
			FEC_MII_DATA_TA | phy | reg | data);

	/*
	 * wait for the MII interrupt
	 */
	while ((timeout--) && (!(eth->ievent & 0x00800000))) ;

	if (timeout == 0) {
#if (DEBUG & 0x2)
		printf ("Write MDIO failed...\n");
#endif
		return -1;
	}

	/*
	 * clear MII interrupt bit
	 */
	eth->ievent = 0x00800000;

	return 0;
}

#if (DEBUG & 0x40)
static uint32 local_crc32(char *string, unsigned int crc_value, int len)
{
	int i;
	char c;
	unsigned int crc, count;

	/*
	 * crc32 algorithm
	 */
	/*
	 * crc = 0xffffffff; * The initialized value should be 0xffffffff
	 */
	crc = crc_value;

	for (i = len; --i >= 0;) {
		c = *string++;
		for (count = 0; count < 8; count++) {
			if ((c & 0x01) ^ (crc & 0x01)) {
				crc >>= 1;
				crc = crc ^ 0xedb88320;
			} else {
				crc >>= 1;
			}
			c >>= 1;
		}
	}

	/*
	 * In big endian system, do byte swaping for crc value
	 */
	 /**/ return crc;
}
#endif	/* DEBUG */

#endif /* CONFIG_MPC5xxx_FEC */

[-- Attachment #5: tlopez.vcf --]
[-- Type: text/x-vcard, Size: 427 bytes --]

begin:vcard
fn;quoted-printable:Jos=C3=A9 Mar=C3=ADa L=C3=B3pez
n;quoted-printable;quoted-printable:L=C3=B3pez;Jos=C3=A9 Mar=C3=ADa
org:Fagor Automation S. Coop.
adr;quoted-printable:;;San Andres 19. Apdo. 144;Arrasate-Mondrag=C3=B3n;;20500;Spain
email;internet:tlopez@aotek.es
title:Sotware engineer
tel;work:(34) 943719200
tel;fax:(34) 943791712 
x-mozilla-html:FALSE
url:http://www.fagorautomation.es
version:2.1
end:vcard


^ permalink raw reply

* Re: [kernel-2.6.15] Fix PCI irq mapping for lite5200
From: Sylvain Munaut @ 2006-01-12  9:48 UTC (permalink / raw)
  To: Andrey Volkov; +Cc: LKML, ML linuxppc-embedded
In-Reply-To: <43C614A5.6030703@varma-el.com>

Hi Andrey,

Andrey Volkov wrote:
> Hi Sylvain,
> 
> This patch fix problem of PCI boards irq mapping on lite5200

What problem is that patch supposed to fix ?
The Lite5200 has a single PCI port, assigned to idsel 24 (afair) and its
INTA is connected to the IRQ0 pin of the 5200 so that looks correct to me.

> (raised after your changes of MPC52xx_IRQ0 number)

I'm not sure I get this either.
Do you mean that change provoked the bug you're talking about or that
before that change the bug was there but just not visible because masked
by the interrupt number being 0 problem ?


	Sylvain

> 
> --
> Regards
> Andrey Volkov
> 
> 
> ------------------------------------------------------------------------
> 
> 	lite5200_map_irq: Fix irq mapping for external PCI boards
> 
> Signed-off-by: Andrey Volkov <avolkov@varma-el.com>
> ---
> 
>  arch/ppc/platforms/lite5200.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
> index 7ed52dc..cd4acb3 100644
> --- a/arch/ppc/platforms/lite5200.c
> +++ b/arch/ppc/platforms/lite5200.c
> @@ -73,7 +73,8 @@ lite5200_show_cpuinfo(struct seq_file *m
>  static int
>  lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
>  {
> -	return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
> +	/* Only INTA supported */
> +	return (pin == 1) ? MPC52xx_IRQ0 : -1;
>  }
>  #endif
>  

^ permalink raw reply

* mv643xx_eth.c: Multicast and IPv6 support
From: Wolfram Joost @ 2006-01-12 12:29 UTC (permalink / raw)
  To: linuxppc-dev

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

Hello,

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.

Does anyone know how to get documentation for the marvell mv643xx-family?

Regards
 Wolfram

[-- Attachment #2: mv643xx_eth.c.diff --]
[-- Type: text/x-diff, Size: 9318 bytes --]

diff -Naurp 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-11 19:57:42.000000000 +0100
@@ -89,6 +89,7 @@ static int mv643xx_poll(struct net_devic
 static void ethernet_phy_set(unsigned int eth_port_num, int phy_addr);
 static int ethernet_phy_detect(unsigned int eth_port_num);
 static struct ethtool_ops mv643xx_ethtool_ops;
+static u8 mv643xx_eth_calc_mc_hash(u8 *addr);
 
 static char mv643xx_driver_name[] = "mv643xx_eth";
 static char mv643xx_driver_version[] = "1.0";
@@ -250,9 +251,115 @@ static void mv643xx_eth_update_mac_addre
 }
 
 /*
+ * mv643xx_eth_calc_mc_hash
+ *
+ * calculate multicast hash
+ *
+ * Input : pointer to mac address
+ * Output : hash value
+ */
+static u8 mv643xx_eth_calc_mc_hash(u8 *p_addr)
+{
+	unsigned mac_h;
+	unsigned mac_l;
+	u8 crc_result = 0;
+	unsigned mac_array[48];
+	unsigned crc[8];
+	unsigned i;
+
+	/* Calculate CRC-8 out of the given address */
+	mac_h = (p_addr[0] << 8) | (p_addr[1]);
+	mac_l = (p_addr[2] << 24) | (p_addr[3] << 16) |
+		(p_addr[4] << 8) | (p_addr[5] << 0);
+
+	for (i = 0; i < 32; i++)
+		mac_array[i] = (mac_l >> i) & 0x1;
+	for (i = 32; i < 48; i++)
+		mac_array[i] = (mac_h >> (i - 32)) & 0x1;
+
+
+	crc[0] = mac_array[45] ^ mac_array[43] ^ mac_array[40] ^
+		mac_array[39] ^ mac_array[35] ^ mac_array[34] ^
+		mac_array[31] ^ mac_array[30] ^ mac_array[28] ^
+		mac_array[23] ^ mac_array[21] ^ mac_array[19] ^
+		mac_array[18] ^ mac_array[16] ^ mac_array[14] ^
+		mac_array[12] ^ mac_array[8] ^ mac_array[7] ^
+		mac_array[6] ^ mac_array[0];
+
+	crc[1] = mac_array[46] ^ mac_array[45] ^ mac_array[44] ^
+		mac_array[43] ^ mac_array[41] ^ mac_array[39] ^
+		mac_array[36] ^ mac_array[34] ^ mac_array[32] ^
+		mac_array[30] ^ mac_array[29] ^ mac_array[28] ^
+		mac_array[24] ^ mac_array[23] ^ mac_array[22] ^
+		mac_array[21] ^ mac_array[20] ^ mac_array[18] ^
+		mac_array[17] ^ mac_array[16] ^ mac_array[15] ^
+		mac_array[14] ^ mac_array[13] ^ mac_array[12] ^
+		mac_array[9] ^ mac_array[6] ^ mac_array[1] ^
+		mac_array[0];
+
+	crc[2] = mac_array[47] ^ mac_array[46] ^ mac_array[44] ^
+		mac_array[43] ^ mac_array[42] ^ mac_array[39] ^
+		mac_array[37] ^ mac_array[34] ^ mac_array[33] ^
+		mac_array[29] ^ mac_array[28] ^ mac_array[25] ^
+		mac_array[24] ^ mac_array[22] ^ mac_array[17] ^
+		mac_array[15] ^ mac_array[13] ^ mac_array[12] ^
+		mac_array[10] ^ mac_array[8] ^ mac_array[6] ^
+		mac_array[2] ^ mac_array[1] ^ mac_array[0];
+
+	crc[3] = mac_array[47] ^ mac_array[45] ^ mac_array[44] ^
+		mac_array[43] ^ mac_array[40] ^ mac_array[38] ^
+		mac_array[35] ^ mac_array[34] ^ mac_array[30] ^
+		mac_array[29] ^ mac_array[26] ^ mac_array[25] ^
+		mac_array[23] ^ mac_array[18] ^ mac_array[16] ^
+		mac_array[14] ^ mac_array[13] ^ mac_array[11] ^
+		mac_array[9] ^ mac_array[7] ^ mac_array[3] ^
+		mac_array[2] ^ mac_array[1];
+
+	crc[4] = mac_array[46] ^ mac_array[45] ^ mac_array[44] ^
+		mac_array[41] ^ mac_array[39] ^ mac_array[36] ^
+		mac_array[35] ^ mac_array[31] ^ mac_array[30] ^
+		mac_array[27] ^ mac_array[26] ^ mac_array[24] ^
+		mac_array[19] ^ mac_array[17] ^ mac_array[15] ^
+		mac_array[14] ^ mac_array[12] ^ mac_array[10] ^
+		mac_array[8] ^ mac_array[4] ^ mac_array[3] ^
+		mac_array[2];
+
+	crc[5] = mac_array[47] ^ mac_array[46] ^ mac_array[45] ^
+		mac_array[42] ^ mac_array[40] ^ mac_array[37] ^
+		mac_array[36] ^ mac_array[32] ^ mac_array[31] ^
+		mac_array[28] ^ mac_array[27] ^ mac_array[25] ^
+		mac_array[20] ^ mac_array[18] ^ mac_array[16] ^
+		mac_array[15] ^ mac_array[13] ^ mac_array[11] ^
+		mac_array[9] ^ mac_array[5] ^ mac_array[4] ^
+		mac_array[3];
+
+	crc[6] = mac_array[47] ^ mac_array[46] ^ mac_array[43] ^
+		mac_array[41] ^ mac_array[38] ^ mac_array[37] ^
+		mac_array[33] ^ mac_array[32] ^ mac_array[29] ^
+		mac_array[28] ^ mac_array[26] ^ mac_array[21] ^
+		mac_array[19] ^ mac_array[17] ^ mac_array[16] ^
+		mac_array[14] ^ mac_array[12] ^ mac_array[10] ^
+		mac_array[6] ^ mac_array[5] ^ mac_array[4];
+
+	crc[7] = mac_array[47] ^ mac_array[44] ^ mac_array[42] ^
+		mac_array[39] ^ mac_array[38] ^ mac_array[34] ^
+		mac_array[33] ^ mac_array[30] ^ mac_array[29] ^
+		mac_array[27] ^ mac_array[22] ^ mac_array[20] ^
+		mac_array[18] ^ mac_array[17] ^ mac_array[15] ^
+		mac_array[13] ^ mac_array[11] ^ mac_array[7] ^
+		mac_array[6] ^ mac_array[5];
+
+	for (i = 0; i < 8; i++)
+		crc_result = crc_result | (crc[i] << i);
+
+	return crc_result;
+}
+
+/*
  * mv643xx_eth_set_rx_mode
  *
  * Change from promiscuos to regular rx mode
+ * maintain multicast tables
  *
  * Input :	pointer to ethernet interface network device structure
  * Output :	N/A
@@ -260,13 +367,64 @@ static void mv643xx_eth_update_mac_addre
 static void mv643xx_eth_set_rx_mode(struct net_device *dev)
 {
 	struct mv643xx_private *mp = netdev_priv(dev);
+	struct dev_mc_list *mc_list = dev->mc_list;
+	u32 multicast_table[64];
+	unsigned table_index;
+	unsigned reg_index;
 
+	/* promiscuous mode */
 	if (dev->flags & IFF_PROMISC)
 		mp->port_config |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
 	else
 		mp->port_config &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
 
 	mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), mp->port_config);
+
+	/* multicast */
+	if (dev->flags & IFF_ALLMULTI) {
+		for (table_index = 0; table_index <= 0xFC; table_index += 4) {
+			printk(KERN_INFO "IFF_ALLMULTI!\n");
+			mv_write((MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(mp->port_num) +
+				  table_index), 0x01010101);
+			mv_write((MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(mp->port_num) +
+				  table_index), 0x01010101);
+		}
+	} else {
+		/* special multicast table */
+		memset(multicast_table,0,sizeof(multicast_table));
+		for (mc_list = dev->mc_list; mc_list; mc_list = mc_list->next) {
+			if ( (mc_list->dmi_addr[0] == 0x01) &&
+				 (mc_list->dmi_addr[1] == 0x00) &&
+				 (mc_list->dmi_addr[2] == 0x5E) &&
+				 (mc_list->dmi_addr[3] == 0x00) &&
+				 (mc_list->dmi_addr[4] == 0x00) ) {
+
+				table_index = mc_list->dmi_addr[5] / 4;
+				reg_index = 8 * ( mc_list->dmi_addr[5] & 0x03 );
+				multicast_table[table_index] |= 0x01 << reg_index;
+			}
+		}
+		for (table_index = 0; table_index <=0xFC; table_index +=4)
+				mv_write((MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(mp->port_num) +
+						  table_index), multicast_table[table_index / 4]);
+		/* other multicast table */
+		memset(multicast_table,0,sizeof(multicast_table));
+		for (mc_list = dev->mc_list; mc_list; mc_list = mc_list->next) {
+			if ( (mc_list->dmi_addr[0] != 0x01) ||
+				 (mc_list->dmi_addr[1] != 0x00) ||
+				 (mc_list->dmi_addr[2] != 0x5E) ||
+				 (mc_list->dmi_addr[3] != 0x00) ||
+				 (mc_list->dmi_addr[4] != 0x00) ) {
+
+				table_index = mv643xx_eth_calc_mc_hash(mc_list->dmi_addr);
+				reg_index = 8 * (table_index & 0x03);
+				multicast_table[table_index / 4] |= 0x01 << reg_index;
+			}
+		}
+		for (table_index = 0; table_index <=0xFC; table_index +=4)
+				mv_write((MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(mp->port_num) +
+						  table_index), multicast_table[table_index / 4]);
+	}
 }
 
 /*
@@ -1150,7 +1308,6 @@ linear:
 					   5 << ETH_TX_IHL_SHIFT;
 			pkt_info.l4i_chk = 0;
 		} else {
-
 			pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
 					   ETH_TX_FIRST_DESC |
 					   ETH_TX_LAST_DESC |
@@ -1158,14 +1315,16 @@ linear:
 					   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) {
+			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.l4i_chk = skb->h.th->check;
 			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;
@@ -1221,14 +1380,19 @@ linear:
 					   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) {
+
+
+
+			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.l4i_chk = skb->h.th->check;
 			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;
@@ -1441,7 +1605,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

* Fw:   therm_adm103x: inquiry
From: Cedric Pradalier @ 2006-01-12 11:52 UTC (permalink / raw)
  To: linuxppc-dev



Begin forwarded message:

Date: Thu, 12 Jan 2006 21:34:14 +1100
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Cedric Pradalier <cedric.pradalier@free.fr>
Subject: Re: therm_adm103x: inquiry


>
>> So practically, what should I do? What should I sent to who?
>
>linuxppc-dev@ozlabs.org CC me & paulus :)
>
>Ben.
>
>

Hi

I'm the author of the therm_adm103x module, used to control
and display the fan management information on ibook G3, rev
2.2 (at least), available since 2.6.4.

Currently, the module is available as a patch or as a
binary module linked with current debian testing kernel:
http://cedric.pradalier.free.fr/ibook2

As far as I can see, this module seems mature enough for
inclusion in official kernel.

A tested patch against 2.6.14 is available at:
http://cedric.pradalier.free.fr/ibook2/adm103x-2.6.14.diff.gz

I've not tested it yet for 2.6.15. 

Some details, from the link site above:

The module provides and sysfs access to the adm103x fan
control parameters. For instance

	  #cat /sys/device/temperatures/info? 
	  T:51°C S:56°C R:10°C  <-- sensor 0
	  T:48°C S:76°C R:10°C  <-- sensor 1
	  #echo "56 10" > /sys/device/temperatures/info0 

make the fan starts at 56 degrees and accelerate
progressively till max at 66 degrees (56 + 10), on the
sensor 0.

To see if thermal control is done by the chips that this
module can manage, just check that
	#cat /proc/device-tree/uni-n/i2c/fan/device_type
returns adm1030 or adm1031.

-- 
Cedric

^ 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

* 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

* 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: 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 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 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 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: 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: 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: 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

* [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

* [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

* 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

* 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: [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

* [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: 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

* 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

* 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


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