power: fan53555: add support for Silergy SYR82X and SYR83X
PATCH 1/1 power: fan53555: add support for Silergy SYR82X and SYR83X
SYR82X and SYR83X are almost identical to FAN53555, the only difference is different die ID and revision, voltage ranges and steps.
--- drivers/power/pmic/fan53555.c | 7 +++-- drivers/power/regulator/fan53555.c | 45 ++++++++++++++++++++++-------- include/power/fan53555.h | 14 ++++++++++ 3 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 include/power/fan53555.h
drivers/power/pmic/fan53555.c +5 -2
@@ -8,6 +8,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <i2c.h> +#include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h>
@@ -58,7 +59,7 @@ static int pmic_fan53555_bind(struct udevice *dev)return -ENOENT ; } -return device_bind_with_driver_data (dev, drv,"SW" ,0 , +return device_bind_with_driver_data (dev, drv,"SW" , dev->driver_data,dev_ofnode (dev), &child); };
@@ -69,7 +70,9 @@ static struct dm_pmic_ops pmic_fan53555_ops = { };static const struct udevice_id pmic_fan53555_match[] = { - { .compatible ="fcs,fan53555" }, + { .compatible ="fcs,fan53555" , .data =FAN53555_VENDOR_FAIRCHILD , }, + { .compatible ="silergy,syr827" , .data =FAN53555_VENDOR_SILERGY , }, + { .compatible ="silergy,syr828" , .data =FAN53555_VENDOR_SILERGY , }, { }, };
drivers/power/regulator/fan53555.c +33 -12
77 lines not on this page · raw message
include/power/fan53555.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 Vasily Khoruzhick <[email protected]> +*/ + +#ifndef _FAN53555_H_ +#define _FAN53555_H_ + +enum fan53555_vendor { +FAN53555_VENDOR_FAIRCHILD , +FAN53555_VENDOR_SILERGY , +}; + +#endif
Signature · 1 line
2.24.0
PATCH 1/1 power: fan53555: add support for Silergy SYR82X and SYR83X
Hi Vasily,
I have got a development board Odroid N1
it has SYR837PKC and SYR838PKC regulator IC on the board.
On testing this patch, it failed with below message.
Model: Hardkernel ODROID-N1 DRAM: 3.9 GiB SW: fan53555_voltages_setup: die id 7 rev 7 not supported! MMC: dwmmc at fe320000: 1, sdhci at fe330000: 0
Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment
could you add this *die id* and *rev id* and update in the next patch.
Could we enable this feature on all rk3399 development boards
-Anand
Quoted 156 lines · Vasily Khoruzhick
SYR82X and SYR83X are almost identical to FAN53555, the only difference is different die ID and revision, voltage ranges and steps.
Signed-off-by Vasily Khoruzhick <[email protected]>--- drivers/power/pmic/fan53555.c | 7 +++-- drivers/power/regulator/fan53555.c | 45 ++++++++++++++++++++++-------- include/power/fan53555.h | 14 ++++++++++ 3 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 include/power/fan53555.hdrivers/power/pmic/fan53555.c +5
-2@@ -8,6 +8,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <i2c.h> +#include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> @@ -58,7 +59,7 @@ static int pmic_fan53555_bind(struct udevice *dev)return -ENOENT ; } -return device_bind_with_driver_data (dev, drv,"SW" ,0 , +return device_bind_with_driver_data (dev, drv,"SW" , dev->driver_data,dev_ofnode (dev), &child); };@@ -69,7 +70,9 @@ static struct dm_pmic_ops pmic_fan53555_ops = { };static const struct udevice_id pmic_fan53555_match[] = { - { .compatible ="fcs,fan53555" }, + { .compatible ="fcs,fan53555" , .data =FAN53555_VENDOR_FAIRCHILD , }, + { .compatible ="silergy,syr827" , .data =FAN53555_VENDOR_SILERGY , }, + { .compatible ="silergy,syr828" , .data =FAN53555_VENDOR_SILERGY , }, { }, };drivers/power/regulator/fan53555.c +33
-12@@ -10,6 +10,7 @@#include <fdtdec.h> #include <i2c.h> #include <asm/gpio.h> +#include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> @@ -27,21 +28,37 @@* See http://www.onsemi.com/pub/Collateral/FAN53555-D.pdf for details. */ static const struct { +unsigned int vendor;u8 die_id;u8 die_rev; +bool check_rev;u32 vsel_min;u32 vsel_step; } ic_types[] = { - {0x0 ,0x3 ,600000 ,10000 },/* Option 00 */ - {0x0 ,0xf ,800000 ,10000 },/* Option 13 */ - {0x0 ,0xc ,600000 ,12500 },/* Option 23 */ - {0x1 ,0x3 ,600000 ,10000 },/* Option 01 */ - {0x3 ,0x3 ,600000 ,10000 },/* Option 03 */ - {0x4 ,0xf ,603000 ,12826 },/* Option 04 */ - {0x5 ,0x3 ,600000 ,10000 },/* Option 05 */ - {0x8 ,0x1 ,600000 ,10000 },/* Option 08 */ - {0x8 ,0xf ,600000 ,10000 },/* Option 08 */ - {0xc ,0xf ,603000 ,12826 },/* Option 09 */ +/* Option 00 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0x3 , true,600000 ,10000 }, +/* Option 13 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0xf , true,800000 ,10000 }, +/* Option 23 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0xc , true,600000 ,12500 }, +/* Option 01 */ + {FAN53555_VENDOR_FAIRCHILD ,0x1 ,0x3 , true,600000 ,10000 }, +/* Option 03 */ + {FAN53555_VENDOR_FAIRCHILD ,0x3 ,0x3 , true,600000 ,10000 }, +/* Option 04 */ + {FAN53555_VENDOR_FAIRCHILD ,0x4 ,0xf , true,603000 ,12826 }, +/* Option 05 */ + {FAN53555_VENDOR_FAIRCHILD ,0x5 ,0x3 , true,600000 ,10000 }, +/* Option 08 */ + {FAN53555_VENDOR_FAIRCHILD ,0x8 ,0x1 , true,600000 ,10000 }, +/* Option 08 */ + {FAN53555_VENDOR_FAIRCHILD ,0x8 ,0xf , true,600000 ,10000 }, +/* Option 09 */ + {FAN53555_VENDOR_FAIRCHILD ,0xc ,0xf , true,603000 ,12826 }, +/* SYL82X */ + {FAN53555_VENDOR_SILERGY ,0x8 ,0x0 , false,712500 ,12500 }, +/* SYL83X */ + {FAN53555_VENDOR_SILERGY ,0x9 ,0x0 , false,712500 ,12500 }, };/* I2C-accessible byte-sized registers */ @@ -152,10 +169,14 @@ static int fan53555_voltages_setup(struct udevice *dev)/* Init voltage range and step */ for (i =0 ; i <ARRAY_SIZE (ic_types); ++i) { +if (ic_types[i].vendor != priv->vendor) +continue ; +if (ic_types[i].die_id != priv->die_id)continue ; -if (ic_types[i].die_rev != priv->die_rev) +if (ic_types[i].check_rev && + ic_types[i].die_rev != priv->die_rev)continue ; priv->vsel_min = ic_types[i].vsel_min;@@ -193,7 +214,7 @@ static int fan53555_probe(struct udevice *dev)return ID2 ;/* extract vendor, die_id and die_rev */ - priv->vendor =bitfield_extract (ID1 ,5 ,3 ); + priv->vendor = dev->driver_data; priv->die_id =ID1 &GENMASK (3 ,0 ); priv->die_rev =ID2 &GENMASK (3 ,0 );include/power/fan53555.h new file +14
-1@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 Vasily Khoruzhick <[email protected]> +*/ + +#ifndef _FAN53555_H_ +#define _FAN53555_H_ + +enum fan53555_vendor { +FAN53555_VENDOR_FAIRCHILD , +FAN53555_VENDOR_SILERGY , +}; + +#endif --2.24.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 power: fan53555: add support for Silergy SYR82X and SYR83X
Quoted 8 lines · Anand Moon
Hi Vasily,
I have got a development board Odroid N1
it has SYR837PKC and SYR838PKC regulator IC on the board.On testing this patch, it failed with below message.
Quoted 8 lines
Model: Hardkernel ODROID-N1 DRAM: 3.9 GiB SW: fan53555_voltages_setup: die id 7 rev 7 not supported! MMC: dwmmc at fe320000: 1, sdhci at fe330000: 0Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment
could you add this *die id* and *rev id* and update in the next patch.
Likely you're missing another patch from me, see
https://patchwork.ozlabs.org/patch/1196194/ so ID you're getting here are not correct.
Quoted 1 line
Could we enable this feature on all rk3399 development boards
That's out of scope of this patch.
Quoted 159 lines
-Anand
Quoted 156 lines · Vasily Khoruzhick
SYR82X and SYR83X are almost identical to FAN53555, the only difference is different die ID and revision, voltage ranges and steps.
Signed-off-by Vasily Khoruzhick <[email protected]>--- drivers/power/pmic/fan53555.c | 7 +++-- drivers/power/regulator/fan53555.c | 45 ++++++++++++++++++++++-------- include/power/fan53555.h | 14 ++++++++++ 3 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 include/power/fan53555.hdrivers/power/pmic/fan53555.c +5
-2@@ -8,6 +8,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <i2c.h> +#include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> @@ -58,7 +59,7 @@ static int pmic_fan53555_bind(struct udevice *dev)return -ENOENT ; } -return device_bind_with_driver_data (dev, drv,"SW" ,0 , +return device_bind_with_driver_data (dev, drv,"SW" , dev->driver_data,dev_ofnode (dev), &child); };@@ -69,7 +70,9 @@ static struct dm_pmic_ops pmic_fan53555_ops = { };static const struct udevice_id pmic_fan53555_match[] = { - { .compatible ="fcs,fan53555" }, + { .compatible ="fcs,fan53555" , .data =FAN53555_VENDOR_FAIRCHILD , }, + { .compatible ="silergy,syr827" , .data =FAN53555_VENDOR_SILERGY , }, + { .compatible ="silergy,syr828" , .data =FAN53555_VENDOR_SILERGY , }, { }, };drivers/power/regulator/fan53555.c +33
-12@@ -10,6 +10,7 @@#include <fdtdec.h> #include <i2c.h> #include <asm/gpio.h> +#include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> @@ -27,21 +28,37 @@* See http://www.onsemi.com/pub/Collateral/FAN53555-D.pdf for details. */ static const struct { +unsigned int vendor;u8 die_id;u8 die_rev; +bool check_rev;u32 vsel_min;u32 vsel_step; } ic_types[] = { - {0x0 ,0x3 ,600000 ,10000 },/* Option 00 */ - {0x0 ,0xf ,800000 ,10000 },/* Option 13 */ - {0x0 ,0xc ,600000 ,12500 },/* Option 23 */ - {0x1 ,0x3 ,600000 ,10000 },/* Option 01 */ - {0x3 ,0x3 ,600000 ,10000 },/* Option 03 */ - {0x4 ,0xf ,603000 ,12826 },/* Option 04 */ - {0x5 ,0x3 ,600000 ,10000 },/* Option 05 */ - {0x8 ,0x1 ,600000 ,10000 },/* Option 08 */ - {0x8 ,0xf ,600000 ,10000 },/* Option 08 */ - {0xc ,0xf ,603000 ,12826 },/* Option 09 */ +/* Option 00 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0x3 , true,600000 ,10000 }, +/* Option 13 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0xf , true,800000 ,10000 }, +/* Option 23 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0xc , true,600000 ,12500 }, +/* Option 01 */ + {FAN53555_VENDOR_FAIRCHILD ,0x1 ,0x3 , true,600000 ,10000 }, +/* Option 03 */ + {FAN53555_VENDOR_FAIRCHILD ,0x3 ,0x3 , true,600000 ,10000 }, +/* Option 04 */ + {FAN53555_VENDOR_FAIRCHILD ,0x4 ,0xf , true,603000 ,12826 }, +/* Option 05 */ + {FAN53555_VENDOR_FAIRCHILD ,0x5 ,0x3 , true,600000 ,10000 }, +/* Option 08 */ + {FAN53555_VENDOR_FAIRCHILD ,0x8 ,0x1 , true,600000 ,10000 }, +/* Option 08 */ + {FAN53555_VENDOR_FAIRCHILD ,0x8 ,0xf , true,600000 ,10000 }, +/* Option 09 */ + {FAN53555_VENDOR_FAIRCHILD ,0xc ,0xf , true,603000 ,12826 }, +/* SYL82X */ + {FAN53555_VENDOR_SILERGY ,0x8 ,0x0 , false,712500 ,12500 }, +/* SYL83X */ + {FAN53555_VENDOR_SILERGY ,0x9 ,0x0 , false,712500 ,12500 }, };/* I2C-accessible byte-sized registers */ @@ -152,10 +169,14 @@ static int fan53555_voltages_setup(struct udevice *dev)/* Init voltage range and step */ for (i =0 ; i <ARRAY_SIZE (ic_types); ++i) { +if (ic_types[i].vendor != priv->vendor) +continue ; +if (ic_types[i].die_id != priv->die_id)continue ; -if (ic_types[i].die_rev != priv->die_rev) +if (ic_types[i].check_rev && + ic_types[i].die_rev != priv->die_rev)continue ; priv->vsel_min = ic_types[i].vsel_min;@@ -193,7 +214,7 @@ static int fan53555_probe(struct udevice *dev)return ID2 ;/* extract vendor, die_id and die_rev */ - priv->vendor =bitfield_extract (ID1 ,5 ,3 ); + priv->vendor = dev->driver_data; priv->die_id =ID1 &GENMASK (3 ,0 ); priv->die_rev =ID2 &GENMASK (3 ,0 );include/power/fan53555.h new file +14
-1@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 Vasily Khoruzhick <[email protected]> +*/ + +#ifndef _FAN53555_H_ +#define _FAN53555_H_ + +enum fan53555_vendor { +FAN53555_VENDOR_FAIRCHILD , +FAN53555_VENDOR_SILERGY , +}; + +#endif --2.24.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 1/1 power: fan53555: add support for Silergy SYR82X and SYR83X
Hi Vasily,
Quoted 17 lines · Vasily Khoruzhick
Quoted 15 lines · Anand Moon
Hi Vasily,
I have got a development board Odroid N1
it has SYR837PKC and SYR838PKC regulator IC on the board.On testing this patch, it failed with below message.
Model: Hardkernel ODROID-N1 DRAM: 3.9 GiB SW: fan53555_voltages_setup: die id 7 rev 7 not supported! MMC: dwmmc at fe320000: 1, sdhci at fe330000: 0Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment
Quoted 6 lines
Quoted 1 line
could you add this *die id* and *rev id* and update in the next patch.
Likely you're missing another patch from me, see
https://patchwork.ozlabs.org/patch/1196194/ so ID you're getting here are not correct.
Ok thanks. This fix my warning.
Please add my
-Anand
PATCH 1/1 power: fan53555: add support for Silergy SYR82X and SYR83X
In reply to Vasily KhoruzhickQuoted 4 lines · Vasily Khoruzhick
SYR82X and SYR83X are almost identical to FAN53555, the only difference is different die ID and revision, voltage ranges and steps.
Signed-off-by Vasily Khoruzhick <[email protected]>
Thanks,
- Kever
Quoted 144 lines
--- drivers/power/pmic/fan53555.c | 7 +++-- drivers/power/regulator/fan53555.c | 45 ++++++++++++++++++++++-------- include/power/fan53555.h | 14 ++++++++++ 3 files changed, 52 insertions(+), 14 deletions(-)create mode 100644
include/power/fan53555.hdrivers/power/pmic/fan53555.c +5
-2@@ -8,6 +8,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <i2c.h> +#include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> @@ -58,7 +59,7 @@ static int pmic_fan53555_bind(struct udevice *dev)return -ENOENT ; } -return device_bind_with_driver_data (dev, drv,"SW" ,0 , +return device_bind_with_driver_data (dev, drv,"SW" , dev->driver_data,dev_ofnode (dev), &child); };@@ -69,7 +70,9 @@ static struct dm_pmic_ops pmic_fan53555_ops = { };static const struct udevice_id pmic_fan53555_match[] = { - { .compatible ="fcs,fan53555" }, + { .compatible ="fcs,fan53555" , .data =FAN53555_VENDOR_FAIRCHILD , }, + { .compatible ="silergy,syr827" , .data =FAN53555_VENDOR_SILERGY , }, + { .compatible ="silergy,syr828" , .data =FAN53555_VENDOR_SILERGY , }, { }, };drivers/power/regulator/fan53555.c +33
-12@@ -10,6 +10,7 @@#include <fdtdec.h> #include <i2c.h> #include <asm/gpio.h> +#include <power/fan53555.h> #include <power/pmic.h> #include <power/regulator.h> @@ -27,21 +28,37 @@* See http://www.onsemi.com/pub/Collateral/FAN53555-D.pdf for details. */ static const struct { +unsigned int vendor;u8 die_id;u8 die_rev; +bool check_rev;u32 vsel_min;u32 vsel_step; } ic_types[] = { - {0x0 ,0x3 ,600000 ,10000 },/* Option 00 */ - {0x0 ,0xf ,800000 ,10000 },/* Option 13 */ - {0x0 ,0xc ,600000 ,12500 },/* Option 23 */ - {0x1 ,0x3 ,600000 ,10000 },/* Option 01 */ - {0x3 ,0x3 ,600000 ,10000 },/* Option 03 */ - {0x4 ,0xf ,603000 ,12826 },/* Option 04 */ - {0x5 ,0x3 ,600000 ,10000 },/* Option 05 */ - {0x8 ,0x1 ,600000 ,10000 },/* Option 08 */ - {0x8 ,0xf ,600000 ,10000 },/* Option 08 */ - {0xc ,0xf ,603000 ,12826 },/* Option 09 */ +/* Option 00 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0x3 , true,600000 ,10000 }, +/* Option 13 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0xf , true,800000 ,10000 }, +/* Option 23 */ + {FAN53555_VENDOR_FAIRCHILD ,0x0 ,0xc , true,600000 ,12500 }, +/* Option 01 */ + {FAN53555_VENDOR_FAIRCHILD ,0x1 ,0x3 , true,600000 ,10000 }, +/* Option 03 */ + {FAN53555_VENDOR_FAIRCHILD ,0x3 ,0x3 , true,600000 ,10000 }, +/* Option 04 */ + {FAN53555_VENDOR_FAIRCHILD ,0x4 ,0xf , true,603000 ,12826 }, +/* Option 05 */ + {FAN53555_VENDOR_FAIRCHILD ,0x5 ,0x3 , true,600000 ,10000 }, +/* Option 08 */ + {FAN53555_VENDOR_FAIRCHILD ,0x8 ,0x1 , true,600000 ,10000 }, +/* Option 08 */ + {FAN53555_VENDOR_FAIRCHILD ,0x8 ,0xf , true,600000 ,10000 }, +/* Option 09 */ + {FAN53555_VENDOR_FAIRCHILD ,0xc ,0xf , true,603000 ,12826 }, +/* SYL82X */ + {FAN53555_VENDOR_SILERGY ,0x8 ,0x0 , false,712500 ,12500 }, +/* SYL83X */ + {FAN53555_VENDOR_SILERGY ,0x9 ,0x0 , false,712500 ,12500 }, };/* I2C-accessible byte-sized registers */ @@ -152,10 +169,14 @@ static int fan53555_voltages_setup(struct udevice *dev)/* Init voltage range and step */ for (i =0 ; i <ARRAY_SIZE (ic_types); ++i) { +if (ic_types[i].vendor != priv->vendor) +continue ; +if (ic_types[i].die_id != priv->die_id)continue ; -if (ic_types[i].die_rev != priv->die_rev) +if (ic_types[i].check_rev && + ic_types[i].die_rev != priv->die_rev)continue ; priv->vsel_min = ic_types[i].vsel_min;@@ -193,7 +214,7 @@ static int fan53555_probe(struct udevice *dev)return ID2 ;/* extract vendor, die_id and die_rev */ - priv->vendor =bitfield_extract (ID1 ,5 ,3 ); + priv->vendor = dev->driver_data; priv->die_id =ID1 &GENMASK (3 ,0 ); priv->die_rev =ID2 &GENMASK (3 ,0 );include/power/fan53555.h new file +14
-0@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 Vasily Khoruzhick <[email protected]> +*/ + +#ifndef _FAN53555_H_ +#define _FAN53555_H_ + +enum fan53555_vendor { +FAN53555_VENDOR_FAIRCHILD , +FAN53555_VENDOR_SILERGY , +}; + +#endif