From patchwork Tue Nov 21 15:17:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomer Maimon X-Patchwork-Id: 167803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp695415vqb; Tue, 21 Nov 2023 07:17:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHY4DQVrEfZMFnBAG81odu0K+jEi5kz6P9+KdRNgCvcguy3h8q6Ed+nyrHFEFqD6mPyAGMa X-Received: by 2002:a17:90b:3e85:b0:27d:241a:dd89 with SMTP id rj5-20020a17090b3e8500b0027d241add89mr10200723pjb.40.1700579878218; Tue, 21 Nov 2023 07:17:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700579878; cv=pass; d=google.com; s=arc-20160816; b=0EFmXzL/yKPsRu5gDsKwP71phnjSHCy5kZXOJ+oTEPySFyNLUekAK7p7WG5ShzOn47 ZvnhgHg9ITZ2xz29i9+rPDaU8tTqNjzpMKfAkqzE/0mqIQ+JjocpwcywASFSySjzhEXS NdxMOoVyVjgj26G0hi8kd+uGj5q7gqAsYcsygEJm4TGgEvHRWK9S+C3/GqPUioUDj8gT rkhfoAJTi5Fcbh+5IbdV45Duegiv09kDMjeFHFTBHqfm8811/KSqLYnlusw+QaaGWzkT xjUa+SXdowvW/2uTeT/3muMTDKtwfmotuo/ouQw1DohiyypdK4ceiGFoDUVj71CUv0Kt ZYQg== ARC-Message-Signature: i=2; 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=3bYMlNrJC8z7wsD7AY1RL+6SbJo0K0vixD3e97989V4=; fh=gghfl28uH6B6HqIt0pKiPezHO/Z+wEj71zSbEHnyb/4=; b=P99zAr+db0a4qQ2LZ8SM1SAO8vY/FLpgmcYRrlkFF707BHUMOEYbrDT2xs5pJSnU0Z w4tgOTF2Hm2r+iAJG8yTc13K79Wi2QMOr2okO4TQTUa1FCHV74KG4nJ5qsNRa5mpLylN p0N6lvMpJBw3qM5B+tmBH43nXL1HZDcJx771I8otuYRnpGe3ewxIEJKk572ABKNxh7li 3YLxFRwagEAe21Nl7nh4+/0Z96Pzaxq24Y7tR6LHw8eupPg3uN1EZgww10hG43ZDajbu ereP29z9GunfM95VjSHb22IUYTxci1PU095TnBl3+woDLQjPoslImj0OTXkbTPBDFzje DS4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nuvoton.onmicrosoft.com header.s=selector2-nuvoton-onmicrosoft-com header.b=Vdkdo9LE; arc=pass (i=1 spf=pass spfdomain=nuvoton.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id s11-20020a17090ad48b00b0028528a3aab7si4347770pju.178.2023.11.21.07.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 07:17:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@nuvoton.onmicrosoft.com header.s=selector2-nuvoton-onmicrosoft-com header.b=Vdkdo9LE; arc=pass (i=1 spf=pass spfdomain=nuvoton.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DF2CD8035C41; Tue, 21 Nov 2023 07:17:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234227AbjKUPRt (ORCPT + 99 others); Tue, 21 Nov 2023 10:17:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjKUPRs (ORCPT ); Tue, 21 Nov 2023 10:17:48 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2073.outbound.protection.outlook.com [40.107.117.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5636410C; Tue, 21 Nov 2023 07:17:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L/JHQGiRNBCEF82+ClkeK9nQEBLnp5F8a2VJJ8SHO/b+YpnYKBNFSvEf8YC7ZpWBDoGTwzMbGT40YJQiHwzUW54EzC1lTzUYM/motTA4uhtcZWNRFplXaB+0NPQgg1Pe5ywBgg54xdStlFvq1yX42e2A1WgYXeGS4LI2PZg2UIlgrTjIPEuRH9DZu4IIx/ouwoMdNSwl/9ciUlyefAf4lbX2D44Wds7t1wPU5JXLzFtiJro1vnUW/iGq00Z2xE2c1UgqBXPkIZ4L41p8pqCoi5gN2zigQYmbeL39ddJtGwZgYFGn7jAI/mfuBiJ1H3Drt6B9fVJDxaoohH9dIrxTjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3bYMlNrJC8z7wsD7AY1RL+6SbJo0K0vixD3e97989V4=; b=mG4jQ1w4Z1eUizMn/4jkqv7cc3rR7dANLg1Lyg3pfoXODHI8ZYDVH+HR1S+7bmVooA0yVknt57A99hRcWonEYF/K8ssSOeBLkPzYwr0ZJV//zRAApBHKVZJcq+Vj5botvASQzy/deIJAGDKHVvqNmakhon7gOnzK4IT9MAFjghevMuX/MpRcTsVIPxSOYuqz3VtmJEkTY+7m/exFnV4x0Nqms/2YQMrMlEc2mMq9OVNm6lkonVsnwPZOMREn7x1CV5IgRG47wVeTOOADrB2IlwU7AzWuvtyHbyG6TUwoiD1Hg5L/SB4WKghUsgSAX2pdDZJSWOSY8Z6ZKWVHaHPjfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 175.98.123.7) smtp.rcpttodomain=codeconstruct.com.au smtp.mailfrom=nuvoton.com; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3bYMlNrJC8z7wsD7AY1RL+6SbJo0K0vixD3e97989V4=; b=Vdkdo9LEXmTWZkpaU98iQR0StyejQr3zWtPzrWGRBsNCngUBo+5gUvZfjha5jWaL/rFce6HoFWwtIwGYI91jC1eheDkh5NlbkWXt5ButNlLOk/vfoaaag9kJUc/3oAIynGg5Kawvy0jOTKAYiRT4QgtnzuQJAGMhCRMrwl0s09c= Received: from SG2PR04CA0214.apcprd04.prod.outlook.com (2603:1096:4:187::17) by SI2PR03MB5531.apcprd03.prod.outlook.com (2603:1096:4:126::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.18; Tue, 21 Nov 2023 15:17:40 +0000 Received: from SG2PEPF000B66CA.apcprd03.prod.outlook.com (2603:1096:4:187:cafe::4e) by SG2PR04CA0214.outlook.office365.com (2603:1096:4:187::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.28 via Frontend Transport; Tue, 21 Nov 2023 15:17:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 175.98.123.7) smtp.mailfrom=nuvoton.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: Pass (protection.outlook.com: domain of nuvoton.com designates 175.98.123.7 as permitted sender) receiver=protection.outlook.com; client-ip=175.98.123.7; helo=NTHCCAS04.nuvoton.com; pr=C Received: from NTHCCAS04.nuvoton.com (175.98.123.7) by SG2PEPF000B66CA.mail.protection.outlook.com (10.167.240.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.7025.12 via Frontend Transport; Tue, 21 Nov 2023 15:17:39 +0000 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCCAS04.nuvoton.com (10.1.8.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.14; Tue, 21 Nov 2023 23:17:38 +0800 Received: from taln58.nuvoton.co.il (10.191.1.178) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 21 Nov 2023 23:17:38 +0800 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln58.nuvoton.co.il (Postfix) with ESMTP id BD5805F63D; Tue, 21 Nov 2023 17:17:36 +0200 (IST) Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 50B72235CE25; Tue, 21 Nov 2023 17:17:36 +0200 (IST) From: Tomer Maimon To: , , , , , , , , , , , , , , , CC: , , , , , , Tomer Maimon Subject: [PATCH v1 1/2] dt-bindings: net: Add support NPCM dwmac Date: Tue, 21 Nov 2023 17:17:32 +0200 Message-ID: <20231121151733.2015384-2-tmaimon77@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231121151733.2015384-1-tmaimon77@gmail.com> References: <20231121151733.2015384-1-tmaimon77@gmail.com> MIME-Version: 1.0 X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66CA:EE_|SI2PR03MB5531:EE_ X-MS-Office365-Filtering-Correlation-Id: bdf72705-85d7-41a8-ecab-08dbeaa50033 X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nhycYkGzp1IQg2JdEqlGIXm8L/S0BphKbxDxCTfrULdx3375rA47PZB9lGsjhHPmMC5PcLTdx2+lXQTrcMAdn7oSKi1Mhf25SRKI22jLhD4qLELgqMQn8usui/LGUjNEAqCaUhhLvDsXhoC6OJNe0BujJoOCFWhO24CYrfbs9mujnX2rjYNGoJjLydxx4NQ+AQkNRTb4Zbj1jdEzD61n8+51SxeT8oo2a9s4lypMU/MujaUUqEFdvoLXZIGG7iD3v75vjzX+79bJpIkRIIz1tEmnqJkTwO3tGCGVmPvnBKLh6HtjE1rK6hheI9smX9p17c9pjUkPxSCsLkBUBKlgcnj3mrKLbouvyOqNNjv0IRZlavbmc/5GVnySX4+IY5GRAPnqWJwFcylptqSORoIKOIEtMpt2bOc9afksHvAxac0X4QyleuAF8YywGYEeNNihb2hLHfYWz8jULvlAZL3Y85gN2/YvVgUCkjPmeiR1jFOkRRDYdSjxJ/tUVrMYZtLdDMNyTEWrJ/MsNiAV8PflIdoefYAOl1MVX3a0d1GtAB9GcZiPoibP/yfIexQKWpQ/uWCNmGoz5Y7jsud3A3UyoWBx4VWwJnLKLtjugC9dpq+r6H9YUK1Mtp4og18EgwGXCf/tBSCrjZN72GUgICZiDsnGWchpoY9T0NDhv+mXSF21OBAiyMpFN9T29kS4q6l4QTiLOBPIb+j/bQa4YGIG/14svmLKLWvFr+8p+xlPuW38pqj+yjzilPF5+n9dB4V2kWMxl3XTrTgmrQCU6vvNpqrLxyxRI2Lw6ztLaNf182M8Mf6/4O+NZHPS4I7iQ2cuDVAcdaVvzTRdY2ovt6466bA7PTDqsegXmhmyv0PvX2bOjWVGBrv376xj/1hQ1Ghh6FtWH0NoGhu97e4HsmXbXQ== X-Forefront-Antispam-Report: CIP:175.98.123.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS04.nuvoton.com;PTR:175-98-123-7.static.tfn.net.tw;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(346002)(376002)(136003)(230922051799003)(451199024)(82310400011)(186009)(64100799003)(61400799012)(48200799006)(36840700001)(46966006)(40470700004)(336012)(1076003)(2616005)(26005)(6266002)(478600001)(6666004)(42882007)(47076005)(36860700001)(73392003)(82202003)(83380400001)(7416002)(2906002)(4326008)(5660300002)(41300700001)(8676002)(110136005)(76482006)(70586007)(42186006)(54906003)(70206006)(966005)(8936002)(316002)(356005)(81166007)(921008)(82740400003)(83170400001)(36756003)(55446002)(40460700003)(40480700001)(45356006)(35450700002);DIR:OUT;SFP:1101; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2023 15:17:39.5869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdf72705-85d7-41a8-ecab-08dbeaa50033 X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[175.98.123.7];Helo=[NTHCCAS04.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66CA.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR03MB5531 X-Spam-Status: No, score=0.5 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 21 Nov 2023 07:17:50 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783187246177059794 X-GMAIL-MSGID: 1783187246177059794 Add documentation to describe Nuvoton BMC NPCM dwmac driver(sgmii). Signed-off-by: Tomer Maimon --- .../bindings/net/nuvoton,npcm8xx-sgmii.yaml | 72 +++++++++++++++++++ .../devicetree/bindings/net/snps,dwmac.yaml | 1 + 2 files changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nuvoton,npcm8xx-sgmii.yaml diff --git a/Documentation/devicetree/bindings/net/nuvoton,npcm8xx-sgmii.yaml b/Documentation/devicetree/bindings/net/nuvoton,npcm8xx-sgmii.yaml new file mode 100644 index 000000000000..6a5f2cade7c9 --- /dev/null +++ b/Documentation/devicetree/bindings/net/nuvoton,npcm8xx-sgmii.yaml @@ -0,0 +1,72 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/nuvoton,npcm8xx-sgmii.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton NPCM DWMAC SGMII Ethernet controller + +maintainers: + - Tomer Maimon + +select: + properties: + compatible: + contains: + enum: + - nuvoton,npcm8xx-sgmii + required: + - compatible + +allOf: + - $ref: snps,dwmac.yaml# + +properties: + compatible: + oneOf: + - items: + - enum: + - nuvoton,npcm8xx-sgmii + - const: snps,dwmac-3.50a + reg: + items: + - description: + The first range represent DWMAC controller registers. + - description: + The second range represent PCS configuration registers. + + clocks: + items: + - description: GMAC main clock + + clock-names: + items: + - const: stmmaceth + +required: + - compatible + - reg + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + #include + #include + + ahb { + #address-cells = <2>; + #size-cells = <2>; + + gmac0: ethernet@f0802000 { + compatible = "nuvoton,npcm8xx-sgmii","snps,dwmac-3.50a"; + reg = <0x0 0xf0802000 0x0 0x2000>, <0x0 0xf0780000 0x0 0x200>; + interrupts = ; + interrupt-names = "macirq"; + clocks = <&clk NPCM8XX_CLK_AHB>; + clock-names = "stmmaceth"; + phy-mode = "rgmii-id"; + }; + }; diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index 5c2769dc689a..ba52dbc85144 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -66,6 +66,7 @@ properties: - ingenic,x2000-mac - loongson,ls2k-dwmac - loongson,ls7a-dwmac + - nuvoton,npcm8xx-sgmii - qcom,qcs404-ethqos - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos From patchwork Tue Nov 21 15:17:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomer Maimon X-Patchwork-Id: 167804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp695919vqb; Tue, 21 Nov 2023 07:18:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzmgTPiZL8krsQrdvPcyHSxBm57PN1KJqe5UVw9zo5Qun6qZfM5bdC4Pk6UNcL2uVuMUOL X-Received: by 2002:a05:6a00:1310:b0:6cb:a60c:2140 with SMTP id j16-20020a056a00131000b006cba60c2140mr5789154pfu.28.1700579924045; Tue, 21 Nov 2023 07:18:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700579924; cv=pass; d=google.com; s=arc-20160816; b=vv9oTgztCaPvwBrH/OTktDgCcV7d8ToBakpHv7gM66lKT7lGsVsMCLaS98MhrlxaFm F6024CLYhWTWFExVVh0TKJPqA0VEI/9wYa3IrSNqlP5F5uLv8Gok+Il/HFpxxzt+3TSt IIUNEOplFIEFurylqFOzfayZ+iI8vmh6oy+biudeB+s0Ko3MJ2+fHJ9MwQa5biIjRJt1 mK8gr+LHdW8ib6CDcyBfIa3DfypR4xdiPpiRaDTewPHgzoL5qbAfnLYH+Rv8vCzT5W2p jlIYHF0gjCVRrwNDKpBmgw0C5E9kidliMLuT2RyvzjtPBOtN5c9Aj9zz2WJZ2j/KFC/c TfLw== ARC-Message-Signature: i=2; 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=TsxyS+EBEcMh9D/3MoDQ5Q14lf8Ya3LsFxMz39xL6fw=; fh=gghfl28uH6B6HqIt0pKiPezHO/Z+wEj71zSbEHnyb/4=; b=S/Pca0haR4wcXSA8nfze5wj/n2Z5WXUI3jrIbiYe9NFkNXE9PEPm7WQhyzOIbpflse ttWvI+HyuiSB79il+Uu8upvQiWvYlA2yr3xPAu0YCD9OjIsKmigZ1eOOeRoeJszMsALi p5ozLVjEhSatSrlUdNJQwsigZvTirq9RKDSpRnoCDkGf21Ei6q+voNUDEEzHQJoIsuo+ 7uKbSuZAHDu4ekX/ebgls4OzQ16fd+/HghVdK88K6MCCqyE5SJq2MNkfl3DbW8/o9DSY po6GQIvGIPkveuuojo6zwhFuRkX6uTtK29V8qPbYQSuODcuQ09QylnXsa3D6Vw9KaTU/ 2DWA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nuvoton.onmicrosoft.com header.s=selector2-nuvoton-onmicrosoft-com header.b=AX4qUv5o; arc=pass (i=1 spf=pass spfdomain=nuvoton.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id e20-20020a63f554000000b005bcfc4fffe4si10627162pgk.187.2023.11.21.07.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 07:18:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@nuvoton.onmicrosoft.com header.s=selector2-nuvoton-onmicrosoft-com header.b=AX4qUv5o; arc=pass (i=1 spf=pass spfdomain=nuvoton.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 17F9C80C0558; Tue, 21 Nov 2023 07:18:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234430AbjKUPRy (ORCPT + 99 others); Tue, 21 Nov 2023 10:17:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234198AbjKUPRs (ORCPT ); Tue, 21 Nov 2023 10:17:48 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2062.outbound.protection.outlook.com [40.107.255.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88B70BD; Tue, 21 Nov 2023 07:17:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e2Xx9uvBEkrbza76HreBZ3sNmlQ4SG7aTB8tng6ZWlreQZ5TxAbJNcSJNTVO8Wj+U0IALTIly2OHMnAzL+/12boa0pdOBUsBNN+AW5n7B7mM4uOtK0ThKF7VA9q89/sQ6RzIknOZCBUZQmtcl/PL4UHzCxN1Oh1ne16pB0s0OCtAtK8vtR1w5qAYgYNDK7dOmrDvpmG44gO6otYRk5u/Wfi35Ox5WtQvhp771h6C5iGR1o1GCd/ZE0l5faJ87vT3/lBVQ5olaiBwbZnsYOmOy26axHGYkIpGlsNPT8lu9v/BsXwWpl2GrkMjKmPuA7xCfmJVLfCAUe7VSaAR1GT/7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TsxyS+EBEcMh9D/3MoDQ5Q14lf8Ya3LsFxMz39xL6fw=; b=eWkRpvurgtzO25rFQy7+z0YmglukL+THi0E8SwSK35YOBThLNLeKI00stv+tEjf1Im4g0UCWSahK95EqgKd1cCGDPvxiP/S7f103uMjml4YcHXrYdz6lxqCjAgCQdcIq3ErBAK9F//MQQYXEIPMlcAZZWPap533cwgy+B7vm7KYiNWzLNDkQh+/R0ci86I3iLLUzljSMtWUtxtuaej2+sX0FyaOkphdGAneQcIMfSCeYDZujiPQ+DIpqyvTkoinIZJqXI00E9atHlSPDGaPWs82mMsx7UEbCIxeLmqXDu6rbhNB904+rM8ihybTudYdj6UcQXyf9uR+Bwjge9F8VZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 175.98.123.7) smtp.rcpttodomain=codeconstruct.com.au smtp.mailfrom=nuvoton.com; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TsxyS+EBEcMh9D/3MoDQ5Q14lf8Ya3LsFxMz39xL6fw=; b=AX4qUv5oO2du1g15ihaO11If6lwBk4KsfycwVIwmRnXVtd/AgtAB8sfg2LpNJvgkHwtoeFnGGdGqTazS2eLIZJx5L9MMYMm0eHcrX9elWf3+KAat326+9pqVVTdJKdbUff5BOWluTuu3qFHr772YlSBhrP1LZxgG151kbN4HDAY= Received: from SG2PR04CA0200.apcprd04.prod.outlook.com (2603:1096:4:187::15) by SI6PR03MB8705.apcprd03.prod.outlook.com (2603:1096:4:24f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.27; Tue, 21 Nov 2023 15:17:40 +0000 Received: from SG2PEPF000B66CA.apcprd03.prod.outlook.com (2603:1096:4:187:cafe::6b) by SG2PR04CA0200.outlook.office365.com (2603:1096:4:187::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.28 via Frontend Transport; Tue, 21 Nov 2023 15:17:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 175.98.123.7) smtp.mailfrom=nuvoton.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: Pass (protection.outlook.com: domain of nuvoton.com designates 175.98.123.7 as permitted sender) receiver=protection.outlook.com; client-ip=175.98.123.7; helo=NTHCCAS04.nuvoton.com; pr=C Received: from NTHCCAS04.nuvoton.com (175.98.123.7) by SG2PEPF000B66CA.mail.protection.outlook.com (10.167.240.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.7025.12 via Frontend Transport; Tue, 21 Nov 2023 15:17:40 +0000 Received: from NTHCCAS02.nuvoton.com (10.1.9.121) by NTHCCAS04.nuvoton.com (10.1.8.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.14; Tue, 21 Nov 2023 23:17:39 +0800 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCCAS02.nuvoton.com (10.1.9.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 21 Nov 2023 23:17:39 +0800 Received: from taln58.nuvoton.co.il (10.191.1.178) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 21 Nov 2023 23:17:39 +0800 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln58.nuvoton.co.il (Postfix) with ESMTP id B26A35F63F; Tue, 21 Nov 2023 17:17:37 +0200 (IST) Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 9EC7B235CE27; Tue, 21 Nov 2023 17:17:36 +0200 (IST) From: Tomer Maimon To: , , , , , , , , , , , , , , , CC: , , , , , , Tomer Maimon Subject: [PATCH v1 2/2] net: stmmac: Add NPCM support Date: Tue, 21 Nov 2023 17:17:33 +0200 Message-ID: <20231121151733.2015384-3-tmaimon77@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231121151733.2015384-1-tmaimon77@gmail.com> References: <20231121151733.2015384-1-tmaimon77@gmail.com> MIME-Version: 1.0 X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66CA:EE_|SI6PR03MB8705:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ae92dbe-d3bc-4f90-22b0-08dbeaa500ab X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CLF0PbdKo4Rl1isfDncngsA0ttranzlel9Hhh8KQV27l/ljw0hza7C0LRLcl9lRJat/mW1LJd0FIVJV3VtUkbqRRDwgP4q6J0MUu/dQcZsDctVeZtlzUb1/J/csdFwsKChmyTCKiol9saqBK5BRdOBtHjF476OLgPZ+R03a3lZV9A3LIL+w2vUtRg862LD+D71AkvBqRm4gCSjv2Pq1l4KBGxFDil4KQPLIYDs4kr8w912knuQngRijYaK7kKCBtlIj/QpVwyu+MjnxwoQfHGOvaLWncJ69E52oycw4Chn5a0I/v8eDqsQzOmSf76a/+a/Do3dnLLq6BArmaA3HDZSijAl4hJQGZ/IteFDsYzjlo5MhxHiNKZISkSDA2uW6k1Jk4rGt/xorrAUVrYoBvOp5pNLKejHAKzVwlQlMUIkYVwLjVl2+LczjB3OkjnQXkb6FfajCigLGea/xbl5oY6/AW0am1EftpeY5xEfN0YSprKT7O+VzdVTJ7pB1705JNCRiGP2ItEBGyH9KlYdpKTjwp7JrWC4pKGDN4fE6Kf8GWWnu3GJjA/m97rClTO2JfOmRcoYOL185hJd1A5TFgwX4FvQRUiefRen27hf4OpD3cOCy3A3LSDojsZh2Ljb0K0XqYa46LIurtBYEBgKNMZ1aOmYbUtG6BZRaYu1UfxHw15WPnZDXc1dR+oLsu4MRxPtS60fKvg8MDeQSNUH4eQvMSwiCDf/N+SaVIx0oEY0XQCcpXsHQFGfFHW/Ymhc6Ef+cxbtN/nJz0/EyQ0H0MlfDcBgTDOzfbKbg/ylpelm5En7TphsYzi32FcjOWfbKkcP4Xb4L3siiPOowZ5gP4/zlZl/52yobW/bNHvLYi5ws= X-Forefront-Antispam-Report: CIP:175.98.123.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS04.nuvoton.com;PTR:175-98-123-7.static.tfn.net.tw;CAT:NONE;SFS:(13230031)(4636009)(136003)(396003)(39860400002)(376002)(346002)(230922051799003)(48200799006)(61400799012)(451199024)(82310400011)(64100799003)(186009)(40470700004)(46966006)(36840700001)(40480700001)(2906002)(8936002)(41300700001)(4326008)(8676002)(7416002)(5660300002)(316002)(42186006)(110136005)(54906003)(76482006)(40460700003)(70586007)(47076005)(55446002)(478600001)(1076003)(26005)(82202003)(73392003)(83170400001)(6666004)(36756003)(70206006)(2616005)(6266002)(42882007)(336012)(81166007)(921008)(83380400001)(36860700001)(356005)(82740400003)(45356006)(35450700002);DIR:OUT;SFP:1101; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2023 15:17:40.3682 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ae92dbe-d3bc-4f90-22b0-08dbeaa500ab X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[175.98.123.7];Helo=[NTHCCAS04.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66CA.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI6PR03MB8705 X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 07:18:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783187294451975726 X-GMAIL-MSGID: 1783187294451975726 Add Nuvoton NPCM BMC SoCs support to STMMAC dwmac driver. And modify MAINTAINERS to add a new F: entry for this driver. Signed-off-by: Tomer Maimon --- MAINTAINERS | 1 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-npcm.c | 121 ++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-npcm.c diff --git a/MAINTAINERS b/MAINTAINERS index 5c9f868e13b6..43059c7d00c7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2507,6 +2507,7 @@ F: arch/arm64/boot/dts/nuvoton/ F: drivers/*/*/*npcm* F: drivers/*/*npcm* F: drivers/rtc/rtc-nct3018y.c +F: drivers/net/ethernet/stmicro/stmmac/dwmac-npcm.c F: include/dt-bindings/clock/nuvoton,npcm7xx-clock.h F: include/dt-bindings/clock/nuvoton,npcm845-clk.h diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index a2b9e289aa36..2487a674d0d3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -121,6 +121,15 @@ config DWMAC_MESON the stmmac device driver. This driver is used for Meson6, Meson8, Meson8b and GXBB SoCs. +config DWMAC_NPCM + tristate "Nuvoton NPCM dwmac support" + depends on OF && (ARCH_NPCM || COMPILE_TEST) + help + Support for Ethernet controller on Nuvoton NPCM BMC SoCs. + + This selects the Nuvoton NPCM BMC SoC glue layer support for + the stmmac device driver. This driver is used for NPCM8xx SoCs. + config DWMAC_QCOM_ETHQOS tristate "Qualcomm ETHQOS support" default ARCH_QCOM diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index 80e598bd4255..1c86c8ca39f0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_DWMAC_IPQ806X) += dwmac-ipq806x.o obj-$(CONFIG_DWMAC_LPC18XX) += dwmac-lpc18xx.o obj-$(CONFIG_DWMAC_MEDIATEK) += dwmac-mediatek.o obj-$(CONFIG_DWMAC_MESON) += dwmac-meson.o dwmac-meson8b.o +obj-$(CONFIG_DWMAC_NPCM) += dwmac-npcm.o obj-$(CONFIG_DWMAC_QCOM_ETHQOS) += dwmac-qcom-ethqos.o obj-$(CONFIG_DWMAC_ROCKCHIP) += dwmac-rk.o obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-npcm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-npcm.c new file mode 100644 index 000000000000..dbb857661142 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-npcm.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (c) 2023 Nuvoton Technology corporation. + +#include +#include +#include +#include +#include +#include +#include + +#include "stmmac_platform.h" + +#define IND_AC_BA_REG 0x1FE +#define SR_MII_CTRL 0x3E0000 + +#define PCS_SR_MII_CTRL_REG 0x0 +#define PCS_SPEED_SELECT6 BIT(6) +#define PCS_AN_ENABLE BIT(12) +#define PCS_SPEED_SELECT13 BIT(13) +#define PCS_RST BIT(15) + +#define PCS_MASK_SPEED 0xDFBF + +struct npcm_dwmac { + void __iomem *reg; +}; + +static void npcm_dwmac_fix_mac_speed(void *priv, unsigned int speed, + unsigned int mode) +{ + struct npcm_dwmac *dwmac = priv; + u16 val; + + iowrite16((u16)(SR_MII_CTRL >> 9), dwmac->reg + IND_AC_BA_REG); + val = ioread16(dwmac->reg + PCS_SR_MII_CTRL_REG); + val &= PCS_MASK_SPEED; + + switch (speed) { + case SPEED_1000: + val |= PCS_SPEED_SELECT6; + break; + case SPEED_100: + val |= PCS_SPEED_SELECT13; + break; + case SPEED_10: + break; + } + + iowrite16(val, dwmac->reg + PCS_SR_MII_CTRL_REG); +} + +void npcm_dwmac_pcs_init(struct npcm_dwmac *dwmac, struct device *dev, + struct plat_stmmacenet_data *plat_dat) +{ + u16 val; + + iowrite16((u16)(SR_MII_CTRL >> 9), dwmac->reg + IND_AC_BA_REG); + val = ioread16(dwmac->reg + PCS_SR_MII_CTRL_REG); + val |= PCS_RST; + iowrite16(val, dwmac->reg + PCS_SR_MII_CTRL_REG); + + while (val & PCS_RST) + val = ioread16(dwmac->reg + PCS_SR_MII_CTRL_REG); + + val &= ~(PCS_AN_ENABLE); + iowrite16(val, dwmac->reg + PCS_SR_MII_CTRL_REG); +} + +static int npcm_dwmac_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat_dat; + struct stmmac_resources stmmac_res; + struct npcm_dwmac *dwmac; + int ret; + + ret = stmmac_get_platform_resources(pdev, &stmmac_res); + if (ret) + return ret; + + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR(plat_dat)) + return PTR_ERR(plat_dat); + + dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + if (!dwmac) + ret = -ENOMEM; + + dwmac->reg = devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(dwmac->reg)) + ret = PTR_ERR(dwmac->reg); + + npcm_dwmac_pcs_init(dwmac, &pdev->dev, plat_dat); + + plat_dat->has_gmac = true; + plat_dat->bsp_priv = dwmac; + plat_dat->fix_mac_speed = npcm_dwmac_fix_mac_speed; + + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); +} + +static const struct of_device_id npcm_dwmac_match[] = { + { .compatible = "nuvoton,npcm8xx-sgmii" }, + { } +}; +MODULE_DEVICE_TABLE(of, npcm_dwmac_match); + +static struct platform_driver npcm_dwmac_driver = { + .probe = npcm_dwmac_probe, + .remove_new = stmmac_pltfr_remove, + .driver = { + .name = "npcm-dwmac", + .pm = &stmmac_pltfr_pm_ops, + .of_match_table = npcm_dwmac_match, + }, +}; +module_platform_driver(npcm_dwmac_driver); + +MODULE_AUTHOR("Tomer Maimon "); +MODULE_DESCRIPTION("Nuvoton NPCM DWMAC glue layer"); +MODULE_LICENSE("GPL v2");