From patchwork Mon Mar 8 03:52:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 395661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EFB9C4332D for ; Mon, 8 Mar 2021 04:06:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 183AC6516F for ; Mon, 8 Mar 2021 04:06:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234114AbhCHEGT (ORCPT ); Sun, 7 Mar 2021 23:06:19 -0500 Received: from mail-eopbgr70044.outbound.protection.outlook.com ([40.107.7.44]:24274 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234100AbhCHEGC (ORCPT ); Sun, 7 Mar 2021 23:06:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QclwA73kUEWh1LEokA7HHR0QlezMxSy0qu2zF8BbUD3rICXnoMagM8N+mAd/hqH7GdbLeNDyI2NTb8GrUVpssw6jxUj4yFA0CZkf1bffNF5JHgSqup74q8WIkbQmOL1ye+f2m4CB6svs0X3VyWjEtjEpCdK3nRhLKCf71+ZLxQbUq2q/dXa1J3+L8rZkSoTUPSFxojan7Zio87I40yzvQJbihl/jYMw63EyYnZksRLQk6n4mqhxrJULhlSEp6cMMc6D6ps4ddqrkyUakYtM2Rr6srTgiCGlIifqqJ/brsOjqMG7p+JP8JsWI8UP5mW7f4WG+X3fQjBjNC6sxQtD+CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3sA3nQ+OEULqsdeLnZgSzuNU567QUWAi8xpQWAby/mg=; b=Gp4JucST5mSKwfXPN7BBs2BPkW0kHhuEzcv+O/H8rhuRAcQwOrKlCPFGPHE9z3vOv2/xbgqEvc7PvbuEsazUN2YGqTgyhoOi8yB/QNrJck4d6+XNWjfsyogSCX8bTr7IgCgMA5yZC0CRVUCFg7aN69T2x7Nd4SDDINyJoDPe7ER4tndNrYwkOUrrvhVS/wBjCF4t+ag71G0CqMcOX4bgliPqRG0/IX3xdzTZ9Vy4Zg4SllILMVLDk0PvY0vD+YRvkRpDEHhaE+LHdezVZn+R4x3XjBqCReRPdT+QWssa1FfT5GrVvkF/E5mkn1cu/8+bDzQbqr+LRmcRO9VoyaHmYw== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3sA3nQ+OEULqsdeLnZgSzuNU567QUWAi8xpQWAby/mg=; b=cH0KD1iurQfAQQQi+yIWXWMXkjQPh5oNBatoLftfrTidc6XKVm/SOnl679EV+26OG6831/gGMwKigml5brI2dSeq7SRlofqVjNFH8CsF7a+4VEurlJUavQ6veGKPT9PW7cRzQjw8GZ3ekxhbQtN+MVruSFZIgVXVIgzV/Afri2c= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB3310.eurprd04.prod.outlook.com (2603:10a6:802:11::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.27; Mon, 8 Mar 2021 04:05:55 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3912.027; Mon, 8 Mar 2021 04:05:55 +0000 From: Liu Ying To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, airlied@linux.ie, daniel@ffwll.ch, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, agx@sigxcpu.org, robert.chiras@nxp.com, martin.kepplinger@puri.sm, robert.foss@linaro.org Subject: [PATCH v4 2/5] phy: Add LVDS configuration options Date: Mon, 8 Mar 2021 11:52:18 +0800 Message-Id: <1615175541-29009-3-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615175541-29009-1-git-send-email-victor.liu@nxp.com> References: <1615175541-29009-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0088.apcprd04.prod.outlook.com (2603:1096:202:15::32) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0088.apcprd04.prod.outlook.com (2603:1096:202:15::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 04:05:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 82291bbf-4b22-4058-0fd1-08d8e1e778f1 X-MS-TrafficTypeDiagnostic: VI1PR04MB3310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iS2RltSlJjMbtfOX5W4Dygme2wjaCGIwc56g/Xy7FarqeVskQ4Mr+Y/xEkGYnU+XUmrKGD06qQy3LU8rrWvZxTvKafzaKifJF8vH1THkOyRI3FhNsBz1BoHndSuVaJHV68EdKjydnTPOvH5e5/9gXN5lrZ4YbR2E2+KVofEgy3dcgLfxmSqnXf7Hm0Hj7k5WQpwZbvuj1VrgdosYG3ry76ap/oqe9Pe6Y9F6XLhHaIAQ0LNm8A0yz36HqmnK3pvaEQu0nV20Q2w7KsiPF/hMWYDa2/jUCMmUUwp5c39tVlHSd3066coo24oLyOKZa9Ev78kVOnTu7gGDYz/UUXpi23b51YNRNK0WgH6wkLD11ZKIRyHtSUw8JQeSt8HKkc6C8jq/LCf+Jo16T01bJcRtiWu/Uhlkyhy4hdVej/tR1rG24s9KBgZyc3KPnTT1vjfgQtY5LbzLodjEp7hXp47Io8XIUkmZljmC1rulnHAvX3Mt8VLEJg1OkCxBR42HxYUgM542bGZBVC90R9cNoiC0wKobNDDxx6Ewt7UezEm/TflIJIe+ljgjaBbB7fh00plbhuBQxu+8GvJrGBR/WkQT3g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(136003)(396003)(366004)(346002)(66556008)(186003)(16526019)(478600001)(66946007)(2906002)(316002)(66476007)(26005)(5660300002)(52116002)(8936002)(6666004)(6486002)(36756003)(8676002)(6512007)(7416002)(4326008)(956004)(6506007)(83380400001)(2616005)(86362001)(69590400012); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HrMS1JpsRDgA8E+qPQdGCtWfXCGQTW1Be38KgvoNuEp/tIG8RD51i11yG8Nn8funcKbJYzVC4clQJQNRJgB12Mo3scqXx7E48UMpEXsUE+UQyUaFzBO4Ppxs91//pF/FPUcMMr6si8vKaNnq5pIbsnckRa8hgTT7uBnjaqfTjJfnn7CBjDWy6CacbyJv1XoPo8Z7Q01zC1Gk1FgNHMI/JQvkVuEypjyPv0GmC3UgLmUMxijzcJih2PffpBYgSFyardIit5LplV42VkTRnALh2HN7RP/U1yNgUwJG+GXegW7M8Ru1auzA6nljQvS2VIMI8aX5LcY5iqekiW9FLH5554VwqI6fBQGe3eSlROCIP98lIervUxd4UZg7opBJLTX6ddmToB5kAxe+QLbFgjXhCtjCOiqNT/JDCQBrN5inxfUSemriApCh6+IAoTk+hve7ZNXIGhUJh+nz8+TGFbHysa2pLRNTOcjiPZkV+ViQ57N3ZbBdMcfuluVrOFFxTu/CYFGgC3TqCKAXjKXc5DYBZR98ejjOszn/gn6Dy9pDZP+daYnVmczLYCFTFn4HN3antZdUhatrqx+WG/XDwkkCjO7ien/49E9snggz5Nd2hUYYVHMYPn1Ud79UmhUHOsYPglefl0r3a4HUbLAe7zEMUImguHJwBtLldL1wE0jX4U2ReIsLYYgy5oyG3qiqYr87/+RJ0IPdpr4YSOArwJlLFPezj5GXY8NGkBNLsvQsdGRD5jgdZG1rPqQPyuS30Es6apVZsv8Mh6EZo1gz08bhjtUQjdhXxoLepE2k/bnd0Y4OA67SadW1wnRNOaGrEx5Wv281+AOsb487y7WWeeiuNqbbgmJoxxqXL0oNXb7Bfp0oAMslHeEsfYqleNk/9uhwqDVcpteZFZIDtlG8zaGHvvs9kDo2yhHm4M8BabwFvJJaZfwRAons2zfzs/HCS9aw/RyhOcu7K2mzghHRXuGVz5wRqbrZoWiDmJ/LTr9SNxLxvbLFQIux+r6levRNdZQDLOINqIS3B/+sbEVxMKkSSgfMrnuUog+AjX/9985FY5PayIadidqITQU6rJPi+EFZuXdeTQoRFH3AQlhD8wEBYdTQ9ps0eMKnv4nKlpvpx8PiMtfBilmat6LSk/pajguKgX3MP9VDLJRMV8oMfgwkCPU+W5BJ7ObzqtRbyA74WgNlqU1ksJ4qfUpMRvxF87KHIS/HV2y2vEyEFdvwh22zScHnazX+wicDgenomjx/qrfYBDtJ03fCtGyjJXZX/vB3IEM/94rY2uqHdObrESIOitwMC+WIb6ROVQC8nkjJop7IVSoLTG8Yb/VislozDErR X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82291bbf-4b22-4058-0fd1-08d8e1e778f1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 04:05:55.8272 (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: 2RFNxla6cilHc4h2X7EgxYohR7gIw2d0J0ya/OeOe9bElmepZ82feqEGofjNPUEP5D+7Fy7LWwLPEPy6Xn0uoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3310 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch allows LVDS PHYs to be configured through the generic functions and through a custom structure added to the generic union. The parameters added here are based on common LVDS PHY implementation practices. The set of parameters should cover all potential users. Cc: Kishon Vijay Abraham I Cc: Vinod Koul Cc: NXP Linux Team Reviewed-by: Robert Foss Signed-off-by: Liu Ying --- v3->v4: * Add Robert's R-b tag. v2->v3: * No change. v1->v2: * No change. include/linux/phy/phy-lvds.h | 48 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/phy/phy.h | 4 ++++ 2 files changed, 52 insertions(+) create mode 100644 include/linux/phy/phy-lvds.h diff --git a/include/linux/phy/phy-lvds.h b/include/linux/phy/phy-lvds.h new file mode 100644 index 00000000..1b5b9d6 --- /dev/null +++ b/include/linux/phy/phy-lvds.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2020 NXP + */ + +#ifndef __PHY_LVDS_H_ +#define __PHY_LVDS_H_ + +/** + * struct phy_configure_opts_lvds - LVDS configuration set + * + * This structure is used to represent the configuration state of a + * LVDS phy. + */ +struct phy_configure_opts_lvds { + /** + * @bits_per_lane_and_dclk_cycle: + * + * Number of bits per data lane and differential clock cycle. + */ + unsigned int bits_per_lane_and_dclk_cycle; + + /** + * @differential_clk_rate: + * + * Clock rate, in Hertz, of the LVDS differential clock. + */ + unsigned long differential_clk_rate; + + /** + * @lanes: + * + * Number of active, consecutive, data lanes, starting from + * lane 0, used for the transmissions. + */ + unsigned int lanes; + + /** + * @is_slave: + * + * Boolean, true if the phy is a slave which works together + * with a master phy to support dual link transmission, + * otherwise a regular phy or a master phy. + */ + bool is_slave; +}; + +#endif /* __PHY_LVDS_H_ */ diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index e435bdb..d450b44 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -17,6 +17,7 @@ #include #include +#include #include struct phy; @@ -51,10 +52,13 @@ enum phy_mode { * 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. */ union phy_configure_opts { struct phy_configure_opts_mipi_dphy mipi_dphy; struct phy_configure_opts_dp dp; + struct phy_configure_opts_lvds lvds; }; /**