/*
 * KUP board specific definitions
 *
 * Copyright (c) 2004 Klaus Heydeck (heydeck@kieback-peter.de)
 */

#ifndef __MACH_KUP4_H
#define __MACH_KUP4_H

#include <linux/config.h>

#include <asm/ppcboot.h>

#define	IMAP_ADDR	0xFFF00000	/* physical base address of IMMR area	*/
#define IMAP_SIZE	(64 * 1024)	/* mapped size of IMMR area		*/

#define I2C_ADDR_RTC		0x51	/* PCF8563 RTC				*/
#define I2C_ADDR_KENN_AK	0x21	/* PCF8574 IO Expander Anschlusskarte	*/


/*-----------------------------------------------------------------------
 * PCMCIA stuff
 *-----------------------------------------------------------------------
 *
 */

#define PCMCIA_MEM_SIZE         ( 64 << 20 )

#if defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
#define MAX_HWIFS       2       /* overwrite default in include/asm-ppc/ide.h   */
#ifndef __ASSEMBLY__
#include <asm/8xx_immap.h>
static __inline__ void ide_led(int on)
{
	volatile immap_t        *immap = (immap_t *)IMAP_ADDR;

	if (on) {
		immap->im_ioport.iop_padat &= ~0x80;
	} else {
		immap->im_ioport.iop_padat |= 0x80;
	}
}
#endif
#define IDE_LED(x) ide_led((x))
#else
#define MAX_HWIFS       1       /* overwrite default in include/asm-ppc/ide.h   */
#endif


/*
 * Definitions for IDE0 Interface
 */
#define IDE0_BASE_OFFSET                0
#define IDE0_DATA_REG_OFFSET            (PCMCIA_MEM_SIZE + 0x320)
#define IDE0_ERROR_REG_OFFSET           (2 * PCMCIA_MEM_SIZE + 0x320 + 1)
#define IDE0_NSECTOR_REG_OFFSET         (2 * PCMCIA_MEM_SIZE + 0x320 + 2)
#define IDE0_SECTOR_REG_OFFSET          (2 * PCMCIA_MEM_SIZE + 0x320 + 3)
#define IDE0_LCYL_REG_OFFSET            (2 * PCMCIA_MEM_SIZE + 0x320 + 4)
#define IDE0_HCYL_REG_OFFSET            (2 * PCMCIA_MEM_SIZE + 0x320 + 5)
#define IDE0_SELECT_REG_OFFSET          (2 * PCMCIA_MEM_SIZE + 0x320 + 6)
#define IDE0_STATUS_REG_OFFSET          (2 * PCMCIA_MEM_SIZE + 0x320 + 7)
#define IDE0_CONTROL_REG_OFFSET         0x0106
#define IDE0_IRQ_REG_OFFSET             0x000A  /* not used                     */


/* define IO_BASE for PCMCIA */
#define _IO_BASE 0x80000000
#define _IO_BASE_SIZE  (64<<10)

/*
 * Interrupts
 */

#if 0
#define PHY_INTERRUPT           12      /* SIU_IRQ6                             */
#endif

#define UPS_5VOLT_INTRRUPT       2      /* SIU_IRQ1                             */
#define UPS_24VOLT_INTERRUPT     4      /* SIU_IRQ2                             */
#define CAN1_INTERRUPT           8      /* SIU_IRQ4                             */
#define FEC_INTERRUPT            9      /* SIU_LEVEL4                           */
#define CAN2_INTERRUPT          10      /* SIU_IRQ5                             */
#define PEN_DOWN_INTERRUPT      12      /* SIU_IRQ6                             */
#define IDE0_INTERRUPT          13      /* SIU_LEVEL6                           */


#ifdef CONFIG_IDE
#define ide_request_irq(irq,hand,flg,dev,id)    \
	request_8xxirq((irq),(hand),(flg),(dev),(id))
#endif

/* We don't use the 8259.
 */
#define NR_8259_INTS    0


#define USB_VCC 0x00020000		/* PB14 */



#define LATCH_HW_KENNUNG	0x90000200

#endif	/* __MACH_KUP4_H */
