]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sunxi: rsb: Move rsb_set_device_mode() call to rsb_init()
authorHans de Goede <hdegoede@redhat.com>
Mon, 26 Jan 2015 15:59:12 +0000 (16:59 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 2 Feb 2015 12:55:14 +0000 (13:55 +0100)
It turns out that the device_mode_data is rsb specific, rather then slave
specific, so integrate the rsb_set_device_mode() call into rsb_init().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
arch/arm/cpu/armv7/sunxi/rsb.c
arch/arm/include/asm/arch-sunxi/rsb.h
drivers/power/axp221.c
include/axp221.h

index 55e943323f8e12f0a489a3af3bf4f70846b840d7..b00befb30119bf547a56270a106359f5bf61c81c 100644 (file)
@@ -16,6 +16,8 @@
 #include <asm/arch/prcm.h>
 #include <asm/arch/rsb.h>
 
+static int rsb_set_device_mode(void);
+
 static void rsb_cfg_io(void)
 {
 #ifdef CONFIG_MACH_SUN8I
@@ -53,7 +55,7 @@ static void rsb_set_clk(void)
        writel((cd_odly << 8) | div, &rsb->ccr);
 }
 
-void rsb_init(void)
+int rsb_init(void)
 {
        struct sunxi_rsb_reg * const rsb =
                (struct sunxi_rsb_reg *)SUNXI_RSB_BASE;
@@ -65,6 +67,8 @@ void rsb_init(void)
 
        writel(RSB_CTRL_SOFT_RST, &rsb->ctrl);
        rsb_set_clk();
+
+       return rsb_set_device_mode();
 }
 
 static int rsb_await_trans(void)
@@ -99,13 +103,14 @@ static int rsb_await_trans(void)
        return ret;
 }
 
-int rsb_set_device_mode(u32 device_mode_data)
+static int rsb_set_device_mode(void)
 {
        struct sunxi_rsb_reg * const rsb =
                (struct sunxi_rsb_reg *)SUNXI_RSB_BASE;
        unsigned long tmo = timer_get_us() + 1000000;
 
-       writel(RSB_DMCR_DEVICE_MODE_START | device_mode_data, &rsb->dmcr);
+       writel(RSB_DMCR_DEVICE_MODE_START | RSB_DMCR_DEVICE_MODE_DATA,
+              &rsb->dmcr);
 
        while (readl(&rsb->dmcr) & RSB_DMCR_DEVICE_MODE_START) {
                if (timer_get_us() > tmo)
index 95a595ab8d418c6c9275eb0cf77399352a1ec1c5..a8934667c4c7b50b0af2aabc40cfec1703826440 100644 (file)
@@ -37,6 +37,7 @@ struct sunxi_rsb_reg {
 #define RSB_STAT_TERR_INT              (1 << 1)
 #define RSB_STAT_LBSY_INT              (1 << 2)
 
+#define RSB_DMCR_DEVICE_MODE_DATA      0x7c3e00
 #define RSB_DMCR_DEVICE_MODE_START     (1 << 31)
 
 #define RSB_CMD_BYTE_WRITE             0x4e
@@ -46,8 +47,7 @@ struct sunxi_rsb_reg {
 #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_init(void);
 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);
index 58bbd45a021af80bd8eee172be9054cf85572641..3e07f23c20c621ba9cbfc101d788462aed93026d 100644 (file)
@@ -29,9 +29,7 @@ static int pmic_bus_init(void)
 #else
        int ret;
 
-       rsb_init();
-
-       ret = rsb_set_device_mode(AXP223_DEVICE_MODE_DATA);
+       ret = rsb_init();
        if (ret)
                return ret;
 
index 6f24a617b67263f5fd43b5c10629f022cb9e5a03..a20e25c2f82740249c9333a7d49657d55ea2550c 100644 (file)
@@ -12,7 +12,6 @@
 
 #define AXP223_DEVICE_ADDR 0x3a3
 #define AXP223_RUNTIME_ADDR 0x2d
-#define AXP223_DEVICE_MODE_DATA 0x7c3e00
 
 /* Page 0 addresses */
 #define AXP221_CHIP_ID         0x03