Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5146d771 authored by Ivan T. Ivanov's avatar Ivan T. Ivanov Committed by Olof Johansson
Browse files

usb: phy: msm: Move mach dependent code to platform data



This patch fix compilation error when driver is compiled
in multi-platform builds.

drivers/built-in.o: In function `msm_otg_link_clk_reset':
./drivers/usb/phy/phy-msm-usb.c:314: undefined reference to `clk_reset'
./drivers/usb/phy/phy-msm-usb.c:318: undefined reference to `clk_reset'

Use platform data supplied reset handlers and adjust error
messages reported when reset sequence fail.

This is an intermediate step before adding support for reset
framework and newer targets.

Signed-off-by: default avatarIvan T. Ivanov <iivanov@mm-sol.com>
Acked-by: default avatarDavid Brown <davidb@codeaurora.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parent 21dea669
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <asm/memory.h>
#include <asm/setup.h>

#include <mach/clk.h>
#include <mach/msm_iomap.h>
#include <mach/dma.h>

@@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {
	-1
};

static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
{
	int ret;

	if (assert) {
		ret = clk_reset(link_clk, CLK_RESET_ASSERT);
		if (ret)
			pr_err("usb hs_clk assert failed\n");
	} else {
		ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
		if (ret)
			pr_err("usb hs_clk deassert failed\n");
	}
	return ret;
}

static int hsusb_phy_clk_reset(struct clk *phy_clk)
{
	int ret;

	ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
	if (ret) {
		pr_err("usb phy clk assert failed\n");
		return ret;
	}
	usleep_range(10000, 12000);
	ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
	if (ret)
		pr_err("usb phy clk deassert failed\n");
	return ret;
}

static struct msm_otg_platform_data msm_otg_pdata = {
	.phy_init_seq		= hsusb_phy_init_seq,
	.mode                   = USB_PERIPHERAL,
	.otg_control		= OTG_PHY_CONTROL,
	.link_clk_reset		= hsusb_link_clk_reset,
	.phy_clk_reset		= hsusb_phy_clk_reset,
};

struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
+35 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <mach/irqs.h>
#include <mach/sirc.h>
#include <mach/vreg.h>
#include <mach/clk.h>
#include <linux/platform_data/mmc-msm_sdcc.h>

#include "devices.h"
@@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = {
	-1
};

static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
{
	int ret;

	if (assert) {
		ret = clk_reset(link_clk, CLK_RESET_ASSERT);
		if (ret)
			pr_err("usb hs_clk assert failed\n");
	} else {
		ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
		if (ret)
			pr_err("usb hs_clk deassert failed\n");
	}
	return ret;
}

static int hsusb_phy_clk_reset(struct clk *phy_clk)
{
	int ret;

	ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
	if (ret) {
		pr_err("usb phy clk assert failed\n");
		return ret;
	}
	usleep_range(10000, 12000);
	ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
	if (ret)
		pr_err("usb phy clk deassert failed\n");
	return ret;
}

static struct msm_otg_platform_data msm_otg_pdata = {
	.phy_init_seq		= hsusb_phy_init_seq,
	.mode                   = USB_PERIPHERAL,
	.otg_control		= OTG_PHY_CONTROL,
	.link_clk_reset		= hsusb_link_clk_reset,
	.phy_clk_reset		= hsusb_phy_clk_reset,
};

static struct platform_device *devices[] __initdata = {
+15 −20
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@
#include <linux/usb/msm_hsusb_hw.h>
#include <linux/regulator/consumer.h>

#include <mach/clk.h>

#define MSM_USB_BASE	(motg->regs)
#define DRIVER_NAME	"msm_otg"

@@ -308,33 +306,30 @@ static void ulpi_init(struct msm_otg *motg)

static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
{
	int ret;
	int ret = 0;

	if (assert) {
		ret = clk_reset(motg->clk, CLK_RESET_ASSERT);
		if (ret)
			dev_err(motg->phy.dev, "usb hs_clk assert failed\n");
	} else {
		ret = clk_reset(motg->clk, CLK_RESET_DEASSERT);
	if (!motg->pdata->link_clk_reset)
		return ret;

	ret = motg->pdata->link_clk_reset(motg->clk, assert);
	if (ret)
			dev_err(motg->phy.dev, "usb hs_clk deassert failed\n");
	}
		dev_err(motg->phy.dev, "usb link clk reset %s failed\n",
			assert ? "assert" : "deassert");

	return ret;
}

static int msm_otg_phy_clk_reset(struct msm_otg *motg)
{
	int ret;
	int ret = 0;

	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT);
	if (ret) {
		dev_err(motg->phy.dev, "usb phy clk assert failed\n");
	if (!motg->pdata->phy_clk_reset)
		return ret;
	}
	usleep_range(10000, 12000);
	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT);

	ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
	if (ret)
		dev_err(motg->phy.dev, "usb phy clk deassert failed\n");
		dev_err(motg->phy.dev, "usb phy clk reset failed\n");

	return ret;
}

+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <linux/types.h>
#include <linux/usb/otg.h>
#include <linux/clk.h>

/**
 * Supported USB modes
@@ -135,6 +136,8 @@ struct msm_otg_platform_data {
	enum msm_usb_phy_type phy_type;
	void (*setup_gpio)(enum usb_otg_state state);
	char *pclk_src_name;
	int (*link_clk_reset)(struct clk *link_clk, bool assert);
	int (*phy_clk_reset)(struct clk *phy_clk);
};

/**