libata: Add OCTEON Compact Flash driver.
cover libata: Add OCTEON Compact Flash driver.
Greetings ata hackers,
Linus recently merged support for the mips/Octeon cpu.
Please consider adding this driver for the Compact Flash system present on many of the OCTEON development boards.
This is a two part patch set, the first part adds a new column to the ata_timing table (for dmack_hold). This is used by the second patch which is the driver itself.
I will reply with the two patches.
Thanks,
David Daney (2):
libata: Add another column to the ata_timing table.
libata: New driver for OCTEON SOC Compact Flash interface (v6).
drivers/ata/Kconfig | 9 + drivers/ata/Makefile | 1 + drivers/ata/libata-core.c | 72 ++-- drivers/ata/pata_octeon_cf.c | 956 ++++++++++++++++++++++++++++++++++++++++++ include/linux/libata.h | 9 +- 5 files changed, 1009 insertions(+), 38 deletions(-) create mode 100644 drivers/ata/pata_octeon_cf.c
PATCH 1/2 libata: Add another column to the ata_timing table.
The forthcoming OCTEON SOC Compact Flash driver needs an additional timing value that was not available in the ata_timing table. I add a new column for dmack_hold time. The values were obtained from the Compact Flash specification Rev 4.1.
--- drivers/ata/libata-core.c | 72 +++++++++++++++++++++++---------------------- include/linux/libata.h | 9 ++++-- 2 files changed, 43 insertions(+), 38 deletions(-)
drivers/ata/libata-core.c +37 -35
@@ -3029,33 +3029,33 @@ int sata_set_spd(struct ata_link *link)*/ static const struct ata_timing ata_timing[] = { -/* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 960, 0 }, */ - {XFER_PIO_0 ,70 ,290 ,240 ,600 ,165 ,150 ,600 ,0 }, - {XFER_PIO_1 ,50 ,290 ,93 ,383 ,125 ,100 ,383 ,0 }, - {XFER_PIO_2 ,30 ,290 ,40 ,330 ,100 ,90 ,240 ,0 }, - {XFER_PIO_3 ,30 ,80 ,70 ,180 ,80 ,70 ,180 ,0 }, - {XFER_PIO_4 ,25 ,70 ,25 ,120 ,70 ,25 ,120 ,0 }, - {XFER_PIO_5 ,15 ,65 ,25 ,100 ,65 ,25 ,100 ,0 }, - {XFER_PIO_6 ,10 ,55 ,20 ,80 ,55 ,20 ,80 ,0 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void ata_timing_quantize (const struct ata_timing *t,struct ata_timing *q,int T ,int UT ) { - q->setup =EZ (t->setup *1000 ,T ); - q->act8b =EZ (t->act8b *1000 ,T ); - q->rec8b =EZ (t->rec8b *1000 ,T ); - q->cyc8b =EZ (t->cyc8b *1000 ,T ); - q->active =EZ (t->active *1000 ,T ); - q->recover =EZ (t->recover *1000 ,T ); - q->cycle =EZ (t->cycle *1000 ,T ); - q->udma =EZ (t->udma *1000 ,UT ); + q->setup =EZ (t->setup *1000 ,T ); + q->act8b =EZ (t->act8b *1000 ,T ); + q->rec8b =EZ (t->rec8b *1000 ,T ); + q->cyc8b =EZ (t->cyc8b *1000 ,T ); + q->active =EZ (t->active *1000 ,T ); + q->recover =EZ (t->recover *1000 ,T ); + q->dmack_hold =EZ (t->dmack_hold *1000 ,T ); + q->cycle =EZ (t->cycle *1000 ,T ); + q->udma =EZ (t->udma *1000 ,UT ); } void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
@@ -3084,6 +3085,7 @@ void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,if (what &ATA_TIMING_CYC8B ) m->cyc8b =max (a->cyc8b, b->cyc8b);if (what &ATA_TIMING_ACTIVE ) m->active =max (a->active, b->active);if (what &ATA_TIMING_RECOVER ) m->recover =max (a->recover, b->recover); +if (what &ATA_TIMING_DMACK_HOLD ) m->dmack_hold =max (a->dmack_hold, b->dmack_hold);if (what &ATA_TIMING_CYCLE ) m->cycle =max (a->cycle, b->cycle);if (what &ATA_TIMING_UDMA ) m->udma =max (a->udma, b->udma); }
include/linux/libata.h +6 -3
@@ -401,12 +401,14 @@ enum {ATA_TIMING_CYC8B ,ATA_TIMING_ACTIVE = (1 <<4 ),ATA_TIMING_RECOVER = (1 <<5 ), -ATA_TIMING_CYCLE = (1 <<6 ), -ATA_TIMING_UDMA = (1 <<7 ), +ATA_TIMING_DMACK_HOLD = (1 <<6 ), +ATA_TIMING_CYCLE = (1 <<7 ), +ATA_TIMING_UDMA = (1 <<8 ),ATA_TIMING_ALL =ATA_TIMING_SETUP |ATA_TIMING_ACT8B |ATA_TIMING_REC8B |ATA_TIMING_CYC8B |ATA_TIMING_ACTIVE |ATA_TIMING_RECOVER | - ATA_TIMING_CYCLE | ATA_TIMING_UDMA, +ATA_TIMING_DMACK_HOLD |ATA_TIMING_CYCLE | + ATA_TIMING_UDMA, }; enum ata_xfer_mask {
@@ -866,6 +868,7 @@ struct ata_timing {unsigned short cyc8b;/* t0 for 8-bit I/O */ unsigned short active;/* t2 or tD */ unsigned short recover;/* t2i or tK */ +unsigned short dmack_hold;/* tj */ unsigned short cycle;/* t0 */ unsigned short udma;/* t2CYCTYP/2 */ };
Signature · 1 line
1.5.6.6
PATCH 2/2 libata: New driver for OCTEON SOC Compact Flash interface (v6).
In reply to David DaneyCavium OCTEON processor support was recently merged, so now we have this CF driver for your consideration.
Most OCTEON variants have *no* DMA or interrupt support on the CF interface so for these, only PIO is supported. Although if DMA is available, we do take advantage of it.
This sixth version is essentially unchanged from the previous. Other than this patch commentary, I changed the type of several local variables from 'unsigned int' to 'int'
Thanks,
--- drivers/ata/Kconfig | 9 + drivers/ata/Makefile | 1 + drivers/ata/pata_octeon_cf.c | 956 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 966 insertions(+), 0 deletions(-) create mode 100644 drivers/ata/pata_octeon_cf.c
drivers/ata/Kconfig +9 -0
@@ -698,6 +698,15 @@ config PATA_IXP4XX_CF If unsure, say N. +config PATA_OCTEON_CF + tristate "OCTEON Boot Bus Compact Flash support" + depends on CPU_CAVIUM_OCTEON + help + This option enables a polled compact flash driver for use with + compact flash cards attached to the OCTEON boot bus. + + If unsure, say N. + config PATA_SCC tristate "Toshiba's Cell Reference Set IDE support" depends on PCI && PPC_CELLEB
drivers/ata/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o obj-$(CONFIG_PATA_SCC) += pata_scc.o obj-$(CONFIG_PATA_SCH) += pata_sch.o obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o +obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o
drivers/ata/pata_octeon_cf.c new file +956 -0
956 lines not on this page · raw message
Signature · 1 line
1.5.6.6
Re: [PATCH 2/2] libata: New driver for OCTEON SOC Compact Flash interface (v6).
drivers/ata/pata_octeon_cf.c line 79
Quoted 1 line
drivers/ata/pata_octeon_cf.c new file +1
-0+ reg_cfg.s.orbit =0 ;/* Don't combine with previos region */
previous ...
drivers/ata/pata_octeon_cf.c line 786
Quoted 4 lines
drivers/ata/pata_octeon_cf.c new file +4
-0+static unsigned int octeon_cf_qc_issue(struct ata_queued_cmd *qc) + case ATAPI_PROT_DMA: + dev_err(ap->dev, "Error, ATAPI not supported\n"); + BUG();
Looks as if you should also have a check_atapi_dma function that always returns non zero (or a mode filter for atapi -> pio)
Looks good to me.