Commit 6baf5103 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_eeprom: rename 'pc_PCIChipInformation'

This variable is the pointer to the string name of the eeprom type
found on the board. This name comes from the boardinfo of the
driver.

For aesthetic reasons, rename it to simply 'type'.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f9d83443
...@@ -208,7 +208,7 @@ static void v_EepromWaitBusy(unsigned long iobase) ...@@ -208,7 +208,7 @@ static void v_EepromWaitBusy(unsigned long iobase)
} }
static unsigned short w_EepromReadWord(unsigned long iobase, static unsigned short w_EepromReadWord(unsigned long iobase,
char *pc_PCIChipInformation, char *type,
unsigned short w_EepromStartAddress) unsigned short w_EepromStartAddress)
{ {
unsigned char b_Counter = 0; unsigned char b_Counter = 0;
...@@ -220,9 +220,7 @@ static unsigned short w_EepromReadWord(unsigned long iobase, ...@@ -220,9 +220,7 @@ static unsigned short w_EepromReadWord(unsigned long iobase,
unsigned short w_ReadWord = 0; unsigned short w_ReadWord = 0;
/* Test the PCI chip type */ /* Test the PCI chip type */
if ((!strcmp(pc_PCIChipInformation, "S5920")) || if (!strcmp(type, "S5920") || !strcmp(type, "S5933")) {
(!strcmp(pc_PCIChipInformation, "S5933")))
{
for (b_Counter = 0; b_Counter < 2; b_Counter++) for (b_Counter = 0; b_Counter < 2; b_Counter++)
{ {
b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256; /* Read the low 8 bit part */ b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256; /* Read the low 8 bit part */
...@@ -276,10 +274,9 @@ static unsigned short w_EepromReadWord(unsigned long iobase, ...@@ -276,10 +274,9 @@ static unsigned short w_EepromReadWord(unsigned long iobase,
} /* for (b_Counter=0; b_Counter<2; b_Counter++) */ } /* for (b_Counter=0; b_Counter<2; b_Counter++) */
w_ReadWord = (b_ReadLowByte | (((unsigned short) b_ReadHighByte) * 256)); w_ReadWord = (b_ReadLowByte | (((unsigned short) b_ReadHighByte) * 256));
} /* end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933"))) */ }
if (!strcmp(pc_PCIChipInformation, "93C76")) if (!strcmp(type, "93C76")) {
{
/* Read 16 bit from the EEPROM 93C76 */ /* Read 16 bit from the EEPROM 93C76 */
v_EepromCs76Read(iobase, w_EepromStartAddress, &w_ReadWord); v_EepromCs76Read(iobase, w_EepromStartAddress, &w_ReadWord);
} }
...@@ -288,43 +285,42 @@ static unsigned short w_EepromReadWord(unsigned long iobase, ...@@ -288,43 +285,42 @@ static unsigned short w_EepromReadWord(unsigned long iobase,
} }
static int i_EepromReadDigitalInputHeader(unsigned long iobase, static int i_EepromReadDigitalInputHeader(unsigned long iobase,
char *pc_PCIChipInformation, char *type,
unsigned short w_Address, unsigned short w_Address,
struct str_DigitalInputHeader *s_Header) struct str_DigitalInputHeader *s_Header)
{ {
unsigned short w_Temp; unsigned short w_Temp;
/* read nbr of channels */ /* read nbr of channels */
s_Header->w_Nchannel = w_EepromReadWord(iobase, pc_PCIChipInformation, s_Header->w_Nchannel = w_EepromReadWord(iobase, type,
0x100 + w_Address + 6); 0x100 + w_Address + 6);
/* interruptible or not */ /* interruptible or not */
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 8); 0x100 + w_Address + 8);
s_Header->b_Interruptible = (unsigned char) (w_Temp >> 7) & 0x01; s_Header->b_Interruptible = (unsigned char) (w_Temp >> 7) & 0x01;
/* How many interruptible logic */ /* How many interruptible logic */
s_Header->w_NinterruptLogic = w_EepromReadWord(iobase, s_Header->w_NinterruptLogic = w_EepromReadWord(iobase, type,
pc_PCIChipInformation,
0x100 + w_Address + 10); 0x100 + w_Address + 10);
return 0; return 0;
} }
static int i_EepromReadDigitalOutputHeader(unsigned long iobase, static int i_EepromReadDigitalOutputHeader(unsigned long iobase,
char *pc_PCIChipInformation, char *type,
unsigned short w_Address, unsigned short w_Address,
struct str_DigitalOutputHeader *s_Header) struct str_DigitalOutputHeader *s_Header)
{ {
/* Read Nbr channels */ /* Read Nbr channels */
s_Header->w_Nchannel = w_EepromReadWord(iobase, pc_PCIChipInformation, s_Header->w_Nchannel = w_EepromReadWord(iobase, type,
0x100 + w_Address + 6); 0x100 + w_Address + 6);
return 0; return 0;
} }
#if 0 #if 0
static int i_EepromReadTimerHeader(unsigned long iobase, static int i_EepromReadTimerHeader(unsigned long iobase,
char *pc_PCIChipInformation, char *type,
unsigned short w_Address, unsigned short w_Address,
struct str_TimerMainHeader *s_Header) struct str_TimerMainHeader *s_Header)
{ {
...@@ -332,14 +328,14 @@ static int i_EepromReadTimerHeader(unsigned long iobase, ...@@ -332,14 +328,14 @@ static int i_EepromReadTimerHeader(unsigned long iobase,
unsigned short i, w_Size = 0, w_Temp; unsigned short i, w_Size = 0, w_Temp;
/* Read No of Timer */ /* Read No of Timer */
s_Header->w_Ntimer = w_EepromReadWord(iobase, pc_PCIChipInformation, s_Header->w_Ntimer = w_EepromReadWord(iobase, type,
0x100 + w_Address + 6); 0x100 + w_Address + 6);
/* Read header size */ /* Read header size */
for (i = 0; i < s_Header->w_Ntimer; i++) { for (i = 0; i < s_Header->w_Ntimer; i++) {
s_Header->s_TimerDetails[i].w_HeaderSize = s_Header->s_TimerDetails[i].w_HeaderSize =
w_EepromReadWord(iobase, pc_PCIChipInformation, w_EepromReadWord(iobase, type,
0x100 + w_Address + 8 + w_Size + 0); 0x100 + w_Address + 8 + w_Size + 0);
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 8 + w_Size + 2); 0x100 + w_Address + 8 + w_Size + 2);
/* Read Resolution */ /* Read Resolution */
...@@ -350,7 +346,7 @@ static int i_EepromReadTimerHeader(unsigned long iobase, ...@@ -350,7 +346,7 @@ static int i_EepromReadTimerHeader(unsigned long iobase,
s_Header->s_TimerDetails[i].b_Mode = s_Header->s_TimerDetails[i].b_Mode =
(unsigned char) (w_Temp >> 4) & 0x3F; (unsigned char) (w_Temp >> 4) & 0x3F;
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 8 + w_Size + 4); 0x100 + w_Address + 8 + w_Size + 4);
/* Read MinTiming */ /* Read MinTiming */
...@@ -366,18 +362,18 @@ static int i_EepromReadTimerHeader(unsigned long iobase, ...@@ -366,18 +362,18 @@ static int i_EepromReadTimerHeader(unsigned long iobase,
#endif #endif
static int i_EepromReadAnlogOutputHeader(unsigned long iobase, static int i_EepromReadAnlogOutputHeader(unsigned long iobase,
char *pc_PCIChipInformation, char *type,
unsigned short w_Address, unsigned short w_Address,
struct str_AnalogOutputHeader *s_Header) struct str_AnalogOutputHeader *s_Header)
{ {
unsigned short w_Temp; unsigned short w_Temp;
/* No of channels for 1st hard component */ /* No of channels for 1st hard component */
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 10); 0x100 + w_Address + 10);
s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF; s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
/* Resolution for 1st hard component */ /* Resolution for 1st hard component */
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 16); 0x100 + w_Address + 16);
s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF; s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF;
return 0; return 0;
...@@ -385,25 +381,23 @@ static int i_EepromReadAnlogOutputHeader(unsigned long iobase, ...@@ -385,25 +381,23 @@ static int i_EepromReadAnlogOutputHeader(unsigned long iobase,
/* Reads only for ONE hardware component */ /* Reads only for ONE hardware component */
static int i_EepromReadAnlogInputHeader(unsigned long iobase, static int i_EepromReadAnlogInputHeader(unsigned long iobase,
char *pc_PCIChipInformation, char *type,
unsigned short w_Address, unsigned short w_Address,
struct str_AnalogInputHeader *s_Header) struct str_AnalogInputHeader *s_Header)
{ {
unsigned short w_Temp, w_Offset; unsigned short w_Temp, w_Offset;
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 10); 0x100 + w_Address + 10);
s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF; s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
s_Header->w_MinConvertTiming = w_EepromReadWord(iobase, s_Header->w_MinConvertTiming = w_EepromReadWord(iobase, type,
pc_PCIChipInformation,
0x100 + w_Address + 16); 0x100 + w_Address + 16);
s_Header->w_MinDelayTiming = w_EepromReadWord(iobase, s_Header->w_MinDelayTiming = w_EepromReadWord(iobase, type,
pc_PCIChipInformation,
0x100 + w_Address + 30); 0x100 + w_Address + 30);
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 20); 0x100 + w_Address + 20);
s_Header->b_HasDma = (w_Temp >> 13) & 0x01; /* whether dma present or not */ s_Header->b_HasDma = (w_Temp >> 13) & 0x01; /* whether dma present or not */
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + 72); /* reading Y */ 0x100 + w_Address + 72); /* reading Y */
w_Temp = w_Temp & 0x00FF; w_Temp = w_Temp & 0x00FF;
if (w_Temp) /* Y>0 */ if (w_Temp) /* Y>0 */
...@@ -417,7 +411,7 @@ static int i_EepromReadAnlogInputHeader(unsigned long iobase, ...@@ -417,7 +411,7 @@ static int i_EepromReadAnlogInputHeader(unsigned long iobase,
} }
/* read Resolution */ /* read Resolution */
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + w_Address + w_Offset); 0x100 + w_Address + w_Offset);
s_Header->b_Resolution = w_Temp & 0x001F; /* last 5 bits */ s_Header->b_Resolution = w_Temp & 0x001F; /* last 5 bits */
...@@ -425,7 +419,7 @@ static int i_EepromReadAnlogInputHeader(unsigned long iobase, ...@@ -425,7 +419,7 @@ static int i_EepromReadAnlogInputHeader(unsigned long iobase,
} }
static int i_EepromReadMainHeader(unsigned long iobase, static int i_EepromReadMainHeader(unsigned long iobase,
char *pc_PCIChipInformation, char *type,
struct comedi_device *dev) struct comedi_device *dev)
{ {
const struct addi_board *this_board = comedi_board(dev); const struct addi_board *this_board = comedi_board(dev);
...@@ -440,25 +434,24 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -440,25 +434,24 @@ static int i_EepromReadMainHeader(unsigned long iobase,
struct str_AnalogInputHeader s_AnalogInputHeader; struct str_AnalogInputHeader s_AnalogInputHeader;
/* Read size */ /* Read size */
s_MainHeader.w_HeaderSize = w_EepromReadWord(iobase, s_MainHeader.w_HeaderSize = w_EepromReadWord(iobase, type,
pc_PCIChipInformation,
0x100 + 8); 0x100 + 8);
/* Read nbr of functionality */ /* Read nbr of functionality */
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + 10); 0x100 + 10);
s_MainHeader.b_Nfunctions = (unsigned char) w_Temp & 0x00FF; s_MainHeader.b_Nfunctions = (unsigned char) w_Temp & 0x00FF;
/* Read functionality details */ /* Read functionality details */
for (i = 0; i < s_MainHeader.b_Nfunctions; i++) { for (i = 0; i < s_MainHeader.b_Nfunctions; i++) {
/* Read Type */ /* Read Type */
w_Temp = w_EepromReadWord(iobase, pc_PCIChipInformation, w_Temp = w_EepromReadWord(iobase, type,
0x100 + 12 + w_Count); 0x100 + 12 + w_Count);
s_MainHeader.s_Functions[i].b_Type = (unsigned char) w_Temp & 0x3F; s_MainHeader.s_Functions[i].b_Type = (unsigned char) w_Temp & 0x3F;
w_Count = w_Count + 2; w_Count = w_Count + 2;
/* Read Address */ /* Read Address */
s_MainHeader.s_Functions[i].w_Address = s_MainHeader.s_Functions[i].w_Address =
w_EepromReadWord(iobase, pc_PCIChipInformation, w_EepromReadWord(iobase, type,
0x100 + 12 + w_Count); 0x100 + 12 + w_Count);
w_Count = w_Count + 2; w_Count = w_Count + 2;
} }
...@@ -468,8 +461,7 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -468,8 +461,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
switch (s_MainHeader.s_Functions[i].b_Type) { switch (s_MainHeader.s_Functions[i].b_Type) {
case EEPROM_DIGITALINPUT: case EEPROM_DIGITALINPUT:
i_EepromReadDigitalInputHeader(iobase, i_EepromReadDigitalInputHeader(iobase, type,
pc_PCIChipInformation,
s_MainHeader.s_Functions[i].w_Address, s_MainHeader.s_Functions[i].w_Address,
&s_DigitalInputHeader); &s_DigitalInputHeader);
devpriv->s_EeParameters.i_NbrDiChannel = devpriv->s_EeParameters.i_NbrDiChannel =
...@@ -477,8 +469,7 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -477,8 +469,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
break; break;
case EEPROM_DIGITALOUTPUT: case EEPROM_DIGITALOUTPUT:
i_EepromReadDigitalOutputHeader(iobase, i_EepromReadDigitalOutputHeader(iobase, type,
pc_PCIChipInformation,
s_MainHeader.s_Functions[i].w_Address, s_MainHeader.s_Functions[i].w_Address,
&s_DigitalOutputHeader); &s_DigitalOutputHeader);
devpriv->s_EeParameters.i_NbrDoChannel = devpriv->s_EeParameters.i_NbrDoChannel =
...@@ -490,8 +481,7 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -490,8 +481,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
break; break;
case EEPROM_ANALOGINPUT: case EEPROM_ANALOGINPUT:
i_EepromReadAnlogInputHeader(iobase, i_EepromReadAnlogInputHeader(iobase, type,
pc_PCIChipInformation,
s_MainHeader.s_Functions[i].w_Address, s_MainHeader.s_Functions[i].w_Address,
&s_AnalogInputHeader); &s_AnalogInputHeader);
if (!(strcmp(this_board->pc_DriverName, "apci3200"))) if (!(strcmp(this_board->pc_DriverName, "apci3200")))
...@@ -515,8 +505,7 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -515,8 +505,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
break; break;
case EEPROM_ANALOGOUTPUT: case EEPROM_ANALOGOUTPUT:
i_EepromReadAnlogOutputHeader(iobase, i_EepromReadAnlogOutputHeader(iobase, type,
pc_PCIChipInformation,
s_MainHeader.s_Functions[i].w_Address, s_MainHeader.s_Functions[i].w_Address,
&s_AnalogOutputHeader); &s_AnalogOutputHeader);
devpriv->s_EeParameters.i_NbrAoChannel = devpriv->s_EeParameters.i_NbrAoChannel =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment