Skip to contentSkip to conversation

ide: add configuration CONFIG_IDE_SWAP_IO

PATCH Superseded Albert Aribaud 2 participants 5 messages Jul 13, 2010

Subsystems (3)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/4 ide: add configuration CONFIG_IDE_SWAP_IO

This configuration option replaces a complex conditional in cmd_ide.c with an explicit define to be added to SoC or board configs.

---
This patch set introduces CONFIG_IDE_SWAP_IO as suggested by Wolfgang Denk, adds orion5x support to cmd_ide.c and adds IDE support to edminiv2.

Patchset history:

V1: Initial 4-patch set -- not cleanly submitted (does
not appear on gmane for instance) and contained some unrelated changes.

V2: Slimmed down to 3 patches and removed unrelated
changes.

V3: Back to 4 patches (cmd_ide improvement, driver addition,

    cmd_ide support for orion, edminiv2 support for sata);
    made initialization code reuseable as a block driver ;
    moved to C structures; commented some constants.

V4: Reordered objects alphabetically in drivers/block/Makefile.
Shortened mv_sata to mvsata.
Removed volatile qualifier in mvsata port structure. Moved port pointer definition from SoC to board code. Removed unrelated changes.

 arch/powerpc/include/asm/config.h |    3 +++
 common/cmd_ide.c                  |   18 +++++++++---------
 doc/README.PXA_CF                 |    8 ++++++++
 include/configs/ap325rxa.h        |    1 +
 include/configs/ms7720se.h        |    1 +
 include/configs/r2dplus.h         |    1 +
 include/configs/r7780mp.h         |    1 +
 7 files changed, 24 insertions(+), 9 deletions(-)
arch/powerpc/include/asm/config.h +3 -0
index fc3facb..371989d 100644
@@ -76,4 +76,7 @@
 /* Relocation to SDRAM works on all PPC boards */
 #define CONFIG_RELOC_FIXUP_WORKS
 
+/* All PPC boards must swap IDE bytes */
+#define CONFIG_IDE_SWAP_IO
+
 #endif /* _ASM_CONFIG_H_ */
common/cmd_ide.c +9 -9
index d486697..9292a5b 100644
@@ -853,7 +853,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
 #endif	/* __LITTLE_ENDIAN || CONFIG_AU1X00 */
 
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA) || defined(CONFIG_SH)
+#if defined(CONFIG_IDE_SWAP_IO)
 static void
 output_data(int dev, ulong *sect_buf, int words)
 {
@@ -897,15 +897,15 @@ output_data(int dev, ulong *sect_buf, int words)
 	}
 #endif
 }
-#else	/* ! __PPC__ */
+#else	/* ! CONFIG_IDE_SWAP_IO */
 static void
 output_data(int dev, ulong *sect_buf, int words)
 {
 	outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
 }
-#endif	/* __PPC__ */
+#endif	/* CONFIG_IDE_SWAP_IO */
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA) || defined(CONFIG_SH)
+#if defined(CONFIG_IDE_SWAP_IO)
 static void
 input_data(int dev, ulong *sect_buf, int words)
 {
@@ -955,14 +955,14 @@ input_data(int dev, ulong *sect_buf, int words)
 	}
 #endif
 }
-#else	/* ! __PPC__ */
+#else	/* ! CONFIG_IDE_SWAP_IO */
 static void
 input_data(int dev, ulong *sect_buf, int words)
 {
 	insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1);
 }
 
-#endif	/* __PPC__ */
+#endif	/* CONFIG_IDE_SWAP_IO */
 
 /* -------------------------------------------------------------------------
  */
@@ -1579,7 +1579,7 @@ int ide_device_present(int dev)
  * ATAPI Support
  */
 
-#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
+#if defined(CONFIG_IDE_SWAP_IO)
 /* since ATAPI may use commands with not 4 bytes alligned length
  * we have our own transfer functions, 2 bytes alligned */
 static void
@@ -1646,7 +1646,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
 #endif
 }
 
-#else	/* ! __PPC__ */
+#else	/* ! CONFIG_IDE_SWAP_IO */
 static void
 output_data_shorts(int dev, ushort *sect_buf, int shorts)
 {
@@ -1659,7 +1659,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
 	insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, shorts);
 }
 
