]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
malta: IDE support
authorPaul Burton <paul.burton@imgtec.com>
Thu, 29 Jan 2015 10:38:20 +0000 (10:38 +0000)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Thu, 29 Jan 2015 12:11:02 +0000 (13:11 +0100)
This patch adds IDE support to the MIPS Malta board. The IDE controller
is enabled after probing the PCI bus and otherwise just makes use of
U-boot generic IDE support.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
arch/mips/include/asm/malta.h
board/imgtec/malta/malta.c
include/configs/malta.h

index 9e7c045aacf79f121847191f0748fb95998590bf..d9ffc1558dbfa392db6b3c0eef40fd4bebb4aa59 100644 (file)
@@ -64,4 +64,9 @@
 
 #define PCI_CFG_PIIX4_GENCFG_SERIRQ    (1 << 16)
 
+#define PCI_CFG_PIIX4_IDETIM_PRI       0x40
+#define PCI_CFG_PIIX4_IDETIM_SEC       0x42
+
+#define PCI_CFG_PIIX4_IDETIM_IDE       (1 << 15)
+
 #endif /* _MIPS_ASM_MALTA_H */
index 78c4bd4efe7114767e9c52ef07a42c6fe8c1460c..72b03ff8cd35e59dfdd9b8b971a000d1ecd6d25d 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <ide.h>
 #include <netdev.h>
 #include <pci.h>
 #include <pci_gt64120.h>
@@ -217,4 +218,22 @@ void pci_init_board(void)
        pci_read_config_byte(bdf, PCI_CFG_PIIX4_SERIRQC, &val8);
        val8 |= PCI_CFG_PIIX4_SERIRQC_EN | PCI_CFG_PIIX4_SERIRQC_CONT;
        pci_write_config_byte(bdf, PCI_CFG_PIIX4_SERIRQC, val8);
+
+       bdf = pci_find_device(PCI_VENDOR_ID_INTEL,
+                             PCI_DEVICE_ID_INTEL_82371AB, 0);
+       if (bdf == -1)
+               panic("Failed to find PIIX4 IDE controller\n");
+
+       /* enable bus master & IO access */
+       val32 |= PCI_COMMAND_MASTER | PCI_COMMAND_IO;
+       pci_write_config_dword(bdf, PCI_COMMAND, val32);
+
+       /* set latency */
+       pci_write_config_byte(bdf, PCI_LATENCY_TIMER, 0x40);
+
+       /* enable IDE/ATA */
+       pci_write_config_dword(bdf, PCI_CFG_PIIX4_IDETIM_PRI,
+                              PCI_CFG_PIIX4_IDETIM_IDE);
+       pci_write_config_dword(bdf, PCI_CFG_PIIX4_IDETIM_SEC,
+                              PCI_CFG_PIIX4_IDETIM_IDE);
 }
index 684d24959033403710c0d4e13d0e0bb4024915ec..ed5da6cd73d22556aa3a9b406c5dc53eff949671 100644 (file)
 #define CONFIG_ENV_ADDR \
        (CONFIG_SYS_FLASH_BASE + (4 << 20) - CONFIG_ENV_SIZE)
 
+/*
+ * IDE/ATA
+ */
+#define CONFIG_SYS_IDE_MAXBUS          1
+#define CONFIG_SYS_IDE_MAXDEVICE       2
+#define CONFIG_SYS_ATA_BASE_ADDR       CONFIG_SYS_ISA_IO_BASE_ADDRESS
+#define CONFIG_SYS_ATA_IDE0_OFFSET     0x01f0
+#define CONFIG_SYS_ATA_DATA_OFFSET     0
+#define CONFIG_SYS_ATA_REG_OFFSET      0
+
 /*
  * Commands
  */
 
 #define CONFIG_CMD_DATE
 #define CONFIG_CMD_DHCP
+#define CONFIG_CMD_IDE
 #define CONFIG_CMD_PCI
 #define CONFIG_CMD_PING