Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1272027 > unrolled thread
| Started by | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| First post | 2015-11-18 10:20 +0100 |
| Last post | 2015-12-09 13:20 +0100 |
| Articles | 20 on this page of 80 — 6 participants |
Back to article view | Back to linux.kernel
[PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-18 10:20 +0100
[PATCH 04/71] ncr5380: Remove more pointless macros Finn Thain <fthain@telegraphics.com.au> - 2015-11-18 10:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-18 12:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-19 03:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Michael Schmitz <schmitzmic@gmail.com> - 2015-11-19 04:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-19 08:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 00:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 02:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 08:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Christoph Hellwig <hch@infradead.org> - 2015-11-20 08:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 09:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 10:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Christoph Hellwig <hch@infradead.org> - 2015-11-20 11:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 12:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Christoph Hellwig <hch@infradead.org> - 2015-11-20 12:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 12:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Geert Uytterhoeven <geert@linux-m68k.org> - 2015-11-20 13:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 13:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 08:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 19:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-21 03:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-21 14:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-22 00:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-22 00:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 00:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-24 02:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 09:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-24 10:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 13:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 19:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 22:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-25 03:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-25 10:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-25 13:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-26 00:10 +0100
[PATCH 72/71] ncr5380: Fix pseudo-DMA Ondrej Zary <linux@rainbow-software.org> - 2015-11-25 22:40 +0100
[RFC PATCH 73/71] ncr5380: Use runtime register mapping Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 10:50 +0100
Re: [RFC PATCH 73/71] ncr5380: Use runtime register mapping Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 13:00 +0100
[RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 10:50 +0100
Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 13:00 +0100
Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 13:10 +0100
Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Ondrej Zary <linux@rainbow-software.org> - 2015-11-30 14:50 +0100
Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-12-06 04:30 +0100
[RFC PATCH 75/71] ncr5380: Remove FLAG_DTC3181E Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 11:10 +0100
Re: [RFC PATCH 75/71] ncr5380: Remove FLAG_DTC3181E Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 06:00 +0100
[RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Ondrej Zary <linux@rainbow-software.org> - 2015-12-04 00:10 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Julian Calaby <julian.calaby@gmail.com> - 2015-12-04 01:20 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Finn Thain <fthain@telegraphics.com.au> - 2015-12-04 09:40 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Julian Calaby <julian.calaby@gmail.com> - 2015-12-05 02:40 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Finn Thain <fthain@telegraphics.com.au> - 2015-12-05 03:20 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Julian Calaby <julian.calaby@gmail.com> - 2015-12-05 03:40 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Finn Thain <fthain@telegraphics.com.au> - 2015-12-04 10:10 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Ondrej Zary <linux@rainbow-software.org> - 2015-12-04 10:40 +0100
Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips Finn Thain <fthain@telegraphics.com.au> - 2015-12-04 10:30 +0100
[RFC PATCH 77/71] ncr5380: Fix wait for 53C80 registers registers after PDMA Ondrej Zary <linux@rainbow-software.org> - 2015-12-04 00:10 +0100
[PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Ondrej Zary <linux@rainbow-software.org> - 2015-12-04 22:10 +0100
Re: [PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-12-06 04:50 +0100
[PATCH 73/71] ncr5380: Use runtime register mapping Ondrej Zary <linux@rainbow-software.org> - 2015-12-04 22:10 +0100
Re: [PATCH 73/71] ncr5380: Use runtime register mapping Finn Thain <fthain@telegraphics.com.au> - 2015-12-06 04:40 +0100
Re: [PATCH 73/71] ncr5380: Use runtime register mapping Geert Uytterhoeven <geert@linux-m68k.org> - 2015-12-06 09:50 +0100
[PATCH 76/71] ncr5380: Enable PDMA for DTC chips Ondrej Zary <linux@rainbow-software.org> - 2015-12-04 22:20 +0100
Re: [PATCH 76/71] ncr5380: Enable PDMA for DTC chips Finn Thain <fthain@telegraphics.com.au> - 2015-12-06 04:50 +0100
Re: [PATCH 76/71] ncr5380: Enable PDMA for DTC chips Ondrej Zary <linux@rainbow-software.org> - 2015-12-06 23:50 +0100
[RFC PATCH 78/71] ncr5380: Add support for HP 53C400A-based cards (C2502) Ondrej Zary <linux@rainbow-software.org> - 2015-12-05 22:20 +0100
Re: [RFC PATCH 78/71] ncr5380: Add support for HP 53C400A-based cards (C2502) Finn Thain <fthain@telegraphics.com.au> - 2015-12-06 04:40 +0100
[PATCH v2 74/71] ncr5380: Enable PDMA for NCR53C400A Ondrej Zary <linux@rainbow-software.org> - 2015-12-06 23:30 +0100
Re: [PATCH v2 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-12-08 03:10 +0100
Re: [PATCH v2 74/71] ncr5380: Enable PDMA for NCR53C400A Ondrej Zary <linux@rainbow-software.org> - 2015-12-09 14:40 +0100
Re: [PATCH v2 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-12-11 00:40 +0100
[PATCH v2 73/71] ncr5380: Use runtime register mapping Ondrej Zary <linux@rainbow-software.org> - 2015-12-06 23:30 +0100
[PATCH v2 76/71] ncr5380: Enable PDMA for DTC chips Ondrej Zary <linux@rainbow-software.org> - 2015-12-07 00:00 +0100
[PATCH v2 77/71] ncr5380: Fix wait for 53C80 registers registers after PDMA Ondrej Zary <linux@rainbow-software.org> - 2015-12-07 00:20 +0100
Re: [PATCH v2 77/71] ncr5380: Fix wait for 53C80 registers registers after PDMA Finn Thain <fthain@telegraphics.com.au> - 2015-12-07 04:20 +0100
Re: [PATCH v2 77/71] ncr5380: Fix wait for 53C80 registers registers after PDMA Ondrej Zary <linux@rainbow-software.org> - 2015-12-07 09:10 +0100
[PATCH v3 76/71] ncr5380: Enable PDMA for DTC chips Ondrej Zary <linux@rainbow-software.org> - 2015-12-07 00:30 +0100
[PATCH v2 78/71] ncr5380: Add support for HP 53C400A-based cards (C2502) Ondrej Zary <linux@rainbow-software.org> - 2015-12-08 09:00 +0100
Re: [PATCH v2 78/71] ncr5380: Add support for HP 53C400A-based cards (C2502) Finn Thain <fthain@telegraphics.com.au> - 2015-12-08 12:50 +0100
Re: [PATCH v2 78/71] ncr5380: Add support for HP 53C400A-based cards (C2502) Ondrej Zary <linux@rainbow-software.org> - 2015-12-09 12:40 +0100
Re: [PATCH v2 78/71] ncr5380: Add support for HP 53C400A-based cards (C2502) Finn Thain <fthain@telegraphics.com.au> - 2015-12-11 00:40 +0100
[PATCH v3 78/71] ncr5380: Add support for HP 53C400A-based cards (C2502) Ondrej Zary <linux@rainbow-software.org> - 2015-12-09 13:20 +0100
Page 3 of 4 — ← Prev page 1 2 [3] 4 Next page →
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-11-30 13:10 +0100 |
| Subject | Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A |
| Message-ID | <qAvrk-3rH-15@gated-at.bofh.it> |
| In reply to | #1279310 |
On Sun, 29 Nov 2015, Ondrej Zary wrote: > Add I/O register mapping for NCR53C400A and enable PDMA mode to > improve performance and fix non-working IRQ. > Is CONFIG_SCSI_GENERIC_NCR53C400 is still needed? Can the driver be fully configured at runtime now? > Tested with HP C2502 (and user-space enabler). > It would be nice if the enabler was documented. Documentation/scsi/g_NCR5380.txt might be a good place for that. That file could perhaps be updated (?) Certainly obsolete and misleading information should be removed if you see any. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-11-30 14:50 +0100 |
| Subject | Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A |
| Message-ID | <qAx07-4hY-27@gated-at.bofh.it> |
| In reply to | #1279814 |
On Monday 30 November 2015, Finn Thain wrote: > > On Sun, 29 Nov 2015, Ondrej Zary wrote: > > > Add I/O register mapping for NCR53C400A and enable PDMA mode to > > improve performance and fix non-working IRQ. > > > > Is CONFIG_SCSI_GENERIC_NCR53C400 is still needed? Can the driver be fully > configured at runtime now? Things depending on CONFIG_SCSI_GENERIC_NCR53C400: #ifdef CONFIG_SCSI_GENERIC_NCR53C400 #define PSEUDO_DMA #endif Defining PSEUDO_DMA should not break anything, just makes code bigger a bit. We can probably just define it always in g_NCR5380.c. This looks weird. I don't have any card with a BIOS to test. #ifdef CONFIG_SCSI_GENERIC_NCR53C400 #define BIOSPARAM #define NCR5380_BIOSPARAM generic_NCR5380_biosparam #else #define NCR5380_BIOSPARAM NULL #endif This looks very wrong and should be done at runtime: #ifdef CONFIG_SCSI_GENERIC_NCR53C400 #define NCR5380_region_size 16 #else #define NCR5380_region_size 8 #endif > > Tested with HP C2502 (and user-space enabler). > > > > It would be nice if the enabler was documented. > Documentation/scsi/g_NCR5380.txt might be a good place for that. That file > could perhaps be updated (?) Certainly obsolete and misleading information > should be removed if you see any. I'll integrate the enabler into the driver. It's like "wakeup sequence for the NCR53C400A and DTC3181E */" in g_NCR5380.c, only the magic numbers are different. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-06 04:30 +0100 |
| Subject | Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A |
| Message-ID | <qCybo-1tM-5@gated-at.bofh.it> |
| In reply to | #1279874 |
On Mon, 30 Nov 2015, Ondrej Zary wrote: > On Monday 30 November 2015, Finn Thain wrote: > > > > On Sun, 29 Nov 2015, Ondrej Zary wrote: > > > > > Add I/O register mapping for NCR53C400A and enable PDMA mode to > > > improve performance and fix non-working IRQ. > > > > > > > Is CONFIG_SCSI_GENERIC_NCR53C400 is still needed? Can the driver be fully > > configured at runtime now? > > Things depending on CONFIG_SCSI_GENERIC_NCR53C400: > > #ifdef CONFIG_SCSI_GENERIC_NCR53C400 > #define PSEUDO_DMA > #endif > > Defining PSEUDO_DMA should not break anything, just makes code bigger a > bit. We can probably just define it always in g_NCR5380.c. Based on your test results, I think so. > > > This looks weird. I don't have any card with a BIOS to test. > #ifdef CONFIG_SCSI_GENERIC_NCR53C400 > #define BIOSPARAM > #define NCR5380_BIOSPARAM generic_NCR5380_biosparam > #else > #define NCR5380_BIOSPARAM NULL > #endif > I'm guessing that when you said "weird", you meant that it is weird to tie BIOSPARAM to CONFIG_SCSI_GENERIC_NCR53C400, because a 53C400-compatible device does not imply a card ROM, and generic_NCR5380_biosparam() does not require any particular device... Regardless, the Kconfig help text doesn't say anything about bios_param, so I think that the weirdness you referred to should not prevent removal of CONFIG_SCSI_GENERIC_NCR53C400. I'm happy to let users manually #define BIOSPARAM if the default scsicam_bios_param() doesn't work. See patch below for example. But if scsicam_bios_param() is adequate, or if generic_NCR5380_biosparam() is inadequate, then we should also remove generic_NCR5380_biosparam(), NCR5380_BIOSPARAM and BIOSPARAM. I'm not sufficiently familiar with this platform to say one way or the other. > > This looks very wrong and should be done at runtime: > #ifdef CONFIG_SCSI_GENERIC_NCR53C400 > #define NCR5380_region_size 16 > #else > #define NCR5380_region_size 8 > #endif > I'll have to leave that fix to you. Thanks. Index: linux/drivers/scsi/Kconfig =================================================================== --- linux.orig/drivers/scsi/Kconfig 2015-12-06 12:29:36.000000000 +1100 +++ linux/drivers/scsi/Kconfig 2015-12-06 13:47:50.000000000 +1100 @@ -816,17 +816,6 @@ config SCSI_GENERIC_NCR5380_MMIO To compile this driver as a module, choose M here: the module will be called g_NCR5380_mmio. -config SCSI_GENERIC_NCR53C400 - bool "Enable NCR53c400 extensions" - depends on SCSI_GENERIC_NCR5380 - help - This enables certain optimizations for the NCR53c400 SCSI cards. - You might as well try it out. Note that this driver will only probe - for the Trantor T130B in its default configuration; you might have - to pass a command line option to the kernel at boot time if it does - not detect your card. See the file - <file:Documentation/scsi/g_NCR5380.txt> for details. - config SCSI_IPS tristate "IBM ServeRAID support" depends on PCI && SCSI Index: linux/drivers/scsi/g_NCR5380.c =================================================================== --- linux.orig/drivers/scsi/g_NCR5380.c 2015-12-06 12:31:23.000000000 +1100 +++ linux/drivers/scsi/g_NCR5380.c 2015-12-06 13:45:42.000000000 +1100 @@ -57,10 +57,7 @@ */ #define AUTOPROBE_IRQ - -#ifdef CONFIG_SCSI_GENERIC_NCR53C400 #define PSEUDO_DMA -#endif #include <asm/io.h> #include <linux/blkdev.h> @@ -506,6 +503,9 @@ generic_NCR5380_biosparam(struct scsi_de ip[2] = capacity >> 11; return 0; } +#define NCR5380_BIOSPARAM generic_NCR5380_biosparam +#else +#define NCR5380_BIOSPARAM NULL #endif #ifdef PSEUDO_DMA Index: linux/drivers/scsi/g_NCR5380.h =================================================================== --- linux.orig/drivers/scsi/g_NCR5380.h 2015-12-06 12:30:42.000000000 +1100 +++ linux/drivers/scsi/g_NCR5380.h 2015-12-06 13:47:12.000000000 +1100 @@ -14,13 +14,6 @@ #ifndef GENERIC_NCR5380_H #define GENERIC_NCR5380_H -#ifdef CONFIG_SCSI_GENERIC_NCR53C400 -#define BIOSPARAM -#define NCR5380_BIOSPARAM generic_NCR5380_biosparam -#else -#define NCR5380_BIOSPARAM NULL -#endif - #define __STRVAL(x) #x #define STRVAL(x) __STRVAL(x) @@ -31,11 +24,9 @@ #define NCR5380_map_name port #define NCR53C400_register_offset 0 -#ifdef CONFIG_SCSI_GENERIC_NCR53C400 -#define NCR5380_region_size 16 -#else -#define NCR5380_region_size 8 -#endif +// FIXME +// #define NCR5380_region_size 16 +// #define NCR5380_region_size 8 #define NCR5380_read(reg) \ inb(instance->io_port + (reg)) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-11-29 11:10 +0100 |
| Subject | [RFC PATCH 75/71] ncr5380: Remove FLAG_DTC3181E |
| Message-ID | <qA75D-4R5-13@gated-at.bofh.it> |
| In reply to | #1272027 |
The FLAG_DTC3181E is used to activate a work-around for arbitration lost
condition that these chips see when ICR is written during arbitration.
Move the ICR write (to set SEL and BSY) after the arbitration loss check
and remove FLAG_DTC3181E.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
Weird, we now have two consecutive checks for ICR_ARBITRATION_LOST and
do different things when they fail...
drivers/scsi/NCR5380.c | 23 +++++++++--------------
drivers/scsi/NCR5380.h | 1 -
drivers/scsi/atari_NCR5380.c | 23 +++++++++--------------
drivers/scsi/dmx3191d.c | 2 +-
drivers/scsi/g_NCR5380.c | 2 +-
5 files changed, 20 insertions(+), 31 deletions(-)
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index acb359a..b617f99 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -482,14 +482,13 @@ static void prepare_info(struct Scsi_Host *instance)
"base 0x%lx, irq %d, "
"can_queue %d, cmd_per_lun %d, "
"sg_tablesize %d, this_id %d, "
- "flags { %s%s%s%s}, "
+ "flags { %s%s%s}, "
"options { %s} ",
instance->hostt->name, instance->io_port, instance->n_io_port,
instance->base, instance->irq,
instance->can_queue, instance->cmd_per_lun,
instance->sg_tablesize, instance->this_id,
hostdata->flags & FLAG_NO_DMA_FIXUP ? "NO_DMA_FIXUP " : "",
- hostdata->flags & FLAG_DTC3181E ? "DTC3181E " : "",
hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "",
hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "",
#ifdef AUTOPROBE_IRQ
@@ -1078,18 +1077,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,
goto out;
}
- /* After/during arbitration, BSY should be asserted.
- * IBM DPES-31080 Version S31Q works now
- * Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman)
- */
- NCR5380_write(INITIATOR_COMMAND_REG,
- ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
-
- /* RvC: DTC3181E has some trouble with this so we simply removed it.
- * Seems to work with only Mustek scanner attached.
- */
- if (!(hostdata->flags & FLAG_DTC3181E) &&
- (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
+ if (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) {
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
dsprintk(NDEBUG_ARBITRATION, instance, "arbitration lost, negating SEL\n");
@@ -1097,6 +1085,13 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,
goto out;
}
+ /* After/during arbitration, BSY should be asserted.
+ * IBM DPES-31080 Version S31Q works now
+ * Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman)
+ */
+ NCR5380_write(INITIATOR_COMMAND_REG,
+ ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
+
/*
* Again, bus clear + bus settle time is 1.2us, however, this is
* a minimum so we'll udelay ceil(1.2)
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 0d8ec43..5092580 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -222,7 +222,6 @@
#define FLAG_NO_DMA_FIXUP 1 /* No DMA errata workarounds */
#define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */
-#define FLAG_DTC3181E 16 /* DTC3181E */
#define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */
#define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */
#define FLAG_TOSHIBA_DELAY 128 /* Allow for borken CD-ROMs */
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index d04374d..7640110 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -586,13 +586,12 @@ static void prepare_info(struct Scsi_Host *instance)
"base 0x%lx, irq %d, "
"can_queue %d, cmd_per_lun %d, "
"sg_tablesize %d, this_id %d, "
- "flags { %s%s%s}, "
+ "flags { %s%s}, "
"options { %s} ",
instance->hostt->name, instance->io_port, instance->n_io_port,
instance->base, instance->irq,
instance->can_queue, instance->cmd_per_lun,
instance->sg_tablesize, instance->this_id,
- hostdata->flags & FLAG_DTC3181E ? "DTC3181E " : "",
hostdata->flags & FLAG_TAGGED_QUEUING ? "TAGGED_QUEUING " : "",
hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "",
#ifdef DIFFERENTIAL
@@ -1279,18 +1278,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,
goto out;
}
- /* After/during arbitration, BSY should be asserted.
- * IBM DPES-31080 Version S31Q works now
- * Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman)
- */
- NCR5380_write(INITIATOR_COMMAND_REG,
- ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
-
- /* RvC: DTC3181E has some trouble with this so we simply removed it.
- * Seems to work with only Mustek scanner attached.
- */
- if (!(hostdata->flags & FLAG_DTC3181E) &&
- (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
+ if (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) {
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
dsprintk(NDEBUG_ARBITRATION, instance, "arbitration lost, negating SEL\n");
@@ -1298,6 +1286,13 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,
goto out;
}
+ /* After/during arbitration, BSY should be asserted.
+ * IBM DPES-31080 Version S31Q works now
+ * Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman)
+ */
+ NCR5380_write(INITIATOR_COMMAND_REG,
+ ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
+
/*
* Again, bus clear + bus settle time is 1.2us, however, this is
* a minimum so we'll udelay ceil(1.2)
diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c
index 3c60dfb..ddb4e61 100644
--- a/drivers/scsi/dmx3191d.c
+++ b/drivers/scsi/dmx3191d.c
@@ -92,7 +92,7 @@ static int dmx3191d_probe_one(struct pci_dev *pdev,
*/
shost->irq = NO_IRQ;
- error = NCR5380_init(shost, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
+ error = NCR5380_init(shost, FLAG_NO_PSEUDO_DMA);
if (error)
goto out_host_put;
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index c3abe48..fae4332 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -331,7 +331,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
ports = ncr_53c400a_ports;
break;
case BOARD_DTC3181E:
- flags = FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E;
+ flags = FLAG_NO_PSEUDO_DMA;
ports = dtc_3181e_ports;
break;
}
--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-11-30 06:00 +0100 |
| Subject | Re: [RFC PATCH 75/71] ncr5380: Remove FLAG_DTC3181E |
| Message-ID | <qAoJb-7o8-1@gated-at.bofh.it> |
| In reply to | #1279313 |
On Sun, 29 Nov 2015, Ondrej Zary wrote:
> The FLAG_DTC3181E is used to activate a work-around for arbitration lost
> condition that these chips see when ICR is written during arbitration.
>
> Move the ICR write (to set SEL and BSY) after the arbitration loss check
> and remove FLAG_DTC3181E.
The first test for ICR_ARBITRATION_LOST happens after the required
arbitration delay, 2.4 us. The second test for ICR_ARBITRATION_LOST
happens after ICR_ASSERT_SEL.
This second test seems to be pointless. It comes from the flow chart in
the NCR datasheet (see download link in patch 17). The spec does not
require this test but some 5380 devices may do. Who knows? It's almost
impossible to be sure, because it would mean losing a race with another
bus device right at the end of the arbitration delay (and we extend that
delay to 3 us anyway).
Certainly one can find other datasheets with sample code and flow charts
that don't do this second check. The reason is that ICR_ARBITRATION_LOST
can be triggered when SEL is asserted by any device, so it may be
triggered after we've won arbitration (because we then set ICR_ASSERT_SEL
ourselves in order to enter selection phase).
>
> ... Weird, we now have two consecutive checks for ICR_ARBITRATION_LOST
> and do different things when they fail...
They do different things because the second exit has to cleanup after the
ICR write.
I agree that it would be nice to remove the DTC3181E special case. It
would mean replacing patch 49.
The patch below is another version of your patch 75. It really needs to be
tested on all kinds of 5380 device, and if possible with a contested bus
(which would imply diconnection privileges, for which the driver still
requires that the chip has a working irq).
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-11-30 15:34:39.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-11-30 15:34:39.000000000 +1100
@@ -482,14 +482,13 @@ static void prepare_info(struct Scsi_Hos
"base 0x%lx, irq %d, "
"can_queue %d, cmd_per_lun %d, "
"sg_tablesize %d, this_id %d, "
- "flags { %s%s%s%s}, "
+ "flags { %s%s%s}, "
"options { %s} ",
instance->hostt->name, instance->io_port, instance->n_io_port,
instance->base, instance->irq,
instance->can_queue, instance->cmd_per_lun,
instance->sg_tablesize, instance->this_id,
hostdata->flags & FLAG_NO_DMA_FIXUP ? "NO_DMA_FIXUP " : "",
- hostdata->flags & FLAG_DTC3181E ? "DTC3181E " : "",
hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "",
hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "",
#ifdef AUTOPROBE_IRQ
@@ -1085,18 +1084,6 @@ static struct scsi_cmnd *NCR5380_select(
NCR5380_write(INITIATOR_COMMAND_REG,
ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
- /* RvC: DTC3181E has some trouble with this so we simply removed it.
- * Seems to work with only Mustek scanner attached.
- */
- if (!(hostdata->flags & FLAG_DTC3181E) &&
- (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
- NCR5380_write(MODE_REG, MR_BASE);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- dsprintk(NDEBUG_ARBITRATION, instance, "arbitration lost, negating SEL\n");
- spin_lock_irq(&hostdata->lock);
- goto out;
- }
-
/*
* Again, bus clear + bus settle time is 1.2us, however, this is
* a minimum so we'll udelay ceil(1.2)
Index: linux/drivers/scsi/NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/NCR5380.h 2015-11-30 15:34:36.000000000 +1100
+++ linux/drivers/scsi/NCR5380.h 2015-11-30 15:34:39.000000000 +1100
@@ -233,7 +233,6 @@
#define FLAG_NO_DMA_FIXUP 1 /* No DMA errata workarounds */
#define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */
-#define FLAG_DTC3181E 16 /* DTC3181E */
#define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */
#define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */
#define FLAG_TOSHIBA_DELAY 128 /* Allow for borken CD-ROMs */
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-11-30 15:34:39.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-11-30 15:34:39.000000000 +1100
@@ -586,13 +586,12 @@ static void prepare_info(struct Scsi_Hos
"base 0x%lx, irq %d, "
"can_queue %d, cmd_per_lun %d, "
"sg_tablesize %d, this_id %d, "
- "flags { %s%s%s}, "
+ "flags { %s%s}, "
"options { %s} ",
instance->hostt->name, instance->io_port, instance->n_io_port,
instance->base, instance->irq,
instance->can_queue, instance->cmd_per_lun,
instance->sg_tablesize, instance->this_id,
- hostdata->flags & FLAG_DTC3181E ? "DTC3181E " : "",
hostdata->flags & FLAG_TAGGED_QUEUING ? "TAGGED_QUEUING " : "",
hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "",
#ifdef DIFFERENTIAL
@@ -1286,18 +1285,6 @@ static struct scsi_cmnd *NCR5380_select(
NCR5380_write(INITIATOR_COMMAND_REG,
ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
- /* RvC: DTC3181E has some trouble with this so we simply removed it.
- * Seems to work with only Mustek scanner attached.
- */
- if (!(hostdata->flags & FLAG_DTC3181E) &&
- (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
- NCR5380_write(MODE_REG, MR_BASE);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- dsprintk(NDEBUG_ARBITRATION, instance, "arbitration lost, negating SEL\n");
- spin_lock_irq(&hostdata->lock);
- goto out;
- }
-
/*
* Again, bus clear + bus settle time is 1.2us, however, this is
* a minimum so we'll udelay ceil(1.2)
Index: linux/drivers/scsi/g_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/g_NCR5380.c 2015-11-30 15:34:39.000000000 +1100
+++ linux/drivers/scsi/g_NCR5380.c 2015-11-30 15:34:39.000000000 +1100
@@ -326,7 +326,7 @@ static int __init generic_NCR5380_detect
ports = ncr_53c400a_ports;
break;
case BOARD_DTC3181E:
- flags = FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E;
+ flags = FLAG_NO_PSEUDO_DMA;
ports = dtc_3181e_ports;
break;
}
Index: linux/drivers/scsi/dmx3191d.c
===================================================================
--- linux.orig/drivers/scsi/dmx3191d.c 2015-11-30 15:34:35.000000000 +1100
+++ linux/drivers/scsi/dmx3191d.c 2015-11-30 15:34:39.000000000 +1100
@@ -92,7 +92,7 @@ static int dmx3191d_probe_one(struct pci
*/
shost->irq = NO_IRQ;
- error = NCR5380_init(shost, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
+ error = NCR5380_init(shost, FLAG_NO_PSEUDO_DMA);
if (error)
goto out_host_put;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-12-04 00:10 +0100 |
| Subject | [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qBLaF-34j-3@gated-at.bofh.it> |
| In reply to | #1272027 |
Add I/O register mapping for DTC chips and enable PDMA mode.
These chips have 16-bit wide HOST BUFFER register (counter register at
offset 0x0d increments by 2 on each HOST BUFFER read).
Large PIO transfers crash at least the DTCT-436P chip (all reads result
in 0xFF) so this patch actually makes it work.
The chip also crashes when we bang the C400 host status register too
heavily after PDMA write - a small udelay is needed.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
# hdparm -t --direct /dev/sdb
/dev/sdb:
Timing O_DIRECT disk reads: 4 MB in 3.78 seconds = 1.06 MB/sec
drivers/scsi/NCR5380.h | 1 +
drivers/scsi/g_NCR5380.c | 47 +++++++++++++++++++++++-----------------------
2 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 5092580..e3b8149 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -222,6 +222,7 @@
#define FLAG_NO_DMA_FIXUP 1 /* No DMA errata workarounds */
#define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */
+#define FLAG_16BIT 16 /* 16-bit PDMA */
#define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */
#define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */
#define FLAG_TOSHIBA_DELAY 128 /* Allow for borken CD-ROMs */
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index fae4332..04f6c29 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -331,7 +331,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
ports = ncr_53c400a_ports;
break;
case BOARD_DTC3181E:
- flags = FLAG_NO_PSEUDO_DMA;
+ flags = FLAG_NO_DMA_FIXUP | FLAG_16BIT;
ports = dtc_3181e_ports;
break;
}
@@ -415,7 +415,8 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
hostdata->c400_blk_cnt = 1;
hostdata->c400_host_buf = 4;
}
- if (overrides[current_override].board == BOARD_NCR53C400A) {
+ if (overrides[current_override].board == BOARD_NCR53C400A ||
+ overrides[current_override].board == BOARD_DTC3181E) {
hostdata->c400_ctl_status = 9;
hostdata->c400_blk_cnt = 10;
hostdata->c400_host_buf = 8;
@@ -434,7 +435,8 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
goto out_unregister;
if (overrides[current_override].board == BOARD_NCR53C400 ||
- overrides[current_override].board == BOARD_NCR53C400A)
+ overrides[current_override].board == BOARD_NCR53C400A ||
+ overrides[current_override].board == BOARD_DTC3181E)
NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
NCR5380_maybe_reset_bus(instance);
@@ -561,11 +563,10 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY);
#ifndef SCSI_G_NCR5380_MEM
- {
- int i;
- for (i = 0; i < 128; i++)
- dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
- }
+ if (hostdata->flags & FLAG_16BIT)
+ insw(instance->io_port + hostdata->c400_host_buf, dst + start, 64);
+ else
+ insb(instance->io_port + hostdata->c400_host_buf, dst + start, 128);
#else
/* implies SCSI_G_NCR5380_MEM */
memcpy_fromio(dst + start,
@@ -582,11 +583,10 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
}
#ifndef SCSI_G_NCR5380_MEM
- {
- int i;
- for (i = 0; i < 128; i++)
- dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
- }
+ if (hostdata->flags & FLAG_16BIT)
+ insw(instance->io_port + hostdata->c400_host_buf, dst + start, 64);
+ else
+ insb(instance->io_port + hostdata->c400_host_buf, dst + start, 128);
#else
/* implies SCSI_G_NCR5380_MEM */
memcpy_fromio(dst + start,
@@ -645,10 +645,10 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; // FIXME - timeout
#ifndef SCSI_G_NCR5380_MEM
- {
- for (i = 0; i < 128; i++)
- NCR5380_write(hostdata->c400_host_buf, src[start + i]);
- }
+ if (hostdata->flags & FLAG_16BIT)
+ outsw(instance->io_port + hostdata->c400_host_buf, src + start, 64);
+ else
+ outsb(instance->io_port + hostdata->c400_host_buf, src + start, 128);
#else
/* implies SCSI_G_NCR5380_MEM */
memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
@@ -660,12 +660,11 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
if (blocks) {
while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; // FIXME - no timeout
-
#ifndef SCSI_G_NCR5380_MEM
- {
- for (i = 0; i < 128; i++)
- NCR5380_write(hostdata->c400_host_buf, src[start + i]);
- }
+ if (hostdata->flags & FLAG_16BIT)
+ outsw(instance->io_port + hostdata->c400_host_buf, src + start, 64);
+ else
+ outsb(instance->io_port + hostdata->c400_host_buf, src + start, 128);
#else
/* implies SCSI_G_NCR5380_MEM */
memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
@@ -685,8 +684,10 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
/* All documentation says to check for this. Maybe my hardware is too
* fast. Waiting for it seems to work fine! KLL
*/
- while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
+ while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ)) {
+ udelay(4); /* DTC436 chip hangs without this */
; // FIXME - no timeout
+ }
/*
* I know. i is certainly != 0 here but the loop is new. See previous
--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julian Calaby <julian.calaby@gmail.com> |
|---|---|
| Date | 2015-12-04 01:20 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qBMgq-3Ms-17@gated-at.bofh.it> |
| In reply to | #1283439 |
Hi Finn, Ondrej,
One small question:
On Fri, Dec 4, 2015 at 10:03 AM, Ondrej Zary <linux@rainbow-software.org> wrote:
> Add I/O register mapping for DTC chips and enable PDMA mode.
>
> These chips have 16-bit wide HOST BUFFER register (counter register at
> offset 0x0d increments by 2 on each HOST BUFFER read).
>
> Large PIO transfers crash at least the DTCT-436P chip (all reads result
> in 0xFF) so this patch actually makes it work.
>
> The chip also crashes when we bang the C400 host status register too
> heavily after PDMA write - a small udelay is needed.
>
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> ---
> # hdparm -t --direct /dev/sdb
>
> /dev/sdb:
> Timing O_DIRECT disk reads: 4 MB in 3.78 seconds = 1.06 MB/sec
>
>
> drivers/scsi/NCR5380.h | 1 +
> drivers/scsi/g_NCR5380.c | 47 +++++++++++++++++++++++-----------------------
> 2 files changed, 25 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
> index fae4332..04f6c29 100644
> --- a/drivers/scsi/g_NCR5380.c
> +++ b/drivers/scsi/g_NCR5380.c
> @@ -415,7 +415,8 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> hostdata->c400_blk_cnt = 1;
> hostdata->c400_host_buf = 4;
> }
> - if (overrides[current_override].board == BOARD_NCR53C400A) {
> + if (overrides[current_override].board == BOARD_NCR53C400A ||
> + overrides[current_override].board == BOARD_DTC3181E) {
These if statements are starting to get a bit long, would it make
sense to replace them with a flag or equivalent?
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-04 09:40 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qBU4j-h7-33@gated-at.bofh.it> |
| In reply to | #1283475 |
On Fri, 4 Dec 2015, Julian Calaby wrote:
> > - if (overrides[current_override].board == BOARD_NCR53C400A) {
> > + if (overrides[current_override].board == BOARD_NCR53C400A ||
> > + overrides[current_override].board == BOARD_DTC3181E) {
>
> These if statements are starting to get a bit long, would it make
> sense to replace them with a flag or equivalent?
To what end? Shorter lines? As in,
if (board_is_ncr53c400a || board_is_dtc3181e) {
/* ... */
}
I suppose that could be an improvement if new flags would entirely replace
the override.board struct member and the existing switch statement,
switch (overrides[current_override].board) {
/* ... */
}
Or maybe you meant testing a new flag something like this,
if (hostdata->ncr53c400_compatible) {
/* ... */
}
If your concern is the Don't Repeat Yourself rule, I'm not sure that new
flag would get tested more than once (?) And it would still have to be
assigned using an "objectionably" long expression, e.g.
hostdata->ncr53c400_compatible =
overrides[current_override].board == BOARD_NCR53C400 ||
overrides[current_override].board == BOARD_NCR53C400A ||
overrides[current_override].board == BOARD_DTC3181E;
Rather than add new flags, perhaps a 'switch' statement instead of an 'if'
statement would be shorter (if the size of the expression is the problem).
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julian Calaby <julian.calaby@gmail.com> |
|---|---|
| Date | 2015-12-05 02:40 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qC9Zn-24T-5@gated-at.bofh.it> |
| In reply to | #1283645 |
Hi Finn,
On Fri, Dec 4, 2015 at 7:38 PM, Finn Thain <fthain@telegraphics.com.au> wrote:
>
> On Fri, 4 Dec 2015, Julian Calaby wrote:
>
>> > - if (overrides[current_override].board == BOARD_NCR53C400A) {
>> > + if (overrides[current_override].board == BOARD_NCR53C400A ||
>> > + overrides[current_override].board == BOARD_DTC3181E) {
>>
>> These if statements are starting to get a bit long, would it make
>> sense to replace them with a flag or equivalent?
>
> To what end? Shorter lines? As in,
Pretty much, each expression is quite long and they seem to be growing
fairly rapidly as you and Ondrej discover similar boards.
>
> if (board_is_ncr53c400a || board_is_dtc3181e) {
> /* ... */
> }
>
> I suppose that could be an improvement if new flags would entirely replace
> the override.board struct member and the existing switch statement,
>
> switch (overrides[current_override].board) {
> /* ... */
> }
>
> Or maybe you meant testing a new flag something like this,
>
> if (hostdata->ncr53c400_compatible) {
> /* ... */
> }
>
> If your concern is the Don't Repeat Yourself rule, I'm not sure that new
> flag would get tested more than once (?) And it would still have to be
> assigned using an "objectionably" long expression, e.g.
>
> hostdata->ncr53c400_compatible =
> overrides[current_override].board == BOARD_NCR53C400 ||
> overrides[current_override].board == BOARD_NCR53C400A ||
> overrides[current_override].board == BOARD_DTC3181E;
>
> Rather than add new flags, perhaps a 'switch' statement instead of an 'if'
> statement would be shorter (if the size of the expression is the problem).
I think switch statements would be cleaner in this particular
instance. I was thinking something like:
if (somthing->flags & NCR53C400_COMPATIBLE) {
/* ... */
}
but if it's only ever going to be used once, then it's pretty
pointless and switch statements are cleaner.
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-05 03:20 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qCaC5-2y5-1@gated-at.bofh.it> |
| In reply to | #1284430 |
On Sat, 5 Dec 2015, Julian Calaby wrote:
> Hi Finn,
>
> On Fri, Dec 4, 2015 at 7:38 PM, Finn Thain <fthain@telegraphics.com.au> wrote:
> >
> > On Fri, 4 Dec 2015, Julian Calaby wrote:
> >
> >> > - if (overrides[current_override].board == BOARD_NCR53C400A) {
> >> > + if (overrides[current_override].board == BOARD_NCR53C400A ||
> >> > + overrides[current_override].board == BOARD_DTC3181E) {
> >>
> >> These if statements are starting to get a bit long, would it make
> >> sense to replace them with a flag or equivalent?
> >
> > To what end? Shorter lines? As in,
>
> Pretty much, each expression is quite long and they seem to be growing
> fairly rapidly as you and Ondrej discover similar boards.
Each BOARD_* macro actually refers to a whole category of devices. No new
boards, devices or categories of devices have been discovered.
Ondrej is enabling and/or fixing PDMA functionality for three existing
device categories, for which the driver already has a nominally compatible
PDMA implementation.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julian Calaby <julian.calaby@gmail.com> |
|---|---|
| Date | 2015-12-05 03:40 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qCaVr-2DW-1@gated-at.bofh.it> |
| In reply to | #1284439 |
Hi Finn,
On Sat, Dec 5, 2015 at 1:12 PM, Finn Thain <fthain@telegraphics.com.au> wrote:
>
> On Sat, 5 Dec 2015, Julian Calaby wrote:
>
>> Hi Finn,
>>
>> On Fri, Dec 4, 2015 at 7:38 PM, Finn Thain <fthain@telegraphics.com.au> wrote:
>> >
>> > On Fri, 4 Dec 2015, Julian Calaby wrote:
>> >
>> >> > - if (overrides[current_override].board == BOARD_NCR53C400A) {
>> >> > + if (overrides[current_override].board == BOARD_NCR53C400A ||
>> >> > + overrides[current_override].board == BOARD_DTC3181E) {
>> >>
>> >> These if statements are starting to get a bit long, would it make
>> >> sense to replace them with a flag or equivalent?
>> >
>> > To what end? Shorter lines? As in,
>>
>> Pretty much, each expression is quite long and they seem to be growing
>> fairly rapidly as you and Ondrej discover similar boards.
>
> Each BOARD_* macro actually refers to a whole category of devices. No new
> boards, devices or categories of devices have been discovered.
>
> Ondrej is enabling and/or fixing PDMA functionality for three existing
> device categories, for which the driver already has a nominally compatible
> PDMA implementation.
I meant discovering boards which are similar.
Either way, I'm not sure it matters that much.
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-04 10:10 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qBUxl-Hj-27@gated-at.bofh.it> |
| In reply to | #1283439 |
On Fri, 4 Dec 2015, Ondrej Zary wrote:
> Add I/O register mapping for DTC chips and enable PDMA mode.
>
> These chips have 16-bit wide HOST BUFFER register (counter register at
> offset 0x0d increments by 2 on each HOST BUFFER read).
>
> Large PIO transfers crash at least the DTCT-436P chip (all reads result
> in 0xFF) so this patch actually makes it work.
>
> The chip also crashes when we bang the C400 host status register too
> heavily after PDMA write - a small udelay is needed.
>
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> ---
> # hdparm -t --direct /dev/sdb
>
> /dev/sdb:
> Timing O_DIRECT disk reads: 4 MB in 3.78 seconds = 1.06 MB/sec
>
>
> drivers/scsi/NCR5380.h | 1 +
> drivers/scsi/g_NCR5380.c | 47 +++++++++++++++++++++++-----------------------
> 2 files changed, 25 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
> index 5092580..e3b8149 100644
> --- a/drivers/scsi/NCR5380.h
> +++ b/drivers/scsi/NCR5380.h
> @@ -222,6 +222,7 @@
>
> #define FLAG_NO_DMA_FIXUP 1 /* No DMA errata workarounds */
> #define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */
> +#define FLAG_16BIT 16 /* 16-bit PDMA */
Can we give this a better name? FLAG_16BIT could be taken to mean "16-bit
ISA card" but do we really want a flag for that? How about
FLAG_16BIT_BUF_REG or FLAG_WORD_IO_BUF?
All active flags appear in the console log, thanks to prepare_info(). It
might be helpful to include this one; FLAG_DTC3181E is likely to
disappear.
--
> #define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */
> #define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */
> #define FLAG_TOSHIBA_DELAY 128 /* Allow for borken CD-ROMs */
> diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
> index fae4332..04f6c29 100644
> --- a/drivers/scsi/g_NCR5380.c
> +++ b/drivers/scsi/g_NCR5380.c
> @@ -331,7 +331,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> ports = ncr_53c400a_ports;
> break;
> case BOARD_DTC3181E:
> - flags = FLAG_NO_PSEUDO_DMA;
> + flags = FLAG_NO_DMA_FIXUP | FLAG_16BIT;
> ports = dtc_3181e_ports;
> break;
> }
> @@ -415,7 +415,8 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> hostdata->c400_blk_cnt = 1;
> hostdata->c400_host_buf = 4;
> }
> - if (overrides[current_override].board == BOARD_NCR53C400A) {
> + if (overrides[current_override].board == BOARD_NCR53C400A ||
> + overrides[current_override].board == BOARD_DTC3181E) {
> hostdata->c400_ctl_status = 9;
> hostdata->c400_blk_cnt = 10;
> hostdata->c400_host_buf = 8;
> @@ -434,7 +435,8 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> goto out_unregister;
>
> if (overrides[current_override].board == BOARD_NCR53C400 ||
> - overrides[current_override].board == BOARD_NCR53C400A)
> + overrides[current_override].board == BOARD_NCR53C400A ||
> + overrides[current_override].board == BOARD_DTC3181E)
> NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
>
> NCR5380_maybe_reset_bus(instance);
> @@ -561,11 +563,10 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
> while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY);
>
> #ifndef SCSI_G_NCR5380_MEM
> - {
> - int i;
> - for (i = 0; i < 128; i++)
> - dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
> - }
> + if (hostdata->flags & FLAG_16BIT)
> + insw(instance->io_port + hostdata->c400_host_buf, dst + start, 64);
> + else
> + insb(instance->io_port + hostdata->c400_host_buf, dst + start, 128);
> #else
> /* implies SCSI_G_NCR5380_MEM */
> memcpy_fromio(dst + start,
> @@ -582,11 +583,10 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
> }
>
> #ifndef SCSI_G_NCR5380_MEM
> - {
> - int i;
> - for (i = 0; i < 128; i++)
> - dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
> - }
> + if (hostdata->flags & FLAG_16BIT)
> + insw(instance->io_port + hostdata->c400_host_buf, dst + start, 64);
> + else
> + insb(instance->io_port + hostdata->c400_host_buf, dst + start, 128);
> #else
> /* implies SCSI_G_NCR5380_MEM */
> memcpy_fromio(dst + start,
> @@ -645,10 +645,10 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
> while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
> ; // FIXME - timeout
> #ifndef SCSI_G_NCR5380_MEM
> - {
> - for (i = 0; i < 128; i++)
> - NCR5380_write(hostdata->c400_host_buf, src[start + i]);
> - }
> + if (hostdata->flags & FLAG_16BIT)
> + outsw(instance->io_port + hostdata->c400_host_buf, src + start, 64);
> + else
> + outsb(instance->io_port + hostdata->c400_host_buf, src + start, 128);
> #else
> /* implies SCSI_G_NCR5380_MEM */
> memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
> @@ -660,12 +660,11 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
> if (blocks) {
> while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
> ; // FIXME - no timeout
> -
> #ifndef SCSI_G_NCR5380_MEM
> - {
> - for (i = 0; i < 128; i++)
> - NCR5380_write(hostdata->c400_host_buf, src[start + i]);
> - }
> + if (hostdata->flags & FLAG_16BIT)
> + outsw(instance->io_port + hostdata->c400_host_buf, src + start, 64);
> + else
> + outsb(instance->io_port + hostdata->c400_host_buf, src + start, 128);
> #else
> /* implies SCSI_G_NCR5380_MEM */
> memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
> @@ -685,8 +684,10 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
> /* All documentation says to check for this. Maybe my hardware is too
> * fast. Waiting for it seems to work fine! KLL
> */
> - while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
> + while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ)) {
> + udelay(4); /* DTC436 chip hangs without this */
> ; // FIXME - no timeout
> + }
>
> /*
> * I know. i is certainly != 0 here but the loop is new. See previous
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-12-04 10:40 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qBV0l-Sz-7@gated-at.bofh.it> |
| In reply to | #1283663 |
On Friday 04 December 2015, Finn Thain wrote: > > On Fri, 4 Dec 2015, Ondrej Zary wrote: > > > Add I/O register mapping for DTC chips and enable PDMA mode. > > > > These chips have 16-bit wide HOST BUFFER register (counter register at > > offset 0x0d increments by 2 on each HOST BUFFER read). > > > > Large PIO transfers crash at least the DTCT-436P chip (all reads result > > in 0xFF) so this patch actually makes it work. > > > > The chip also crashes when we bang the C400 host status register too > > heavily after PDMA write - a small udelay is needed. > > > > Signed-off-by: Ondrej Zary <linux@rainbow-software.org> > > --- > > # hdparm -t --direct /dev/sdb > > > > /dev/sdb: > > Timing O_DIRECT disk reads: 4 MB in 3.78 seconds = 1.06 MB/sec > > > > > > drivers/scsi/NCR5380.h | 1 + > > drivers/scsi/g_NCR5380.c | 47 +++++++++++++++++++++++----------------------- > > 2 files changed, 25 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h > > index 5092580..e3b8149 100644 > > --- a/drivers/scsi/NCR5380.h > > +++ b/drivers/scsi/NCR5380.h > > @@ -222,6 +222,7 @@ > > > > #define FLAG_NO_DMA_FIXUP 1 /* No DMA errata workarounds */ > > #define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */ > > +#define FLAG_16BIT 16 /* 16-bit PDMA */ > > Can we give this a better name? FLAG_16BIT could be taken to mean "16-bit > ISA card" but do we really want a flag for that? How about > FLAG_16BIT_BUF_REG or FLAG_WORD_IO_BUF? > > All active flags appear in the console log, thanks to prepare_info(). It > might be helpful to include this one; FLAG_DTC3181E is likely to > disappear. Thinking more about this, we can probably detect the host buffer register width instead of adding another flag. Read the counter, then read once from the host buffer and read the counter again to see if it increments by 1 or 2. Or maybe even 4 for PCI cards. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-04 10:30 +0100 |
| Subject | Re: [RFC PATCH 76/71] ncr5380: Enable PDMA for DTC chips |
| Message-ID | <qBUQG-Pe-3@gated-at.bofh.it> |
| In reply to | #1283439 |
On Fri, 4 Dec 2015, Ondrej Zary wrote:
> @@ -685,8 +684,10 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
> /* All documentation says to check for this. Maybe my hardware is too
> * fast. Waiting for it seems to work fine! KLL
> */
> - while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
> + while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ)) {
> + udelay(4); /* DTC436 chip hangs without this */
> ; // FIXME - no timeout
> + }
>
> /*
> * I know. i is certainly != 0 here but the loop is new. See previous
>
Given that you've added braces, the redundant semicolon can be removed.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-12-04 00:10 +0100 |
| Subject | [RFC PATCH 77/71] ncr5380: Fix wait for 53C80 registers registers after PDMA |
| Message-ID | <qBLaF-34j-11@gated-at.bofh.it> |
| In reply to | #1272027 |
The check for 53C80 registers accessibility was commented out because
it was broken (inverted). Fix and enable it.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
drivers/scsi/g_NCR5380.c | 35 +++++++----------------------------
1 file changed, 7 insertions(+), 28 deletions(-)
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 04f6c29..c5cd490 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -599,14 +599,10 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
if (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
printk("53C400r: no 53C80 gated irq after transfer");
-#if 0
- /*
- * DON'T DO THIS - THEY NEVER ARRIVE!
- */
- printk("53C400r: Waiting for 53C80 registers\n");
- while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG)
+ /* wait for 53C80 registers to be available */
+ while (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG))
;
-#endif
+
if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER))
printk(KERN_ERR "53C400r: no end dma signal\n");
@@ -674,36 +670,19 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
blocks--;
}
-#if 0
- printk("53C400w: waiting for registers to be available\n");
- THEY NEVER DO ! while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG);
- printk("53C400w: Got em\n");
-#endif
-
- /* Let's wait for this instead - could be ugly */
- /* All documentation says to check for this. Maybe my hardware is too
- * fast. Waiting for it seems to work fine! KLL
- */
while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ)) {
udelay(4); /* DTC436 chip hangs without this */
; // FIXME - no timeout
}
- /*
- * I know. i is certainly != 0 here but the loop is new. See previous
- * comment.
- */
- if (i) {
- if (!((i = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_END_DMA_TRANSFER))
- printk(KERN_ERR "53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n", i);
- } else
- printk(KERN_ERR "53C400w: no 53C80 gated irq after transfer (last block)\n");
+ /* wait for 53C80 registers to be available */
+ while (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG))
+ ;
-#if 0
if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER)) {
printk(KERN_ERR "53C400w: no end dma signal\n");
}
-#endif
+
while (!(NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT))
; // TIMEOUT
return 0;
--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-12-04 22:10 +0100 |
| Subject | [PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A |
| Message-ID | <qC5M5-7Yp-5@gated-at.bofh.it> |
| In reply to | #1272027 |
Add I/O register mapping for NCR53C400A and enable PDMA mode to
improve performance and fix non-working IRQ.
Tested with HP C2502 (and user-space enabler).
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
drivers/scsi/g_NCR5380.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index ce444da..cd483c6 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -324,7 +324,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
#endif
break;
case BOARD_NCR53C400A:
- flags = FLAG_NO_PSEUDO_DMA;
+ flags = FLAG_NO_DMA_FIXUP;
ports = ncr_53c400a_ports;
break;
case BOARD_DTC3181E:
@@ -412,6 +412,11 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
hostdata->c400_blk_cnt = 1;
hostdata->c400_host_buf = 4;
}
+ if (overrides[current_override].board == BOARD_NCR53C400A) {
+ hostdata->c400_ctl_status = 9;
+ hostdata->c400_blk_cnt = 10;
+ hostdata->c400_host_buf = 8;
+ }
#else
instance->base = overrides[current_override].NCR5380_map_name;
hostdata->iomem = iomem;
@@ -425,7 +430,8 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
if (NCR5380_init(instance, flags))
goto out_unregister;
- if (overrides[current_override].board == BOARD_NCR53C400)
+ if (overrides[current_override].board == BOARD_NCR53C400 ||
+ overrides[current_override].board == BOARD_NCR53C400A)
NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
NCR5380_maybe_reset_bus(instance);
--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-06 04:50 +0100 |
| Subject | Re: [PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A |
| Message-ID | <qCyuJ-1Aw-9@gated-at.bofh.it> |
| In reply to | #1284227 |
On Fri, 4 Dec 2015, Ondrej Zary wrote:
> Add I/O register mapping for NCR53C400A and enable PDMA mode to
> improve performance and fix non-working IRQ.
>
> Tested with HP C2502 (and user-space enabler).
>
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> ---
> drivers/scsi/g_NCR5380.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
> index ce444da..cd483c6 100644
> --- a/drivers/scsi/g_NCR5380.c
> +++ b/drivers/scsi/g_NCR5380.c
> @@ -324,7 +324,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> #endif
> break;
> case BOARD_NCR53C400A:
> - flags = FLAG_NO_PSEUDO_DMA;
> + flags = FLAG_NO_DMA_FIXUP;
Nice!
> ports = ncr_53c400a_ports;
> break;
> case BOARD_DTC3181E:
> @@ -412,6 +412,11 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> hostdata->c400_blk_cnt = 1;
> hostdata->c400_host_buf = 4;
> }
> + if (overrides[current_override].board == BOARD_NCR53C400A) {
Please use an 'else' here. Or a switch statement.
> + hostdata->c400_ctl_status = 9;
> + hostdata->c400_blk_cnt = 10;
> + hostdata->c400_host_buf = 8;
> + }
> #else
> instance->base = overrides[current_override].NCR5380_map_name;
> hostdata->iomem = iomem;
> @@ -425,7 +430,8 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> if (NCR5380_init(instance, flags))
> goto out_unregister;
>
> - if (overrides[current_override].board == BOARD_NCR53C400)
> + if (overrides[current_override].board == BOARD_NCR53C400 ||
> + overrides[current_override].board == BOARD_NCR53C400A)
> NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
>
> NCR5380_maybe_reset_bus(instance);
>
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-12-04 22:10 +0100 |
| Subject | [PATCH 73/71] ncr5380: Use runtime register mapping |
| Message-ID | <qC5M6-7Yp-23@gated-at.bofh.it> |
| In reply to | #1272027 |
Convert compile-time C400_ register mapping to runtime mapping.
This removes the weird negative register offsets and allows adding
additional mappings.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
drivers/scsi/NCR5380.h | 13 +---------
drivers/scsi/g_NCR5380.c | 61 ++++++++++++++++++++++++++--------------------
drivers/scsi/g_NCR5380.h | 12 ++++++---
3 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 36779df..923db6c 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -163,8 +163,7 @@
/* Write any value to this register to start an ini mode DMA receive */
#define START_DMA_INITIATOR_RECEIVE_REG 7 /* wo */
-#define C400_CONTROL_STATUS_REG NCR53C400_register_offset-8 /* rw */
-
+/* NCR 53C400(A) Control Status Register bits: */
#define CSR_RESET 0x80 /* wo Resets 53c400 */
#define CSR_53C80_REG 0x80 /* ro 5380 registers busy */
#define CSR_TRANS_DIR 0x40 /* rw Data transfer direction */
@@ -181,16 +180,6 @@
#define CSR_BASE CSR_53C80_INTR
#endif
-/* Number of 128-byte blocks to be transferred */
-#define C400_BLOCK_COUNTER_REG NCR53C400_register_offset-7 /* rw */
-
-/* Resume transfer after disconnect */
-#define C400_RESUME_TRANSFER_REG NCR53C400_register_offset-6 /* wo */
-
-/* Access to host buffer stack */
-#define C400_HOST_BUFFER NCR53C400_register_offset-4 /* rw */
-
-
/* Note : PHASE_* macros are based on the values of the STATUS register */
#define PHASE_MASK (SR_MSG | SR_CD | SR_IO)
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index a9a237f..ce444da 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -253,6 +253,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
};
int flags;
struct Scsi_Host *instance;
+ struct NCR5380_hostdata *hostdata;
#ifdef SCSI_G_NCR5380_MEM
unsigned long base;
void __iomem *iomem;
@@ -395,6 +396,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
if (instance == NULL)
goto out_release;
+ hostdata = shost_priv(instance);
#ifndef SCSI_G_NCR5380_MEM
instance->io_port = overrides[current_override].NCR5380_map_name;
@@ -404,18 +406,27 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
* On NCR53C400 boards, NCR5380 registers are mapped 8 past
* the base address.
*/
- if (overrides[current_override].board == BOARD_NCR53C400)
+ if (overrides[current_override].board == BOARD_NCR53C400) {
instance->io_port += 8;
+ hostdata->c400_ctl_status = 0;
+ hostdata->c400_blk_cnt = 1;
+ hostdata->c400_host_buf = 4;
+ }
#else
instance->base = overrides[current_override].NCR5380_map_name;
- ((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
+ hostdata->iomem = iomem;
+ if (overrides[current_override].board == BOARD_NCR53C400) {
+ hostdata->c400_ctl_status = 0x100;
+ hostdata->c400_blk_cnt = 0x101;
+ hostdata->c400_host_buf = 0x104;
+ }
#endif
if (NCR5380_init(instance, flags))
goto out_unregister;
if (overrides[current_override].board == BOARD_NCR53C400)
- NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
+ NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
NCR5380_maybe_reset_bus(instance);
@@ -523,30 +534,28 @@ generic_NCR5380_biosparam(struct scsi_device *sdev, struct block_device *bdev,
static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
{
-#ifdef SCSI_G_NCR5380_MEM
struct NCR5380_hostdata *hostdata = shost_priv(instance);
-#endif
int blocks = len / 128;
int start = 0;
int bl;
- NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR);
- NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
+ NCR5380_write(hostdata->c400_ctl_status, CSR_BASE | CSR_TRANS_DIR);
+ NCR5380_write(hostdata->c400_blk_cnt, blocks);
while (1) {
- if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
+ if ((bl = NCR5380_read(hostdata->c400_blk_cnt)) == 0) {
break;
}
- if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
+ if (NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ) {
printk(KERN_ERR "53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
return -1;
}
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
+ while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY);
#ifndef SCSI_G_NCR5380_MEM
{
int i;
for (i = 0; i < 128; i++)
- dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
+ dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
}
#else
/* implies SCSI_G_NCR5380_MEM */
@@ -558,7 +567,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
}
if (blocks) {
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
+ while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
{
// FIXME - no timeout
}
@@ -567,7 +576,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
{
int i;
for (i = 0; i < 128; i++)
- dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
+ dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
}
#else
/* implies SCSI_G_NCR5380_MEM */
@@ -578,7 +587,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
blocks--;
}
- if (!(NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ))
+ if (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
printk("53C400r: no 53C80 gated irq after transfer");
#if 0
@@ -586,7 +595,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
* DON'T DO THIS - THEY NEVER ARRIVE!
*/
printk("53C400r: Waiting for 53C80 registers\n");
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG)
+ while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG)
;
#endif
if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER))
@@ -607,31 +616,29 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
{
-#ifdef SCSI_G_NCR5380_MEM
struct NCR5380_hostdata *hostdata = shost_priv(instance);
-#endif
int blocks = len / 128;
int start = 0;
int bl;
int i;
- NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
- NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
+ NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
+ NCR5380_write(hostdata->c400_blk_cnt, blocks);
while (1) {
- if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
+ if (NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ) {
printk(KERN_ERR "53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
return -1;
}
- if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
+ if ((bl = NCR5380_read(hostdata->c400_blk_cnt)) == 0) {
break;
}
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
+ while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; // FIXME - timeout
#ifndef SCSI_G_NCR5380_MEM
{
for (i = 0; i < 128; i++)
- NCR5380_write(C400_HOST_BUFFER, src[start + i]);
+ NCR5380_write(hostdata->c400_host_buf, src[start + i]);
}
#else
/* implies SCSI_G_NCR5380_MEM */
@@ -642,13 +649,13 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
blocks--;
}
if (blocks) {
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
+ while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; // FIXME - no timeout
#ifndef SCSI_G_NCR5380_MEM
{
for (i = 0; i < 128; i++)
- NCR5380_write(C400_HOST_BUFFER, src[start + i]);
+ NCR5380_write(hostdata->c400_host_buf, src[start + i]);
}
#else
/* implies SCSI_G_NCR5380_MEM */
@@ -661,7 +668,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
#if 0
printk("53C400w: waiting for registers to be available\n");
- THEY NEVER DO ! while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG);
+ THEY NEVER DO ! while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG);
printk("53C400w: Got em\n");
#endif
@@ -669,7 +676,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
/* All documentation says to check for this. Maybe my hardware is too
* fast. Waiting for it seems to work fine! KLL
*/
- while (!(i = NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ))
+ while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
; // FIXME - no timeout
/*
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h
index fd201e9..c5e57b7 100644
--- a/drivers/scsi/g_NCR5380.h
+++ b/drivers/scsi/g_NCR5380.h
@@ -29,7 +29,6 @@
#define NCR5380_map_type int
#define NCR5380_map_name port
-#define NCR53C400_register_offset 0
#ifdef CONFIG_SCSI_GENERIC_NCR53C400
#define NCR5380_region_size 16
@@ -42,7 +41,10 @@
#define NCR5380_write(reg, value) \
outb(value, instance->io_port + (reg))
-#define NCR5380_implementation_fields /* none */
+#define NCR5380_implementation_fields \
+ int c400_ctl_status; \
+ int c400_blk_cnt; \
+ int c400_host_buf;
#else
/* therefore SCSI_G_NCR5380_MEM */
@@ -50,7 +52,6 @@
#define NCR5380_map_type unsigned long
#define NCR5380_map_name base
-#define NCR53C400_register_offset 0x108
#define NCR53C400_mem_base 0x3880
#define NCR53C400_host_buffer 0x3900
#define NCR5380_region_size 0x3a00
@@ -63,7 +64,10 @@
NCR53C400_mem_base + (reg))
#define NCR5380_implementation_fields \
- void __iomem *iomem;
+ void __iomem *iomem; \
+ int c400_ctl_status; \
+ int c400_blk_cnt; \
+ int c400_host_buf;
#endif
--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-06 04:40 +0100 |
| Subject | Re: [PATCH 73/71] ncr5380: Use runtime register mapping |
| Message-ID | <qCyl4-1x2-15@gated-at.bofh.it> |
| In reply to | #1284232 |
On Fri, 4 Dec 2015, Ondrej Zary wrote:
> Convert compile-time C400_ register mapping to runtime mapping.
> This removes the weird negative register offsets and allows adding
> additional mappings.
>
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> ---
> drivers/scsi/NCR5380.h | 13 +---------
> drivers/scsi/g_NCR5380.c | 61 ++++++++++++++++++++++++++--------------------
> drivers/scsi/g_NCR5380.h | 12 ++++++---
> 3 files changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
> index 36779df..923db6c 100644
> --- a/drivers/scsi/NCR5380.h
> +++ b/drivers/scsi/NCR5380.h
> @@ -163,8 +163,7 @@
> /* Write any value to this register to start an ini mode DMA receive */
> #define START_DMA_INITIATOR_RECEIVE_REG 7 /* wo */
>
> -#define C400_CONTROL_STATUS_REG NCR53C400_register_offset-8 /* rw */
> -
> +/* NCR 53C400(A) Control Status Register bits: */
> #define CSR_RESET 0x80 /* wo Resets 53c400 */
> #define CSR_53C80_REG 0x80 /* ro 5380 registers busy */
> #define CSR_TRANS_DIR 0x40 /* rw Data transfer direction */
> @@ -181,16 +180,6 @@
> #define CSR_BASE CSR_53C80_INTR
> #endif
>
> -/* Number of 128-byte blocks to be transferred */
> -#define C400_BLOCK_COUNTER_REG NCR53C400_register_offset-7 /* rw */
> -
> -/* Resume transfer after disconnect */
> -#define C400_RESUME_TRANSFER_REG NCR53C400_register_offset-6 /* wo */
> -
> -/* Access to host buffer stack */
> -#define C400_HOST_BUFFER NCR53C400_register_offset-4 /* rw */
> -
> -
> /* Note : PHASE_* macros are based on the values of the STATUS register */
> #define PHASE_MASK (SR_MSG | SR_CD | SR_IO)
>
> diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
> index a9a237f..ce444da 100644
> --- a/drivers/scsi/g_NCR5380.c
> +++ b/drivers/scsi/g_NCR5380.c
> @@ -253,6 +253,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> };
> int flags;
> struct Scsi_Host *instance;
> + struct NCR5380_hostdata *hostdata;
> #ifdef SCSI_G_NCR5380_MEM
> unsigned long base;
> void __iomem *iomem;
> @@ -395,6 +396,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
> if (instance == NULL)
> goto out_release;
> + hostdata = shost_priv(instance);
>
> #ifndef SCSI_G_NCR5380_MEM
> instance->io_port = overrides[current_override].NCR5380_map_name;
> @@ -404,18 +406,27 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
> * On NCR53C400 boards, NCR5380 registers are mapped 8 past
> * the base address.
> */
> - if (overrides[current_override].board == BOARD_NCR53C400)
> + if (overrides[current_override].board == BOARD_NCR53C400) {
> instance->io_port += 8;
> + hostdata->c400_ctl_status = 0;
> + hostdata->c400_blk_cnt = 1;
> + hostdata->c400_host_buf = 4;
> + }
> #else
> instance->base = overrides[current_override].NCR5380_map_name;
> - ((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
> + hostdata->iomem = iomem;
> + if (overrides[current_override].board == BOARD_NCR53C400) {
> + hostdata->c400_ctl_status = 0x100;
> + hostdata->c400_blk_cnt = 0x101;
> + hostdata->c400_host_buf = 0x104;
> + }
> #endif
>
> if (NCR5380_init(instance, flags))
> goto out_unregister;
>
> if (overrides[current_override].board == BOARD_NCR53C400)
> - NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
> + NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
>
> NCR5380_maybe_reset_bus(instance);
>
> @@ -523,30 +534,28 @@ generic_NCR5380_biosparam(struct scsi_device *sdev, struct block_device *bdev,
>
> static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
> {
> -#ifdef SCSI_G_NCR5380_MEM
> struct NCR5380_hostdata *hostdata = shost_priv(instance);
> -#endif
> int blocks = len / 128;
> int start = 0;
> int bl;
>
> - NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR);
> - NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
> + NCR5380_write(hostdata->c400_ctl_status, CSR_BASE | CSR_TRANS_DIR);
> + NCR5380_write(hostdata->c400_blk_cnt, blocks);
> while (1) {
> - if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
> + if ((bl = NCR5380_read(hostdata->c400_blk_cnt)) == 0) {
> break;
> }
Rewritten in Linux coding style that is,
bl = NCR5380_read(hostdata->c400_blk_cnt);
if (bl == 0)
break;
But in this case, bl is not used further so why not just remove it along
with the braces?
> - if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
> + if (NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ) {
> printk(KERN_ERR "53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
> return -1;
> }
> - while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
> + while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY);
The semicolon should appear on the next line where it is more visible.
>
> #ifndef SCSI_G_NCR5380_MEM
> {
> int i;
> for (i = 0; i < 128; i++)
> - dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
> + dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
> }
Why not just change the loop to insb() now, rather than waiting until the
patch after next? Then you can remove the extra braces and 'int i'
declaration.
> #else
> /* implies SCSI_G_NCR5380_MEM */
> @@ -558,7 +567,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
> }
>
> if (blocks) {
> - while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
> + while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
> {
> // FIXME - no timeout
> }
> @@ -567,7 +576,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
> {
> int i;
> for (i = 0; i < 128; i++)
> - dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
> + dst[start + i] = NCR5380_read(hostdata->c400_host_buf);
Same here.
> }
> #else
> /* implies SCSI_G_NCR5380_MEM */
> @@ -578,7 +587,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
> blocks--;
> }
>
> - if (!(NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ))
> + if (!(NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
> printk("53C400r: no 53C80 gated irq after transfer");
>
> #if 0
> @@ -586,7 +595,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
> * DON'T DO THIS - THEY NEVER ARRIVE!
> */
> printk("53C400r: Waiting for 53C80 registers\n");
> - while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG)
> + while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG)
> ;
> #endif
> if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER))
> @@ -607,31 +616,29 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
>
> static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
> {
> -#ifdef SCSI_G_NCR5380_MEM
> struct NCR5380_hostdata *hostdata = shost_priv(instance);
> -#endif
> int blocks = len / 128;
> int start = 0;
> int bl;
> int i;
>
> - NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
> - NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
> + NCR5380_write(hostdata->c400_ctl_status, CSR_BASE);
> + NCR5380_write(hostdata->c400_blk_cnt, blocks);
> while (1) {
> - if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
> + if (NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ) {
> printk(KERN_ERR "53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
> return -1;
> }
>
> - if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
> + if ((bl = NCR5380_read(hostdata->c400_blk_cnt)) == 0) {
As above.
> break;
> }
> - while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
> + while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
> ; // FIXME - timeout
> #ifndef SCSI_G_NCR5380_MEM
> {
> for (i = 0; i < 128; i++)
> - NCR5380_write(C400_HOST_BUFFER, src[start + i]);
> + NCR5380_write(hostdata->c400_host_buf, src[start + i]);
> }
Also as above.
> #else
> /* implies SCSI_G_NCR5380_MEM */
> @@ -642,13 +649,13 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
> blocks--;
> }
> if (blocks) {
> - while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
> + while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
> ; // FIXME - no timeout
>
> #ifndef SCSI_G_NCR5380_MEM
> {
> for (i = 0; i < 128; i++)
> - NCR5380_write(C400_HOST_BUFFER, src[start + i]);
> + NCR5380_write(hostdata->c400_host_buf, src[start + i]);
> }
Same here.
Thanks.
> #else
> /* implies SCSI_G_NCR5380_MEM */
> @@ -661,7 +668,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
>
> #if 0
> printk("53C400w: waiting for registers to be available\n");
> - THEY NEVER DO ! while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG);
> + THEY NEVER DO ! while (NCR5380_read(hostdata->c400_ctl_status) & CSR_53C80_REG);
> printk("53C400w: Got em\n");
> #endif
>
> @@ -669,7 +676,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
> /* All documentation says to check for this. Maybe my hardware is too
> * fast. Waiting for it seems to work fine! KLL
> */
> - while (!(i = NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ))
> + while (!(i = NCR5380_read(hostdata->c400_ctl_status) & CSR_GATED_53C80_IRQ))
> ; // FIXME - no timeout
>
> /*
> diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h
> index fd201e9..c5e57b7 100644
> --- a/drivers/scsi/g_NCR5380.h
> +++ b/drivers/scsi/g_NCR5380.h
> @@ -29,7 +29,6 @@
>
> #define NCR5380_map_type int
> #define NCR5380_map_name port
> -#define NCR53C400_register_offset 0
>
> #ifdef CONFIG_SCSI_GENERIC_NCR53C400
> #define NCR5380_region_size 16
> @@ -42,7 +41,10 @@
> #define NCR5380_write(reg, value) \
> outb(value, instance->io_port + (reg))
>
> -#define NCR5380_implementation_fields /* none */
> +#define NCR5380_implementation_fields \
> + int c400_ctl_status; \
> + int c400_blk_cnt; \
> + int c400_host_buf;
>
> #else
> /* therefore SCSI_G_NCR5380_MEM */
> @@ -50,7 +52,6 @@
>
> #define NCR5380_map_type unsigned long
> #define NCR5380_map_name base
> -#define NCR53C400_register_offset 0x108
> #define NCR53C400_mem_base 0x3880
> #define NCR53C400_host_buffer 0x3900
> #define NCR5380_region_size 0x3a00
> @@ -63,7 +64,10 @@
> NCR53C400_mem_base + (reg))
>
> #define NCR5380_implementation_fields \
> - void __iomem *iomem;
> + void __iomem *iomem; \
> + int c400_ctl_status; \
> + int c400_blk_cnt; \
> + int c400_host_buf;
>
> #endif
>
>
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| Date | 2015-12-06 09:50 +0100 |
| Subject | Re: [PATCH 73/71] ncr5380: Use runtime register mapping |
| Message-ID | <qCDb3-4E0-9@gated-at.bofh.it> |
| In reply to | #1284707 |
On Sun, Dec 6, 2015 at 4:39 AM, Finn Thain <fthain@telegraphics.com.au> wrote:
>> - while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
>> + while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY);
>
> The semicolon should appear on the next line where it is more visible.
And adding a cpu_relax() to the empty loop body is another good visual cue.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
Page 3 of 4 — ← Prev page 1 2 [3] 4 Next page →
Back to top | Article view | linux.kernel
csiph-web