/*
 * Marubun MR-SHPC-01 PCMCIA controller device driver
 *
 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
 *
 * 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>
#include <config.h>
#include <pcmcia.h>
#include <asm/io.h>

#undef CONFIG_PCMCIA

#if defined(CONFIG_CMD_PCMCIA)
#define	CONFIG_PCMCIA
#endif

#if	defined(CONFIG_CMD_IDE)
#define	CONFIG_PCMCIA
#endif

#if	defined(CONFIG_PCMCIA)  \
	        && (defined(CONFIG_MARUBUN_PCCARD))

/* MR-SHPC-01 register */
#define MRSHPC_MODE   	(CFG_MARUBUN_MRSHPC + 4)
#define MRSHPC_OPTION   (CFG_MARUBUN_MRSHPC + 6)
#define MRSHPC_CSR      (CFG_MARUBUN_MRSHPC + 8)
#define MRSHPC_ISR      (CFG_MARUBUN_MRSHPC + 10)
#define MRSHPC_ICR      (CFG_MARUBUN_MRSHPC + 12)
#define MRSHPC_CPWCR    (CFG_MARUBUN_MRSHPC + 14)
#define MRSHPC_MW0CR1   (CFG_MARUBUN_MRSHPC + 16)
#define MRSHPC_MW1CR1   (CFG_MARUBUN_MRSHPC + 18)
#define MRSHPC_IOWCR1   (CFG_MARUBUN_MRSHPC + 20)
#define MRSHPC_MW0CR2   (CFG_MARUBUN_MRSHPC + 22)
#define MRSHPC_MW1CR2   (CFG_MARUBUN_MRSHPC + 24)
#define MRSHPC_IOWCR2   (CFG_MARUBUN_MRSHPC + 26)
#define MRSHPC_CDCR     (CFG_MARUBUN_MRSHPC + 28)
#define MRSHPC_PCIC_INFO (CFG_MARUBUN_MRSHPC + 30)

int pcmcia_on (void)
{
	printf("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");

	/* Init */
	outw( 0x0000 , MRSHPC_MODE );

	if ((inw(MRSHPC_CSR) & 0x000c) == 0){	/* if card detect is true */
		if ((inw(MRSHPC_CSR) & 0x0080) == 0){
			outw(0x0674 ,MRSHPC_CPWCR);  /* Card Vcc is 3.3v? */
		}else{
			outw(0x0678 ,MRSHPC_CPWCR);  /* Card Vcc is 5V */
		}
		udelay( 100000 );   /* wait for power on */
	}else{
		return 1;
	}
	/*
	 *	PC-Card window open
	 *	flag == COMMON/ATTRIBUTE/IO
	 */
	/* common window open */
	outw(0x8a84,MRSHPC_MW0CR1); /* window 0xb8400000 */
	if ((inw(MRSHPC_CSR) & 0x4000) != 0)
		outw(0x0b00,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 1 */
	else
		outw(0x0300,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 0 */

	/* attribute window open */
	outw(0x8a85,MRSHPC_MW1CR1); /* window 0xb8500000 */
	if ((inw(MRSHPC_CSR) & 0x4000) != 0)
		outw(0x0a00,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 1 */
	else
		outw(0x0200,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 0 */

	/* I/O window open */
	outw(0x8a86,MRSHPC_IOWCR1); /* I/O window 0xb8600000 */
	outw(0x0008,MRSHPC_CDCR);   /* I/O card mode */
	if ((inw(MRSHPC_CSR) & 0x4000) != 0)
		outw(0x0a00,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1 */
	else
		outw(0x0200,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0 */

	outw(0x0000,MRSHPC_ISR);
	outw(0x2000,MRSHPC_ICR);
	outb(0x00,(CFG_MARUBUN_MW2 + 0x206));
	outb(0x42,(CFG_MARUBUN_MW2 + 0x200));

	return 0;
}

int pcmcia_off (void)
{
	printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");

	return 0;
}

#endif /* CONFIG_MARUBUN_PCCARD */
