From patchwork Thu Mar 23 10:26:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 7092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2838809wrt; Thu, 23 Mar 2023 03:57:26 -0700 (PDT) X-Google-Smtp-Source: AK7set8YJFh6/uO0KewFjEqjlTDD3mPHQh3lS+zRVuvHHidNExVRcFDhBnxaSNnLK4GzWjFTDlhk X-Received: by 2002:a17:906:58d1:b0:93a:34b3:923a with SMTP id e17-20020a17090658d100b0093a34b3923amr11383217ejs.71.1679569046276; Thu, 23 Mar 2023 03:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679569046; cv=none; d=google.com; s=arc-20160816; b=GKxWnt37FGTTtmt3Vcs8yc42ygUMwtI26krINuZPxvSuo54ERAjvl/WtFYCWY0lfnm wia1ITyig6b/rzEukTQZtsskRWdAvVMZezyrStpQuuvlEpQD0XMSZ6pRO+LxP1Y/UzRm MlnqbIi0r+8OGa2XATcfy0migOcjDKlLKlxgmEfAHXFuyX7diVKvk3Dt3cCYVhbr/ecE Kc0B2apzvjfryu1mwK3urJqey38aC4CUcYdho7HzoR1MPpkKMAENpU0O51Ou6mkHW3fl yF9Sa3kNwJgD4CtL8/Ei9g9D5HYnRSgZkmTNsaEHcGMcZZj9yL9293tVm3HJVhX8fT76 lDug== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Bb2LaA5oKhmmtAZYLmsiQ/YaU0jciVROXMb0QSlP0Wg=; b=UeQqRHjBeBeDehxCLGDDP+EoF8fzdO5FqmhDyKc57xjLlBxVe0wiyMzqd58j6NAErP YP5de3Dg+ie615c5StcN57qVgMSYRvd+BC5OudbXcr2xF/zbwl3KWA13ALZwv3TYnyFI ZJ5ZUmbGKYJRqtc7XY0byoc3hcc1a4o1HWzze+O0gC13alqmcTNMFzGbCPt5ERxhViWt fT83zwEB8Yacb+Xa0dVf4/qaoQkYgzxnw5nPrTWS5yCYzK4vDbOxDfO3pjWHGjYG8+rs iOThFv1s0ULGnshPaV6MgwkJJNjoAz3g1FYENZpFxf/M29Ez+gSnV2ltUPPof6deM9ZA ZoxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VxFDk1bt; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mf12-20020a170906cb8c00b0091ee7139cb7si9999287ejb.411.2023.03.23.03.57.03; Thu, 23 Mar 2023 03:57:26 -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=@bootlin.com header.s=gm1 header.b=VxFDk1bt; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231483AbjCWK36 (ORCPT + 99 others); Thu, 23 Mar 2023 06:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbjCWK3V (ORCPT ); Thu, 23 Mar 2023 06:29:21 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 377A21C5BB; Thu, 23 Mar 2023 03:27:08 -0700 (PDT) Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 2138B40002; Thu, 23 Mar 2023 10:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1679567227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Bb2LaA5oKhmmtAZYLmsiQ/YaU0jciVROXMb0QSlP0Wg=; b=VxFDk1btpm3I+lY27gnNS2ZFS9MfFuK69w+dHpGJzWzpWR45gsxG/km5LiGA2wHJLBaLg5 VK+K97/DL86knDX6Mke46XFjzerXEVRH/Zb93FgpPBaY8F7wk6J1AgSvyMu1tzuk8dHWz6 xrEgKll+w/M4VK1OG85PKzR2sOgHEFTx9oc+ivV39IX8d7A+Kx1+d0/2wBwB2dPZ3ZQdte O+duzsRYbMcdgNBtMQpKLou3uaJu7N2ahGwixQe8z+OWcf1e6cGnb37vdxOxH8ZCklBNVI VeYlf21rudf7mc+B1N60Wt0NTfnjRYXw13T+M37jn2YthgvBxNvOGQ6CArHBmg== From: Herve Codina To: Herve Codina , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vinod Koul , Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-phy@lists.infradead.org, Christophe Leroy , Thomas Petazzoni Subject: [RFC PATCH 0/4] Hi, Date: Thu, 23 Mar 2023 11:26:51 +0100 Message-Id: <20230323102655.264115-1-herve.codina@bootlin.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1761155792037111881?= X-GMAIL-MSGID: =?utf-8?q?1761155792037111881?= I have a system where I need to handle an HDLC interface. The HDLC data are transferred using a TDM bus on which a PEF2256 is present. The PEF2256 transfers data from/to the TDM bus to/from E1 line. This PEF2256 is also connected to a PowerQUICC SoC for the control path and the TDM is connected to the SoC (QMC component) for the data path. From the HDLC driver, I need to handle data using the QMC and carrier detection using the PEF2256 (E1 line carrier). The HDLC driver consider the PEF2256 as a generic PHY. So, the design is the following: +----------+ +-------------+ +---------+ | HDLC drv | <-data-> | QMC channel | <-- TDM --> | PEF2256 | +----------+ +-------------+ | | <--> E1 ^ +---------+ +---------+ | | +-> | Gen PHY | <-> | PEF2256 | <- local bus -> | | +---------+ | PHY drv | +---------+ +---------+ In order to implement this, I had to: 1 - Extend the generic PHY API to support get_status() and notification on status change. 2 - Introduce a new kind of generic PHY named "basic phy". This PHY familly can provide a link status in the get_status() data. 3 - Support the PEF2256 PHY as a "basic phy" The purpose of this RFC series is to discuss this design. The QMC driver code is available on linux-next. In this series: - patch 1: driver HDLC using the QMC channel - patch 2: Extend the generic PHY API - patch 3: Use the "basic phy" in the HDLC driver - patch 4: Implement the PEF2256 PHY driver I did 2 patches for the HDLC driver in order to point the new PHY family usage in the HDLC driver. In the end, these two patches will be squashed and the bindings will be added. Hope to have some feedback on this proposal. Best regards, Hervé Herve Codina (4): net: wan: Add support for QMC HDLC phy: Extend API to support 'status' get and notification net: wan: fsl_qmc_hdlc: Add PHY support phy: lantiq: Add PEF2256 PHY support drivers/net/wan/Kconfig | 12 + drivers/net/wan/Makefile | 1 + drivers/net/wan/fsl_qmc_hdlc.c | 558 ++++++++++++++++++++++++ drivers/phy/lantiq/Kconfig | 15 + drivers/phy/lantiq/Makefile | 1 + drivers/phy/lantiq/phy-lantiq-pef2256.c | 131 ++++++ drivers/phy/phy-core.c | 88 ++++ include/linux/phy/phy-basic.h | 27 ++ include/linux/phy/phy.h | 89 +++- 9 files changed, 921 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wan/fsl_qmc_hdlc.c create mode 100644 drivers/phy/lantiq/phy-lantiq-pef2256.c create mode 100644 include/linux/phy/phy-basic.h