Skip to contentSkip to conversation

IDE fixes

GIT PULL Bartlomiej Zolnierkiewicz 1 participant 2 messages Mar 5, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi,

Two bug fixes (for odd-length ATAPI PIO transfers from Sergei Shtylyov and for insanely long DMA timeouts from Roel Kluin), some sparse fixes (from Hannes Eder) and a new driver for AT91 Static Memory Controller with Compact Flash True IDE Mode logic (from Stanislaw Gruszka, arch specific part has been acked by a platform maintainer).

Linus, please pull from:

master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/

to receive the following updates:

 arch/arm/mach-at91/at91sam9263_devices.c |  105 +++++++
 arch/arm/mach-at91/include/mach/board.h  |    3 +
 drivers/ide/Kconfig                      |    5 +
 drivers/ide/Makefile                     |    1 +
 drivers/ide/at91_ide.c                   |  467 ++++++++++++++++++++++++++++++
 drivers/ide/ide-disk_proc.c              |    2 +-
 drivers/ide/ide-floppy_proc.c            |    2 +-
 drivers/ide/ide-io.c                     |    3 +-
 drivers/ide/ide-iops.c                   |    2 +
 drivers/ide/ide-probe.c                  |    7 +-
 drivers/ide/ide-proc.c                   |    2 +-
 drivers/ide/ide-tape.c                   |    2 +-
 include/linux/hdreg.h                    |    1 -
 include/linux/ide.h                      |    1 +
 14 files changed, 596 insertions(+), 7 deletions(-)
 create mode 100644 drivers/ide/at91_ide.c

Bartlomiej Zolnierkiewicz (1):
remove stale comment from <linux/hdreg.h>

Hannes Eder (1):
ide: NULL noise: drivers/ide/ide-*.c

Roel Kluin (1):
ide: expiry() returns int, negative expiry() return values won't be noticed

Sergei Shtylyov (1):
ide-iops: fix odd-length ATAPI PIO transfers

Stanislaw Gruszka (3):
ide: allow to wrap interrupt handler
ide: add at91_ide driver
AT91: initialize Compact Flash on AT91SAM9263 cpu

arch/arm/mach-at91/at91sam9263_devices.c +105 -0
index 134af97..b7f2332 100644
@@ -347,6 +347,111 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
 void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
 #endif
 
+/* --------------------------------------------------------------------
+ *  Compact Flash (PCMCIA or IDE)
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \
+    defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE)
+
+static struct at91_cf_data cf0_data;
+
+static struct resource cf0_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_4,
+		.end	= AT91_CHIPSELECT_4 + SZ_256M - 1,
+		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
+	}
+};
+
+static struct platform_device cf0_device = {
+	.id		= 0,
+	.dev		= {
+				.platform_data	= &cf0_data,
+	},
+	.resource	= cf0_resources,
+	.num_resources	= ARRAY_SIZE(cf0_resources),
+};
+
+static struct at91_cf_data cf1_data;
+
+static struct resource cf1_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_5,
+		.end	= AT91_CHIPSELECT_5 + SZ_256M - 1,
+		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
+	}
+};
+
+static struct platform_device cf1_device = {
+	.id		= 1,
+	.dev		= {
+				.platform_data	= &cf1_data,
+	},
+	.resource	= cf1_resources,
+	.num_resources	= ARRAY_SIZE(cf1_resources),
+};
+
+void __init at91_add_device_cf(struct at91_cf_data *data)
+{
+	unsigned long ebi0_csa;
+	struct platform_device *pdev;
+
+	if (!data)
+		return;
+
+	/*
+	 * assign CS4 or CS5 to SMC with Compact Flash logic support,
+	 * we assume SMC timings are configured by board code,
+	 * except True IDE where timings are controlled by driver
+	 */
+	ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
+	switch (data->chipselect) {
+	case 4:
+		at91_set_A_periph(AT91_PIN_PD6, 0);  /* EBI0_NCS4/CFCS0 */
+		ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1;
+		cf0_data = *data;
+		pdev = &cf0_device;
+		break;
+	case 5:
+		at91_set_A_periph(AT91_PIN_PD7, 0);  /* EBI0_NCS5/CFCS1 */
+		ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2;
+		cf1_data = *data;
+		pdev = &cf1_device;
+		break;
+	default:
+		printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
+		       data->chipselect);
+		return;
+	}
+	at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa);
+
+	if (data->det_pin) {
+		at91_set_gpio_input(data->det_pin, 1);
+		at91_set_deglitch(data->det_pin, 1);
+	}
+
+	if (data->irq_pin) {
+		at91_set_gpio_input(data->irq_pin, 1);
+		at91_set_deglitch(data->irq_pin, 1);
+	}
+
+	if (data->vcc_pin)
+		/* initially off */
+		at91_set_gpio_output(data->vcc_pin, 0);
+
+	/* enable EBI controlled pins */
+	at91_set_A_periph(AT91_PIN_PD5, 1);  /* NWAIT */
+	at91_set_A_periph(AT91_PIN_PD8, 0);  /* CFCE1 */
+	at91_set_A_periph(AT91_PIN_PD9, 0);  /* CFCE2 */
+	at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */
+
+	pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf";
+	platform_device_register(pdev);
+}
+#else
+void __init at91_add_device_cf(struct at91_cf_data *data) {}
+#endif
 
 /* --------------------------------------------------------------------
  *  NAND / SmartMedia
arch/arm/mach-at91/include/mach/board.h +3 -0
index 0b3ae21..793fe7b 100644
@@ -56,6 +56,9 @@ struct at91_cf_data {
 	u8	vcc_pin;		/* power switching */
 	u8	rst_pin;		/* card reset */
 	u8	chipselect;		/* EBI Chip Select number */
