Commit 801a69c7 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Kishon Vijay Abraham I

phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data

Since this driver uses the struct rcar_gen3_data in struct rcar_gen3_chan
only, we can remove the rcar_gen3_data.
Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent 2bcdf181
...@@ -74,20 +74,15 @@ ...@@ -74,20 +74,15 @@
#define USB2_ADPCTRL_IDPULLUP BIT(5) /* 1 = ID sampling is enabled */ #define USB2_ADPCTRL_IDPULLUP BIT(5) /* 1 = ID sampling is enabled */
#define USB2_ADPCTRL_DRVVBUS BIT(4) #define USB2_ADPCTRL_DRVVBUS BIT(4)
struct rcar_gen3_data {
void __iomem *base;
struct clk *clk;
};
struct rcar_gen3_chan { struct rcar_gen3_chan {
struct rcar_gen3_data usb2; void __iomem *base;
struct phy *phy; struct phy *phy;
bool has_otg; bool has_otg;
}; };
static void rcar_gen3_set_host_mode(struct rcar_gen3_chan *ch, int host) static void rcar_gen3_set_host_mode(struct rcar_gen3_chan *ch, int host)
{ {
void __iomem *usb2_base = ch->usb2.base; void __iomem *usb2_base = ch->base;
u32 val = readl(usb2_base + USB2_COMMCTRL); u32 val = readl(usb2_base + USB2_COMMCTRL);
dev_vdbg(&ch->phy->dev, "%s: %08x, %d\n", __func__, val, host); dev_vdbg(&ch->phy->dev, "%s: %08x, %d\n", __func__, val, host);
...@@ -100,7 +95,7 @@ static void rcar_gen3_set_host_mode(struct rcar_gen3_chan *ch, int host) ...@@ -100,7 +95,7 @@ static void rcar_gen3_set_host_mode(struct rcar_gen3_chan *ch, int host)
static void rcar_gen3_set_linectrl(struct rcar_gen3_chan *ch, int dp, int dm) static void rcar_gen3_set_linectrl(struct rcar_gen3_chan *ch, int dp, int dm)
{ {
void __iomem *usb2_base = ch->usb2.base; void __iomem *usb2_base = ch->base;
u32 val = readl(usb2_base + USB2_LINECTRL1); u32 val = readl(usb2_base + USB2_LINECTRL1);
dev_vdbg(&ch->phy->dev, "%s: %08x, %d, %d\n", __func__, val, dp, dm); dev_vdbg(&ch->phy->dev, "%s: %08x, %d, %d\n", __func__, val, dp, dm);
...@@ -114,7 +109,7 @@ static void rcar_gen3_set_linectrl(struct rcar_gen3_chan *ch, int dp, int dm) ...@@ -114,7 +109,7 @@ static void rcar_gen3_set_linectrl(struct rcar_gen3_chan *ch, int dp, int dm)
static void rcar_gen3_enable_vbus_ctrl(struct rcar_gen3_chan *ch, int vbus) static void rcar_gen3_enable_vbus_ctrl(struct rcar_gen3_chan *ch, int vbus)
{ {
void __iomem *usb2_base = ch->usb2.base; void __iomem *usb2_base = ch->base;
u32 val = readl(usb2_base + USB2_ADPCTRL); u32 val = readl(usb2_base + USB2_ADPCTRL);
dev_vdbg(&ch->phy->dev, "%s: %08x, %d\n", __func__, val, vbus); dev_vdbg(&ch->phy->dev, "%s: %08x, %d\n", __func__, val, vbus);
...@@ -141,13 +136,13 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch) ...@@ -141,13 +136,13 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch) static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch)
{ {
return !!(readl(ch->usb2.base + USB2_ADPCTRL) & return !!(readl(ch->base + USB2_ADPCTRL) &
USB2_ADPCTRL_OTGSESSVLD); USB2_ADPCTRL_OTGSESSVLD);
} }
static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
{ {
return !!(readl(ch->usb2.base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG); return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
} }
static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch) static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch)
...@@ -166,7 +161,7 @@ static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch) ...@@ -166,7 +161,7 @@ static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch)
static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch) static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch)
{ {
void __iomem *usb2_base = ch->usb2.base; void __iomem *usb2_base = ch->base;
u32 val; u32 val;
val = readl(usb2_base + USB2_VBCTRL); val = readl(usb2_base + USB2_VBCTRL);
...@@ -187,7 +182,7 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch) ...@@ -187,7 +182,7 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch)
static int rcar_gen3_phy_usb2_init(struct phy *p) static int rcar_gen3_phy_usb2_init(struct phy *p)
{ {
struct rcar_gen3_chan *channel = phy_get_drvdata(p); struct rcar_gen3_chan *channel = phy_get_drvdata(p);
void __iomem *usb2_base = channel->usb2.base; void __iomem *usb2_base = channel->base;
/* Initialize USB2 part */ /* Initialize USB2 part */
writel(USB2_INT_ENABLE_INIT, usb2_base + USB2_INT_ENABLE); writel(USB2_INT_ENABLE_INIT, usb2_base + USB2_INT_ENABLE);
...@@ -205,7 +200,7 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p) ...@@ -205,7 +200,7 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p)
{ {
struct rcar_gen3_chan *channel = phy_get_drvdata(p); struct rcar_gen3_chan *channel = phy_get_drvdata(p);
writel(0, channel->usb2.base + USB2_INT_ENABLE); writel(0, channel->base + USB2_INT_ENABLE);
return 0; return 0;
} }
...@@ -213,7 +208,7 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p) ...@@ -213,7 +208,7 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p)
static int rcar_gen3_phy_usb2_power_on(struct phy *p) static int rcar_gen3_phy_usb2_power_on(struct phy *p)
{ {
struct rcar_gen3_chan *channel = phy_get_drvdata(p); struct rcar_gen3_chan *channel = phy_get_drvdata(p);
void __iomem *usb2_base = channel->usb2.base; void __iomem *usb2_base = channel->base;
u32 val; u32 val;
val = readl(usb2_base + USB2_USBCTR); val = readl(usb2_base + USB2_USBCTR);
...@@ -235,7 +230,7 @@ static struct phy_ops rcar_gen3_phy_usb2_ops = { ...@@ -235,7 +230,7 @@ static struct phy_ops rcar_gen3_phy_usb2_ops = {
static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch)
{ {
struct rcar_gen3_chan *ch = _ch; struct rcar_gen3_chan *ch = _ch;
void __iomem *usb2_base = ch->usb2.base; void __iomem *usb2_base = ch->base;
u32 status = readl(usb2_base + USB2_OBINTSTA); u32 status = readl(usb2_base + USB2_OBINTSTA);
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
...@@ -274,9 +269,9 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) ...@@ -274,9 +269,9 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
channel->usb2.base = devm_ioremap_resource(dev, res); channel->base = devm_ioremap_resource(dev, res);
if (IS_ERR(channel->usb2.base)) if (IS_ERR(channel->base))
return PTR_ERR(channel->usb2.base); return PTR_ERR(channel->base);
/* call request_irq for OTG */ /* call request_irq for OTG */
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment