From patchwork Wed Dec 30 12:53:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 11993225 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 571AEC433DB for ; Wed, 30 Dec 2020 12:55:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 163052220B for ; Wed, 30 Dec 2020 12:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726662AbgL3MzV (ORCPT ); Wed, 30 Dec 2020 07:55:21 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:51509 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbgL3MzV (ORCPT ); Wed, 30 Dec 2020 07:55:21 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4D5WSh3gmbz1qs3D; Wed, 30 Dec 2020 13:54:12 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4D5WSh3BWPz1tYWG; Wed, 30 Dec 2020 13:54:12 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id qociLUD-jNfU; Wed, 30 Dec 2020 13:54:11 +0100 (CET) X-Auth-Info: SehLCSFW8ydQHslG9EwSMBZNtSGSqlAE5+eyQ33+yMo= Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 30 Dec 2020 13:54:11 +0100 (CET) From: Marek Vasut To: netdev@vger.kernel.org Cc: Marek Vasut , Andrew Lunn , Heiner Kallweit , Lukas Wunner Subject: [PATCH 1/2] net: phy: micrel: Add KS8851 PHY support Date: Wed, 30 Dec 2020 13:53:57 +0100 Message-Id: <20201230125358.1023502-1-marex@denx.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The KS8851 has a reduced internal PHY, which is accessible through its registers at offset 0xe4. The PHY is compatible with KS886x PHY present in Micrel switches, except the PHY ID Low/High registers are swapped. Add PHY ID for this KS8851 PHY and use custom PHY ID mask due to the swap. Signed-off-by: Marek Vasut Cc: Andrew Lunn Cc: Heiner Kallweit Cc: Lukas Wunner To: netdev@vger.kernel.org --- drivers/net/phy/micrel.c | 9 +++++++++ include/linux/micrel_phy.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 54e0d75203da..ca6da128e37a 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1386,6 +1386,14 @@ static struct phy_driver ksphy_driver[] = { .read_status = ksz8873mll_read_status, .suspend = genphy_suspend, .resume = genphy_resume, +}, { + .phy_id = PHY_ID_KSZ8851, + .phy_id_mask = 0xfff000ff, + .name = "Micrel KSZ8851 Ethernet MAC", + /* PHY_BASIC_FEATURES */ + .config_init = kszphy_config_init, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .phy_id = PHY_ID_KSZ886X, .phy_id_mask = MICREL_PHY_ID_MASK, @@ -1432,6 +1440,7 @@ static struct mdio_device_id __maybe_unused micrel_tbl[] = { { PHY_ID_KSZ8061, MICREL_PHY_ID_MASK }, { PHY_ID_KSZ8081, MICREL_PHY_ID_MASK }, { PHY_ID_KSZ8873MLL, MICREL_PHY_ID_MASK }, + { PHY_ID_KSZ8851, 0xfff000ff }, { PHY_ID_KSZ886X, MICREL_PHY_ID_MASK }, { PHY_ID_LAN8814, MICREL_PHY_ID_MASK }, { } diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 416ee6dd2574..1c26e4ac0dc9 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -29,6 +29,8 @@ #define PHY_ID_KSZ9131 0x00221640 #define PHY_ID_LAN8814 0x00221660 +/* The PHY ID Low/High registers are swapped on KSZ8851 */ +#define PHY_ID_KSZ8851 0x14300022 #define PHY_ID_KSZ886X 0x00221430 #define PHY_ID_KSZ8863 0x00221435