Lines Matching full:chip

15 #include "chip.h"
19 int mv88e6xxx_g2_read(struct mv88e6xxx_chip *chip, int reg, u16 *val) in mv88e6xxx_g2_read() argument
21 return mv88e6xxx_read(chip, chip->info->global2_addr, reg, val); in mv88e6xxx_g2_read()
24 int mv88e6xxx_g2_write(struct mv88e6xxx_chip *chip, int reg, u16 val) in mv88e6xxx_g2_write() argument
26 return mv88e6xxx_write(chip, chip->info->global2_addr, reg, val); in mv88e6xxx_g2_write()
29 int mv88e6xxx_g2_wait_bit(struct mv88e6xxx_chip *chip, int reg, int in mv88e6xxx_g2_wait_bit() argument
32 return mv88e6xxx_wait_bit(chip, chip->info->global2_addr, reg, in mv88e6xxx_g2_wait_bit()
38 static int mv88e6xxx_g2_int_source(struct mv88e6xxx_chip *chip, u16 *src) in mv88e6xxx_g2_int_source() argument
41 return mv88e6xxx_g2_read(chip, MV88E6XXX_G2_INT_SRC, src); in mv88e6xxx_g2_int_source()
46 static int mv88e6xxx_g2_int_mask(struct mv88e6xxx_chip *chip, u16 mask) in mv88e6xxx_g2_int_mask() argument
48 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_INT_MASK, mask); in mv88e6xxx_g2_int_mask()
53 static int mv88e6xxx_g2_mgmt_enable_2x(struct mv88e6xxx_chip *chip, u16 en2x) in mv88e6xxx_g2_mgmt_enable_2x() argument
55 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_MGMT_EN_2X, en2x); in mv88e6xxx_g2_mgmt_enable_2x()
60 static int mv88e6xxx_g2_mgmt_enable_0x(struct mv88e6xxx_chip *chip, u16 en0x) in mv88e6xxx_g2_mgmt_enable_0x() argument
62 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_MGMT_EN_0X, en0x); in mv88e6xxx_g2_mgmt_enable_0x()
67 static int mv88e6xxx_g2_switch_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_switch_mgmt_rsvd2cpu() argument
73 err = mv88e6xxx_g2_read(chip, MV88E6XXX_G2_SWITCH_MGMT, &val); in mv88e6xxx_g2_switch_mgmt_rsvd2cpu()
82 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_SWITCH_MGMT, val); in mv88e6xxx_g2_switch_mgmt_rsvd2cpu()
85 int mv88e6185_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) in mv88e6185_g2_mgmt_rsvd2cpu() argument
92 err = mv88e6xxx_g2_mgmt_enable_0x(chip, 0xffff); in mv88e6185_g2_mgmt_rsvd2cpu()
96 return mv88e6xxx_g2_switch_mgmt_rsvd2cpu(chip, true); in mv88e6185_g2_mgmt_rsvd2cpu()
99 int mv88e6352_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) in mv88e6352_g2_mgmt_rsvd2cpu() argument
106 err = mv88e6xxx_g2_mgmt_enable_2x(chip, 0xffff); in mv88e6352_g2_mgmt_rsvd2cpu()
110 return mv88e6185_g2_mgmt_rsvd2cpu(chip); in mv88e6352_g2_mgmt_rsvd2cpu()
115 int mv88e6xxx_g2_device_mapping_write(struct mv88e6xxx_chip *chip, int target, in mv88e6xxx_g2_device_mapping_write() argument
123 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_DEVICE_MAPPING, in mv88e6xxx_g2_device_mapping_write()
129 static int mv88e6xxx_g2_trunk_mask_write(struct mv88e6xxx_chip *chip, int num, in mv88e6xxx_g2_trunk_mask_write() argument
132 u16 val = (num << 12) | (mask & mv88e6xxx_port_mask(chip)); in mv88e6xxx_g2_trunk_mask_write()
137 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_TRUNK_MASK, in mv88e6xxx_g2_trunk_mask_write()
143 static int mv88e6xxx_g2_trunk_mapping_write(struct mv88e6xxx_chip *chip, int id, in mv88e6xxx_g2_trunk_mapping_write() argument
146 const u16 port_mask = BIT(mv88e6xxx_num_ports(chip)) - 1; in mv88e6xxx_g2_trunk_mapping_write()
149 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_TRUNK_MAPPING, in mv88e6xxx_g2_trunk_mapping_write()
153 int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_trunk_clear() argument
155 const u16 port_mask = BIT(mv88e6xxx_num_ports(chip)) - 1; in mv88e6xxx_g2_trunk_clear()
160 err = mv88e6xxx_g2_trunk_mask_write(chip, i, false, port_mask); in mv88e6xxx_g2_trunk_clear()
167 err = mv88e6xxx_g2_trunk_mapping_write(chip, i, 0); in mv88e6xxx_g2_trunk_clear()
179 static int mv88e6xxx_g2_irl_wait(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_irl_wait() argument
183 return mv88e6xxx_g2_wait_bit(chip, MV88E6XXX_G2_IRL_CMD, bit, 0); in mv88e6xxx_g2_irl_wait()
186 static int mv88e6xxx_g2_irl_op(struct mv88e6xxx_chip *chip, u16 op, int port, in mv88e6xxx_g2_irl_op() argument
191 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_IRL_CMD, in mv88e6xxx_g2_irl_op()
197 return mv88e6xxx_g2_irl_wait(chip); in mv88e6xxx_g2_irl_op()
200 int mv88e6352_g2_irl_init_all(struct mv88e6xxx_chip *chip, int port) in mv88e6352_g2_irl_init_all() argument
202 return mv88e6xxx_g2_irl_op(chip, MV88E6352_G2_IRL_CMD_OP_INIT_ALL, port, in mv88e6352_g2_irl_init_all()
206 int mv88e6390_g2_irl_init_all(struct mv88e6xxx_chip *chip, int port) in mv88e6390_g2_irl_init_all() argument
208 return mv88e6xxx_g2_irl_op(chip, MV88E6390_G2_IRL_CMD_OP_INIT_ALL, port, in mv88e6390_g2_irl_init_all()
212 /* Offset 0x0B: Cross-chip Port VLAN (Addr) Register
213 * Offset 0x0C: Cross-chip Port VLAN Data Register
216 static int mv88e6xxx_g2_pvt_op_wait(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_pvt_op_wait() argument
220 return mv88e6xxx_g2_wait_bit(chip, MV88E6XXX_G2_PVT_ADDR, bit, 0); in mv88e6xxx_g2_pvt_op_wait()
223 static int mv88e6xxx_g2_pvt_op(struct mv88e6xxx_chip *chip, int src_dev, in mv88e6xxx_g2_pvt_op() argument
228 /* 9-bit Cross-chip PVT pointer: with MV88E6XXX_G2_MISC_5_BIT_PORT in mv88e6xxx_g2_pvt_op()
235 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_PVT_ADDR, op); in mv88e6xxx_g2_pvt_op()
239 return mv88e6xxx_g2_pvt_op_wait(chip); in mv88e6xxx_g2_pvt_op()
242 int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev, in mv88e6xxx_g2_pvt_write() argument
247 err = mv88e6xxx_g2_pvt_op_wait(chip); in mv88e6xxx_g2_pvt_write()
251 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_PVT_DATA, data); in mv88e6xxx_g2_pvt_write()
255 return mv88e6xxx_g2_pvt_op(chip, src_dev, src_port, in mv88e6xxx_g2_pvt_write()
261 static int mv88e6xxx_g2_switch_mac_write(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_switch_mac_write() argument
266 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_SWITCH_MAC, in mv88e6xxx_g2_switch_mac_write()
270 int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr) in mv88e6xxx_g2_set_switch_mac() argument
275 err = mv88e6xxx_g2_switch_mac_write(chip, i, addr[i]); in mv88e6xxx_g2_set_switch_mac()
285 static int mv88e6xxx_g2_pot_write(struct mv88e6xxx_chip *chip, int pointer, in mv88e6xxx_g2_pot_write() argument
290 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_PRIO_OVERRIDE, in mv88e6xxx_g2_pot_write()
294 int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_pot_clear() argument
300 err = mv88e6xxx_g2_pot_write(chip, i, 0); in mv88e6xxx_g2_pot_clear()
313 static int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_eeprom_wait() argument
318 err = mv88e6xxx_g2_wait_bit(chip, MV88E6XXX_G2_EEPROM_CMD, bit, 0); in mv88e6xxx_g2_eeprom_wait()
324 return mv88e6xxx_g2_wait_bit(chip, MV88E6XXX_G2_EEPROM_CMD, bit, 0); in mv88e6xxx_g2_eeprom_wait()
327 static int mv88e6xxx_g2_eeprom_cmd(struct mv88e6xxx_chip *chip, u16 cmd) in mv88e6xxx_g2_eeprom_cmd() argument
331 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_EEPROM_CMD, in mv88e6xxx_g2_eeprom_cmd()
336 return mv88e6xxx_g2_eeprom_wait(chip); in mv88e6xxx_g2_eeprom_cmd()
339 static int mv88e6xxx_g2_eeprom_read8(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_eeprom_read8() argument
345 err = mv88e6xxx_g2_eeprom_wait(chip); in mv88e6xxx_g2_eeprom_read8()
349 err = mv88e6xxx_g2_write(chip, MV88E6390_G2_EEPROM_ADDR, addr); in mv88e6xxx_g2_eeprom_read8()
353 err = mv88e6xxx_g2_eeprom_cmd(chip, cmd); in mv88e6xxx_g2_eeprom_read8()
357 err = mv88e6xxx_g2_read(chip, MV88E6XXX_G2_EEPROM_CMD, &cmd); in mv88e6xxx_g2_eeprom_read8()
366 static int mv88e6xxx_g2_eeprom_write8(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_eeprom_write8() argument
373 err = mv88e6xxx_g2_eeprom_wait(chip); in mv88e6xxx_g2_eeprom_write8()
377 err = mv88e6xxx_g2_write(chip, MV88E6390_G2_EEPROM_ADDR, addr); in mv88e6xxx_g2_eeprom_write8()
381 return mv88e6xxx_g2_eeprom_cmd(chip, cmd | data); in mv88e6xxx_g2_eeprom_write8()
384 static int mv88e6xxx_g2_eeprom_read16(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_eeprom_read16() argument
390 err = mv88e6xxx_g2_eeprom_wait(chip); in mv88e6xxx_g2_eeprom_read16()
394 err = mv88e6xxx_g2_eeprom_cmd(chip, cmd); in mv88e6xxx_g2_eeprom_read16()
398 return mv88e6xxx_g2_read(chip, MV88E6352_G2_EEPROM_DATA, data); in mv88e6xxx_g2_eeprom_read16()
401 static int mv88e6xxx_g2_eeprom_write16(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_eeprom_write16() argument
407 err = mv88e6xxx_g2_eeprom_wait(chip); in mv88e6xxx_g2_eeprom_write16()
411 err = mv88e6xxx_g2_write(chip, MV88E6352_G2_EEPROM_DATA, data); in mv88e6xxx_g2_eeprom_write16()
415 return mv88e6xxx_g2_eeprom_cmd(chip, cmd); in mv88e6xxx_g2_eeprom_write16()
418 int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_get_eeprom8() argument
428 err = mv88e6xxx_g2_eeprom_read8(chip, offset, data); in mv88e6xxx_g2_get_eeprom8()
441 int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_set_eeprom8() argument
451 err = mv88e6xxx_g2_eeprom_write8(chip, offset, *data); in mv88e6xxx_g2_set_eeprom8()
464 int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_get_eeprom16() argument
475 err = mv88e6xxx_g2_eeprom_read16(chip, offset >> 1, &val); in mv88e6xxx_g2_get_eeprom16()
487 err = mv88e6xxx_g2_eeprom_read16(chip, offset >> 1, &val); in mv88e6xxx_g2_get_eeprom16()
500 err = mv88e6xxx_g2_eeprom_read16(chip, offset >> 1, &val); in mv88e6xxx_g2_get_eeprom16()
514 int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_set_eeprom16() argument
523 err = mv88e6xxx_g2_read(chip, MV88E6XXX_G2_EEPROM_CMD, &val); in mv88e6xxx_g2_set_eeprom16()
533 err = mv88e6xxx_g2_eeprom_read16(chip, offset >> 1, &val); in mv88e6xxx_g2_set_eeprom16()
539 err = mv88e6xxx_g2_eeprom_write16(chip, offset >> 1, val); in mv88e6xxx_g2_set_eeprom16()
552 err = mv88e6xxx_g2_eeprom_write16(chip, offset >> 1, val); in mv88e6xxx_g2_set_eeprom16()
562 err = mv88e6xxx_g2_eeprom_read16(chip, offset >> 1, &val); in mv88e6xxx_g2_set_eeprom16()
568 err = mv88e6xxx_g2_eeprom_write16(chip, offset >> 1, val); in mv88e6xxx_g2_set_eeprom16()
584 static int mv88e6xxx_g2_smi_phy_wait(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_smi_phy_wait() argument
588 return mv88e6xxx_g2_wait_bit(chip, MV88E6XXX_G2_SMI_PHY_CMD, bit, 0); in mv88e6xxx_g2_smi_phy_wait()
591 static int mv88e6xxx_g2_smi_phy_cmd(struct mv88e6xxx_chip *chip, u16 cmd) in mv88e6xxx_g2_smi_phy_cmd() argument
595 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_SMI_PHY_CMD, in mv88e6xxx_g2_smi_phy_cmd()
600 return mv88e6xxx_g2_smi_phy_wait(chip); in mv88e6xxx_g2_smi_phy_cmd()
603 static int mv88e6xxx_g2_smi_phy_access(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_access() argument
623 return mv88e6xxx_g2_smi_phy_cmd(chip, cmd); in mv88e6xxx_g2_smi_phy_access()
626 static int mv88e6xxx_g2_smi_phy_access_c22(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_access_c22() argument
630 return mv88e6xxx_g2_smi_phy_access(chip, external, false, op, dev, reg); in mv88e6xxx_g2_smi_phy_access_c22()
634 static int mv88e6xxx_g2_smi_phy_read_data_c22(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_read_data_c22() argument
641 err = mv88e6xxx_g2_smi_phy_wait(chip); in mv88e6xxx_g2_smi_phy_read_data_c22()
645 err = mv88e6xxx_g2_smi_phy_access_c22(chip, external, op, dev, reg); in mv88e6xxx_g2_smi_phy_read_data_c22()
649 return mv88e6xxx_g2_read(chip, MV88E6XXX_G2_SMI_PHY_DATA, data); in mv88e6xxx_g2_smi_phy_read_data_c22()
653 static int mv88e6xxx_g2_smi_phy_write_data_c22(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_write_data_c22() argument
660 err = mv88e6xxx_g2_smi_phy_wait(chip); in mv88e6xxx_g2_smi_phy_write_data_c22()
664 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_SMI_PHY_DATA, data); in mv88e6xxx_g2_smi_phy_write_data_c22()
668 return mv88e6xxx_g2_smi_phy_access_c22(chip, external, op, dev, reg); in mv88e6xxx_g2_smi_phy_write_data_c22()
671 static int mv88e6xxx_g2_smi_phy_access_c45(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_access_c45() argument
675 return mv88e6xxx_g2_smi_phy_access(chip, external, true, op, port, dev); in mv88e6xxx_g2_smi_phy_access_c45()
679 static int mv88e6xxx_g2_smi_phy_write_addr_c45(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_write_addr_c45() argument
686 err = mv88e6xxx_g2_smi_phy_wait(chip); in mv88e6xxx_g2_smi_phy_write_addr_c45()
690 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_SMI_PHY_DATA, addr); in mv88e6xxx_g2_smi_phy_write_addr_c45()
694 return mv88e6xxx_g2_smi_phy_access_c45(chip, external, op, port, dev); in mv88e6xxx_g2_smi_phy_write_addr_c45()
698 static int mv88e6xxx_g2_smi_phy_read_data_c45(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_read_data_c45() argument
705 err = mv88e6xxx_g2_smi_phy_access_c45(chip, external, op, port, dev); in mv88e6xxx_g2_smi_phy_read_data_c45()
709 return mv88e6xxx_g2_read(chip, MV88E6XXX_G2_SMI_PHY_DATA, data); in mv88e6xxx_g2_smi_phy_read_data_c45()
712 static int mv88e6xxx_g2_smi_phy_read_c45(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_read_c45() argument
720 err = mv88e6xxx_g2_smi_phy_write_addr_c45(chip, external, port, dev, in mv88e6xxx_g2_smi_phy_read_c45()
725 return mv88e6xxx_g2_smi_phy_read_data_c45(chip, external, port, dev, in mv88e6xxx_g2_smi_phy_read_c45()
730 static int mv88e6xxx_g2_smi_phy_write_data_c45(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_write_data_c45() argument
737 err = mv88e6xxx_g2_write(chip, MV88E6XXX_G2_SMI_PHY_DATA, data); in mv88e6xxx_g2_smi_phy_write_data_c45()
741 return mv88e6xxx_g2_smi_phy_access_c45(chip, external, op, port, dev); in mv88e6xxx_g2_smi_phy_write_data_c45()
744 static int mv88e6xxx_g2_smi_phy_write_c45(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_smi_phy_write_c45() argument
752 err = mv88e6xxx_g2_smi_phy_write_addr_c45(chip, external, port, dev, in mv88e6xxx_g2_smi_phy_write_c45()
757 return mv88e6xxx_g2_smi_phy_write_data_c45(chip, external, port, dev, in mv88e6xxx_g2_smi_phy_write_c45()
761 int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6xxx_g2_smi_phy_read() argument
768 return mv88e6xxx_g2_smi_phy_read_c45(chip, external, addr, reg, in mv88e6xxx_g2_smi_phy_read()
771 return mv88e6xxx_g2_smi_phy_read_data_c22(chip, external, addr, reg, in mv88e6xxx_g2_smi_phy_read()
775 int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus, in mv88e6xxx_g2_smi_phy_write() argument
782 return mv88e6xxx_g2_smi_phy_write_c45(chip, external, addr, reg, in mv88e6xxx_g2_smi_phy_write()
785 return mv88e6xxx_g2_smi_phy_write_data_c22(chip, external, addr, reg, in mv88e6xxx_g2_smi_phy_write()
790 static int mv88e6097_watchdog_action(struct mv88e6xxx_chip *chip, int irq) in mv88e6097_watchdog_action() argument
794 mv88e6xxx_g2_read(chip, MV88E6352_G2_WDOG_CTL, &reg); in mv88e6097_watchdog_action()
796 dev_info(chip->dev, "Watchdog event: 0x%04x", reg); in mv88e6097_watchdog_action()
801 static void mv88e6097_watchdog_free(struct mv88e6xxx_chip *chip) in mv88e6097_watchdog_free() argument
805 mv88e6xxx_g2_read(chip, MV88E6352_G2_WDOG_CTL, &reg); in mv88e6097_watchdog_free()
810 mv88e6xxx_g2_write(chip, MV88E6352_G2_WDOG_CTL, reg); in mv88e6097_watchdog_free()
813 static int mv88e6097_watchdog_setup(struct mv88e6xxx_chip *chip) in mv88e6097_watchdog_setup() argument
815 return mv88e6xxx_g2_write(chip, MV88E6352_G2_WDOG_CTL, in mv88e6097_watchdog_setup()
827 static void mv88e6250_watchdog_free(struct mv88e6xxx_chip *chip) in mv88e6250_watchdog_free() argument
831 mv88e6xxx_g2_read(chip, MV88E6250_G2_WDOG_CTL, &reg); in mv88e6250_watchdog_free()
836 mv88e6xxx_g2_write(chip, MV88E6250_G2_WDOG_CTL, reg); in mv88e6250_watchdog_free()
839 static int mv88e6250_watchdog_setup(struct mv88e6xxx_chip *chip) in mv88e6250_watchdog_setup() argument
841 return mv88e6xxx_g2_write(chip, MV88E6250_G2_WDOG_CTL, in mv88e6250_watchdog_setup()
853 static int mv88e6390_watchdog_setup(struct mv88e6xxx_chip *chip) in mv88e6390_watchdog_setup() argument
855 return mv88e6xxx_g2_write(chip, MV88E6390_G2_WDOG_CTL, in mv88e6390_watchdog_setup()
864 static int mv88e6390_watchdog_action(struct mv88e6xxx_chip *chip, int irq) in mv88e6390_watchdog_action() argument
869 mv88e6xxx_g2_write(chip, MV88E6390_G2_WDOG_CTL, in mv88e6390_watchdog_action()
871 err = mv88e6xxx_g2_read(chip, MV88E6390_G2_WDOG_CTL, &reg); in mv88e6390_watchdog_action()
873 dev_info(chip->dev, "Watchdog event: 0x%04x", in mv88e6390_watchdog_action()
876 mv88e6xxx_g2_write(chip, MV88E6390_G2_WDOG_CTL, in mv88e6390_watchdog_action()
878 err = mv88e6xxx_g2_read(chip, MV88E6390_G2_WDOG_CTL, &reg); in mv88e6390_watchdog_action()
880 dev_info(chip->dev, "Watchdog history: 0x%04x", in mv88e6390_watchdog_action()
884 if (chip->info->ops->reset) in mv88e6390_watchdog_action()
885 chip->info->ops->reset(chip); in mv88e6390_watchdog_action()
887 mv88e6390_watchdog_setup(chip); in mv88e6390_watchdog_action()
892 static void mv88e6390_watchdog_free(struct mv88e6xxx_chip *chip) in mv88e6390_watchdog_free() argument
894 mv88e6xxx_g2_write(chip, MV88E6390_G2_WDOG_CTL, in mv88e6390_watchdog_free()
907 struct mv88e6xxx_chip *chip = dev_id; in mv88e6xxx_g2_watchdog_thread_fn() local
910 mv88e6xxx_reg_lock(chip); in mv88e6xxx_g2_watchdog_thread_fn()
911 if (chip->info->ops->watchdog_ops->irq_action) in mv88e6xxx_g2_watchdog_thread_fn()
912 ret = chip->info->ops->watchdog_ops->irq_action(chip, irq); in mv88e6xxx_g2_watchdog_thread_fn()
913 mv88e6xxx_reg_unlock(chip); in mv88e6xxx_g2_watchdog_thread_fn()
918 static void mv88e6xxx_g2_watchdog_free(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_watchdog_free() argument
920 mv88e6xxx_reg_lock(chip); in mv88e6xxx_g2_watchdog_free()
921 if (chip->info->ops->watchdog_ops->irq_free) in mv88e6xxx_g2_watchdog_free()
922 chip->info->ops->watchdog_ops->irq_free(chip); in mv88e6xxx_g2_watchdog_free()
923 mv88e6xxx_reg_unlock(chip); in mv88e6xxx_g2_watchdog_free()
925 free_irq(chip->watchdog_irq, chip); in mv88e6xxx_g2_watchdog_free()
926 irq_dispose_mapping(chip->watchdog_irq); in mv88e6xxx_g2_watchdog_free()
929 static int mv88e6xxx_g2_watchdog_setup(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_watchdog_setup() argument
933 chip->watchdog_irq = irq_find_mapping(chip->g2_irq.domain, in mv88e6xxx_g2_watchdog_setup()
935 if (chip->watchdog_irq < 0) in mv88e6xxx_g2_watchdog_setup()
936 return chip->watchdog_irq; in mv88e6xxx_g2_watchdog_setup()
938 err = request_threaded_irq(chip->watchdog_irq, NULL, in mv88e6xxx_g2_watchdog_setup()
941 "mv88e6xxx-watchdog", chip); in mv88e6xxx_g2_watchdog_setup()
945 mv88e6xxx_reg_lock(chip); in mv88e6xxx_g2_watchdog_setup()
946 if (chip->info->ops->watchdog_ops->irq_setup) in mv88e6xxx_g2_watchdog_setup()
947 err = chip->info->ops->watchdog_ops->irq_setup(chip); in mv88e6xxx_g2_watchdog_setup()
948 mv88e6xxx_reg_unlock(chip); in mv88e6xxx_g2_watchdog_setup()
955 static int mv88e6xxx_g2_misc_5_bit_port(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_misc_5_bit_port() argument
961 err = mv88e6xxx_g2_read(chip, MV88E6XXX_G2_MISC, &val); in mv88e6xxx_g2_misc_5_bit_port()
970 return mv88e6xxx_g2_write(chip, MV88E6XXX_G2_MISC, val); in mv88e6xxx_g2_misc_5_bit_port()
973 int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_misc_4_bit_port() argument
975 return mv88e6xxx_g2_misc_5_bit_port(chip, false); in mv88e6xxx_g2_misc_4_bit_port()
980 struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); in mv88e6xxx_g2_irq_mask() local
983 chip->g2_irq.masked |= (1 << n); in mv88e6xxx_g2_irq_mask()
988 struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); in mv88e6xxx_g2_irq_unmask() local
991 chip->g2_irq.masked &= ~(1 << n); in mv88e6xxx_g2_irq_unmask()
996 struct mv88e6xxx_chip *chip = dev_id; in mv88e6xxx_g2_irq_thread_fn() local
1003 mv88e6xxx_reg_lock(chip); in mv88e6xxx_g2_irq_thread_fn()
1004 err = mv88e6xxx_g2_int_source(chip, &reg); in mv88e6xxx_g2_irq_thread_fn()
1005 mv88e6xxx_reg_unlock(chip); in mv88e6xxx_g2_irq_thread_fn()
1011 sub_irq = irq_find_mapping(chip->g2_irq.domain, n); in mv88e6xxx_g2_irq_thread_fn()
1022 struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); in mv88e6xxx_g2_irq_bus_lock() local
1024 mv88e6xxx_reg_lock(chip); in mv88e6xxx_g2_irq_bus_lock()
1029 struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d); in mv88e6xxx_g2_irq_bus_sync_unlock() local
1032 err = mv88e6xxx_g2_int_mask(chip, ~chip->g2_irq.masked); in mv88e6xxx_g2_irq_bus_sync_unlock()
1034 dev_err(chip->dev, "failed to mask interrupts\n"); in mv88e6xxx_g2_irq_bus_sync_unlock()
1036 mv88e6xxx_reg_unlock(chip); in mv88e6xxx_g2_irq_bus_sync_unlock()
1051 struct mv88e6xxx_chip *chip = d->host_data; in mv88e6xxx_g2_irq_domain_map() local
1054 irq_set_chip_and_handler(irq, &chip->g2_irq.chip, handle_level_irq); in mv88e6xxx_g2_irq_domain_map()
1065 void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_irq_free() argument
1069 mv88e6xxx_g2_watchdog_free(chip); in mv88e6xxx_g2_irq_free()
1071 free_irq(chip->device_irq, chip); in mv88e6xxx_g2_irq_free()
1072 irq_dispose_mapping(chip->device_irq); in mv88e6xxx_g2_irq_free()
1075 virq = irq_find_mapping(chip->g2_irq.domain, irq); in mv88e6xxx_g2_irq_free()
1079 irq_domain_remove(chip->g2_irq.domain); in mv88e6xxx_g2_irq_free()
1082 int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) in mv88e6xxx_g2_irq_setup() argument
1086 chip->g2_irq.domain = irq_domain_add_simple( in mv88e6xxx_g2_irq_setup()
1087 chip->dev->of_node, 16, 0, &mv88e6xxx_g2_irq_domain_ops, chip); in mv88e6xxx_g2_irq_setup()
1088 if (!chip->g2_irq.domain) in mv88e6xxx_g2_irq_setup()
1092 irq_create_mapping(chip->g2_irq.domain, irq); in mv88e6xxx_g2_irq_setup()
1094 chip->g2_irq.chip = mv88e6xxx_g2_irq_chip; in mv88e6xxx_g2_irq_setup()
1095 chip->g2_irq.masked = ~0; in mv88e6xxx_g2_irq_setup()
1097 chip->device_irq = irq_find_mapping(chip->g1_irq.domain, in mv88e6xxx_g2_irq_setup()
1099 if (chip->device_irq < 0) { in mv88e6xxx_g2_irq_setup()
1100 err = chip->device_irq; in mv88e6xxx_g2_irq_setup()
1104 err = request_threaded_irq(chip->device_irq, NULL, in mv88e6xxx_g2_irq_setup()
1106 IRQF_ONESHOT, "mv88e6xxx-g2", chip); in mv88e6xxx_g2_irq_setup()
1110 return mv88e6xxx_g2_watchdog_setup(chip); in mv88e6xxx_g2_irq_setup()
1114 virq = irq_find_mapping(chip->g2_irq.domain, irq); in mv88e6xxx_g2_irq_setup()
1118 irq_domain_remove(chip->g2_irq.domain); in mv88e6xxx_g2_irq_setup()
1123 int mv88e6xxx_g2_irq_mdio_setup(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_irq_mdio_setup() argument
1128 for (phy = 0; phy < chip->info->num_internal_phys; phy++) { in mv88e6xxx_g2_irq_mdio_setup()
1129 irq = irq_find_mapping(chip->g2_irq.domain, phy); in mv88e6xxx_g2_irq_mdio_setup()
1134 bus->irq[chip->info->phy_base_addr + phy] = irq; in mv88e6xxx_g2_irq_mdio_setup()
1146 void mv88e6xxx_g2_irq_mdio_free(struct mv88e6xxx_chip *chip, in mv88e6xxx_g2_irq_mdio_free() argument
1151 for (phy = 0; phy < chip->info->num_internal_phys; phy++) in mv88e6xxx_g2_irq_mdio_free()