From patchwork Wed Nov 2 04:10:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 14022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3385952wru; Tue, 1 Nov 2022 21:18:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FdbWrgGSMIvN9ROoqIoD8agGAUp59uHSRVflwEFCyMcik/S1JGQE53IPN6LzPZ/VvtEic X-Received: by 2002:a17:907:7d8f:b0:78e:2cba:560f with SMTP id oz15-20020a1709077d8f00b0078e2cba560fmr21681882ejc.173.1667362684009; Tue, 01 Nov 2022 21:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667362684; cv=none; d=google.com; s=arc-20160816; b=GJAMsH3Z/8kPXMBdtDCfGxlVy6emXDbNMElEo3dhRthCLbPZduSvNVh3CVgbG1Ok/C YgirtcvbH1ON0SCiyGR09w/JKFn+YHk/HMvng6B0ab/rImeC3vE1YwqLSQg75sI6BTZ3 iM1oe608n00v1lJ2ec33Dkl1PzzvhwaFDuDfvpY4JwJ8zPGF2fYEhh37UjNpzgDiQVov aUjTloQkINbAbOc1vu4Rip8ZldJDHp+dA4KuZ88MTfVNJaUxWhl34lP+iZaCUTPEAj9W KI1KAonN5cWur0Vj31Lgizud3hs6idDO2KpVvagjMSWgsthMRCVZFmavDo0miIq0LeuP V5kQ== 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=IDdJX7q41nXG1vu8YhaGwcJUhL4RybCVqsgArUa6qf4=; b=l72yzw0R8FawzmVo9Pi3tQKr3NmV4nfM6F6ETTuCPrwrTgM9LlxjSWUn+io6LIbaZk UfZyEwOrpesdL6egY+m/fIcj24mUB74tzF666YdplO6qOXd2fpwWf3K6dHzKiR8rOy+o l5QZA/4nwBxhXvuOXWQQqon50zDh1dmDjcPqJ+icvgD1gTjgdI2DXh9Pv08rd+z8JU5j V1BIQxat289H3L9ewcmY7j5IQUn5bVEGNLKlNWCee1oimObeqn4rvXdoPnG2Y9/FTu96 Q10GHI2gKU2bYM9ZmJhTGbSszdEkQkq1UVqXCbmIJ+SxHAorz2xPOTiV01BRlt6Pub/p AQSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=h5bH8joC; 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=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a1709066bc200b007317ad1f9a4si10204994ejs.310.2022.11.01.21.17.38; Tue, 01 Nov 2022 21:18:03 -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=@microchip.com header.s=mchp header.b=h5bH8joC; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbiKBEOi (ORCPT + 99 others); Wed, 2 Nov 2022 00:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiKBEOd (ORCPT ); Wed, 2 Nov 2022 00:14:33 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC8FB1CB1C; Tue, 1 Nov 2022 21:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667362465; x=1698898465; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=25DNsgPEKgMFBwyfwI/QGdsGIiY/OjVK3YkxEfYRyak=; b=h5bH8joCbqLWgg7o4kj2UoN+pjuvQO9b6gdRsWKD5+kFAjaUlIKYSbL1 Bs2N0lsHAXTrInOyYFD6+VSqHZOy+I+ypz39fYpMIaxyqSJJ/DlPcMY8T Y2c/wNFnYeYWyV002iEkTXAVxofr3/ihUDtqXE5lbp7QrJ0uOg0GLQmTV A7hLt91l1cIShanV9Aw1K8zMI9Ayh0Qtt2yIu2yDTZ1rA6HD2aanpuHrM 0b1ru6lanhx1gPYvMFkjiOrq8L7Eu3uJ1SRGOX3B/kDdGAzAlC3aCWKEb X4WxDU2yzphNergOQjV2PSFKgkuY7UUZiYg1XnKAviQvf81zia/afwOjB A==; X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="181530209" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Nov 2022 21:14:24 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 1 Nov 2022 21:14:23 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 1 Nov 2022 21:14:19 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [PATCH net-next 1/6] net: dsa: microchip: lan937x: add regmap range validation Date: Wed, 2 Nov 2022 09:40:53 +0530 Message-ID: <20221102041058.128779-2-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> References: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748356494142434461?= X-GMAIL-MSGID: =?utf-8?q?1748356494142434461?= Add regmap_range and regmap_access_table to define valid register range for LAN937x switch family. LAN937x family have sku id's LAN9370, LAN9371, LAN9372, LAN9373 and LAN9374. regmap_range structure is arranged as Global Registers followed by Port Registers but they are distributed as Global Registers, T1 PHY Port Registers, Tx PHY Port Registers, RGMII Port Registers, SGMII Port Registers. On 16 bit addressing, most significant 4 bits are used for representing port number. So valid range of two different T1 PHY ports within a sku will differ on upper nibble only. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 1760 ++++++++++++++++++++++++ 1 file changed, 1760 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index d612181b3226..b0905c5b701d 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -1030,6 +1030,1756 @@ static const struct regmap_access_table ksz9896_register_set = { .n_yes_ranges = ARRAY_SIZE(ksz9896_valid_regs), }; +static const struct regmap_range lan9370_valid_regs[] = { + regmap_reg_range(0x0000, 0x0003), + regmap_reg_range(0x0007, 0x0007), + regmap_reg_range(0x000f, 0x0027), + regmap_reg_range(0x0030, 0x0035), + regmap_reg_range(0x0050, 0x005f), + regmap_reg_range(0x0100, 0x011b), + regmap_reg_range(0x0120, 0x0123), + regmap_reg_range(0x0128, 0x0140), + regmap_reg_range(0x0142, 0x0159), + regmap_reg_range(0x0200, 0x0203), + regmap_reg_range(0x0210, 0x0217), + regmap_reg_range(0x0300, 0x0300), + regmap_reg_range(0x0302, 0x0307), + regmap_reg_range(0x030a, 0x0336), + regmap_reg_range(0x0338, 0x033b), + regmap_reg_range(0x033e, 0x033e), + regmap_reg_range(0x0340, 0x0367), + regmap_reg_range(0x0370, 0x0370), + regmap_reg_range(0x0374, 0x0378), + regmap_reg_range(0x037c, 0x037d), + regmap_reg_range(0x0380, 0x0383), + regmap_reg_range(0x0390, 0x039b), + regmap_reg_range(0x03a4, 0x03b7), + regmap_reg_range(0x03e0, 0x03e3), + regmap_reg_range(0x03e8, 0x03eb), + regmap_reg_range(0x0400, 0x040e), + regmap_reg_range(0x0410, 0x0437), + regmap_reg_range(0x0440, 0x046f), + regmap_reg_range(0x0500, 0x054b), + regmap_reg_range(0x0550, 0x05b7), + regmap_reg_range(0x0640, 0x0645), + regmap_reg_range(0x0648, 0x064d), + regmap_reg_range(0x0650, 0x0655), + regmap_reg_range(0x0700, 0x07ff), + regmap_reg_range(0x0800, 0x088b), + regmap_reg_range(0x0900, 0x09ff), + + /* Port 1 */ + regmap_reg_range(0x1000, 0x1001), + regmap_reg_range(0x1004, 0x100b), + regmap_reg_range(0x101b, 0x101b), + regmap_reg_range(0x101f, 0x1021), + regmap_reg_range(0x1030, 0x1030), + regmap_reg_range(0x1040, 0x1040), + regmap_reg_range(0x1100, 0x111f), + regmap_reg_range(0x1200, 0x120b), + regmap_reg_range(0x1300, 0x1307), + regmap_reg_range(0x1400, 0x1405), + regmap_reg_range(0x1408, 0x1409), + regmap_reg_range(0x1410, 0x1417), + regmap_reg_range(0x1420, 0x1427), + regmap_reg_range(0x1500, 0x1507), + regmap_reg_range(0x1600, 0x1665), + regmap_reg_range(0x1668, 0x168f), + regmap_reg_range(0x1694, 0x169b), + regmap_reg_range(0x16a0, 0x16a2), + regmap_reg_range(0x16c0, 0x16c3), + regmap_reg_range(0x16d0, 0x16d4), + regmap_reg_range(0x16e0, 0x16ef), + regmap_reg_range(0x1800, 0x1804), + regmap_reg_range(0x1808, 0x180b), + regmap_reg_range(0x1810, 0x181f), + regmap_reg_range(0x1850, 0x1857), + regmap_reg_range(0x1860, 0x186b), + regmap_reg_range(0x1870, 0x188c), + regmap_reg_range(0x1890, 0x1890), + regmap_reg_range(0x1894, 0x18a0), + regmap_reg_range(0x18a0, 0x18ab), + regmap_reg_range(0x18c1, 0x18e7), + regmap_reg_range(0x1900, 0x1907), + regmap_reg_range(0x1914, 0x1920), + regmap_reg_range(0x1923, 0x1936), + regmap_reg_range(0x1938, 0x193d), + regmap_reg_range(0x1940, 0x1941), + regmap_reg_range(0x1944, 0x1953), + regmap_reg_range(0x1a00, 0x1a1b), + regmap_reg_range(0x1b00, 0x1b04), + regmap_reg_range(0x1b08, 0x1b13), + regmap_reg_range(0x1c00, 0x1c05), + regmap_reg_range(0x1c08, 0x1c1b), + + /* Port 2 */ + regmap_reg_range(0x2000, 0x2001), + regmap_reg_range(0x2004, 0x200b), + regmap_reg_range(0x201b, 0x201b), + regmap_reg_range(0x201f, 0x2021), + regmap_reg_range(0x2030, 0x2030), + regmap_reg_range(0x2040, 0x2040), + regmap_reg_range(0x2100, 0x211f), + regmap_reg_range(0x2200, 0x220b), + regmap_reg_range(0x2300, 0x2307), + regmap_reg_range(0x2400, 0x2405), + regmap_reg_range(0x2408, 0x2409), + regmap_reg_range(0x2410, 0x2417), + regmap_reg_range(0x2420, 0x2427), + regmap_reg_range(0x2500, 0x2507), + regmap_reg_range(0x2600, 0x2665), + regmap_reg_range(0x2668, 0x268f), + regmap_reg_range(0x2694, 0x269b), + regmap_reg_range(0x26a0, 0x26a2), + regmap_reg_range(0x26c0, 0x26c3), + regmap_reg_range(0x26d0, 0x26d4), + regmap_reg_range(0x26e0, 0x26ef), + regmap_reg_range(0x2800, 0x2804), + regmap_reg_range(0x2808, 0x280b), + regmap_reg_range(0x2810, 0x281f), + regmap_reg_range(0x2850, 0x2857), + regmap_reg_range(0x2860, 0x286b), + regmap_reg_range(0x2870, 0x288c), + regmap_reg_range(0x2890, 0x2890), + regmap_reg_range(0x2894, 0x28a0), + regmap_reg_range(0x28a0, 0x28ab), + regmap_reg_range(0x28c1, 0x28e7), + regmap_reg_range(0x2900, 0x2907), + regmap_reg_range(0x2914, 0x2920), + regmap_reg_range(0x2923, 0x2936), + regmap_reg_range(0x2938, 0x293d), + regmap_reg_range(0x2940, 0x2941), + regmap_reg_range(0x2944, 0x2953), + regmap_reg_range(0x2a00, 0x2a1b), + regmap_reg_range(0x2b00, 0x2b04), + regmap_reg_range(0x2b08, 0x2b13), + regmap_reg_range(0x2c00, 0x2c05), + regmap_reg_range(0x2c08, 0x2c1b), + + /* Port 3 */ + regmap_reg_range(0x3000, 0x3001), + regmap_reg_range(0x3004, 0x300b), + regmap_reg_range(0x301b, 0x301b), + regmap_reg_range(0x301f, 0x3021), + regmap_reg_range(0x3030, 0x3030), + regmap_reg_range(0x3040, 0x3040), + regmap_reg_range(0x3100, 0x311f), + regmap_reg_range(0x3200, 0x320b), + regmap_reg_range(0x3300, 0x3307), + regmap_reg_range(0x3400, 0x3405), + regmap_reg_range(0x3408, 0x3409), + regmap_reg_range(0x3410, 0x3417), + regmap_reg_range(0x3420, 0x3427), + regmap_reg_range(0x3500, 0x3507), + regmap_reg_range(0x3600, 0x3665), + regmap_reg_range(0x3668, 0x368f), + regmap_reg_range(0x3694, 0x369b), + regmap_reg_range(0x36a0, 0x36a2), + regmap_reg_range(0x36c0, 0x36c3), + regmap_reg_range(0x36d0, 0x36d4), + regmap_reg_range(0x36e0, 0x36ef), + regmap_reg_range(0x3800, 0x3804), + regmap_reg_range(0x3808, 0x380b), + regmap_reg_range(0x3810, 0x381f), + regmap_reg_range(0x3850, 0x3857), + regmap_reg_range(0x3860, 0x386b), + regmap_reg_range(0x3870, 0x388c), + regmap_reg_range(0x3890, 0x3890), + regmap_reg_range(0x3894, 0x38a0), + regmap_reg_range(0x38a0, 0x38ab), + regmap_reg_range(0x38c1, 0x38e7), + regmap_reg_range(0x3900, 0x3907), + regmap_reg_range(0x3914, 0x3920), + regmap_reg_range(0x3923, 0x3936), + regmap_reg_range(0x3938, 0x393d), + regmap_reg_range(0x3940, 0x3941), + regmap_reg_range(0x3944, 0x3953), + regmap_reg_range(0x3a00, 0x3a1b), + regmap_reg_range(0x3b00, 0x3b04), + regmap_reg_range(0x3b08, 0x3b13), + regmap_reg_range(0x3c00, 0x3c05), + regmap_reg_range(0x3c08, 0x3c1b), + + /* Port 4 */ + regmap_reg_range(0x4000, 0x4001), + regmap_reg_range(0x4004, 0x400b), + regmap_reg_range(0x401b, 0x401b), + regmap_reg_range(0x401f, 0x4021), + regmap_reg_range(0x4030, 0x4030), + regmap_reg_range(0x4040, 0x4040), + regmap_reg_range(0x4100, 0x411f), + regmap_reg_range(0x4200, 0x420b), + regmap_reg_range(0x4300, 0x4307), + regmap_reg_range(0x4400, 0x4405), + regmap_reg_range(0x4408, 0x4409), + regmap_reg_range(0x4410, 0x4417), + regmap_reg_range(0x4420, 0x4427), + regmap_reg_range(0x4500, 0x4507), + regmap_reg_range(0x4600, 0x4665), + regmap_reg_range(0x4668, 0x468f), + regmap_reg_range(0x4694, 0x469b), + regmap_reg_range(0x46a0, 0x46a2), + regmap_reg_range(0x46c0, 0x46c3), + regmap_reg_range(0x46d0, 0x46d4), + regmap_reg_range(0x46e0, 0x46ef), + regmap_reg_range(0x4800, 0x4804), + regmap_reg_range(0x4808, 0x480b), + regmap_reg_range(0x4810, 0x481f), + regmap_reg_range(0x4850, 0x4857), + regmap_reg_range(0x4860, 0x486b), + regmap_reg_range(0x4870, 0x488c), + regmap_reg_range(0x4890, 0x4890), + regmap_reg_range(0x4894, 0x48a0), + regmap_reg_range(0x48a0, 0x48ab), + regmap_reg_range(0x48c1, 0x48e7), + regmap_reg_range(0x4900, 0x4907), + regmap_reg_range(0x4914, 0x4920), + regmap_reg_range(0x4923, 0x4936), + regmap_reg_range(0x4938, 0x493d), + regmap_reg_range(0x4940, 0x4941), + regmap_reg_range(0x4944, 0x4953), + regmap_reg_range(0x4a00, 0x4a1b), + regmap_reg_range(0x4b00, 0x4b04), + regmap_reg_range(0x4b08, 0x4b13), + regmap_reg_range(0x4c00, 0x4c05), + regmap_reg_range(0x4c08, 0x4c1b), + + /* Port 5 */ + regmap_reg_range(0x5000, 0x5001), + regmap_reg_range(0x5004, 0x500b), + regmap_reg_range(0x501b, 0x501b), + regmap_reg_range(0x501f, 0x5021), + regmap_reg_range(0x5030, 0x5030), + regmap_reg_range(0x5040, 0x5040), + regmap_reg_range(0x5200, 0x520b), + regmap_reg_range(0x5300, 0x5307), + regmap_reg_range(0x5400, 0x5405), + regmap_reg_range(0x5408, 0x5409), + regmap_reg_range(0x5410, 0x5417), + regmap_reg_range(0x5420, 0x5427), + regmap_reg_range(0x5500, 0x5507), + regmap_reg_range(0x5600, 0x5665), + regmap_reg_range(0x5668, 0x568f), + regmap_reg_range(0x5694, 0x569b), + regmap_reg_range(0x56a0, 0x56a2), + regmap_reg_range(0x56c0, 0x56c3), + regmap_reg_range(0x56d0, 0x56d4), + regmap_reg_range(0x56e0, 0x56ef), + regmap_reg_range(0x5800, 0x5804), + regmap_reg_range(0x5808, 0x580b), + regmap_reg_range(0x5810, 0x581f), + regmap_reg_range(0x5850, 0x5857), + regmap_reg_range(0x5860, 0x586b), + regmap_reg_range(0x5870, 0x588c), + regmap_reg_range(0x5890, 0x5890), + regmap_reg_range(0x5894, 0x58a0), + regmap_reg_range(0x58a0, 0x58ab), + regmap_reg_range(0x58c1, 0x58e7), + regmap_reg_range(0x5900, 0x5907), + regmap_reg_range(0x5914, 0x5920), + regmap_reg_range(0x5923, 0x5936), + regmap_reg_range(0x5938, 0x593d), + regmap_reg_range(0x5940, 0x5941), + regmap_reg_range(0x5944, 0x5953), + regmap_reg_range(0x5a00, 0x5a1b), + regmap_reg_range(0x5b00, 0x5b04), + regmap_reg_range(0x5b08, 0x5b13), + regmap_reg_range(0x5c00, 0x5c05), + regmap_reg_range(0x5c08, 0x5c1b), +}; + +static const struct regmap_access_table lan9370_register_set = { + .yes_ranges = lan9370_valid_regs, + .n_yes_ranges = ARRAY_SIZE(lan9370_valid_regs), +}; + +static const struct regmap_range lan9371_valid_regs[] = { + regmap_reg_range(0x0000, 0x0003), + regmap_reg_range(0x0007, 0x0007), + regmap_reg_range(0x000f, 0x0027), + regmap_reg_range(0x0030, 0x0035), + regmap_reg_range(0x0050, 0x005f), + regmap_reg_range(0x0100, 0x011b), + regmap_reg_range(0x0120, 0x0123), + regmap_reg_range(0x0128, 0x0140), + regmap_reg_range(0x0142, 0x0159), + regmap_reg_range(0x0200, 0x0203), + regmap_reg_range(0x0210, 0x0217), + regmap_reg_range(0x0300, 0x0300), + regmap_reg_range(0x0302, 0x0307), + regmap_reg_range(0x030a, 0x0336), + regmap_reg_range(0x0338, 0x033b), + regmap_reg_range(0x033e, 0x033e), + regmap_reg_range(0x0340, 0x0367), + regmap_reg_range(0x0370, 0x0370), + regmap_reg_range(0x0374, 0x0378), + regmap_reg_range(0x037c, 0x037d), + regmap_reg_range(0x0380, 0x0383), + regmap_reg_range(0x0390, 0x039b), + regmap_reg_range(0x03a4, 0x03b7), + regmap_reg_range(0x03e0, 0x03e3), + regmap_reg_range(0x03e8, 0x03eb), + regmap_reg_range(0x0400, 0x040e), + regmap_reg_range(0x0410, 0x0437), + regmap_reg_range(0x0440, 0x046f), + regmap_reg_range(0x0500, 0x054b), + regmap_reg_range(0x0550, 0x05b7), + regmap_reg_range(0x0640, 0x0645), + regmap_reg_range(0x0648, 0x064d), + regmap_reg_range(0x0650, 0x0655), + regmap_reg_range(0x0700, 0x07ff), + regmap_reg_range(0x0800, 0x088b), + regmap_reg_range(0x0900, 0x09ff), + + /* Port 1 */ + regmap_reg_range(0x1000, 0x1001), + regmap_reg_range(0x1004, 0x100b), + regmap_reg_range(0x101b, 0x101b), + regmap_reg_range(0x101f, 0x1021), + regmap_reg_range(0x1030, 0x1030), + regmap_reg_range(0x1040, 0x1040), + regmap_reg_range(0x1100, 0x111f), + regmap_reg_range(0x1200, 0x120b), + regmap_reg_range(0x1300, 0x1307), + regmap_reg_range(0x1400, 0x1405), + regmap_reg_range(0x1408, 0x1409), + regmap_reg_range(0x1410, 0x1417), + regmap_reg_range(0x1420, 0x1427), + regmap_reg_range(0x1500, 0x1507), + regmap_reg_range(0x1600, 0x1665), + regmap_reg_range(0x1668, 0x168f), + regmap_reg_range(0x1694, 0x169b), + regmap_reg_range(0x16a0, 0x16a2), + regmap_reg_range(0x16c0, 0x16c3), + regmap_reg_range(0x16d0, 0x16d4), + regmap_reg_range(0x16e0, 0x16ef), + regmap_reg_range(0x1800, 0x1804), + regmap_reg_range(0x1808, 0x180b), + regmap_reg_range(0x1810, 0x181f), + regmap_reg_range(0x1850, 0x1857), + regmap_reg_range(0x1860, 0x186b), + regmap_reg_range(0x1870, 0x188c), + regmap_reg_range(0x1890, 0x1890), + regmap_reg_range(0x1894, 0x18a0), + regmap_reg_range(0x18a0, 0x18ab), + regmap_reg_range(0x18c1, 0x18e7), + regmap_reg_range(0x1900, 0x1907), + regmap_reg_range(0x1914, 0x1920), + regmap_reg_range(0x1923, 0x1936), + regmap_reg_range(0x1938, 0x193d), + regmap_reg_range(0x1940, 0x1941), + regmap_reg_range(0x1944, 0x1953), + regmap_reg_range(0x1a00, 0x1a1b), + regmap_reg_range(0x1b00, 0x1b04), + regmap_reg_range(0x1b08, 0x1b13), + regmap_reg_range(0x1c00, 0x1c05), + regmap_reg_range(0x1c08, 0x1c1b), + + /* Port 2 */ + regmap_reg_range(0x2000, 0x2001), + regmap_reg_range(0x2004, 0x200b), + regmap_reg_range(0x201b, 0x201b), + regmap_reg_range(0x201f, 0x2021), + regmap_reg_range(0x2030, 0x2030), + regmap_reg_range(0x2040, 0x2040), + regmap_reg_range(0x2100, 0x211f), + regmap_reg_range(0x2200, 0x220b), + regmap_reg_range(0x2300, 0x2307), + regmap_reg_range(0x2400, 0x2405), + regmap_reg_range(0x2408, 0x2409), + regmap_reg_range(0x2410, 0x2417), + regmap_reg_range(0x2420, 0x2427), + regmap_reg_range(0x2500, 0x2507), + regmap_reg_range(0x2600, 0x2665), + regmap_reg_range(0x2668, 0x268f), + regmap_reg_range(0x2694, 0x269b), + regmap_reg_range(0x26a0, 0x26a2), + regmap_reg_range(0x26c0, 0x26c3), + regmap_reg_range(0x26d0, 0x26d4), + regmap_reg_range(0x26e0, 0x26ef), + regmap_reg_range(0x2800, 0x2804), + regmap_reg_range(0x2808, 0x280b), + regmap_reg_range(0x2810, 0x281f), + regmap_reg_range(0x2850, 0x2857), + regmap_reg_range(0x2860, 0x286b), + regmap_reg_range(0x2870, 0x288c), + regmap_reg_range(0x2890, 0x2890), + regmap_reg_range(0x2894, 0x28a0), + regmap_reg_range(0x28a0, 0x28ab), + regmap_reg_range(0x28c1, 0x28e7), + regmap_reg_range(0x2900, 0x2907), + regmap_reg_range(0x2914, 0x2920), + regmap_reg_range(0x2923, 0x2936), + regmap_reg_range(0x2938, 0x293d), + regmap_reg_range(0x2940, 0x2941), + regmap_reg_range(0x2944, 0x2953), + regmap_reg_range(0x2a00, 0x2a1b), + regmap_reg_range(0x2b00, 0x2b04), + regmap_reg_range(0x2b08, 0x2b13), + regmap_reg_range(0x2c00, 0x2c05), + regmap_reg_range(0x2c08, 0x2c1b), + + /* Port 3 */ + regmap_reg_range(0x3000, 0x3001), + regmap_reg_range(0x3004, 0x300b), + regmap_reg_range(0x301b, 0x301b), + regmap_reg_range(0x301f, 0x3021), + regmap_reg_range(0x3030, 0x3030), + regmap_reg_range(0x3040, 0x3040), + regmap_reg_range(0x3100, 0x311f), + regmap_reg_range(0x3200, 0x320b), + regmap_reg_range(0x3300, 0x3307), + regmap_reg_range(0x3400, 0x3405), + regmap_reg_range(0x3408, 0x3409), + regmap_reg_range(0x3410, 0x3417), + regmap_reg_range(0x3420, 0x3427), + regmap_reg_range(0x3500, 0x3507), + regmap_reg_range(0x3600, 0x3665), + regmap_reg_range(0x3668, 0x368f), + regmap_reg_range(0x3694, 0x369b), + regmap_reg_range(0x36a0, 0x36a2), + regmap_reg_range(0x36c0, 0x36c3), + regmap_reg_range(0x36d0, 0x36d4), + regmap_reg_range(0x36e0, 0x36ef), + regmap_reg_range(0x3800, 0x3804), + regmap_reg_range(0x3808, 0x380b), + regmap_reg_range(0x3810, 0x381f), + regmap_reg_range(0x3850, 0x3857), + regmap_reg_range(0x3860, 0x386b), + regmap_reg_range(0x3870, 0x388c), + regmap_reg_range(0x3890, 0x3890), + regmap_reg_range(0x3894, 0x38a0), + regmap_reg_range(0x38a0, 0x38ab), + regmap_reg_range(0x38c1, 0x38e7), + regmap_reg_range(0x3900, 0x3907), + regmap_reg_range(0x3914, 0x3920), + regmap_reg_range(0x3923, 0x3936), + regmap_reg_range(0x3938, 0x393d), + regmap_reg_range(0x3940, 0x3941), + regmap_reg_range(0x3944, 0x3953), + regmap_reg_range(0x3a00, 0x3a1b), + regmap_reg_range(0x3b00, 0x3b04), + regmap_reg_range(0x3b08, 0x3b13), + regmap_reg_range(0x3c00, 0x3c05), + regmap_reg_range(0x3c08, 0x3c1b), + + /* Port 4 */ + regmap_reg_range(0x4000, 0x4001), + regmap_reg_range(0x4004, 0x400b), + regmap_reg_range(0x401b, 0x401b), + regmap_reg_range(0x401f, 0x4021), + regmap_reg_range(0x4030, 0x4030), + regmap_reg_range(0x4040, 0x4040), + regmap_reg_range(0x4200, 0x420b), + regmap_reg_range(0x4280, 0x42ff), + regmap_reg_range(0x4300, 0x4307), + regmap_reg_range(0x4400, 0x4405), + regmap_reg_range(0x4408, 0x4409), + regmap_reg_range(0x4410, 0x4417), + regmap_reg_range(0x4420, 0x4427), + regmap_reg_range(0x4500, 0x4507), + regmap_reg_range(0x4600, 0x4665), + regmap_reg_range(0x4668, 0x468f), + regmap_reg_range(0x4694, 0x469b), + regmap_reg_range(0x46a0, 0x46a2), + regmap_reg_range(0x46c0, 0x46c3), + regmap_reg_range(0x46d0, 0x46d4), + regmap_reg_range(0x46e0, 0x46ef), + regmap_reg_range(0x4800, 0x4804), + regmap_reg_range(0x4808, 0x480b), + regmap_reg_range(0x4810, 0x481f), + regmap_reg_range(0x4850, 0x4857), + regmap_reg_range(0x4860, 0x486b), + regmap_reg_range(0x4870, 0x488c), + regmap_reg_range(0x4890, 0x4890), + regmap_reg_range(0x4894, 0x48a0), + regmap_reg_range(0x48a0, 0x48ab), + regmap_reg_range(0x48c1, 0x48e7), + regmap_reg_range(0x4900, 0x4907), + regmap_reg_range(0x4914, 0x4920), + regmap_reg_range(0x4923, 0x4936), + regmap_reg_range(0x4938, 0x493d), + regmap_reg_range(0x4940, 0x4941), + regmap_reg_range(0x4944, 0x4953), + regmap_reg_range(0x4a00, 0x4a1b), + regmap_reg_range(0x4b00, 0x4b04), + regmap_reg_range(0x4b08, 0x4b13), + regmap_reg_range(0x4c00, 0x4c05), + regmap_reg_range(0x4c08, 0x4c1b), + + /* Port 5 */ + regmap_reg_range(0x5000, 0x5001), + regmap_reg_range(0x5004, 0x500b), + regmap_reg_range(0x501b, 0x501b), + regmap_reg_range(0x501f, 0x5021), + regmap_reg_range(0x5030, 0x5030), + regmap_reg_range(0x5040, 0x5040), + regmap_reg_range(0x5200, 0x520b), + regmap_reg_range(0x5300, 0x5307), + regmap_reg_range(0x5400, 0x5405), + regmap_reg_range(0x5408, 0x5409), + regmap_reg_range(0x5410, 0x5417), + regmap_reg_range(0x5420, 0x5427), + regmap_reg_range(0x5500, 0x5507), + regmap_reg_range(0x5600, 0x5665), + regmap_reg_range(0x5668, 0x568f), + regmap_reg_range(0x5694, 0x569b), + regmap_reg_range(0x56a0, 0x56a2), + regmap_reg_range(0x56c0, 0x56c3), + regmap_reg_range(0x56d0, 0x56d4), + regmap_reg_range(0x56e0, 0x56ef), + regmap_reg_range(0x5800, 0x5804), + regmap_reg_range(0x5808, 0x580b), + regmap_reg_range(0x5810, 0x581f), + regmap_reg_range(0x5850, 0x5857), + regmap_reg_range(0x5860, 0x586b), + regmap_reg_range(0x5870, 0x588c), + regmap_reg_range(0x5890, 0x5890), + regmap_reg_range(0x5894, 0x58a0), + regmap_reg_range(0x58a0, 0x58ab), + regmap_reg_range(0x58c1, 0x58e7), + regmap_reg_range(0x5900, 0x5907), + regmap_reg_range(0x5914, 0x5920), + regmap_reg_range(0x5923, 0x5936), + regmap_reg_range(0x5938, 0x593d), + regmap_reg_range(0x5940, 0x5941), + regmap_reg_range(0x5944, 0x5953), + regmap_reg_range(0x5a00, 0x5a1b), + regmap_reg_range(0x5b00, 0x5b04), + regmap_reg_range(0x5b08, 0x5b13), + regmap_reg_range(0x5c00, 0x5c05), + regmap_reg_range(0x5c08, 0x5c1b), + + /* Port 6 */ + regmap_reg_range(0x6000, 0x6001), + regmap_reg_range(0x6004, 0x600b), + regmap_reg_range(0x601b, 0x601b), + regmap_reg_range(0x601f, 0x6021), + regmap_reg_range(0x6030, 0x6030), + regmap_reg_range(0x6040, 0x6040), + regmap_reg_range(0x6200, 0x620b), + regmap_reg_range(0x6300, 0x6307), + regmap_reg_range(0x6400, 0x6405), + regmap_reg_range(0x6408, 0x6409), + regmap_reg_range(0x6410, 0x6417), + regmap_reg_range(0x6420, 0x6427), + regmap_reg_range(0x6500, 0x6507), + regmap_reg_range(0x6600, 0x6665), + regmap_reg_range(0x6668, 0x668f), + regmap_reg_range(0x6694, 0x669b), + regmap_reg_range(0x66a0, 0x66a2), + regmap_reg_range(0x66c0, 0x66c3), + regmap_reg_range(0x66d0, 0x66d4), + regmap_reg_range(0x66e0, 0x66ef), + regmap_reg_range(0x6800, 0x6804), + regmap_reg_range(0x6808, 0x680b), + regmap_reg_range(0x6810, 0x681f), + regmap_reg_range(0x6850, 0x6857), + regmap_reg_range(0x6860, 0x686b), + regmap_reg_range(0x6870, 0x688c), + regmap_reg_range(0x6890, 0x6890), + regmap_reg_range(0x6894, 0x68a0), + regmap_reg_range(0x68a0, 0x68ab), + regmap_reg_range(0x68c1, 0x68e7), + regmap_reg_range(0x6900, 0x6907), + regmap_reg_range(0x6914, 0x6920), + regmap_reg_range(0x6923, 0x6936), + regmap_reg_range(0x6938, 0x693d), + regmap_reg_range(0x6940, 0x6941), + regmap_reg_range(0x6944, 0x6953), + regmap_reg_range(0x6a00, 0x6a1b), + regmap_reg_range(0x6b00, 0x6b04), + regmap_reg_range(0x6b08, 0x6b13), + regmap_reg_range(0x6c00, 0x6c05), + regmap_reg_range(0x6c08, 0x6c1b), +}; + +static const struct regmap_access_table lan9371_register_set = { + .yes_ranges = lan9371_valid_regs, + .n_yes_ranges = ARRAY_SIZE(lan9371_valid_regs), +}; + +static const struct regmap_range lan9372_valid_regs[] = { + regmap_reg_range(0x0000, 0x0003), + regmap_reg_range(0x0007, 0x0007), + regmap_reg_range(0x000f, 0x0027), + regmap_reg_range(0x0030, 0x0035), + regmap_reg_range(0x0050, 0x005f), + regmap_reg_range(0x0100, 0x011b), + regmap_reg_range(0x0120, 0x0123), + regmap_reg_range(0x0128, 0x0140), + regmap_reg_range(0x0142, 0x0159), + regmap_reg_range(0x0200, 0x0203), + regmap_reg_range(0x0210, 0x0217), + regmap_reg_range(0x0300, 0x0300), + regmap_reg_range(0x0302, 0x0307), + regmap_reg_range(0x030a, 0x0336), + regmap_reg_range(0x0338, 0x033b), + regmap_reg_range(0x033e, 0x033e), + regmap_reg_range(0x0340, 0x0367), + regmap_reg_range(0x0370, 0x0370), + regmap_reg_range(0x0374, 0x0378), + regmap_reg_range(0x037c, 0x037d), + regmap_reg_range(0x0380, 0x0383), + regmap_reg_range(0x0390, 0x039b), + regmap_reg_range(0x03a4, 0x03b7), + regmap_reg_range(0x03e0, 0x03e3), + regmap_reg_range(0x03e8, 0x03eb), + regmap_reg_range(0x0400, 0x040e), + regmap_reg_range(0x0410, 0x0437), + regmap_reg_range(0x0440, 0x046f), + regmap_reg_range(0x0500, 0x054b), + regmap_reg_range(0x0550, 0x05b7), + regmap_reg_range(0x0640, 0x0645), + regmap_reg_range(0x0648, 0x064d), + regmap_reg_range(0x0650, 0x0655), + regmap_reg_range(0x0700, 0x07ff), + regmap_reg_range(0x0800, 0x088b), + regmap_reg_range(0x0900, 0x09ff), + + /* Port 1 */ + regmap_reg_range(0x1000, 0x1001), + regmap_reg_range(0x1004, 0x100b), + regmap_reg_range(0x101b, 0x101b), + regmap_reg_range(0x101f, 0x1021), + regmap_reg_range(0x1030, 0x1030), + regmap_reg_range(0x1040, 0x1040), + regmap_reg_range(0x1100, 0x111f), + regmap_reg_range(0x1200, 0x120b), + regmap_reg_range(0x1300, 0x1307), + regmap_reg_range(0x1400, 0x1405), + regmap_reg_range(0x1408, 0x1409), + regmap_reg_range(0x1410, 0x1417), + regmap_reg_range(0x1420, 0x1427), + regmap_reg_range(0x1500, 0x1507), + regmap_reg_range(0x1600, 0x1665), + regmap_reg_range(0x1668, 0x168f), + regmap_reg_range(0x1694, 0x169b), + regmap_reg_range(0x16a0, 0x16a2), + regmap_reg_range(0x16c0, 0x16c3), + regmap_reg_range(0x16d0, 0x16d4), + regmap_reg_range(0x16e0, 0x16ef), + regmap_reg_range(0x1800, 0x1804), + regmap_reg_range(0x1808, 0x180b), + regmap_reg_range(0x1810, 0x181f), + regmap_reg_range(0x1850, 0x1857), + regmap_reg_range(0x1860, 0x186b), + regmap_reg_range(0x1870, 0x188c), + regmap_reg_range(0x1890, 0x1890), + regmap_reg_range(0x1894, 0x18a0), + regmap_reg_range(0x18a0, 0x18ab), + regmap_reg_range(0x18c1, 0x18e7), + regmap_reg_range(0x1900, 0x1907), + regmap_reg_range(0x1914, 0x1920), + regmap_reg_range(0x1923, 0x1936), + regmap_reg_range(0x1938, 0x193d), + regmap_reg_range(0x1940, 0x1941), + regmap_reg_range(0x1944, 0x1953), + regmap_reg_range(0x1a00, 0x1a1b), + regmap_reg_range(0x1b00, 0x1b04), + regmap_reg_range(0x1b08, 0x1b13), + regmap_reg_range(0x1c00, 0x1c05), + regmap_reg_range(0x1c08, 0x1c1b), + + /* Port 2 */ + regmap_reg_range(0x2000, 0x2001), + regmap_reg_range(0x2004, 0x200b), + regmap_reg_range(0x201b, 0x201b), + regmap_reg_range(0x201f, 0x2021), + regmap_reg_range(0x2030, 0x2030), + regmap_reg_range(0x2040, 0x2040), + regmap_reg_range(0x2100, 0x211f), + regmap_reg_range(0x2200, 0x220b), + regmap_reg_range(0x2300, 0x2307), + regmap_reg_range(0x2400, 0x2405), + regmap_reg_range(0x2408, 0x2409), + regmap_reg_range(0x2410, 0x2417), + regmap_reg_range(0x2420, 0x2427), + regmap_reg_range(0x2500, 0x2507), + regmap_reg_range(0x2600, 0x2665), + regmap_reg_range(0x2668, 0x268f), + regmap_reg_range(0x2694, 0x269b), + regmap_reg_range(0x26a0, 0x26a2), + regmap_reg_range(0x26c0, 0x26c3), + regmap_reg_range(0x26d0, 0x26d4), + regmap_reg_range(0x26e0, 0x26ef), + regmap_reg_range(0x2800, 0x2804), + regmap_reg_range(0x2808, 0x280b), + regmap_reg_range(0x2810, 0x281f), + regmap_reg_range(0x2850, 0x2857), + regmap_reg_range(0x2860, 0x286b), + regmap_reg_range(0x2870, 0x288c), + regmap_reg_range(0x2890, 0x2890), + regmap_reg_range(0x2894, 0x28a0), + regmap_reg_range(0x28a0, 0x28ab), + regmap_reg_range(0x28c1, 0x28e7), + regmap_reg_range(0x2900, 0x2907), + regmap_reg_range(0x2914, 0x2920), + regmap_reg_range(0x2923, 0x2936), + regmap_reg_range(0x2938, 0x293d), + regmap_reg_range(0x2940, 0x2941), + regmap_reg_range(0x2944, 0x2953), + regmap_reg_range(0x2a00, 0x2a1b), + regmap_reg_range(0x2b00, 0x2b04), + regmap_reg_range(0x2b08, 0x2b13), + regmap_reg_range(0x2c00, 0x2c05), + regmap_reg_range(0x2c08, 0x2c1b), + + /* Port 3 */ + regmap_reg_range(0x3000, 0x3001), + regmap_reg_range(0x3004, 0x300b), + regmap_reg_range(0x301b, 0x301b), + regmap_reg_range(0x301f, 0x3021), + regmap_reg_range(0x3030, 0x3030), + regmap_reg_range(0x3040, 0x3040), + regmap_reg_range(0x3100, 0x311f), + regmap_reg_range(0x3200, 0x320b), + regmap_reg_range(0x3300, 0x3307), + regmap_reg_range(0x3400, 0x3405), + regmap_reg_range(0x3408, 0x3409), + regmap_reg_range(0x3410, 0x3417), + regmap_reg_range(0x3420, 0x3427), + regmap_reg_range(0x3500, 0x3507), + regmap_reg_range(0x3600, 0x3665), + regmap_reg_range(0x3668, 0x368f), + regmap_reg_range(0x3694, 0x369b), + regmap_reg_range(0x36a0, 0x36a2), + regmap_reg_range(0x36c0, 0x36c3), + regmap_reg_range(0x36d0, 0x36d4), + regmap_reg_range(0x36e0, 0x36ef), + regmap_reg_range(0x3800, 0x3804), + regmap_reg_range(0x3808, 0x380b), + regmap_reg_range(0x3810, 0x381f), + regmap_reg_range(0x3850, 0x3857), + regmap_reg_range(0x3860, 0x386b), + regmap_reg_range(0x3870, 0x388c), + regmap_reg_range(0x3890, 0x3890), + regmap_reg_range(0x3894, 0x38a0), + regmap_reg_range(0x38a0, 0x38ab), + regmap_reg_range(0x38c1, 0x38e7), + regmap_reg_range(0x3900, 0x3907), + regmap_reg_range(0x3914, 0x3920), + regmap_reg_range(0x3923, 0x3936), + regmap_reg_range(0x3938, 0x393d), + regmap_reg_range(0x3940, 0x3941), + regmap_reg_range(0x3944, 0x3953), + regmap_reg_range(0x3a00, 0x3a1b), + regmap_reg_range(0x3b00, 0x3b04), + regmap_reg_range(0x3b08, 0x3b13), + regmap_reg_range(0x3c00, 0x3c05), + regmap_reg_range(0x3c08, 0x3c1b), + + /* Port 4 */ + regmap_reg_range(0x4000, 0x4001), + regmap_reg_range(0x4004, 0x400b), + regmap_reg_range(0x401b, 0x401b), + regmap_reg_range(0x401f, 0x4021), + regmap_reg_range(0x4030, 0x4030), + regmap_reg_range(0x4040, 0x4040), + regmap_reg_range(0x4200, 0x420b), + regmap_reg_range(0x4280, 0x42ff), + regmap_reg_range(0x4300, 0x4307), + regmap_reg_range(0x4400, 0x4405), + regmap_reg_range(0x4408, 0x4409), + regmap_reg_range(0x4410, 0x4417), + regmap_reg_range(0x4420, 0x4427), + regmap_reg_range(0x4500, 0x4507), + regmap_reg_range(0x4600, 0x4665), + regmap_reg_range(0x4668, 0x468f), + regmap_reg_range(0x4694, 0x469b), + regmap_reg_range(0x46a0, 0x46a2), + regmap_reg_range(0x46c0, 0x46c3), + regmap_reg_range(0x46d0, 0x46d4), + regmap_reg_range(0x46e0, 0x46ef), + regmap_reg_range(0x4800, 0x4804), + regmap_reg_range(0x4808, 0x480b), + regmap_reg_range(0x4810, 0x481f), + regmap_reg_range(0x4850, 0x4857), + regmap_reg_range(0x4860, 0x486b), + regmap_reg_range(0x4870, 0x488c), + regmap_reg_range(0x4890, 0x4890), + regmap_reg_range(0x4894, 0x48a0), + regmap_reg_range(0x48a0, 0x48ab), + regmap_reg_range(0x48c1, 0x48e7), + regmap_reg_range(0x4900, 0x4907), + regmap_reg_range(0x4914, 0x4920), + regmap_reg_range(0x4923, 0x4936), + regmap_reg_range(0x4938, 0x493d), + regmap_reg_range(0x4940, 0x4941), + regmap_reg_range(0x4944, 0x4953), + regmap_reg_range(0x4a00, 0x4a1b), + regmap_reg_range(0x4b00, 0x4b04), + regmap_reg_range(0x4b08, 0x4b13), + regmap_reg_range(0x4c00, 0x4c05), + regmap_reg_range(0x4c08, 0x4c1b), + + /* Port 5 */ + regmap_reg_range(0x5000, 0x5001), + regmap_reg_range(0x5004, 0x500b), + regmap_reg_range(0x501b, 0x501b), + regmap_reg_range(0x501f, 0x5021), + regmap_reg_range(0x5030, 0x5030), + regmap_reg_range(0x5040, 0x5040), + regmap_reg_range(0x5200, 0x520b), + regmap_reg_range(0x5300, 0x5307), + regmap_reg_range(0x5400, 0x5405), + regmap_reg_range(0x5408, 0x5409), + regmap_reg_range(0x5410, 0x5417), + regmap_reg_range(0x5420, 0x5427), + regmap_reg_range(0x5500, 0x5507), + regmap_reg_range(0x5600, 0x5665), + regmap_reg_range(0x5668, 0x568f), + regmap_reg_range(0x5694, 0x569b), + regmap_reg_range(0x56a0, 0x56a2), + regmap_reg_range(0x56c0, 0x56c3), + regmap_reg_range(0x56d0, 0x56d4), + regmap_reg_range(0x56e0, 0x56ef), + regmap_reg_range(0x5800, 0x5804), + regmap_reg_range(0x5808, 0x580b), + regmap_reg_range(0x5810, 0x581f), + regmap_reg_range(0x5850, 0x5857), + regmap_reg_range(0x5860, 0x586b), + regmap_reg_range(0x5870, 0x588c), + regmap_reg_range(0x5890, 0x5890), + regmap_reg_range(0x5894, 0x58a0), + regmap_reg_range(0x58a0, 0x58ab), + regmap_reg_range(0x58c1, 0x58e7), + regmap_reg_range(0x5900, 0x5907), + regmap_reg_range(0x5914, 0x5920), + regmap_reg_range(0x5923, 0x5936), + regmap_reg_range(0x5938, 0x593d), + regmap_reg_range(0x5940, 0x5941), + regmap_reg_range(0x5944, 0x5953), + regmap_reg_range(0x5a00, 0x5a1b), + regmap_reg_range(0x5b00, 0x5b04), + regmap_reg_range(0x5b08, 0x5b13), + regmap_reg_range(0x5c00, 0x5c05), + regmap_reg_range(0x5c08, 0x5c1b), + + /* Port 6 */ + regmap_reg_range(0x6000, 0x6001), + regmap_reg_range(0x6004, 0x600b), + regmap_reg_range(0x601b, 0x601b), + regmap_reg_range(0x601f, 0x6021), + regmap_reg_range(0x6030, 0x6030), + regmap_reg_range(0x6040, 0x6040), + regmap_reg_range(0x6200, 0x620b), + regmap_reg_range(0x6300, 0x6307), + regmap_reg_range(0x6400, 0x6405), + regmap_reg_range(0x6408, 0x6409), + regmap_reg_range(0x6410, 0x6417), + regmap_reg_range(0x6420, 0x6427), + regmap_reg_range(0x6500, 0x6507), + regmap_reg_range(0x6600, 0x6665), + regmap_reg_range(0x6668, 0x668f), + regmap_reg_range(0x6694, 0x669b), + regmap_reg_range(0x66a0, 0x66a2), + regmap_reg_range(0x66c0, 0x66c3), + regmap_reg_range(0x66d0, 0x66d4), + regmap_reg_range(0x66e0, 0x66ef), + regmap_reg_range(0x6800, 0x6804), + regmap_reg_range(0x6808, 0x680b), + regmap_reg_range(0x6810, 0x681f), + regmap_reg_range(0x6850, 0x6857), + regmap_reg_range(0x6860, 0x686b), + regmap_reg_range(0x6870, 0x688c), + regmap_reg_range(0x6890, 0x6890), + regmap_reg_range(0x6894, 0x68a0), + regmap_reg_range(0x68a0, 0x68ab), + regmap_reg_range(0x68c1, 0x68e7), + regmap_reg_range(0x6900, 0x6907), + regmap_reg_range(0x6914, 0x6920), + regmap_reg_range(0x6923, 0x6936), + regmap_reg_range(0x6938, 0x693d), + regmap_reg_range(0x6940, 0x6941), + regmap_reg_range(0x6944, 0x6953), + regmap_reg_range(0x6a00, 0x6a1b), + regmap_reg_range(0x6b00, 0x6b04), + regmap_reg_range(0x6b08, 0x6b13), + regmap_reg_range(0x6c00, 0x6c05), + regmap_reg_range(0x6c08, 0x6c1b), + + /* Port 7 */ + regmap_reg_range(0x7000, 0x7001), + regmap_reg_range(0x7004, 0x700b), + regmap_reg_range(0x701b, 0x701b), + regmap_reg_range(0x701f, 0x7021), + regmap_reg_range(0x7030, 0x7030), + regmap_reg_range(0x7040, 0x7040), + regmap_reg_range(0x7100, 0x711f), + regmap_reg_range(0x7200, 0x720b), + regmap_reg_range(0x7300, 0x7307), + regmap_reg_range(0x7400, 0x7405), + regmap_reg_range(0x7408, 0x7409), + regmap_reg_range(0x7410, 0x7417), + regmap_reg_range(0x7420, 0x7427), + regmap_reg_range(0x7500, 0x7507), + regmap_reg_range(0x7600, 0x7665), + regmap_reg_range(0x7668, 0x768f), + regmap_reg_range(0x7694, 0x769b), + regmap_reg_range(0x76a0, 0x76a2), + regmap_reg_range(0x76c0, 0x76c3), + regmap_reg_range(0x76d0, 0x76d4), + regmap_reg_range(0x76e0, 0x76ef), + regmap_reg_range(0x7800, 0x7804), + regmap_reg_range(0x7808, 0x780b), + regmap_reg_range(0x7810, 0x781f), + regmap_reg_range(0x7850, 0x7857), + regmap_reg_range(0x7860, 0x786b), + regmap_reg_range(0x7870, 0x788c), + regmap_reg_range(0x7890, 0x7890), + regmap_reg_range(0x7894, 0x78a0), + regmap_reg_range(0x78a0, 0x78ab), + regmap_reg_range(0x78c1, 0x78e7), + regmap_reg_range(0x7900, 0x7907), + regmap_reg_range(0x7914, 0x7920), + regmap_reg_range(0x7923, 0x7936), + regmap_reg_range(0x7938, 0x793d), + regmap_reg_range(0x7940, 0x7941), + regmap_reg_range(0x7944, 0x7953), + regmap_reg_range(0x7a00, 0x7a1b), + regmap_reg_range(0x7b00, 0x7b04), + regmap_reg_range(0x7b08, 0x7b13), + regmap_reg_range(0x7c00, 0x7c05), + regmap_reg_range(0x7c08, 0x7c1b), + + /* Port 8 */ + regmap_reg_range(0x8000, 0x8001), + regmap_reg_range(0x8004, 0x800b), + regmap_reg_range(0x801b, 0x801b), + regmap_reg_range(0x801f, 0x8021), + regmap_reg_range(0x8030, 0x8030), + regmap_reg_range(0x8040, 0x8040), + regmap_reg_range(0x8100, 0x811f), + regmap_reg_range(0x8200, 0x820b), + regmap_reg_range(0x8300, 0x8307), + regmap_reg_range(0x8400, 0x8405), + regmap_reg_range(0x8408, 0x8409), + regmap_reg_range(0x8410, 0x8417), + regmap_reg_range(0x8420, 0x8427), + regmap_reg_range(0x8500, 0x8507), + regmap_reg_range(0x8600, 0x8665), + regmap_reg_range(0x8668, 0x868f), + regmap_reg_range(0x8694, 0x869b), + regmap_reg_range(0x86a0, 0x86a2), + regmap_reg_range(0x86c0, 0x86c3), + regmap_reg_range(0x86d0, 0x86d4), + regmap_reg_range(0x86e0, 0x86ef), + regmap_reg_range(0x8800, 0x8804), + regmap_reg_range(0x8808, 0x880b), + regmap_reg_range(0x8810, 0x881f), + regmap_reg_range(0x8850, 0x8857), + regmap_reg_range(0x8860, 0x886b), + regmap_reg_range(0x8870, 0x888c), + regmap_reg_range(0x8890, 0x8890), + regmap_reg_range(0x8894, 0x88a0), + regmap_reg_range(0x88a0, 0x88ab), + regmap_reg_range(0x88c1, 0x88e7), + regmap_reg_range(0x8900, 0x8907), + regmap_reg_range(0x8914, 0x8920), + regmap_reg_range(0x8923, 0x8936), + regmap_reg_range(0x8938, 0x893d), + regmap_reg_range(0x8940, 0x8941), + regmap_reg_range(0x8944, 0x8953), + regmap_reg_range(0x8a00, 0x8a1b), + regmap_reg_range(0x8b00, 0x8b04), + regmap_reg_range(0x8b08, 0x8b13), + regmap_reg_range(0x8c00, 0x8c05), + regmap_reg_range(0x8c08, 0x8c1b), +}; + +static const struct regmap_access_table lan9372_register_set = { + .yes_ranges = lan9372_valid_regs, + .n_yes_ranges = ARRAY_SIZE(lan9372_valid_regs), +}; + +static const struct regmap_range lan9373_valid_regs[] = { + regmap_reg_range(0x0000, 0x0003), + regmap_reg_range(0x0007, 0x0007), + regmap_reg_range(0x000f, 0x0027), + regmap_reg_range(0x0030, 0x0035), + regmap_reg_range(0x0050, 0x005f), + regmap_reg_range(0x0100, 0x011b), + regmap_reg_range(0x0120, 0x0123), + regmap_reg_range(0x0128, 0x0140), + regmap_reg_range(0x0142, 0x0159), + regmap_reg_range(0x0200, 0x0203), + regmap_reg_range(0x0210, 0x0217), + regmap_reg_range(0x0300, 0x0300), + regmap_reg_range(0x0302, 0x0307), + regmap_reg_range(0x030a, 0x0336), + regmap_reg_range(0x0338, 0x033b), + regmap_reg_range(0x033e, 0x033e), + regmap_reg_range(0x0340, 0x0367), + regmap_reg_range(0x0370, 0x0370), + regmap_reg_range(0x0374, 0x0378), + regmap_reg_range(0x037c, 0x037d), + regmap_reg_range(0x0380, 0x0383), + regmap_reg_range(0x0390, 0x039b), + regmap_reg_range(0x03a4, 0x03b7), + regmap_reg_range(0x03e0, 0x03e3), + regmap_reg_range(0x03e8, 0x03eb), + regmap_reg_range(0x0400, 0x040e), + regmap_reg_range(0x0410, 0x0437), + regmap_reg_range(0x0440, 0x046f), + regmap_reg_range(0x0500, 0x054b), + regmap_reg_range(0x0550, 0x05b7), + regmap_reg_range(0x0640, 0x0645), + regmap_reg_range(0x0648, 0x064d), + regmap_reg_range(0x0650, 0x0655), + regmap_reg_range(0x0700, 0x07ff), + regmap_reg_range(0x0800, 0x088b), + regmap_reg_range(0x0900, 0x09ff), + + /* Port 1 */ + regmap_reg_range(0x1000, 0x1001), + regmap_reg_range(0x1004, 0x100b), + regmap_reg_range(0x101b, 0x101b), + regmap_reg_range(0x101f, 0x1021), + regmap_reg_range(0x1030, 0x1030), + regmap_reg_range(0x1040, 0x1040), + regmap_reg_range(0x1100, 0x111f), + regmap_reg_range(0x1200, 0x120b), + regmap_reg_range(0x1300, 0x1307), + regmap_reg_range(0x1400, 0x1405), + regmap_reg_range(0x1408, 0x1409), + regmap_reg_range(0x1410, 0x1417), + regmap_reg_range(0x1420, 0x1427), + regmap_reg_range(0x1500, 0x1507), + regmap_reg_range(0x1600, 0x1665), + regmap_reg_range(0x1668, 0x168f), + regmap_reg_range(0x1694, 0x169b), + regmap_reg_range(0x16a0, 0x16a2), + regmap_reg_range(0x16c0, 0x16c3), + regmap_reg_range(0x16d0, 0x16d4), + regmap_reg_range(0x16e0, 0x16ef), + regmap_reg_range(0x1800, 0x1804), + regmap_reg_range(0x1808, 0x180b), + regmap_reg_range(0x1810, 0x181f), + regmap_reg_range(0x1850, 0x1857), + regmap_reg_range(0x1860, 0x186b), + regmap_reg_range(0x1870, 0x188c), + regmap_reg_range(0x1890, 0x1890), + regmap_reg_range(0x1894, 0x18a0), + regmap_reg_range(0x18a0, 0x18ab), + regmap_reg_range(0x18c1, 0x18e7), + regmap_reg_range(0x1900, 0x1907), + regmap_reg_range(0x1914, 0x1920), + regmap_reg_range(0x1923, 0x1936), + regmap_reg_range(0x1938, 0x193d), + regmap_reg_range(0x1940, 0x1941), + regmap_reg_range(0x1944, 0x1953), + regmap_reg_range(0x1a00, 0x1a1b), + regmap_reg_range(0x1b00, 0x1b04), + regmap_reg_range(0x1b08, 0x1b13), + regmap_reg_range(0x1c00, 0x1c05), + regmap_reg_range(0x1c08, 0x1c1b), + + /* Port 2 */ + regmap_reg_range(0x2000, 0x2001), + regmap_reg_range(0x2004, 0x200b), + regmap_reg_range(0x201b, 0x201b), + regmap_reg_range(0x201f, 0x2021), + regmap_reg_range(0x2030, 0x2030), + regmap_reg_range(0x2040, 0x2040), + regmap_reg_range(0x2100, 0x211f), + regmap_reg_range(0x2200, 0x220b), + regmap_reg_range(0x2300, 0x2307), + regmap_reg_range(0x2400, 0x2405), + regmap_reg_range(0x2408, 0x2409), + regmap_reg_range(0x2410, 0x2417), + regmap_reg_range(0x2420, 0x2427), + regmap_reg_range(0x2500, 0x2507), + regmap_reg_range(0x2600, 0x2665), + regmap_reg_range(0x2668, 0x268f), + regmap_reg_range(0x2694, 0x269b), + regmap_reg_range(0x26a0, 0x26a2), + regmap_reg_range(0x26c0, 0x26c3), + regmap_reg_range(0x26d0, 0x26d4), + regmap_reg_range(0x26e0, 0x26ef), + regmap_reg_range(0x2800, 0x2804), + regmap_reg_range(0x2808, 0x280b), + regmap_reg_range(0x2810, 0x281f), + regmap_reg_range(0x2850, 0x2857), + regmap_reg_range(0x2860, 0x286b), + regmap_reg_range(0x2870, 0x288c), + regmap_reg_range(0x2890, 0x2890), + regmap_reg_range(0x2894, 0x28a0), + regmap_reg_range(0x28a0, 0x28ab), + regmap_reg_range(0x28c1, 0x28e7), + regmap_reg_range(0x2900, 0x2907), + regmap_reg_range(0x2914, 0x2920), + regmap_reg_range(0x2923, 0x2936), + regmap_reg_range(0x2938, 0x293d), + regmap_reg_range(0x2940, 0x2941), + regmap_reg_range(0x2944, 0x2953), + regmap_reg_range(0x2a00, 0x2a1b), + regmap_reg_range(0x2b00, 0x2b04), + regmap_reg_range(0x2b08, 0x2b13), + regmap_reg_range(0x2c00, 0x2c05), + regmap_reg_range(0x2c08, 0x2c1b), + + /* Port 3 */ + regmap_reg_range(0x3000, 0x3001), + regmap_reg_range(0x3004, 0x300b), + regmap_reg_range(0x301b, 0x301b), + regmap_reg_range(0x301f, 0x3021), + regmap_reg_range(0x3030, 0x3030), + regmap_reg_range(0x3040, 0x3040), + regmap_reg_range(0x3100, 0x311f), + regmap_reg_range(0x3200, 0x320b), + regmap_reg_range(0x3300, 0x3307), + regmap_reg_range(0x3400, 0x3405), + regmap_reg_range(0x3408, 0x3409), + regmap_reg_range(0x3410, 0x3417), + regmap_reg_range(0x3420, 0x3427), + regmap_reg_range(0x3500, 0x3507), + regmap_reg_range(0x3600, 0x3665), + regmap_reg_range(0x3668, 0x368f), + regmap_reg_range(0x3694, 0x369b), + regmap_reg_range(0x36a0, 0x36a2), + regmap_reg_range(0x36c0, 0x36c3), + regmap_reg_range(0x36d0, 0x36d4), + regmap_reg_range(0x36e0, 0x36ef), + regmap_reg_range(0x3800, 0x3804), + regmap_reg_range(0x3808, 0x380b), + regmap_reg_range(0x3810, 0x381f), + regmap_reg_range(0x3850, 0x3857), + regmap_reg_range(0x3860, 0x386b), + regmap_reg_range(0x3870, 0x388c), + regmap_reg_range(0x3890, 0x3890), + regmap_reg_range(0x3894, 0x38a0), + regmap_reg_range(0x38a0, 0x38ab), + regmap_reg_range(0x38c1, 0x38e7), + regmap_reg_range(0x3900, 0x3907), + regmap_reg_range(0x3914, 0x3920), + regmap_reg_range(0x3923, 0x3936), + regmap_reg_range(0x3938, 0x393d), + regmap_reg_range(0x3940, 0x3941), + regmap_reg_range(0x3944, 0x3953), + regmap_reg_range(0x3a00, 0x3a1b), + regmap_reg_range(0x3b00, 0x3b04), + regmap_reg_range(0x3b08, 0x3b13), + regmap_reg_range(0x3c00, 0x3c05), + regmap_reg_range(0x3c08, 0x3c1b), + + /* Port 4 */ + regmap_reg_range(0x4000, 0x4001), + regmap_reg_range(0x4004, 0x400b), + regmap_reg_range(0x401b, 0x401b), + regmap_reg_range(0x401f, 0x4021), + regmap_reg_range(0x4030, 0x4030), + regmap_reg_range(0x4040, 0x4040), + regmap_reg_range(0x4200, 0x420b), + regmap_reg_range(0x4300, 0x4307), + regmap_reg_range(0x4400, 0x4405), + regmap_reg_range(0x4408, 0x4409), + regmap_reg_range(0x4410, 0x4417), + regmap_reg_range(0x4420, 0x4427), + regmap_reg_range(0x4500, 0x4507), + regmap_reg_range(0x4600, 0x4665), + regmap_reg_range(0x4668, 0x468f), + regmap_reg_range(0x4694, 0x469b), + regmap_reg_range(0x46a0, 0x46a2), + regmap_reg_range(0x46c0, 0x46c3), + regmap_reg_range(0x46d0, 0x46d4), + regmap_reg_range(0x46e0, 0x46ef), + regmap_reg_range(0x4800, 0x4804), + regmap_reg_range(0x4808, 0x480b), + regmap_reg_range(0x4810, 0x481f), + regmap_reg_range(0x4850, 0x4857), + regmap_reg_range(0x4860, 0x486b), + regmap_reg_range(0x4870, 0x488c), + regmap_reg_range(0x4890, 0x4890), + regmap_reg_range(0x4894, 0x48a0), + regmap_reg_range(0x48a0, 0x48ab), + regmap_reg_range(0x48c1, 0x48e7), + regmap_reg_range(0x4900, 0x4907), + regmap_reg_range(0x4914, 0x4920), + regmap_reg_range(0x4923, 0x4936), + regmap_reg_range(0x4938, 0x493d), + regmap_reg_range(0x4940, 0x4941), + regmap_reg_range(0x4944, 0x4953), + regmap_reg_range(0x4a00, 0x4a1b), + regmap_reg_range(0x4b00, 0x4b04), + regmap_reg_range(0x4b08, 0x4b13), + regmap_reg_range(0x4c00, 0x4c05), + regmap_reg_range(0x4c08, 0x4c1b), + + /* Port 5 */ + regmap_reg_range(0x5000, 0x5001), + regmap_reg_range(0x5004, 0x500b), + regmap_reg_range(0x501b, 0x501b), + regmap_reg_range(0x501f, 0x5021), + regmap_reg_range(0x5030, 0x5030), + regmap_reg_range(0x5040, 0x5040), + regmap_reg_range(0x5200, 0x520b), + regmap_reg_range(0x5300, 0x5307), + regmap_reg_range(0x5400, 0x5405), + regmap_reg_range(0x5408, 0x5409), + regmap_reg_range(0x5410, 0x5417), + regmap_reg_range(0x5420, 0x5427), + regmap_reg_range(0x5500, 0x5507), + regmap_reg_range(0x5600, 0x5665), + regmap_reg_range(0x5668, 0x568f), + regmap_reg_range(0x5694, 0x569b), + regmap_reg_range(0x56a0, 0x56a2), + regmap_reg_range(0x56c0, 0x56c3), + regmap_reg_range(0x56d0, 0x56d4), + regmap_reg_range(0x56e0, 0x56ef), + regmap_reg_range(0x5800, 0x5804), + regmap_reg_range(0x5808, 0x580b), + regmap_reg_range(0x5810, 0x581f), + regmap_reg_range(0x5850, 0x5857), + regmap_reg_range(0x5860, 0x586b), + regmap_reg_range(0x5870, 0x588c), + regmap_reg_range(0x5890, 0x5890), + regmap_reg_range(0x5894, 0x58a0), + regmap_reg_range(0x58a0, 0x58ab), + regmap_reg_range(0x58c1, 0x58e7), + regmap_reg_range(0x5900, 0x5907), + regmap_reg_range(0x5914, 0x5920), + regmap_reg_range(0x5923, 0x5936), + regmap_reg_range(0x5938, 0x593d), + regmap_reg_range(0x5940, 0x5941), + regmap_reg_range(0x5944, 0x5953), + regmap_reg_range(0x5a00, 0x5a1b), + regmap_reg_range(0x5b00, 0x5b04), + regmap_reg_range(0x5b08, 0x5b13), + regmap_reg_range(0x5c00, 0x5c05), + regmap_reg_range(0x5c08, 0x5c1b), + + /* Port 6 */ + regmap_reg_range(0x6000, 0x6001), + regmap_reg_range(0x6004, 0x600b), + regmap_reg_range(0x601b, 0x601b), + regmap_reg_range(0x601f, 0x6021), + regmap_reg_range(0x6030, 0x6030), + regmap_reg_range(0x6040, 0x6040), + regmap_reg_range(0x6200, 0x620b), + regmap_reg_range(0x6300, 0x6307), + regmap_reg_range(0x6400, 0x6405), + regmap_reg_range(0x6408, 0x6409), + regmap_reg_range(0x6410, 0x6417), + regmap_reg_range(0x6420, 0x6427), + regmap_reg_range(0x6500, 0x6507), + regmap_reg_range(0x6600, 0x6665), + regmap_reg_range(0x6668, 0x668f), + regmap_reg_range(0x6694, 0x669b), + regmap_reg_range(0x66a0, 0x66a2), + regmap_reg_range(0x66c0, 0x66c3), + regmap_reg_range(0x66d0, 0x66d4), + regmap_reg_range(0x66e0, 0x66ef), + regmap_reg_range(0x6800, 0x6804), + regmap_reg_range(0x6808, 0x680b), + regmap_reg_range(0x6810, 0x681f), + regmap_reg_range(0x6850, 0x6857), + regmap_reg_range(0x6860, 0x686b), + regmap_reg_range(0x6870, 0x688c), + regmap_reg_range(0x6890, 0x6890), + regmap_reg_range(0x6894, 0x68a0), + regmap_reg_range(0x68a0, 0x68ab), + regmap_reg_range(0x68c1, 0x68e7), + regmap_reg_range(0x6900, 0x6907), + regmap_reg_range(0x6914, 0x6920), + regmap_reg_range(0x6923, 0x6936), + regmap_reg_range(0x6938, 0x693d), + regmap_reg_range(0x6940, 0x6941), + regmap_reg_range(0x6944, 0x6953), + regmap_reg_range(0x6a00, 0x6a1b), + regmap_reg_range(0x6b00, 0x6b04), + regmap_reg_range(0x6b08, 0x6b13), + regmap_reg_range(0x6c00, 0x6c05), + regmap_reg_range(0x6c08, 0x6c1b), + + /* Port 7 */ + regmap_reg_range(0x7000, 0x7001), + regmap_reg_range(0x7004, 0x700b), + regmap_reg_range(0x701b, 0x701b), + regmap_reg_range(0x701f, 0x7021), + regmap_reg_range(0x7030, 0x7030), + regmap_reg_range(0x7040, 0x7040), + regmap_reg_range(0x7100, 0x711f), + regmap_reg_range(0x7200, 0x720b), + regmap_reg_range(0x7300, 0x7307), + regmap_reg_range(0x7400, 0x7405), + regmap_reg_range(0x7408, 0x7409), + regmap_reg_range(0x7410, 0x7417), + regmap_reg_range(0x7420, 0x7427), + regmap_reg_range(0x7500, 0x7507), + regmap_reg_range(0x7600, 0x7665), + regmap_reg_range(0x7668, 0x768f), + regmap_reg_range(0x7694, 0x769b), + regmap_reg_range(0x76a0, 0x76a2), + regmap_reg_range(0x76c0, 0x76c3), + regmap_reg_range(0x76d0, 0x76d4), + regmap_reg_range(0x76e0, 0x76ef), + regmap_reg_range(0x7800, 0x7804), + regmap_reg_range(0x7808, 0x780b), + regmap_reg_range(0x7810, 0x781f), + regmap_reg_range(0x7850, 0x7857), + regmap_reg_range(0x7860, 0x786b), + regmap_reg_range(0x7870, 0x788c), + regmap_reg_range(0x7890, 0x7890), + regmap_reg_range(0x7894, 0x78a0), + regmap_reg_range(0x78a0, 0x78ab), + regmap_reg_range(0x78c1, 0x78e7), + regmap_reg_range(0x7900, 0x7907), + regmap_reg_range(0x7914, 0x7920), + regmap_reg_range(0x7923, 0x7936), + regmap_reg_range(0x7938, 0x793d), + regmap_reg_range(0x7940, 0x7941), + regmap_reg_range(0x7944, 0x7953), + regmap_reg_range(0x7a00, 0x7a1b), + regmap_reg_range(0x7b00, 0x7b04), + regmap_reg_range(0x7b08, 0x7b13), + regmap_reg_range(0x7c00, 0x7c05), + regmap_reg_range(0x7c08, 0x7c1b), + + /* Port 8 */ + regmap_reg_range(0x8000, 0x8001), + regmap_reg_range(0x8004, 0x800b), + regmap_reg_range(0x801b, 0x801b), + regmap_reg_range(0x801f, 0x8021), + regmap_reg_range(0x8030, 0x8030), + regmap_reg_range(0x8040, 0x8040), + regmap_reg_range(0x8100, 0x811f), + regmap_reg_range(0x8200, 0x820b), + regmap_reg_range(0x8300, 0x8307), + regmap_reg_range(0x8400, 0x8405), + regmap_reg_range(0x8408, 0x8409), + regmap_reg_range(0x8410, 0x8417), + regmap_reg_range(0x8420, 0x8427), + regmap_reg_range(0x8500, 0x8507), + regmap_reg_range(0x8600, 0x8665), + regmap_reg_range(0x8668, 0x868f), + regmap_reg_range(0x8694, 0x869b), + regmap_reg_range(0x86a0, 0x86a2), + regmap_reg_range(0x86c0, 0x86c3), + regmap_reg_range(0x86d0, 0x86d4), + regmap_reg_range(0x86e0, 0x86ef), + regmap_reg_range(0x8800, 0x8804), + regmap_reg_range(0x8808, 0x880b), + regmap_reg_range(0x8810, 0x881f), + regmap_reg_range(0x8850, 0x8857), + regmap_reg_range(0x8860, 0x886b), + regmap_reg_range(0x8870, 0x888c), + regmap_reg_range(0x8890, 0x8890), + regmap_reg_range(0x8894, 0x88a0), + regmap_reg_range(0x88a0, 0x88ab), + regmap_reg_range(0x88c1, 0x88e7), + regmap_reg_range(0x8900, 0x8907), + regmap_reg_range(0x8914, 0x8920), + regmap_reg_range(0x8923, 0x8936), + regmap_reg_range(0x8938, 0x893d), + regmap_reg_range(0x8940, 0x8941), + regmap_reg_range(0x8944, 0x8953), + regmap_reg_range(0x8a00, 0x8a1b), + regmap_reg_range(0x8b00, 0x8b04), + regmap_reg_range(0x8b08, 0x8b13), + regmap_reg_range(0x8c00, 0x8c05), + regmap_reg_range(0x8c08, 0x8c1b), +}; + +static const struct regmap_access_table lan9373_register_set = { + .yes_ranges = lan9373_valid_regs, + .n_yes_ranges = ARRAY_SIZE(lan9373_valid_regs), +}; + +static const struct regmap_range lan9374_valid_regs[] = { + regmap_reg_range(0x0000, 0x0003), + regmap_reg_range(0x0007, 0x0007), + regmap_reg_range(0x000f, 0x0027), + regmap_reg_range(0x0030, 0x0035), + regmap_reg_range(0x0050, 0x005f), + regmap_reg_range(0x0100, 0x011b), + regmap_reg_range(0x0120, 0x0123), + regmap_reg_range(0x0128, 0x0140), + regmap_reg_range(0x0142, 0x0159), + regmap_reg_range(0x0200, 0x0203), + regmap_reg_range(0x0210, 0x0217), + regmap_reg_range(0x0300, 0x0300), + regmap_reg_range(0x0302, 0x0307), + regmap_reg_range(0x030a, 0x0336), + regmap_reg_range(0x0338, 0x033b), + regmap_reg_range(0x033e, 0x033e), + regmap_reg_range(0x0340, 0x0367), + regmap_reg_range(0x0370, 0x0370), + regmap_reg_range(0x0374, 0x0378), + regmap_reg_range(0x037c, 0x037d), + regmap_reg_range(0x0380, 0x0383), + regmap_reg_range(0x0390, 0x039b), + regmap_reg_range(0x03a4, 0x03b7), + regmap_reg_range(0x03e0, 0x03e3), + regmap_reg_range(0x03e8, 0x03eb), + regmap_reg_range(0x0400, 0x040e), + regmap_reg_range(0x0410, 0x0437), + regmap_reg_range(0x0440, 0x046f), + regmap_reg_range(0x0500, 0x054b), + regmap_reg_range(0x0550, 0x05b7), + regmap_reg_range(0x0640, 0x0645), + regmap_reg_range(0x0648, 0x064d), + regmap_reg_range(0x0650, 0x0655), + regmap_reg_range(0x0700, 0x07ff), + regmap_reg_range(0x0800, 0x088b), + regmap_reg_range(0x0900, 0x09ff), + + /* Port 1 */ + regmap_reg_range(0x1000, 0x1001), + regmap_reg_range(0x1004, 0x100b), + regmap_reg_range(0x101b, 0x101b), + regmap_reg_range(0x101f, 0x1021), + regmap_reg_range(0x1030, 0x1030), + regmap_reg_range(0x1040, 0x1040), + regmap_reg_range(0x1100, 0x111f), + regmap_reg_range(0x1200, 0x120b), + regmap_reg_range(0x1300, 0x1307), + regmap_reg_range(0x1400, 0x1405), + regmap_reg_range(0x1408, 0x1409), + regmap_reg_range(0x1410, 0x1417), + regmap_reg_range(0x1420, 0x1427), + regmap_reg_range(0x1500, 0x1507), + regmap_reg_range(0x1600, 0x1665), + regmap_reg_range(0x1668, 0x168f), + regmap_reg_range(0x1694, 0x169b), + regmap_reg_range(0x16a0, 0x16a2), + regmap_reg_range(0x16c0, 0x16c3), + regmap_reg_range(0x16d0, 0x16d4), + regmap_reg_range(0x16e0, 0x16ef), + regmap_reg_range(0x1800, 0x1804), + regmap_reg_range(0x1808, 0x180b), + regmap_reg_range(0x1810, 0x181f), + regmap_reg_range(0x1850, 0x1857), + regmap_reg_range(0x1860, 0x186b), + regmap_reg_range(0x1870, 0x188c), + regmap_reg_range(0x1890, 0x1890), + regmap_reg_range(0x1894, 0x18a0), + regmap_reg_range(0x18a0, 0x18ab), + regmap_reg_range(0x18c1, 0x18e7), + regmap_reg_range(0x1900, 0x1907), + regmap_reg_range(0x1914, 0x1920), + regmap_reg_range(0x1923, 0x1936), + regmap_reg_range(0x1938, 0x193d), + regmap_reg_range(0x1940, 0x1941), + regmap_reg_range(0x1944, 0x1953), + regmap_reg_range(0x1a00, 0x1a1b), + regmap_reg_range(0x1b00, 0x1b04), + regmap_reg_range(0x1b08, 0x1b13), + regmap_reg_range(0x1c00, 0x1c05), + regmap_reg_range(0x1c08, 0x1c1b), + + /* Port 2 */ + regmap_reg_range(0x2000, 0x2001), + regmap_reg_range(0x2004, 0x200b), + regmap_reg_range(0x201b, 0x201b), + regmap_reg_range(0x201f, 0x2021), + regmap_reg_range(0x2030, 0x2030), + regmap_reg_range(0x2040, 0x2040), + regmap_reg_range(0x2100, 0x211f), + regmap_reg_range(0x2200, 0x220b), + regmap_reg_range(0x2300, 0x2307), + regmap_reg_range(0x2400, 0x2405), + regmap_reg_range(0x2408, 0x2409), + regmap_reg_range(0x2410, 0x2417), + regmap_reg_range(0x2420, 0x2427), + regmap_reg_range(0x2500, 0x2507), + regmap_reg_range(0x2600, 0x2665), + regmap_reg_range(0x2668, 0x268f), + regmap_reg_range(0x2694, 0x269b), + regmap_reg_range(0x26a0, 0x26a2), + regmap_reg_range(0x26c0, 0x26c3), + regmap_reg_range(0x26d0, 0x26d4), + regmap_reg_range(0x26e0, 0x26ef), + regmap_reg_range(0x2800, 0x2804), + regmap_reg_range(0x2808, 0x280b), + regmap_reg_range(0x2810, 0x281f), + regmap_reg_range(0x2850, 0x2857), + regmap_reg_range(0x2860, 0x286b), + regmap_reg_range(0x2870, 0x288c), + regmap_reg_range(0x2890, 0x2890), + regmap_reg_range(0x2894, 0x28a0), + regmap_reg_range(0x28a0, 0x28ab), + regmap_reg_range(0x28c1, 0x28e7), + regmap_reg_range(0x2900, 0x2907), + regmap_reg_range(0x2914, 0x2920), + regmap_reg_range(0x2923, 0x2936), + regmap_reg_range(0x2938, 0x293d), + regmap_reg_range(0x2940, 0x2941), + regmap_reg_range(0x2944, 0x2953), + regmap_reg_range(0x2a00, 0x2a1b), + regmap_reg_range(0x2b00, 0x2b04), + regmap_reg_range(0x2b08, 0x2b13), + regmap_reg_range(0x2c00, 0x2c05), + regmap_reg_range(0x2c08, 0x2c1b), + + /* Port 3 */ + regmap_reg_range(0x3000, 0x3001), + regmap_reg_range(0x3004, 0x300b), + regmap_reg_range(0x301b, 0x301b), + regmap_reg_range(0x301f, 0x3021), + regmap_reg_range(0x3030, 0x3030), + regmap_reg_range(0x3040, 0x3040), + regmap_reg_range(0x3100, 0x311f), + regmap_reg_range(0x3200, 0x320b), + regmap_reg_range(0x3300, 0x3307), + regmap_reg_range(0x3400, 0x3405), + regmap_reg_range(0x3408, 0x3409), + regmap_reg_range(0x3410, 0x3417), + regmap_reg_range(0x3420, 0x3427), + regmap_reg_range(0x3500, 0x3507), + regmap_reg_range(0x3600, 0x3665), + regmap_reg_range(0x3668, 0x368f), + regmap_reg_range(0x3694, 0x369b), + regmap_reg_range(0x36a0, 0x36a2), + regmap_reg_range(0x36c0, 0x36c3), + regmap_reg_range(0x36d0, 0x36d4), + regmap_reg_range(0x36e0, 0x36ef), + regmap_reg_range(0x3800, 0x3804), + regmap_reg_range(0x3808, 0x380b), + regmap_reg_range(0x3810, 0x381f), + regmap_reg_range(0x3850, 0x3857), + regmap_reg_range(0x3860, 0x386b), + regmap_reg_range(0x3870, 0x388c), + regmap_reg_range(0x3890, 0x3890), + regmap_reg_range(0x3894, 0x38a0), + regmap_reg_range(0x38a0, 0x38ab), + regmap_reg_range(0x38c1, 0x38e7), + regmap_reg_range(0x3900, 0x3907), + regmap_reg_range(0x3914, 0x3920), + regmap_reg_range(0x3923, 0x3936), + regmap_reg_range(0x3938, 0x393d), + regmap_reg_range(0x3940, 0x3941), + regmap_reg_range(0x3944, 0x3953), + regmap_reg_range(0x3a00, 0x3a1b), + regmap_reg_range(0x3b00, 0x3b04), + regmap_reg_range(0x3b08, 0x3b13), + regmap_reg_range(0x3c00, 0x3c05), + regmap_reg_range(0x3c08, 0x3c1b), + + /* Port 4 */ + regmap_reg_range(0x4000, 0x4001), + regmap_reg_range(0x4004, 0x400b), + regmap_reg_range(0x401b, 0x401b), + regmap_reg_range(0x401f, 0x4021), + regmap_reg_range(0x4030, 0x4030), + regmap_reg_range(0x4040, 0x4040), + regmap_reg_range(0x4100, 0x411f), + regmap_reg_range(0x4200, 0x420b), + regmap_reg_range(0x4300, 0x4307), + regmap_reg_range(0x4400, 0x4405), + regmap_reg_range(0x4408, 0x4409), + regmap_reg_range(0x4410, 0x4417), + regmap_reg_range(0x4420, 0x4427), + regmap_reg_range(0x4500, 0x4507), + regmap_reg_range(0x4600, 0x4665), + regmap_reg_range(0x4668, 0x468f), + regmap_reg_range(0x4694, 0x469b), + regmap_reg_range(0x46a0, 0x46a2), + regmap_reg_range(0x46c0, 0x46c3), + regmap_reg_range(0x46d0, 0x46d4), + regmap_reg_range(0x46e0, 0x46ef), + regmap_reg_range(0x4800, 0x4804), + regmap_reg_range(0x4808, 0x480b), + regmap_reg_range(0x4810, 0x481f), + regmap_reg_range(0x4850, 0x4857), + regmap_reg_range(0x4860, 0x486b), + regmap_reg_range(0x4870, 0x488c), + regmap_reg_range(0x4890, 0x4890), + regmap_reg_range(0x4894, 0x48a0), + regmap_reg_range(0x48a0, 0x48ab), + regmap_reg_range(0x48c1, 0x48e7), + regmap_reg_range(0x4900, 0x4907), + regmap_reg_range(0x4914, 0x4920), + regmap_reg_range(0x4923, 0x4936), + regmap_reg_range(0x4938, 0x493d), + regmap_reg_range(0x4940, 0x4941), + regmap_reg_range(0x4944, 0x4953), + regmap_reg_range(0x4a00, 0x4a1b), + regmap_reg_range(0x4b00, 0x4b04), + regmap_reg_range(0x4b08, 0x4b13), + regmap_reg_range(0x4c00, 0x4c05), + regmap_reg_range(0x4c08, 0x4c1b), + + /* Port 5 */ + regmap_reg_range(0x5000, 0x5001), + regmap_reg_range(0x5004, 0x500b), + regmap_reg_range(0x501b, 0x501b), + regmap_reg_range(0x501f, 0x5021), + regmap_reg_range(0x5030, 0x5030), + regmap_reg_range(0x5040, 0x5040), + regmap_reg_range(0x5200, 0x520b), + regmap_reg_range(0x5300, 0x5307), + regmap_reg_range(0x5400, 0x5405), + regmap_reg_range(0x5408, 0x5409), + regmap_reg_range(0x5410, 0x5417), + regmap_reg_range(0x5420, 0x5427), + regmap_reg_range(0x5500, 0x5507), + regmap_reg_range(0x5600, 0x5665), + regmap_reg_range(0x5668, 0x568f), + regmap_reg_range(0x5694, 0x569b), + regmap_reg_range(0x56a0, 0x56a2), + regmap_reg_range(0x56c0, 0x56c3), + regmap_reg_range(0x56d0, 0x56d4), + regmap_reg_range(0x56e0, 0x56ef), + regmap_reg_range(0x5800, 0x5804), + regmap_reg_range(0x5808, 0x580b), + regmap_reg_range(0x5810, 0x581f), + regmap_reg_range(0x5850, 0x5857), + regmap_reg_range(0x5860, 0x586b), + regmap_reg_range(0x5870, 0x588c), + regmap_reg_range(0x5890, 0x5890), + regmap_reg_range(0x5894, 0x58a0), + regmap_reg_range(0x58a0, 0x58ab), + regmap_reg_range(0x58c1, 0x58e7), + regmap_reg_range(0x5900, 0x5907), + regmap_reg_range(0x5914, 0x5920), + regmap_reg_range(0x5923, 0x5936), + regmap_reg_range(0x5938, 0x593d), + regmap_reg_range(0x5940, 0x5941), + regmap_reg_range(0x5944, 0x5953), + regmap_reg_range(0x5a00, 0x5a1b), + regmap_reg_range(0x5b00, 0x5b04), + regmap_reg_range(0x5b08, 0x5b13), + regmap_reg_range(0x5c00, 0x5c05), + regmap_reg_range(0x5c08, 0x5c1b), + + /* Port 6 */ + regmap_reg_range(0x6000, 0x6001), + regmap_reg_range(0x6004, 0x600b), + regmap_reg_range(0x601b, 0x601b), + regmap_reg_range(0x601f, 0x6021), + regmap_reg_range(0x6030, 0x6030), + regmap_reg_range(0x6040, 0x6040), + regmap_reg_range(0x6200, 0x620b), + regmap_reg_range(0x6300, 0x6307), + regmap_reg_range(0x6400, 0x6405), + regmap_reg_range(0x6408, 0x6409), + regmap_reg_range(0x6410, 0x6417), + regmap_reg_range(0x6420, 0x6427), + regmap_reg_range(0x6500, 0x6507), + regmap_reg_range(0x6600, 0x6665), + regmap_reg_range(0x6668, 0x668f), + regmap_reg_range(0x6694, 0x669b), + regmap_reg_range(0x66a0, 0x66a2), + regmap_reg_range(0x66c0, 0x66c3), + regmap_reg_range(0x66d0, 0x66d4), + regmap_reg_range(0x66e0, 0x66ef), + regmap_reg_range(0x6800, 0x6804), + regmap_reg_range(0x6808, 0x680b), + regmap_reg_range(0x6810, 0x681f), + regmap_reg_range(0x6850, 0x6857), + regmap_reg_range(0x6860, 0x686b), + regmap_reg_range(0x6870, 0x688c), + regmap_reg_range(0x6890, 0x6890), + regmap_reg_range(0x6894, 0x68a0), + regmap_reg_range(0x68a0, 0x68ab), + regmap_reg_range(0x68c1, 0x68e7), + regmap_reg_range(0x6900, 0x6907), + regmap_reg_range(0x6914, 0x6920), + regmap_reg_range(0x6923, 0x6936), + regmap_reg_range(0x6938, 0x693d), + regmap_reg_range(0x6940, 0x6941), + regmap_reg_range(0x6944, 0x6953), + regmap_reg_range(0x6a00, 0x6a1b), + regmap_reg_range(0x6b00, 0x6b04), + regmap_reg_range(0x6b08, 0x6b13), + regmap_reg_range(0x6c00, 0x6c05), + regmap_reg_range(0x6c08, 0x6c1b), + + /* Port 7 */ + regmap_reg_range(0x7000, 0x7001), + regmap_reg_range(0x7004, 0x700b), + regmap_reg_range(0x701b, 0x701b), + regmap_reg_range(0x701f, 0x7021), + regmap_reg_range(0x7030, 0x7030), + regmap_reg_range(0x7040, 0x7040), + regmap_reg_range(0x7100, 0x711f), + regmap_reg_range(0x7200, 0x720b), + regmap_reg_range(0x7300, 0x7307), + regmap_reg_range(0x7400, 0x7405), + regmap_reg_range(0x7408, 0x7409), + regmap_reg_range(0x7410, 0x7417), + regmap_reg_range(0x7420, 0x7427), + regmap_reg_range(0x7500, 0x7507), + regmap_reg_range(0x7600, 0x7665), + regmap_reg_range(0x7668, 0x768f), + regmap_reg_range(0x7694, 0x769b), + regmap_reg_range(0x76a0, 0x76a2), + regmap_reg_range(0x76c0, 0x76c3), + regmap_reg_range(0x76d0, 0x76d4), + regmap_reg_range(0x76e0, 0x76ef), + regmap_reg_range(0x7800, 0x7804), + regmap_reg_range(0x7808, 0x780b), + regmap_reg_range(0x7810, 0x781f), + regmap_reg_range(0x7850, 0x7857), + regmap_reg_range(0x7860, 0x786b), + regmap_reg_range(0x7870, 0x788c), + regmap_reg_range(0x7890, 0x7890), + regmap_reg_range(0x7894, 0x78a0), + regmap_reg_range(0x78a0, 0x78ab), + regmap_reg_range(0x78c1, 0x78e7), + regmap_reg_range(0x7900, 0x7907), + regmap_reg_range(0x7914, 0x7920), + regmap_reg_range(0x7923, 0x7936), + regmap_reg_range(0x7938, 0x793d), + regmap_reg_range(0x7940, 0x7941), + regmap_reg_range(0x7944, 0x7953), + regmap_reg_range(0x7a00, 0x7a1b), + regmap_reg_range(0x7b00, 0x7b04), + regmap_reg_range(0x7b08, 0x7b13), + regmap_reg_range(0x7c00, 0x7c05), + regmap_reg_range(0x7c08, 0x7c1b), + + /* Port 8 */ + regmap_reg_range(0x8000, 0x8001), + regmap_reg_range(0x8004, 0x800b), + regmap_reg_range(0x801b, 0x801b), + regmap_reg_range(0x801f, 0x8021), + regmap_reg_range(0x8030, 0x8030), + regmap_reg_range(0x8040, 0x8040), + regmap_reg_range(0x8100, 0x811f), + regmap_reg_range(0x8200, 0x820b), + regmap_reg_range(0x8300, 0x8307), + regmap_reg_range(0x8400, 0x8405), + regmap_reg_range(0x8408, 0x8409), + regmap_reg_range(0x8410, 0x8417), + regmap_reg_range(0x8420, 0x8427), + regmap_reg_range(0x8500, 0x8507), + regmap_reg_range(0x8600, 0x8665), + regmap_reg_range(0x8668, 0x868f), + regmap_reg_range(0x8694, 0x869b), + regmap_reg_range(0x86a0, 0x86a2), + regmap_reg_range(0x86c0, 0x86c3), + regmap_reg_range(0x86d0, 0x86d4), + regmap_reg_range(0x86e0, 0x86ef), + regmap_reg_range(0x8800, 0x8804), + regmap_reg_range(0x8808, 0x880b), + regmap_reg_range(0x8810, 0x881f), + regmap_reg_range(0x8850, 0x8857), + regmap_reg_range(0x8860, 0x886b), + regmap_reg_range(0x8870, 0x888c), + regmap_reg_range(0x8890, 0x8890), + regmap_reg_range(0x8894, 0x88a0), + regmap_reg_range(0x88a0, 0x88ab), + regmap_reg_range(0x88c1, 0x88e7), + regmap_reg_range(0x8900, 0x8907), + regmap_reg_range(0x8914, 0x8920), + regmap_reg_range(0x8923, 0x8936), + regmap_reg_range(0x8938, 0x893d), + regmap_reg_range(0x8940, 0x8941), + regmap_reg_range(0x8944, 0x8953), + regmap_reg_range(0x8a00, 0x8a1b), + regmap_reg_range(0x8b00, 0x8b04), + regmap_reg_range(0x8b08, 0x8b13), + regmap_reg_range(0x8c00, 0x8c05), + regmap_reg_range(0x8c08, 0x8c1b), +}; + +static const struct regmap_access_table lan9374_register_set = { + .yes_ranges = lan9374_valid_regs, + .n_yes_ranges = ARRAY_SIZE(lan9374_valid_regs), +}; + const struct ksz_chip_data ksz_switch_chips[] = { [KSZ8563] = { .chip_id = KSZ8563_CHIP_ID, @@ -1334,6 +3084,8 @@ const struct ksz_chip_data ksz_switch_chips[] = { .supports_rmii = {false, false, false, false, true}, .supports_rgmii = {false, false, false, false, true}, .internal_phy = {true, true, true, true, false}, + .wr_table = &lan9370_register_set, + .rd_table = &lan9370_register_set, }, [LAN9371] = { @@ -1358,6 +3110,8 @@ const struct ksz_chip_data ksz_switch_chips[] = { .supports_rmii = {false, false, false, false, true, true}, .supports_rgmii = {false, false, false, false, true, true}, .internal_phy = {true, true, true, true, false, false}, + .wr_table = &lan9371_register_set, + .rd_table = &lan9371_register_set, }, [LAN9372] = { @@ -1386,6 +3140,8 @@ const struct ksz_chip_data ksz_switch_chips[] = { true, true, false, false}, .internal_phy = {true, true, true, true, false, false, true, true}, + .wr_table = &lan9372_register_set, + .rd_table = &lan9372_register_set, }, [LAN9373] = { @@ -1414,6 +3170,8 @@ const struct ksz_chip_data ksz_switch_chips[] = { true, true, false, false}, .internal_phy = {true, true, true, false, false, false, true, true}, + .wr_table = &lan9373_register_set, + .rd_table = &lan9373_register_set, }, [LAN9374] = { @@ -1442,6 +3200,8 @@ const struct ksz_chip_data ksz_switch_chips[] = { true, true, false, false}, .internal_phy = {true, true, true, true, false, false, true, true}, + .wr_table = &lan9374_register_set, + .rd_table = &lan9374_register_set, }, }; EXPORT_SYMBOL_GPL(ksz_switch_chips); From patchwork Wed Nov 2 04:10:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 14027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3386673wru; Tue, 1 Nov 2022 21:19:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JEJWd+dwypOUZWSlItz+0XXmKXcng/4jynkMRYUT7QHN9VmtsbindJ1g/4qSiuuL7kT4K X-Received: by 2002:a17:906:3054:b0:7ad:e82b:ac23 with SMTP id d20-20020a170906305400b007ade82bac23mr8398491ejd.235.1667362797621; Tue, 01 Nov 2022 21:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667362797; cv=none; d=google.com; s=arc-20160816; b=H2+pkNoI601mJoeH4FqB+2ZcE8XzMOwWOLRK1aZVl12R+eJCry6uehHSiEwl0sbCkO Vf+lldBqIrDD2JzzgGREeUZhJdQiadErWSTSjFGKuHHL3ENUN7h3+8gfhfhYQethQH2b 4wyUz8HFhD6KJ+NLM28muVwyzsTtBoal/l6WTGl74IKb00MS3CHzW/NQYJYd8vYf4Tu5 Vx28I89jG+zWAP3/W70avAInPZDEdrH5Vjo5dfkefHmCwQ3+3MlNNo8xr7UAWn4JCdGp 8rS0kdsF8A44PRz3R9BSSo6rRHEWdKMZkMwaqsgBlvl8vvtSaNqRGDMOZnFmUlBed1nG q12Q== 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=lBEuzwGJfAYMfIq1qr1BY49CThuyWLhLhxBKjoAJe7U=; b=vaG+dj0Fo06VNoM4dhsgQHlIVsTdUFvjkxUlEpBFs8QqnKyXepKWYTMX1dnWlyO1Ie Z4gOjJB+bs/T0qymcKxUqprgXqbzYPxW+DJ7wU6ViGsu4pnOa+23RR26cplP3z+ZLv/o WAKEK5aeqLJZf4/EKZ0c27si0WBgaY581lvyIAZ8n0cRF3bgpshbUJxiCmrsnSY1oVSB vf83JN99tDVJIdEskrmlg6CZnesiYv0eQZVgyXvbDOigjJt51+ymUUDexzwKDwADya+g ezNgl59q7Hpf8cs+vVrn3u0iSgx2+mch508rYes5MasQEW19UgWUVv/P48kZWwc3AlH1 tEgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=qGbtP4m7; 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=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a056402355300b0043e5ca9a0e2si15772671edd.628.2022.11.01.21.19.34; Tue, 01 Nov 2022 21:19:57 -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=@microchip.com header.s=mchp header.b=qGbtP4m7; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbiKBEOt (ORCPT + 99 others); Wed, 2 Nov 2022 00:14:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbiKBEOd (ORCPT ); Wed, 2 Nov 2022 00:14:33 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D899D2339D; Tue, 1 Nov 2022 21:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667362470; x=1698898470; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ssDfl6TfGbH5+54WMZeH+z9h4AlgTT6KpSbOo70Omcs=; b=qGbtP4m7VuLTRc6e5IJWRwFcxwVaWzW5Wgns32lDmXGAEntqqlO1Vke0 zDUp2xcXtcr0NR1S/fFCFcvPx9FUyJSkmdeS7rO3hRaUlIcNUSbow1h7W eUkxnoKedulA78xgsZRk7n5fvDorLOU3ZlPJuoVPE/cSVgWE2F4W+Pz4a r3b9074UWaSf0+4TEPk/pz0f/vF4ODJbuR2IgkfwMOGvYYUcD7M5oTwMz qFOGp1du0Wvkdd5rJuS42k7h4fboXEGbHoMaEgD8TtIHJT6AVh8CUJbcq 8W+kZXglLIeQhtseN83ffDagmcrd6WAsN1GnFvAr5/9KdkC41Wpef5Hnj g==; X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="181530231" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Nov 2022 21:14:29 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 1 Nov 2022 21:14:29 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 1 Nov 2022 21:14:24 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [PATCH net-next 2/6] net: dsa: microchip: add ksz9563 in ksz_switch_ops and select based on compatible string Date: Wed, 2 Nov 2022 09:40:54 +0530 Message-ID: <20221102041058.128779-3-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> References: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748356613266042653?= X-GMAIL-MSGID: =?utf-8?q?1748356613266042653?= Add KSZ9563 inside ksz_switch_chips structure with port_nirq as 3. KSZ9563 use KSZ9893 switch parameters but port_nirq count is 3 for KSZ9563 whereas 2 for KSZ9893. Add KSZ9563 inside ksz_switch_chips as a separate member and from device tree map compatible string into KSZ9563 inside ksz_spi.c and ksz9477_i2c.c. Global Chip ID 1 and 2 registers read value 9893, select sku based on Global Chip ID 4 Register which read 0x1c for KSZ9563. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz9477.c | 3 ++- drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +- drivers/net/dsa/microchip/ksz_common.c | 33 +++++++++++++++++++++++-- drivers/net/dsa/microchip/ksz_common.h | 3 +++ drivers/net/dsa/microchip/ksz_spi.c | 2 +- 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index a6a0321a8931..0d6b40968657 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -195,7 +195,8 @@ int ksz9477_reset_switch(struct ksz_device *dev) /* KSZ9893 compatible chips do not support refclk configuration */ if (dev->chip_id == KSZ9893_CHIP_ID || - dev->chip_id == KSZ8563_CHIP_ID) + dev->chip_id == KSZ8563_CHIP_ID || + dev->chip_id == KSZ9563_CHIP_ID) return 0; data8 = SW_ENABLE_REFCLKO; diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c index 3763930dc6fc..55146584e9b5 100644 --- a/drivers/net/dsa/microchip/ksz9477_i2c.c +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c @@ -101,7 +101,7 @@ static const struct of_device_id ksz9477_dt_ids[] = { }, { .compatible = "microchip,ksz9563", - .data = &ksz_switch_chips[KSZ9893] + .data = &ksz_switch_chips[KSZ9563] }, { .compatible = "microchip,ksz8563", diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index b0905c5b701d..7620855ba995 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -3032,6 +3032,31 @@ const struct ksz_chip_data ksz_switch_chips[] = { .gbit_capable = {true, true, true}, }, + [KSZ9563] = { + .chip_id = KSZ9563_CHIP_ID, + .dev_name = "KSZ9563", + .num_vlans = 4096, + .num_alus = 4096, + .num_statics = 16, + .cpu_ports = 0x07, /* can be configured as cpu port */ + .port_cnt = 3, /* total port count */ + .port_nirqs = 3, + .ops = &ksz9477_dev_ops, + .mib_names = ksz9477_mib_names, + .mib_cnt = ARRAY_SIZE(ksz9477_mib_names), + .reg_mib_cnt = MIB_COUNTER_NUM, + .regs = ksz9477_regs, + .masks = ksz9477_masks, + .shifts = ksz9477_shifts, + .xmii_ctrl0 = ksz9477_xmii_ctrl0, + .xmii_ctrl1 = ksz8795_xmii_ctrl1, /* Same as ksz8795 */ + .supports_mii = {false, false, true}, + .supports_rmii = {false, false, true}, + .supports_rgmii = {false, false, true}, + .internal_phy = {true, true, false}, + .gbit_capable = {true, true, true}, + }, + [KSZ9567] = { .chip_id = KSZ9567_CHIP_ID, .dev_name = "KSZ9567", @@ -4149,7 +4174,8 @@ static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds, if (dev->chip_id == KSZ8830_CHIP_ID || dev->chip_id == KSZ8563_CHIP_ID || - dev->chip_id == KSZ9893_CHIP_ID) + dev->chip_id == KSZ9893_CHIP_ID || + dev->chip_id == KSZ9563_CHIP_ID) proto = DSA_TAG_PROTO_KSZ9893; if (dev->chip_id == KSZ9477_CHIP_ID || @@ -4269,7 +4295,8 @@ static void ksz_set_xmii(struct ksz_device *dev, int port, data8 |= bitval[P_RGMII_SEL]; /* On KSZ9893, disable RGMII in-band status support */ if (dev->chip_id == KSZ9893_CHIP_ID || - dev->chip_id == KSZ8563_CHIP_ID) + dev->chip_id == KSZ8563_CHIP_ID || + dev->chip_id == KSZ9563_CHIP_ID) data8 &= ~P_MII_MAC_MODE; break; default: @@ -4542,6 +4569,8 @@ static int ksz_switch_detect(struct ksz_device *dev) if (id4 == SKU_ID_KSZ8563) dev->chip_id = KSZ8563_CHIP_ID; + else if (id4 == SKU_ID_KSZ9563) + dev->chip_id = KSZ9563_CHIP_ID; else dev->chip_id = KSZ9893_CHIP_ID; diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 9cfa179575ce..c6726cbd5465 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -154,6 +154,7 @@ enum ksz_model { KSZ9896, KSZ9897, KSZ9893, + KSZ9563, KSZ9567, LAN9370, LAN9371, @@ -172,6 +173,7 @@ enum ksz_chip_id { KSZ9896_CHIP_ID = 0x00989600, KSZ9897_CHIP_ID = 0x00989700, KSZ9893_CHIP_ID = 0x00989300, + KSZ9563_CHIP_ID = 0x00956300, KSZ9567_CHIP_ID = 0x00956700, LAN9370_CHIP_ID = 0x00937000, LAN9371_CHIP_ID = 0x00937100, @@ -551,6 +553,7 @@ static inline int is_lan937x(struct ksz_device *dev) /* KSZ9893, KSZ9563, KSZ8563 specific register */ #define REG_CHIP_ID4 0x0f #define SKU_ID_KSZ8563 0x3c +#define SKU_ID_KSZ9563 0x1c /* Driver set switch broadcast storm protection at 10% rate. */ #define BROADCAST_STORM_PROT_RATE 10 diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c index 1b6ab891b986..4f2186779082 100644 --- a/drivers/net/dsa/microchip/ksz_spi.c +++ b/drivers/net/dsa/microchip/ksz_spi.c @@ -163,7 +163,7 @@ static const struct of_device_id ksz_dt_ids[] = { }, { .compatible = "microchip,ksz9563", - .data = &ksz_switch_chips[KSZ9893] + .data = &ksz_switch_chips[KSZ9563] }, { .compatible = "microchip,ksz8563", From patchwork Wed Nov 2 04:10:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 14023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3386250wru; Tue, 1 Nov 2022 21:18:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43KJZU1HNoirnp8sTssvVzmd1RLz063vGUK58uSr2Kg3IokgHfSk0J/IyGUZIJPC35oq8K X-Received: by 2002:a17:907:7251:b0:7a5:a8f5:b86e with SMTP id ds17-20020a170907725100b007a5a8f5b86emr21478857ejc.761.1667362731318; Tue, 01 Nov 2022 21:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667362731; cv=none; d=google.com; s=arc-20160816; b=gnO2UWkZsz4bVvIpLE7IEQzNqkSSyOMhDuTb28/Pgu0uKy3BtDT2cQ5N73ylTab4Dk MljZi6OMgrTgq/PSJ21nCefVoPt8tppm9tXilbAkP/u6U1nlY5KuD30jqvnZ9RoOoUWf DhT3/WgZu0p0ceFctie6JibcqsrNIv4SuJs7Hp/UiooZT9rsvhQk5PbGT9w/utfRSAZQ 4ZDlDNHxLhMCuKXF3/JIXTwuxXkyjuvOf6xFmFiF4VkfvtjIMAEEEJpYTJzinGJpl3zi vQ6aZQ33eMFer0jumpgypXTEue8RpAOQAdy1/6BnI4UPqwhXByG42Ti3sEYd1OH5MyK1 ondA== 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=lfd9osbMvONWfppHFW5HiM8uBJo6ASNUVIa74GMvLfk=; b=v2SIzN/Vf1Lu0biLNwwFFAWyXehyjee0+7tI55TcckxK0Lg/Kn2/oQa4v8A2diE4O2 7wE55sBHaxcQEBaXLzJ7bVT5jS3BikHtg5m7BKLHLaRr+44rD5phSTEDJu7TDWr5bwVN 8sDC4qW6K9mLvH/IS2LVImBba5MOJmkJVc6u2NwdnqITJJ4jSiWNSuZDJTs9uqz323LL p1f3HRUWNdKg9SP5fr51c1BQ31PR9HWlaf4iDZCT+eGrhyURG3cMvYpN1MbzLZKOZiA3 5JTGQrGFWj2MbzJk4LirsLdtub/U0Nk2/YOgCorKy7P12cJbBMsYH4CHYkSsz/zVcAxX rxIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Fes+XqR3; 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=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t29-20020a508d5d000000b0045ad02bb8fbsi12133370edt.290.2022.11.01.21.18.28; Tue, 01 Nov 2022 21:18:51 -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=@microchip.com header.s=mchp header.b=Fes+XqR3; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbiKBEPc (ORCPT + 99 others); Wed, 2 Nov 2022 00:15:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230005AbiKBEOi (ORCPT ); Wed, 2 Nov 2022 00:14:38 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14B6023388; Tue, 1 Nov 2022 21:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667362475; x=1698898475; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XREYEvSdINiMHV6IL4y/XM301yNPd7W2TtRBmVU9SiM=; b=Fes+XqR3nYeIMjXGZ+fyn9h6L3clvG/z9WTiyuATkCCDuqVh9ndrvOAb Y2fg8W8/xwsRPRJ+w/7PgW6USlvrNLeLbV/hXxQGQzLgPNzhuVegXp8Uv TaOBa/NKHdz5sn7AKBI7rx2Zj50YVL7UGWHtUQHQPhz0p4pvhEVX35sTQ eDBjoYEpoS5FeDiDEX3VcNcxTOWroJrnrnqG7Y8kisXpDnfhsnXEz0nvM 6ZWr3nrGFgqDSecM8h9X0xIM90Ka8o2gfbPkYVIXLjsjZlWlXXtY7o7+6 cSjp72S2NKXXXJhhAkKWo3ceh8EBP/2yrGvYizBpNC4S62MzZCE2XGmeu g==; X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="121397451" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Nov 2022 21:14:35 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 1 Nov 2022 21:14:34 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 1 Nov 2022 21:14:30 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [PATCH net-next 3/6] net: dsa: microchip: add irq in i2c probe Date: Wed, 2 Nov 2022 09:40:55 +0530 Message-ID: <20221102041058.128779-4-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> References: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748356543263859117?= X-GMAIL-MSGID: =?utf-8?q?1748356543263859117?= add device irq in i2c probe function. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz9477_i2c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c index 55146584e9b5..caa9acf1495c 100644 --- a/drivers/net/dsa/microchip/ksz9477_i2c.c +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c @@ -41,6 +41,8 @@ static int ksz9477_i2c_probe(struct i2c_client *i2c, if (i2c->dev.platform_data) dev->pdata = i2c->dev.platform_data; + dev->irq = i2c->irq; + ret = ksz_switch_register(dev); /* Main DSA driver may not be started yet. */ From patchwork Wed Nov 2 04:10:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 14025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3386541wru; Tue, 1 Nov 2022 21:19:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5O6ESpZtUGS33NdeAEyFKS7yaLKmPdD+L+fuBXzkeLx+/VYFbs6x1RfyxKVFH/v0VpR2Ro X-Received: by 2002:a17:906:2bc7:b0:72f:dc70:a3c6 with SMTP id n7-20020a1709062bc700b0072fdc70a3c6mr22202308ejg.645.1667362778334; Tue, 01 Nov 2022 21:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667362778; cv=none; d=google.com; s=arc-20160816; b=EH5+opyDiAA2FA9AWIOjA7bg26XRsQP1pioN1t7CNfaLouv3xtOwK5o6HE8Msqlfnq rhQ+Z/kiEK//AWFEgQA3lxttvEFw+JFi8CW8sYVPHKA1JRQypThqT0sa4qkoAyhbU+8c N2OVrRqm3kGDs2WjfRGcoj5CQmrBbBUgkNHbkwFdBB3C2jcR0j0gJFqybH2IIxY2i18V rhqF6F4maVRB2v/S1oDe9ow4tCO1BQd7+fobNsreK8Jcxuu/MH19kPpqEqm2IgofTs4z jvlVpRgHlxj3pKkU0U3hdzgvUkuguvlatar6CmQyj30LsJsiQ414wbdC2RUWrzGaiPhW 755Q== 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=SxHiO70i9PsvluYl8QEPfvHjq+Kxe7Zx7Z8JewlmLQw=; b=SuX0s4qcsWa+9cnxXe5tmti5DeCSb/2bx1LaHRTIFwbCJWda1NGIqz2ycWZWJtNWG8 nBZ+pW6kw3HUpdoZ8XViPZpHR2hufTc0fcVxIOS2XGV56QLuJ89LtKqm637e528mjIlH lvRqfDHp2itlbIsOKEnbZgh3cgYnhxOY7Sq0WssNNWgeh2ROzcBoPflMOtUQtyoAPrAc RG0OtAN6j0aUS7fsdje5HlTSUQHYbkIykP1aM4zVHnRJFf916AkMm+pTiQVXmEcYscNT dOjE694nJrI96cDEeXdJO3qMcdGeyCEluce9iQA588OMXfdJu8oJLtuv8vPpEEDYbX3Y oXcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=uoGbcuOL; 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=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020aa7dd0a000000b0045d523bee48si12360193edv.178.2022.11.01.21.19.14; Tue, 01 Nov 2022 21:19:38 -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=@microchip.com header.s=mchp header.b=uoGbcuOL; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230259AbiKBEPh (ORCPT + 99 others); Wed, 2 Nov 2022 00:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbiKBEPO (ORCPT ); Wed, 2 Nov 2022 00:15:14 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9939623BEA; Tue, 1 Nov 2022 21:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667362483; x=1698898483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sZkHzp4axHvnVQJ1e6P/AN6YKQRNToLw1Xi9YPFU8ms=; b=uoGbcuOLEJuYwbY/ZM2qWX+xr++iXDH5VgvFzHU2rkogwzrlRbUiJjJD zcGYII5lPKp/Lst2j7GrWopCxfYKKXX70oy7cLp4640N6DODtFH167cT1 hLH8IRJNYxs4xYDBJXQGNZ9lEtQigVs4rTAqIQEGME0vI6sBY2hHrXZRw RkxEnD4oRihaRF+iUCa8J5XEgM0mIf2QkUKB1EuGss2X8g6VY3ThOgln5 B9Hp5mMFugeDRot74L/0wYKQg67SuqMpjj+ooFDnCxY/sngTVH8pZdDxT T8GEEkeT3TvAq9/F+8+N+eD13JDPpf43C4UR6Uy3Y6ooshphwR9sXEuHq w==; X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="184948864" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Nov 2022 21:14:42 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 1 Nov 2022 21:14:40 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 1 Nov 2022 21:14:36 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [PATCH net-next 4/6] net: dsa: microchip: add error checking for ksz_pwrite Date: Wed, 2 Nov 2022 09:40:56 +0530 Message-ID: <20221102041058.128779-5-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> References: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748356592547554541?= X-GMAIL-MSGID: =?utf-8?q?1748356592547554541?= Add status validation for port register write inside lan937x_change_mtu. ksz_pwrite and ksz_pread api's are updated with return type int (Reference patch mentioned below). Update lan937x_change_mtu with status validation for ksz_pwrite16(). Link: https://patchwork.kernel.org/project/netdevbpf/patch/20220826105634.3855578-6-o.rempel@pengutronix.de/ Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/lan937x_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c index 7e4f307a0387..06d3d0308cba 100644 --- a/drivers/net/dsa/microchip/lan937x_main.c +++ b/drivers/net/dsa/microchip/lan937x_main.c @@ -242,7 +242,11 @@ int lan937x_change_mtu(struct ksz_device *dev, int port, int new_mtu) } /* Write the frame size in PORT_MAX_FR_SIZE register */ - ksz_pwrite16(dev, port, PORT_MAX_FR_SIZE, new_mtu); + ret = ksz_pwrite16(dev, port, PORT_MAX_FR_SIZE, new_mtu); + if (ret) { + dev_err(ds->dev, "failed to update mtu for port %d\n", port); + return ret; + } return 0; } From patchwork Wed Nov 2 04:10:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 14024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3386255wru; Tue, 1 Nov 2022 21:18:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fmFyEmXfyRk7tC22oSDN1HZUEiU4+ye3gOBr2I3hx6Zftct9EahtzD8dHpFmYxGWbAGTt X-Received: by 2002:a17:906:5dae:b0:78e:302f:4218 with SMTP id n14-20020a1709065dae00b0078e302f4218mr22906944ejv.22.1667362732755; Tue, 01 Nov 2022 21:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667362732; cv=none; d=google.com; s=arc-20160816; b=m0ITp7vkwkVSXZcHefNItM0CFEj3jkeyXXGBYwsYM0NH22OmXuBVXmY0By4zEd5MrZ eiloUHeYPDntMHKkZGpsafFBB7AyyaM2gE6tqGztuh6TD2ZbJXEysk8Y90p7JdKQkNtb kQVUGGhrdivJJssWz9Af728Tg5DNLlKZz5x3UYzIQr92ArzbRtCK1ZfsRb1up3+VRo7h xRW+DHz59SNh6pXW9Gljw7GQOFydx+M2vIdub7VqcSEUv06pOrmhY+Ckv0JPL8upG4zn rLxGbyQ4cVCPU1OHoqbb0egKoVL8ql4oZy4lh8hFclR8LqdO1soFRY2S6tnM4mEw0TTz SBNw== 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=rR7/CklcQlqhoTKupXOZnlelW7BoQTgocq6Q6yOb5/g=; b=HeodXvKtuxy7xxcJNtpQd/LoTeoHeq+K95OHJlreZha/YQa5ZIGXZlIlTDake8YmtS aI3+zI7ejn8UmvvM2hIyujYjRg1JA974x9CxRkkSCVf7H8++LNEOTye6yyvzxB19bZ19 3KQkcBKeaFZGJgA9ErY/aDwg0/TNkv+o6XQjt/BxsvETiNxLyQvlIBj8LfKxIHqHr1WD pv4bFc8fHinYgbykxPsHZEnTHu0MfnYXt2HYGDWJaXs/t+tLFu0L7iS3OS4+TU+7BzFh hnPuxF5IwVtnRSCh/0jC7f6rXb34VHjoO4C0N0LtWu+LkHf7WwoG463c71S0aMWWyhJL VRSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=oTrBdqhm; 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=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a056402084500b004637f0abb77si10105636edz.487.2022.11.01.21.18.29; Tue, 01 Nov 2022 21:18:52 -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=@microchip.com header.s=mchp header.b=oTrBdqhm; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230326AbiKBEP4 (ORCPT + 99 others); Wed, 2 Nov 2022 00:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbiKBEPT (ORCPT ); Wed, 2 Nov 2022 00:15:19 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D577DF38; Tue, 1 Nov 2022 21:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667362488; x=1698898488; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZjHjwtYeimh+uqynqbTRCzpKyff/1Kid7o8ddH+6vhw=; b=oTrBdqhm18fUf7r9LtpA3Xw+JvpWMlSQVnvL7LUx+aVYhoMOr2bxWi50 1xo8pBaYooN+NSK6DFHuNVXid8M7+BU/bWnXO8i1vIW5zD4k9SpaJXnET 785slLPsPlktL2y4rgIqqyO6ChyhL4B/0UaJMa7RHWgjwNUj78Cj79qxr LiFU7IXJN4SwTRVfK8AQaq3W+WT+Y/vNujIAwJk9tODoX4lj+rVzTWhQN q3A+FM+mekrENDjWP8HEiiLEhjReTCFuhyBddXQocnYiinA0icIXkYoFf dGoK7JI24plGPyLlTZK3NPDGt1Wu2z6a3+dl7UsWsaJXrY4Mj6TAKx6V3 Q==; X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="187301801" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Nov 2022 21:14:47 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 1 Nov 2022 21:14:47 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 1 Nov 2022 21:14:43 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [PATCH net-next 5/6] net: dsa: microchip: ksz8563: Add number of port irq Date: Wed, 2 Nov 2022 09:40:57 +0530 Message-ID: <20221102041058.128779-6-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> References: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748356544668712119?= X-GMAIL-MSGID: =?utf-8?q?1748356544668712119?= KSZ8563 have three port interrupts: PTP, PHY and ACL. Add port_nirq as 3 for KSZ8563 inside ksz_chip_data. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 7620855ba995..b2a0c0c32d0a 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2789,6 +2789,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 = 3, .ops = &ksz9477_dev_ops, .mib_names = ksz9477_mib_names, .mib_cnt = ARRAY_SIZE(ksz9477_mib_names), From patchwork Wed Nov 2 04:10:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 14026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3386648wru; Tue, 1 Nov 2022 21:19:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5EPrGSVCgHsXIbNiA4ycgijAH3mrGwDEvnPAHTPzoSHlYoh5LONUB/ZnIOmcv9Vj4Miit/ X-Received: by 2002:a17:906:cc48:b0:7a8:4a3b:11f7 with SMTP id mm8-20020a170906cc4800b007a84a3b11f7mr22107795ejb.388.1667362793235; Tue, 01 Nov 2022 21:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667362793; cv=none; d=google.com; s=arc-20160816; b=Kt6ZIHzkKRhYSk7FTYOyDToyvBQQqKprzEtkP8bFabZ4kVNRlhM4QCZt937ZIra/I3 tkYKR3CezO8jj3ConWuB/fDX1Dd7KM2nEa/ZmkvHqImSejQSvdXduZh7JKQusPUiqDGf Mzh1AK+mB6/5JH2U/h1zeYlscf0Pm8V94pGm8pqfsXaYM4sFiEP7SOA6oU3jpp7IPNwO ett1tihAwS7B1Of3DYxz9oSqyPdLROZbSmOnZzrOkSsVNIN3yS/VCCEFGATc1EjQH9hX +ua9ygFPJuiifNMLwRyLLGdkIBUQd3JGvRu9FgTAKxwEa0PjCsvqWc526BCAFuYCmNC3 +byA== 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=aN63oC2EFzEMliOcQ4Ye4Q0L5v5qw0kTAbBh3Y0KhKk=; b=Tbent02maIK83m0WNUHSEbAWvH3/KPMhhFLfmDneOwaSr4H1J/4UNONl4Q6NtGJhLC ep12UGBTFedu+qjGljEcjnXxk2/5QQZmc49a6uxs2x1FcFiv7BoII81lLhD7DXP9SFRB fSQHQVF/u/2baiTrdmAU0CRywmZr2uCRsK0/Gi1r3etXnJczWeGKpiYXoiwKi+kYnXYU kjzLSsX5xxgEu0JAvVhTH8HEMA74tuzFIoMfq6hEt7Qe0Hg+/KnR0hrp1nL1DofiSD2k d+K+rcsTwhhZTe9emO0ttfRSPHlRYgCvb/qqD1frsdvnNgCpDAZk36ToWROSV6YGkoIs Kv3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=gZLsJTEV; 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=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh6-20020a1709076e8600b0078e16203457si16610460ejc.5.2022.11.01.21.19.30; Tue, 01 Nov 2022 21:19:53 -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=@microchip.com header.s=mchp header.b=gZLsJTEV; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230336AbiKBEQC (ORCPT + 99 others); Wed, 2 Nov 2022 00:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbiKBEPZ (ORCPT ); Wed, 2 Nov 2022 00:15:25 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60D03248FB; Tue, 1 Nov 2022 21:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667362493; x=1698898493; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9GnNyz13QneI0oPfy3KJmDwliNeb7C9tr9KliRE0l1Y=; b=gZLsJTEVElUpMI4cqB3RQdhzTkDr4jZo3kJw52arjpoNkcIMZ8fbgeg0 o7cWUDU+ELrQcQI5YIVIIkfTTrPetrbrprjJyFLpslVHKE358aVcuTEpd 8WN6xPqh3nOmxB+NS9a5HbupyYj3yV0xNLtgwIBHqUoSiNjVxQbSHYaNw lDE2kYy4wPKCEiSXNuQX0zOPQTeJUVNs+PhaQHBWYNo1rnhBbGL2Q4JX9 N0C4/e2Vt0MNBF+fmcV0+xPKyll3T4Cgab6BWVCFpcDWzcYWHlI41WpiN gKRQmuxX+lh3wJYnEMvM2JRhWEThjWebt1TCIxgLB51441qD4/mEUqMN4 w==; X-IronPort-AV: E=Sophos;i="5.95,232,1661842800"; d="scan'208";a="181530261" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Nov 2022 21:14:53 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 1 Nov 2022 21:14:52 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 1 Nov 2022 21:14:48 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [PATCH net-next 6/6] net: dsa: microchip: add dev_err_probe in probe functions Date: Wed, 2 Nov 2022 09:40:58 +0530 Message-ID: <20221102041058.128779-7-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> References: <20221102041058.128779-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748356608089324294?= X-GMAIL-MSGID: =?utf-8?q?1748356608089324294?= Probe functions uses normal dev_err() to check error conditions and print messages. Replace dev_err() with dev_err_probe() to have more standardized format and error logging. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz8863_smi.c | 9 ++++----- drivers/net/dsa/microchip/ksz9477_i2c.c | 8 +++----- drivers/net/dsa/microchip/ksz_spi.c | 8 +++----- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/microchip/ksz8863_smi.c index ddb40838181e..9e49c2cc0550 100644 --- a/drivers/net/dsa/microchip/ksz8863_smi.c +++ b/drivers/net/dsa/microchip/ksz8863_smi.c @@ -152,11 +152,10 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev) ®map_smi[i], dev, &rc); if (IS_ERR(dev->regmap[i])) { - ret = PTR_ERR(dev->regmap[i]); - dev_err(&mdiodev->dev, - "Failed to initialize regmap%i: %d\n", - ksz8863_regmap_config[i].val_bits, ret); - return ret; + return dev_err_probe(&mdiodev->dev, + PTR_ERR(dev->regmap[i]) + "Failed to initialize regmap%i\n", + ksz8863_regmap_config[i].val_bits); } } diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c index caa9acf1495c..db4aec0a51dc 100644 --- a/drivers/net/dsa/microchip/ksz9477_i2c.c +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c @@ -30,11 +30,9 @@ static int ksz9477_i2c_probe(struct i2c_client *i2c, rc.lock_arg = &dev->regmap_mutex; dev->regmap[i] = devm_regmap_init_i2c(i2c, &rc); if (IS_ERR(dev->regmap[i])) { - ret = PTR_ERR(dev->regmap[i]); - dev_err(&i2c->dev, - "Failed to initialize regmap%i: %d\n", - ksz9477_regmap_config[i].val_bits, ret); - return ret; + return dev_err_probe(&i2c->dev, PTR_ERR(dev->regmap[i]), + "Failed to initialize regmap%i\n", + ksz9477_regmap_config[i].val_bits); } } diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c index 4f2186779082..96c52e8fb51b 100644 --- a/drivers/net/dsa/microchip/ksz_spi.c +++ b/drivers/net/dsa/microchip/ksz_spi.c @@ -71,11 +71,9 @@ static int ksz_spi_probe(struct spi_device *spi) dev->regmap[i] = devm_regmap_init_spi(spi, &rc); if (IS_ERR(dev->regmap[i])) { - ret = PTR_ERR(dev->regmap[i]); - dev_err(&spi->dev, - "Failed to initialize regmap%i: %d\n", - regmap_config[i].val_bits, ret); - return ret; + return dev_err_probe(&spi->dev, PTR_ERR(dev->regmap[i]), + "Failed to initialize regmap%i\n", + regmap_config[i].val_bits); } }