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