mirror of
https://github.com/torvalds/linux.git
synced 2024-11-07 20:51:47 +00:00
61464c8357
This is a large branch that contains a handful of different cleanups: - Fixing up the I/O space remapping on PCI on ARM. This is a series from Rob Herring that restructures how all pci devices allocate I/O space, and it's part of the work to allow multiplatform kernels. - A number of cleanup series for OMAP, moving and removing some headers, sparse irq rework and in general preparation for multiplatform. - Final removal of all non-DT boards for Tegra, it is now device-tree-only! - Removal of a stale platform, nxp4008. It's an old mobile chipset that is no longer in use, and was very likely never really used with a mainline kernel. We have not been able to find anyone interested in keeping it around in the kernel. - Removal of the legacy dmaengine driver on tegra + A handful of other things that I haven't described above. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJQaO1fAAoJEIwa5zzehBx3IPgP/jxoO1flVGNVf0reqqyDro/w prZmp8cNVH9uv8xG9n9vawObrMQ8M6jCJ449fEWuAZ58EXrpIPd0kkm/MOmxp8K1 LNs+q2aXxWpD488+b3RK55g3fksqZutTbn3y6HNuCoLG9l8yT/95KX4IIzfEP2Ch 1TCNHdkTbf37nTBOmKN0x1kahGpWDrOkf9ysHQq+DXAGF4uwNwtR194dqz3HbDND hZqRq7qCLn9OwGRGNicPFoB6UcxwZ/+/+u5sX7nqPGoiPofg977mhWk1DFO15EM3 S+A6g0dZ+XLsL+fFtOl4snSmrG5Et6qTOP0/ItQJgTG+5YdCS09ohCWJwRCBHbgj M5arOkyGFdVAlvX7cUux374sMe0AcqUsEmt79mYuBpIE+pBJaRUoCgDcs9FDZeUB U6WcE4AkxMtW7DtmVW+mF4ls9/K6cRXgWMuHCUmt1o3m3Ly9ITT7j+ntXnD9nuYk ndoVLR6Vxk2BzlkD0JEtg7FRAS9Wgo2DBix05qM1Qkut2iIZRhFQlqJQpNbeNdii /3Lg/hqpAVTZKGCd+paegHez61meyFz2PB2IiE0JKANhKHRCWTWRGgKIXkGyCiXk wJ2iRCOlMEpmpJgCBzfI32ER/hnW4s64iDjgksEwz6pEt7xCbhwgmwrpf0H0KsSF rLroHOMqyISd/Ha52Vin =ck1u -----END PGP SIGNATURE----- Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM soc general cleanups from Olof Johansson: "This is a large branch that contains a handful of different cleanups: - Fixing up the I/O space remapping on PCI on ARM. This is a series from Rob Herring that restructures how all pci devices allocate I/O space, and it's part of the work to allow multiplatform kernels. - A number of cleanup series for OMAP, moving and removing some headers, sparse irq rework and in general preparation for multiplatform. - Final removal of all non-DT boards for Tegra, it is now device-tree-only! - Removal of a stale platform, nxp4008. It's an old mobile chipset that is no longer in use, and was very likely never really used with a mainline kernel. We have not been able to find anyone interested in keeping it around in the kernel. - Removal of the legacy dmaengine driver on tegra + A handful of other things that I haven't described above." Fix up some conflicts with the staging tree (and because nxp4008 was removed) * tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (184 commits) ARM: OMAP2+: serial: Change MAX_HSUART_PORTS to 6 ARM: OMAP4: twl-common: Support for additional devices on i2c1 bus ARM: mmp: using for_each_set_bit to simplify the code ARM: tegra: harmony: fix ldo7 regulator-name ARM: OMAP2+: Make omap4-keypad.h local ARM: OMAP2+: Make l4_3xxx.h local ARM: OMAP2+: Make l4_2xxx.h local ARM: OMAP2+: Make l3_3xxx.h local ARM: OMAP2+: Make l3_2xxx.h local ARM: OMAP1: Move irda.h from plat to mach ARM: OMAP2+: Make hdq1w.h local ARM: OMAP2+: Make gpmc-smsc911x.h local ARM: OMAP2+: Make gpmc-smc91x.h local ARM: OMAP1: Move flash.h from plat to mach ARM: OMAP2+: Make debug-devices.h local ARM: OMAP1: Move board-voiceblue.h from plat to mach ARM: OMAP1: Move board-sx1.h from plat to mach ARM: OMAP2+: Make omap-wakeupgen.h local ARM: OMAP2+: Make omap-secure.h local ARM: OMAP2+: Make ctrl_module_wkup_44xx.h local ...
156 lines
4.0 KiB
C
156 lines
4.0 KiB
C
/*
|
|
* This file configures the internal USB PHY in OMAP4430. Used
|
|
* with TWL6030 transceiver and MUSB on OMAP4430.
|
|
*
|
|
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Author: Hema HK <hemahk@ti.com>
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/io.h>
|
|
#include <linux/err.h>
|
|
#include <linux/usb.h>
|
|
|
|
#include <plat/usb.h>
|
|
|
|
#include "soc.h"
|
|
#include "control.h"
|
|
|
|
void am35x_musb_reset(void)
|
|
{
|
|
u32 regval;
|
|
|
|
/* Reset the musb interface */
|
|
regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
|
|
|
|
regval |= AM35XX_USBOTGSS_SW_RST;
|
|
omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET);
|
|
|
|
regval &= ~AM35XX_USBOTGSS_SW_RST;
|
|
omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET);
|
|
|
|
regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
|
|
}
|
|
|
|
void am35x_musb_phy_power(u8 on)
|
|
{
|
|
unsigned long timeout = jiffies + msecs_to_jiffies(100);
|
|
u32 devconf2;
|
|
|
|
if (on) {
|
|
/*
|
|
* Start the on-chip PHY and its PLL.
|
|
*/
|
|
devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
|
|
|
|
devconf2 &= ~(CONF2_RESET | CONF2_PHYPWRDN | CONF2_OTGPWRDN);
|
|
devconf2 |= CONF2_PHY_PLLON;
|
|
|
|
omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
|
|
|
|
pr_info(KERN_INFO "Waiting for PHY clock good...\n");
|
|
while (!(omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2)
|
|
& CONF2_PHYCLKGD)) {
|
|
cpu_relax();
|
|
|
|
if (time_after(jiffies, timeout)) {
|
|
pr_err(KERN_ERR "musb PHY clock good timed out\n");
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
/*
|
|
* Power down the on-chip PHY.
|
|
*/
|
|
devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
|
|
|
|
devconf2 &= ~CONF2_PHY_PLLON;
|
|
devconf2 |= CONF2_PHYPWRDN | CONF2_OTGPWRDN;
|
|
omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
|
|
}
|
|
}
|
|
|
|
void am35x_musb_clear_irq(void)
|
|
{
|
|
u32 regval;
|
|
|
|
regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
|
|
regval |= AM35XX_USBOTGSS_INT_CLR;
|
|
omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
|
|
regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
|
|
}
|
|
|
|
void am35x_set_mode(u8 musb_mode)
|
|
{
|
|
u32 devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
|
|
|
|
devconf2 &= ~CONF2_OTGMODE;
|
|
switch (musb_mode) {
|
|
case MUSB_HOST: /* Force VBUS valid, ID = 0 */
|
|
devconf2 |= CONF2_FORCE_HOST;
|
|
break;
|
|
case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */
|
|
devconf2 |= CONF2_FORCE_DEVICE;
|
|
break;
|
|
case MUSB_OTG: /* Don't override the VBUS/ID comparators */
|
|
devconf2 |= CONF2_NO_OVERRIDE;
|
|
break;
|
|
default:
|
|
pr_info(KERN_INFO "Unsupported mode %u\n", musb_mode);
|
|
}
|
|
|
|
omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
|
|
}
|
|
|
|
void ti81xx_musb_phy_power(u8 on)
|
|
{
|
|
void __iomem *scm_base = NULL;
|
|
u32 usbphycfg;
|
|
|
|
scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
|
|
if (!scm_base) {
|
|
pr_err("system control module ioremap failed\n");
|
|
return;
|
|
}
|
|
|
|
usbphycfg = __raw_readl(scm_base + USBCTRL0);
|
|
|
|
if (on) {
|
|
if (cpu_is_ti816x()) {
|
|
usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
|
|
usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
|
|
} else if (cpu_is_ti814x()) {
|
|
usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
|
|
| USBPHY_DPINPUT | USBPHY_DMINPUT);
|
|
usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
|
|
| USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
|
|
}
|
|
} else {
|
|
if (cpu_is_ti816x())
|
|
usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
|
|
else if (cpu_is_ti814x())
|
|
usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
|
|
|
|
}
|
|
__raw_writel(usbphycfg, scm_base + USBCTRL0);
|
|
|
|
iounmap(scm_base);
|
|
}
|