Skip to contentSkip to conversation

add pata_arasan_cf support

PATCH Superseded Viresh Kumar 3 participants 6 messages Feb 22, 2011 – Mar 14, 2011

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

v3 cover add pata_arasan_cf support

This patch series adds
- ata_sff_queue_work() & ata_sff_queue_delayed_work()
- add support for arasan compact flash controller.

Changes Since V2:
- arasan_cf_error_handler declared to cancel scheduled work.
- modified .sg_tablesize & .dma_boundary in arasan_cf_sht.
- lines over 80 columns broken at more logical places.

Changes Since V1:
- add separate patch to introduce ata_sff_queue_work & ata_sff_queue_delayed_work
- remove arasan cf drivers workqueue.
- remove drivers/ata/pata_arasan_cf.h and put register definitions in pata_arasan_cf.c
- take ap->lock and host->lock at relevant places.
- use bool for variables which can have value 0 or 1.
- remove bmdma part and override freeze, qc_issue routines.
- introduce concept of delayed_work if altstatus reg reads ATA_BUSY after =
DMA
xfer are over.

Viresh Kumar (2):
libata-sff: add ata_sff_queue_work() & ata_sff_queue_delayed_work()
pata_arasan_cf: Adding support for arasan compact flash host
controller

 MAINTAINERS                         |    7 +
 drivers/ata/Kconfig                 |    6 +
 drivers/ata/Makefile                |    1 +
 drivers/ata/libata-sff.c            |   15 +-
 drivers/ata/pata_arasan_cf.c        |  957 +++++++++++++++++++++++++++++++++++
 include/linux/libata.h              |    3 +
 include/linux/pata_arasan_cf_data.h |   47 ++
 7 files changed, 1034 insertions(+), 2 deletions(-)
 create mode 100644 drivers/ata/pata_arasan_cf.c
 create mode 100644 include/linux/pata_arasan_cf_data.h
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH RESEND 1/2 libata-sff: add ata_sff_queue_work() & ata_sff_queue_delayed_work()

This patch adds ata_sff_queue_work() & ata_sff_queue_delayed_work() routine in libata-sff.c file. This routine can be used by ata drivers to use ata_sff_wq.

---
 drivers/ata/libata-sff.c |   15 +++++++++++++--
 include/linux/libata.h   |    3 +++
 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/ata/libata-sff.c +13 -2
index 484697f..52f13ea 100644
@@ -1302,6 +1302,18 @@ fsm_start:
 }
 EXPORT_SYMBOL_GPL(ata_sff_hsm_move);
 
+void ata_sff_queue_work(struct work_struct *work)
+{
+	queue_work(ata_sff_wq, work);
+}
+EXPORT_SYMBOL_GPL(ata_sff_queue_work);
+
+void ata_sff_queue_delayed_work(struct delayed_work *dwork, unsigned long delay)
+{
+	queue_delayed_work(ata_sff_wq, dwork, delay);
+}
+EXPORT_SYMBOL_GPL(ata_sff_queue_delayed_work);
+
 void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay)
 {
 	struct ata_port *ap = link->ap;
@@ -1311,8 +1323,7 @@ void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay)
 	ap->sff_pio_task_link = link;
 
 	/* may fail if ata_sff_flush_pio_task() in progress */
-	queue_delayed_work(ata_sff_wq, &ap->sff_pio_task,
-			   msecs_to_jiffies(delay));
+	ata_sff_queue_delayed_work(&ap->sff_pio_task, msecs_to_jiffies(delay));
 }
 EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task);
 
include/linux/libata.h +3 -0
index d947b12..9ac7f0a 100644
@@ -1615,6 +1615,9 @@ extern void ata_sff_irq_on(struct ata_port *ap);
 extern void ata_sff_irq_clear(struct ata_port *ap);
 extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
 			    u8 status, int in_wq);
+extern void ata_sff_queue_work(struct work_struct *work);
+extern void ata_sff_queue_delayed_work(struct delayed_work *dwork,
+		unsigned long delay);
 extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay);
 extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
 extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
Signature · 1 line
1.7.2.2
#2 lore raw

Re: [PATCH V1 resend 1/2] libata-sff: add ata_sff_queue_work() & ata_sff_queue_delayed_work()

Quoted 5 lines · Viresh Kumar

This patch adds ata_sff_queue_work()& ata_sff_queue_delayed_work() routine in libata-sff.c file. This routine can be used by ata drivers to use ata_sff_wq.

applied 1-2

#3 lore raw

PATCH v3 2/2 pata_arasan_cf: Adding support for arasan compact flash host controller

In reply to Viresh Kumar

The Arasan CompactFlash Device Controller has three basic modes of
operation: PC card ATA using I/O mode, PC card ATA using memory mode, PC card ATA using true IDE modes.

Currently driver supports only True IDE mode.

---
 MAINTAINERS                         |    7 +
 drivers/ata/Kconfig                 |    6 +
 drivers/ata/Makefile                |    1 +
 drivers/ata/pata_arasan_cf.c        |  957 +++++++++++++++++++++++++++++++++++
 include/linux/pata_arasan_cf_data.h |   47 ++
 5 files changed, 1018 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ata/pata_arasan_cf.c
 create mode 100644 include/linux/pata_arasan_cf_data.h
MAINTAINERS +7 -0
index 916f561..98bc389 100644
@@ -485,6 +485,13 @@ S:	Maintained
 F:	drivers/net/appletalk/
 F:	net/appletalk/
 
+ARASAN COMPACT FLASH PATA CONTROLLER
+M:	Viresh Kumar <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	include/linux/pata_arasan_cf_data.h
+F:	drivers/ata/pata_arasan_cf.c
+
 ARC FRAMEBUFFER DRIVER
 M:	Jaya Kumar <[email protected]>
 S:	Maintained
