Skip to content

Commit 432d2ae

Browse files
committed
phy: rockchip: inno-combphy: remove redundant param_exped
The function param_read() and param_exped() do the same thing, so this patch uses the more general param_read() instead of the param_exped(), and delete the param_exped() directly. Change-Id: Ic097069c28a717ff5f70ceaa36a22ea1bd26b76f Signed-off-by: William Wu <william.wu@rock-chips.com>
1 parent d49d6cc commit 432d2ae

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

drivers/phy/rockchip/phy-rockchip-inno-combphy.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -136,31 +136,13 @@ static inline int param_write(struct regmap *base,
136136
return regmap_write(base, reg->offset, val);
137137
}
138138

139-
static inline bool param_exped(void __iomem *base,
140-
const struct combphy_reg *reg,
141-
unsigned int value)
142-
{
143-
int ret;
144-
unsigned int tmp, orig;
145-
unsigned int mask = GENMASK(reg->bitend, reg->bitstart);
146-
147-
ret = regmap_read(base, reg->offset, &orig);
148-
if (ret)
149-
return false;
150-
151-
tmp = (orig & mask) >> reg->bitstart;
152-
153-
return tmp == value;
154-
}
155-
156139
static ssize_t u3phy_mode_show(struct device *device,
157140
struct device_attribute *attr,
158141
char *buf)
159142
{
160143
struct rockchip_combphy_priv *priv = dev_get_drvdata(device);
161144

162-
if (param_exped(priv->usb_pcie_grf,
163-
&priv->cfg->grfcfg.u3_port_num, 0))
145+
if (param_read(priv->usb_pcie_grf, &priv->cfg->grfcfg.u3_port_num, 0))
164146
return sprintf(buf, "u2\n");
165147
else
166148
return sprintf(buf, "u3\n");
@@ -173,8 +155,7 @@ static ssize_t u3phy_mode_store(struct device *device,
173155
struct rockchip_combphy_priv *priv = dev_get_drvdata(device);
174156

175157
if (!strncmp(buf, "u3", 2) &&
176-
param_exped(priv->usb_pcie_grf,
177-
&priv->cfg->grfcfg.u3_port_num, 0)) {
158+
param_read(priv->usb_pcie_grf, &priv->cfg->grfcfg.u3_port_num, 0)) {
178159
/*
179160
* Enable USB 3.0 rx termination, need to select
180161
* pipe_l0_rxtermination from USB 3.0 controller.
@@ -189,8 +170,8 @@ static ssize_t u3phy_mode_store(struct device *device,
189170
&priv->cfg->grfcfg.u3_port_disable, false);
190171
dev_info(priv->dev, "Set usb3.0 and usb2.0 mode successfully\n");
191172
} else if (!strncmp(buf, "u2", 2) &&
192-
param_exped(priv->usb_pcie_grf,
193-
&priv->cfg->grfcfg.u3_port_num, 1)) {
173+
param_read(priv->usb_pcie_grf,
174+
&priv->cfg->grfcfg.u3_port_num, 1)) {
194175
/*
195176
* Disable USB 3.0 rx termination, need to select
196177
* pipe_l0_rxtermination from grf and remove rx

0 commit comments

Comments
 (0)