More fixes, cleanup and modernization for NCR5380 drivers
Subsystems (2)
Re: [PATCH v3 72/77] ncr5380: Fix pseudo DMA transfers on 53C400
In reply to Finn ThainQuoted 5 lines · Finn Thain
From: Ondrej Zary <[email protected]>
Pseudo-DMA (PDMA) has been broken for ages, resulting in hangs on 53C400-based cards.
Quoted 8 lines
According to 53C400 datasheet, PDMA transfer length must be a multiple of 128. Check if that's true and use PIO if it's not.
This makes PDMA work on 53C400 (Canon FG2-5202).
Signed-off-by Ondrej Zary <[email protected]>Signed-off-by Finn Thain <[email protected]>
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
PATCH v3 73/77 ncr5380: Use runtime register mapping
In reply to Finn ThainFrom: Ondrej Zary <[email protected]>
Convert compile-time C400_ register mapping to runtime mapping. This removes the weird negative register offsets and allows adding additional mappings.
While at it, convert read/write loops into insb/outsb.
--- drivers/scsi/NCR5380.h | 13 ------ drivers/scsi/g_NCR5380.c | 88 +++++++++++++++++++++-------------------------- drivers/scsi/g_NCR5380.h | 12 ++++-- 3 files changed, 49 insertions(+), 64 deletions(-)
drivers/scsi/NCR5380.h +1 -12
@@ -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)
drivers/scsi/g_NCR5380.c +40 -48
192 lines not on this page · raw message
drivers/scsi/g_NCR5380.h +8 -4
@@ -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
Re: [PATCH v3 73/77] ncr5380: Use runtime register mapping
Quoted 11 lines · Finn Thain
From: Ondrej Zary <[email protected]>
Convert compile-time
C400_register mapping to runtime mapping. This removes the weird negative register offsets and allows adding additional mappings.While at it, convert read/write loops into insb/outsb.
Signed-off-by Ondrej Zary <[email protected]>Signed-off-by Finn Thain <[email protected]>
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
PATCH v3 74/77 ncr5380: Enable PDMA for NCR53C400A
In reply to Finn ThainFrom: Ondrej Zary <[email protected]>
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).
---
Changes to Ondrej's version:
- An 'if' statement is now a 'switch' statement.
- Throw an error if MMIO register locations are not known.
--- drivers/scsi/g_NCR5380.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/scsi/g_NCR5380.c +19 -4
@@ -323,7 +323,7 @@ static int __init generic_NCR5380_detect#endif break ;case BOARD_NCR53C400A : - flags =FLAG_NO_PSEUDO_DMA ; + flags =FLAG_NO_DMA_FIXUP ; ports = ncr_53c400a_ports;break ;case BOARD_DTC3181E :
@@ -405,27 +405,42 @@ static int __init generic_NCR5380_detect* On NCR53C400 boards, NCR5380 registers are mapped 8 past * the base address. */ -if (overrides[current_override].board ==BOARD_NCR53C400 ) { +switch (overrides[current_override].board) { +case BOARD_NCR53C400 : instance->io_port +=8 ; hostdata->c400_ctl_status =0 ; hostdata->c400_blk_cnt =1 ; hostdata->c400_host_buf =4 ; +break ; +case BOARD_NCR53C400A : + hostdata->c400_ctl_status =9 ; + hostdata->c400_blk_cnt =10 ; + hostdata->c400_host_buf =8 ; +break ; }#else instance->base = overrides[current_override].NCR5380_map_name; hostdata->iomem = iomem; -if (overrides[current_override].board ==BOARD_NCR53C400 ) { +switch (overrides[current_override].board) { +case BOARD_NCR53C400 : hostdata->c400_ctl_status =0x100 ; hostdata->c400_blk_cnt =0x101 ; hostdata->c400_host_buf =0x104 ; +break ; +case BOARD_NCR53C400A : +pr_err (DRV_MODULE_NAME ": unknown register offsets\n" ); + goto out_unregister; }#endif if (NCR5380_init (instance, flags)) goto out_unregister; -if (overrides[current_override].board ==BOARD_NCR53C400 ) +switch (overrides[current_override].board) { +case BOARD_NCR53C400 : +case BOARD_NCR53C400A :NCR5380_write (hostdata->c400_ctl_status,CSR_BASE ); + }NCR5380_maybe_reset_bus (instance);
Re: [PATCH v3 74/77] ncr5380: Enable PDMA for NCR53C400A
Quoted 12 lines · Finn Thain
From: Ondrej Zary <[email protected]>
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 <[email protected]>Signed-off-by Finn Thain <[email protected]>---
Quoted 8 lines
Changes to Ondrej's version:
- An 'if' statement is now a 'switch' statement.
- Throw an error if MMIO register locations are not known.--- drivers/scsi/g_NCR5380.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
PATCH v3 75/77 ncr5380: Enable PDMA for DTC chips
In reply to Finn ThainFrom: Ondrej Zary <[email protected]>
Add I/O register mapping for DTC chips and enable PDMA mode.
These chips have 16-bit wide HOST BUFFER register and it must be read by 16-bit accesses (we lose data otherwise).
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 on the C400 host status register too heavily after PDMA write - a small udelay is needed.
Tested on DTCT-436P and verified that it does not break 53C400A.
---
Changes to Ondrej's version:
- Rebased.
--- drivers/scsi/g_NCR5380.c | 38 +++++++++++++++++++++++++++++++------- drivers/scsi/g_NCR5380.h | 3 ++- 2 files changed, 33 insertions(+), 8 deletions(-)
drivers/scsi/g_NCR5380.c +31 -7
@@ -327,7 +327,7 @@ static int __init generic_NCR5380_detect ports = ncr_53c400a_ports;break ;case BOARD_DTC3181E : - flags =FLAG_NO_PSEUDO_DMA ; + flags =FLAG_NO_DMA_FIXUP ; ports = dtc_3181e_ports;break ; }
@@ -400,6 +400,7 @@ static int __init generic_NCR5380_detect#ifndef SCSI_G_NCR5380_MEM instance->io_port = overrides[current_override].NCR5380_map_name; instance->n_io_port = region_size; + hostdata->io_width =1 ;/* 8-bit PDMA by default */ /* * On NCR53C400 boards, NCR5380 registers are mapped 8 past
@@ -412,6 +413,9 @@ static int __init generic_NCR5380_detect hostdata->c400_blk_cnt =1 ; hostdata->c400_host_buf =4 ;break ; +case BOARD_DTC3181E : + hostdata->io_width =2 ;/* 16-bit PDMA */ +/* fall through */ case BOARD_NCR53C400A : hostdata->c400_ctl_status =9 ; hostdata->c400_blk_cnt =10 ;
@@ -427,6 +431,7 @@ static int __init generic_NCR5380_detect hostdata->c400_blk_cnt =0x101 ; hostdata->c400_host_buf =0x104 ;break ; +case BOARD_DTC3181E :case BOARD_NCR53C400A :pr_err (DRV_MODULE_NAME ": unknown register offsets\n" ); goto out_unregister;
@@ -438,6 +443,7 @@ static int __init generic_NCR5380_detectswitch (overrides[current_override].board) {case BOARD_NCR53C400 : +case BOARD_DTC3181E :case BOARD_NCR53C400A :NCR5380_write (hostdata->c400_ctl_status,CSR_BASE ); }
@@ -565,7 +571,11 @@ static inline int NCR5380_pread(struct S ;/* FIXME - no timeout */ #ifndef SCSI_G_NCR5380_MEM -insb (instance->io_port + hostdata->c400_host_buf, +if (hostdata->io_width ==2 ) +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 */
@@ -581,7 +591,11 @@ static inline int NCR5380_pread(struct S ;/* FIXME - no timeout */ #ifndef SCSI_G_NCR5380_MEM -insb (instance->io_port + hostdata->c400_host_buf, +if (hostdata->io_width ==2 ) +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 */
@@ -639,7 +653,11 @@ static inline int NCR5380_pwrite(structwhile (NCR5380_read (hostdata->c400_ctl_status) &CSR_HOST_BUF_NOT_RDY ) ;// FIXME - timeout #ifndef SCSI_G_NCR5380_MEM -outsb (instance->io_port + hostdata->c400_host_buf, +if (hostdata->io_width ==2 ) +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 */
@@ -654,7 +672,11 @@ static inline int NCR5380_pwrite(struct ;// FIXME - no timeout #ifndef SCSI_G_NCR5380_MEM -outsb (instance->io_port + hostdata->c400_host_buf, +if (hostdata->io_width ==2 ) +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 */
@@ -675,8 +697,10 @@ static inline int NCR5380_pwrite(struct/* 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 )) - ;// FIXME - no timeout +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
drivers/scsi/g_NCR5380.h +2 -1
@@ -44,7 +44,8 @@#define NCR5380_implementation_fields \ int c400_ctl_status; \ int c400_blk_cnt; \ - int c400_host_buf; + int c400_host_buf; \ + int io_width;#else /* therefore SCSI_G_NCR5380_MEM */
Re: [PATCH v3 75/77] ncr5380: Enable PDMA for DTC chips
Quoted 10 lines · Finn Thain
From: Ondrej Zary <[email protected]>
Add I/O register mapping for DTC chips and enable PDMA mode.
These chips have 16-bit wide HOST BUFFER register and it must be read by 16-bit accesses (we lose data otherwise).
Large PIO transfers crash at least the DTCT-436P chip (all reads result in
0xFF) so this patch actually makes it work.
Quoted 8 lines
The chip also crashes when we bang on the C400 host status register too heavily after PDMA write - a small udelay is needed.
Tested on DTCT-436P and verified that it does not break 53C400A.
Signed-off-by Ondrej Zary <[email protected]>Signed-off-by Finn Thain <[email protected]>
Cheers,
Hannes
Signature · 8 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 76/77 ncr5380: Fix wait for 53C80 registers registers after PDMA
In reply to Finn ThainFrom: Ondrej Zary <[email protected]>
The check for 53C80 registers accessibility was commented out because it was broken (inverted). Fix and enable it.
--- drivers/scsi/g_NCR5380.c | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-)
drivers/scsi/g_NCR5380.c +6 -31
@@ -609,14 +609,10 @@ static inline int NCR5380_pread(struct Sif (!(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" );
@@ -638,7 +634,6 @@ static inline int NCR5380_pwrite(structstruct NCR5380_hostdata *hostdata =shost_priv (instance);int blocks = len /128 ;int start =0 ; -int i;NCR5380_write (hostdata->c400_ctl_status,CSR_BASE );NCR5380_write (hostdata->c400_blk_cnt, blocks);
@@ -687,36 +682,16 @@ static inline int NCR5380_pwrite(struct 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 )) { +/* wait for 53C80 registers to be available */ +while (!(NCR5380_read (hostdata->c400_ctl_status) &CSR_53C80_REG )) {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" ); - -#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 ;
Re: [PATCH v3 76/77] ncr5380: Fix wait for 53C80 registers registers after PDMA
Quoted 5 lines · Finn Thain
From: Ondrej Zary <[email protected]>
The check for 53C80 registers accessibility was commented out because it was broken (inverted). Fix and enable it.
Quoted 7 lines
Signed-off-by Ondrej Zary <[email protected]>Signed-off-by Finn Thain <[email protected]>--- drivers/scsi/g_NCR5380.c | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-)
Cheers,
Hannes
Signature · 8 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 77/77 ncr5380: Add support for HP C2502
In reply to Finn ThainFrom: Ondrej Zary <[email protected]>
HP C2502 cards (based on 53C400A chips) use different magic numbers for software-based I/O address configuration than other cards. The configuration is also extended to allow setting the IRQ.
Move the configuration to a new function magic_configure() and move magic the magic numbers into an array. Add new magic numbers for these HP cards and hp_c2502 module parameter to use them, e.g.:
modprobe g_NCR5380 ncr_irq=7 ncr_addr=0x280 hp_c2502=1
Tested with HP C2502 and DTCT-436P.
---
Changes to Ondrej's versions:
- Omit a redundant comment.
- Throw an error if MMIO register locations are not known.
- Avoid 'if (...) { ... continue; } else { ... }'
- Fix "warning: 'port_idx' may be used uninitialized" and "warning: 'magic' may be used uninitialized" for port-mapped config.
- Rebased.
--- drivers/scsi/g_NCR5380.c | 74 ++++++++++++++++++++++++++++++++++++----------- drivers/scsi/g_NCR5380.h | 1 2 files changed, 59 insertions(+), 16 deletions(-)
drivers/scsi/g_NCR5380.c +58 -16
@@ -80,6 +80,7 @@ static int ncr_5380;static int ncr_53c400;static int ncr_53c400a;static int dtc_3181e; +static int hp_c2502; static struct override { NCR5380_map_type NCR5380_map_name;
@@ -225,6 +226,30 @@ static int __init do_DTC3181E_setup(char#endif +#ifndef SCSI_G_NCR5380_MEM +/* +* Configure I/O address of 53C400A or DTC436 by writing magic numbers +* to ports 0x779 and 0x379. +*/ +static void magic_configure (int idx,u8 irq,u8 magic[]) +{ +u8 cfg =0 ; + +outb (magic[0 ],0x779 ); +outb (magic[1 ],0x379 ); +outb (magic[2 ],0x379 ); +outb (magic[3 ],0x379 ); +outb (magic[4 ],0x379 ); + +/* allowed IRQs for HP C2502 */ +if (irq !=2 && irq !=3 && irq !=4 && irq !=5 && irq !=7 ) + irq =0 ; +if (idx >=0 && idx <=7 ) + cfg =0x80 | idx | (irq <<4 ); +outb (cfg,0x379 ); +} +#endif +/** * generic_NCR5380_detect - look for NCR5380 controllers * @tpnt: the scsi template
@@ -241,8 +266,10 @@ static int __init generic_NCR5380_detectstatic int current_override;int count;unsigned int *ports; +u8 *magic =NULL ;#ifndef SCSI_G_NCR5380_MEM int i; +int port_idx =-1 ;unsigned long region_size =16 ;#endif static unsigned int __initdata ncr_53c400a_ports[] = {
@@ -251,6 +278,12 @@ static int __init generic_NCR5380_detectstatic unsigned int __initdata dtc_3181e_ports[] = {0x220 ,0x240 ,0x280 ,0x2a0 ,0x2c0 ,0x300 ,0x320 ,0x340 ,0 }; +static u8 ncr_53c400a_magic[]__initdata = {/* 53C400A & DTC436 */ +0x59 ,0xb9 ,0xc5 ,0xae ,0xa6 + }; +static u8 hp_c2502_magic[]__initdata = {/* HP C2502 */ +0x0f ,0x22 ,0xf0 ,0x20 ,0x80 + };int flags;struct Scsi_Host *instance;struct NCR5380_hostdata *hostdata;
@@ -273,6 +306,8 @@ static int __init generic_NCR5380_detect overrides[0 ].board =BOARD_NCR53C400A ; else if (dtc_3181e) overrides[0].board = BOARD_DTC3181E; + else if (hp_c2502) + overrides[0].board = BOARD_HP_C2502;#ifndef SCSI_G_NCR5380_MEM if (!current_override &&isapnp_present ()) {struct pnp_dev *dev =NULL ;
@@ -325,24 +360,26 @@ static int __init generic_NCR5380_detectcase BOARD_NCR53C400A : flags =FLAG_NO_DMA_FIXUP ; ports = ncr_53c400a_ports; + magic = ncr_53c400a_magic; +break ; +case BOARD_HP_C2502 : + flags =FLAG_NO_DMA_FIXUP ; + ports = ncr_53c400a_ports; + magic = hp_c2502_magic;break ;case BOARD_DTC3181E : flags =FLAG_NO_DMA_FIXUP ; ports = dtc_3181e_ports; + magic = ncr_53c400a_magic;break ; }#ifndef SCSI_G_NCR5380_MEM -if (ports) { +if (ports && magic) {/* wakeup sequence for the NCR53C400A and DTC3181E */ /* Disable the adapter and look for a free io port */ -outb (0x59 ,0x779 ); -outb (0xb9 ,0x379 ); -outb (0xc5 ,0x379 ); -outb (0xae ,0x379 ); -outb (0xa6 ,0x379 ); -outb (0x00 ,0x379 ); +magic_configure (-1 ,0 , magic);if (overrides[current_override].NCR5380_map_name !=PORT_AUTO )for (i =0 ; ports[i]; i++) {
@@ -361,17 +398,12 @@ static int __init generic_NCR5380_detect }if (ports[i]) {/* At this point we have our region reserved */ -outb (0x59 ,0x779 ); -outb (0xb9 ,0x379 ); -outb (0xc5 ,0x379 ); -outb (0xae ,0x379 ); -outb (0xa6 ,0x379 ); -outb (0x80 | i,0x379 );/* set io port to be used */ +magic_configure (i,0 , magic);/* no IRQ yet */ outb (0xc0 , ports[i] +9 );if (inb (ports[i] +9 ) !=0x80 )continue ; -else - overrides[current_override].NCR5380_map_name = ports[i]; + overrides[current_override].NCR5380_map_name = ports[i]; + port_idx = i; }else continue ; }
@@ -417,6 +449,7 @@ static int __init generic_NCR5380_detect hostdata->io_width =2 ;/* 16-bit PDMA */ /* fall through */ case BOARD_NCR53C400A : +case BOARD_HP_C2502 : hostdata->c400_ctl_status =9 ; hostdata->c400_blk_cnt =10 ; hostdata->c400_host_buf =8 ;
@@ -433,6 +466,7 @@ static int __init generic_NCR5380_detectbreak ;case BOARD_DTC3181E :case BOARD_NCR53C400A : +case BOARD_HP_C2502 :pr_err (DRV_MODULE_NAME ": unknown register offsets\n" ); goto out_unregister; }
@@ -445,6 +479,7 @@ static int __init generic_NCR5380_detectcase BOARD_NCR53C400 :case BOARD_DTC3181E :case BOARD_NCR53C400A : +case BOARD_HP_C2502 :NCR5380_write (hostdata->c400_ctl_status,CSR_BASE ); }
@@ -459,12 +494,18 @@ static int __init generic_NCR5380_detectif (instance->irq ==255 ) instance->irq =NO_IRQ ; -if (instance->irq !=NO_IRQ ) +if (instance->irq !=NO_IRQ ) { +#ifndef SCSI_G_NCR5380_MEM +/* set IRQ for HP C2502 */ +if (overrides[current_override].board ==BOARD_HP_C2502 ) +magic_configure (port_idx, instance->irq, magic); +#endif if (request_irq (instance->irq, generic_NCR5380_intr,0 ,"NCR5380" , instance)) {printk (KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n" , instance->host_no, instance->irq); instance->irq =NO_IRQ ; } + }if (instance->irq ==NO_IRQ ) {printk (KERN_INFO "scsi%d : interrupts not enabled. for better interactive performance,\n" , instance->host_no);
@@ -751,6 +792,7 @@ module_param(ncr_5380, int, 0);module_param (ncr_53c400, int,0 );module_param (ncr_53c400a, int,0 );module_param (dtc_3181e, int,0 ); +module_param (hp_c2502, int,0 );MODULE_LICENSE ("GPL" );#if !defined(SCSI_G_NCR5380_MEM ) && defined(MODULE )
drivers/scsi/g_NCR5380.h +1 -0
@@ -88,6 +88,7 @@#define BOARD_NCR53C400 1#define BOARD_NCR53C400A 2#define BOARD_DTC3181E 3 +#define BOARD_HP_C2502 4#endif /* GENERIC_NCR5380_H */
Re: [PATCH v3 77/77] ncr5380: Add support for HP C2502
Quoted 11 lines · Finn Thain
From: Ondrej Zary <[email protected]>
HP C2502 cards (based on 53C400A chips) use different magic numbers for software-based I/O address configuration than other cards. The configuration is also extended to allow setting the IRQ.
Move the configuration to a new function
magic_configure()and move magic the magic numbers into an array. Add new magic numbers for these HP cards andhp_c2502module parameter to use them, e.g.:
modprobeg_NCR5380ncr_irq=7 ncr_addr=0x280 hp_c2502=1
Quoted 5 lines
Tested with HP C2502 and DTCT-436P.
Signed-off-by Ondrej Zary <[email protected]>Signed-off-by Finn Thain <[email protected]>
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
Quoted 20 lines · On Tuesday 22 December 2015 02:17:38 Finn Thain wrote:
Like my previous work on the NCR5380 drivers, this patch series has bug fixes, code cleanup and modernization. These drivers suffer from mistakes, poor style and neglect and this long series addresses the worst of it, covering all ten wrapper drivers and both of the core driver forks. The combined size of the drivers is reduced by over 700 LoC.
This series continues to reduce divergence between the two core driver forks, often by copying a bug fix from one to the other. Most patches are larger for having to keep the two forks in sync. Making the same change to both is churn if one of them is to be removed but neither can be as yet. By the end of this series the diff between the two forks is minimal, so it becomes clear what caused the fork and what can be done about it.
This patch series did benefit from
scripts/checkpatch.plbut not too much. Decades ago, these drivers started out with 4-space tabs and if the 80 column limit were to be strictly enforced now, it would require adding new functions and shortening identifiers. I would defer this sort of activity until after the fork has been resolved.
Quoted 3 lines
All patches to all NCR5380 drivers (x86, ARM, m68k) have been compile- tested. The
mac_scsi, dmx3191d,g_NCR5380andatari_scsimodules were regression tested on suitable hardware.
Tested on HP C2502 (53C400A chip), Canon FG2-5202 (53C400 chip) and DTC-3181L (DTCT-436P chip) ISA cards - everything works fine!
Thanks.
Signature · 1 line
Ondrej Zary
Hi Finn,
I've tested this series thoroughly on my Atari Falcon - no regressions, runs stable and is quite responsive. No SCSI lock-ups that had plagued the old driver (before your rewrites).
Please add my
Cheers,
Michael
Am 22.12.15 um 14:17 schrieb Finn Thain:
Quoted 62 lines
Like my previous work on the NCR5380 drivers, this patch series has bug fixes, code cleanup and modernization. These drivers suffer from mistakes, poor style and neglect and this long series addresses the worst of it, covering all ten wrapper drivers and both of the core driver forks. The combined size of the drivers is reduced by over 700 LoC.
This series continues to reduce divergence between the two core driver forks, often by copying a bug fix from one to the other. Most patches are larger for having to keep the two forks in sync. Making the same change to both is churn if one of them is to be removed but neither can be as yet. By the end of this series the diff between the two forks is minimal, so it becomes clear what caused the fork and what can be done about it.
This patch series did benefit from
scripts/checkpatch.plbut not too much. Decades ago, these drivers started out with 4-space tabs and if the 80 column limit were to be strictly enforced now, it would require adding new functions and shortening identifiers. I would defer this sort of activity until after the fork has been resolved.All patches to all NCR5380 drivers (x86, ARM, m68k) have been compile- tested. The
mac_scsi, dmx3191d,g_NCR5380andatari_scsimodules were regression tested on suitable hardware.Changes since v1:
- Patch 8 omits a pointless assignment.
- Patch 10 gets a better error message.
- Patch 20 drops theWQ_CPU_INTENSIVEflag.
- Patch 21 adds timing calibration for the register polling loop.
- Patch 49 is replaced by a new one that removesFLAG_DTC3181E.
- Patch 72 by Ondrej Zary was added to fix pseudo DMA on 53C400.Changes since v2:
- Patch 21 has better calibration with low HZ values.
- Patch 57 no longer attempts to dereference a NULL pointer on Atari.
- Patch 66 initializesmax_sectorsin the host templates.
- Patches 73 thru 77 by Ondrej Zary were added with additional fixes for 53C400-compatible cards.--- drivers/scsi/Kconfig | 17 drivers/scsi/NCR5380.c | 2868 +++++++++++++++++++------------------------ drivers/scsi/NCR5380.h | 87 - drivers/scsi/arm/cumana_1.c | 31 drivers/scsi/arm/oak.c | 27 drivers/scsi/atari_NCR5380.c | 2292 +++++++++++++++------------------- drivers/scsi/atari_scsi.c | 102 - drivers/scsi/dmx3191d.c | 33 drivers/scsi/dtc.c | 115 - drivers/scsi/dtc.h | 45 drivers/scsi/g_NCR5380.c | 408 +++--- drivers/scsi/g_NCR5380.h | 66 drivers/scsi/mac_scsi.c | 117 - drivers/scsi/pas16.c | 116 - drivers/scsi/pas16.h | 40 drivers/scsi/sun3_scsi.c | 141 -- drivers/scsi/t128.c | 102 - drivers/scsi/t128.h | 39 18 files changed, 2957 insertions(+), 3689 deletions(-)