> Date: Tue, 26 Dec 2017 22:51:38 +0800 > From: Kevin Lo <ke...@openbsd.org> > > > Shouldn't be too difficult to add support for that one to axppmic(4). > > Do you want me to create a diff for you to test? > > That'd be great, thanks. Testing is easier than writing code :)
Here's a diff. Should give you a couple of sensors and working regulators. That might make the on-board eMMC work. Index: axppmic.c =================================================================== RCS file: /cvs/src/sys/dev/fdt/axppmic.c,v retrieving revision 1.4 diff -u -p -r1.4 axppmic.c --- axppmic.c 26 Dec 2017 17:16:33 -0000 1.4 +++ axppmic.c 26 Dec 2017 17:18:17 -0000 @@ -40,7 +40,7 @@ extern void (*powerdownfn)(void); #define AXP806_REG_ADDR_EXT_MASTER_MODE (0 << 4) #define AXP806_REG_ADDR_EXT_SLAVE_MODE (1 << 4) -/* Regulators for AXP209, AXP806 and AXP809. */ +/* Regulators for AXP209, AXP223, AXP806 and AXP809. */ struct axppmic_regdata { const char *name; @@ -66,6 +66,47 @@ struct axppmic_regdata axp209_regdata[] { NULL } }; +struct axppmic_regdata axp223_regdata[] = { + { "dcdc1", 0x10, (1 << 1), (1 << 1), (0 << 1), + 0x21, 0x1f, 1600000, 100000 }, + { "dcdc2", 0x10, (1 << 2), (1 << 2), (0 << 2), + 0x22, 0x3f, 600000, 20000 }, + { "dcdc3", 0x10, (1 << 3), (1 << 3), (0 << 3), + 0x23, 0x3f, 600000, 20000 }, + { "dcdc4", 0x10, (1 << 4), (1 << 4), (0 << 4), + 0x24, 0x3f, 600000, 20000 }, + { "dcdc5", 0x10, (1 << 5), (1 << 5), (0 << 5), + 0x25, 0x1f, 1000000, 50000 }, + { "dc1sw", 0x12, (1 << 7), (1 << 7), (0 << 7) }, + { "dc5ldo", 0x10, (1 << 0), (1 << 0), (0 << 0), + 0x1c, 0x07, 700000, 100000 }, + { "aldo1", 0x10, (1 << 6), (1 << 6), (0 << 6), + 0x28, 0x1f, 700000, 100000 }, + { "aldo2", 0x10, (1 << 7), (1 << 7), (0 << 7), + 0x29, 0x1f, 700000, 100000 }, + { "aldo3", 0x13, (1 << 7), (1 << 7), (0 << 7), + 0x2a, 0x1f, 700000, 100000 }, + { "dldo1", 0x12, (1 << 3), (1 << 3), (0 << 3), + 0x15, 0x1f, 700000, 100000 }, + { "dldo2", 0x12, (1 << 4), (1 << 4), (0 << 4), + 0x16, 0x1f, 700000, 100000 }, + { "dldo3", 0x12, (1 << 5), (1 << 5), (0 << 5), + 0x17, 0x1f, 700000, 100000 }, + { "dldo4", 0x12, (1 << 6), (1 << 6), (0 << 6), + 0x18, 0x1f, 700000, 100000 }, + { "eldo1", 0x12, (1 << 0), (1 << 0), (0 << 0), + 0x19, 0x1f, 700000, 100000 }, + { "eldo2", 0x12, (1 << 1), (1 << 1), (0 << 1), + 0x1a, 0x1f, 700000, 100000 }, + { "eldo3", 0x12, (1 << 2), (1 << 2), (0 << 2), + 0x1b, 0x1f, 700000, 100000 }, + { "ldo_io0", 0x90, 0x07, 0x03, 0x04, + 0x91, 0x1f, 700000, 100000 }, + { "ldo_io1", 0x92, 0x07, 0x03, 0x04, + 0x93, 0x1f, 700000, 100000 }, + { NULL } +}; + struct axppmic_regdata axp806_regdata[] = { { "dcdca", 0x10, (1 << 0), (1 << 0), (0 << 0), 0x12, 0x7f, 600000, 10000, 1120000, 20000 }, @@ -137,7 +178,7 @@ struct axppmic_regdata axp809_regdata[] { NULL } }; -/* Sensors for AXP209 and AXP809. */ +/* Sensors for AXP209 and AXP223/AXP809. */ #define AXPPMIC_NSENSORS 8 @@ -160,7 +201,7 @@ struct axppmic_sensdata axp209_sensdata[ { NULL } }; -struct axppmic_sensdata axp809_sensdata[] = { +struct axppmic_sensdata axp223_sensdata[] = { { "ACIN", SENSOR_INDICATOR, 0x00, (1 << 7), (1 << 6) }, { "VBUS", SENSOR_INDICATOR, 0x00, (1 << 5), (1 << 4) }, { "", SENSOR_TEMP, 0x56, 5450000, 105861 }, @@ -177,8 +218,9 @@ struct axppmic_device { struct axppmic_device axppmic_devices[] = { { "x-powers,axp152", "AXP152" }, { "x-powers,axp209", "AXP209", axp209_regdata, axp209_sensdata }, + { "x-powers,axp223", "AXP223", axp223_regdata, axp223_sensdata }, { "x-powers,axp806", "AXP806", axp806_regdata }, - { "x-powers,axp809", "AXP809", axp809_regdata, axp809_sensdata } + { "x-powers,axp809", "AXP809", axp809_regdata, axp223_sensdata } }; const struct axppmic_device *