Lines Matching refs:ha
12 static inline void eeprom_cmd(uint32_t cmd, struct scsi_qla_host *ha) in eeprom_cmd() argument
14 writel(cmd, isp_nvram(ha)); in eeprom_cmd()
15 readl(isp_nvram(ha)); in eeprom_cmd()
19 static inline int eeprom_size(struct scsi_qla_host *ha) in eeprom_size() argument
21 return is_qla4010(ha) ? FM93C66A_SIZE_16 : FM93C86A_SIZE_16; in eeprom_size()
24 static inline int eeprom_no_addr_bits(struct scsi_qla_host *ha) in eeprom_no_addr_bits() argument
26 return is_qla4010(ha) ? FM93C56A_NO_ADDR_BITS_16 : in eeprom_no_addr_bits()
30 static inline int eeprom_no_data_bits(struct scsi_qla_host *ha) in eeprom_no_data_bits() argument
35 static int fm93c56a_select(struct scsi_qla_host * ha) in fm93c56a_select() argument
39 ha->eeprom_cmd_data = AUBURN_EEPROM_CS_1 | 0x000f0000; in fm93c56a_select()
40 eeprom_cmd(ha->eeprom_cmd_data, ha); in fm93c56a_select()
44 static int fm93c56a_cmd(struct scsi_qla_host * ha, int cmd, int addr) in fm93c56a_cmd() argument
52 eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1, ha); in fm93c56a_cmd()
54 eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 | in fm93c56a_cmd()
55 AUBURN_EEPROM_CLK_RISE, ha); in fm93c56a_cmd()
56 eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 | in fm93c56a_cmd()
57 AUBURN_EEPROM_CLK_FALL, ha); in fm93c56a_cmd()
72 eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha); in fm93c56a_cmd()
75 eeprom_cmd(ha->eeprom_cmd_data | dataBit | in fm93c56a_cmd()
76 AUBURN_EEPROM_CLK_RISE, ha); in fm93c56a_cmd()
77 eeprom_cmd(ha->eeprom_cmd_data | dataBit | in fm93c56a_cmd()
78 AUBURN_EEPROM_CLK_FALL, ha); in fm93c56a_cmd()
82 mask = 1 << (eeprom_no_addr_bits(ha) - 1); in fm93c56a_cmd()
86 for (i = 0; i < eeprom_no_addr_bits(ha); i++) { in fm93c56a_cmd()
94 eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha); in fm93c56a_cmd()
98 eeprom_cmd(ha->eeprom_cmd_data | dataBit | in fm93c56a_cmd()
99 AUBURN_EEPROM_CLK_RISE, ha); in fm93c56a_cmd()
100 eeprom_cmd(ha->eeprom_cmd_data | dataBit | in fm93c56a_cmd()
101 AUBURN_EEPROM_CLK_FALL, ha); in fm93c56a_cmd()
108 static int fm93c56a_deselect(struct scsi_qla_host * ha) in fm93c56a_deselect() argument
110 ha->eeprom_cmd_data = AUBURN_EEPROM_CS_0 | 0x000f0000; in fm93c56a_deselect()
111 eeprom_cmd(ha->eeprom_cmd_data, ha); in fm93c56a_deselect()
115 static int fm93c56a_datain(struct scsi_qla_host * ha, unsigned short *value) in fm93c56a_datain() argument
123 for (i = 0; i < eeprom_no_data_bits(ha); i++) { in fm93c56a_datain()
124 eeprom_cmd(ha->eeprom_cmd_data | in fm93c56a_datain()
125 AUBURN_EEPROM_CLK_RISE, ha); in fm93c56a_datain()
126 eeprom_cmd(ha->eeprom_cmd_data | in fm93c56a_datain()
127 AUBURN_EEPROM_CLK_FALL, ha); in fm93c56a_datain()
129 dataBit = (readw(isp_nvram(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0; in fm93c56a_datain()
139 struct scsi_qla_host * ha) in eeprom_readword() argument
141 fm93c56a_select(ha); in eeprom_readword()
142 fm93c56a_cmd(ha, FM93C56A_READ, eepromAddr); in eeprom_readword()
143 fm93c56a_datain(ha, value); in eeprom_readword()
144 fm93c56a_deselect(ha); in eeprom_readword()
149 u16 rd_nvram_word(struct scsi_qla_host * ha, int offset) in rd_nvram_word() argument
154 eeprom_readword(offset, &val, ha); in rd_nvram_word()
158 u8 rd_nvram_byte(struct scsi_qla_host *ha, int offset) in rd_nvram_byte() argument
169 val = le16_to_cpu(rd_nvram_word(ha, index)); in rd_nvram_byte()
179 int qla4xxx_is_nvram_configuration_valid(struct scsi_qla_host * ha) in qla4xxx_is_nvram_configuration_valid() argument
186 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_is_nvram_configuration_valid()
187 for (index = 0; index < eeprom_size(ha); index++) in qla4xxx_is_nvram_configuration_valid()
188 checksum += rd_nvram_word(ha, index); in qla4xxx_is_nvram_configuration_valid()
189 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_is_nvram_configuration_valid()
202 int ql4xxx_sem_spinlock(struct scsi_qla_host * ha, u32 sem_mask, u32 sem_bits) in ql4xxx_sem_spinlock() argument
209 "0x%x\n", ha->host_no, sem_mask, sem_bits)); in ql4xxx_sem_spinlock()
211 spin_lock_irqsave(&ha->hardware_lock, flags); in ql4xxx_sem_spinlock()
212 writel((sem_mask | sem_bits), isp_semaphore(ha)); in ql4xxx_sem_spinlock()
213 value = readw(isp_semaphore(ha)); in ql4xxx_sem_spinlock()
214 spin_unlock_irqrestore(&ha->hardware_lock, flags); in ql4xxx_sem_spinlock()
217 "code = 0x%x\n", ha->host_no, in ql4xxx_sem_spinlock()
226 void ql4xxx_sem_unlock(struct scsi_qla_host * ha, u32 sem_mask) in ql4xxx_sem_unlock() argument
230 spin_lock_irqsave(&ha->hardware_lock, flags); in ql4xxx_sem_unlock()
231 writel(sem_mask, isp_semaphore(ha)); in ql4xxx_sem_unlock()
232 readl(isp_semaphore(ha)); in ql4xxx_sem_unlock()
233 spin_unlock_irqrestore(&ha->hardware_lock, flags); in ql4xxx_sem_unlock()
235 DEBUG2(printk("scsi%ld : UNLOCK SEM - mask= 0x%x\n", ha->host_no, in ql4xxx_sem_unlock()
239 int ql4xxx_sem_lock(struct scsi_qla_host * ha, u32 sem_mask, u32 sem_bits) in ql4xxx_sem_lock() argument
244 spin_lock_irqsave(&ha->hardware_lock, flags); in ql4xxx_sem_lock()
245 writel((sem_mask | sem_bits), isp_semaphore(ha)); in ql4xxx_sem_lock()
246 value = readw(isp_semaphore(ha)); in ql4xxx_sem_lock()
247 spin_unlock_irqrestore(&ha->hardware_lock, flags); in ql4xxx_sem_lock()
250 "0x%x, sema code=0x%x\n", ha->host_no, in ql4xxx_sem_lock()