+	u8	flags;
+#define AT91_CF_TRUE_IDE	0x01
+#define AT91_IDE_SWAP_A0_A2	0x02
 };
 extern void __init at91_add_device_cf(struct at91_cf_data *data);
 
drivers/ide/Kconfig +5 -0
index e072903..5ea3bfa 100644
@@ -721,6 +721,11 @@ config BLK_DEV_IDE_TX4939
 	depends on SOC_TX4939
 	select BLK_DEV_IDEDMA_SFF
 
+config BLK_DEV_IDE_AT91
+	tristate "Atmel AT91 (SAM9, CAP9, AT572D940HF) IDE support"
+	depends on ARM && ARCH_AT91 && !ARCH_AT91RM9200 && !ARCH_AT91X40
+	select IDE_TIMINGS
+
 config IDE_ARM
 	tristate "ARM IDE support"
 	depends on ARM && (ARCH_RPC || ARCH_SHARK)
drivers/ide/Makefile +1 -0
index d0e3d7d..1c326d9 100644
@@ -116,3 +116,4 @@ obj-$(CONFIG_BLK_DEV_IDE_AU1XXX)	+= au1xxx-ide.o
 
 obj-$(CONFIG_BLK_DEV_IDE_TX4938)	+= tx4938ide.o
 obj-$(CONFIG_BLK_DEV_IDE_TX4939)	+= tx4939ide.o
+obj-$(CONFIG_BLK_DEV_IDE_AT91)		+= at91_ide.o
drivers/ide/at91_ide.c new file +467 -0

467 lines not on this page · raw message

drivers/ide/ide-disk_proc.c +1 -1
index 1146f42..1f86dcb 100644
@@ -125,5 +125,5 @@ const struct ide_proc_devset ide_disk_settings[] = {
 	IDE_PROC_DEVSET(multcount,	0,    16),
 	IDE_PROC_DEVSET(nowerr,		0,     1),
 	IDE_PROC_DEVSET(wcache,		0,     1),
-	{ 0 },
+	{ NULL },
 };
drivers/ide/ide-floppy_proc.c +1 -1
index 3ec762c..fcd4d81 100644
@@ -29,5 +29,5 @@ const struct ide_proc_devset ide_floppy_settings[] = {
 	IDE_PROC_DEVSET(bios_head, 0,  255),
 	IDE_PROC_DEVSET(bios_sect, 0,   63),
 	IDE_PROC_DEVSET(ticks,	   0,  255),
-	{ 0 },
+	{ NULL },
 };
drivers/ide/ide-io.c +2 -1
index 9ee51ad..a9a6c20 100644
@@ -908,7 +908,7 @@ void ide_timer_expiry (unsigned long data)
 	ide_drive_t	*uninitialized_var(drive);
 	ide_handler_t	*handler;
 	unsigned long	flags;
-	unsigned long	wait = -1;
+	int		wait = -1;
 	int		plug_device = 0;
 
 	spin_lock_irqsave(&hwif->lock, flags);
@@ -1162,6 +1162,7 @@ out_early:
 
 	return irq_ret;
 }
+EXPORT_SYMBOL_GPL(ide_intr);
 
 /**
  *	ide_do_drive_cmd	-	issue IDE special command
drivers/ide/ide-iops.c +2 -0
index 753b92e..b1892bd 100644
@@ -315,6 +315,8 @@ void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf,
 	u8 io_32bit = drive->io_32bit;
 	u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
 
+	len++;
+
 	if (io_32bit) {
 		unsigned long uninitialized_var(flags);
 
drivers/ide/ide-probe.c +6 -1
index ce0818a..ee8e3e7 100644
@@ -950,6 +950,7 @@ static int ide_port_setup_devices(ide_hwif_t *hwif)
 static int init_irq (ide_hwif_t *hwif)
 {
 	struct ide_io_ports *io_ports = &hwif->io_ports;
+	irq_handler_t irq_handler;
 	int sa = 0;
 
 	mutex_lock(&ide_cfg_mtx);
@@ -959,6 +960,10 @@ static int init_irq (ide_hwif_t *hwif)
 	hwif->timer.function = &ide_timer_expiry;
 	hwif->timer.data = (unsigned long)hwif;
 
+	irq_handler = hwif->host->irq_handler;
+	if (irq_handler == NULL)
+		irq_handler = ide_intr;
+
 #if defined(__mc68000__)
 	sa = IRQF_SHARED;
 #endif /* __mc68000__ */
@@ -969,7 +974,7 @@ static int init_irq (ide_hwif_t *hwif)
 	if (io_ports->ctl_addr)
 		hwif->tp_ops->set_irq(hwif, 1);
 
-	if (request_irq(hwif->irq, &ide_intr, sa, hwif->name, hwif))
+	if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
 		goto out_up;
 
 	if (!hwif->rqsize) {
drivers/ide/ide-proc.c +1 -1
index 1d8978b..a7b9287 100644
@@ -231,7 +231,7 @@ static const struct ide_proc_devset ide_generic_settings[] = {
 	IDE_PROC_DEVSET(pio_mode, 0, 255),
 	IDE_PROC_DEVSET(unmaskirq, 0, 1),
 	IDE_PROC_DEVSET(using_dma, 0, 1),
-	{ 0 },
+	{ NULL },
 };
 
 static void proc_ide_settings_warn(void)
drivers/ide/ide-tape.c +1 -1
index bb450a7..4e6181c 100644
@@ -2166,7 +2166,7 @@ static const struct ide_proc_devset idetape_settings[] = {
 	__IDE_PROC_DEVSET(speed,	0, 0xffff, NULL, NULL),
 	__IDE_PROC_DEVSET(tdsc,		IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX,
 					mulf_tdsc, divf_tdsc),
-	{ 0 },
+	{ NULL },
 };
 #endif
 
include/linux/hdreg.h +0 -1
index c37e924..ed21bd3 100644
@@ -511,7 +511,6 @@ struct hd_driveid {
 	unsigned short	words69_70[2];	/* reserved words 69-70
 					 * future command overlap and queuing
 					 */
-	/* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
 	unsigned short	words71_74[4];	/* reserved words 71-74
 					 * for IDENTIFY PACKET DEVICE command
 					 */
include/linux/ide.h +1 -0
index fe235b6..e0cedfe 100644
@@ -866,6 +866,7 @@ struct ide_host {
 	unsigned int	n_ports;
 	struct device	*dev[2];
 	unsigned int	(*init_chipset)(struct pci_dev *);
+	irq_handler_t	irq_handler;
 	unsigned long	host_flags;
 	void		*host_priv;
 	ide_hwif_t	*cur_port;	/* for hosts requiring serialization */
#1 lore raw
Quoted 8 lines · Bartlomiej Zolnierkiewicz

Hi,

Two bug fixes (for odd-length ATAPI PIO transfers from Sergei Shtylyov and for insanely long DMA timeouts from Roel Kluin), some sparse fixes (from Hannes Eder) and a new driver for AT91 Static Memory Controller with Compact Flash True IDE Mode logic (from Stanislaw Gruszka, arch specific part has been acked by a platform maintainer).

Now with <linux/ata.h> change (add CFA identify words for the future use) from Sergei & Jeff.

Quoted 5 lines

Linus, please pull from:

master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/

to receive the following updates:

 arch/arm/mach-at91/at91sam9263_devices.c |  105 +++++++
 arch/arm/mach-at91/include/mach/board.h  |    3 +
 drivers/ide/Kconfig                      |    5 +
 drivers/ide/Makefile                     |    1 +
 drivers/ide/at91_ide.c                   |  467 ++++++++++++++++++++++++++++++
 drivers/ide/ide-disk_proc.c              |    2 +-
 drivers/ide/ide-floppy_proc.c            |    2 +-
 drivers/ide/ide-io.c                     |    3 +-
 drivers/ide/ide-iops.c                   |    2 +
 drivers/ide/ide-probe.c                  |    7 +-
 drivers/ide/ide-proc.c                   |    2 +-
 drivers/ide/ide-tape.c                   |    2 +-
 include/linux/ata.h                      |    2 +
 include/linux/hdreg.h                    |    1 -
 include/linux/ide.h                      |    1 +
 15 files changed, 598 insertions(+), 7 deletions(-)
 create mode 100644 drivers/ide/at91_ide.c

Bartlomiej Zolnierkiewicz (1):
remove stale comment from <linux/hdreg.h>

Hannes Eder (1):
ide: NULL noise: drivers/ide/ide-*.c

Roel Kluin (1):
ide: expiry() returns int, negative expiry() return values won't be noticed

Sergei Shtylyov (2):
ide-iops: fix odd-length ATAPI PIO transfers
ata: add CFA specific identify data words

Stanislaw Gruszka (3):
ide: allow to wrap interrupt handler
ide: add at91_ide driver
AT91: initialize Compact Flash on AT91SAM9263 cpu

[...]

include/linux/ata.h +2 -0
index 08a86d5..9a061ac 100644
@@ -89,6 +89,8 @@ enum {
 	ATA_ID_DLF		= 128,
 	ATA_ID_CSFO		= 129,
 	ATA_ID_CFA_POWER	= 160,
+	ATA_ID_CFA_KEY_MGMT	= 162,
+	ATA_ID_CFA_MODES	= 163,
 	ATA_ID_ROT_SPEED	= 217,
 	ATA_ID_PIO4		= (1 << 1),