• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/infiniband/hw/ipath/

Lines Matching refs:dd

87  * @dd: the infinipath device
94 static int i2c_gpio_set(struct ipath_devdata *dd,
100 gpioval = &dd->ipath_gpio_out;
101 read_val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_extctrl);
103 mask = dd->ipath_gpio_scl;
105 mask = dd->ipath_gpio_sda;
113 ipath_write_kreg(dd, dd->ipath_kregs->kr_extctrl, write_val);
122 write_val <<= dd->ipath_gpio_scl_num;
123 *gpioval = *gpioval & ~(1UL << dd->ipath_gpio_scl_num);
126 write_val <<= dd->ipath_gpio_sda_num;
127 *gpioval = *gpioval & ~(1UL << dd->ipath_gpio_sda_num);
130 ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_out, *gpioval);
137 * @dd: the infinipath device
144 static int i2c_gpio_get(struct ipath_devdata *dd,
157 read_val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_extctrl);
160 mask = dd->ipath_gpio_scl;
162 mask = dd->ipath_gpio_sda;
164 ipath_write_kreg(dd, dd->ipath_kregs->kr_extctrl, write_val);
165 read_val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_extstatus);
180 * @dd: the infinipath device
187 static void i2c_wait_for_writes(struct ipath_devdata *dd)
189 (void)ipath_read_kreg32(dd, dd->ipath_kregs->kr_scratch);
193 static void scl_out(struct ipath_devdata *dd, u8 bit)
195 i2c_gpio_set(dd, i2c_line_scl, bit ? i2c_line_high : i2c_line_low);
197 i2c_wait_for_writes(dd);
200 static void sda_out(struct ipath_devdata *dd, u8 bit)
202 i2c_gpio_set(dd, i2c_line_sda, bit ? i2c_line_high : i2c_line_low);
204 i2c_wait_for_writes(dd);
207 static u8 sda_in(struct ipath_devdata *dd, int wait)
211 if (i2c_gpio_get(dd, i2c_line_sda, &bit))
215 i2c_wait_for_writes(dd);
222 * @dd: the infinipath device
224 static int i2c_ackrcv(struct ipath_devdata *dd)
230 ack_received = sda_in(dd, 1);
231 scl_out(dd, i2c_line_high);
232 ack_received = sda_in(dd, 1) == 0;
233 scl_out(dd, i2c_line_low);
239 * @dd: the infinipath device
244 static int wr_byte(struct ipath_devdata *dd, u8 data)
251 sda_out(dd, bit);
252 scl_out(dd, i2c_line_high);
253 scl_out(dd, i2c_line_low);
255 return (!i2c_ackrcv(dd)) ? 1 : 0;
258 static void send_ack(struct ipath_devdata *dd)
260 sda_out(dd, i2c_line_low);
261 scl_out(dd, i2c_line_high);
262 scl_out(dd, i2c_line_low);
263 sda_out(dd, i2c_line_high);
268 * @dd: the infinipath device
273 static int i2c_startcmd(struct ipath_devdata *dd, u8 offset_dir)
278 sda_out(dd, i2c_line_high);
279 scl_out(dd, i2c_line_high);
280 sda_out(dd, i2c_line_low);
281 scl_out(dd, i2c_line_low);
284 res = wr_byte(dd, offset_dir);
294 * @dd: the infinipath device
298 static void stop_cmd(struct ipath_devdata *dd)
300 scl_out(dd, i2c_line_low);
301 sda_out(dd, i2c_line_low);
302 scl_out(dd, i2c_line_high);
303 sda_out(dd, i2c_line_high);
309 * @dd: the infinipath device
312 static int eeprom_reset(struct ipath_devdata *dd)
315 u64 *gpioval = &dd->ipath_gpio_out;
319 *gpioval = ipath_read_kreg64(dd, dd->ipath_kregs->kr_gpio_out);
328 scl_out(dd, i2c_line_low);
329 sda_out(dd, i2c_line_high);
332 scl_out(dd, i2c_line_high);
334 if (sda_in(dd, 0)) {
335 sda_out(dd, i2c_line_low);
336 scl_out(dd, i2c_line_low);
341 scl_out(dd, i2c_line_low);
352 * @dd: the infinipath device
358 int ipath_eeprom_read(struct ipath_devdata *dd, u8 eeprom_offset,
367 eeprom_reset(dd);
371 if (i2c_startcmd(dd, eeprom_offset)) {
373 stop_cmd(dd);
387 scl_out(dd, i2c_line_high);
388 bit = sda_in(dd, 0);
390 scl_out(dd, i2c_line_low);
395 send_ack(dd);
401 stop_cmd(dd);
411 * @dd: the infinipath device
416 int ipath_eeprom_write(struct ipath_devdata *dd, u8 eeprom_offset,
426 eeprom_reset(dd);
429 if (i2c_startcmd(dd, (eeprom_offset << 1) | WRITE_CMD)) {
440 if (wr_byte(dd, *bp++)) {
448 stop_cmd(dd);
460 while (i2c_startcmd(dd, READ_CMD)) {
461 stop_cmd(dd);
471 scl_out(dd, i2c_line_high);
472 bit = sda_in(dd, 0);
473 scl_out(dd, i2c_line_low);
477 stop_cmd(dd);
484 stop_cmd(dd);
508 * @dd: the infinipath device
513 void ipath_get_eeprom_info(struct ipath_devdata *dd)
520 int t = dd->ipath_unit;
525 dd->ipath_guid = dd0->ipath_guid;
526 bguid = (u8 *) & dd->ipath_guid;
534 dd,
538 dd->ipath_guid = 0;
545 dd->ipath_nguid = 1;
550 (unsigned long long) be64_to_cpu(dd->ipath_guid));
557 ipath_dev_err(dd, "Couldn't allocate memory to read %u "
562 if (ipath_eeprom_read(dd, 0, buf, len)) {
563 ipath_dev_err(dd, "Failed reading GUID from eeprom\n");
570 dev_info(&dd->pcidev->dev, "Bad I2C flash checksum: "
576 ipath_dev_err(dd, "Invalid GUID %llx from flash; "
585 dev_info(&dd->pcidev->dev, "Warning, GUID %llx is "
603 dd->ipath_guid = guid;
604 dd->ipath_nguid = ifp->if_numguid;
615 char *snp = dd->ipath_serial;
621 len = (sizeof dd->ipath_serial) - len;
627 memcpy(dd->ipath_serial, ifp->if_serial,
630 ipath_dev_err(dd, "Board SN %s did not pass functional "
631 "test: %s\n", dd->ipath_serial,
635 (unsigned long long) be64_to_cpu(dd->ipath_guid));