1 /* SPDX-License-Identifier: GPL-2.0 */
3 * ddbridge-io.h: Digital Devices bridge I/O inline functions
5 * Copyright (C) 2010-2017 Digital Devices GmbH
10 #ifndef __DDBRIDGE_IO_H__
11 #define __DDBRIDGE_IO_H__
17 /******************************************************************************/
19 static inline u32 ddblreadl(struct ddb_link *link, u32 adr)
21 return readl(link->dev->regs + adr);
24 static inline void ddblwritel(struct ddb_link *link, u32 val, u32 adr)
26 writel(val, link->dev->regs + adr);
29 static inline u32 ddbreadl(struct ddb *dev, u32 adr)
31 return readl(dev->regs + adr);
34 static inline void ddbwritel(struct ddb *dev, u32 val, u32 adr)
36 writel(val, dev->regs + adr);
39 static inline void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count)
41 memcpy_toio(dev->regs + adr, src, count);
44 static inline void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count)
46 memcpy_fromio(dst, dev->regs + adr, count);
49 static inline u32 safe_ddbreadl(struct ddb *dev, u32 adr)
51 u32 val = ddbreadl(dev, adr);
53 /* (ddb)readl returns (uint)-1 (all bits set) on failure, catch that */
55 dev_err(&dev->pdev->dev, "ddbreadl failure, adr=%08x\n", adr);
62 #endif /* __DDBRIDGE_IO_H__ */