Commit 44702983 authored by Samuel Holland's avatar Samuel Holland
Browse files

allwinner: Return the PMIC to I2C mode after use



This gives the rich OS the flexibility to choose between I2C and RSB
communication. Since a runtime address can only be assigned once after
entering RSB mode, it also lets the rich OS choose any runtime address.
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Change-Id: Id49c124c5e925985fc31c0ba38c7fb6c941aafa8
parent d6fdb52b
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include <stdint.h> #include <stdint.h>
#define AXP20X_MODE_REG 0x3e
#define AXP20X_MODE_I2C 0x00
#define AXP20X_MODE_RSB 0x7c
#define NA 0xff #define NA 0xff
enum { enum {
......
...@@ -97,11 +97,8 @@ static int rsb_init(void) ...@@ -97,11 +97,8 @@ static int rsb_init(void)
if (ret) if (ret)
return ret; return ret;
/* /* Initiate an I2C transaction to switch the PMIC to RSB mode. */
* Initiate an I2C transaction to write 0x7c into register 0x3e, ret = rsb_set_device_mode(AXP20X_MODE_RSB << 16 | AXP20X_MODE_REG << 8);
* switching the PMIC to RSB mode.
*/
ret = rsb_set_device_mode(0x7c3e00);
if (ret) if (ret)
return ret; return ret;
...@@ -151,6 +148,11 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt) ...@@ -151,6 +148,11 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt)
pmic = AXP803_RSB; pmic = AXP803_RSB;
axp_setup_regulators(fdt); axp_setup_regulators(fdt);
/* Switch the PMIC back to I2C mode. */
ret = axp_write(AXP20X_MODE_REG, AXP20X_MODE_I2C);
if (ret)
return ret;
break; break;
default: default:
return -ENODEV; return -ENODEV;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment