From: Julius Werner <jwerner@chromium.org>
To: Felipe Balbi <balbi@ti.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
linux-samsung-soc@vger.kernel.org,
Tomasz Figa <t.figa@samsung.com>,
Vivek Gautam <gautam.vivek@samsung.com>,
devicetree@vger.kernel.org,
Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
Julius Werner <jwerner@chromium.org>
Subject: [PATCH 3/3] usb: phy-samsung-usb: Remove USB_PHY_TYPE from Samsung PHY driver
Date: Thu, 1 Aug 2013 17:52:06 -0700 [thread overview]
Message-ID: <1375404726-26264-4-git-send-email-jwerner@chromium.org> (raw)
In-Reply-To: <1375404726-26264-1-git-send-email-jwerner@chromium.org>
Since the PMU register handling was simplified, the last reason to
differentiate between HOST and DEVICE PHYs in the Samsung USB PHY driver
has disappeared. This patch removes that variable and reworks
surrounding code to live without it to make the driver a little smaller
and cleaner.
Signed-off-by: Julius Werner <jwerner@chromium.org>
---
drivers/usb/phy/phy-samsung-usb.c | 23 +++--------------------
drivers/usb/phy/phy-samsung-usb.h | 7 +------
drivers/usb/phy/phy-samsung-usb2.c | 19 +++----------------
drivers/usb/phy/phy-samsung-usb3.c | 7 -------
4 files changed, 7 insertions(+), 49 deletions(-)
diff --git a/drivers/usb/phy/phy-samsung-usb.c b/drivers/usb/phy/phy-samsung-usb.c
index fa382c9..32c5264 100644
--- a/drivers/usb/phy/phy-samsung-usb.c
+++ b/drivers/usb/phy/phy-samsung-usb.c
@@ -27,7 +27,6 @@
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
-#include <linux/usb/samsung_usb_phy.h>
#include "phy-samsung-usb.h"
@@ -101,7 +100,7 @@ EXPORT_SYMBOL_GPL(samsung_usbphy_set_isolation_4210);
/*
* Configure the mode of working of usb-phy here: HOST/DEVICE.
*/
-void samsung_usbphy_cfg_sel(struct samsung_usbphy *sphy)
+void samsung_usbphy_cfg_sel(struct samsung_usbphy *sphy, bool device_mode)
{
u32 reg;
@@ -112,31 +111,15 @@ void samsung_usbphy_cfg_sel(struct samsung_usbphy *sphy)
reg = readl(sphy->sysreg);
- if (sphy->phy_type == USB_PHY_TYPE_DEVICE)
+ if (device_mode)
reg &= ~EXYNOS_USB20PHY_CFG_HOST_LINK;
- else if (sphy->phy_type == USB_PHY_TYPE_HOST)
+ else
reg |= EXYNOS_USB20PHY_CFG_HOST_LINK;
writel(reg, sphy->sysreg);
}
EXPORT_SYMBOL_GPL(samsung_usbphy_cfg_sel);
-/*
- * PHYs are different for USB Device and USB Host.
- * This make sure that correct PHY type is selected before
- * any operation on PHY.
- */
-int samsung_usbphy_set_type(struct usb_phy *phy,
- enum samsung_usb_phy_type phy_type)
-{
- struct samsung_usbphy *sphy = phy_to_sphy(phy);
-
- sphy->phy_type = phy_type;
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(samsung_usbphy_set_type);
-
int samsung_usbphy_rate_to_clksel_64xx(struct samsung_usbphy *sphy,
unsigned long rate)
{
diff --git a/drivers/usb/phy/phy-samsung-usb.h b/drivers/usb/phy/phy-samsung-usb.h
index f2e9c4a..0c0d7d1 100644
--- a/drivers/usb/phy/phy-samsung-usb.h
+++ b/drivers/usb/phy/phy-samsung-usb.h
@@ -285,8 +285,6 @@ struct samsung_usbphy_drvdata {
* @sysreg: USB2.0 PHY_CFG register memory base
* @ref_clk_freq: reference clock frequency selection
* @drv_data: driver data available for different SoCs
- * @phy_type: Samsung SoCs specific phy types: #HOST
- * #DEVICE
* @phy_usage: usage count for phy
* @lock: lock for phy operations
*/
@@ -300,7 +298,6 @@ struct samsung_usbphy {
void __iomem *sysreg;
int ref_clk_freq;
const struct samsung_usbphy_drvdata *drv_data;
- enum samsung_usb_phy_type phy_type;
atomic_t phy_usage;
spinlock_t lock;
};
@@ -326,9 +323,7 @@ static inline const struct samsung_usbphy_drvdata
extern int samsung_usbphy_parse_dt(struct samsung_usbphy *sphy);
extern void samsung_usbphy_set_isolation_4210(struct samsung_usbphy *sphy,
bool on);
-extern void samsung_usbphy_cfg_sel(struct samsung_usbphy *sphy);
-extern int samsung_usbphy_set_type(struct usb_phy *phy,
- enum samsung_usb_phy_type phy_type);
+extern void samsung_usbphy_cfg_sel(struct samsung_usbphy *sphy, bool dev_mode);
extern int samsung_usbphy_get_refclk_freq(struct samsung_usbphy *sphy);
extern int samsung_usbphy_rate_to_clksel_64xx(struct samsung_usbphy *sphy,
unsigned long rate);
diff --git a/drivers/usb/phy/phy-samsung-usb2.c b/drivers/usb/phy/phy-samsung-usb2.c
index c2c83d4..eb215a1 100644
--- a/drivers/usb/phy/phy-samsung-usb2.c
+++ b/drivers/usb/phy/phy-samsung-usb2.c
@@ -27,7 +27,6 @@
#include <linux/io.h>
#include <linux/of.h>
#include <linux/usb/otg.h>
-#include <linux/usb/samsung_usb_phy.h>
#include <linux/platform_data/samsung-usbphy.h>
#include "phy-samsung-usb.h"
@@ -283,13 +282,13 @@ static int samsung_usb2phy_init(struct usb_phy *phy)
spin_lock_irqsave(&sphy->lock, flags);
+ /* Selecting Host/OTG mode; After reset USB2.0PHY_CFG: HOST */
if (host) {
- /* setting default phy-type for USB 2.0 */
if (!strstr(dev_name(host->controller), "ehci") ||
!strstr(dev_name(host->controller), "ohci"))
- samsung_usbphy_set_type(&sphy->phy, USB_PHY_TYPE_HOST);
+ samsung_usbphy_cfg_sel(sphy, false);
} else {
- samsung_usbphy_set_type(&sphy->phy, USB_PHY_TYPE_DEVICE);
+ samsung_usbphy_cfg_sel(sphy, true);
}
/* Disable phy isolation */
@@ -298,9 +297,6 @@ static int samsung_usb2phy_init(struct usb_phy *phy)
else if (sphy->drv_data->set_isolation)
sphy->drv_data->set_isolation(sphy, false);
- /* Selecting Host/OTG mode; After reset USB2.0PHY_CFG: HOST */
- samsung_usbphy_cfg_sel(sphy);
-
/* Initialize usb phy registers */
sphy->drv_data->phy_enable(sphy);
@@ -332,15 +328,6 @@ static void samsung_usb2phy_shutdown(struct usb_phy *phy)
spin_lock_irqsave(&sphy->lock, flags);
- if (host) {
- /* setting default phy-type for USB 2.0 */
- if (!strstr(dev_name(host->controller), "ehci") ||
- !strstr(dev_name(host->controller), "ohci"))
- samsung_usbphy_set_type(&sphy->phy, USB_PHY_TYPE_HOST);
- } else {
- samsung_usbphy_set_type(&sphy->phy, USB_PHY_TYPE_DEVICE);
- }
-
/* De-initialize usb phy registers */
sphy->drv_data->phy_disable(sphy);
diff --git a/drivers/usb/phy/phy-samsung-usb3.c b/drivers/usb/phy/phy-samsung-usb3.c
index 6259a35..ac05d91 100644
--- a/drivers/usb/phy/phy-samsung-usb3.c
+++ b/drivers/usb/phy/phy-samsung-usb3.c
@@ -24,7 +24,6 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/of.h>
-#include <linux/usb/samsung_usb_phy.h>
#include <linux/platform_data/samsung-usbphy.h>
#include "phy-samsung-usb.h"
@@ -178,9 +177,6 @@ static int samsung_usb3phy_init(struct usb_phy *phy)
spin_lock_irqsave(&sphy->lock, flags);
- /* setting default phy-type for USB 3.0 */
- samsung_usbphy_set_type(&sphy->phy, USB_PHY_TYPE_DEVICE);
-
/* Disable phy isolation */
if (sphy->drv_data->set_isolation)
sphy->drv_data->set_isolation(sphy, false);
@@ -213,9 +209,6 @@ static void samsung_usb3phy_shutdown(struct usb_phy *phy)
spin_lock_irqsave(&sphy->lock, flags);
- /* setting default phy-type for USB 3.0 */
- samsung_usbphy_set_type(&sphy->phy, USB_PHY_TYPE_DEVICE);
-
/* De-initialize usb phy registers */
sphy->drv_data->phy_disable(sphy);
--
1.7.12.4
prev parent reply other threads:[~2013-08-02 0:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 0:52 [PATCH 0/3] usb: phy-samsung-usb: Simplify and cleanup Julius Werner
2013-08-02 0:52 ` [PATCH 1/3] usb: phy-samsung-usb: Simplify PMU register handling Julius Werner
2013-08-02 7:51 ` Felipe Balbi
2013-08-06 18:00 ` Julius Werner
2013-08-02 0:52 ` [PATCH 2/3] usb: phy-samsung-usb: trivial: rename pmuregs variable Julius Werner
2013-08-02 0:52 ` Julius Werner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375404726-26264-4-git-send-email-jwerner@chromium.org \
--to=jwerner@chromium.org \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=gautam.vivek@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sylvester.nawrocki@gmail.com \
--cc=t.figa@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).