-#endif	/* __PPC__ */
+#endif	/* CONFIG_IDE_SWAP_IO */
 
 /*
  * Wait until (Status & mask) == res, or timeout (in ms)
doc/README.PXA_CF +8 -0
index 6a0f236..1d76b32 100644
@@ -6,6 +6,14 @@ follow the connections of the standard lubbock. Anyway just the block
 marked memory configuration should be touched since the other parameters
 are imposed by the PXA architecture.
 
+EDIT 2010-07-01: in common/cmd_ide.c, having CONFIG_PXA_PCMCIA defined
+would cause looping on inw()/outw() rather than using insw()/outsw(),
+thus making sure IDE / ATA bytes are properly swapped. This behaviour
+is now controlled by CONFIG_IDE_SWAP_IO, therefore PXA boards with
+PCMCIA should #define CONFIG_IDE_SWAP_IO.
+
+#define CONFIG_IDE_SWAP_IO
+
 #define CONFIG_PXA_PCMCIA 1
 #define CONFIG_PXA_IDE 1
 
include/configs/ap325rxa.h +1 -0
index 70dd47e..80a5797 100644
@@ -138,6 +138,7 @@
 #define CONFIG_SYS_ATA_DATA_OFFSET	0x200	/* data reg offset */
 #define CONFIG_SYS_ATA_REG_OFFSET	0x200	/* reg offset */
 #define CONFIG_SYS_ATA_ALT_OFFSET	0x210	/* alternate register offset */
+#define CONFIG_IDE_SWAP_IO
 
 /* if you use all NOR Flash , you change dip-switch. Please see Manual. */
 #define CONFIG_SYS_MAX_FLASH_BANKS	1
include/configs/ms7720se.h +1 -0
index ba0a3f8..0ea3527 100644
@@ -122,5 +122,6 @@
 #define CONFIG_SYS_ATA_DATA_OFFSET	0		/* data reg offset */
 #define CONFIG_SYS_ATA_REG_OFFSET	0		/* reg offset */
 #define CONFIG_SYS_ATA_ALT_OFFSET	0x200		/* alternate register offset */
+#define CONFIG_IDE_SWAP_IO
 
 #endif	/* __MS7720SE_H */
include/configs/r2dplus.h +1 -0
index 8931b97..955f3ff 100644
@@ -96,6 +96,7 @@
 #define CONFIG_SYS_ATA_DATA_OFFSET	0x1000	/* data reg offset */
 #define CONFIG_SYS_ATA_REG_OFFSET	0x1000	/* reg offset */
 #define CONFIG_SYS_ATA_ALT_OFFSET	0x800	/* alternate register offset */
+#define CONFIG_IDE_SWAP_IO
 
 /*
  * SuperH PCI Bridge Configration
include/configs/r7780mp.h +1 -0
index 71c570e..3afe93a 100644
@@ -171,6 +171,7 @@
 #define CONFIG_SYS_ATA_DATA_OFFSET     0x1000          /* data reg offset */
 #define CONFIG_SYS_ATA_REG_OFFSET      0x1000          /* reg offset */
 #define CONFIG_SYS_ATA_ALT_OFFSET      0x800           /* alternate register offset */
+#define CONFIG_IDE_SWAP_IO
 #endif /* CONFIG_CMD_IDE */
 
 #endif /* __R7780RP_H */
Signature · 1 line
1.6.4.4
#1 lore raw

PATCH v4 2/4 ide: add mvsata_ide driver

This driver only provides initialization code; actual driving is done by cmd_ide.c using the ATA compatibility mode of the Marvell SATAHC controller.

---
 drivers/block/Makefile     |    7 +++--
 drivers/block/mvsata_ide.c |   60 ++++++++++++++++++++++++++++++++++++++++++++
 include/mvsata_ide.h       |   55 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 119 insertions(+), 3 deletions(-)
 create mode 100644 drivers/block/mvsata_ide.c
 create mode 100644 include/mvsata_ide.h
