Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4881921pxb; Mon, 15 Feb 2021 03:57:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXDI2RgVH+Hz0WMi734d90RtpNpUSzFB1Pr7bDS9qup9MI8otHpPztR6ZvxUXNzC4ET6Zd X-Received: by 2002:a17:906:4e45:: with SMTP id g5mr458736ejw.186.1613390269675; Mon, 15 Feb 2021 03:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613390269; cv=none; d=google.com; s=arc-20160816; b=O+m7CsTvW6o+Ovk+1BZBHwpcqnB7TXjVr9vnIPOOh4ahN21zsSYzw5/eD7KQYHFUeB GnqPQzMw1LgHcReyfx+JXpfpYGNideT5uW/R23u8UI/Pqujd7dIEYDyT63G/hn0bt+UA 09re09qEstSwKYxNsIGypX98SMdsqU96na3j3Pz6Gufxpi9W66894oxNiDNx3j3ZQKkX YJsMFU9wmMfhOcQjF05WW7p0vGqTfBrg4sls1ScuwZOYp5G/BuVf5iLQ+SZQ4SX6jkPF 1FYCMiD5/78WsWxmpVYaaJlrc0SH3+HDk88v6mMR2UVJoBWsDq5c9/vcbAvlJLI/aZvj EL1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=evOhiN5iqq5MDuW2y+VKX24pQNbwurTcJH8VQqHMCFg=; b=AZdyK7+eKy1GJkvae2lWEMTrg0blnr6EXmod5UQcbEGSNIN6jnxsdYEZ18qE/xiSTQ NL2SeOMkFRfxhvJQ32cLkv4UguFWw+IkbLS3/eKhZGglQSRDBjhdlnQyuBKI4lK9KBqg k4KySzyngEVMTfQrMCZbXkcXva89o5QlMNmS1KKAzP1kc2VzalRSrirHFyUclMj7dcUv rhbwZ9aLZ6bGq5bs0SjMYrjQhUQuPzNLb+AOEGsCFsULqVlIyjGaBELdcwcMjpi19JKK +0QuijdOcm6Yi2q57dc4LN6FRo8a/5wL5JljzOW0bKb9ZlBEdnDxdS6bHISpv+VWys08 MzLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=CA5JrEwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si634831eds.376.2021.02.15.03.57.26; Mon, 15 Feb 2021 03:57:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=CA5JrEwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230156AbhBOL42 (ORCPT + 99 others); Mon, 15 Feb 2021 06:56:28 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:46482 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbhBOL4S (ORCPT ); Mon, 15 Feb 2021 06:56:18 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 11FBtEdk051330; Mon, 15 Feb 2021 05:55:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1613390114; bh=evOhiN5iqq5MDuW2y+VKX24pQNbwurTcJH8VQqHMCFg=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=CA5JrEwLGZFhs9rtWBnDJp0k4yJ8iD259/1g8qfTwH5yDJaMQot9jlkqlhsSmXGZF gOjMX6sc1bUaRZTMUaDwPHQyPN3dwXIbuRZqPwm72HGFPQ+XbQWG5xhmWb9gFAmh3E BaZvNJVKl4ks+tdnfGL7TgCAz60nEJRiFvK9Vtq0= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 11FBtEvf013131 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Feb 2021 05:55:14 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 15 Feb 2021 05:55:14 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 15 Feb 2021 05:55:14 -0600 Received: from [10.250.234.133] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 11FBtAS4077334; Mon, 15 Feb 2021 05:55:11 -0600 Subject: Re: [PATCH v14 2/4] phy: Add media type and speed serdes configuration interfaces To: Steen Hegelund , Vinod Koul CC: Alexandre Belloni , Lars Povlsen , Bjarni Jonasson , Microchip UNG Driver List , , , Andrew Lunn References: <20210210085255.2006824-1-steen.hegelund@microchip.com> <20210210085255.2006824-3-steen.hegelund@microchip.com> <04d91f6b-775a-8389-b813-31f7b4a778cb@ti.com> From: Kishon Vijay Abraham I Message-ID: <704b850f-9345-2e36-e84b-b332fed22270@ti.com> Date: Mon, 15 Feb 2021 17:25:10 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steen, On 12/02/21 6:35 pm, Steen Hegelund wrote: > Hi Kishon, > > On Fri, 2021-02-12 at 17:02 +0530, Kishon Vijay Abraham I wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you >> know the content is safe >> >> Hi Steen, >> >> On 10/02/21 2:22 pm, Steen Hegelund wrote: >>> Provide new phy configuration interfaces for media type and speed >>> that >>> allows allows e.g. PHYs used for ethernet to be configured with >>> this >>> information. >>> >>> Signed-off-by: Lars Povlsen >>> Signed-off-by: Steen Hegelund >>> Reviewed-by: Andrew Lunn >>> Reviewed-by: Alexandre Belloni >>> --- >>>  drivers/phy/phy-core.c  | 30 ++++++++++++++++++++++++++++++ >>>  include/linux/phy/phy.h | 26 ++++++++++++++++++++++++++ >>>  2 files changed, 56 insertions(+) >>> >>> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c >>> index 71cb10826326..ccb575b13777 100644 >>> --- a/drivers/phy/phy-core.c >>> +++ b/drivers/phy/phy-core.c >>> @@ -373,6 +373,36 @@ int phy_set_mode_ext(struct phy *phy, enum >>> phy_mode mode, int submode) >>>  } >>>  EXPORT_SYMBOL_GPL(phy_set_mode_ext); >>> >>> +int phy_set_media(struct phy *phy, enum phy_media media) >>> +{ >>> +     int ret; >>> + >>> +     if (!phy || !phy->ops->set_media) >>> +             return 0; >>> + >>> +     mutex_lock(&phy->mutex); >>> +     ret = phy->ops->set_media(phy, media); >>> +     mutex_unlock(&phy->mutex); >>> + >>> +     return ret; >>> +} >>> +EXPORT_SYMBOL_GPL(phy_set_media); >>> + >>> +int phy_set_speed(struct phy *phy, int speed) >>> +{ >>> +     int ret; >>> + >>> +     if (!phy || !phy->ops->set_speed) >>> +             return 0; >>> + >>> +     mutex_lock(&phy->mutex); >>> +     ret = phy->ops->set_speed(phy, speed); >>> +     mutex_unlock(&phy->mutex); >>> + >>> +     return ret; >>> +} >>> +EXPORT_SYMBOL_GPL(phy_set_speed); >> >> Can't speed derived from mode? Do we need a separate set_speed >> function? >> >> Thanks >> Kishon > > Yes the client will need to be able to choose the speed as needed:  > e.g. lower than the serdes mode supports, in case the the media or the > other end is not capable of running that speed.   > > An example is a 10G and 25G serdes connected via DAC and as there is no > inband autoneg, the 25G client would have to manually select 10G speed > to communicate with its partner. Okay. Is it going to be some sort of manual negotiation where the Ethernet controller invokes set_speed with different speeds? Or the Ethernet controller will get the speed using some out of band mechanism and invokes set_speed once with the actual speed? Thanks Kishon > >> >>> + >>>  int phy_reset(struct phy *phy) >>>  { >>>       int ret; >>> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h >>> index e435bdb0bab3..e4fd69a1faa7 100644 >>> --- a/include/linux/phy/phy.h >>> +++ b/include/linux/phy/phy.h >>> @@ -44,6 +44,12 @@ enum phy_mode { >>>       PHY_MODE_DP >>>  }; >>> >>> +enum phy_media { >>> +     PHY_MEDIA_DEFAULT, >>> +     PHY_MEDIA_SR, >>> +     PHY_MEDIA_DAC, >>> +}; >>> + >>>  /** >>>   * union phy_configure_opts - Opaque generic phy configuration >>>   * >>> @@ -64,6 +70,8 @@ union phy_configure_opts { >>>   * @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 >>>   * @release: ops to be performed while the consumer relinquishes >>> the PHY >>> @@ -75,6 +83,8 @@ struct phy_ops { >>>       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: >>> @@ -215,6 +225,8 @@ int phy_power_off(struct phy *phy); >>>  int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int >>> submode); >>>  #define phy_set_mode(phy, mode) \ >>>       phy_set_mode_ext(phy, mode, 0) >>> +int phy_set_media(struct phy *phy, enum phy_media media); >>> +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); >>> @@ -344,6 +356,20 @@ static inline int phy_set_mode_ext(struct phy >>> *phy, enum phy_mode mode, >>>  #define phy_set_mode(phy, mode) \ >>>       phy_set_mode_ext(phy, mode, 0) >>> >>> +static inline int phy_set_media(struct phy *phy, enum phy_media >>> media) >>> +{ >>> +     if (!phy) >>> +             return 0; >>> +     return -ENOSYS; >>> +} >>> + >>> +static inline int phy_set_speed(struct phy *phy, int speed) >>> +{ >>> +     if (!phy) >>> +             return 0; >>> +     return -ENOSYS; >>> +} >>> + >>>  static inline enum phy_mode phy_get_mode(struct phy *phy) >>>  { >>>       return PHY_MODE_INVALID; >>> > > > Thanks for your comments. > >