]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
IDE: - make ide_inb () and ide_outb () "weak", so boards can
authorHeiko Schocher <hs@pollux.denx.de>
Tue, 28 Aug 2007 15:39:14 +0000 (17:39 +0200)
committerHeiko Schocher <hs@pollux.denx.de>
Tue, 28 Aug 2007 15:39:14 +0000 (17:39 +0200)
          define there own I/O functions.
          (Needed for the pcs440ep board).
        - The default I/O Functions are again 8 Bit accesses.
        - Added CONFIG_CMD_IDE for the pcs440ep Board.

Signed-off-by: Heiko Schocher <hs@denx.de>
board/pcs440ep/pcs440ep.c
common/cmd_ide.c
include/asm-ppc/io.h
include/configs/pcs440ep.h
include/ide.h

index e247fee0c176a7969731291dffba8fbfa8e1b680..90e99d3dca88997256219823c58777cb1c533829 100644 (file)
@@ -30,6 +30,7 @@
 #include <spd_sdram.h>
 #include <status_led.h>
 #include <sha1.h>
+#include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -867,6 +868,29 @@ U_BOOT_CMD(
 );
 #endif
 
+#if defined (CONFIG_CMD_IDE)
+/* These addresses need to be shifted one place to the left
+ * ( bus per_addr 20 -30 is connectsd on CF bus A10-A0)
+ * These values are shifted
+ */
+extern ulong *ide_bus_offset;
+void inline ide_outb(int dev, int port, unsigned char val)
+{
+       debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
+               dev, port, val, (ATA_CURR_BASE(dev)+port));
+
+       out_be16((u16 *)(ATA_CURR_BASE(dev)+(port << 1)), val);
+}
+unsigned char inline ide_inb(int dev, int port)
+{
+       uchar val;
+       val = in_be16((u16 *)(ATA_CURR_BASE(dev)+(port << 1)));
+       debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
+               dev, port, (ATA_CURR_BASE(dev)+port), val);
+       return (val);
+}
+#endif
+
 #ifdef CONFIG_IDE_PREINIT
 int ide_preinit (void)
 {
index 89fefed33d06fccdc535eefaad9a038d1626b621..bb064eaa04a3ad7869db70aeca2f99f23a3be8b9 100644 (file)
@@ -31,6 +31,7 @@
 #include <command.h>
 #include <image.h>
 #include <asm/byteorder.h>
+#include <asm/io.h>
 
 #if defined(CONFIG_IDE_8xx_DIRECT) || defined(CONFIG_IDE_PCMCIA)
 # include <pcmcia.h>
@@ -128,8 +129,6 @@ ulong ide_bus_offset[CFG_IDE_MAXBUS] = {
 };
 
 
-#define        ATA_CURR_BASE(dev)      (CFG_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
-
 #ifndef CONFIG_AMIGAONEG3SE
 static int ide_bus_ok[CFG_IDE_MAXBUS];
 #else
@@ -172,8 +171,8 @@ static uchar ide_wait  (int dev, ulong t);
 
 #define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
 
-static void __inline__ ide_outb(int dev, int port, unsigned char val);
-static unsigned char __inline__ ide_inb(int dev, int port);
+void inline ide_outb(int dev, int port, unsigned char val);
+unsigned char inline ide_inb(int dev, int port);
 static void input_data(int dev, ulong *sect_buf, int words);
 static void output_data(int dev, ulong *sect_buf, int words);
 static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
@@ -805,45 +804,27 @@ set_pcmcia_timing (int pmode)
 
 /* ------------------------------------------------------------------------- */
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
-static void __inline__
-ide_outb(int dev, int port, unsigned char val)
+void inline
+__ide_outb(int dev, int port, unsigned char val)
 {
        debug ("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 */
-       EIEIO;
-       *((u16 *)(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port))) = val;
-}
-#else  /* ! __PPC__ */
-static void __inline__
-ide_outb(int dev, int port, unsigned char val)
-{
-       outb(val, ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port));
+               dev, port, val, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
+       outb(val, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
 }
-#endif /* __PPC__ */
-
+void inline ide_outb (int dev, int port, unsigned char val)
+               __attribute__((weak, alias("__ide_outb")));
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
-static unsigned char __inline__
-ide_inb(int dev, int port)
+unsigned char inline
+__ide_inb(int dev, int port)
 {
        uchar val;
-       /* Ensure I/O operations complete */
-       EIEIO;
-       val = *((u16 *)(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
+       val = inb((ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
        debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
-               dev, port, (ATA_CURR_BASE(dev)+port), val);
-       return (val);
+               dev, port, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)), val);
+       return val;
 }
-#else  /* ! __PPC__ */
-static unsigned char __inline__
-ide_inb(int dev, int port)
-{
-  return inb(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port));
-}
-#endif /* __PPC__ */
+unsigned char inline ide_inb(int dev, int port)
+                       __attribute__((weak, alias("__ide_inb")));
 
 #ifdef __PPC__
 # ifdef CONFIG_AMIGAONEG3SE
index 03289bcc21402ea3f20dd7d991b5ddcd4d80f1bb..11dfa1c57b48b6248ed96c457e9faa57a2e18c23 100644 (file)
@@ -13,6 +13,9 @@
 #define SIO_CONFIG_RA   0x398
 #define SIO_CONFIG_RD   0x399
 
+#ifndef _IO_BASE
+#define _IO_BASE 0
+#endif
 
 #define readb(addr) in_8((volatile u8 *)(addr))
 #define writeb(b,addr) out_8((volatile u8 *)(addr), (b))
index 8e51d2d3c05bebb5354fe5465dd9f4e4c75500e1..7653ba1d2457c64ee4ab7b6c494b924db39e17cc 100644 (file)
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_ELF
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 #define CONFIG_CMD_I2C
+#define CONFIG_CMD_IDE
 #define CONFIG_CMD_IRQ
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_PCI
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_REGINFO
+#define CONFIG_CMD_REISER
 #define CONFIG_CMD_SDRAM
-#define CONFIG_CMD_EXT2
-#define CONFIG_CMD_FAT
 #define CONFIG_CMD_USB
 
-
 #define CONFIG_SUPPORT_VFAT
 
 /*
 /* Offset for alternate registers      */
 #define CFG_ATA_ALT_OFFSET     (0x0000)
 
-/* These addresses need to be shifted one place to the left
- * ( bus per_addr 20 -30 is connectsd on CF bus A10-A0)
- * These values are shifted
- */
-#define CFG_ATA_PORT_ADDR(port) ((port) << 1)
-
 #endif /* __CONFIG_H */
index 6976a6c319c3736b4a0c33ab89e57739cb9299c4..222f4f84e48664f25e983b48557cf695c2f883df 100644 (file)
@@ -26,6 +26,8 @@
 
 #define        IDE_BUS(dev)    (dev >> 1)
 
+#define        ATA_CURR_BASE(dev)      (CFG_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
+
 #ifdef CONFIG_IDE_LED
 
 /*