[U-Boot] [PATCH 2/4] orion5x: edminiv2: add CMD_IDE support

Albert Aribaud albert.aribaud at free.fr
Thu Jul 1 02:38:00 CEST 2010


Signed-off-by: Albert Aribaud <albert.aribaud at free.fr>
---
 arch/arm/include/asm/arch-orion5x/orion5x.h |   20 ++++++++++++++++++
 board/LaCie/edminiv2/config.mk              |    6 ++++-
 board/LaCie/edminiv2/edminiv2.c             |   26 ++++++++++++++++++++++++
 include/configs/edminiv2.h                  |   29 +++++++++++++++++++++++++-
 4 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch-orion5x/orion5x.h b/arch/arm/include/asm/arch-orion5x/orion5x.h
index 4008c84..11de968 100644
--- a/arch/arm/include/asm/arch-orion5x/orion5x.h
+++ b/arch/arm/include/asm/arch-orion5x/orion5x.h
@@ -55,6 +55,26 @@
 #define ORION5X_USB20_PORT0_BASE		(ORION5X_REGISTER(0x50000))
 #define ORION5X_USB20_PORT1_BASE		(ORION5X_REGISTER(0xA0000))
 #define ORION5X_EGIGA_BASE			(ORION5X_REGISTER(0x72000))
+#define ORION5X_SATA_BASE			(ORION5X_REGISTER(0x80000))
+#define ORION5X_SATA_PORT0_OFFSET		0x2000
+#define ORION5X_SATA_PORT1_OFFSET		0x4000
+
+/*
+ * SATA definitions needed for controller initialization
+ */
+/* SControl register address */
+#define ORION5X_SATA_PORT1_SCONTROL_REG \
+	(ORION5X_SATA_BASE+ORION5X_SATA_PORT1_OFFSET+0x308)
+/* Mask and values for device DETection and link initialization */
+#define ORION5X_SATA_SCONTROL_DET_MASK		0x0000000F
+#define ORION5X_SATA_SCONTROL_DET_NONE		0x00000000
+#define ORION5X_SATA_SCONTROL_DET_INIT		0x00000001
+/* Mask and values for device Interface Power Management */
+#define ORION5X_SATA_SCONTROL_IMP_MASK		0x00000F00
+#define ORION5X_SATA_SCONTROL_IMP_NO_LP_ALLOWED	0x00000300
+
+/* Orion5x will need byte-swapping if using ATA registers */
+#define CONFIG_IDE_SWAP_IO
 
 #define CONFIG_MAX_RAM_BANK_SIZE		(64*1024*1024)
 
diff --git a/board/LaCie/edminiv2/config.mk b/board/LaCie/edminiv2/config.mk
index 3dec1aa..1606cca 100644
--- a/board/LaCie/edminiv2/config.mk
+++ b/board/LaCie/edminiv2/config.mk
@@ -24,4 +24,8 @@
 # MA 02110-1301 USA
 #
 
-TEXT_BASE = 0x00100000
+# As the Linux  kernel will load from 00008000 up and we cannot tell
+# how big it can be, let U-Boot run in the topmost megabyte of the
+# ED Mini V2 64 megabyte DRAM.
+
+TEXT_BASE = 0x03F00000
diff --git a/board/LaCie/edminiv2/edminiv2.c b/board/LaCie/edminiv2/edminiv2.c
index 54c0ffe..84375c2 100644
--- a/board/LaCie/edminiv2/edminiv2.c
+++ b/board/LaCie/edminiv2/edminiv2.c
@@ -80,13 +80,39 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
 }
 #endif				/* CONFIG_SYS_FLASH_CFI */
 
