summaryrefslogtreecommitdiffstats
path: root/drivers/pxa_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/pxa_pcmcia.c
parenta874c8c65f57ecfbb8c7961525ac4376b6fbab8b (diff)
downloadbarebox-9d407995516bfcd401b76de0c11e679fb3871c79.tar.gz
barebox-9d407995516bfcd401b76de0c11e679fb3871c79.tar.xz
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/pxa_pcmcia.c')
-rw-r--r--drivers/pxa_pcmcia.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/drivers/pxa_pcmcia.c b/drivers/pxa_pcmcia.c
new file mode 100644
index 0000000000..d9d38bbfcd
--- /dev/null
+++ b/drivers/pxa_pcmcia.c
@@ -0,0 +1,95 @@
+#include <common.h>
+#include <config.h>
+
+#ifdef CONFIG_PXA_PCMCIA
+
+#include <pcmcia.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/io.h>
+
+static inline void msWait(unsigned msVal)
+{
+ udelay(msVal*1000);
+}
+
+int pcmcia_on (void)
+{
+ unsigned int reg_arr[] = {
+ 0x48000028, CFG_MCMEM0_VAL,
+ 0x4800002c, CFG_MCMEM1_VAL,
+ 0x48000030, CFG_MCATT0_VAL,
+ 0x48000034, CFG_MCATT1_VAL,
+ 0x48000038, CFG_MCIO0_VAL,
+ 0x4800003c, CFG_MCIO1_VAL,
+
+ 0, 0
+ };
+ int i, rc;
+
+#ifdef CONFIG_EXADRON1
+ int cardDetect;
+ volatile unsigned int *v_pBCRReg =
+ (volatile unsigned int *) 0x08000000;
+#endif
+
+ debug ("%s\n", __FUNCTION__);
+
+ i = 0;
+ while (reg_arr[i])
+ *((volatile unsigned int *) reg_arr[i++]) |= reg_arr[i++];
+ udelay (1000);
+
+ debug ("%s: programmed mem controller \n", __FUNCTION__);
+
+#ifdef CONFIG_EXADRON1
+
+/*define useful BCR masks */
+#define BCR_CF_INIT_VAL 0x00007230
+#define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231
+#define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233
+#define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213
+#define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211
+
+ /* we see from the GPIO bit if the card is present */
+ cardDetect = !(GPLR0 & GPIO_bit (14));
+
+ if (cardDetect) {
+ printf ("No PCMCIA card found!\n");
+ }
+
+ /* reset the card via the BCR line */
+ *v_pBCRReg = (unsigned) BCR_CF_INIT_VAL;
+ msWait (500);
+
+ *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL;
+ msWait (500);
+
+ *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL;
+ msWait (500);
+
+ *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL;
+ msWait (500);
+
+ *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL;
+ msWait (1500);
+
+ /* enable address bus */
+ GPCR1 = 0x01;
+ /* and the first CF slot */
+ MECR = 0x00000002;
+
+#endif /* EXADRON 1 */
+
+ rc = check_ide_device (0); /* use just slot 0 */
+
+ return rc;
+}
+
+#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
+int pcmcia_off (void)
+{
+ return 0;
+}
+#endif
+
+#endif /* CONFIG_PXA_PCMCIA */