[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200905113818.7962b6d4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Sat, 5 Sep 2020 11:38:18 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Dan Murphy <dmurphy@...com>
Cc: <davem@...emloft.net>, <andrew@...n.ch>, <f.fainelli@...il.com>,
<hkallweit1@...il.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v3 3/3] net: dp83869: Add speed optimization
feature
On Thu, 3 Sep 2020 06:42:59 -0500 Dan Murphy wrote:
> +static int dp83869_set_downshift(struct phy_device *phydev, u8 cnt)
> +{
> + int val, count;
> +
> + if (cnt > DP83869_DOWNSHIFT_8_COUNT)
> + return -E2BIG;
ERANGE
> + if (!cnt)
> + return phy_clear_bits(phydev, DP83869_CFG2,
> + DP83869_DOWNSHIFT_EN);
> +
> + switch (cnt) {
> + case DP83869_DOWNSHIFT_1_COUNT:
> + count = DP83869_DOWNSHIFT_1_COUNT_VAL;
> + break;
> + case DP83869_DOWNSHIFT_2_COUNT:
> + count = DP83869_DOWNSHIFT_2_COUNT_VAL;
> + break;
> + case DP83869_DOWNSHIFT_4_COUNT:
> + count = DP83869_DOWNSHIFT_4_COUNT_VAL;
> + break;
> + case DP83869_DOWNSHIFT_8_COUNT:
> + count = DP83869_DOWNSHIFT_8_COUNT_VAL;
> + break;
> + default:
> + phydev_err(phydev,
> + "Downshift count must be 1, 2, 4 or 8\n");
> + return -EINVAL;
> + }
> +
> + val = DP83869_DOWNSHIFT_EN;
> + val |= FIELD_PREP(DP83869_DOWNSHIFT_ATTEMPT_MASK, count);
> +
> + return phy_modify(phydev, DP83869_CFG2,
> + DP83869_DOWNSHIFT_EN | DP83869_DOWNSHIFT_ATTEMPT_MASK,
> + val);
> +}
Powered by blists - more mailing lists