Lines Matching refs:chip
153 static void pch_phub_read_modify_write_reg(struct pch_phub_reg *chip, in pch_phub_read_modify_write_reg() argument
157 void __iomem *reg_addr = chip->pch_phub_base_address + reg_addr_offset; in pch_phub_read_modify_write_reg()
166 struct pch_phub_reg *chip = pci_get_drvdata(pdev); in pch_phub_save_reg_conf() local
168 void __iomem *p = chip->pch_phub_base_address; in pch_phub_save_reg_conf()
170 chip->phub_id_reg = ioread32(p + PCH_PHUB_ID_REG); in pch_phub_save_reg_conf()
171 chip->q_pri_val_reg = ioread32(p + PCH_PHUB_QUEUE_PRI_VAL_REG); in pch_phub_save_reg_conf()
172 chip->rc_q_maxsize_reg = ioread32(p + PCH_PHUB_RC_QUEUE_MAXSIZE_REG); in pch_phub_save_reg_conf()
173 chip->bri_q_maxsize_reg = ioread32(p + PCH_PHUB_BRI_QUEUE_MAXSIZE_REG); in pch_phub_save_reg_conf()
174 chip->comp_resp_timeout_reg = in pch_phub_save_reg_conf()
176 chip->bus_slave_control_reg = in pch_phub_save_reg_conf()
178 chip->deadlock_avoid_type_reg = in pch_phub_save_reg_conf()
180 chip->intpin_reg_wpermit_reg0 = in pch_phub_save_reg_conf()
182 chip->intpin_reg_wpermit_reg1 = in pch_phub_save_reg_conf()
184 chip->intpin_reg_wpermit_reg2 = in pch_phub_save_reg_conf()
186 chip->intpin_reg_wpermit_reg3 = in pch_phub_save_reg_conf()
200 chip->phub_id_reg, in pch_phub_save_reg_conf()
201 chip->q_pri_val_reg, in pch_phub_save_reg_conf()
202 chip->rc_q_maxsize_reg, in pch_phub_save_reg_conf()
203 chip->bri_q_maxsize_reg, in pch_phub_save_reg_conf()
204 chip->comp_resp_timeout_reg, in pch_phub_save_reg_conf()
205 chip->bus_slave_control_reg, in pch_phub_save_reg_conf()
206 chip->deadlock_avoid_type_reg, in pch_phub_save_reg_conf()
207 chip->intpin_reg_wpermit_reg0, in pch_phub_save_reg_conf()
208 chip->intpin_reg_wpermit_reg1, in pch_phub_save_reg_conf()
209 chip->intpin_reg_wpermit_reg2, in pch_phub_save_reg_conf()
210 chip->intpin_reg_wpermit_reg3); in pch_phub_save_reg_conf()
212 chip->int_reduce_control_reg[i] = in pch_phub_save_reg_conf()
216 __func__, i, chip->int_reduce_control_reg[i]); in pch_phub_save_reg_conf()
218 chip->clkcfg_reg = ioread32(p + CLKCFG_REG_OFFSET); in pch_phub_save_reg_conf()
219 if ((chip->ioh_type == 2) || (chip->ioh_type == 4)) in pch_phub_save_reg_conf()
220 chip->funcsel_reg = ioread32(p + FUNCSEL_REG_OFFSET); in pch_phub_save_reg_conf()
227 struct pch_phub_reg *chip = pci_get_drvdata(pdev); in pch_phub_restore_reg_conf() local
229 p = chip->pch_phub_base_address; in pch_phub_restore_reg_conf()
231 iowrite32(chip->phub_id_reg, p + PCH_PHUB_ID_REG); in pch_phub_restore_reg_conf()
232 iowrite32(chip->q_pri_val_reg, p + PCH_PHUB_QUEUE_PRI_VAL_REG); in pch_phub_restore_reg_conf()
233 iowrite32(chip->rc_q_maxsize_reg, p + PCH_PHUB_RC_QUEUE_MAXSIZE_REG); in pch_phub_restore_reg_conf()
234 iowrite32(chip->bri_q_maxsize_reg, p + PCH_PHUB_BRI_QUEUE_MAXSIZE_REG); in pch_phub_restore_reg_conf()
235 iowrite32(chip->comp_resp_timeout_reg, in pch_phub_restore_reg_conf()
237 iowrite32(chip->bus_slave_control_reg, in pch_phub_restore_reg_conf()
239 iowrite32(chip->deadlock_avoid_type_reg, in pch_phub_restore_reg_conf()
241 iowrite32(chip->intpin_reg_wpermit_reg0, in pch_phub_restore_reg_conf()
243 iowrite32(chip->intpin_reg_wpermit_reg1, in pch_phub_restore_reg_conf()
245 iowrite32(chip->intpin_reg_wpermit_reg2, in pch_phub_restore_reg_conf()
247 iowrite32(chip->intpin_reg_wpermit_reg3, in pch_phub_restore_reg_conf()
261 chip->phub_id_reg, in pch_phub_restore_reg_conf()
262 chip->q_pri_val_reg, in pch_phub_restore_reg_conf()
263 chip->rc_q_maxsize_reg, in pch_phub_restore_reg_conf()
264 chip->bri_q_maxsize_reg, in pch_phub_restore_reg_conf()
265 chip->comp_resp_timeout_reg, in pch_phub_restore_reg_conf()
266 chip->bus_slave_control_reg, in pch_phub_restore_reg_conf()
267 chip->deadlock_avoid_type_reg, in pch_phub_restore_reg_conf()
268 chip->intpin_reg_wpermit_reg0, in pch_phub_restore_reg_conf()
269 chip->intpin_reg_wpermit_reg1, in pch_phub_restore_reg_conf()
270 chip->intpin_reg_wpermit_reg2, in pch_phub_restore_reg_conf()
271 chip->intpin_reg_wpermit_reg3); in pch_phub_restore_reg_conf()
273 iowrite32(chip->int_reduce_control_reg[i], in pch_phub_restore_reg_conf()
277 __func__, i, chip->int_reduce_control_reg[i]); in pch_phub_restore_reg_conf()
280 iowrite32(chip->clkcfg_reg, p + CLKCFG_REG_OFFSET); in pch_phub_restore_reg_conf()
281 if ((chip->ioh_type == 2) || (chip->ioh_type == 4)) in pch_phub_restore_reg_conf()
282 iowrite32(chip->funcsel_reg, p + FUNCSEL_REG_OFFSET); in pch_phub_restore_reg_conf()
291 static void pch_phub_read_serial_rom(struct pch_phub_reg *chip, in pch_phub_read_serial_rom() argument
294 void __iomem *mem_addr = chip->pch_phub_extrom_base_address + in pch_phub_read_serial_rom()
305 static int pch_phub_write_serial_rom(struct pch_phub_reg *chip, in pch_phub_write_serial_rom() argument
308 void __iomem *mem_addr = chip->pch_phub_extrom_base_address + in pch_phub_write_serial_rom()
318 chip->pch_phub_extrom_base_address + PHUB_CONTROL); in pch_phub_write_serial_rom()
324 while (ioread8(chip->pch_phub_extrom_base_address + in pch_phub_write_serial_rom()
333 chip->pch_phub_extrom_base_address + PHUB_CONTROL); in pch_phub_write_serial_rom()
343 static void pch_phub_read_serial_rom_val(struct pch_phub_reg *chip, in pch_phub_read_serial_rom_val() argument
348 mem_addr = chip->pch_mac_start_address + in pch_phub_read_serial_rom_val()
351 pch_phub_read_serial_rom(chip, mem_addr, data); in pch_phub_read_serial_rom_val()
359 static int pch_phub_write_serial_rom_val(struct pch_phub_reg *chip, in pch_phub_write_serial_rom_val() argument
365 mem_addr = chip->pch_mac_start_address + in pch_phub_write_serial_rom_val()
368 retval = pch_phub_write_serial_rom(chip, mem_addr, data); in pch_phub_write_serial_rom_val()
376 static int pch_phub_gbe_serial_rom_conf(struct pch_phub_reg *chip) in pch_phub_gbe_serial_rom_conf() argument
380 retval = pch_phub_write_serial_rom(chip, 0x0b, 0xbc); in pch_phub_gbe_serial_rom_conf()
381 retval |= pch_phub_write_serial_rom(chip, 0x0a, 0x10); in pch_phub_gbe_serial_rom_conf()
382 retval |= pch_phub_write_serial_rom(chip, 0x09, 0x01); in pch_phub_gbe_serial_rom_conf()
383 retval |= pch_phub_write_serial_rom(chip, 0x08, 0x02); in pch_phub_gbe_serial_rom_conf()
385 retval |= pch_phub_write_serial_rom(chip, 0x0f, 0x00); in pch_phub_gbe_serial_rom_conf()
386 retval |= pch_phub_write_serial_rom(chip, 0x0e, 0x00); in pch_phub_gbe_serial_rom_conf()
387 retval |= pch_phub_write_serial_rom(chip, 0x0d, 0x00); in pch_phub_gbe_serial_rom_conf()
388 retval |= pch_phub_write_serial_rom(chip, 0x0c, 0x80); in pch_phub_gbe_serial_rom_conf()
390 retval |= pch_phub_write_serial_rom(chip, 0x13, 0xbc); in pch_phub_gbe_serial_rom_conf()
391 retval |= pch_phub_write_serial_rom(chip, 0x12, 0x10); in pch_phub_gbe_serial_rom_conf()
392 retval |= pch_phub_write_serial_rom(chip, 0x11, 0x01); in pch_phub_gbe_serial_rom_conf()
393 retval |= pch_phub_write_serial_rom(chip, 0x10, 0x18); in pch_phub_gbe_serial_rom_conf()
395 retval |= pch_phub_write_serial_rom(chip, 0x1b, 0xbc); in pch_phub_gbe_serial_rom_conf()
396 retval |= pch_phub_write_serial_rom(chip, 0x1a, 0x10); in pch_phub_gbe_serial_rom_conf()
397 retval |= pch_phub_write_serial_rom(chip, 0x19, 0x01); in pch_phub_gbe_serial_rom_conf()
398 retval |= pch_phub_write_serial_rom(chip, 0x18, 0x19); in pch_phub_gbe_serial_rom_conf()
400 retval |= pch_phub_write_serial_rom(chip, 0x23, 0xbc); in pch_phub_gbe_serial_rom_conf()
401 retval |= pch_phub_write_serial_rom(chip, 0x22, 0x10); in pch_phub_gbe_serial_rom_conf()
402 retval |= pch_phub_write_serial_rom(chip, 0x21, 0x01); in pch_phub_gbe_serial_rom_conf()
403 retval |= pch_phub_write_serial_rom(chip, 0x20, 0x3a); in pch_phub_gbe_serial_rom_conf()
405 retval |= pch_phub_write_serial_rom(chip, 0x27, 0x01); in pch_phub_gbe_serial_rom_conf()
406 retval |= pch_phub_write_serial_rom(chip, 0x26, 0x00); in pch_phub_gbe_serial_rom_conf()
407 retval |= pch_phub_write_serial_rom(chip, 0x25, 0x00); in pch_phub_gbe_serial_rom_conf()
408 retval |= pch_phub_write_serial_rom(chip, 0x24, 0x00); in pch_phub_gbe_serial_rom_conf()
416 static int pch_phub_gbe_serial_rom_conf_mp(struct pch_phub_reg *chip) in pch_phub_gbe_serial_rom_conf_mp() argument
422 retval = pch_phub_write_serial_rom(chip, 0x03 + offset_addr, 0xbc); in pch_phub_gbe_serial_rom_conf_mp()
423 retval |= pch_phub_write_serial_rom(chip, 0x02 + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
424 retval |= pch_phub_write_serial_rom(chip, 0x01 + offset_addr, 0x40); in pch_phub_gbe_serial_rom_conf_mp()
425 retval |= pch_phub_write_serial_rom(chip, 0x00 + offset_addr, 0x02); in pch_phub_gbe_serial_rom_conf_mp()
427 retval |= pch_phub_write_serial_rom(chip, 0x07 + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
428 retval |= pch_phub_write_serial_rom(chip, 0x06 + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
429 retval |= pch_phub_write_serial_rom(chip, 0x05 + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
430 retval |= pch_phub_write_serial_rom(chip, 0x04 + offset_addr, 0x80); in pch_phub_gbe_serial_rom_conf_mp()
432 retval |= pch_phub_write_serial_rom(chip, 0x0b + offset_addr, 0xbc); in pch_phub_gbe_serial_rom_conf_mp()
433 retval |= pch_phub_write_serial_rom(chip, 0x0a + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
434 retval |= pch_phub_write_serial_rom(chip, 0x09 + offset_addr, 0x40); in pch_phub_gbe_serial_rom_conf_mp()
435 retval |= pch_phub_write_serial_rom(chip, 0x08 + offset_addr, 0x18); in pch_phub_gbe_serial_rom_conf_mp()
437 retval |= pch_phub_write_serial_rom(chip, 0x13 + offset_addr, 0xbc); in pch_phub_gbe_serial_rom_conf_mp()
438 retval |= pch_phub_write_serial_rom(chip, 0x12 + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
439 retval |= pch_phub_write_serial_rom(chip, 0x11 + offset_addr, 0x40); in pch_phub_gbe_serial_rom_conf_mp()
440 retval |= pch_phub_write_serial_rom(chip, 0x10 + offset_addr, 0x19); in pch_phub_gbe_serial_rom_conf_mp()
442 retval |= pch_phub_write_serial_rom(chip, 0x1b + offset_addr, 0xbc); in pch_phub_gbe_serial_rom_conf_mp()
443 retval |= pch_phub_write_serial_rom(chip, 0x1a + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
444 retval |= pch_phub_write_serial_rom(chip, 0x19 + offset_addr, 0x40); in pch_phub_gbe_serial_rom_conf_mp()
445 retval |= pch_phub_write_serial_rom(chip, 0x18 + offset_addr, 0x3a); in pch_phub_gbe_serial_rom_conf_mp()
447 retval |= pch_phub_write_serial_rom(chip, 0x1f + offset_addr, 0x01); in pch_phub_gbe_serial_rom_conf_mp()
448 retval |= pch_phub_write_serial_rom(chip, 0x1e + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
449 retval |= pch_phub_write_serial_rom(chip, 0x1d + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
450 retval |= pch_phub_write_serial_rom(chip, 0x1c + offset_addr, 0x00); in pch_phub_gbe_serial_rom_conf_mp()
460 static void pch_phub_read_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data) in pch_phub_read_gbe_mac_addr() argument
464 pch_phub_read_serial_rom_val(chip, i, &data[i]); in pch_phub_read_gbe_mac_addr()
472 static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data) in pch_phub_write_gbe_mac_addr() argument
477 if ((chip->ioh_type == 1) || (chip->ioh_type == 5)) /* EG20T or ML7831*/ in pch_phub_write_gbe_mac_addr()
478 retval = pch_phub_gbe_serial_rom_conf(chip); in pch_phub_write_gbe_mac_addr()
480 retval = pch_phub_gbe_serial_rom_conf_mp(chip); in pch_phub_write_gbe_mac_addr()
485 retval = pch_phub_write_serial_rom_val(chip, i, data[i]); in pch_phub_write_gbe_mac_addr()
506 struct pch_phub_reg *chip = in pch_phub_bin_read() local
516 chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); in pch_phub_bin_read()
517 if (!chip->pch_phub_extrom_base_address) in pch_phub_bin_read()
520 pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address, in pch_phub_bin_read()
523 pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address + 1, in pch_phub_bin_read()
527 pch_phub_read_serial_rom(chip, in pch_phub_bin_read()
528 chip->pch_opt_rom_start_address + 2, in pch_phub_bin_read()
541 pch_phub_read_serial_rom(chip, in pch_phub_bin_read()
542 chip->pch_opt_rom_start_address + addr_offset + off, in pch_phub_bin_read()
550 pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); in pch_phub_bin_read()
555 pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); in pch_phub_bin_read()
570 struct pch_phub_reg *chip = in pch_phub_bin_write() local
586 chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); in pch_phub_bin_write()
587 if (!chip->pch_phub_extrom_base_address) { in pch_phub_bin_write()
596 ret = pch_phub_write_serial_rom(chip, in pch_phub_bin_write()
597 chip->pch_opt_rom_start_address + addr_offset + off, in pch_phub_bin_write()
606 pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); in pch_phub_bin_write()
611 pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); in pch_phub_bin_write()
622 struct pch_phub_reg *chip = dev_get_drvdata(dev); in show_pch_mac() local
625 chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); in show_pch_mac()
626 if (!chip->pch_phub_extrom_base_address) in show_pch_mac()
629 pch_phub_read_gbe_mac_addr(chip, mac); in show_pch_mac()
630 pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); in show_pch_mac()
640 struct pch_phub_reg *chip = dev_get_drvdata(dev); in store_pch_mac() local
646 chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); in store_pch_mac()
647 if (!chip->pch_phub_extrom_base_address) in store_pch_mac()
650 ret = pch_phub_write_gbe_mac_addr(chip, mac); in store_pch_mac()
651 pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); in store_pch_mac()
674 struct pch_phub_reg *chip; in pch_phub_probe() local
676 chip = kzalloc(sizeof(struct pch_phub_reg), GFP_KERNEL); in pch_phub_probe()
677 if (chip == NULL) in pch_phub_probe()
698 chip->pch_phub_base_address = pci_iomap(pdev, 1, 0); in pch_phub_probe()
701 if (chip->pch_phub_base_address == NULL) { in pch_phub_probe()
708 chip->pch_phub_base_address); in pch_phub_probe()
710 chip->pdev = pdev; /* Save pci device struct */ in pch_phub_probe()
724 pch_phub_read_modify_write_reg(chip, in pch_phub_probe()
732 pch_phub_read_modify_write_reg(chip, in pch_phub_probe()
739 iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); in pch_phub_probe()
741 iowrite32(0x25, chip->pch_phub_base_address + 0x44); in pch_phub_probe()
742 chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; in pch_phub_probe()
743 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; in pch_phub_probe()
754 iowrite32(0x000affa0, chip->pch_phub_base_address + 0x14); in pch_phub_probe()
755 chip->pch_opt_rom_start_address =\ in pch_phub_probe()
761 iowrite32(0x000a0000, chip->pch_phub_base_address + 0x14); in pch_phub_probe()
763 iowrite32(0x25, chip->pch_phub_base_address + 0x140); in pch_phub_probe()
764 chip->pch_opt_rom_start_address =\ in pch_phub_probe()
766 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; in pch_phub_probe()
780 iowrite32(0x0000ffa0, chip->pch_phub_base_address + 0x14); in pch_phub_probe()
781 chip->pch_opt_rom_start_address =\ in pch_phub_probe()
783 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; in pch_phub_probe()
795 iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); in pch_phub_probe()
797 iowrite32(0x25, chip->pch_phub_base_address + 0x44); in pch_phub_probe()
798 chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; in pch_phub_probe()
799 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; in pch_phub_probe()
802 chip->ioh_type = id->driver_data; in pch_phub_probe()
803 pci_set_drvdata(pdev, chip); in pch_phub_probe()
810 pci_iounmap(pdev, chip->pch_phub_base_address); in pch_phub_probe()
816 kfree(chip); in pch_phub_probe()
823 struct pch_phub_reg *chip = pci_get_drvdata(pdev); in pch_phub_remove() local
827 pci_iounmap(pdev, chip->pch_phub_base_address); in pch_phub_remove()
830 kfree(chip); in pch_phub_remove()