summaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/arch-sunxi/rsb.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-11-29 13:38:35 +0100
committerHans de Goede <hdegoede@redhat.com>2015-01-14 14:56:36 +0100
commit66ebea06f71a85552b7339d1b03ec1a092dc6c70 (patch)
tree43494b5240df365bf20f78d77b09390afd18b229 /arch/arm/include/asm/arch-sunxi/rsb.h
parentce881076fc51f281ab28b2a1fde370f10b0c41eb (diff)
downloadtalos-obmc-uboot-66ebea06f71a85552b7339d1b03ec1a092dc6c70.tar.gz
talos-obmc-uboot-66ebea06f71a85552b7339d1b03ec1a092dc6c70.zip
sunxi: Add support for the rsb (Reduced Serial Bus)
sun8i (A23) introduces a new bus for communicating with the pmic, the rsb, the rsb is also used to communicate with the pmic on the A80, and is documented in the A80 user manual. This commit adds support for this based on the rsb driver from the allwinner u-boot sources. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'arch/arm/include/asm/arch-sunxi/rsb.h')
-rw-r--r--arch/arm/include/asm/arch-sunxi/rsb.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-sunxi/rsb.h b/arch/arm/include/asm/arch-sunxi/rsb.h
new file mode 100644
index 0000000000..95a595ab8d
--- /dev/null
+++ b/arch/arm/include/asm/arch-sunxi/rsb.h
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2014 Hans de Goede <hdegoede@redhat.com>
+ *
+ * Based on allwinner u-boot sources rsb code which is:
+ * (C) Copyright 2007-2013
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * lixiang <lixiang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __SUNXI_RSB_H
+#define __SUNXI_RSB_H
+
+#include <common.h>
+#include <asm/io.h>
+
+struct sunxi_rsb_reg {
+ u32 ctrl; /* 0x00 */
+ u32 ccr; /* 0x04 */
+ u32 inte; /* 0x08 */
+ u32 stat; /* 0x0c */
+ u32 addr; /* 0x10 */
+ u8 res0[8]; /* 0x14 */
+ u32 data; /* 0x1c */
+ u8 res1[4]; /* 0x20 */
+ u32 lcr; /* 0x24 */
+ u32 dmcr; /* 0x28 */
+ u32 cmd; /* 0x2c */
+ u32 devaddr; /* 0x30 */
+};
+
+#define RSB_CTRL_SOFT_RST (1 << 0)
+#define RSB_CTRL_START_TRANS (1 << 7)
+
+#define RSB_STAT_TOVER_INT (1 << 0)
+#define RSB_STAT_TERR_INT (1 << 1)
+#define RSB_STAT_LBSY_INT (1 << 2)
+
+#define RSB_DMCR_DEVICE_MODE_START (1 << 31)
+
+#define RSB_CMD_BYTE_WRITE 0x4e
+#define RSB_CMD_BYTE_READ 0x8b
+#define RSB_CMD_SET_RTSADDR 0xe8
+
+#define RSB_DEVADDR_RUNTIME_ADDR(x) ((x) << 16)
+#define RSB_DEVADDR_DEVICE_ADDR(x) ((x) << 0)
+
+void rsb_init(void);
+int rsb_set_device_mode(u32 device_mode_data);
+int rsb_set_device_address(u16 device_addr, u16 runtime_addr);
+int rsb_write(const u16 runtime_device_addr, const u8 reg_addr, u8 data);
+int rsb_read(const u16 runtime_device_addr, const u8 reg_addr, u8 *data);
+
+#endif
OpenPOWER on IntegriCloud