1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2014 Hans de Goede <hdegoede@redhat.com>
5 * Based on allwinner u-boot sources rsb code which is:
6 * (C) Copyright 2007-2013
7 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
8 * lixiang <lixiang@allwinnertech.com>
17 struct sunxi_rsb_reg {
23 u8 res0[8]; /* 0x14 */
25 u8 res1[4]; /* 0x20 */
29 u32 devaddr; /* 0x30 */
32 #define RSB_CTRL_SOFT_RST (1 << 0)
33 #define RSB_CTRL_START_TRANS (1 << 7)
35 #define RSB_STAT_TOVER_INT (1 << 0)
36 #define RSB_STAT_TERR_INT (1 << 1)
37 #define RSB_STAT_LBSY_INT (1 << 2)
39 #define RSB_DMCR_DEVICE_MODE_DATA 0x7c3e00
40 #define RSB_DMCR_DEVICE_MODE_START (1 << 31)
42 #define RSB_CMD_BYTE_WRITE 0x4e
43 #define RSB_CMD_BYTE_READ 0x8b
44 #define RSB_CMD_SET_RTSADDR 0xe8
46 #define RSB_DEVADDR_RUNTIME_ADDR(x) ((x) << 16)
47 #define RSB_DEVADDR_DEVICE_ADDR(x) ((x) << 0)
50 int rsb_set_device_address(u16 device_addr, u16 runtime_addr);
51 int rsb_write(const u16 runtime_device_addr, const u8 reg_addr, u8 data);
52 int rsb_read(const u16 runtime_device_addr, const u8 reg_addr, u8 *data);