From patchwork Thu Dec 7 14:27:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10099333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4BFDF602BF for ; Thu, 7 Dec 2017 14:39:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C77229E7C for ; Thu, 7 Dec 2017 14:39:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FCD72A473; Thu, 7 Dec 2017 14:39:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B66629E7C for ; Thu, 7 Dec 2017 14:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=HasUAg8kL+Dvh3c5fKU0zCfLsD24Xlt9HwRHVikh7lY=; b=j6qja4nl/V9B+kHO11QzU2822D wOsAicLFOJmjl/XjiqAdVOmnnwTiZNLMbGfmDHNg1YA0nXZmynSJdq69tEAcy3iXQjGehXSCWQUhM o/YmvnHBlHIoOheH4u0TJU+D9PaTIpnPPeaVh74ZDXtaD52cmEHrAeEZoFYJCfsMtgDSVwGZaj5Bc p+BxTmNzBdC4RC/za6VURA8eoHiAIqOqZOrWb99dJphLdl+/bWsAcokOtt0dxd7pRFgZ9MINW0QvO AktVgCyOkbJd2b7uP6MCGBBYl6616/5PHJ9oSMuj4I4K5sNjqeQfH0Twi122Es1FLOwLBpEcmJJiU 63cOiQZw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMxKl-0005P3-89; Thu, 07 Dec 2017 14:39:31 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMxKU-00058R-Jo for linux-arm-kernel@bombadil.infradead.org; Thu, 07 Dec 2017 14:39:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=D9e33m8eYc8i3EnNuM0oIMqS70qglGoD6u5VklvZrbo=; b=Kup/uw6peo9eOhwgDfloC0SZT SHdozzickQ3Owq1ihNcJhWKhipG9AWEI3l1GvkLUhNwSPbSXtxDal+iWYV72LFHvnOHPZc1/HN7KD 5jYamNrDoMTKxQoRahsjBrvrzZPb+JoGFXzD9TiZpxulO0GBRBP9Gd7lj5I9BkR0uRC9UArbD9Ooe bQofVhOQCS+M4iTv8NKN+lZd56t8y+6RQApLOvpeXIWGnzWh1FWX6KMMV6JERsR9WySKJtBHiDXjU GQNpE9Lva5Zis4//0ibX1XSafH5llgUDr0OrzZl8IGNW44847fxOpKqH7U1fg4RHGqKSSm1Y8rv0H ls+uHjyTQ==; Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMx9P-00022X-Su for linux-arm-kernel@lists.infradead.org; Thu, 07 Dec 2017 14:27:49 +0000 Received: by mail-wm0-x244.google.com with SMTP id l141so13350144wmg.1 for ; Thu, 07 Dec 2017 06:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D9e33m8eYc8i3EnNuM0oIMqS70qglGoD6u5VklvZrbo=; b=Seru7aNoof5wMNGUqn2SOLwZWYltExTKXuASWi+jmi5ioMpD+JY68To0bMVdFUZ7o9 m/J4XJctM62wLZEO3dvHWD8qiVfS6sWTLngdMkuyoEr7ct7fyzI9zt2DCQoxL7OE/iwg oQ8BEQ4CLbNui3OtUCvgrpSaOE2/0MxWhfP3WkU9RfE29+6ofiufJaUroqNVsOG65w3z M0ugmDTUOBs9jd8XTTSDf9x/BZK55wrIBWul12ZFAoLgoqI5fDipUVpDGp+isZxdfj+h S/9ozUqC1DkD899nXDuzvGkdMTprnK/xLmJ2XRMZQ2USfxOZgGEubNBK7JAd/DFnpsGD fN9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D9e33m8eYc8i3EnNuM0oIMqS70qglGoD6u5VklvZrbo=; b=crXOZz/OaspCkjArSknBeBlIVvGCeoQhrPybTrxNoseb9etBbjaYHoPX9rBidMDUMO hdkBZjId2qDqvUwOcxSSafNtQVuE5WHbw+cROJlPer30IZ67lRyzZ5zG7LCasb+qOgHY ceSwYC0ZjFf1AYgMaikqMiSqpLZVwZUkff9XBcfEOX8oW2C5nK0GTUiS21428AFmGQR8 jccfgalA7hQeXLDs1WS3kWAxHPtIvl/cHg72CJolrRRhWy3BBW7llWWxjf+2goiXN/9F 8rmtOvWMk6snEx+zWJHVITpw38aNrobJGqWTUnEJrfw3YQdnAIlnvA6MwXbSwlb0fe7n yZzw== X-Gm-Message-State: AKGB3mLHzjTHQmRR0VUcMKkHUKVqyjS7I6Pg4kfdqfcenBIV4W8aSbjz /pmulkNJmxD2jYtpLUJnccKVxA== X-Google-Smtp-Source: AGs4zMZ4+9KFozjGgCNAh35s4ge3lA7eBp1ESzOpAudParSn7HuNmuuffcTwpDkn3HZ8XxKpLeoPqQ== X-Received: by 10.28.224.4 with SMTP id x4mr1288856wmg.118.1512656845491; Thu, 07 Dec 2017 06:27:25 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id t138sm6264520wme.16.2017.12.07.06.27.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Dec 2017 06:27:24 -0800 (PST) From: Jerome Brunet To: Andrew Lunn , Florian Fainelli Subject: [PATCH net-next v2 7/8] net: phy: meson-gxl: add interrupt support Date: Thu, 7 Dec 2017 15:27:14 +0100 Message-Id: <20171207142715.32578-8-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171207142715.32578-1-jbrunet@baylibre.com> References: <20171207142715.32578-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171207_142747_957322_60AB47E0 X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Hilman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Enable interrupt support in meson-gxl PHY driver Signed-off-by: Jerome Brunet --- drivers/net/phy/meson-gxl.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index 5325940fe899..861b021b9758 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c @@ -33,6 +33,14 @@ #define TSTCNTL_WRITE_ADDRESS GENMASK(4, 0) #define TSTREAD1 21 #define TSTWRITE 23 +#define INTSRC_FLAG 29 +#define INTSRC_ANEG_PR BIT(1) +#define INTSRC_PARALLEL_FAULT BIT(2) +#define INTSRC_ANEG_LP_ACK BIT(3) +#define INTSRC_LINK_DOWN BIT(4) +#define INTSRC_REMOTE_FAULT BIT(5) +#define INTSRC_ANEG_COMPLETE BIT(6) +#define INTSRC_MASK 30 #define BANK_ANALOG_DSP 0 #define BANK_WOL 1 @@ -193,17 +201,44 @@ int meson_gxl_read_status(struct phy_device *phydev) return genphy_read_status(phydev); } +static int meson_gxl_ack_interrupt(struct phy_device *phydev) +{ + int ret = phy_read(phydev, INTSRC_FLAG); + + return ret < 0 ? ret : 0; +} + +static int meson_gxl_config_intr(struct phy_device *phydev) +{ + u16 val; + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + val = INTSRC_ANEG_PR + | INTSRC_PARALLEL_FAULT + | INTSRC_ANEG_LP_ACK + | INTSRC_LINK_DOWN + | INTSRC_REMOTE_FAULT + | INTSRC_ANEG_COMPLETE; + } else { + val = 0; + } + + return phy_write(phydev, INTSRC_MASK, val); +} + static struct phy_driver meson_gxl_phy[] = { { .phy_id = 0x01814400, .phy_id_mask = 0xfffffff0, .name = "Meson GXL Internal PHY", .features = PHY_BASIC_FEATURES, - .flags = PHY_IS_INTERNAL, + .flags = PHY_IS_INTERNAL | PHY_HAS_INTERRUPT, .config_init = meson_gxl_config_init, .config_aneg = genphy_config_aneg, .aneg_done = genphy_aneg_done, .read_status = meson_gxl_read_status, + .ack_interrupt = meson_gxl_ack_interrupt, + .config_intr = meson_gxl_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, },