mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 23:51:33 +00:00
sh: Add marubun's pcmcia driver
Marubun pcmcia is a chip for PCMCIA used with SuperH. Of course, this can be used even by other architectures. When use this driver, came to be able to use CompactFlash and Ethernet. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
This commit is contained in:
parent
febd86b969
commit
33ecdc2f9d
3 changed files with 179 additions and 0 deletions
65
doc/README.marubun-pcmcia
Normal file
65
doc/README.marubun-pcmcia
Normal file
|
@ -0,0 +1,65 @@
|
|||
|
||||
U-Boot MARUBUN MR-SHPC-01 PCMCIA controller driver
|
||||
Last update 21/11/2007 by Nobuhiro Iwamatsu
|
||||
|
||||
========================================================================================
|
||||
|
||||
0. What's this?
|
||||
This driver supports MARUBUN MR-SHPC-01.
|
||||
url: http://www.marubun.co.jp/product/semicon/devices/qgc18e0000002n2z.html
|
||||
(Sorry Japanese only.)
|
||||
|
||||
This chip is used with SuperH well, and adopted by the
|
||||
reference board.
|
||||
ex. * MS7750SE01
|
||||
* MS7722SE01
|
||||
* other
|
||||
|
||||
This chip doesn't support CardBus.
|
||||
|
||||
1. base source code
|
||||
The code is based on sources from the Linux kernel
|
||||
( arch/sh/kernel/cf-enabler.c ).
|
||||
|
||||
2. How to use
|
||||
The options you have to specify in the config file are (with the
|
||||
value for my board as an example):
|
||||
|
||||
* CONFIG_MARUBUN_PCCARD
|
||||
If you want to use this device driver, should define CONFIG_MARUBUN_PCCARD.
|
||||
ex. #define CONFIG_MARUBUN_PCCARD
|
||||
|
||||
* CONFIG_PCMCIA_SLOT_A
|
||||
Most devices have only one slot. You should define CONFIG_PCMCIA_SLOT_A .
|
||||
ex. #define CONFIG_PCMCIA_SLOT_A 1
|
||||
|
||||
* CFG_MARUBUN_MRSHPC
|
||||
This is MR-SHPC-01 PCMCIA controler base address.
|
||||
You should do the setting matched to your environment.
|
||||
ex. #define CFG_MARUBUN_MRSHPC 0xb03fffe0
|
||||
( for MS7722SE01 environment )
|
||||
|
||||
* CFG_MARUBUN_MW1
|
||||
This is MR-SHPC-01 memory window base address.
|
||||
You should do the setting matched to your environment.
|
||||
ex. #define CFG_MARUBUN_MW1 0xb0400000
|
||||
( for MS7722SE01 environment )
|
||||
|
||||
* CFG_MARUBUN_MW1
|
||||
This is MR-SHPC-01 attribute window base address.
|
||||
You should do the setting matched to your environment.
|
||||
ex. #define CFG_MARUBUN_MW2 0xb0500000
|
||||
( for MS7722SE01 environment )
|
||||
|
||||
* CFG_MARUBUN_MW1
|
||||
This is MR-SHPC-01 I/O window base address.
|
||||
You should do the setting matched to your environment.
|
||||
ex. #define CFG_MARUBUN_IO 0xb0600000
|
||||
( for MS7722SE01 environment )
|
||||
|
||||
3. Other
|
||||
* Check Compact Flash only.
|
||||
* Maybe, NE2000 compatible NIC is sure to move.
|
||||
|
||||
Copyright (c) 2007
|
||||
Nobuhiro Iwamatsu <iwamatsu@nigaur.org>
|
|
@ -125,6 +125,7 @@ COBJS-y += ti_pci1410a.o
|
|||
COBJS-y += tqm8xx_pcmcia.o
|
||||
COBJS-y += tsi108_pci.o
|
||||
COBJS-y += w83c553f.o
|
||||
COBJS-y += marubun_pcmcia.o
|
||||
|
||||
#
|
||||
# USB Drivers
|
||||
|
|
113
drivers/marubun_pcmcia.c
Normal file
113
drivers/marubun_pcmcia.c
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* 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>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
|
||||
#define CONFIG_PCMCIA
|
||||
#endif
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_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 */
|
Loading…
Reference in a new issue