.num_statics = 16,
                .cpu_ports = 0x7F,      /* can be configured as cpu port */
                .port_cnt = 7,          /* total physical port count */
+               .port_nirqs = 4,
                .ops = &ksz9477_dev_ops,
                .phy_errata_9477 = true,
                .mib_names = ksz9477_mib_names,
                .num_statics = 16,
                .cpu_ports = 0x3F,      /* can be configured as cpu port */
                .port_cnt = 6,          /* total physical port count */
+               .port_nirqs = 2,
                .ops = &ksz9477_dev_ops,
                .phy_errata_9477 = true,
                .mib_names = ksz9477_mib_names,
                .num_statics = 16,
                .cpu_ports = 0x7F,      /* can be configured as cpu port */
                .port_cnt = 7,          /* total physical port count */
+               .port_nirqs = 2,
                .ops = &ksz9477_dev_ops,
                .phy_errata_9477 = true,
                .mib_names = ksz9477_mib_names,
                .num_statics = 16,
                .cpu_ports = 0x07,      /* can be configured as cpu port */
                .port_cnt = 3,          /* total port count */
+               .port_nirqs = 2,
                .ops = &ksz9477_dev_ops,
                .mib_names = ksz9477_mib_names,
                .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
                .num_statics = 16,
                .cpu_ports = 0x7F,      /* can be configured as cpu port */
                .port_cnt = 7,          /* total physical port count */
+               .port_nirqs = 3,
                .ops = &ksz9477_dev_ops,
                .phy_errata_9477 = true,
                .mib_names = ksz9477_mib_names,
                .num_statics = 256,
                .cpu_ports = 0x10,      /* can be configured as cpu port */
                .port_cnt = 5,          /* total physical port count */
+               .port_nirqs = 6,
                .ops = &lan937x_dev_ops,
                .mib_names = ksz9477_mib_names,
                .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
                .num_statics = 256,
                .cpu_ports = 0x30,      /* can be configured as cpu port */
                .port_cnt = 6,          /* total physical port count */
+               .port_nirqs = 6,
                .ops = &lan937x_dev_ops,
                .mib_names = ksz9477_mib_names,
                .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
                .num_statics = 256,
                .cpu_ports = 0x30,      /* can be configured as cpu port */
                .port_cnt = 8,          /* total physical port count */
+               .port_nirqs = 6,
                .ops = &lan937x_dev_ops,
                .mib_names = ksz9477_mib_names,
                .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
                .num_statics = 256,
                .cpu_ports = 0x38,      /* can be configured as cpu port */
                .port_cnt = 5,          /* total physical port count */
+               .port_nirqs = 6,
                .ops = &lan937x_dev_ops,
                .mib_names = ksz9477_mib_names,
                .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
                .num_statics = 256,
                .cpu_ports = 0x30,      /* can be configured as cpu port */
                .port_cnt = 8,          /* total physical port count */
+               .port_nirqs = 6,
                .ops = &lan937x_dev_ops,
                .mib_names = ksz9477_mib_names,
                .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
 
 #include "ksz_common.h"
 #include "lan937x.h"
 
-#define LAN937x_PNIRQS 6
-
 static int lan937x_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set)
 {
        return regmap_update_bits(dev->regmap[0], addr, bits, set ? bits : 0);
        int ret, irq;
        int irq_num;
 
-       port->pirq.nirqs = LAN937x_PNIRQS;
+       port->pirq.nirqs = dev->info->port_nirqs;
        port->pirq.domain = irq_domain_add_simple(dev->dev->of_node,
                                                  port->pirq.nirqs, 0,
                                                  &lan937x_pirq_domain_ops,