/* * Copyright (C) 2011 Google, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * */ #include #include #include #include #include #include #define ULPI_VIEW_WAKEUP (1 << 31) #define ULPI_VIEW_RUN (1 << 30) #define ULPI_VIEW_WRITE (1 << 29) #define ULPI_VIEW_READ (0 << 29) #define ULPI_VIEW_ADDR(x) (((x) & 0xff) << 16) #define ULPI_VIEW_DATA_READ(x) (((x) >> 8) & 0xff) #define ULPI_VIEW_DATA_WRITE(x) ((x) & 0xff) static int ulpi_viewport_wait(void __iomem *view, u32 mask) { unsigned long usec = 2000; while (usec--) { if (!(readl(view) & mask)) return 0; udelay(1); } return -ETIMEDOUT; } static int ulpi_viewport_read(struct usb_phy *otg, u32 reg) { int ret; void __iomem *view = otg->io_priv; writel(ULPI_VIEW_WAKEUP | ULPI_VIEW_WRITE, view); ret = ulpi_viewport_wait(view, ULPI_VIEW_WAKEUP); if (ret) return ret; writel(ULPI_VIEW_RUN | ULPI_VIEW_READ | ULPI_VIEW_ADDR(reg), view); ret = ulpi_viewport_wait(view, ULPI_VIEW_RUN); if (ret) return ret; return ULPI_VIEW_DATA_READ(readl(view)); } static int ulpi_viewport_write(struct usb_phy *otg, u32 val, u32 reg) { int ret; void __iomem *view = otg->io_priv; writel(ULPI_VIEW_WAKEUP | ULPI_VIEW_WRITE, view); ret = ulpi_viewport_wait(view, ULPI_VIEW_WAKEUP); if (ret) return ret; writel(ULPI_VIEW_RUN | ULPI_VIEW_WRITE | ULPI_VIEW_DATA_WRITE(val) | ULPI_VIEW_ADDR(reg), view); return ulpi_viewport_wait(view, ULPI_VIEW_RUN); } struct usb_phy_io_ops ulpi_viewport_access_ops = { .read = ulpi_viewport_read, .write = ulpi_viewport_write, }; EXPORT_SYMBOL_GPL(ulpi_viewport_access_ops); 63000'>commitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-18 10:47:11 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-18 10:47:11 -0800
commit49b550fee80b5f36b961640666f7945d7ec63000 (patch)
tree3dd2539f7168f8763c3ac9744234893c92d56585 /tools/arch
parent9da96f99f15169b8bf77a1f27ed6d926f82ea59f (diff)
parent3e4f7a4956e54143f7fc15c636158ad4166d219d (diff)
Merge branch 'rcu-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull RCU fixes from Ingo Molnar: "This fixes sporadic ACPI related hangs in synchronize_rcu() that were caused by the ACPI code mistakenly relying on an aspect of RCU that was neither promised to work nor reliable but which happened to work - until in v4.9 we changed the RCU implementation, which made the hangs more prominent. Since the mis-use of the RCU facility wasn't properly detected and prevented either, these fixes make the RCU side work reliably instead of working around the problem in the ACPI code. Hence the slightly larger diffstat that goes beyond the normal scope of RCU fixes in -rc kernels" * 'rcu-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: rcu: Narrow early boot window of illegal synchronous grace periods rcu: Remove cond_resched() from Tiny synchronize_sched()
Diffstat (limited to 'tools/arch')