summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-04-15 23:14:49 +0000
committerwdenk <wdenk>2004-04-15 23:14:49 +0000
commitdb01a2ea991b539ffbd36ab952fcf2e754789a83 (patch)
tree8514a5df0b86fe3315a29fd9068093da43f3b3ca /common
parentbda6c8aece36f4f21cb041f518d09c26e4fb47eb (diff)
* Patch by Stephen Williams, 01 Apr 2004:
Add support for Picture Elements JSE board * Patch by Christian Pell, 01 Apr 2004: Add CompactFlash support for PXA systems.
Diffstat (limited to 'common')
-rw-r--r--common/cmd_ide.c41
-rw-r--r--common/cmd_pcmcia.c139
2 files changed, 164 insertions, 16 deletions
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index aad61273e5..baab8715c9 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -782,15 +782,17 @@ set_pcmcia_timing (int pmode)
/* ------------------------------------------------------------------------- */
-#ifdef __PPC__
+#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
static void __inline__
ide_outb(int dev, int port, unsigned char val)
{
- PRINTF ("ide_outb (dev= %d, port= %d, val= 0x%02x) : @ 0x%08lx\n",
+ PRINTF ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
dev, port, val, (ATA_CURR_BASE(dev)+port));
/* Ensure I/O operations complete */
+#ifdef __PPC__
__asm__ volatile("eieio");
+#endif
*((uchar *)(ATA_CURR_BASE(dev)+port)) = val;
}
#else /* ! __PPC__ */
@@ -802,15 +804,17 @@ ide_outb(int dev, int port, unsigned char val)
#endif /* __PPC__ */
-#ifdef __PPC__
+#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
static unsigned char __inline__
ide_inb(int dev, int port)
{
uchar val;
/* Ensure I/O operations complete */
+#ifdef __PPC__
__asm__ volatile("eieio");
+#endif
val = *((uchar *)(ATA_CURR_BASE(dev)+port));
- PRINTF ("ide_inb (dev= %d, port= %d) : @ 0x%08lx -> 0x%02x\n",
+ PRINTF ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
dev, port, (ATA_CURR_BASE(dev)+port), val);
return (val);
}
@@ -856,6 +860,8 @@ input_swap_data(int dev, ulong *sect_buf, int words)
volatile ushort *pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
ushort *dbuf = (ushort *)sect_buf;
+ PRINTF("in input swap data base for read is %lx\n", (unsigned long) pbuf);
+
while (words--) {
*dbuf++ = ld_le16(pbuf);
*dbuf++ = ld_le16(pbuf);
@@ -878,7 +884,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
-#ifdef __PPC__
+#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
static void
output_data(int dev, ulong *sect_buf, int words)
{
@@ -889,9 +895,13 @@ output_data(int dev, ulong *sect_buf, int words)
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
dbuf = (ushort *)sect_buf;
while (words--) {
+#ifdef __PPC__
__asm__ volatile ("eieio");
+#endif
*pbuf = *dbuf++;
+#ifdef __PPC__
__asm__ volatile ("eieio");
+#endif
*pbuf = *dbuf++;
}
#else /* CONFIG_HMI10 */
@@ -922,7 +932,7 @@ output_data(int dev, ulong *sect_buf, int words)
}
#endif /* __PPC__ */
-#ifdef __PPC__
+#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
static void
input_data(int dev, ulong *sect_buf, int words)
{
@@ -932,10 +942,17 @@ input_data(int dev, ulong *sect_buf, int words)
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
dbuf = (ushort *)sect_buf;
+
+ PRINTF("in input data base for read is %lx\n", (unsigned long) pbuf);
+
while (words--) {
+#ifdef __PPC__
__asm__ volatile ("eieio");
+#endif
*dbuf++ = *pbuf;
+#ifdef __PPC__
__asm__ volatile ("eieio");
+#endif
*dbuf++ = *pbuf;
}
#else /* CONFIG_HMI10 */
@@ -1576,7 +1593,7 @@ static void ide_led (uchar led, uchar status)
#define AT_PRINTF(fmt,args...)
#endif
-#ifdef __PPC__
+#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
/* since ATAPI may use commands with not 4 bytes alligned length
* we have our own transfer functions, 2 bytes alligned */
static void
@@ -1588,8 +1605,13 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
dbuf = (ushort *)sect_buf;
+
+ PRINTF("in output data shorts base for read is %lx\n", (unsigned long) pbuf);
+
while (shorts--) {
+#ifdef __PPC__
__asm__ volatile ("eieio");
+#endif
*pbuf = *dbuf++;
}
#else /* CONFIG_HMI10 */
@@ -1617,8 +1639,13 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
dbuf = (ushort *)sect_buf;
+
+ PRINTF("in input data shorts base for read is %lx\n", (unsigned long) pbuf);
+
while (shorts--) {
+#ifdef __PPC__
__asm__ volatile ("eieio");
+#endif
*dbuf++ = *pbuf;
}
#else /* CONFIG_HMI10 */
diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c
index b7e57bfaf9..47632e7559 100644
--- a/common/cmd_pcmcia.c
+++ b/common/cmd_pcmcia.c
@@ -63,6 +63,9 @@
#if defined(CONFIG_LWMON)
#include <i2c.h>
#endif
+#ifdef CONFIG_PXA_PCMCIA
+#include <asm/arch/pxa-regs.h>
+#endif
#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) || \
((CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD))
@@ -86,7 +89,7 @@ static int hardware_disable(int slot);
static int hardware_enable (int slot);
static int voltage_set(int slot, int vcc, int vpp);
-#ifndef CONFIG_I82365
+#if (! defined(CONFIG_I82365)) && (! defined(CONFIG_PXA_PCMCIA))
static u_int m8xx_get_graycode(u_int size);
#endif /* CONFIG_I82365 */
#if 0
@@ -95,6 +98,8 @@ static u_int m8xx_get_speed(u_int ns, u_int is_io);
/* -------------------------------------------------------------------- */
+#ifndef CONFIG_PXA_PCMCIA
+
/* look up table for pgcrx registers */
static u_int *pcmcia_pgcrx[2] = {
@@ -106,13 +111,15 @@ static u_int *pcmcia_pgcrx[2] = {
#endif /* CONFIG_I82365 */
-#ifdef CONFIG_IDE_8xx_PCCARD
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
static void print_funcid (int func);
static void print_fixed (volatile uchar *p);
static int identify (volatile uchar *p);
static int check_ide_device (int slot);
#endif /* CONFIG_IDE_8xx_PCCARD */
+#endif
+
const char *indent = "\t ";
/* -------------------------------------------------------------------- */
@@ -151,8 +158,7 @@ int pcmcia_on (void)
rc = i82365_init();
- if (rc == 0)
- {
+ if (rc == 0) {
rc = check_ide_device(0);
}
@@ -160,6 +166,8 @@ int pcmcia_on (void)
}
#else
+#ifndef CONFIG_PXA_PCMCIA
+
#ifdef CONFIG_HMI10
# define HMI10_FRAM_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(2) | PCMCIA_SL(4))
#endif
@@ -280,8 +288,108 @@ int pcmcia_on (void)
}
return (rc);
}
+
+#endif / CONFIG_PXA_PCMCIA */
+
#endif /* CONFIG_I82365 */
+#ifdef CONFIG_PXA_PCMCIA
+
+static int hardware_enable (int slot)
+{
+ return 0; /* No hardware to enable */
+}
+
+static int hardware_disable(int slot)
+{
+ return 0; /* No hardware to disable */
+}
+
+static int voltage_set(int slot, int vcc, int vpp)
+{
+ return 0;
+}
+
+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;
+}
+
+#endif /* CONFIG_PXA_PCMCIA */
+
/* -------------------------------------------------------------------- */
#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
@@ -296,6 +404,9 @@ static int pcmcia_off (void)
return 0;
}
#else
+
+#ifndef CONFIG_PXA_PCMCIA
+
static int pcmcia_off (void)
{
int i;
@@ -327,13 +438,23 @@ static int pcmcia_off (void)
hardware_disable(_slot_);
return 0;
}
+
+#endif /* CONFIG_PXA_PCMCIA */
+
#endif /* CONFIG_I82365 */
+#ifdef CONFIG_PXA_PCMCIA
+static int pcmcia_off (void)
+{
+ return 0;
+}
+#endif
+
#endif /* CFG_CMD_PCMCIA */
/* -------------------------------------------------------------------- */
-#ifdef CONFIG_IDE_8xx_PCCARD
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
#define MAX_TUPEL_SZ 512
#define MAX_FEATURES 4
@@ -2370,7 +2491,7 @@ static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] =
/* -------------------------------------------------------------------- */
-#ifndef CONFIG_I82365
+#if ( ! defined(CONFIG_I82365) && ! defined(CONFIG_PXA_PCMCIA) )
static u_int m8xx_get_graycode(u_int size)
{
@@ -2444,7 +2565,7 @@ static u_int m8xx_get_speed(u_int ns, u_int is_io)
/* -------------------------------------------------------------------- */
-#ifdef CONFIG_IDE_8xx_PCCARD
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
static void print_funcid (int func)
{
puts (indent);
@@ -2486,7 +2607,7 @@ static void print_funcid (int func)
/* -------------------------------------------------------------------- */
-#ifdef CONFIG_IDE_8xx_PCCARD
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
static void print_fixed (volatile uchar *p)
{
if (p == NULL)
@@ -2544,7 +2665,7 @@ static void print_fixed (volatile uchar *p)
/* -------------------------------------------------------------------- */
-#ifdef CONFIG_IDE_8xx_PCCARD
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
#define MAX_IDENT_CHARS 64
#define MAX_IDENT_FIELDS 4