WIP FPC-III support
[linux/fpc-iii.git] / arch / hexagon / lib / io.c
blobd35d69d6588c4a182106f4951be34c4826f99211
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * I/O access functions for Hexagon
5 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
6 */
8 #include <asm/io.h>
10 /* These are all FIFO routines! */
13 * __raw_readsw - read words a short at a time
14 * @addr: source address
15 * @data: data address
16 * @len: number of shorts to read
18 void __raw_readsw(const void __iomem *addr, void *data, int len)
20 const volatile short int *src = (short int *) addr;
21 short int *dst = (short int *) data;
23 if ((u32)data & 0x1)
24 panic("unaligned pointer to readsw");
26 while (len-- > 0)
27 *dst++ = *src;
32 * __raw_writesw - read words a short at a time
33 * @addr: source address
34 * @data: data address
35 * @len: number of shorts to read
37 void __raw_writesw(void __iomem *addr, const void *data, int len)
39 const short int *src = (short int *)data;
40 volatile short int *dst = (short int *)addr;
42 if ((u32)data & 0x1)
43 panic("unaligned pointer to writesw");
45 while (len-- > 0)
46 *dst = *src++;
51 /* Pretty sure len is pre-adjusted for the length of the access already */
52 void __raw_readsl(const void __iomem *addr, void *data, int len)
54 const volatile long *src = (long *) addr;
55 long *dst = (long *) data;
57 if ((u32)data & 0x3)
58 panic("unaligned pointer to readsl");
60 while (len-- > 0)
61 *dst++ = *src;
66 void __raw_writesl(void __iomem *addr, const void *data, int len)
68 const long *src = (long *)data;
69 volatile long *dst = (long *)addr;
71 if ((u32)data & 0x3)
72 panic("unaligned pointer to writesl");
74 while (len-- > 0)
75 *dst = *src++;