mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
arm-soc: soc-specific updates
This is a larger set of new functionality for the existing SoC families,
including:
* vt8500 gains support for new CPU cores, notably the Cortex-A9 based wm8850
* prima2 gains support for the "marco" SoC family, its SMP based cousin
* tegra gains support for the new Tegra4 (Tegra114) family
* socfpga now supports a newer version of the hardware including SMP
* i.mx31 and bcm2835 are now using DT probing for their clocks
* lots of updates for sh-mobile
* OMAP updates for clocks, power management and USB
* i.mx6q and tegra now support cpuidle
* kirkwood now supports PCIe hot plugging
* tegra clock support is updated
* tegra USB PHY probing gets implemented diffently
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIVAwUAUSUyPGCrR//JCVInAQI4YA/+Nb0FaA7qMmTPuJhm7aZNfnwBcGxZ7IZp
s2xByEl3r5zbLKlKGNGE0x7Q7ETHV4y9tohzi9ZduH2b60dMRYgII06CEmDPu6/h
4vBap2oLzfWfs9hwpCIh7N9wNzxSj/R42vlXHhNmspHlw7cFk1yw5EeJ+ocxmZPq
H9lyjAxsGErkZyM/xstNQ1Uvhc8XHAFSUzWrg8hvf6AVVR8hwpIqVzfIizv6Vpk6
ryBoUBHfdTztAOrafK54CdRc7l6kVMomRodKGzMyasnBK3ZfFca3IR7elnxLyEFJ
uPDu5DKOdYrjXC8X2dPM6kYiE41YFuqOV2ahBt9HqRe6liNBLHQ6NAH7f7+jBWSI
eeWe84c2vFaqhAGlci/xm4GaP0ud5ZLudtiVPlDY5tYIADqLygNcx1HIt/5sT7QI
h34LMjc4+/TGVWTVf5yRmIzTrCXZv5YoAak3UWFoM4nVBo/eYVyNLEt5g9YsfjrC
P/GWrXJJvOCB3gAi31pgGYJzZg8K7kTTAh/dgxjqzU4f6nGRm5PBydiJe18/lWkH
qtfNE0RbhxCi3JEBnxW48AIEndVSRbd7jf8upC/s9rPURtFSVXp4APTHVyNUKCip
gojBxcRYtesyG/53nrwdTyiyHx6GocmWnMNZJoDo0UQEkog2dOef+StdC3zhc2Vm
9EttcFqWJ+E=
=PRrg
-----END PGP SIGNATURE-----
Merge tag 'soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC-specific updates from Arnd Bergmann:
"This is a larger set of new functionality for the existing SoC
families, including:
- vt8500 gains support for new CPU cores, notably the Cortex-A9 based
wm8850
- prima2 gains support for the "marco" SoC family, its SMP based
cousin
- tegra gains support for the new Tegra4 (Tegra114) family
- socfpga now supports a newer version of the hardware including SMP
- i.mx31 and bcm2835 are now using DT probing for their clocks
- lots of updates for sh-mobile
- OMAP updates for clocks, power management and USB
- i.mx6q and tegra now support cpuidle
- kirkwood now supports PCIe hot plugging
- tegra clock support is updated
- tegra USB PHY probing gets implemented diffently"
* tag 'soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (148 commits)
ARM: prima2: remove duplicate v7_invalidate_l1
ARM: shmobile: r8a7779: Correct TMU clock support again
ARM: prima2: fix __init section for cpu hotplug
ARM: OMAP: Consolidate OMAP USB-HS platform data (part 3/3)
ARM: OMAP: Consolidate OMAP USB-HS platform data (part 1/3)
arm: socfpga: Add SMP support for actual socfpga harware
arm: Add v7_invalidate_l1 to cache-v7.S
arm: socfpga: Add entries to enable make dtbs socfpga
arm: socfpga: Add new device tree source for actual socfpga HW
ARM: tegra: sort Kconfig selects for Tegra114
ARM: tegra: enable ARCH_REQUIRE_GPIOLIB for Tegra114
ARM: tegra: Fix build error w/ ARCH_TEGRA_114_SOC w/o ARCH_TEGRA_3x_SOC
ARM: tegra: Fix build error for gic update
ARM: tegra: remove empty tegra_smp_init_cpus()
ARM: shmobile: Register ARM architected timer
ARM: MARCO: fix the build issue due to gic-vic-to-irqchip move
ARM: shmobile: r8a7779: Correct TMU clock support
ARM: mxs_defconfig: Select CONFIG_DEVTMPFS_MOUNT
ARM: mxs: decrease mxs_clockevent_device.min_delta_ns to 2 clock cycles
ARM: mxs: use apbx bus clock to drive the timers on timrotv2
...
This commit is contained in:
commit
bab588fcfb
255 changed files with 11516 additions and 9687 deletions
|
|
@ -2,7 +2,7 @@
|
|||
* EHCI-compliant USB host controller driver for NVIDIA Tegra SoCs
|
||||
*
|
||||
* Copyright (C) 2010 Google, Inc.
|
||||
* Copyright (C) 2009 NVIDIA Corporation
|
||||
* Copyright (C) 2009 - 2013 NVIDIA Corporation
|
||||
*
|
||||
* 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
|
||||
|
|
@ -26,23 +26,28 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include <linux/usb/ehci_def.h>
|
||||
#include <linux/usb/tegra_usb_phy.h>
|
||||
|
||||
#define TEGRA_USB_BASE 0xC5000000
|
||||
#define TEGRA_USB2_BASE 0xC5004000
|
||||
#define TEGRA_USB3_BASE 0xC5008000
|
||||
|
||||
/* PORTSC registers */
|
||||
#define TEGRA_USB_PORTSC1 0x184
|
||||
#define TEGRA_USB_PORTSC1_PTS(x) (((x) & 0x3) << 30)
|
||||
#define TEGRA_USB_PORTSC1_PHCD (1 << 23)
|
||||
|
||||
#define TEGRA_USB_DMA_ALIGN 32
|
||||
|
||||
struct tegra_ehci_hcd {
|
||||
struct ehci_hcd *ehci;
|
||||
struct tegra_usb_phy *phy;
|
||||
struct clk *clk;
|
||||
struct clk *emc_clk;
|
||||
struct usb_phy *transceiver;
|
||||
int host_resumed;
|
||||
int port_resuming;
|
||||
bool needs_double_reset;
|
||||
enum tegra_usb_phy_port_speed port_speed;
|
||||
};
|
||||
|
||||
|
|
@ -50,9 +55,8 @@ static void tegra_ehci_power_up(struct usb_hcd *hcd)
|
|||
{
|
||||
struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
|
||||
|
||||
clk_prepare_enable(tegra->emc_clk);
|
||||
clk_prepare_enable(tegra->clk);
|
||||
usb_phy_set_suspend(&tegra->phy->u_phy, 0);
|
||||
usb_phy_set_suspend(hcd->phy, 0);
|
||||
tegra->host_resumed = 1;
|
||||
}
|
||||
|
||||
|
|
@ -61,9 +65,8 @@ static void tegra_ehci_power_down(struct usb_hcd *hcd)
|
|||
struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
|
||||
|
||||
tegra->host_resumed = 0;
|
||||
usb_phy_set_suspend(&tegra->phy->u_phy, 1);
|
||||
usb_phy_set_suspend(hcd->phy, 1);
|
||||
clk_disable_unprepare(tegra->clk);
|
||||
clk_disable_unprepare(tegra->emc_clk);
|
||||
}
|
||||
|
||||
static int tegra_ehci_internal_port_reset(
|
||||
|
|
@ -156,7 +159,7 @@ static int tegra_ehci_hub_control(
|
|||
if (tegra->port_resuming && !(temp & PORT_SUSPEND)) {
|
||||
/* Resume completed, re-enable disconnect detection */
|
||||
tegra->port_resuming = 0;
|
||||
tegra_usb_phy_postresume(tegra->phy);
|
||||
tegra_usb_phy_postresume(hcd->phy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +187,7 @@ static int tegra_ehci_hub_control(
|
|||
}
|
||||
|
||||
/* For USB1 port we need to issue Port Reset twice internally */
|
||||
if (tegra->phy->instance == 0 &&
|
||||
if (tegra->needs_double_reset &&
|
||||
(typeReq == SetPortFeature && wValue == USB_PORT_FEAT_RESET)) {
|
||||
spin_unlock_irqrestore(&ehci->lock, flags);
|
||||
return tegra_ehci_internal_port_reset(ehci, status_reg);
|
||||
|
|
@ -209,7 +212,7 @@ static int tegra_ehci_hub_control(
|
|||
goto done;
|
||||
|
||||
/* Disable disconnect detection during port resume */
|
||||
tegra_usb_phy_preresume(tegra->phy);
|
||||
tegra_usb_phy_preresume(hcd->phy);
|
||||
|
||||
ehci->reset_done[wIndex-1] = jiffies + msecs_to_jiffies(25);
|
||||
|
||||
|
|
@ -473,7 +476,7 @@ static int controller_resume(struct device *dev)
|
|||
}
|
||||
|
||||
/* Force the phy to keep data lines in suspend state */
|
||||
tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed);
|
||||
tegra_ehci_phy_restore_start(hcd->phy, tegra->port_speed);
|
||||
|
||||
/* Enable host mode */
|
||||
tdi_reset(ehci);
|
||||
|
|
@ -540,17 +543,17 @@ static int controller_resume(struct device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
tegra_ehci_phy_restore_end(tegra->phy);
|
||||
tegra_ehci_phy_restore_end(hcd->phy);
|
||||
goto done;
|
||||
|
||||
restart:
|
||||
if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH)
|
||||
tegra_ehci_phy_restore_end(tegra->phy);
|
||||
tegra_ehci_phy_restore_end(hcd->phy);
|
||||
|
||||
tegra_ehci_restart(hcd);
|
||||
|
||||
done:
|
||||
tegra_usb_phy_preresume(tegra->phy);
|
||||
tegra_usb_phy_preresume(hcd->phy);
|
||||
tegra->port_resuming = 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -604,6 +607,37 @@ static const struct dev_pm_ops tegra_ehci_pm_ops = {
|
|||
|
||||
#endif
|
||||
|
||||
/* Bits of PORTSC1, which will get cleared by writing 1 into them */
|
||||
#define TEGRA_PORTSC1_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
|
||||
|
||||
void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val)
|
||||
{
|
||||
unsigned long val;
|
||||
struct usb_hcd *hcd = bus_to_hcd(x->otg->host);
|
||||
void __iomem *base = hcd->regs;
|
||||
|
||||
val = readl(base + TEGRA_USB_PORTSC1) & ~TEGRA_PORTSC1_RWC_BITS;
|
||||
val &= ~TEGRA_USB_PORTSC1_PTS(3);
|
||||
val |= TEGRA_USB_PORTSC1_PTS(pts_val & 3);
|
||||
writel(val, base + TEGRA_USB_PORTSC1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_ehci_set_pts);
|
||||
|
||||
void tegra_ehci_set_phcd(struct usb_phy *x, bool enable)
|
||||
{
|
||||
unsigned long val;
|
||||
struct usb_hcd *hcd = bus_to_hcd(x->otg->host);
|
||||
void __iomem *base = hcd->regs;
|
||||
|
||||
val = readl(base + TEGRA_USB_PORTSC1) & ~TEGRA_PORTSC1_RWC_BITS;
|
||||
if (enable)
|
||||
val |= TEGRA_USB_PORTSC1_PHCD;
|
||||
else
|
||||
val &= ~TEGRA_USB_PORTSC1_PHCD;
|
||||
writel(val, base + TEGRA_USB_PORTSC1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_ehci_set_phcd);
|
||||
|
||||
static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32);
|
||||
|
||||
static int tegra_ehci_probe(struct platform_device *pdev)
|
||||
|
|
@ -615,6 +649,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
|||
int err = 0;
|
||||
int irq;
|
||||
int instance = pdev->id;
|
||||
struct usb_phy *u_phy;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
|
|
@ -656,15 +691,8 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
|||
if (err)
|
||||
goto fail_clk;
|
||||
|
||||
tegra->emc_clk = devm_clk_get(&pdev->dev, "emc");
|
||||
if (IS_ERR(tegra->emc_clk)) {
|
||||
dev_err(&pdev->dev, "Can't get emc clock\n");
|
||||
err = PTR_ERR(tegra->emc_clk);
|
||||
goto fail_emc_clk;
|
||||
}
|
||||
|
||||
clk_prepare_enable(tegra->emc_clk);
|
||||
clk_set_rate(tegra->emc_clk, 400000000);
|
||||
tegra->needs_double_reset = of_property_read_bool(pdev->dev.of_node,
|
||||
"nvidia,needs-double-reset");
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
|
|
@ -712,9 +740,19 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
|||
goto fail_io;
|
||||
}
|
||||
|
||||
usb_phy_init(&tegra->phy->u_phy);
|
||||
hcd->phy = u_phy = &tegra->phy->u_phy;
|
||||
usb_phy_init(hcd->phy);
|
||||
|
||||
err = usb_phy_set_suspend(&tegra->phy->u_phy, 0);
|
||||
u_phy->otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
|
||||
GFP_KERNEL);
|
||||
if (!u_phy->otg) {
|
||||
dev_err(&pdev->dev, "Failed to alloc memory for otg\n");
|
||||
err = -ENOMEM;
|
||||
goto fail_io;
|
||||
}
|
||||
u_phy->otg->host = hcd_to_bus(hcd);
|
||||
|
||||
err = usb_phy_set_suspend(hcd->phy, 0);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "Failed to power on the phy\n");
|
||||
goto fail;
|
||||
|
|
@ -760,10 +798,8 @@ fail:
|
|||
if (!IS_ERR_OR_NULL(tegra->transceiver))
|
||||
otg_set_host(tegra->transceiver->otg, NULL);
|
||||
#endif
|
||||
usb_phy_shutdown(&tegra->phy->u_phy);
|
||||
usb_phy_shutdown(hcd->phy);
|
||||
fail_io:
|
||||
clk_disable_unprepare(tegra->emc_clk);
|
||||
fail_emc_clk:
|
||||
clk_disable_unprepare(tegra->clk);
|
||||
fail_clk:
|
||||
usb_put_hcd(hcd);
|
||||
|
|
@ -784,15 +820,12 @@ static int tegra_ehci_remove(struct platform_device *pdev)
|
|||
otg_set_host(tegra->transceiver->otg, NULL);
|
||||
#endif
|
||||
|
||||
usb_phy_shutdown(hcd->phy);
|
||||
usb_remove_hcd(hcd);
|
||||
usb_put_hcd(hcd);
|
||||
|
||||
usb_phy_shutdown(&tegra->phy->u_phy);
|
||||
|
||||
clk_disable_unprepare(tegra->clk);
|
||||
|
||||
clk_disable_unprepare(tegra->emc_clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/usb/otg.h>
|
||||
#include <linux/usb/ulpi.h>
|
||||
|
|
@ -35,19 +36,6 @@
|
|||
|
||||
#define ULPI_VIEWPORT 0x170
|
||||
|
||||
#define USB_PORTSC1 0x184
|
||||
#define USB_PORTSC1_PTS(x) (((x) & 0x3) << 30)
|
||||
#define USB_PORTSC1_PSPD(x) (((x) & 0x3) << 26)
|
||||
#define USB_PORTSC1_PHCD (1 << 23)
|
||||
#define USB_PORTSC1_WKOC (1 << 22)
|
||||
#define USB_PORTSC1_WKDS (1 << 21)
|
||||
#define USB_PORTSC1_WKCN (1 << 20)
|
||||
#define USB_PORTSC1_PTC(x) (((x) & 0xf) << 16)
|
||||
#define USB_PORTSC1_PP (1 << 12)
|
||||
#define USB_PORTSC1_SUSP (1 << 7)
|
||||
#define USB_PORTSC1_PE (1 << 2)
|
||||
#define USB_PORTSC1_CCS (1 << 0)
|
||||
|
||||
#define USB_SUSP_CTRL 0x400
|
||||
#define USB_WAKE_ON_CNNT_EN_DEV (1 << 3)
|
||||
#define USB_WAKE_ON_DISCON_EN_DEV (1 << 4)
|
||||
|
|
@ -208,11 +196,6 @@ static struct tegra_utmip_config utmip_default[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static inline bool phy_is_ulpi(struct tegra_usb_phy *phy)
|
||||
{
|
||||
return (phy->instance == 1);
|
||||
}
|
||||
|
||||
static int utmip_pad_open(struct tegra_usb_phy *phy)
|
||||
{
|
||||
phy->pad_clk = clk_get_sys("utmip-pad", NULL);
|
||||
|
|
@ -221,7 +204,7 @@ static int utmip_pad_open(struct tegra_usb_phy *phy)
|
|||
return PTR_ERR(phy->pad_clk);
|
||||
}
|
||||
|
||||
if (phy->instance == 0) {
|
||||
if (phy->is_legacy_phy) {
|
||||
phy->pad_regs = phy->regs;
|
||||
} else {
|
||||
phy->pad_regs = ioremap(TEGRA_USB_BASE, TEGRA_USB_SIZE);
|
||||
|
|
@ -236,7 +219,7 @@ static int utmip_pad_open(struct tegra_usb_phy *phy)
|
|||
|
||||
static void utmip_pad_close(struct tegra_usb_phy *phy)
|
||||
{
|
||||
if (phy->instance != 0)
|
||||
if (!phy->is_legacy_phy)
|
||||
iounmap(phy->pad_regs);
|
||||
clk_put(phy->pad_clk);
|
||||
}
|
||||
|
|
@ -305,7 +288,7 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
|
|||
unsigned long val;
|
||||
void __iomem *base = phy->regs;
|
||||
|
||||
if (phy->instance == 0) {
|
||||
if (phy->is_legacy_phy) {
|
||||
val = readl(base + USB_SUSP_CTRL);
|
||||
val |= USB_SUSP_SET;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
|
|
@ -315,13 +298,8 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
|
|||
val = readl(base + USB_SUSP_CTRL);
|
||||
val &= ~USB_SUSP_SET;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
}
|
||||
|
||||
if (phy->instance == 2) {
|
||||
val = readl(base + USB_PORTSC1);
|
||||
val |= USB_PORTSC1_PHCD;
|
||||
writel(val, base + USB_PORTSC1);
|
||||
}
|
||||
} else
|
||||
tegra_ehci_set_phcd(&phy->u_phy, true);
|
||||
|
||||
if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0)
|
||||
pr_err("%s: timeout waiting for phy to stabilize\n", __func__);
|
||||
|
|
@ -332,7 +310,7 @@ static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
|
|||
unsigned long val;
|
||||
void __iomem *base = phy->regs;
|
||||
|
||||
if (phy->instance == 0) {
|
||||
if (phy->is_legacy_phy) {
|
||||
val = readl(base + USB_SUSP_CTRL);
|
||||
val |= USB_SUSP_CLR;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
|
|
@ -342,13 +320,8 @@ static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
|
|||
val = readl(base + USB_SUSP_CTRL);
|
||||
val &= ~USB_SUSP_CLR;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
}
|
||||
|
||||
if (phy->instance == 2) {
|
||||
val = readl(base + USB_PORTSC1);
|
||||
val &= ~USB_PORTSC1_PHCD;
|
||||
writel(val, base + USB_PORTSC1);
|
||||
}
|
||||
} else
|
||||
tegra_ehci_set_phcd(&phy->u_phy, false);
|
||||
|
||||
if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID,
|
||||
USB_PHY_CLK_VALID))
|
||||
|
|
@ -365,7 +338,7 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
|
|||
val |= UTMIP_RESET;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
|
||||
if (phy->instance == 0) {
|
||||
if (phy->is_legacy_phy) {
|
||||
val = readl(base + USB1_LEGACY_CTRL);
|
||||
val |= USB1_NO_LEGACY_MODE;
|
||||
writel(val, base + USB1_LEGACY_CTRL);
|
||||
|
|
@ -440,16 +413,14 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
|
|||
val |= UTMIP_BIAS_PDTRK_COUNT(0x5);
|
||||
writel(val, base + UTMIP_BIAS_CFG1);
|
||||
|
||||
if (phy->instance == 0) {
|
||||
if (phy->is_legacy_phy) {
|
||||
val = readl(base + UTMIP_SPARE_CFG0);
|
||||
if (phy->mode == TEGRA_USB_PHY_MODE_DEVICE)
|
||||
val &= ~FUSE_SETUP_SEL;
|
||||
else
|
||||
val |= FUSE_SETUP_SEL;
|
||||
writel(val, base + UTMIP_SPARE_CFG0);
|
||||
}
|
||||
|
||||
if (phy->instance == 2) {
|
||||
} else {
|
||||
val = readl(base + USB_SUSP_CTRL);
|
||||
val |= UTMIP_PHY_ENABLE;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
|
|
@ -459,7 +430,7 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
|
|||
val &= ~UTMIP_RESET;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
|
||||
if (phy->instance == 0) {
|
||||
if (phy->is_legacy_phy) {
|
||||
val = readl(base + USB1_LEGACY_CTRL);
|
||||
val &= ~USB1_VBUS_SENSE_CTL_MASK;
|
||||
val |= USB1_VBUS_SENSE_CTL_A_SESS_VLD;
|
||||
|
|
@ -472,11 +443,8 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
|
|||
|
||||
utmi_phy_clk_enable(phy);
|
||||
|
||||
if (phy->instance == 2) {
|
||||
val = readl(base + USB_PORTSC1);
|
||||
val &= ~USB_PORTSC1_PTS(~0);
|
||||
writel(val, base + USB_PORTSC1);
|
||||
}
|
||||
if (!phy->is_legacy_phy)
|
||||
tegra_ehci_set_pts(&phy->u_phy, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -621,10 +589,6 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
|
|||
return ret;
|
||||
}
|
||||
|
||||
val = readl(base + USB_PORTSC1);
|
||||
val |= USB_PORTSC1_WKOC | USB_PORTSC1_WKDS | USB_PORTSC1_WKCN;
|
||||
writel(val, base + USB_PORTSC1);
|
||||
|
||||
val = readl(base + USB_SUSP_CTRL);
|
||||
val |= USB_SUSP_CLR;
|
||||
writel(val, base + USB_SUSP_CTRL);
|
||||
|
|
@ -639,17 +603,8 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
|
|||
|
||||
static int ulpi_phy_power_off(struct tegra_usb_phy *phy)
|
||||
{
|
||||
unsigned long val;
|
||||
void __iomem *base = phy->regs;
|
||||
struct tegra_ulpi_config *config = phy->config;
|
||||
|
||||
/* Clear WKCN/WKDS/WKOC wake-on events that can cause the USB
|
||||
* Controller to immediately bring the ULPI PHY out of low power
|
||||
*/
|
||||
val = readl(base + USB_PORTSC1);
|
||||
val &= ~(USB_PORTSC1_WKOC | USB_PORTSC1_WKDS | USB_PORTSC1_WKCN);
|
||||
writel(val, base + USB_PORTSC1);
|
||||
|
||||
clk_disable(phy->clk);
|
||||
return gpio_direction_output(config->reset_gpio, 0);
|
||||
}
|
||||
|
|
@ -660,7 +615,7 @@ static int tegra_phy_init(struct usb_phy *x)
|
|||
struct tegra_ulpi_config *ulpi_config;
|
||||
int err;
|
||||
|
||||
if (phy_is_ulpi(phy)) {
|
||||
if (phy->is_ulpi_phy) {
|
||||
ulpi_config = phy->config;
|
||||
phy->clk = clk_get_sys(NULL, ulpi_config->clk);
|
||||
if (IS_ERR(phy->clk)) {
|
||||
|
|
@ -698,7 +653,7 @@ static void tegra_usb_phy_close(struct usb_phy *x)
|
|||
{
|
||||
struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy);
|
||||
|
||||
if (phy_is_ulpi(phy))
|
||||
if (phy->is_ulpi_phy)
|
||||
clk_put(phy->clk);
|
||||
else
|
||||
utmip_pad_close(phy);
|
||||
|
|
@ -709,7 +664,7 @@ static void tegra_usb_phy_close(struct usb_phy *x)
|
|||
|
||||
static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
|
||||
{
|
||||
if (phy_is_ulpi(phy))
|
||||
if (phy->is_ulpi_phy)
|
||||
return ulpi_phy_power_on(phy);
|
||||
else
|
||||
return utmi_phy_power_on(phy);
|
||||
|
|
@ -717,7 +672,7 @@ static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
|
|||
|
||||
static int tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
|
||||
{
|
||||
if (phy_is_ulpi(phy))
|
||||
if (phy->is_ulpi_phy)
|
||||
return ulpi_phy_power_off(phy);
|
||||
else
|
||||
return utmi_phy_power_off(phy);
|
||||
|
|
@ -739,8 +694,9 @@ struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
|
|||
unsigned long parent_rate;
|
||||
int i;
|
||||
int err;
|
||||
struct device_node *np = dev->of_node;
|
||||
|
||||
phy = kmalloc(sizeof(struct tegra_usb_phy), GFP_KERNEL);
|
||||
phy = kzalloc(sizeof(struct tegra_usb_phy), GFP_KERNEL);
|
||||
if (!phy)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
|
@ -749,9 +705,16 @@ struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
|
|||
phy->config = config;
|
||||
phy->mode = phy_mode;
|
||||
phy->dev = dev;
|
||||
phy->is_legacy_phy =
|
||||
of_property_read_bool(np, "nvidia,has-legacy-mode");
|
||||
err = of_property_match_string(np, "phy_type", "ulpi");
|
||||
if (err < 0)
|
||||
phy->is_ulpi_phy = false;
|
||||
else
|
||||
phy->is_ulpi_phy = true;
|
||||
|
||||
if (!phy->config) {
|
||||
if (phy_is_ulpi(phy)) {
|
||||
if (phy->is_ulpi_phy) {
|
||||
pr_err("%s: ulpi phy configuration missing", __func__);
|
||||
err = -EINVAL;
|
||||
goto err0;
|
||||
|
|
@ -796,45 +759,40 @@ err0:
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_usb_phy_open);
|
||||
|
||||
void tegra_usb_phy_preresume(struct tegra_usb_phy *phy)
|
||||
void tegra_usb_phy_preresume(struct usb_phy *x)
|
||||
{
|
||||
if (!phy_is_ulpi(phy))
|
||||
struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy);
|
||||
|
||||
if (!phy->is_ulpi_phy)
|
||||
utmi_phy_preresume(phy);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume);
|
||||
|
||||
void tegra_usb_phy_postresume(struct tegra_usb_phy *phy)
|
||||
void tegra_usb_phy_postresume(struct usb_phy *x)
|
||||
{
|
||||
if (!phy_is_ulpi(phy))
|
||||
struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy);
|
||||
|
||||
if (!phy->is_ulpi_phy)
|
||||
utmi_phy_postresume(phy);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
|
||||
|
||||
void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
|
||||
void tegra_ehci_phy_restore_start(struct usb_phy *x,
|
||||
enum tegra_usb_phy_port_speed port_speed)
|
||||
{
|
||||
if (!phy_is_ulpi(phy))
|
||||
struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy);
|
||||
|
||||
if (!phy->is_ulpi_phy)
|
||||
utmi_phy_restore_start(phy, port_speed);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start);
|
||||
|
||||
void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy)
|
||||
void tegra_ehci_phy_restore_end(struct usb_phy *x)
|
||||
{
|
||||
if (!phy_is_ulpi(phy))
|
||||
struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy);
|
||||
|
||||
if (!phy->is_ulpi_phy)
|
||||
utmi_phy_restore_end(phy);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end);
|
||||
|
||||
void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy)
|
||||
{
|
||||
if (!phy_is_ulpi(phy))
|
||||
utmi_phy_clk_disable(phy);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_disable);
|
||||
|
||||
void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy)
|
||||
{
|
||||
if (!phy_is_ulpi(phy))
|
||||
utmi_phy_clk_enable(phy);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_enable);
|
||||
|
|
|
|||
Loading…
Reference in a new issue