diff options
author | Wolfgang Denk <wd@pollux.denx.de> | 2006-07-10 23:07:28 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@pollux.denx.de> | 2006-07-10 23:07:28 +0200 |
commit | 9d407995516bfcd401b76de0c11e679fb3871c79 (patch) | |
tree | dae126efb15ae0a160bd1b3f0b18ad2735c6c015 /board/fads | |
parent | a874c8c65f57ecfbb8c7961525ac4376b6fbab8b (diff) |
Major PCMCIA Cleanup to make code better readable and maintainable.
Notes:
- Board-dependend code for RPXLITE and RPXCLASSIC-based boards
placed to the drivers/rpx_pmcia.c file to avoid duplication.
Same for TQM8xx-based boards (drivers/tqm8xx_pmcia.c).
- drivers/i82365.c has been split into two parts located at
board/atc/ti113x.c and board/cpc45/pd67290.c (ATC and CPC45 are
the only boards using CONFIG_82365).
- Changes were tested for clean build and *very* *few* boards.
Diffstat (limited to 'board/fads')
-rw-r--r-- | board/fads/Makefile | 2 | ||||
-rw-r--r-- | board/fads/pcmcia.c | 84 |
2 files changed, 85 insertions, 1 deletions
diff --git a/board/fads/Makefile b/board/fads/Makefile index baa6c2e40b0..7fc88ee8246 100644 --- a/board/fads/Makefile +++ b/board/fads/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o flash.o lamp.o +OBJS = $(BOARD).o flash.o lamp.o pcmcia.o $(LIB): .depend $(OBJS) $(AR) crv $@ $(OBJS) diff --git a/board/fads/pcmcia.c b/board/fads/pcmcia.c new file mode 100644 index 00000000000..978c16b9412 --- /dev/null +++ b/board/fads/pcmcia.c @@ -0,0 +1,84 @@ +#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 + +#ifdef CONFIG_PCMCIA + +#ifdef CONFIG_ADS +#define PCMCIA_BOARD_MSG "ADS" +#else +#define PCMCIA_BOARD_MSG "FADS" +#endif + +int pcmcia_voltage_set(int slot, int vcc, int vpp) +{ + u_long reg = 0; + + switch(vpp) { + case 0: reg = 0; break; + case 50: reg = 1; break; + case 120: reg = 2; break; + default: return 1; + } + + switch(vcc) { + case 0: reg = 0; break; +#ifdef CONFIG_ADS + case 50: reg = BCSR1_PCCVCCON; break; +#endif +#ifdef CONFIG_FADS + case 33: reg = BCSR1_PCCVCC0 | BCSR1_PCCVCC1; break; + case 50: reg = BCSR1_PCCVCC1; break; +#endif + default: return 1; + } + + /* first, turn off all power */ + +#ifdef CONFIG_ADS + *((uint *)BCSR1) |= BCSR1_PCCVCCON; +#endif +#ifdef CONFIG_FADS + *((uint *)BCSR1) &= ~(BCSR1_PCCVCC0 | BCSR1_PCCVCC1); +#endif + *((uint *)BCSR1) &= ~BCSR1_PCCVPP_MASK; + + /* enable new powersettings */ + +#ifdef CONFIG_ADS + *((uint *)BCSR1) &= ~reg; +#endif +#ifdef CONFIG_FADS + *((uint *)BCSR1) |= reg; +#endif + + *((uint *)BCSR1) |= reg << 20; + + return 0; +} + +int pcmcia_hardware_enable(int slot) +{ + *((uint *)BCSR1) &= ~BCSR1_PCCEN; + return 0; +} + +#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) +int pcmcia_hardware_disable(int slot) +{ + *((uint *)BCSR1) &= ~BCSR1_PCCEN; + return 0; +} +#endif /* CFG_CMD_PCMCIA */ + +#endif /* CONFIG_PCMCIA */ |