From patchwork Tue Dec 29 13:58:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 1421211 X-Patchwork-Delegate: narmstrong@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=v0Q5Qq5x; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D4wz53vLNz9sVv for ; Wed, 30 Dec 2020 01:00:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D02B28257D; Tue, 29 Dec 2020 14:59:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="v0Q5Qq5x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7B33825AB; Tue, 29 Dec 2020 14:59:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 034A082564 for ; Tue, 29 Dec 2020 14:59:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=narmstrong@baylibre.com Received: by mail-wr1-x42e.google.com with SMTP id t30so14765351wrb.0 for ; Tue, 29 Dec 2020 05:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MxmSo4YEIYtoXatpN2gwm7qBDJ/g/oXY9prnXg4jdO8=; b=v0Q5Qq5xl3iK1hZsw2mlslCB1B/WvaSnLt2vtV/36iowb2/D3Le9P/JcZNfw8H62Mb A871jfHDN06dF87BZWTfzkKHmLPTnCdGUwFahP9iHIhfRAO0ZNgh90vjxmh7o3STtXKl KiFGoV/GxhZJd914J2CBFBn6yl/j+RSIluN/UPS6Ae5BZbXcASSMtCmnmYiVXg/mUHQx tDrCovO3vMaSA05HNwsToRC2PumtH+OIT5LGOf4mEa3fzQ44d5CGZAJ7mpwpTBuQ/KmJ Ut637JnNBIm27X03JW7XeYx0bqx9QC4P6wKPQO7ZgYBYEsCY8ijfhDJymWy/dN0lCEM/ R4Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MxmSo4YEIYtoXatpN2gwm7qBDJ/g/oXY9prnXg4jdO8=; b=Otd04x3Q5S/SKJxhtafOixXjfLnenoC30CV6B/jrJ+INrsRUhbi5lsr2adInEDu1iE HNpR+PMdkchcvaF52lteJLtZtkjKATACwexSmgPGnpxFJ6VCchywDstaDTXlqaOkkIA6 sdPkE2j7OOoX4m/WT7IGlqQaKCY2qIfVtywoIcY7K9bJ/8cibAGWsCxrHWY41zJQbRYK EpF+nTsU1KF6apcKNmIGU9V+hDfzCCG/PWDKof/mJXRXdyr2H1rw7HNLBEvTS3+yk5zo 2SvuqAll6zzXPUVS8+my0Fxejl+FN1Lb88p5V+ATYfEb1EzchXx6pVp0DzBRWDDQCe9P jqLQ== X-Gm-Message-State: AOAM533xUyEZ2cr3T3HVwjc7qQr2lYk2eX+a3CqBEVPQd046eGHmrWm2 Jru3iCGENunhC0EPy6ENb+b+VEGyFfVCIA== X-Google-Smtp-Source: ABdhPJyWFIgd5h5twKbesnMTmluw/lPGrvyQS6Plrjz1sWNGIXoz9c4zx6ECnSo1Hghgd3i5u6hBrw== X-Received: by 2002:a5d:558a:: with SMTP id i10mr56982634wrv.363.1609250348172; Tue, 29 Dec 2020 05:59:08 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:2464:c563:b017:7ce1]) by smtp.gmail.com with ESMTPSA id z22sm3666950wml.1.2020.12.29.05.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Dec 2020 05:59:07 -0800 (PST) From: Neil Armstrong To: u-boot@lists.denx.de, sjg@chromium.org Cc: u-boot-amlogic@groups.io, Neil Armstrong Subject: [PATCH 2/4] generic-phy: add configure op Date: Tue, 29 Dec 2020 14:58:59 +0100 Message-Id: <20201229135901.30090-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201229135901.30090-1-narmstrong@baylibre.com> References: <20201229135901.30090-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the PHY configure op callback to the generic PHY uclass to permit configuring the PHY. It's useful for MIPI DSI PHYs to setup the link timings. Signed-off-by:Neil Armstrong Signed-off-by: Neil Armstrong --- drivers/phy/phy-uclass.c | 11 +++++++++++ include/generic-phy.h | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index ef03e3a502..43ffbcee0f 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -204,6 +204,17 @@ int generic_phy_power_off(struct phy *phy) return ret; } +int generic_phy_configure(struct phy *phy, void *params) +{ + struct phy_ops const *ops; + + if (!generic_phy_valid(phy)) + return 0; + ops = phy_dev_ops(phy->dev); + + return ops->configure ? ops->configure(phy, params) : 0; +} + int generic_phy_get_bulk(struct udevice *dev, struct phy_bulk *bulk) { int i, ret, count; diff --git a/include/generic-phy.h b/include/generic-phy.h index 5ab34cda03..a17d900e4b 100644 --- a/include/generic-phy.h +++ b/include/generic-phy.h @@ -122,6 +122,20 @@ struct phy_ops { * @return 0 if OK, or a negative error code */ int (*power_off)(struct phy *phy); + + /** + * configure - configure a PHY device + * + * @phy: PHY port to be configured + * @params: PHY Parameters, underlying data is specific to the PHY function + * + * During runtime, the PHY may need to be configured for it's main function. + * This function configures the PHY for it's main function following + * power_on/off() after beeing initialized. + * + * @return 0 if OK, or a negative error code + */ + int (*configure)(struct phy *phy, void *params); }; /** @@ -183,6 +197,15 @@ int generic_phy_power_on(struct phy *phy); */ int generic_phy_power_off(struct phy *phy); +/** + * generic_phy_configure() - configure a PHY device + * + * @phy: PHY port to be configured + * @params: PHY Parameters, underlying data is specific to the PHY function + * @return 0 if OK, or a negative error code + */ +int generic_phy_configure(struct phy *phy, void *params); + /** * generic_phy_get_by_index() - Get a PHY device by integer index.