Commit 3e0c70d050c7ed6d163897a6ac894f063c31b10f

Authored by Nobuhiro Iwamatsu
Committed by Greg Kroah-Hartman
1 parent 7af395922a

usb: ehci-sh: Add PHY init function with platform data

In devices using ehci-sh, initialization of the PHY may be necessary.
This adds platform data to ehci-sh and provide function to initialize PHY.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
CC: Shimoda, Yoshihiro <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 2 changed files with 36 additions and 0 deletions Side-by-side Diff

drivers/usb/host/ehci-sh.c
... ... @@ -11,6 +11,7 @@
11 11 */
12 12 #include <linux/platform_device.h>
13 13 #include <linux/clk.h>
  14 +#include <linux/platform_data/ehci-sh.h>
14 15  
15 16 struct ehci_sh_priv {
16 17 struct clk *iclk, *fclk;
... ... @@ -100,6 +101,7 @@
100 101 const struct hc_driver *driver = &ehci_sh_hc_driver;
101 102 struct resource *res;
102 103 struct ehci_sh_priv *priv;
  104 + struct ehci_sh_platdata *pdata;
103 105 struct usb_hcd *hcd;
104 106 int irq, ret;
105 107  
... ... @@ -124,6 +126,9 @@
124 126 goto fail_create_hcd;
125 127 }
126 128  
  129 + if (pdev->dev.platform_data != NULL)
  130 + pdata = pdev->dev.platform_data;
  131 +
127 132 /* initialize hcd */
128 133 hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev,
129 134 dev_name(&pdev->dev));
... ... @@ -167,6 +172,9 @@
167 172  
168 173 clk_enable(priv->fclk);
169 174 clk_enable(priv->iclk);
  175 +
  176 + if (pdata && pdata->phy_init)
  177 + pdata->phy_init();
170 178  
171 179 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
172 180 if (ret != 0) {
include/linux/platform_data/ehci-sh.h
  1 +/*
  2 + * EHCI SuperH driver platform data
  3 + *
  4 + * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  5 + * Copyright (C) 2012 Renesas Solutions Corp.
  6 + *
  7 + * This program is free software; you can redistribute it and/or modify
  8 + * it under the terms of the GNU General Public License as published by
  9 + * the Free Software Foundation; version 2 of the License.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU General Public License
  17 + * along with this program; if not, write to the Free Software
  18 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19 + */
  20 +
  21 +#ifndef __USB_EHCI_SH_H
  22 +#define __USB_EHCI_SH_H
  23 +
  24 +struct ehci_sh_platdata {
  25 + void (*phy_init)(void); /* Phy init function */
  26 +};
  27 +
  28 +#endif /* __USB_EHCI_SH_H */