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

Commit 8062d94a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'xceiv-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

USB: transceiver changes for 3.4

Here we have a big rework done by Heikki Krogerus (thanks) which
splits OTG functionality away from transceivers.

We have known for quite a long time that struct otg_transceiver was
a bad name for the structure, considering transceiver is far from
being OTG-specific (see 4e67185a).
parents 15e68a80 6e13c650
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ static int devboard_usbh1_hw_init(struct platform_device *pdev)
#define USBH1_VBUSEN_B	IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
#define USBH1_MODE	IOMUX_TO_GPIO(MX31_PIN_NFALE)

static int devboard_isp1105_init(struct otg_transceiver *otg)
static int devboard_isp1105_init(struct usb_phy *otg)
{
	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
	if (ret)
@@ -177,7 +177,7 @@ static int devboard_isp1105_init(struct otg_transceiver *otg)
}


static int devboard_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
static int devboard_isp1105_set_vbus(struct usb_otg *otg, bool on)
{
	if (on)
		gpio_set_value(USBH1_VBUSEN_B, 0);
@@ -194,18 +194,24 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = {

static int __init devboard_usbh1_init(void)
{
	struct otg_transceiver *otg;
	struct usb_phy *phy;
	struct platform_device *pdev;

	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
	if (!otg)
	phy = kzalloc(sizeof(*phy), GFP_KERNEL);
	if (!phy)
		return -ENOMEM;

	otg->label	= "ISP1105";
	otg->init	= devboard_isp1105_init;
	otg->set_vbus	= devboard_isp1105_set_vbus;
	phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
	if (!phy->otg) {
		kfree(phy);
		return -ENOMEM;
	}

	phy->label	= "ISP1105";
	phy->init	= devboard_isp1105_init;
	phy->otg->set_vbus	= devboard_isp1105_set_vbus;

	usbh1_pdata.otg = otg;
	usbh1_pdata.otg = phy;

	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
	if (IS_ERR(pdev))
+15 −9
Original line number Diff line number Diff line
@@ -272,7 +272,7 @@ static int marxbot_usbh1_hw_init(struct platform_device *pdev)
#define USBH1_VBUSEN_B	IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
#define USBH1_MODE	IOMUX_TO_GPIO(MX31_PIN_NFALE)

static int marxbot_isp1105_init(struct otg_transceiver *otg)
static int marxbot_isp1105_init(struct usb_phy *otg)
{
	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
	if (ret)
@@ -291,7 +291,7 @@ static int marxbot_isp1105_init(struct otg_transceiver *otg)
}


static int marxbot_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
static int marxbot_isp1105_set_vbus(struct usb_otg *otg, bool on)
{
	if (on)
		gpio_set_value(USBH1_VBUSEN_B, 0);
@@ -308,18 +308,24 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = {

static int __init marxbot_usbh1_init(void)
{
	struct otg_transceiver *otg;
	struct usb_phy *phy;
	struct platform_device *pdev;

	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
	if (!otg)
	phy = kzalloc(sizeof(*phy), GFP_KERNEL);
	if (!phy)
		return -ENOMEM;

	otg->label	= "ISP1105";
	otg->init	= marxbot_isp1105_init;
	otg->set_vbus	= marxbot_isp1105_set_vbus;
	phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
	if (!phy->otg) {
		kfree(phy);
		return -ENOMEM;
	}

	phy->label	= "ISP1105";
	phy->init	= marxbot_isp1105_init;
	phy->otg->set_vbus	= marxbot_isp1105_set_vbus;

	usbh1_pdata.otg = otg;
	usbh1_pdata.otg = phy;

	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
	if (IS_ERR(pdev))
+10 −10
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ struct pxa3xx_u2d_ulpi {
	struct clk		*clk;
	void __iomem		*mmio_base;

	struct otg_transceiver	*otg;
	struct usb_phy		*otg;
	unsigned int		ulpi_mode;
};

@@ -79,7 +79,7 @@ static int pxa310_ulpi_poll(void)
	return -ETIMEDOUT;
}

static int pxa310_ulpi_read(struct otg_transceiver *otg, u32 reg)
static int pxa310_ulpi_read(struct usb_phy *otg, u32 reg)
{
	int err;

@@ -98,7 +98,7 @@ static int pxa310_ulpi_read(struct otg_transceiver *otg, u32 reg)
	return u2d_readl(U2DOTGUCR) & U2DOTGUCR_RDATA;
}

static int pxa310_ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg)
static int pxa310_ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
{
	if (pxa310_ulpi_get_phymode() != SYNCH) {
		pr_warning("%s: PHY is not in SYNCH mode!\n", __func__);
@@ -111,7 +111,7 @@ static int pxa310_ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg)
	return pxa310_ulpi_poll();
}

struct otg_io_access_ops pxa310_ulpi_access_ops = {
struct usb_phy_io_ops pxa310_ulpi_access_ops = {
	.read	= pxa310_ulpi_read,
	.write	= pxa310_ulpi_write,
};
@@ -139,19 +139,19 @@ static int pxa310_start_otg_host_transcvr(struct usb_bus *host)

	pxa310_otg_transceiver_rtsm();

	err = otg_init(u2d->otg);
	err = usb_phy_init(u2d->otg);
	if (err) {
		pr_err("OTG transceiver init failed");
		return err;
	}

	err = otg_set_vbus(u2d->otg, 1);
	err = otg_set_vbus(u2d->otg->otg, 1);
	if (err) {
		pr_err("OTG transceiver VBUS set failed");
		return err;
	}

	err = otg_set_host(u2d->otg, host);
	err = otg_set_host(u2d->otg->otg, host);
	if (err)
		pr_err("OTG transceiver Host mode set failed");

@@ -189,9 +189,9 @@ static void pxa310_stop_otg_hc(void)
{
	pxa310_otg_transceiver_rtsm();

	otg_set_host(u2d->otg, NULL);
	otg_set_vbus(u2d->otg, 0);
	otg_shutdown(u2d->otg);
	otg_set_host(u2d->otg->otg, NULL);
	otg_set_vbus(u2d->otg->otg, 0);
	usb_phy_shutdown(u2d->otg);
}

static void pxa310_u2d_setup_otg_hc(void)
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ struct tegra_usb_phy {
	struct clk *pad_clk;
	enum tegra_usb_phy_mode mode;
	void *config;
	struct otg_transceiver *ulpi;
	struct usb_phy *ulpi;
};

struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
+2 −2
Original line number Diff line number Diff line
@@ -608,13 +608,13 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
	writel(val, base + ULPI_TIMING_CTRL_1);

	/* Fix VbusInvalid due to floating VBUS */
	ret = otg_io_write(phy->ulpi, 0x40, 0x08);
	ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08);
	if (ret) {
		pr_err("%s: ulpi write failed\n", __func__);
		return ret;
	}

	ret = otg_io_write(phy->ulpi, 0x80, 0x0B);
	ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B);
	if (ret) {
		pr_err("%s: ulpi write failed\n", __func__);
		return ret;
Loading