/* -------------------------------------------------------------------- */
/* RPX Boards from Embedded Planet					*/
/* -------------------------------------------------------------------- */
#include <common.h>
#include <mpc8xx.h>
#include <pcmcia.h>

#undef	CONFIG_PCMCIA

#if	CONFIG_COMMANDS & CFG_CMD_PCMCIA
#define	CONFIG_PCMCIA
#endif

#if	(CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
#define	CONFIG_PCMCIA
#endif

#if	defined(CONFIG_PCMCIA)	\
	&& (defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE))

#define	PCMCIA_BOARD_MSG	"RPX CLASSIC or RPX LITE"

int pcmcia_voltage_set(int slot, int vcc, int vpp)
{
	u_long reg = 0;

	switch(vcc) {
		case 0: break;
		case 33: reg |= BCSR1_PCVCTL4; break;
		case 50: reg |= BCSR1_PCVCTL5; break;
		default: return 1;
	}

	switch(vpp) {
		case 0: break;
		case 33:
		case 50:
			if(vcc == vpp)
				reg |= BCSR1_PCVCTL6;
			else
				return 1;
			break;
		case 120:
			reg |= BCSR1_PCVCTL7;
			default: return 1;
	}

	/* first, turn off all power */
	*((uint *)RPX_CSR_ADDR) &= ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5
			| BCSR1_PCVCTL6 | BCSR1_PCVCTL7);

	/* enable new powersettings */
	*((uint *)RPX_CSR_ADDR) |= reg;

	return 0;
}

int pcmcia_hardware_enable (int slot)
{
	return 0;	/* No hardware to enable */
}

#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
static int pcmcia_hardware_disable(int slot)
{
	return 0;	/* No hardware to disable */
}
#endif	/* CONFIG_COMMANDS & CFG_CMD_PCMCIA */


#endif	/* CONFIG_PCMCIA && (CONFIG_RPXCLASSIC || CONFIG_RPXLITE) */
