phy: rockchip-usb: delete unused functionality

Deleted phy operations for rk336x and rk3399, because they
use Inno USB2.0 PHY, and we have added a new phy driver for
them. This can make our phy driver to stay closer to upstream.

Change-Id: I3b70cd78564c6a9873be88fc19954a8c2f95dd98
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2018-05-16 18:37:12 +08:00
committed by Tao Huang
parent e1bcb0e4eb
commit 44b30beec8

View File

@@ -17,7 +17,6 @@
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
@@ -40,14 +39,6 @@
#define SIDDQ_ON BIT(13)
#define SIDDQ_OFF (0 << 13)
#define USB2_PHY_WRITE_ENA (0xffff << 16)
#define USB2_PHY_SUSPEND (0x5 << 0 | 0xd << 4 | 0x1 << 8)
#define USB2_PHY_RESUME (0)
#define UTMI_SEL_GRF_WR_ENA (0x3 << 16)
#define UTMI_SEL_GRF_SUSPEND (0x1 << 0)
#define UTMI_SEL_GRF_RESUME (0x2 << 0)
struct rockchip_usb_phys {
int reg;
const char *pll_name;
@@ -55,15 +46,11 @@ struct rockchip_usb_phys {
struct rockchip_usb_phy_pdata {
struct rockchip_usb_phys *phys;
unsigned int phy_pw_on;
unsigned int phy_pw_off;
bool siddq_ctl;
};
struct rockchip_usb_phy_base {
struct device *dev;
struct regmap *reg_base;
struct gpio_desc *vbus_drv_gpio;
const struct rockchip_usb_phy_pdata *pdata;
};
@@ -79,12 +66,10 @@ struct rockchip_usb_phy {
};
static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
bool off)
bool siddq)
{
unsigned int val;
val = !off ? phy->base->pdata->phy_pw_on : phy->base->pdata->phy_pw_off;
return regmap_write(phy->base->reg_base, phy->reg_offset, val);
return regmap_write(phy->base->reg_base, phy->reg_offset,
SIDDQ_WRITE_ENA | (siddq ? SIDDQ_ON : SIDDQ_OFF));
}
static unsigned long rockchip_usb_phy480m_recalc_rate(struct clk_hw *hw,
@@ -100,22 +85,17 @@ static void rockchip_usb_phy480m_disable(struct clk_hw *hw)
clk480m_hw);
/* Power down usb phy analog blocks by set siddq 1 */
if (phy->base->pdata->siddq_ctl)
rockchip_usb_phy_power(phy, 1);
rockchip_usb_phy_power(phy, 1);
}
static int rockchip_usb_phy480m_enable(struct clk_hw *hw)
{
int ret = 0;
struct rockchip_usb_phy *phy = container_of(hw,
struct rockchip_usb_phy,
clk480m_hw);
/* Power up usb phy analog blocks by set siddq 0 */
if (phy->base->pdata->siddq_ctl)
ret = rockchip_usb_phy_power(phy, 0);
return ret;
return rockchip_usb_phy_power(phy, 0);
}
static int rockchip_usb_phy480m_is_enabled(struct clk_hw *hw)
@@ -123,18 +103,14 @@ static int rockchip_usb_phy480m_is_enabled(struct clk_hw *hw)
struct rockchip_usb_phy *phy = container_of(hw,
struct rockchip_usb_phy,
clk480m_hw);
int ret = 1;
int ret;
u32 val;
if (phy->base->pdata->siddq_ctl) {
ret = regmap_read(phy->base->reg_base, phy->reg_offset, &val);
if (ret < 0)
return ret;
ret = regmap_read(phy->base->reg_base, phy->reg_offset, &val);
if (ret < 0)
return ret;
ret = (val & SIDDQ_ON) ? 0 : 1;
}
return ret;
return (val & SIDDQ_ON) ? 0 : 1;
}
static const struct clk_ops rockchip_usb_phy480m_ops = {
@@ -146,32 +122,18 @@ static const struct clk_ops rockchip_usb_phy480m_ops = {
static int rockchip_usb_phy_power_off(struct phy *_phy)
{
int ret = 0;
struct rockchip_usb_phy *phy = phy_get_drvdata(_phy);
if (!phy->base->pdata->siddq_ctl) {
ret = rockchip_usb_phy_power(phy, 1);
if (ret)
return ret;
}
clk_disable_unprepare(phy->clk480m);
return 0;
}
static int rockchip_usb_phy_power_on(struct phy *_phy)
{
int ret = 0;
struct rockchip_usb_phy *phy = phy_get_drvdata(_phy);
ret = clk_prepare_enable(phy->clk480m);
if (ret)
return ret;
if (!phy->base->pdata->siddq_ctl)
ret = rockchip_usb_phy_power(phy, 0);
return ret;
return clk_prepare_enable(phy->clk480m);
}
static int rockchip_usb_phy_reset(struct phy *_phy)
@@ -323,9 +285,6 @@ static const struct rockchip_usb_phy_pdata rk3066a_pdata = {
{ .reg = 0x188, .pll_name = "sclk_otgphy1_480m" },
{ /* sentinel */ }
},
.phy_pw_on = SIDDQ_WRITE_ENA | SIDDQ_OFF,
.phy_pw_off = SIDDQ_WRITE_ENA | SIDDQ_ON,
.siddq_ctl = true,
};
static const struct rockchip_usb_phy_pdata rk3188_pdata = {
@@ -334,9 +293,6 @@ static const struct rockchip_usb_phy_pdata rk3188_pdata = {
{ .reg = 0x11c, .pll_name = "sclk_otgphy1_480m" },
{ /* sentinel */ }
},
.phy_pw_on = SIDDQ_WRITE_ENA | SIDDQ_OFF,
.phy_pw_off = SIDDQ_WRITE_ENA | SIDDQ_ON,
.siddq_ctl = true,
};
static const struct rockchip_usb_phy_pdata rk3288_pdata = {
@@ -346,31 +302,6 @@ static const struct rockchip_usb_phy_pdata rk3288_pdata = {
{ .reg = 0x348, .pll_name = "sclk_otgphy2_480m" },
{ /* sentinel */ }
},
.phy_pw_on = SIDDQ_WRITE_ENA | SIDDQ_OFF,
.phy_pw_off = SIDDQ_WRITE_ENA | SIDDQ_ON,
.siddq_ctl = true,
};
static const struct rockchip_usb_phy_pdata rk336x_pdata = {
.phys = (struct rockchip_usb_phys[]){
{ .reg = 0x700, .pll_name = "sclk_otgphy0_480m" },
{ .reg = 0x728, .pll_name = "sclk_otgphy1_480m" },
{ /* sentinel */ }
},
.phy_pw_on = USB2_PHY_WRITE_ENA | USB2_PHY_RESUME,
.phy_pw_off = USB2_PHY_WRITE_ENA | USB2_PHY_SUSPEND,
.siddq_ctl = false,
};
static const struct rockchip_usb_phy_pdata rk3399_pdata = {
.phys = (struct rockchip_usb_phys[]){
{ .reg = 0xe458, .pll_name = "sclk_otgphy0_480m" },
{ .reg = 0xe468, .pll_name = "sclk_otgphy1_480m" },
{ /* sentinel */ }
},
.phy_pw_on = UTMI_SEL_GRF_WR_ENA | UTMI_SEL_GRF_RESUME,
.phy_pw_off = UTMI_SEL_GRF_WR_ENA | UTMI_SEL_GRF_SUSPEND,
.siddq_ctl = false,
};
static int rockchip_usb_phy_probe(struct platform_device *pdev)
@@ -407,14 +338,6 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
return PTR_ERR(phy_base->reg_base);
}
/* Request the vbus_drv GPIO asserted */
phy_base->vbus_drv_gpio =
devm_gpiod_get_optional(dev, "vbus_drv", GPIOD_OUT_HIGH);
if (!phy_base->vbus_drv_gpio)
dev_info(&pdev->dev, "vbus_drv is not assigned!\n");
else if (IS_ERR(phy_base->vbus_drv_gpio))
return PTR_ERR(phy_base->vbus_drv_gpio);
for_each_available_child_of_node(dev->of_node, child) {
err = rockchip_usb_phy_init(phy_base, child);
if (err) {