Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7069032rwn; Tue, 13 Sep 2022 13:22:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XK9iYO5JvhUvi5WgtIqIXq9lpd7Q/aj57Pm4H8CPIjbLKrn4vozY88JBhvAqna9LZa+S8 X-Received: by 2002:a17:90b:4b43:b0:202:e09c:664d with SMTP id mi3-20020a17090b4b4300b00202e09c664dmr1007395pjb.120.1663100542000; Tue, 13 Sep 2022 13:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663100541; cv=none; d=google.com; s=arc-20160816; b=OvkitxVE2dHFmeA3nAlmctRWB4CWawq1xu8fyXaLQTYLag4O6DuLVTKdPksViqcihY KI9dzQmJXOOT6IW2oxM9KP3xYwqDZtm59L+dtgM+UnsPOwF+L7jOT9PZ4vgNyYqoTlaW QgZIukAR1XRUfeq1xfWw3fpvJ7t68v6MxErhU1Rp5Jvaj1oH3tZKd0FGzLQBQSkwfVvR 5p0lVGvKG4SOKrir5HSOgNoRndrBRtKxW8Qn6gwCokp0zR4ksOilOooAgBCWhT9jPWqi xl1oy3pBzfhmdA7woa/0BgKayvdA5cX0/PDd2jEpQx+y3wZOZ92pcdZ3o6qLST72ef8p w/Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=62zrroreV09z06pto3FC2TnPEa3QeqHeX1xMH+bNz9g=; b=Ov3ZDKecftTIIVFNEMdrnR/lxs9S3ZZ9057Mesp/DjmkJd8TV0t+mNBdfYXln05PLz NcoOny75jAVHnyQO6MbQW8F0E0Xmm7WyxnqIu9WI3qUv7TjmlYslFHreYpAA9ndcWtZW 7/bVEemkjnW6sbC57wdFzWFGHl0slAMy9D6N09wX83fhBcsVp0/N+yMdtw0dCx/ndfwH 2Xxl0XHn25kc3ZMm/094QXAz3xfW7gAnlSaX6bqT53WejpvBzoUQmYppz/WCz4wmN2yS ZWfl5YcHyAwKpQjukBPzL6nXDubkN19WmGLbUMj9cFp37RyS5tYDAc5KoTEMwFGxZwOi mPGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@smile-fr.20210112.gappssmtp.com header.s=20210112 header.b=MuyXEmm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 21-20020a630015000000b004395afacb7csi1106587pga.214.2022.09.13.13.22.09; Tue, 13 Sep 2022 13:22:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@smile-fr.20210112.gappssmtp.com header.s=20210112 header.b=MuyXEmm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbiIMULc (ORCPT + 99 others); Tue, 13 Sep 2022 16:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiIMULa (ORCPT ); Tue, 13 Sep 2022 16:11:30 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AA89647D8 for ; Tue, 13 Sep 2022 13:11:28 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id z12so4211676wrp.9 for ; Tue, 13 Sep 2022 13:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=62zrroreV09z06pto3FC2TnPEa3QeqHeX1xMH+bNz9g=; b=MuyXEmm6WaSkEfZJ6KsnaVU6RD9fxVm4FIrfdybwcF446nIdBmzX8mvZzvLcoZmDpK IDMZuSYpJ+SjvvfIElWmxR8ywdC5FveAntzSy14nwv3i+lEwcxu2hkqolR7hjAgGvdLf 3Q+Hk/39hoPz56ktyfyGBNjZjt5z5Iotfk+7gznu5lwUhiMuk3brpJ3fB7RdhNSUVCk3 CUfhtvSXVQbGPbFsZLU8QvLtU9elDuUxUKzGjoY0UpbvbWKMiAYnVI18/7y6P3ppXAlT 4g3I3uVhcLOBDBtydyQA+xh/2piFpOGtW8MYXzGINFUJwf+RF4wNVQdciAWBTbdQDE2O UZXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=62zrroreV09z06pto3FC2TnPEa3QeqHeX1xMH+bNz9g=; b=gNGyTIsCHlJ44NGyWFxC9c/jd1rW33bBhbSrCHagpni0XZ2IUnQqCjuuSnfDUei7iD SRE7BzxBH6dB7V1jb+GTvV76b1csG8uf8NEzF5wCnUKUopokDmJXzNyOiuH1ysk38mhy imU6rw1OJ3oYh0nfUThLrYKQYkaFUdBMPhFNiFy3Opv0phqI4BfQB2sUmeMaLtWh8+1V vvpHCiKCW8KlrvD6a/Z3+T51F6XqrP8z6bCj0+i5jFx7ILGuz9VQJ3E7cUJttC7G82+i ALH+rdgH8rnlAlDJM0BURo4qY5BiN35jv077B039dyO4kNb2Bkyezb7xD3o8gQPjDBsK j3Vw== X-Gm-Message-State: ACgBeo0vapmwUJJnFNx7TnBjMkBK7u6nf5VScVnIX/pdxEsF5hNnjNDi BCxSA76fn3npYQ8Fp8IXBCFFcg== X-Received: by 2002:a05:6000:80a:b0:229:4632:d1d1 with SMTP id bt10-20020a056000080a00b002294632d1d1mr19798951wrb.73.1663099887113; Tue, 13 Sep 2022 13:11:27 -0700 (PDT) Received: from ?IPV6:2a01:cb05:8f8a:1800:1c97:b8d1:b477:d53f? (2a01cb058f8a18001c97b8d1b477d53f.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:1c97:b8d1:b477:d53f]) by smtp.gmail.com with ESMTPSA id w21-20020a1cf615000000b003a63a3b55c3sm14262952wmc.14.2022.09.13.13.11.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Sep 2022 13:11:26 -0700 (PDT) Message-ID: Date: Tue, 13 Sep 2022 22:11:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [Patch net-next 1/5] net: dsa: microchip: determine number of port irq based on switch type Content-Language: fr To: Arun Ramadoss , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, Tristram.Ha@microchip.com, prasanna.vengateshan@microchip.com, hkallweit1@gmail.com References: <20220913160427.12749-1-arun.ramadoss@microchip.com> <20220913160427.12749-2-arun.ramadoss@microchip.com> From: Romain Naour In-Reply-To: <20220913160427.12749-2-arun.ramadoss@microchip.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Le 13/09/2022 à 18:04, Arun Ramadoss a écrit : > Currently the number of port irqs is hard coded for the lan937x switch > as 6. In order to make the generic interrupt handler for ksz switches, > number of port irq supported by the switch is added to the > ksz_chip_data. It is 4 for ksz9477, 2 for ksz9897 and 3 for ksz9567. The ksz9896 has been added recently and it's close to the ksz9897. So it should get ".port_nirqs = 2" too? IIUC, to get the number of port irqs you have to look at table "Port Interrupt Mask Register" in the datasheet. 4 port irqs for the ksz9477: SGMII, PTP, PHY and ACL. 2 port irqs for the ksz9897/ksz9896: PHY and ACL. 3 port irqs for the ksz9567: PTP, PHY and ACL. Best regards, Romain > > Signed-off-by: Arun Ramadoss > Reviewed-by: Andrew Lunn > --- > drivers/net/dsa/microchip/ksz_common.c | 9 +++++++++ > drivers/net/dsa/microchip/ksz_common.h | 1 + > drivers/net/dsa/microchip/lan937x_main.c | 4 +--- > 3 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c > index fcaa71f66322..b91089a483e7 100644 > --- a/drivers/net/dsa/microchip/ksz_common.c > +++ b/drivers/net/dsa/microchip/ksz_common.c > @@ -1168,6 +1168,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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, > @@ -1230,6 +1231,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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, > @@ -1259,6 +1261,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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), > @@ -1283,6 +1286,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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, > @@ -1312,6 +1316,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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), > @@ -1335,6 +1340,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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), > @@ -1358,6 +1364,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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), > @@ -1385,6 +1392,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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), > @@ -1412,6 +1420,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { > .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), > diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h > index 6203dcd8c8f7..baa1e1bc1b7c 100644 > --- a/drivers/net/dsa/microchip/ksz_common.h > +++ b/drivers/net/dsa/microchip/ksz_common.h > @@ -45,6 +45,7 @@ struct ksz_chip_data { > int num_statics; > int cpu_ports; > int port_cnt; > + u8 port_nirqs; > const struct ksz_dev_ops *ops; > bool phy_errata_9477; > bool ksz87xx_eee_link_erratum; > diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c > index 9b6760b1e572..7136d9c55315 100644 > --- a/drivers/net/dsa/microchip/lan937x_main.c > +++ b/drivers/net/dsa/microchip/lan937x_main.c > @@ -20,8 +20,6 @@ > #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); > @@ -697,7 +695,7 @@ static int lan937x_pirq_setup(struct ksz_device *dev, u8 p) > 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,