aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/advansys.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2007-07-26 23:51:47 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:39:12 -0400
commit9649af39e30d8d2668c35d008e8e14ae138e4d40 (patch)
treef8fccc5fa42fb89f52a274a76c8526f9e1cf8748 /drivers/scsi/advansys.c
parent71f36115d20e8d8b0ef10479ff0cde877ec56f98 (diff)
[SCSI] advansys: More PCI cleanups
- Remove wrappers around the PCI configuration space accessors - Call pci_set_master() instead of poking at config space directly - Move the latency setting into one function called for both narrow and wide boards. - Tidy up AdvInitGetConfig() a little. - Delete a few unused prototypes and definitions. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/advansys.c')
-rw-r--r--drivers/scsi/advansys.c254
1 files changed, 34 insertions, 220 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index d51ca86bda74..424549d79b13 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -854,15 +854,6 @@ typedef unsigned char uchar;
854#define ERR (-1) 854#define ERR (-1)
855#define UW_ERR (uint)(0xFFFF) 855#define UW_ERR (uint)(0xFFFF)
856#define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0) 856#define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0)
857#define AscPCIConfigVendorIDRegister 0x0000
858#define AscPCIConfigDeviceIDRegister 0x0002
859#define AscPCIConfigCommandRegister 0x0004
860#define AscPCIConfigStatusRegister 0x0006
861#define AscPCIConfigRevisionIDRegister 0x0008
862#define AscPCIConfigCacheSize 0x000C
863#define AscPCIConfigLatencyTimer 0x000D
864#define AscPCIIOBaseRegister 0x0010
865#define AscPCICmdRegBits_IOMemBusMaster 0x0007
866#define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7) 857#define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7)
867#define ASC_PCI_MKID(bus, dev, func) ((((dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF)) 858#define ASC_PCI_MKID(bus, dev, func) ((((dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF))
868 859
@@ -1936,17 +1927,11 @@ static uchar AscSetChipIRQ(PortAddr, uchar, ushort);
1936static ushort AscGetChipBiosAddress(PortAddr, ushort); 1927static ushort AscGetChipBiosAddress(PortAddr, ushort);
1937static inline ulong DvcEnterCritical(void); 1928static inline ulong DvcEnterCritical(void);
1938static inline void DvcLeaveCritical(ulong); 1929static inline void DvcLeaveCritical(ulong);
1939#ifdef CONFIG_PCI
1940static uchar DvcReadPCIConfigByte(ASC_DVC_VAR *, ushort);
1941static void DvcWritePCIConfigByte(ASC_DVC_VAR *, ushort, uchar);
1942#endif /* CONFIG_PCI */
1943static ushort AscGetChipBiosAddress(PortAddr, ushort); 1930static ushort AscGetChipBiosAddress(PortAddr, ushort);
1944static void DvcSleepMilliSecond(ASC_DCNT); 1931static void DvcSleepMilliSecond(ASC_DCNT);
1945static void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT); 1932static void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT);
1946static void DvcPutScsiQ(PortAddr, ushort, uchar *, int); 1933static void DvcPutScsiQ(PortAddr, ushort, uchar *, int);
1947static void DvcGetQinfo(PortAddr, ushort, uchar *, int); 1934static void DvcGetQinfo(PortAddr, ushort, uchar *, int);
1948static ushort AscInitGetConfig(ASC_DVC_VAR *);
1949static ushort AscInitSetConfig(ASC_DVC_VAR *);
1950static ushort AscInitAsc1000Driver(ASC_DVC_VAR *); 1935static ushort AscInitAsc1000Driver(ASC_DVC_VAR *);
1951static void AscAsyncFix(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *); 1936static void AscAsyncFix(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *);
1952static int AscTagQueuingSafe(ASC_SCSI_INQUIRY *); 1937static int AscTagQueuingSafe(ASC_SCSI_INQUIRY *);
@@ -3077,8 +3062,6 @@ typedef struct adv_scsi_req_q {
3077static inline ulong DvcEnterCritical(void); 3062static inline ulong DvcEnterCritical(void);
3078static inline void DvcLeaveCritical(ulong); 3063static inline void DvcLeaveCritical(ulong);
3079static void DvcSleepMilliSecond(ADV_DCNT); 3064static void DvcSleepMilliSecond(ADV_DCNT);
3080static uchar DvcAdvReadPCIConfigByte(ADV_DVC_VAR *, ushort);
3081static void DvcAdvWritePCIConfigByte(ADV_DVC_VAR *, ushort, uchar);
3082static ADV_PADDR DvcGetPhyAddr(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *, 3065static ADV_PADDR DvcGetPhyAddr(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *,
3083 uchar *, ASC_SDCNT *, int); 3066 uchar *, ASC_SDCNT *, int);
3084static void DvcDelayMicroSecond(ADV_DVC_VAR *, ushort); 3067static void DvcDelayMicroSecond(ADV_DVC_VAR *, ushort);
@@ -3112,12 +3095,6 @@ static void AdvSet38C1600EEPConfig(AdvPortAddr, ADVEEP_38C1600_CONFIG *);
3112static void AdvWaitEEPCmd(AdvPortAddr); 3095static void AdvWaitEEPCmd(AdvPortAddr);
3113static ushort AdvReadEEPWord(AdvPortAddr, int); 3096static ushort AdvReadEEPWord(AdvPortAddr, int);
3114 3097
3115/*
3116 * PCI Bus Definitions
3117 */
3118#define AscPCICmdRegBits_BusMastering 0x0007
3119#define AscPCICmdRegBits_ParErrRespCtrl 0x0040
3120
3121/* Read byte from a register. */ 3098/* Read byte from a register. */
3122#define AdvReadByteRegister(iop_base, reg_off) \ 3099#define AdvReadByteRegister(iop_base, reg_off) \
3123 (ADV_MEM_READB((iop_base) + (reg_off))) 3100 (ADV_MEM_READB((iop_base) + (reg_off)))
@@ -7327,31 +7304,6 @@ DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words)
7327} 7304}
7328 7305
7329/* 7306/*
7330 * Read a PCI configuration byte.
7331 */
7332static uchar __devinit DvcReadPCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset)
7333{
7334#ifdef CONFIG_PCI
7335 uchar byte_data;
7336 pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data);
7337 return byte_data;
7338#else /* !defined(CONFIG_PCI) */
7339 return 0;
7340#endif /* !defined(CONFIG_PCI) */
7341}
7342
7343/*
7344 * Write a PCI configuration byte.
7345 */
7346static void __devinit
7347DvcWritePCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data)
7348{
7349#ifdef CONFIG_PCI
7350 pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data);
7351#endif /* CONFIG_PCI */
7352}
7353
7354/*
7355 * Return the BIOS address of the adapter at the specified 7307 * Return the BIOS address of the adapter at the specified
7356 * I/O port and with the specified bus type. 7308 * I/O port and with the specified bus type.
7357 */ 7309 */
@@ -7424,33 +7376,6 @@ DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq,
7424} 7376}
7425 7377
7426/* 7378/*
7427 * Read a PCI configuration byte.
7428 */
7429static uchar __devinit DvcAdvReadPCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset)
7430{
7431#ifdef CONFIG_PCI
7432 uchar byte_data;
7433 pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data);
7434 return byte_data;
7435#else /* CONFIG_PCI */
7436 return 0;
7437#endif /* CONFIG_PCI */
7438}
7439
7440/*
7441 * Write a PCI configuration byte.
7442 */
7443static void __devinit
7444DvcAdvWritePCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset, uchar byte_data)
7445{
7446#ifdef CONFIG_PCI
7447 pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data);
7448#else /* CONFIG_PCI */
7449 return;
7450#endif /* CONFIG_PCI */
7451}
7452
7453/*
7454 * --- Tracing and Debugging Functions 7379 * --- Tracing and Debugging Functions
7455 */ 7380 */
7456 7381
@@ -10321,89 +10246,15 @@ static uchar __devinit AscGetIsaDmaSpeed(PortAddr iop_base)
10321} 10246}
10322#endif /* CONFIG_ISA */ 10247#endif /* CONFIG_ISA */
10323 10248
10324static ushort __devinit
10325AscReadPCIConfigWord(ASC_DVC_VAR *asc_dvc, ushort pci_config_offset)
10326{
10327 uchar lsb, msb;
10328
10329 lsb = DvcReadPCIConfigByte(asc_dvc, pci_config_offset);
10330 msb = DvcReadPCIConfigByte(asc_dvc, pci_config_offset + 1);
10331 return ((ushort)((msb << 8) | lsb));
10332}
10333
10334static ushort __devinit AscInitGetConfig(ASC_DVC_VAR *asc_dvc) 10249static ushort __devinit AscInitGetConfig(ASC_DVC_VAR *asc_dvc)
10335{ 10250{
10336 ushort warn_code; 10251 unsigned short warn_code = 0;
10337 PortAddr iop_base;
10338 ushort PCIDeviceID;
10339 ushort PCIVendorID;
10340 uchar PCIRevisionID;
10341 uchar prevCmdRegBits;
10342 10252
10343 warn_code = 0;
10344 iop_base = asc_dvc->iop_base;
10345 asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG; 10253 asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG;
10346 if (asc_dvc->err_code != 0) { 10254 if (asc_dvc->err_code != 0)
10347 return (UW_ERR); 10255 return (UW_ERR);
10348 }
10349 if (asc_dvc->bus_type == ASC_IS_PCI) {
10350 PCIVendorID = AscReadPCIConfigWord(asc_dvc,
10351 AscPCIConfigVendorIDRegister);
10352
10353 PCIDeviceID = AscReadPCIConfigWord(asc_dvc,
10354 AscPCIConfigDeviceIDRegister);
10355
10356 PCIRevisionID = DvcReadPCIConfigByte(asc_dvc,
10357 AscPCIConfigRevisionIDRegister);
10358 10256
10359 if (PCIVendorID != PCI_VENDOR_ID_ASP) { 10257 if (AscFindSignature(asc_dvc->iop_base)) {
10360 warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
10361 }
10362 prevCmdRegBits = DvcReadPCIConfigByte(asc_dvc,
10363 AscPCIConfigCommandRegister);
10364
10365 if ((prevCmdRegBits & AscPCICmdRegBits_IOMemBusMaster) !=
10366 AscPCICmdRegBits_IOMemBusMaster) {
10367 DvcWritePCIConfigByte(asc_dvc,
10368 AscPCIConfigCommandRegister,
10369 (prevCmdRegBits |
10370 AscPCICmdRegBits_IOMemBusMaster));
10371
10372 if ((DvcReadPCIConfigByte(asc_dvc,
10373 AscPCIConfigCommandRegister)
10374 & AscPCICmdRegBits_IOMemBusMaster)
10375 != AscPCICmdRegBits_IOMemBusMaster) {
10376 warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
10377 }
10378 }
10379 if ((PCIDeviceID == PCI_DEVICE_ID_ASP_1200A) ||
10380 (PCIDeviceID == PCI_DEVICE_ID_ASP_ABP940)) {
10381 DvcWritePCIConfigByte(asc_dvc,
10382 AscPCIConfigLatencyTimer, 0x00);
10383 if (DvcReadPCIConfigByte
10384 (asc_dvc, AscPCIConfigLatencyTimer)
10385 != 0x00) {
10386 warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
10387 }
10388 } else if (PCIDeviceID == PCI_DEVICE_ID_ASP_ABP940U) {
10389 if (DvcReadPCIConfigByte(asc_dvc,
10390 AscPCIConfigLatencyTimer) <
10391 0x20) {
10392 DvcWritePCIConfigByte(asc_dvc,
10393 AscPCIConfigLatencyTimer,
10394 0x20);
10395
10396 if (DvcReadPCIConfigByte(asc_dvc,
10397 AscPCIConfigLatencyTimer)
10398 < 0x20) {
10399 warn_code |=
10400 ASC_WARN_SET_PCI_CONFIG_SPACE;
10401 }
10402 }
10403 }
10404 }
10405
10406 if (AscFindSignature(iop_base)) {
10407 warn_code |= AscInitAscDvcVar(asc_dvc); 10258 warn_code |= AscInitAscDvcVar(asc_dvc);
10408 warn_code |= AscInitFromEEP(asc_dvc); 10259 warn_code |= AscInitFromEEP(asc_dvc);
10409 asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG; 10260 asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG;
@@ -10437,13 +10288,8 @@ static ushort __devinit AscInitFromAscDvcVar(ASC_DVC_VAR *asc_dvc)
10437 PortAddr iop_base; 10288 PortAddr iop_base;
10438 ushort cfg_msw; 10289 ushort cfg_msw;
10439 ushort warn_code; 10290 ushort warn_code;
10440 ushort pci_device_id = 0;
10441 10291
10442 iop_base = asc_dvc->iop_base; 10292 iop_base = asc_dvc->iop_base;
10443#ifdef CONFIG_PCI
10444 if (asc_dvc->cfg->dev)
10445 pci_device_id = to_pci_dev(asc_dvc->cfg->dev)->device;
10446#endif
10447 warn_code = 0; 10293 warn_code = 0;
10448 cfg_msw = AscGetChipCfgMsw(iop_base); 10294 cfg_msw = AscGetChipCfgMsw(iop_base);
10449 if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) { 10295 if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) {
@@ -10465,19 +10311,23 @@ static ushort __devinit AscInitFromAscDvcVar(ASC_DVC_VAR *asc_dvc)
10465 asc_dvc->err_code |= ASC_IERR_SET_IRQ_NO; 10311 asc_dvc->err_code |= ASC_IERR_SET_IRQ_NO;
10466 } 10312 }
10467 } 10313 }
10314#ifdef CONFIG_PCI
10468 if (asc_dvc->bus_type & ASC_IS_PCI) { 10315 if (asc_dvc->bus_type & ASC_IS_PCI) {
10316 struct pci_dev *pdev = to_pci_dev(asc_dvc->cfg->dev);
10469 cfg_msw &= 0xFFC0; 10317 cfg_msw &= 0xFFC0;
10470 AscSetChipCfgMsw(iop_base, cfg_msw); 10318 AscSetChipCfgMsw(iop_base, cfg_msw);
10471 if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) { 10319 if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) {
10472 } else { 10320 } else {
10473 if ((pci_device_id == PCI_DEVICE_ID_ASP_1200A) || 10321 if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) ||
10474 (pci_device_id == PCI_DEVICE_ID_ASP_ABP940)) { 10322 (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) {
10475 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB; 10323 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB;
10476 asc_dvc->bug_fix_cntl |= 10324 asc_dvc->bug_fix_cntl |=
10477 ASC_BUG_FIX_ASYN_USE_SYN; 10325 ASC_BUG_FIX_ASYN_USE_SYN;
10478 } 10326 }
10479 } 10327 }
10480 } else if (asc_dvc->bus_type == ASC_IS_ISAPNP) { 10328 } else
10329#endif /* CONFIG_PCI */
10330 if (asc_dvc->bus_type == ASC_IS_ISAPNP) {
10481 if (AscGetChipVersion(iop_base, asc_dvc->bus_type) 10331 if (AscGetChipVersion(iop_base, asc_dvc->bus_type)
10482 == ASC_CHIP_VER_ASYN_BUG) { 10332 == ASC_CHIP_VER_ASYN_BUG) {
10483 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN; 10333 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN;
@@ -13875,55 +13725,13 @@ static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __devinitdata =
13875 */ 13725 */
13876static int __devinit AdvInitGetConfig(ADV_DVC_VAR *asc_dvc) 13726static int __devinit AdvInitGetConfig(ADV_DVC_VAR *asc_dvc)
13877{ 13727{
13878 ushort warn_code; 13728 unsigned short warn_code = 0;
13879 AdvPortAddr iop_base; 13729 AdvPortAddr iop_base = asc_dvc->iop_base;
13880 uchar pci_cmd_reg; 13730 struct pci_dev *pdev = to_pci_dev(asc_dvc->cfg->dev);
13731 u16 cmd;
13881 int status; 13732 int status;
13882 13733
13883 warn_code = 0;
13884 asc_dvc->err_code = 0; 13734 asc_dvc->err_code = 0;
13885 iop_base = asc_dvc->iop_base;
13886
13887 /*
13888 * PCI Command Register
13889 *
13890 * Note: AscPCICmdRegBits_BusMastering definition (0x0007) includes
13891 * I/O Space Control, Memory Space Control and Bus Master Control bits.
13892 */
13893
13894 if (((pci_cmd_reg = DvcAdvReadPCIConfigByte(asc_dvc,
13895 AscPCIConfigCommandRegister))
13896 & AscPCICmdRegBits_BusMastering)
13897 != AscPCICmdRegBits_BusMastering) {
13898 pci_cmd_reg |= AscPCICmdRegBits_BusMastering;
13899
13900 DvcAdvWritePCIConfigByte(asc_dvc,
13901 AscPCIConfigCommandRegister,
13902 pci_cmd_reg);
13903
13904 if (((DvcAdvReadPCIConfigByte
13905 (asc_dvc, AscPCIConfigCommandRegister))
13906 & AscPCICmdRegBits_BusMastering)
13907 != AscPCICmdRegBits_BusMastering) {
13908 warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
13909 }
13910 }
13911
13912 /*
13913 * PCI Latency Timer
13914 *
13915 * If the "latency timer" register is 0x20 or above, then we don't need
13916 * to change it. Otherwise, set it to 0x20 (i.e. set it to 0x20 if it
13917 * comes up less than 0x20).
13918 */
13919 if (DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer) < 0x20) {
13920 DvcAdvWritePCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer,
13921 0x20);
13922 if (DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer) <
13923 0x20) {
13924 warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
13925 }
13926 }
13927 13735
13928 /* 13736 /*
13929 * Save the state of the PCI Configuration Command Register 13737 * Save the state of the PCI Configuration Command Register
@@ -13932,10 +13740,9 @@ static int __devinit AdvInitGetConfig(ADV_DVC_VAR *asc_dvc)
13932 * DMA parity errors. 13740 * DMA parity errors.
13933 */ 13741 */
13934 asc_dvc->cfg->control_flag = 0; 13742 asc_dvc->cfg->control_flag = 0;
13935 if (((DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigCommandRegister) 13743 pci_read_config_word(pdev, PCI_COMMAND, &cmd);
13936 & AscPCICmdRegBits_ParErrRespCtrl)) == 0) { 13744 if ((cmd & PCI_COMMAND_PARITY) == 0)
13937 asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR; 13745 asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR;
13938 }
13939 13746
13940 asc_dvc->cfg->lib_version = (ADV_LIB_VERSION_MAJOR << 8) | 13747 asc_dvc->cfg->lib_version = (ADV_LIB_VERSION_MAJOR << 8) |
13941 ADV_LIB_VERSION_MINOR; 13748 ADV_LIB_VERSION_MINOR;
@@ -13977,19 +13784,11 @@ static int __devinit AdvInitGetConfig(ADV_DVC_VAR *asc_dvc)
13977 ADV_CTRL_REG_CMD_WR_IO_REG); 13784 ADV_CTRL_REG_CMD_WR_IO_REG);
13978 13785
13979 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { 13786 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
13980 if ((status = 13787 status = AdvInitFrom38C1600EEP(asc_dvc);
13981 AdvInitFrom38C1600EEP(asc_dvc)) == ADV_ERROR) {
13982 return ADV_ERROR;
13983 }
13984 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { 13788 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
13985 if ((status = 13789 status = AdvInitFrom38C0800EEP(asc_dvc);
13986 AdvInitFrom38C0800EEP(asc_dvc)) == ADV_ERROR) {
13987 return ADV_ERROR;
13988 }
13989 } else { 13790 } else {
13990 if ((status = AdvInitFrom3550EEP(asc_dvc)) == ADV_ERROR) { 13791 status = AdvInitFrom3550EEP(asc_dvc);
13991 return ADV_ERROR;
13992 }
13993 } 13792 }
13994 warn_code |= status; 13793 warn_code |= status;
13995 } 13794 }
@@ -18488,6 +18287,19 @@ static struct pci_device_id advansys_pci_tbl[] __devinitdata = {
18488 18287
18489MODULE_DEVICE_TABLE(pci, advansys_pci_tbl); 18288MODULE_DEVICE_TABLE(pci, advansys_pci_tbl);
18490 18289
18290static void __devinit advansys_set_latency(struct pci_dev *pdev)
18291{
18292 if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) ||
18293 (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) {
18294 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0);
18295 } else {
18296 u8 latency;
18297 pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
18298 if (latency < 0x20)
18299 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x20);
18300 }
18301}
18302
18491static int __devinit 18303static int __devinit
18492advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 18304advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
18493{ 18305{
@@ -18500,6 +18312,8 @@ advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
18500 err = pci_request_regions(pdev, "advansys"); 18312 err = pci_request_regions(pdev, "advansys");
18501 if (err) 18313 if (err)
18502 goto disable_device; 18314 goto disable_device;
18315 pci_set_master(pdev);
18316 advansys_set_latency(pdev);
18503 18317
18504 if (pci_resource_len(pdev, 0) == 0) 18318 if (pci_resource_len(pdev, 0) == 0)
18505 goto nodev; 18319 goto nodev;