drivers/ata/Kconfig +6 -0
index 36e2319..5dd1e4c 100644
@@ -283,6 +283,12 @@ config PATA_AMD
 
 	  If unsure, say N.
 
+config PATA_ARASAN_CF
+	tristate "ARASAN CompactFlash PATA Controller Support"
+	select DMA_ENGINE
+	help
+	  Say Y here to support the ARASAN CompactFlash PATA controller
+
 config PATA_ARTOP
 	tristate "ARTOP 6210/6260 PATA support"
 	depends on PCI
drivers/ata/Makefile +1 -0
index 2b67c90..0da42cb 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_SATA_DWC)		+= sata_dwc_460ex.o
 
 # SFF w/ custom DMA
 obj-$(CONFIG_PDC_ADMA)		+= pdc_adma.o
+obj-$(CONFIG_PATA_ARASAN_CF)	+= pata_arasan_cf.o
 obj-$(CONFIG_PATA_OCTEON_CF)	+= pata_octeon_cf.o
 obj-$(CONFIG_SATA_QSTOR)	+= sata_qstor.o
 obj-$(CONFIG_SATA_SX4)		+= sata_sx4.o
drivers/ata/pata_arasan_cf.c new file +957 -0

957 lines not on this page · raw message

include/linux/pata_arasan_cf_data.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#4 lore raw

Re: [PATCH V3 2/2] pata_arasan_cf: Adding support for arasan compact flash host controller

Quoted 7 lines · Viresh Kumar

The Arasan CompactFlash Device Controller has three basic modes of
operation: PC card ATA using I/O mode, PC card ATA using memory mode, PC card ATA using true IDE modes.

Currently driver supports only True IDE mode.

Looks mostly good to me now but just few more things.

drivers/ata/pata_arasan_cf.c line 371

Quoted 10 lines
drivers/ata/pata_arasan_cf.c new file +10 -0
+static inline void dma_complete(struct arasan_cf_dev *acdev)
+{
+	struct ata_queued_cmd *qc = acdev->qc;
+
+	acdev->qc = NULL;
+	ata_sff_interrupt(acdev->irq, acdev->host);
+
+	if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol))
+		ata_ehi_push_desc(&qc->ap->link.eh_info, "DMA Failed: Timeout");
+}

ata_ehi_push_desc() needs to be called under host lock. In case I missed other places, all functions which modify port/host states need to be called under host lock. Please make sure they are.

drivers/ata/pata_arasan_cf.c line 648

Quoted 8 lines
drivers/ata/pata_arasan_cf.c new file +8 -0
+void arasan_cf_error_handler(struct ata_port *ap)
+{
+	struct arasan_cf_dev *acdev = ap->host->private_data;
+
+	cancel_work_sync(&acdev->work);
+	cancel_delayed_work_sync(&acdev->dwork);
+	return ata_sff_error_handler(ap);
+}

Please add some comments explaining what's going on with DMA processing as this driver is quite unusual. Here and in the issue path.

Quoted 2 lines
drivers/ata/pata_arasan_cf.c new file +2 -0
+static int __devinit arasan_cf_probe(struct platform_device *pdev)
+{

...

drivers/ata/pata_arasan_cf.c line 848

Quoted 1 line
drivers/ata/pata_arasan_cf.c new file +1 -0
+	ap->flags |= ATA_FLAG_PIO_POLLING;

Maybe ATA_FLAG_NO_ATAPI too?

Thanks.

Signature · 1 line
tejun
#5 lore raw

Re: [PATCH V3 2/2] pata_arasan_cf: Adding support for arasan compact flash host controller

Quoted 16 lines · Tejun Heo

drivers/ata/pata_arasan_cf.c line 371

Quoted 10 lines · Viresh Kumar
drivers/ata/pata_arasan_cf.c new file +10 -0
+static inline void dma_complete(struct arasan_cf_dev *acdev)
+{
+	struct ata_queued_cmd *qc = acdev->qc;
+
+	acdev->qc = NULL;
+	ata_sff_interrupt(acdev->irq, acdev->host);
+
+	if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol))
+		ata_ehi_push_desc(&qc->ap->link.eh_info, "DMA Failed: Timeout");
+}

ata_ehi_push_desc() needs to be called under host lock. In case I missed other places, all functions which modify port/host states need to be called under host lock. Please make sure they are.

Ok. Will do that. I have checked other places, lock was missing only at this place.

Quoted 4 lines
Quoted 4 lines
drivers/ata/pata_arasan_cf.c new file +4 -0
+void arasan_cf_error_handler(struct ata_port *ap)
+{
+	struct arasan_cf_dev *acdev = ap->host->private_data;
+
Quoted 9 lines

drivers/ata/pata_arasan_cf.c line 648

Quoted 4 lines
drivers/ata/pata_arasan_cf.c new file +4 -0
+	cancel_work_sync(&acdev->work);
+	cancel_delayed_work_sync(&acdev->dwork);
+	return ata_sff_error_handler(ap);
+}

Please add some comments explaining what's going on with DMA processing as this driver is quite unusual. Here and in the issue path.

Will do that.

Quoted 7 lines
Quoted 2 lines
drivers/ata/pata_arasan_cf.c new file +2 -0
+static int __devinit arasan_cf_probe(struct platform_device *pdev)
+{

...

drivers/ata/pata_arasan_cf.c line 848

Quoted 1 line
drivers/ata/pata_arasan_cf.c new file +1 -0
+	ap->flags |= ATA_FLAG_PIO_POLLING;

Maybe ATA_FLAG_NO_ATAPI too?

Yes.

Signature · 1 line
viresh