From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11011037.outbound.protection.outlook.com [52.101.65.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF62B42849E; Thu, 30 Apr 2026 11:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.37 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777547259; cv=fail; b=hr+XQapCBi5CFlYW8MN64tQBNapbY8iwgyRNI4a1y2BJXPUKt84kC+XPjCe/1/wM8R5n4dxBUfqSnc2MIv1qjtsWBx+vJq4ywMN5tNs4UWbbynYE/81Xjb8CPI9czuLTAdHFQ0hN7yx52PbpHNlcDq+M1KG5tyWPE2p9WoTqggg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777547259; c=relaxed/simple; bh=QatxSmDxVtJXEe4jnkIIsOQ34H9IKlvZCg2mchKWEN4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=GgxhU42AOxTF7927PT44/lVEULMiYy59RRoMEqZmZSFLPXlEnCGo+y7VuLrVKUrUZU0JsB84PIpVoH4S+Ep2ehz7WQLoN9JbA09CsjU+hcHY8RAjZI5nzctAQhxJipz6bm2pDGfx3BCGHWyxMTgbVKKxebHSRRL5qc8/w6mc6mU= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=i7nvdRWT; arc=fail smtp.client-ip=52.101.65.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="i7nvdRWT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w22ICt+7yOJvqMK+rEyMJOrWwizN05eGc8JEOHB4lfZtekcrx4kEd+FFxYd63K24UTvMlXLyGkOFTzPutRn7a5p8CkDK8b8YoyK4m1PRjfgdzcLXGwPlEJlqyEHbOShAj0bJrgJ+g/i0n7GG9/WUl7MOFiOjJ3KLhN4UytdR8iHKh1IpSrDK3qyu+E9oqog4pGxFlm9bUx8Y3K6Edn+Z5CyVEzl3w2jLS0ZnAZyaaNmyKxj1IABtUBRggCTtAYjgwh9nGWWvQIHrxERjCJFilYjc80n6gWvZVTk11MseJ8cc7C41pWdj5pwxuq8WjtyYGrPAaoqXcIxd7CuAov+RKg== 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=MZtThZR/dP1AUvbt7o1bCDZSur99EnBjciSZr5atMJo=; b=hnkmavhQnM9c7YW2n+DI6TWShNZkQIi1+OcXZNkyABF+et8YGfychuWUuR6cIv0HK0njRVxAyv4UHjxINh46Zt3piUScpLzz2kRdeGcSSE0FMMluWHUHFANmRVHe1m0v8D+mJiOLxaBVDYSPgy5DJK1o/KaIV4ZcYwCi4005GqHYug1iiumO9HmI3T7CDgQo5u3GrfrhVBCo7sQVGgl4w3DcBVczf0XfHr3fsmQX/hy5N39WYH4IyBIKBsYsYOICimbQujFfKvH3BG9/ussEhY6pYQKGgk+xIJmMdnmD+Wy0p5/TQy252D9Kx+XdUim6OBSjZlvflaYSTadarmRgCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MZtThZR/dP1AUvbt7o1bCDZSur99EnBjciSZr5atMJo=; b=i7nvdRWT+v3LvJGRNbjSF6bQzUxBhAiFfG2vPxMVgQC07iysJt+UYQ8sZgmMXnVHqv1/NJ/fRl8lUgovcayhKq5U5bLO/7zgasSey5rpJxlsFuSaWUAI0s2IL4jYnh5USyZfZeccGW6izHHx9AO9/phWJZXIbu20M3fO372kSNFocSr7DIc50Oj7cQo/G0nJ1IDGvu5gdDaQ1OXxy11BY8h2wvA7xsiJBrpZY38HrJL50MGDelVZMhdWz2q+wiQE27MnEhFIyP4oSSn0oL51y2AqPSOv+QNgfBRbInPQALqA3YEzizJaxvVUkifBzxP/taVaYyQH5Wq1v1PhKN8sJA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8585.eurprd04.prod.outlook.com (2603:10a6:20b:438::13) by VI1PR04MB7182.eurprd04.prod.outlook.com (2603:10a6:800:121::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9870.20; Thu, 30 Apr 2026 11:07:23 +0000 Received: from AM9PR04MB8585.eurprd04.prod.outlook.com ([fe80::f010:fca8:7ef:62f4]) by AM9PR04MB8585.eurprd04.prod.outlook.com ([fe80::f010:fca8:7ef:62f4%4]) with mapi id 15.20.9846.025; Thu, 30 Apr 2026 11:07:23 +0000 From: Vladimir Oltean To: linux-phy@lists.infradead.org Cc: Vinod Koul , Neil Armstrong , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-can@vger.kernel.org, linux-gpio@vger.kernel.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org, spacemit@lists.linux.dev, UNGLinuxDriver@microchip.com, Dmitry Baryshkov , Abhinav Kumar , Alexandre Belloni , =?UTF-8?q?Andr=C3=A9=20Draszik?= , Andrew Lunn , Andrzej Hajda , Andy Yan , Bjorn Helgaas , Chanho Park , Chen-Yu Tsai , Claudiu Beznea , Damien Le Moal , Daniel Machon , David Airlie , "David S. Miller" , Dmitry Baryshkov , Eric Dumazet , Fabio Estevam , Frank Li , Geert Uytterhoeven , Greg Kroah-Hartman , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Inki Dae , Jagan Teki , Jakub Kicinski , "James E.J. Bottomley" , JC Kuo , Jernej Skrabec , Jessica Zhang , Joe Perches , Johan Hovold , Jonas Karlman , Jonathan Hunter , Kevin Xie , Krzysztof Kozlowski , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Laurent Pinchart , Linus Walleij , Lorenzo Pieralisi , Maarten Lankhorst , Magnus Damm , Manivannan Sadhasivam , Marc Kleine-Budde , Marek Szyprowski , Marijn Suijten , Markus Schneider-Pargmann , "Martin K. Petersen" , Mathias Nyman , Mauro Carvalho Chehab , Maxime Ripard , Michael Dege , Nicolas Ferre , Niklas Cassel , Nitin Rawat , Paolo Abeni , Pengutronix Kernel Team , Peter Chen , Peter Griffin , Rob Clark , Robert Foss , Rob Herring , "Russell King (Oracle)" , Samuel Holland , Sandy Huang , Sascha Hauer , Sean Paul , Sebastian Reichel , Shawn Guo , Shawn Lin , Simona Vetter , Steen Hegelund , Thierry Reding , Thinh Nguyen , Thomas Zimmermann , Tudor Ambarus , Vincent Mailhol , Yixun Lan , Yoshihiro Shimoda Subject: [PATCH v7 phy-next 15/27] phy: move provider API out of public Date: Thu, 30 Apr 2026 14:06:40 +0300 Message-Id: <20260430110652.558622-16-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260430110652.558622-1-vladimir.oltean@nxp.com> References: <20260430110652.558622-1-vladimir.oltean@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AM8P251CA0029.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::34) To AM9PR04MB8585.eurprd04.prod.outlook.com (2603:10a6:20b:438::13) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8585:EE_|VI1PR04MB7182:EE_ X-MS-Office365-Filtering-Correlation-Id: f5da4610-e38d-412d-7171-08dea6a8a79a X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|7416014|376014|366016|19092799006|1800799024|13003099007|18002099003|18092099006|56012099003|22082099003; X-Microsoft-Antispam-Message-Info: x0BIleBYKGUrMW/AvVFEnzo+i1rwpZKlyxECGlzrG+R19Fe3F+5Ff6GizanOwJFkUq64w//KJxf+FOiBi1ZT0J+tps/ApitThh09emQQd3wChe00jPmQ77cYiyC5s4rfWOry9acksYi9W/C8h0agtPNvEZhCnnwLSQzGov9jRknAaam07WwvBrCzZ50e1xR5bNmuKyH8mXLo/yhXqXpCH9Qm7S/prJOfbOGL8Bhvb4GVGzoEI4CsInocMd6SlwLJLcy5ETlYw+WPY2SWBVLQ5ERyZvbjZ4DebkLRUWTLi2cP4iEvsdUNXFw0HmMCugUG33LEmuyePABu2Np1rELb4xJYSENdqBN/t6IGnfEB4lcSB6AuQwu7cL7Lc/v5jvlTRSNG4WgTd7Q4iEVAATTjX494rD2sD7Ip7cqbXD4A903ny///HyhBFwywmFohSGNPbiKaTXHZSw6Ah74oe9RETe2quEjowN1CcM82eB4QzTzFU6CM741WPqNY62JuQJjhqE8HSwquR4t0O/PKAj6yqdgO4SY6B93fC5GY/o6uhXicQpfMNwFuMSvC7Q72L4yIObW4gTq/E4X0QpFRGV7VSoTgBoWr47NdiAmTBsusU1+Cs5XkI5RCEPBKRZitM1b/PHS/NratTy/wjP9azVpyVWdoubMvjwtT3Gb10v7berWxJ2MZruSzf05MCDRqVLgI X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8585.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(10070799003)(7416014)(376014)(366016)(19092799006)(1800799024)(13003099007)(18002099003)(18092099006)(56012099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eG9uZTNhS1g5c0hJcFpUaFRrenEzZ09Wd3MrWG04SFBuYW1EK1NycGFEYzlu?= =?utf-8?B?VUV6NysweGlObjVHbzhrNHZpeFE3WExxSlI3N2lkdjd4VU9VeUh4V1QzcG55?= =?utf-8?B?dGlPemV4QzhrYzdsU2MzY1FlcFl5VVlOVHp2dEwweGZWZE1VczY5bW5tancz?= =?utf-8?B?d2lsT25nNlZaYmRrbHhNQlZYbWdxT1IzRHQ2SEQ1dDlpUTdWMldKKzZaeFYv?= =?utf-8?B?SWRFWUZWMGFjUnhWeFd1NFY2a2l0VnhwWUhSNHdudCtScVJLQlFZRTVQY0Mx?= =?utf-8?B?MmZzTndtakFVUlNDQ0VOV3FBdGMxZlJSSGIwcXNjNnloa3NDd2RVZ0tzNVlX?= =?utf-8?B?bVovMGZUUVVVMi9vV2tSdnI2ZHdRa3I1K1ovNk5VS1Z0YkRRbE11UEY0NENv?= =?utf-8?B?cDkvd0hiSkJjUExNa0hmcGJxZ0pkeWtCZjB0M3pROTFXc28zbXUxVXRwcG0z?= =?utf-8?B?MFlFNytLdExlenAwT3RBZDdnTnAwNEJIeTFTL0w4Z1V6WC8zcjNDYUNjeEsv?= =?utf-8?B?L1dPNmVDN09CQ01WVUwwMHV4QzBld0d5dHBhVmRpd2FKY1c3Qk92cnNjK09n?= =?utf-8?B?cThkSXVNcHVqL1NyMHc0WWl6UVB6UDNVV1B1Y2p5Wjg3UXgxdnJKOTlSanVl?= =?utf-8?B?RTVaL3A5VHFMc25PV1dyeWpZa2FlUnZaZXZjcXFtb2JYamR4V1VLanUyZmFN?= =?utf-8?B?RFcyY29zSW1RNEp5OWZQajZXSTRmdStkanZ5NERiZnRtMVVwSFJvcUd2MnBk?= =?utf-8?B?TGxPR0E2WXYrU1hLdmNBUC9mY05MRU1hOW1aampmZU5kRURwb2VncERxeFBu?= =?utf-8?B?STNtZTZUWUtZMHk5czFZSnpQZU1PNUhzU0NXbGk4LzY3L3BSMVdtY05sYXN2?= =?utf-8?B?aXlMbG9ibk41OWhuSlBDTTNvS002ZGZjRXFEaXZqYWR0NFh1TXFldFlNSktq?= =?utf-8?B?MGVxYThzME42b0xjRlgvTUFsVWFhUjBkSEhOT0w0OFVGOCtGL3BnQkFwdDlK?= =?utf-8?B?WEhJZjZlN1NibS9hN1Q1RFpkN2pBZEhyV1JWUERiaVRnbTNqVEd3ME0zMkNG?= =?utf-8?B?U0FlYk5aWHg3NThMekpleUV5SE9LNm83Y2hOdnJNNGplSE5yVC96YktQbW5l?= =?utf-8?B?Q3ZyamJJaTIrY2hpWnFnb3JiRjN5dnY1UnNvSzNGRzBuS2JXVkZBemJuUGxB?= =?utf-8?B?NTh3cWY3VFNPcFZWL3Jkak52RE5WTnJqZlJJcWZidTlJMFNGbERBUithM1Rp?= =?utf-8?B?K3RPaHBHdDhqNFpXUjU0NldIbkl2cHJBT2IvNlUwRGMvZUlGS0xjeTRlRnNn?= =?utf-8?B?MlJ3WTZzUklRYUNQdElpZEFvZ3NuaTMxMXpvQXBaemZHdXp0WU1TMFVLNzBC?= =?utf-8?B?WVlITkxUUWErMDdyenpaV0ZqM3BvWGx0NHQ2NGszOWt4b3ArSGt4U21aYzln?= =?utf-8?B?WkFRTWtzSEJFNEQ1SmdXN0lDR2d1bXNRdENIVW5sTjVwNDRUQVd1cnV5NUx3?= =?utf-8?B?azdXeGF4M2NmYXFIWEpmcGk0QTBSYkphcUxlSm5TQ2xRajFwZ0hwR3FBMVdN?= =?utf-8?B?RUNtVFZkV1dMMFQvQThvWGRhbGFlZTBjckpacUo1RldxTzBldEJrcWh0SkR3?= =?utf-8?B?eDE2RURzbHJoMW5YdUFlSVcrT0E4Ykx5TThSdFBsVHc5RHVhUFBpcGRnMXMx?= =?utf-8?B?SXFDZzRnbTRqcm8xSGxjKzc2YmFQUVpwaHA5amFvQjg0N28wcnQrRlFBQVdM?= =?utf-8?B?ZnJ4QWk0ekVlTWpaWXFaekZPa0J4QUNmdGpCUVNRUk1ybXNkNmpVTzhsRzFn?= =?utf-8?B?dDAxODVaWWZHTUUvYUdWYWh2Z1lwenY2OEFCbzcydkdyNjRRNnZvWUp3Vmxv?= =?utf-8?B?eTk4K3ZEalpTSDcyOUxJdkFSd3FEMUtldHo5K0tWSUhIcnNIRVFaNDg2WElh?= =?utf-8?B?c2xxOHY4OGY3dGV0c09WY2ZkeFNEcVNnd3ZhYjVBd051emJiZk41bjJsV1Zm?= =?utf-8?B?UFFDMUlha3pFb2hTQ3NML0hpQnhLZ3gyRzJrMHE1MkdCZ1lyU3E5bG95OURE?= =?utf-8?B?SVgzV3EvYkljdlNOU01wTDFCQzAyRG1XV1UzWllZVWtqbXpOVDhUakNmREx5?= =?utf-8?B?NEhhcSsvZVExZmZybHBMSkFZMFpLdjZBR3dkZGdzQ1UvQzZXMlFPTXNGb0pP?= =?utf-8?B?NzZSMCtnSng5c2t2S0p1SFduMkMrWE1TWlJGUHRyQnloL0piNzRMbFNFb2Nr?= =?utf-8?B?aS9Ca3JXbm9jRHNrQ09wZU83RG4wdGM2MnZpZUZZbXJNUEQxY1QyV0xUaEhZ?= =?utf-8?B?QnJZbktwNmtYOVQ1TG9qYW5vSzBFOENqckxOYjNpcWgwNmZUZ1k0am5LQktU?= =?utf-8?Q?7UzDQOCC5QGmr2dc7haqG0v7AwQrUqWKuKSul?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5da4610-e38d-412d-7171-08dea6a8a79a X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8585.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2026 11:07:23.3175 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1zzdkdUiKynQyOS+K06uquPlKUoI0PWSUOz+GfA7QcJztWjqW/bgoQN6MU25Hn6y1EEL9S/OA/kt7wTCORGRWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7182 The major goal is to hide the contents of struct phy from consumer drivers. The idea with "phy-props.h" is that both consumers and providers make use of some data types. So both headers include "phy-props.h". Some slight points of contention. 1. phy_set_bus_width(): Vinod explains that despite the current caller situation (9 providers, 1 consumer), it is a consumer API function. The use case is that the controller (for example UFS) may have limitations and should set the expected lanes to be used and width on those lanes. A number of Generic PHYs can support multiple lanes and multiple width so this is way for controller telling I am using this configuration. 2. phy-provider.h should go to include/linux/phy/ or to drivers/phy/? We do have 3 PHY providers outside of drivers/phy/: drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c drivers/pinctrl/tegra/pinctrl-tegra-xusb.c but the practice is not encouraged, and with time, these should be moved to the subsystem. This is not something that I can do now. 3. We can no longer tolerate static inline helpers. Allowing these would make it impossible to hide the struct phy definition from consumers. I've made phy_get_mode(), phy_get_bus_width(), phy_set_bus_width() exported symbols in drivers/phy/phy-core.c. 4. This is not a change without side effects. In the transition we are no longer providing at all, and to PHY consumer drivers. However, the in-tree dependencies should all have been resolved. Also, the movement of phy-provider.h to drivers/phy/ is at least "interesting" for out of tree PHY provider drivers (this header is not deployed by make headers_install). However, it seems to be what Vinod is looking to see. For temporary compatibility, keep including the provider header. This will be removed when abuses are all gotten rid of. Signed-off-by: Vladimir Oltean Reviewed-by: Dmitry Baryshkov --- Cc: Abhinav Kumar Cc: Alexandre Belloni Cc: "André Draszik" Cc: Andrew Lunn Cc: Andrzej Hajda Cc: Andy Yan Cc: Bjorn Helgaas Cc: Chanho Park Cc: Chen-Yu Tsai Cc: Claudiu Beznea Cc: Damien Le Moal Cc: Daniel Machon Cc: David Airlie Cc: "David S. Miller" Cc: Dmitry Baryshkov Cc: Eric Dumazet Cc: Fabio Estevam Cc: Frank Li Cc: Geert Uytterhoeven Cc: Greg Kroah-Hartman Cc: "Heiko Stübner" Cc: Inki Dae Cc: Jagan Teki Cc: Jakub Kicinski Cc: "James E.J. Bottomley" Cc: JC Kuo Cc: Jernej Skrabec Cc: Jessica Zhang Cc: Joe Perches Cc: Johan Hovold Cc: Jonas Karlman Cc: Jonathan Hunter Cc: Kevin Xie Cc: Krzysztof Kozlowski Cc: "Krzysztof Wilczyński" Cc: Laurent Pinchart Cc: Linus Walleij Cc: Lorenzo Pieralisi Cc: Maarten Lankhorst Cc: Magnus Damm Cc: Manivannan Sadhasivam Cc: Marc Kleine-Budde Cc: Marek Szyprowski Cc: Marijn Suijten Cc: Markus Schneider-Pargmann Cc: "Martin K. Petersen" Cc: Mathias Nyman Cc: Mauro Carvalho Chehab Cc: Maxime Ripard Cc: Michael Dege Cc: Neil Armstrong Cc: Nicolas Ferre Cc: Niklas Cassel Cc: Nitin Rawat Cc: Paolo Abeni Cc: Pengutronix Kernel Team Cc: Peter Chen Cc: Peter Griffin Cc: Rob Clark Cc: Robert Foss Cc: Rob Herring Cc: "Russell King (Oracle)" Cc: Samuel Holland Cc: Sandy Huang Cc: Sascha Hauer Cc: Sean Paul Cc: Sebastian Reichel Cc: Shawn Guo Cc: Shawn Lin Cc: Simona Vetter Cc: Steen Hegelund Cc: Thierry Reding Cc: Thinh Nguyen Cc: Thomas Zimmermann Cc: Tudor Ambarus Cc: Vincent Mailhol Cc: Yixun Lan Cc: Yoshihiro Shimoda v2->v7: none v1->v2: - collect tag - fix path to phy-provider.h - update commit message with the 4th point of contention --- drivers/phy/phy-core.c | 34 +++ drivers/phy/phy-provider.h | 256 +++++++++++++++++ include/linux/phy/phy-props.h | 75 +++++ include/linux/phy/phy.h | 497 +++++++--------------------------- 4 files changed, 456 insertions(+), 406 deletions(-) create mode 100644 drivers/phy/phy-provider.h create mode 100644 include/linux/phy/phy-props.h diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 21aaf2f76e53..a1aff00fba7c 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -20,6 +20,22 @@ #include #include +#define to_phy(a) (container_of((a), struct phy, dev)) + +/** + * struct phy_lookup - PHY association in list of phys managed by the phy driver + * @node: list node + * @dev_id: the device of the association + * @con_id: connection ID string on device + * @phy: the phy of the association + */ +struct phy_lookup { + struct list_head node; + const char *dev_id; + const char *con_id; + struct phy *phy; +}; + static void phy_release(struct device *dev); static const struct class phy_class = { .name = "phy", @@ -606,6 +622,24 @@ int phy_validate(struct phy *phy, enum phy_mode mode, int submode, } EXPORT_SYMBOL_GPL(phy_validate); +enum phy_mode phy_get_mode(struct phy *phy) +{ + return phy->attrs.mode; +} +EXPORT_SYMBOL_GPL(phy_get_mode); + +int phy_get_bus_width(struct phy *phy) +{ + return phy->attrs.bus_width; +} +EXPORT_SYMBOL_GPL(phy_get_bus_width); + +void phy_set_bus_width(struct phy *phy, int bus_width) +{ + phy->attrs.bus_width = bus_width; +} +EXPORT_SYMBOL_GPL(phy_set_bus_width); + /** * _of_phy_get() - lookup and obtain a reference to a phy by phandle * @np: device_node for which to get the phy diff --git a/drivers/phy/phy-provider.h b/drivers/phy/phy-provider.h new file mode 100644 index 000000000000..0637278a2d8d --- /dev/null +++ b/drivers/phy/phy-provider.h @@ -0,0 +1,256 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * phy-provider.h -- Generic PHY provider API + * + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com + * + * Author: Kishon Vijay Abraham I + */ +#ifndef __PHY_PROVIDER_H +#define __PHY_PROVIDER_H + +#include +#include +#include +#include +#include + +struct phy; + +/** + * struct phy_ops - set of function pointers for performing phy operations + * @init: operation to be performed for initializing phy + * @exit: operation to be performed while exiting + * @power_on: powering on the phy + * @power_off: powering off the phy + * @set_mode: set the mode of the phy + * @set_media: set the media type of the phy (optional) + * @set_speed: set the speed of the phy (optional) + * @reset: resetting the phy + * @calibrate: calibrate the phy + * @notify_phystate: notify and configure the phy for a particular state + * @release: ops to be performed while the consumer relinquishes the PHY + * @owner: the module owner containing the ops + */ +struct phy_ops { + int (*init)(struct phy *phy); + int (*exit)(struct phy *phy); + int (*power_on)(struct phy *phy); + int (*power_off)(struct phy *phy); + int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode); + int (*set_media)(struct phy *phy, enum phy_media media); + int (*set_speed)(struct phy *phy, int speed); + + /** + * @configure: + * + * Optional. + * + * Used to change the PHY parameters. phy_init() must have + * been called on the phy. + * + * Returns: 0 if successful, an negative error code otherwise + */ + int (*configure)(struct phy *phy, union phy_configure_opts *opts); + + /** + * @validate: + * + * Optional. + * + * Used to check that the current set of parameters can be + * handled by the phy. Implementations are free to tune the + * parameters passed as arguments if needed by some + * implementation detail or constraints. It must not change + * any actual configuration of the PHY, so calling it as many + * times as deemed fit by the consumer must have no side + * effect. + * + * Returns: 0 if the configuration can be applied, an negative + * error code otherwise + */ + int (*validate)(struct phy *phy, enum phy_mode mode, int submode, + union phy_configure_opts *opts); + int (*reset)(struct phy *phy); + int (*calibrate)(struct phy *phy); + + /* notify phy connect status change */ + int (*connect)(struct phy *phy, int port); + int (*disconnect)(struct phy *phy, int port); + + int (*notify_phystate)(struct phy *phy, union phy_notify state); + void (*release)(struct phy *phy); + struct module *owner; +}; + +/** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + * @max_link_rate: Maximum link rate supported by PHY (units to be decided by producer and consumer) + * @mode: PHY mode + */ +struct phy_attrs { + u32 bus_width; + u32 max_link_rate; + enum phy_mode mode; +}; + +/** + * struct phy - represents the phy device + * @dev: phy device + * @id: id of the phy device + * @ops: function pointers for performing phy operations + * @mutex: mutex to protect phy_ops + * @lockdep_key: lockdep information for this mutex + * @init_count: used to protect when the PHY is used by multiple consumers + * @power_count: used to protect when the PHY is used by multiple consumers + * @attrs: used to specify PHY specific attributes + * @pwr: power regulator associated with the phy + * @debugfs: debugfs directory + */ +struct phy { + struct device dev; + int id; + const struct phy_ops *ops; + struct mutex mutex; + struct lock_class_key lockdep_key; + int init_count; + int power_count; + struct phy_attrs attrs; + struct regulator *pwr; + struct dentry *debugfs; +}; + +/** + * struct phy_provider - represents the phy provider + * @dev: phy provider device + * @children: can be used to override the default (dev->of_node) child node + * @owner: the module owner having of_xlate + * @list: to maintain a linked list of PHY providers + * @of_xlate: function pointer to obtain phy instance from phy pointer + */ +struct phy_provider { + struct device *dev; + struct device_node *children; + struct module *owner; + struct list_head list; + struct phy *(*of_xlate)(struct device *dev, + const struct of_phandle_args *args); +}; + +#define of_phy_provider_register(dev, xlate) \ + __of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) + +#define devm_of_phy_provider_register(dev, xlate) \ + __devm_of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) + +#define of_phy_provider_register_full(dev, children, xlate) \ + __of_phy_provider_register(dev, children, THIS_MODULE, xlate) + +#define devm_of_phy_provider_register_full(dev, children, xlate) \ + __devm_of_phy_provider_register(dev, children, THIS_MODULE, xlate) + +static inline void phy_set_drvdata(struct phy *phy, void *data) +{ + dev_set_drvdata(&phy->dev, data); +} + +static inline void *phy_get_drvdata(struct phy *phy) +{ + return dev_get_drvdata(&phy->dev); +} + +#if IS_ENABLED(CONFIG_GENERIC_PHY) +struct phy *phy_create(struct device *dev, struct device_node *node, + const struct phy_ops *ops); +struct phy *devm_phy_create(struct device *dev, struct device_node *node, + const struct phy_ops *ops); +void phy_destroy(struct phy *phy); +void devm_phy_destroy(struct device *dev, struct phy *phy); + +struct phy_provider * +__of_phy_provider_register(struct device *dev, struct device_node *children, + struct module *owner, + struct phy *(*of_xlate)(struct device *dev, + const struct of_phandle_args *args)); +struct phy_provider * +__devm_of_phy_provider_register(struct device *dev, struct device_node *children, + struct module *owner, + struct phy *(*of_xlate)(struct device *dev, + const struct of_phandle_args *args)); +void of_phy_provider_unregister(struct phy_provider *phy_provider); +void devm_of_phy_provider_unregister(struct device *dev, + struct phy_provider *phy_provider); +int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id); +void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id); +struct phy *of_phy_simple_xlate(struct device *dev, + const struct of_phandle_args *args); +#else +static inline struct phy *phy_create(struct device *dev, + struct device_node *node, + const struct phy_ops *ops) +{ + return ERR_PTR(-ENOSYS); +} + +static inline struct phy *devm_phy_create(struct device *dev, + struct device_node *node, + const struct phy_ops *ops) +{ + return ERR_PTR(-ENOSYS); +} + +static inline void phy_destroy(struct phy *phy) +{ +} + +static inline void devm_phy_destroy(struct device *dev, struct phy *phy) +{ +} + +static inline struct phy_provider * +__of_phy_provider_register(struct device *dev, struct device_node *children, + struct module *owner, + struct phy *(*of_xlate)(struct device *dev, + const struct of_phandle_args *args)) +{ + return ERR_PTR(-ENOSYS); +} + +static inline struct phy_provider * +__devm_of_phy_provider_register(struct device *dev, struct device_node *children, + struct module *owner, + struct phy *(*of_xlate)(struct device *dev, + const struct of_phandle_args *args)) +{ + return ERR_PTR(-ENOSYS); +} + +static inline void of_phy_provider_unregister(struct phy_provider *phy_provider) +{ +} + +static inline void devm_of_phy_provider_unregister(struct device *dev, + struct phy_provider *phy_provider) +{ +} + +static inline int phy_create_lookup(struct phy *phy, const char *con_id, + const char *dev_id) +{ + return 0; +} + +static inline void phy_remove_lookup(struct phy *phy, const char *con_id, + const char *dev_id) +{ +} + +static inline struct phy *of_phy_simple_xlate(struct device *dev, + const struct of_phandle_args *args) +{ + return ERR_PTR(-ENOSYS); +} +#endif /* IS_ENABLED(CONFIG_GENERIC_PHY) */ + +#endif /* __PHY_PROVIDER_H */ diff --git a/include/linux/phy/phy-props.h b/include/linux/phy/phy-props.h new file mode 100644 index 000000000000..11f36738165f --- /dev/null +++ b/include/linux/phy/phy-props.h @@ -0,0 +1,75 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * phy-provider.h -- Generic PHY properties + * + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com + * + * Author: Kishon Vijay Abraham I + */ +#ifndef __PHY_PROPS_H +#define __PHY_PROPS_H + +#include +#include +#include +#include + +enum phy_mode { + PHY_MODE_INVALID, + PHY_MODE_USB_HOST, + PHY_MODE_USB_HOST_LS, + PHY_MODE_USB_HOST_FS, + PHY_MODE_USB_HOST_HS, + PHY_MODE_USB_HOST_SS, + PHY_MODE_USB_DEVICE, + PHY_MODE_USB_DEVICE_LS, + PHY_MODE_USB_DEVICE_FS, + PHY_MODE_USB_DEVICE_HS, + PHY_MODE_USB_DEVICE_SS, + PHY_MODE_USB_OTG, + PHY_MODE_UFS_HS_A, + PHY_MODE_UFS_HS_B, + PHY_MODE_PCIE, + PHY_MODE_ETHERNET, + PHY_MODE_MIPI_DPHY, + PHY_MODE_SATA, + PHY_MODE_LVDS, + PHY_MODE_DP, + PHY_MODE_HDMI, +}; + +enum phy_media { + PHY_MEDIA_DEFAULT, + PHY_MEDIA_SR, + PHY_MEDIA_DAC, +}; + +enum phy_ufs_state { + PHY_UFS_HIBERN8_ENTER, + PHY_UFS_HIBERN8_EXIT, +}; + +union phy_notify { + enum phy_ufs_state ufs_state; +}; + +/** + * union phy_configure_opts - Opaque generic phy configuration + * + * @mipi_dphy: Configuration set applicable for phys supporting + * the MIPI_DPHY phy mode. + * @dp: Configuration set applicable for phys supporting + * the DisplayPort protocol. + * @lvds: Configuration set applicable for phys supporting + * the LVDS phy mode. + * @hdmi: Configuration set applicable for phys supporting + * the HDMI phy mode. + */ +union phy_configure_opts { + struct phy_configure_opts_mipi_dphy mipi_dphy; + struct phy_configure_opts_dp dp; + struct phy_configure_opts_lvds lvds; + struct phy_configure_opts_hdmi hdmi; +}; + +#endif /* __PHY_PROPS_H */ diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index ea47975e288a..f208edd25afe 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -1,246 +1,38 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ /* - * phy.h -- generic phy header file + * phy.h -- Generic PHY consumer API * * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com * * Author: Kishon Vijay Abraham I */ -#ifndef __DRIVERS_PHY_H -#define __DRIVERS_PHY_H +#ifndef __PHY_CONSUMER_H +#define __PHY_CONSUMER_H -#include -#include -#include -#include -#include +#include -#include -#include -#include -#include +#include "../../../drivers/phy/phy-provider.h" +struct device; +struct device_node; struct phy; -enum phy_mode { - PHY_MODE_INVALID, - PHY_MODE_USB_HOST, - PHY_MODE_USB_HOST_LS, - PHY_MODE_USB_HOST_FS, - PHY_MODE_USB_HOST_HS, - PHY_MODE_USB_HOST_SS, - PHY_MODE_USB_DEVICE, - PHY_MODE_USB_DEVICE_LS, - PHY_MODE_USB_DEVICE_FS, - PHY_MODE_USB_DEVICE_HS, - PHY_MODE_USB_DEVICE_SS, - PHY_MODE_USB_OTG, - PHY_MODE_UFS_HS_A, - PHY_MODE_UFS_HS_B, - PHY_MODE_PCIE, - PHY_MODE_ETHERNET, - PHY_MODE_MIPI_DPHY, - PHY_MODE_SATA, - PHY_MODE_LVDS, - PHY_MODE_DP, - PHY_MODE_HDMI, -}; - -enum phy_media { - PHY_MEDIA_DEFAULT, - PHY_MEDIA_SR, - PHY_MEDIA_DAC, -}; - -enum phy_ufs_state { - PHY_UFS_HIBERN8_ENTER, - PHY_UFS_HIBERN8_EXIT, -}; - -union phy_notify { - enum phy_ufs_state ufs_state; -}; - -/** - * union phy_configure_opts - Opaque generic phy configuration - * - * @mipi_dphy: Configuration set applicable for phys supporting - * the MIPI_DPHY phy mode. - * @dp: Configuration set applicable for phys supporting - * the DisplayPort protocol. - * @lvds: Configuration set applicable for phys supporting - * the LVDS phy mode. - * @hdmi: Configuration set applicable for phys supporting - * the HDMI phy mode. - */ -union phy_configure_opts { - struct phy_configure_opts_mipi_dphy mipi_dphy; - struct phy_configure_opts_dp dp; - struct phy_configure_opts_lvds lvds; - struct phy_configure_opts_hdmi hdmi; -}; - -/** - * struct phy_ops - set of function pointers for performing phy operations - * @init: operation to be performed for initializing phy - * @exit: operation to be performed while exiting - * @power_on: powering on the phy - * @power_off: powering off the phy - * @set_mode: set the mode of the phy - * @set_media: set the media type of the phy (optional) - * @set_speed: set the speed of the phy (optional) - * @reset: resetting the phy - * @calibrate: calibrate the phy - * @notify_phystate: notify and configure the phy for a particular state - * @release: ops to be performed while the consumer relinquishes the PHY - * @owner: the module owner containing the ops - */ -struct phy_ops { - int (*init)(struct phy *phy); - int (*exit)(struct phy *phy); - int (*power_on)(struct phy *phy); - int (*power_off)(struct phy *phy); - int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode); - int (*set_media)(struct phy *phy, enum phy_media media); - int (*set_speed)(struct phy *phy, int speed); - - /** - * @configure: - * - * Optional. - * - * Used to change the PHY parameters. phy_init() must have - * been called on the phy. - * - * Returns: 0 if successful, an negative error code otherwise - */ - int (*configure)(struct phy *phy, union phy_configure_opts *opts); - - /** - * @validate: - * - * Optional. - * - * Used to check that the current set of parameters can be - * handled by the phy. Implementations are free to tune the - * parameters passed as arguments if needed by some - * implementation detail or constraints. It must not change - * any actual configuration of the PHY, so calling it as many - * times as deemed fit by the consumer must have no side - * effect. - * - * Returns: 0 if the configuration can be applied, an negative - * error code otherwise - */ - int (*validate)(struct phy *phy, enum phy_mode mode, int submode, - union phy_configure_opts *opts); - int (*reset)(struct phy *phy); - int (*calibrate)(struct phy *phy); - - /* notify phy connect status change */ - int (*connect)(struct phy *phy, int port); - int (*disconnect)(struct phy *phy, int port); - - int (*notify_phystate)(struct phy *phy, union phy_notify state); - void (*release)(struct phy *phy); - struct module *owner; -}; - -/** - * struct phy_attrs - represents phy attributes - * @bus_width: Data path width implemented by PHY - * @max_link_rate: Maximum link rate supported by PHY (units to be decided by producer and consumer) - * @mode: PHY mode - */ -struct phy_attrs { - u32 bus_width; - u32 max_link_rate; - enum phy_mode mode; -}; - -/** - * struct phy - represents the phy device - * @dev: phy device - * @id: id of the phy device - * @ops: function pointers for performing phy operations - * @mutex: mutex to protect phy_ops - * @lockdep_key: lockdep information for this mutex - * @init_count: used to protect when the PHY is used by multiple consumers - * @power_count: used to protect when the PHY is used by multiple consumers - * @attrs: used to specify PHY specific attributes - * @pwr: power regulator associated with the phy - * @debugfs: debugfs directory - */ -struct phy { - struct device dev; - int id; - const struct phy_ops *ops; - struct mutex mutex; - struct lock_class_key lockdep_key; - int init_count; - int power_count; - struct phy_attrs attrs; - struct regulator *pwr; - struct dentry *debugfs; -}; - -/** - * struct phy_provider - represents the phy provider - * @dev: phy provider device - * @children: can be used to override the default (dev->of_node) child node - * @owner: the module owner having of_xlate - * @list: to maintain a linked list of PHY providers - * @of_xlate: function pointer to obtain phy instance from phy pointer - */ -struct phy_provider { - struct device *dev; - struct device_node *children; - struct module *owner; - struct list_head list; - struct phy * (*of_xlate)(struct device *dev, - const struct of_phandle_args *args); -}; - -/** - * struct phy_lookup - PHY association in list of phys managed by the phy driver - * @node: list node - * @dev_id: the device of the association - * @con_id: connection ID string on device - * @phy: the phy of the association - */ -struct phy_lookup { - struct list_head node; - const char *dev_id; - const char *con_id; - struct phy *phy; -}; - -#define to_phy(a) (container_of((a), struct phy, dev)) - -#define of_phy_provider_register(dev, xlate) \ - __of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) - -#define devm_of_phy_provider_register(dev, xlate) \ - __devm_of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) - -#define of_phy_provider_register_full(dev, children, xlate) \ - __of_phy_provider_register(dev, children, THIS_MODULE, xlate) - -#define devm_of_phy_provider_register_full(dev, children, xlate) \ - __devm_of_phy_provider_register(dev, children, THIS_MODULE, xlate) - -static inline void phy_set_drvdata(struct phy *phy, void *data) -{ - dev_set_drvdata(&phy->dev, data); -} - -static inline void *phy_get_drvdata(struct phy *phy) -{ - return dev_get_drvdata(&phy->dev); -} - #if IS_ENABLED(CONFIG_GENERIC_PHY) +struct phy *phy_get(struct device *dev, const char *string); +struct phy *devm_phy_get(struct device *dev, const char *string); +struct phy *devm_phy_optional_get(struct device *dev, const char *string); +struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, + const char *con_id); +struct phy *devm_of_phy_optional_get(struct device *dev, struct device_node *np, + const char *con_id); +struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, + int index); +void of_phy_put(struct phy *phy); +void phy_put(struct device *dev, struct phy *phy); +void devm_phy_put(struct device *dev, struct phy *phy); +struct phy *of_phy_get(struct device_node *np, const char *con_id); + int phy_pm_runtime_get(struct phy *phy); int phy_pm_runtime_get_sync(struct phy *phy); void phy_pm_runtime_put(struct phy *phy); @@ -257,59 +49,69 @@ int phy_set_speed(struct phy *phy, int speed); int phy_configure(struct phy *phy, union phy_configure_opts *opts); int phy_validate(struct phy *phy, enum phy_mode mode, int submode, union phy_configure_opts *opts); - -static inline enum phy_mode phy_get_mode(struct phy *phy) -{ - return phy->attrs.mode; -} +enum phy_mode phy_get_mode(struct phy *phy); int phy_reset(struct phy *phy); int phy_calibrate(struct phy *phy); int phy_notify_connect(struct phy *phy, int port); int phy_notify_disconnect(struct phy *phy, int port); int phy_notify_state(struct phy *phy, union phy_notify state); -static inline int phy_get_bus_width(struct phy *phy) +int phy_get_bus_width(struct phy *phy); +void phy_set_bus_width(struct phy *phy, int bus_width); +#else +static inline struct phy *phy_get(struct device *dev, const char *string) { - return phy->attrs.bus_width; + return ERR_PTR(-ENOSYS); } -static inline void phy_set_bus_width(struct phy *phy, int bus_width) + +static inline struct phy *devm_phy_get(struct device *dev, const char *string) { - phy->attrs.bus_width = bus_width; + return ERR_PTR(-ENOSYS); } -struct phy *phy_get(struct device *dev, const char *string); -struct phy *devm_phy_get(struct device *dev, const char *string); -struct phy *devm_phy_optional_get(struct device *dev, const char *string); -struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, - const char *con_id); -struct phy *devm_of_phy_optional_get(struct device *dev, struct device_node *np, - const char *con_id); -struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, - int index); -void of_phy_put(struct phy *phy); -void phy_put(struct device *dev, struct phy *phy); -void devm_phy_put(struct device *dev, struct phy *phy); -struct phy *of_phy_get(struct device_node *np, const char *con_id); -struct phy *of_phy_simple_xlate(struct device *dev, - const struct of_phandle_args *args); -struct phy *phy_create(struct device *dev, struct device_node *node, - const struct phy_ops *ops); -struct phy *devm_phy_create(struct device *dev, struct device_node *node, - const struct phy_ops *ops); -void phy_destroy(struct phy *phy); -void devm_phy_destroy(struct device *dev, struct phy *phy); -struct phy_provider *__of_phy_provider_register(struct device *dev, - struct device_node *children, struct module *owner, - struct phy * (*of_xlate)(struct device *dev, - const struct of_phandle_args *args)); -struct phy_provider *__devm_of_phy_provider_register(struct device *dev, - struct device_node *children, struct module *owner, - struct phy * (*of_xlate)(struct device *dev, - const struct of_phandle_args *args)); -void of_phy_provider_unregister(struct phy_provider *phy_provider); -void devm_of_phy_provider_unregister(struct device *dev, - struct phy_provider *phy_provider); -int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id); -void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id); -#else + +static inline struct phy *devm_phy_optional_get(struct device *dev, + const char *string) +{ + return NULL; +} + +static inline struct phy *devm_of_phy_get(struct device *dev, + struct device_node *np, + const char *con_id) +{ + return ERR_PTR(-ENOSYS); +} + +static inline struct phy *devm_of_phy_optional_get(struct device *dev, + struct device_node *np, + const char *con_id) +{ + return NULL; +} + +static inline struct phy *devm_of_phy_get_by_index(struct device *dev, + struct device_node *np, + int index) +{ + return ERR_PTR(-ENOSYS); +} + +static inline void of_phy_put(struct phy *phy) +{ +} + +static inline void phy_put(struct device *dev, struct phy *phy) +{ +} + +static inline void devm_phy_put(struct device *dev, struct phy *phy) +{ +} + +static inline struct phy *of_phy_get(struct device_node *np, const char *con_id) +{ + return ERR_PTR(-ENOSYS); +} + static inline int phy_pm_runtime_get(struct phy *phy) { if (!phy) @@ -388,61 +190,59 @@ static inline int phy_set_speed(struct phy *phy, int speed) return -ENODEV; } -static inline enum phy_mode phy_get_mode(struct phy *phy) -{ - return PHY_MODE_INVALID; -} - -static inline int phy_reset(struct phy *phy) +static inline int phy_configure(struct phy *phy, + union phy_configure_opts *opts) { if (!phy) return 0; return -ENOSYS; } -static inline int phy_calibrate(struct phy *phy) +static inline int phy_validate(struct phy *phy, enum phy_mode mode, int submode, + union phy_configure_opts *opts) { if (!phy) return 0; return -ENOSYS; } -static inline int phy_notify_connect(struct phy *phy, int index) +static inline enum phy_mode phy_get_mode(struct phy *phy) +{ + return PHY_MODE_INVALID; +} + +static inline int phy_reset(struct phy *phy) { if (!phy) return 0; return -ENOSYS; } -static inline int phy_notify_disconnect(struct phy *phy, int index) +static inline int phy_calibrate(struct phy *phy) { if (!phy) return 0; return -ENOSYS; } -static inline int phy_notify_state(struct phy *phy, union phy_notify state) +static inline int phy_notify_connect(struct phy *phy, int index) { if (!phy) return 0; return -ENOSYS; } -static inline int phy_configure(struct phy *phy, - union phy_configure_opts *opts) +static inline int phy_notify_disconnect(struct phy *phy, int index) { if (!phy) return 0; - return -ENOSYS; } -static inline int phy_validate(struct phy *phy, enum phy_mode mode, int submode, - union phy_configure_opts *opts) +static inline int phy_notify_state(struct phy *phy, union phy_notify state) { if (!phy) return 0; - return -ENOSYS; } @@ -453,122 +253,7 @@ static inline int phy_get_bus_width(struct phy *phy) static inline void phy_set_bus_width(struct phy *phy, int bus_width) { - return; -} - -static inline struct phy *phy_get(struct device *dev, const char *string) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *devm_phy_get(struct device *dev, const char *string) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *devm_phy_optional_get(struct device *dev, - const char *string) -{ - return NULL; -} - -static inline struct phy *devm_of_phy_get(struct device *dev, - struct device_node *np, - const char *con_id) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *devm_of_phy_optional_get(struct device *dev, - struct device_node *np, - const char *con_id) -{ - return NULL; -} - -static inline struct phy *devm_of_phy_get_by_index(struct device *dev, - struct device_node *np, - int index) -{ - return ERR_PTR(-ENOSYS); -} - -static inline void of_phy_put(struct phy *phy) -{ -} - -static inline void phy_put(struct device *dev, struct phy *phy) -{ -} - -static inline void devm_phy_put(struct device *dev, struct phy *phy) -{ -} - -static inline struct phy *of_phy_get(struct device_node *np, const char *con_id) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *of_phy_simple_xlate(struct device *dev, - const struct of_phandle_args *args) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *phy_create(struct device *dev, - struct device_node *node, - const struct phy_ops *ops) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *devm_phy_create(struct device *dev, - struct device_node *node, - const struct phy_ops *ops) -{ - return ERR_PTR(-ENOSYS); -} - -static inline void phy_destroy(struct phy *phy) -{ -} - -static inline void devm_phy_destroy(struct device *dev, struct phy *phy) -{ -} - -static inline struct phy_provider *__of_phy_provider_register( - struct device *dev, struct device_node *children, struct module *owner, - struct phy * (*of_xlate)(struct device *dev, - const struct of_phandle_args *args)) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy_provider *__devm_of_phy_provider_register(struct device - *dev, struct device_node *children, struct module *owner, - struct phy * (*of_xlate)(struct device *dev, - const struct of_phandle_args *args)) -{ - return ERR_PTR(-ENOSYS); -} - -static inline void of_phy_provider_unregister(struct phy_provider *phy_provider) -{ -} - -static inline void devm_of_phy_provider_unregister(struct device *dev, - struct phy_provider *phy_provider) -{ -} -static inline int -phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) -{ - return 0; } -static inline void phy_remove_lookup(struct phy *phy, const char *con_id, - const char *dev_id) { } -#endif +#endif /* IS_ENABLED(CONFIG_GENERIC_PHY) */ -#endif /* __DRIVERS_PHY_H */ +#endif /* __PHY_CONSUMER_H */ -- 2.34.1