Lines Matching +full:force +full:- +full:external +full:- +full:phy

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Copyright (c) 2016-2017 Savoir-faire Linux Inc.
21 return mv88e6xxx_read(chip, chip->info->global2_addr, reg, val); in mv88e6xxx_g2_read()
26 return mv88e6xxx_write(chip, chip->info->global2_addr, reg, val); in mv88e6xxx_g2_write()
32 return mv88e6xxx_wait_bit(chip, chip->info->global2_addr, reg, in mv88e6xxx_g2_wait_bit()
146 const u16 port_mask = BIT(mv88e6xxx_num_ports(chip)) - 1; in mv88e6xxx_g2_trunk_mapping_write()
155 const u16 port_mask = BIT(mv88e6xxx_num_ports(chip)) - 1; in mv88e6xxx_g2_trunk_clear()
212 /* Offset 0x0B: Cross-chip Port VLAN (Addr) Register
213 * Offset 0x0C: Cross-chip Port VLAN Data Register
228 /* 9-bit Cross-chip PVT pointer: with MV88E6XXX_G2_MISC_5_BIT_PORT in mv88e6xxx_g2_pvt_op()
229 * cleared, source device is 5-bit, source port is 4-bit. in mv88e6xxx_g2_pvt_op()
339 * Offset 0x15: EEPROM Data (for 16-bit data access)
340 * Offset 0x15: EEPROM Addr (for 8-bit data access)
451 unsigned int offset = eeprom->offset; in mv88e6xxx_g2_get_eeprom8()
452 unsigned int len = eeprom->len; in mv88e6xxx_g2_get_eeprom8()
455 eeprom->len = 0; in mv88e6xxx_g2_get_eeprom8()
462 eeprom->len++; in mv88e6xxx_g2_get_eeprom8()
465 len--; in mv88e6xxx_g2_get_eeprom8()
474 unsigned int offset = eeprom->offset; in mv88e6xxx_g2_set_eeprom8()
475 unsigned int len = eeprom->len; in mv88e6xxx_g2_set_eeprom8()
478 eeprom->len = 0; in mv88e6xxx_g2_set_eeprom8()
485 eeprom->len++; in mv88e6xxx_g2_set_eeprom8()
488 len--; in mv88e6xxx_g2_set_eeprom8()
497 unsigned int offset = eeprom->offset; in mv88e6xxx_g2_get_eeprom16()
498 unsigned int len = eeprom->len; in mv88e6xxx_g2_get_eeprom16()
502 eeprom->len = 0; in mv88e6xxx_g2_get_eeprom16()
512 len--; in mv88e6xxx_g2_get_eeprom16()
513 eeprom->len++; in mv88e6xxx_g2_get_eeprom16()
525 len -= 2; in mv88e6xxx_g2_get_eeprom16()
526 eeprom->len += 2; in mv88e6xxx_g2_get_eeprom16()
537 len--; in mv88e6xxx_g2_get_eeprom16()
538 eeprom->len++; in mv88e6xxx_g2_get_eeprom16()
547 unsigned int offset = eeprom->offset; in mv88e6xxx_g2_set_eeprom16()
548 unsigned int len = eeprom->len; in mv88e6xxx_g2_set_eeprom16()
558 return -EROFS; in mv88e6xxx_g2_set_eeprom16()
560 eeprom->len = 0; in mv88e6xxx_g2_set_eeprom16()
574 len--; in mv88e6xxx_g2_set_eeprom16()
575 eeprom->len++; in mv88e6xxx_g2_set_eeprom16()
587 len -= 2; in mv88e6xxx_g2_set_eeprom16()
588 eeprom->len += 2; in mv88e6xxx_g2_set_eeprom16()
603 len--; in mv88e6xxx_g2_set_eeprom16()
604 eeprom->len++; in mv88e6xxx_g2_set_eeprom16()
610 /* Offset 0x18: SMI PHY Command Register
611 * Offset 0x19: SMI PHY Data Register
634 bool external, bool c45, u16 op, int dev, in mv88e6xxx_g2_smi_phy_access() argument
639 if (external) in mv88e6xxx_g2_smi_phy_access()
657 bool external, u16 op, int dev, in mv88e6xxx_g2_smi_phy_access_c22() argument
660 return mv88e6xxx_g2_smi_phy_access(chip, external, false, op, dev, reg); in mv88e6xxx_g2_smi_phy_access_c22()
665 bool external, int dev, int reg, in mv88e6xxx_g2_smi_phy_read_data_c22() argument
675 err = mv88e6xxx_g2_smi_phy_access_c22(chip, external, op, dev, reg); in mv88e6xxx_g2_smi_phy_read_data_c22()
684 bool external, int dev, int reg, in mv88e6xxx_g2_smi_phy_write_data_c22() argument
698 return mv88e6xxx_g2_smi_phy_access_c22(chip, external, op, dev, reg); in mv88e6xxx_g2_smi_phy_write_data_c22()
702 bool external, u16 op, int port, in mv88e6xxx_g2_smi_phy_access_c45() argument
705 return mv88e6xxx_g2_smi_phy_access(chip, external, true, op, port, dev); in mv88e6xxx_g2_smi_phy_access_c45()
710 bool external, int port, int dev, in mv88e6xxx_g2_smi_phy_write_addr_c45() argument
724 return mv88e6xxx_g2_smi_phy_access_c45(chip, external, op, port, dev); in mv88e6xxx_g2_smi_phy_write_addr_c45()
729 bool external, int port, int dev, in mv88e6xxx_g2_smi_phy_read_data_c45() argument
735 err = mv88e6xxx_g2_smi_phy_access_c45(chip, external, op, port, dev); in mv88e6xxx_g2_smi_phy_read_data_c45()
743 bool external, int port, int devad, in _mv88e6xxx_g2_smi_phy_read_c45() argument
748 err = mv88e6xxx_g2_smi_phy_write_addr_c45(chip, external, port, devad, in _mv88e6xxx_g2_smi_phy_read_c45()
753 return mv88e6xxx_g2_smi_phy_read_data_c45(chip, external, port, devad, in _mv88e6xxx_g2_smi_phy_read_c45()
759 bool external, int port, int dev, in mv88e6xxx_g2_smi_phy_write_data_c45() argument
769 return mv88e6xxx_g2_smi_phy_access_c45(chip, external, op, port, dev); in mv88e6xxx_g2_smi_phy_write_data_c45()
773 bool external, int port, int devad, in _mv88e6xxx_g2_smi_phy_write_c45() argument
778 err = mv88e6xxx_g2_smi_phy_write_addr_c45(chip, external, port, devad, in _mv88e6xxx_g2_smi_phy_write_c45()
783 return mv88e6xxx_g2_smi_phy_write_data_c45(chip, external, port, devad, in _mv88e6xxx_g2_smi_phy_write_c45()
791 struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; in mv88e6xxx_g2_smi_phy_read_c22()
792 bool external = mdio_bus->external; in mv88e6xxx_g2_smi_phy_read_c22() local
794 return mv88e6xxx_g2_smi_phy_read_data_c22(chip, external, addr, reg, in mv88e6xxx_g2_smi_phy_read_c22()
802 struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; in mv88e6xxx_g2_smi_phy_read_c45()
803 bool external = mdio_bus->external; in mv88e6xxx_g2_smi_phy_read_c45() local
805 return _mv88e6xxx_g2_smi_phy_read_c45(chip, external, addr, devad, reg, in mv88e6xxx_g2_smi_phy_read_c45()
813 struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; in mv88e6xxx_g2_smi_phy_write_c22()
814 bool external = mdio_bus->external; in mv88e6xxx_g2_smi_phy_write_c22() local
816 return mv88e6xxx_g2_smi_phy_write_data_c22(chip, external, addr, reg, in mv88e6xxx_g2_smi_phy_write_c22()
824 struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv; in mv88e6xxx_g2_smi_phy_write_c45()
825 bool external = mdio_bus->external; in mv88e6xxx_g2_smi_phy_write_c45() local
827 return _mv88e6xxx_g2_smi_phy_write_c45(chip, external, addr, devad, reg, in mv88e6xxx_g2_smi_phy_write_c45()
838 dev_info(chip->dev, "Watchdog event: 0x%04x", reg); in mv88e6097_watchdog_action()
914 dev_info(chip->dev, "Watchdog event: 0x%04x", in mv88e6390_watchdog_action()
921 dev_info(chip->dev, "Watchdog history: 0x%04x", in mv88e6390_watchdog_action()
925 if (chip->info->ops->reset) in mv88e6390_watchdog_action()
926 chip->info->ops->reset(chip); in mv88e6390_watchdog_action()
950 /* Fix for clearing the force WD event bit. in mv88e6393x_watchdog_action()
972 if (chip->info->ops->watchdog_ops->irq_action) in mv88e6xxx_g2_watchdog_thread_fn()
973 ret = chip->info->ops->watchdog_ops->irq_action(chip, irq); in mv88e6xxx_g2_watchdog_thread_fn()
982 if (chip->info->ops->watchdog_ops->irq_free) in mv88e6xxx_g2_watchdog_free()
983 chip->info->ops->watchdog_ops->irq_free(chip); in mv88e6xxx_g2_watchdog_free()
986 free_irq(chip->watchdog_irq, chip); in mv88e6xxx_g2_watchdog_free()
987 irq_dispose_mapping(chip->watchdog_irq); in mv88e6xxx_g2_watchdog_free()
994 chip->watchdog_irq = irq_find_mapping(chip->g2_irq.domain, in mv88e6xxx_g2_watchdog_setup()
996 if (chip->watchdog_irq < 0) in mv88e6xxx_g2_watchdog_setup()
997 return chip->watchdog_irq; in mv88e6xxx_g2_watchdog_setup()
999 snprintf(chip->watchdog_irq_name, sizeof(chip->watchdog_irq_name), in mv88e6xxx_g2_watchdog_setup()
1000 "mv88e6xxx-%s-watchdog", dev_name(chip->dev)); in mv88e6xxx_g2_watchdog_setup()
1002 err = request_threaded_irq(chip->watchdog_irq, NULL, in mv88e6xxx_g2_watchdog_setup()
1005 chip->watchdog_irq_name, chip); in mv88e6xxx_g2_watchdog_setup()
1010 if (chip->info->ops->watchdog_ops->irq_setup) in mv88e6xxx_g2_watchdog_setup()
1011 err = chip->info->ops->watchdog_ops->irq_setup(chip); in mv88e6xxx_g2_watchdog_setup()
1045 unsigned int n = d->hwirq; in mv88e6xxx_g2_irq_mask()
1047 chip->g2_irq.masked |= (1 << n); in mv88e6xxx_g2_irq_mask()
1053 unsigned int n = d->hwirq; in mv88e6xxx_g2_irq_unmask()
1055 chip->g2_irq.masked &= ~(1 << n); in mv88e6xxx_g2_irq_unmask()
1075 sub_irq = irq_find_mapping(chip->g2_irq.domain, n); in mv88e6xxx_g2_irq_thread_fn()
1096 err = mv88e6xxx_g2_int_mask(chip, ~chip->g2_irq.masked); in mv88e6xxx_g2_irq_bus_sync_unlock()
1098 dev_err(chip->dev, "failed to mask interrupts\n"); in mv88e6xxx_g2_irq_bus_sync_unlock()
1104 .name = "mv88e6xxx-g2",
1115 struct mv88e6xxx_chip *chip = d->host_data; in mv88e6xxx_g2_irq_domain_map()
1117 irq_set_chip_data(irq, d->host_data); in mv88e6xxx_g2_irq_domain_map()
1118 irq_set_chip_and_handler(irq, &chip->g2_irq.chip, handle_level_irq); in mv88e6xxx_g2_irq_domain_map()
1135 free_irq(chip->device_irq, chip); in mv88e6xxx_g2_irq_free()
1136 irq_dispose_mapping(chip->device_irq); in mv88e6xxx_g2_irq_free()
1139 virq = irq_find_mapping(chip->g2_irq.domain, irq); in mv88e6xxx_g2_irq_free()
1143 irq_domain_remove(chip->g2_irq.domain); in mv88e6xxx_g2_irq_free()
1150 chip->g2_irq.masked = ~0; in mv88e6xxx_g2_irq_setup()
1152 err = mv88e6xxx_g2_int_mask(chip, ~chip->g2_irq.masked); in mv88e6xxx_g2_irq_setup()
1157 chip->g2_irq.domain = irq_domain_add_simple( in mv88e6xxx_g2_irq_setup()
1158 chip->dev->of_node, 16, 0, &mv88e6xxx_g2_irq_domain_ops, chip); in mv88e6xxx_g2_irq_setup()
1159 if (!chip->g2_irq.domain) in mv88e6xxx_g2_irq_setup()
1160 return -ENOMEM; in mv88e6xxx_g2_irq_setup()
1163 irq_create_mapping(chip->g2_irq.domain, irq); in mv88e6xxx_g2_irq_setup()
1165 chip->g2_irq.chip = mv88e6xxx_g2_irq_chip; in mv88e6xxx_g2_irq_setup()
1167 chip->device_irq = irq_find_mapping(chip->g1_irq.domain, in mv88e6xxx_g2_irq_setup()
1169 if (chip->device_irq < 0) { in mv88e6xxx_g2_irq_setup()
1170 err = chip->device_irq; in mv88e6xxx_g2_irq_setup()
1174 snprintf(chip->device_irq_name, sizeof(chip->device_irq_name), in mv88e6xxx_g2_irq_setup()
1175 "mv88e6xxx-%s-g2", dev_name(chip->dev)); in mv88e6xxx_g2_irq_setup()
1177 err = request_threaded_irq(chip->device_irq, NULL, in mv88e6xxx_g2_irq_setup()
1179 IRQF_ONESHOT, chip->device_irq_name, chip); in mv88e6xxx_g2_irq_setup()
1187 virq = irq_find_mapping(chip->g2_irq.domain, irq); in mv88e6xxx_g2_irq_setup()
1191 irq_domain_remove(chip->g2_irq.domain); in mv88e6xxx_g2_irq_setup()
1199 int phy_start = chip->info->internal_phys_offset; in mv88e6xxx_g2_irq_mdio_setup()
1200 int phy_end = chip->info->internal_phys_offset + in mv88e6xxx_g2_irq_mdio_setup()
1201 chip->info->num_internal_phys; in mv88e6xxx_g2_irq_mdio_setup()
1202 int phy, irq; in mv88e6xxx_g2_irq_mdio_setup() local
1204 for (phy = phy_start; phy < phy_end; phy++) { in mv88e6xxx_g2_irq_mdio_setup()
1205 irq = irq_find_mapping(chip->g2_irq.domain, phy); in mv88e6xxx_g2_irq_mdio_setup()
1209 bus->irq[chip->info->phy_base_addr + phy] = irq; in mv88e6xxx_g2_irq_mdio_setup()