drivers/block/Makefile +4 -3
index 3f6ad5c..64dcf4e 100644
@@ -25,15 +25,16 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libblock.a
 
+COBJS-$(CONFIG_SCSI_AHCI) += ahci.o
 COBJS-$(CONFIG_ATA_PIIX) += ata_piix.o
-COBJS-$(CONFIG_CMD_MG_DISK) += mg_disk.o
 COBJS-$(CONFIG_FSL_SATA) += fsl_sata.o
-COBJS-$(CONFIG_IDE_SIL680) += sil680.o
 COBJS-$(CONFIG_LIBATA) += libata.o
+COBJS-$(CONFIG_CMD_MG_DISK) += mg_disk.o
+COBJS-$(CONFIG_MVSATA_IDE) += mvsata_ide.o
 COBJS-$(CONFIG_PATA_BFIN) += pata_bfin.o
 COBJS-$(CONFIG_SATA_DWC) += sata_dwc.o
 COBJS-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
-COBJS-$(CONFIG_SCSI_AHCI) += ahci.o
+COBJS-$(CONFIG_IDE_SIL680) += sil680.o
 COBJS-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o
 COBJS-$(CONFIG_SYSTEMACE) += systemace.o
 
drivers/block/mvsata_ide.c new file +60 -0

60 lines not on this page · raw message

include/mvsata_ide.h new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
1.6.4.4
#2 lore raw

PATCH v4 3/4 cmd_ide: add support for orion5x

Add MVSATAHC definitions to orion5x.
Add support for orion5x in cmd_ide.

---
 arch/arm/include/asm/arch-orion5x/orion5x.h |    3 +++
 common/cmd_ide.c                            |    4 ++++
 2 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-orion5x/orion5x.h +3 -0
index 4008c84..100a411 100644
@@ -55,6 +55,9 @@
 #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
 
 #define CONFIG_MAX_RAM_BANK_SIZE		(64*1024*1024)
 
common/cmd_ide.c +4 -0
index 9292a5b..7f98ebb 100644
@@ -45,6 +45,10 @@
 #include <mpc5xxx.h>
 #endif
 
+#ifdef CONFIG_ORION5X
+#include <asm/arch/orion5x.h>
+#endif
+
 #include <ide.h>
 #include <ata.h>
 
Signature · 1 line
1.6.4.4
#3 lore raw

PATCH v4 4/4 edminiv2: add mvsata_ide and cmd_ide support

Add mvsata_ide port 1 initialization in edminiv2 init code Add mvsata_ide and cmd_ide configuration in edminiv2 config

---
 board/LaCie/edminiv2/edminiv2.c |    7 ++++++
 include/configs/edminiv2.h      |   46 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 1 deletions(-)
board/LaCie/edminiv2/edminiv2.c +7 -0
index 54c0ffe..f0c2110 100644
@@ -88,5 +88,12 @@ int board_init(void)
 	/* boot parameter start at 256th byte of RAM base */
 	gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
 
+#if defined(CONFIG_MVSATA_IDE)
+	/* Enable SATA port 1 if SATA IDE was configured */
+	mvsata_ide_initialize_port(
+		(struct mv_sata_port_registers *)
+		(ORION5X_SATA_BASE+ORION5X_SATA_PORT1_OFFSET));
+#endif
+
 	return 0;
 }
include/configs/edminiv2.h +45 -1

70 lines not on this page · raw message

Signature · 1 line
1.6.4.4
#4 lore raw

PATCH v4 2/4 ide: add mvsata_ide driver

In reply to Albert Aribaud

drivers/block/mvsata_ide.c line 36

Quoted 3 lines · Albert Aribaud
drivers/block/mvsata_ide.c new file +3 -0
+/* Mask and values for device Interface Power Management */
+#define MVSATA_SCONTROL_IMP_MASK		0x00000F00
+#define MVSATA_SCONTROL_IMP_NO_LP_ALLOWED	0x00000300

Should this not then be:

+#define MVSATA_SCONTROL_IPM_MASK 0x00000F00
+#define MVSATA_SCONTROL_IPM_NO_LP_ALLOWED 0x00000300

?

IPM vs IMP

Rogan