summaryrefslogtreecommitdiffstats
path: root/drivers/rpx_pcmcia.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.denx.de>2006-07-10 23:07:28 +0200
committerWolfgang Denk <wd@pollux.denx.de>2006-07-10 23:07:28 +0200
commit9d407995516bfcd401b76de0c11e679fb3871c79 (patch)
treedae126efb15ae0a160bd1b3f0b18ad2735c6c015 /drivers/rpx_pcmcia.c
parenta874c8c65f57ecfbb8c7961525ac4376b6fbab8b (diff)
downloadu-boot-9d407995516bfcd401b76de0c11e679fb3871c79.tar.gz
u-boot-9d407995516bfcd401b76de0c11e679fb3871c79.tar.xz
u-boot-9d407995516bfcd401b76de0c11e679fb3871c79.zip
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 'drivers/rpx_pcmcia.c')
-rw-r--r--drivers/rpx_pcmcia.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/rpx_pcmcia.c b/drivers/rpx_pcmcia.c
new file mode 100644
index 0000000000..01ff1d45ba
--- /dev/null
+++ b/drivers/rpx_pcmcia.c
@@ -0,0 +1,71 @@
+/* -------------------------------------------------------------------- */
+/* 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) */