+/*
+ * ED Mini V2 uses SATA PORT1. Initialize this port and
+ * disable low power on it.
+ */
+
+/* mask for isolating IPM and DET fields in SControl register */
+#define EDMINIV2_SCONTROL_MASK (ORION5X_SATA_SCONTROL_DET_MASK \
+	|| ORION5X_SATA_SCONTROL_IMP_MASK)
+
+/* IPM and DET values for initializing link */
+#define EDMINIV2_PORT_INIT (ORION5X_SATA_SCONTROL_DET_INIT \
+	|| ORION5X_SATA_SCONTROL_IMP_NO_LP_ALLOWED)
+
+/* IPM and DET values to use link once initialized */
+#define EDMINIV2_PORT_USE (ORION5X_SATA_SCONTROL_DET_NONE \
+	|| ORION5X_SATA_SCONTROL_IMP_NO_LP_ALLOWED)
+
 int board_init(void)
 {
+	u32 reg;
+
 	/* arch number of board */
 	gd->bd->bi_arch_number = MACH_TYPE_EDMINI_V2;
 
 	/* boot parameter start at 256th byte of RAM base */
 	gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
 
+	/* reset port 1 of SATAHC controller */
+	reg = readl(ORION5X_SATA_PORT1_SCONTROL_REG);
+	reg = (reg & ~EDMINIV2_SCONTROL_MASK) | EDMINIV2_PORT_INIT;
+	writel(reg, ORION5X_SATA_PORT1_SCONTROL_REG);
+	reg = (reg & ~EDMINIV2_SCONTROL_MASK) | EDMINIV2_PORT_USE;
+	writel(reg, ORION5X_SATA_PORT1_SCONTROL_REG);
+
 	return 0;
 }
diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h
index c3d95a0..5c328c8 100644
--- a/include/configs/edminiv2.h
+++ b/include/configs/edminiv2.h
@@ -52,6 +52,12 @@
 #define CONFIG_SYS_HZ		1000
 
 /*
+ * __io is necessary for cmd_ide to compile
+ */
+
+#define __io
+
+/*
  * Board-specific values for Orion5x MPP low level init:
  * - MPPs 12 to 15 are SATA LEDs (mode 5)
  * - Others are GPIO/unused (mode 3 for MPP0, mode 5 for
@@ -60,7 +66,7 @@
 
 #define ORION5X_MPP0_7		0x00000003
 #define ORION5X_MPP8_15		0x55550000
-#define ORION5X_MPP16_23	0x00000000
+#define ORION5X_MPP16_23	0x00005555
 
 /*
  * Board-specific values for Orion5x GPIO low level init:
@@ -74,7 +80,6 @@
  */
 
 #define ORION5X_GPIO_OUT_ENABLE	0x03fcffff
-#define ORION5X_GPIO_OUT_VALUE	0x03fcffff
 
 /*
  * NS16550 Configuration
@@ -131,6 +136,7 @@
  * Commands configuration - using default command set for now
  */
 #include <config_cmd_default.h>
+
 /*
  * Disabling some default commands for staggered bring-up
  */
@@ -139,6 +145,25 @@
 #undef CONFIG_CMD_NFS	/* no NFS since no net */
 
 /*
+ * ED Mini has a connector for SATA Port 1
+ */
+
+#define CONFIG_CMD_IDE
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+
+#define CONFIG_LIBATA
+#define CONFIG_SYS_IDE_MAXBUS		1
+#define CONFIG_SYS_IDE_MAXDEVICE	1
+#define CONFIG_SYS_ATA_BASE_ADDR	ORION5X_SATA_BASE
+#define CONFIG_SYS_ATA_IDE0_OFFSET	ORION5X_SATA_PORT1_OFFSET
+#define CONFIG_SYS_ATA_DATA_OFFSET	(0x0100)
+#define CONFIG_SYS_ATA_REG_OFFSET	(0x0100)
+#define CONFIG_SYS_ATA_ALT_OFFSET	(0x0100)
+#define CONFIG_SYS_ATA_STRIDE		4
+#define CONFIG_LBA48
+
+/*
  *  Environment variables configurations
  */
 #define CONFIG_ENV_IS_IN_FLASH		1
-- 
1.6.4.4



More information about the U-Boot mailing list