summaryrefslogtreecommitdiff
path: root/arch/arc
diff options
context:
space:
mode:
authorSrinivasarao P <spathi@codeaurora.org>2018-12-24 12:22:31 +0530
committerSrinivasarao P <spathi@codeaurora.org>2018-12-24 12:23:20 +0530
commit52be7fe1faa3ab55f76c8eddb9ce07b31720524d (patch)
tree53ad5a8fa8634bab8b6f41b94edb43d4c1d244c0 /arch/arc
parent8271e2f79c2cbf13887cf0c58daa9375d65939db (diff)
parentdfca92bab267c629c7aff059de9217d2fb1ab21e (diff)
Merge android-4.4.169 (dfca92b) into msm-4.4
* refs/heads/tmp-dfca92b Linux 4.4.169 ALSA: isa/wavefront: prevent some out of bound writes rtc: snvs: Add timeouts to avoid kernel lockups rtc: snvs: add a missing write sync i2c: scmi: Fix probe error on devices with an empty SMB0001 ACPI device node i2c: axxia: properly handle master timeout cifs: In Kconfig CONFIG_CIFS_POSIX needs depends on legacy (insecure cifs) ARM: 8814/1: mm: improve/fix ARM v7_dma_inv_range() unaligned address handling mv88e6060: disable hardware level MAC learning libata: whitelist all SAMSUNG MZ7KM* solid-state disks Input: omap-keypad - fix keyboard debounce configuration clk: mmp: Off by one in mmp_clk_add() ide: pmac: add of_node_put() drivers/tty: add missing of_node_put() drivers/sbus/char: add of_node_put() sbus: char: add of_node_put() SUNRPC: Fix a potential race in xprt_connect() bonding: fix 802.3ad state sent to partner when unbinding slave ARC: io.h: Implement reads{x}()/writes{x}() drm/msm: Grab a vblank reference when waiting for commit_done x86/earlyprintk/efi: Fix infinite loop on some screen widths scsi: vmw_pscsi: Rearrange code to avoid multiple calls to free_irq during unload scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset mac80211_hwsim: fix module init error paths for netlink mac80211: Fix condition validating WMM IE mac80211: don't WARN on bad WMM parameters from buggy APs f2fs: fix a panic caused by NULL flush_cmd_control Revert "drm/rockchip: Allow driver to be shutdown on reboot/kexec" powerpc/msi: Fix NULL pointer access in teardown code tracing: Fix memory leak of instance function hash filters tracing: Fix memory leak in set_trigger_filter() MMC: OMAP: fix broken MMC on OMAP15XX/OMAP5910/OMAP310 aio: fix spectre gadget in lookup_ioctx pinctrl: sunxi: a83t: Fix IRQ offset typo for PH11 powerpc/boot: Fix random libfdt related build errors timer/debug: Change /proc/timer_list from 0444 to 0400 lib/interval_tree_test.c: allow users to limit scope of endpoint lib/rbtree-test: lower default params lib/rbtree_test.c: make input module parameters lib/interval_tree_test.c: allow full tree search lib/interval_tree_test.c: make test options module parameters ANDROID: Revert fs/squashfs back to linux-4.4.y Conflicts: drivers/gpu/drm/msm/msm_atomic.c Change-Id: Iecec05c300fb06c0bcdd44a797795e854ea0d0fd Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/io.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index cb69299a492e..f120d823e8c2 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -12,6 +12,7 @@
#include <linux/types.h>
#include <asm/byteorder.h>
#include <asm/page.h>
+#include <asm/unaligned.h>
#ifdef CONFIG_ISA_ARCV2
#include <asm/barrier.h>
@@ -85,6 +86,42 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
return w;
}
+/*
+ * {read,write}s{b,w,l}() repeatedly access the same IO address in
+ * native endianness in 8-, 16-, 32-bit chunks {into,from} memory,
+ * @count times
+ */
+#define __raw_readsx(t,f) \
+static inline void __raw_reads##f(const volatile void __iomem *addr, \
+ void *ptr, unsigned int count) \
+{ \
+ bool is_aligned = ((unsigned long)ptr % ((t) / 8)) == 0; \
+ u##t *buf = ptr; \
+ \
+ if (!count) \
+ return; \
+ \
+ /* Some ARC CPU's don't support unaligned accesses */ \
+ if (is_aligned) { \
+ do { \
+ u##t x = __raw_read##f(addr); \
+ *buf++ = x; \
+ } while (--count); \
+ } else { \
+ do { \
+ u##t x = __raw_read##f(addr); \
+ put_unaligned(x, buf++); \
+ } while (--count); \
+ } \
+}
+
+#define __raw_readsb __raw_readsb
+__raw_readsx(8, b)
+#define __raw_readsw __raw_readsw
+__raw_readsx(16, w)
+#define __raw_readsl __raw_readsl
+__raw_readsx(32, l)
+
#define __raw_writeb __raw_writeb
static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
{
@@ -117,6 +154,35 @@ static inline void __raw_writel(u32 w, volatile void __iomem *addr)
}
+#define __raw_writesx(t,f) \
+static inline void __raw_writes##f(volatile void __iomem *addr, \
+ const void *ptr, unsigned int count) \
+{ \
+ bool is_aligned = ((unsigned long)ptr % ((t) / 8)) == 0; \
+ const u##t *buf = ptr; \
+ \
+ if (!count) \
+ return; \
+ \
+ /* Some ARC CPU's don't support unaligned accesses */ \
+ if (is_aligned) { \
+ do { \
+ __raw_write##f(*buf++, addr); \
+ } while (--count); \
+ } else { \
+ do { \
+ __raw_write##f(get_unaligned(buf++), addr); \
+ } while (--count); \
+ } \
+}
+
+#define __raw_writesb __raw_writesb
+__raw_writesx(8, b)
+#define __raw_writesw __raw_writesw
+__raw_writesx(16, w)
+#define __raw_writesl __raw_writesl
+__raw_writesx(32, l)
+
/*
* MMIO can also get buffered/optimized in micro-arch, so barriers needed
* Based on ARM model for the typical use case
@@ -132,10 +198,16 @@ static inline void __raw_writel(u32 w, volatile void __iomem *addr)
#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
+#define readsb(p,d,l) ({ __raw_readsb(p,d,l); __iormb(); })
+#define readsw(p,d,l) ({ __raw_readsw(p,d,l); __iormb(); })
+#define readsl(p,d,l) ({ __raw_readsl(p,d,l); __iormb(); })
#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
+#define writesb(p,d,l) ({ __iowmb(); __raw_writesb(p,d,l); })
+#define writesw(p,d,l) ({ __iowmb(); __raw_writesw(p,d,l); })
+#define writesl(p,d,l) ({ __iowmb(); __raw_writesl(p,d,l); })
/*
* Relaxed API for drivers which can handle barrier ordering themselves