From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 621DD606A327 for ; Mon, 30 Nov 2026 03:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=3QuA5Ldm DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=qrLYWxSeTehteOqkoqmDySSetrnlScS9C1u2ze6rIdI=; b=3QuA5LdmGHnSpWodBW0FUjLGGA msFwpTn+6p8EtR7WDBOKRuRuyqxYGp+wVPnQuicEm2Mnb/k4VK3jLrxGog1nqqGtOz42XHiXraYIZ C3t/OQ3Iuv0gFiry492SGMtTpxkqUN0fvzUpGcb5J+U3difB+L3m0+Yb5lzvgBaHXEv2ZHf5GH/Nn 8Dl5MHdcyRYDgPeRCycGs1/Jf8U5CdZg/IHbXKYQJtgPzT6DMPflNJrwIv1EYCzYXqGQUfX0paA0k qZr4JV6/SuycCE5kU24VcdMl7A2GOSpDE1t3ETaP0OXr8JfM3rQt9rnD3E8MBQRhOg3vI0ayLh9wl GfcXtLOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXrun-000000034Rd-2bii; Mon, 30 Nov 2026 03:18:53 +0000 Received: from mail-koreacentralazlp170130006.outbound.protection.outlook.com ([2a01:111:f403:c40f::6] helo=SEYPR02CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXruJ-000000034I6-2zVM; Mon, 30 Nov 2026 03:18:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QmyH3Z6JRukr8t3NgnXv7sKyKkO7PdNRSZx5kW2XSk+/j63YHRqSawvJXikAF6J5TsYxudpGnHWwhEPwTBuHI0YfsUeeykbcFU0C0be8+Mo25mVGb+xcQSGq2woOR5pg8V9VMfZ6y4UDu7yvIHcOlogXpjFveFuS8TNvdZwJif+uCSRqdhtOOlCvg3qp2R4B557zHycRy3vc030QUAByApcHnRlEr4H+ta1ggCYm/4o2B0Yz7BwLVz/l/VFYu5id1AjldPPAZIfIAYnf948cYu0p5XnkgL26WNra/oDNSoZw9zVnSkhNUY/K9rW1r63ZWf4KG/OId3LZ6qDLZTHgwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qrLYWxSeTehteOqkoqmDySSetrnlScS9C1u2ze6rIdI=; b=ImyxHNs37aM2S29TC+dF4WK24SFeHoqgqQ3iQ0Bbd+Qy2AVO/uMySHBxdguL3UyHl+Lev/yqE5ChhuCh4mgDJiRa0WieKAzBu6B+gwI/psohaP0R47Z4t/2gWgWNXgwMnU/9HccRtGTafeSmNeUfKSsYRGmxhSDg5A2T+XWukJYiZF2Mti0pet9m9ywadRzKYMFIh1ZHqylgLJplsbJbBxwKneV4jaHWie+spJAPEurKWXPvKcz7SEpebpNM+69Xc4Mt6EWmeWYTvvbWa22dgPZzDNqvwNWES50S8T578sBkTUcJRImDTZbJ48Y1gTOxNFN0c/zP/jEWar7DHJ3fnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 222.71.101.198) smtp.rcpttodomain=cixtech.com smtp.mailfrom=cixtech.com; dmarc=bestguesspass action=none header.from=cixtech.com; dkim=none (message not signed); arc=none (0) Received: from SI1PR02CA0054.apcprd02.prod.outlook.com (2603:1096:4:1f5::13) by KUYPR06MB8747.apcprd06.prod.outlook.com (2603:1096:d10:8c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.9; Mon, 30 Nov 2026 03:18:13 +0000 Received: from SG2PEPF000B66CD.apcprd03.prod.outlook.com (2603:1096:4:1f5:cafe::14) by SI1PR02CA0054.outlook.office365.com (2603:1096:4:1f5::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.12 via Frontend Transport; Mon, 30 Nov 2026 03:18:13 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 222.71.101.198) smtp.mailfrom=cixtech.com; dkim=none (message not signed) header.d=none;dmarc=bestguesspass action=none header.from=cixtech.com; Received-SPF: Pass (protection.outlook.com: domain of cixtech.com designates 222.71.101.198 as permitted sender) receiver=protection.outlook.com; client-ip=222.71.101.198; helo=smtprelay.cixcomputing.com; pr=C Received: from smtprelay.cixcomputing.com (222.71.101.198) by SG2PEPF000B66CD.mail.protection.outlook.com (10.167.240.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Mon, 30 Nov 2026 03:18:13 +0000 Received: from gary-System-Product-Name (unknown [172.16.66.27]) by smtprelay.cixcomputing.com (Postfix) with ESMTPSA id B44D6427EFC7; Mon, 30 Nov 2026 11:18:12 +0800 (CST) Date: Mon, 30 Nov 2026 11:18:11 +0800 From: Gary Yang To: Manivannan Sadhasivam Cc: Vinod Koul , Neil Armstrong , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Fugang Duan , Luo Liu , CIX Linux Kernel Upstream Group , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] phy: cix: add Sky1 USB/DP combo PHY driver Message-ID: References: <20261102082112.2306326-1-gary.yang@cixtech.com> <20261117083434.3414417-1-gary.yang@cixtech.com> <20261117083434.3414417-3-gary.yang@cixtech.com> <179577770311.3421.6446368011498200273.b4-reply@b4> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <179577770311.3421.6446368011498200273.b4-reply@b4> X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66CD:EE_|KUYPR06MB8747:EE_ X-MS-Office365-Filtering-Correlation-Id: 66cab0a7-10b3-4b36-2d57-08df4e90919a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|23010399003|1800799024|82310400026|7416014|376014|10067099003|56012099006|261028144727099003|261026121527099003|261026140227099003|261102123227099003|261021121427099003|261021123027099003|261022105027099003|261022075727099003|261009223027099003|18002099003|22082099003|4143699003|6133799003; X-Microsoft-Antispam-Message-Info: XFCKErimZWj6MgX1bixQVpZ4lr/2NecjnkHxt77/IpU0ybWlEPR2mZqFyjgFEXTwKysys0liuKNlxOiYhXsqWSFefn+UvKoPgqPMDy6hK11VHrOKQdiuoikyI/4mtRO+I1KET47t2gHPn6k1lvbPHbsWi+3rl0aCOeHtBWxCF9z2IaZzKv9Y7cRcyl4Bs8/G0vldtkYmTgDh2S8OSENfbt3dcL4Q9GCl7v0oE+xbvVSplx7kmWViZyWLkK+3eq+57ZgyOf2nrrqvr0XKudfgYnmNbiV+yu5iIgdZ9jBEB66RWMj9WmG5jq3yqBBQt17Npc8CI/6XRn52Qh1xmKF5Cm+27GgumhCKrUgRJ2GU7VAPL786o0RRNzyoAYiufdnQkJw9hP8CSdbcCRi4K9NkHVkySC8/BVP2HHb9UtHIHGwLZTXmFSXtdtB/3KgTiqwxRwdP+YcYVOVDqtJtQM3hDArybKvwznjGUlRHyXcWPqwh5TNO8vudH5I7ITz24qolPq+2sIk9XcRIkKS1Xo150ag6KpKGmkKOOEUcwx/otwCKq22MDVHB1aVvjWfkRjd06jwss4Ntp5Vvx/yx1lAC0JARInWz573f7avF1Ayvl0vMEVGDRGt03gka/xQb0Eygk5PnxIV5Z6YCiM/kdvKcOIoeu/bI26k2IF30Ltqv0VKC5tEzOzcXwD3ojd0JNlVYLW/6y8daA2hnMOc6YlXFfA== X-Forefront-Antispam-Report: CIP:222.71.101.198;CTRY:CN;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:smtprelay.cixcomputing.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(23010399003)(1800799024)(82310400026)(7416014)(376014)(10067099003)(56012099006)(261028144727099003)(261026121527099003)(261026140227099003)(261102123227099003)(261021121427099003)(261021123027099003)(261022105027099003)(261022075727099003)(261009223027099003)(18002099003)(22082099003)(4143699003)(6133799003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w6KCpOHwsv9esJjt4v+ba4PCer+fvl1q6aB9Rzz86NNLvVt/yP3OsmLnWlUjzViFwJCdGViQKhpBx33Y2tYaX3ZBIxvnDY3UsFvQ1ZMS4ngEZ+oLwV/PBX4lCZkMsQuce/O8T7H8VOcKe5WNl2hHoTCeDb7BC7p2nRuX7zwsiekTHPGo7PNHt9uoKjO1ES/Ot1B7gtZSn8HKrFUwqe1lryIeTV2IKhZUus1UZIp7VhA+8W6X8O0b4/DjrNoiDHgn/d4vtcB/Nfavy6gFDEr0jJqiY5XrfJ1IvjB6zdDnaIBgIqLo9ddMqMqumJg/y3WOjOs8h34bnm1rK3FHWOLdQ3O3E2JhpsZpBSICxdlnYdJP9TK4DRrFM+vKuZFyGotjaVfYqqC6v6D16ohp9pJdJhaGA18cWUkmSYXxxOLvGVHlR3J98N0YoZUKisWd8ZJm X-OriginatorOrg: cixtech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 03:18:13.3247 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66cab0a7-10b3-4b36-2d57-08df4e90919a X-MS-Exchange-CrossTenant-Id: 0409f77a-e53d-4d23-943e-ccade7cb4811 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0409f77a-e53d-4d23-943e-ccade7cb4811;Ip=[222.71.101.198];Helo=[smtprelay.cixcomputing.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66CD.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: KUYPR06MB8747 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_191825_795237_5E9669EB X-CRM114-Status: GOOD ( 39.06 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 hi Manivannan: Thanks for your review. I'm glad to see your comments! On 2026-11-27 16:38, Manivannan Sadhasivam wrote: > EXTERNAL EMAIL > > On 2026-11-17 16:34 +0800, Gary Yang wrote: > > Add a driver for the USB/DP combo PHY found on the CIX Sky1 SoC. A > > single PHY instance drives one SuperSpeedPlus USB lane and up to four > > DisplayPort lanes of a USB Type-C port, and exposes them as two PHYs > > selected by PHY_TYPE_USB3 and PHY_TYPE_DP, so that the USB and DP > > controllers can bind to them independently. > > > > The PHY supports Type-C plug orientation switching, which is driven > > through the S5 system controller, and muxing of the PHY lanes between > > USB and DP, which is programmed in the PHY registers. It registers a > > Type-C switch and mux with the Type-C class, so the orientation and > > mode decisions are taken by the connector driver instead of the PHY. > > > > The shared PHY is programmed once per mode combination: the driver > > tracks the current and requested USB/DP mode as well as the plug > > orientation, and reprograms the PHY on the next power-on only when the > > mode combination or the orientation has changed. > > > > Reviewed-by: Fugang Duan > > Signed-off-by: Gary Yang > > --- > > MAINTAINERS | 4 +- > > drivers/phy/cix/Kconfig | 16 + > > drivers/phy/cix/Makefile | 1 + > > drivers/phy/cix/phy-cix-usbdp.c | 1422 +++++++++++++++++++++++++++++++ > > drivers/phy/cix/phy-cix-usbdp.h | 257 ++++++ > > 5 files changed, 1699 insertions(+), 1 deletion(-) > > create mode 100644 drivers/phy/cix/phy-cix-usbdp.c > > create mode 100644 drivers/phy/cix/phy-cix-usbdp.h > > [...] > > > +static inline void udphy_write(struct cix_udphy *udphy, u32 reg, u32 val) > > No 'inline' keyword in .c files please. Compilers will decide when to inline a > function. Same comment applies to other helpers. > > Besides, this function doesn't add any value. So drop it please. > Agree, we will drop it in next version > > +{ > > + writel(val, udphy->base + reg * 4); > > +} > > + > > +static inline void udphy_update_bits(struct cix_udphy *udphy, u32 reg, > > + u32 mask, u32 val) > > +{ > > + void __iomem *addr = udphy->base + reg * 4; > > + u32 tmp; > > + > > + tmp = readl(addr); > > + writel((tmp & ~mask) | (val & mask), addr); > > +} > > + > > +static inline void udphy_write_table(struct cix_udphy *udphy, > > + const struct reg_sequence *seq, > > + unsigned int num) > > +{ > > + unsigned int i; > > + > > + for (i = 0; i < num; i++) > > + udphy_write(udphy, seq[i].reg, seq[i].def); > > +} > > + > > +/* Link rate change */ > > +struct phy_link_cfg { > > + const struct reg_sequence *seq; > > + unsigned int num_seq; > > + u32 hsclk_div; > > + u32 clk_sel; > > + u32 pll_intdiv; > > + u32 pll_fracdivl; > > + u32 pll_high_thr; > > +}; > > + > > +static const struct phy_link_cfg link_cfg[] = { > > + { sky1_udphy_dp_partial_conf, ARRAY_SIZE(sky1_udphy_dp_partial_conf), > > + 0x0002, 0x0f01, 0x0195, 0x0000, 0x010e }, /* 1.62 Gbps */ > > + { sky1_udphy_dp_partial_conf, ARRAY_SIZE(sky1_udphy_dp_partial_conf), > > + 0x0001, 0x0701, 0x01c2, 0x0000, 0x012c }, /* 2.70 Gbps */ > > + { sky1_udphy_dp_partial_conf, ARRAY_SIZE(sky1_udphy_dp_partial_conf), > > + 0x0000, 0x0301, 0x01c2, 0x0000, 0x012c }, /* 5.40 Gbps */ > > + { sky1_udphy_dp_8p1_conf, ARRAY_SIZE(sky1_udphy_dp_8p1_conf), > > + 0x0000, 0x0200, 0x0151, 0x8000, 0x00e2 }, /* 8.10 Gbps */ > > +}; > > + > > +struct phy_voltage_conf { > > + u32 tx_txcc_ctrl; > > + u32 drv_diag_tx_drv; > > + u32 tx_txcc_mgnfc_mult_000; > > + u32 tx_txcc_cpost_mult_00; > > +}; > > + > > +static const struct phy_voltage_conf volt_cfg[] = { > > + { 0x08a4, 0x0003, 0x0028, 0x0000 }, /* swing level == 0 */ > > + { 0x08a4, 0x0003, 0x001f, 0x0014 }, > > + { 0x08a4, 0x0003, 0x0012, 0x0020 }, > > + { 0x08a4, 0x0003, 0x0000, 0x0027 }, > > + { 0x08a4, 0x0003, 0x001f, 0x0000 }, /* swing level == 1 */ > > + { 0x08a4, 0x0003, 0x0013, 0x0012 }, > > + { 0x08a4, 0x0003, 0x0000, 0x001f }, > > + { 0x08a4, 0x0003, 0x0000, 0x001f }, > > + { 0x08a4, 0x0003, 0x0013, 0x0000 }, /* swing level == 2 */ > > + { 0x08a4, 0x0003, 0x0000, 0x0013 }, > > + { 0x08a4, 0x0003, 0x0000, 0x0013 }, > > + { 0x08a4, 0x0003, 0x0000, 0x0013 }, > > + { 0x08a4, 0x0003, 0x0000, 0x0000 }, /* swing level == 3 */ > > + { 0x08a4, 0x0003, 0x0000, 0x0000 }, > > + { 0x08a4, 0x0003, 0x0000, 0x0000 }, > > + { 0x08a4, 0x0003, 0x0000, 0x0000 }, > > +}; > > + > > +static int udphy_dplane_get(struct cix_udphy *udphy) > > +{ > > + int dp_lanes; > > + > > + switch (udphy->next_mode) { > > + case UDPHY_MODE_DP: > > + dp_lanes = 4; > > + break; > > + case UDPHY_MODE_DP_USB: > > + dp_lanes = 2; > > + break; > > + case UDPHY_MODE_USB: > > + fallthrough; > > + default: > > + dp_lanes = 0; > > + break; > > + } > > + > > + return dp_lanes; > > +} > > + > > +static int sky1_udphy_clk_enable(struct clk *clk) > > +{ > > + int i, ret = -EBUSY; > > Why can't you return the actual error from clk_prepare_enable()? > Sorry for the confusion. That is just a default; it is later overwritten by the return value of clk_prepare_enable(), so the value actually returned is clk_prepare_enable()'s. I will drop the default in the next version to make this clearer. > > + > > + /* > > + * If the clock could not enable 10 iterations, > > + * it considers this clock is broken. > > Make use of full 80 columns for comments. > OK, we will fix it in next version > > + */ > > + for (i = 0; i < 10; i++) { > > + ret = clk_prepare_enable(clk); > > + if (!ret) > > + return 0; > > + > > + usleep_range(5000, 6000); > > + } > > + > > + return ret; > > +} > > + > > +static int sky1_udphy_exit(struct cix_udphy *udphy) > > +{ > > + reset_control_assert(udphy->reset); > > + reset_control_assert(udphy->preset); > > + clk_disable_unprepare(udphy->apb_clk); > > + return 0; > > +} > > + > > +static void sky1_udphy_set_orientation(struct cix_udphy *udphy) > > +{ > > + const struct cix_udphy_con_dir *con_dir = > > + &udphy->cfg->con_dir[udphy->id]; > > + > > + regmap_update_bits(udphy->usbphy_syscon, con_dir->offset, > > + GENMASK(con_dir->bit, con_dir->bit), > > + (u32)udphy->flip << con_dir->bit); > > + > > + usleep_range(10, 20); > > +} > > + > > +static void sky1_udphy_write_mode_table(struct cix_udphy *udphy) > > +{ > > + if (udphy->next_mode == UDPHY_MODE_DP) { > > + udphy_write_table(udphy, sky1_udphy_dp_conf, > > + ARRAY_SIZE(sky1_udphy_dp_conf)); > > + } else if (!udphy->flip) { > > + udphy_write_table(udphy, sky1_udphy_usbdp_conf_normal, > > + ARRAY_SIZE(sky1_udphy_usbdp_conf_normal)); > > + } else { > > + udphy_write_table(udphy, sky1_udphy_usbdp_conf_flip, > > + ARRAY_SIZE(sky1_udphy_usbdp_conf_flip)); > > + } > > +} > > + > > +/* Reprogram the PHY after the mode or the plug orientation has changed. */ > > +static int sky1_udphy_reinit(struct cix_udphy *udphy) > > +{ > > + sky1_udphy_set_orientation(udphy); > > + > > + /* > > + * The APB clock is still enabled, so the block can be reset without > > + * running the full power-on sequence again. > > + */ > > + reset_control_assert(udphy->reset); > > + reset_control_assert(udphy->preset); > > + reset_control_deassert(udphy->preset); > > + > > + sky1_udphy_write_mode_table(udphy); > > + > > + reset_control_deassert(udphy->reset); > > + > > + return 0; > > +} > > + > > +static int sky1_udphy_init(struct cix_udphy *udphy) > > +{ > > + int ret; > > + > > + sky1_udphy_set_orientation(udphy); > > + > > + /* usb rcsu reset is default deassert */ > > + reset_control_assert(udphy->reset); > > + reset_control_assert(udphy->preset); > > + > > + ret = sky1_udphy_clk_enable(udphy->apb_clk); > > + if (ret) { > > + dev_err(udphy->dev, "failed to enable APB clock\n"); > > + return ret; > > + } > > + > > + reset_control_deassert(udphy->preset); > > + > > + sky1_udphy_write_mode_table(udphy); > > + > > + reset_control_deassert(udphy->reset); > > + > > + return 0; > > +} > > + > > +static const struct cix_udphy_cfg sky1_udphy_cfg = { > > + .con_dir = sky1_udphy_con_dir, > > + .udphy_init = sky1_udphy_init, > > + .udphy_reinit = sky1_udphy_reinit, > > + .udphy_exit = sky1_udphy_exit > > +}; > > Do you really need per-device callbacks? Do you really forsee different devices > using different callbacks in the future? If not, I'd suggest to drop it. > Yes, this is an interface reserved for future combo PHYs, since different PHYs have different implementations of the PHY init() and exit() callbacks. I hope that makes sense. Thanks. > > + > > +static int udphy_orien_sw_set(struct typec_switch_dev *sw, > > + enum typec_orientation orien) > > +{ > > + struct cix_udphy *udphy = typec_switch_get_drvdata(sw); > > + bool flip; > > + > > + guard(mutex)(&udphy->mutex); > > + > > + if (orien == TYPEC_ORIENTATION_NONE) > > + return 0; > > + > > + flip = (orien == TYPEC_ORIENTATION_REVERSE); > > + if (udphy->flip != flip) { > > + dev_dbg(udphy->dev, "plug orientation changed, re-init required\n"); > > + udphy->needs_reinit = true; > > + } > > + > > + udphy->flip = flip; > > + > > + return 0; > > +} > > [...] > > > +static int cix_udphy_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct device_node *np = dev->of_node; > > + struct phy_provider *phy_provider; > > + struct cix_udphy *udphy; > > + u32 id; > > + int ret; > > + > > + udphy = devm_kzalloc(dev, sizeof(*udphy), GFP_KERNEL); > > + if (!udphy) > > + return -ENOMEM; > > + > > + dev_set_drvdata(dev, udphy); > > + udphy->dev = dev; > > + udphy_set_default_mode(udphy); > > + > > + udphy->usbphy_syscon = > > + syscon_regmap_lookup_by_phandle_args(np, "cix,usbphy-syscon", 1, > > + &id); > > + if (IS_ERR(udphy->usbphy_syscon)) > > + return dev_err_probe(dev, PTR_ERR(udphy->usbphy_syscon), > > + "failed to get usbphy syscon\n"); > > + > > + if (id >= ARRAY_SIZE(sky1_udphy_con_dir)) > > + return dev_err_probe(dev, -EINVAL, > > + "invalid usbphy syscon id\n"); > > + > > + udphy->id = id; > > + > > + udphy->cfg = device_get_match_data(dev); > > + if (!udphy->cfg) > > + return dev_err_probe(dev, -EINVAL, > > + "failed to get match data\n"); > > + > > + udphy->reset = devm_reset_control_get_exclusive(dev, "core"); > > + if (IS_ERR(udphy->reset)) > > + return dev_err_probe(dev, PTR_ERR(udphy->reset), > > + "failed to get reset\n"); > > + > > + udphy->preset = devm_reset_control_get_exclusive(dev, "apb"); > > + if (IS_ERR(udphy->preset)) > > + return dev_err_probe(dev, PTR_ERR(udphy->preset), > > + "failed to get preset\n"); > > + > > + reset_control_assert(udphy->reset); > > + reset_control_assert(udphy->preset); > > + > > + udphy->apb_clk = devm_clk_get(dev, NULL); > > + if (IS_ERR(udphy->apb_clk)) > > + return dev_err_probe(dev, PTR_ERR(udphy->apb_clk), > > + "failed to get APB clock\n"); > > + > > + udphy->base = devm_platform_ioremap_resource(pdev, 0); > > + if (IS_ERR(udphy->base)) > > + return dev_err_probe(dev, PTR_ERR(udphy->base), > > + "failed to remap registers\n"); > > + > > + mutex_init(&udphy->mutex); > > devm_mutex_init()? > Good idea. we will fix it as your suggestions. If I miss any your comments, please kindly remind me. Thanks Best Regards Gary > - Mani > > >