Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6353330rwn; Tue, 13 Sep 2022 03:03:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ijSIRZI/XUtydj/pzF3S4VyATI4xuYvZvUtiHBOPXy2SSjRgbrD9GOM7CKAXoCIWyTwA0 X-Received: by 2002:a17:90b:3b90:b0:202:8a60:c852 with SMTP id pc16-20020a17090b3b9000b002028a60c852mr3156839pjb.169.1663063411503; Tue, 13 Sep 2022 03:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663063411; cv=none; d=google.com; s=arc-20160816; b=sytuEOAgKqvfFiJbofzjvBTR6NqbGBb/sUI8KIFvasgrZtqSj9NmmA/XktrIclUky1 cBwrDbltlg7iw9dr24KVKQMpI2yHZysWYeCKIq5leeuucmP5AyvCjXJKlOWv2RxdqNG5 4BD25Dm9G0RuF/7vS11AQJIAYRYXT9SGkmBhgC5lGsp2qu9yzZm6o8AsxG/9oLyAbphy zGLJrqIXK63jzYng/XToTcIrk0RphdadqeUEDS3x/TU6OUPm+WNMSTiRpNcbpzrcd4Ci ciCzMw2OzKXnbHJmrwZw7xruUC0cvGeDnPotpU8ZdR6A+zfU7Lp4G0fG2c+IRaNiHiOC gH/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OmpEgagjlULRvJ/1pGA/OeRDk6objYeCwx870+1HYV4=; b=J+X+4+JX7ClDvioxB5uLq2u95YnwRr17SUVGvAZ+MxSz6yrbr7rPdNs+tlfaze3QTF BJocwFG9TfvpqEFIBrcDYcs+9nHsVYNvOwuTWwVHScRkr7eGePrl80V8VNZQy+J7ACLD tEizEQB7iQMs683dEsPxixg+ENBLGBTgF1TqcbXXTV+5qxuRQsHbETVM8nEDINNMKhP2 R1ZYzmSdeoCdZ636kGOEtz3cnVbp7uwOGEE6lk0yDN0n6SwfLpC5S/XY2YRonQ9Vool2 CVd9a+vtqpXsd/gI7ZNlmlDIYFJmyLgj3KE8D8rt1JPvaqJqdIZeAl0lxl7ib1Il2Z1m 35rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=zi1mMMjG; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a6549c8000000b004383737c01dsi12091404pgs.803.2022.09.13.03.03.17; Tue, 13 Sep 2022 03:03:31 -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=@walle.cc header.s=mail2022082101 header.b=zi1mMMjG; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231829AbiIMJp2 (ORCPT + 99 others); Tue, 13 Sep 2022 05:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231756AbiIMJpR (ORCPT ); Tue, 13 Sep 2022 05:45:17 -0400 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A82F14020; Tue, 13 Sep 2022 02:45:16 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 2B3A51267; Tue, 13 Sep 2022 11:45:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1663062314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OmpEgagjlULRvJ/1pGA/OeRDk6objYeCwx870+1HYV4=; b=zi1mMMjGMptL+yo9NbTngbslzM5i/3Ybv0b1GMqp1BjLP8l5MtEgZ/YUmwMixCLBZSq+Zy U23gBduChTwYbo2uHOXTPpuMTnW6ep8xlR7JBYdW0B7WO5qHAlEFkkRcmBvj0euUjAnvZ+ DtX6A8ItzbHR/SwD3IQsItfT0mHm9zxlrAukYNEjvnPemaXT96DhGYmDNP51Nai0ixwZgG QEbleSB9OR7wmHxuY85JD8aKOhlEmYNS7yb71nnMP1H3qmketClMw1iVRRSVCeuthb5zXR vGU1KLR4Okp980iCf/RegFPRw26UGzdrUm9qRUe7LkLg7lGpgPw8PXT4q1XtCQ== From: Michael Walle To: michael@walle.cc Cc: UNGLinuxDriver@microchip.com, andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, hkallweit1@gmail.com, horatiu.vultur@microchip.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, pabeni@redhat.com Subject: Re: [PATCH net-next] net: phy: micrel: Add interrupts support for LAN8804 PHY Date: Tue, 13 Sep 2022 11:45:08 +0200 Message-Id: <20220913094508.222812-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220913081814.212548-1-michael@walle.cc> References: <20220913081814.212548-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 >> Add support for interrupts for LAN8804 PHY. >> >> Signed-off-by: Horatiu Vultur >> --- >> drivers/net/phy/micrel.c | 55 ++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 55 insertions(+) >> >> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c >> index 7b8c5c8d013e..98e9bc101d96 100644 >> --- a/drivers/net/phy/micrel.c >> +++ b/drivers/net/phy/micrel.c >> @@ -2676,6 +2676,59 @@ static int lan8804_config_init(struct phy_device *phydev) >> return 0; >> } >> >> +static irqreturn_t lan8804_handle_interrupt(struct phy_device *phydev) >> +{ >> + int status; >> + >> + status = phy_read(phydev, LAN8814_INTS); >> + if (status < 0) { >> + phy_error(phydev); >> + return IRQ_NONE; >> + } >> + >> + if (status > 0) >> + phy_trigger_machine(phydev); >> + >> + return IRQ_HANDLED; >> +} >> + >> +#define LAN8804_OUTPUT_CONTROL 25 >> +#define LAN8804_OUTPUT_CONTROL_INTR_BUFFER BIT(14) >> +#define LAN8804_CONTROL 31 >> +#define LAN8804_CONTROL_INTR_POLARITY BIT(14) >> + >> +static int lan8804_config_intr(struct phy_device *phydev) >> +{ >> + int err; >> + >> + /* Change interrupt polarity */ >> + phy_write(phydev, LAN8804_CONTROL, LAN8804_CONTROL_INTR_POLARITY); > > I assume you change the polarity to high active? Could you add a note? > The LAN966x nor the LAN8804 datasheet describe this bit. You might also add > a note, that this is an internal PHY and you cannot change the polarity on > the GIC. Which begs the question, is this really only an internal PHY or > can you actually buy it as a dedicated one. Then you'd change the polarity > in a really unusual way. > > > > + > > + /* Change interrupt buffer type */ > > To what? Push-pull? Regardless of my remarks, the code itself is working fine: Tested-by: Michael Walle # on kontron-kswitch-d10 -michael > + phy_write(phydev, LAN8804_OUTPUT_CONTROL, > + LAN8804_OUTPUT_CONTROL_INTR_BUFFER); > +