* [U-Boot] [PATCH V3 0/7] dm: universal_c210: support the DM_PMIC [not found] <CGME20170109054756epcas5p1be84a53e75fbd735f8484587b4b1f3e6@epcas5p1.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung [not found] ` <CGME20170109054756epcas5p1d88d90590a765e8409c4f2e612761f78@epcas5p1.samsung.com> ` (7 more replies) 0 siblings, 8 replies; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot This patchset is for supporting pmic driver-mode on universal_c210 board. It's using i2c-s3c24x0.c file. (Fixes some complier error issue.) Remove the soft_i2c codes in universal.c. It seems a deadcode because of no usage. Before time, it had used the soft-i2c as gpio_request(), not using s3c24x0-i2c.c (gpb6/7 were used the sda/scl.) There is no reason not to use the s3c24x0-i2c.c *dm tree i2c [ + ] |-- i2c at 138b0000 pmic [ + ] | `-- max8998-pmic at 66 *dm uclass uclass 20: i2c - i2c at 13860000 @ 5ae652d8, seq -1, (req 0) - i2c at 13870000 @ 5ae65330, seq -1, (req 1) - i2c at 13880000 @ 5ae65388, seq -1, (req 2) - i2c at 13890000 @ 5ae653e0, seq -1, (req 3) - i2c at 138a0000 @ 5ae65438, seq -1, (req 4) - * i2c at 138b0000 @ 5ae65490, seq 5, (req 5) - i2c at 138c0000 @ 5ae65570, seq -1, (req 6) - i2c at 138d0000 @ 5ae655c8, seq -1, (req 7) i2c [ + ] |-- i2c at 138b0000 pmic [ + ] | `-- max8998-pmic at 66 *After using pmic command. Universal # pmic list | Name | Parent name | Parent uclass @ seq | max8998-pmic at 66 | i2c at 138b0000 | i2c @ 5 Changelog on V3: - Changes the patches sequence for fixing the buildman error - Adds the commit message in more details. Changelog on V2: - Changes to "depends on ARCH_EXYNOS4" in Kconfig (fixes buildman error.) Jaehoon Chung (7): ARM: dts: exynos4: use the node's name for i2c ARM: dts: exnyos4210-universl_c210: add i2c_5 and pmic nodes configs: s5pc210_universal: enable the DM_PMIC and MAX8998 board: samsung: universal_210: use the driver model for max8998 i2c: s3c24x0: fix the compiler error for exynos4 i2c: Kconfig: Add SYS_I2C_S3C24X0 entry board: samsung: universal_c210: remove the codes relevant to soft_i2c arch/arm/dts/exynos4.dtsi | 27 +++-- arch/arm/dts/exynos4210-universal_c210.dts | 164 ++++++++++++++++++++++++++ board/samsung/universal_c210/universal.c | 180 +++++++++++++++-------------- configs/s5pc210_universal_defconfig | 3 + drivers/i2c/Kconfig | 5 + drivers/i2c/s3c24x0_i2c.c | 8 +- 6 files changed, 292 insertions(+), 95 deletions(-) -- 2.10.2 ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <CGME20170109054756epcas5p1d88d90590a765e8409c4f2e612761f78@epcas5p1.samsung.com>]
* [U-Boot] [PATCH V3 1/7] ARM: dts: exynos4: use the node's name for i2c [not found] ` <CGME20170109054756epcas5p1d88d90590a765e8409c4f2e612761f78@epcas5p1.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung 2017-01-19 13:57 ` Simon Glass 0 siblings, 1 reply; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot Use the node's name for i2c. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- arch/arm/dts/exynos4.dtsi | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/arch/arm/dts/exynos4.dtsi b/arch/arm/dts/exynos4.dtsi index 7de227c..a5a00c8 100644 --- a/arch/arm/dts/exynos4.dtsi +++ b/arch/arm/dts/exynos4.dtsi @@ -10,6 +10,17 @@ #include "skeleton.dtsi" / { + aliases { + i2c0 = &i2c_0; + i2c1 = &i2c_1; + i2c2 = &i2c_2; + i2c3 = &i2c_3; + i2c4 = &i2c_4; + i2c5 = &i2c_5; + i2c6 = &i2c_6; + i2c7 = &i2c_7; + }; + combiner: interrupt-controller at 10440000 { compatible = "samsung,exynos4210-combiner"; #interrupt-cells = <2>; @@ -47,7 +58,7 @@ id = <4>; }; - i2c at 13860000 { + i2c_0: i2c at 13860000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; @@ -55,7 +66,7 @@ interrupts = <0 56 0>; }; - i2c at 13870000 { + i2c_1: i2c at 13870000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; @@ -63,7 +74,7 @@ interrupts = <1 57 0>; }; - i2c at 13880000 { + i2c_2: i2c at 13880000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; @@ -71,7 +82,7 @@ interrupts = <2 58 0>; }; - i2c at 13890000 { + i2c_3: i2c at 13890000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; @@ -79,7 +90,7 @@ interrupts = <3 59 0>; }; - i2c at 138a0000 { + i2c_4: i2c at 138a0000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; @@ -87,7 +98,7 @@ interrupts = <4 60 0>; }; - i2c at 138b0000 { + i2c_5: i2c at 138b0000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; @@ -95,7 +106,7 @@ interrupts = <5 61 0>; }; - i2c at 138c0000 { + i2c_6: i2c at 138c0000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; @@ -103,7 +114,7 @@ interrupts = <6 62 0>; }; - i2c at 138d0000 { + i2c_7: i2c at 138d0000 { #address-cells = <1>; #size-cells = <0>; compatible = "samsung,s3c2440-i2c"; -- 2.10.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 1/7] ARM: dts: exynos4: use the node's name for i2c 2017-01-09 5:47 ` [U-Boot] [PATCH V3 1/7] ARM: dts: exynos4: use the node's name for i2c Jaehoon Chung @ 2017-01-19 13:57 ` Simon Glass 0 siblings, 0 replies; 16+ messages in thread From: Simon Glass @ 2017-01-19 13:57 UTC (permalink / raw) To: u-boot On 8 January 2017 at 22:47, Jaehoon Chung <jh80.chung@samsung.com> wrote: > Use the node's name for i2c. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > arch/arm/dts/exynos4.dtsi | 27 +++++++++++++++++++-------- > 1 file changed, 19 insertions(+), 8 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <CGME20170109054756epcas1p3d969efcd6a5a04136f519625b2df8bd2@epcas1p3.samsung.com>]
* [U-Boot] [PATCH V3 2/7] ARM: dts: exnyos4210-universl_c210: add i2c_5 and pmic nodes [not found] ` <CGME20170109054756epcas1p3d969efcd6a5a04136f519625b2df8bd2@epcas1p3.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung 2017-01-14 17:13 ` Simon Glass 0 siblings, 1 reply; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot Add the i2c_5 node and pmic as its child node. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- arch/arm/dts/exynos4210-universal_c210.dts | 164 +++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) diff --git a/arch/arm/dts/exynos4210-universal_c210.dts b/arch/arm/dts/exynos4210-universal_c210.dts index 8cac7dd..5763627 100644 --- a/arch/arm/dts/exynos4210-universal_c210.dts +++ b/arch/arm/dts/exynos4210-universal_c210.dts @@ -94,3 +94,167 @@ samsung,rgb-mode = <0>; }; }; + +&i2c_5 { + clock-frequency = <100000>; + status = "okay"; + + max8998-pmic at 66 { + compatible = "maxim,max8998"; + reg = <0x66 0 0>; + voltage-regulators { + ldo2_reg: LDO2 { + regulator-name = "VALIVE_1.2V"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + }; + + ldo3_reg: LDO3 { + regulator-name = "VUSB+MIPI_1.1V"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-always-on; + }; + + ldo4_reg: LDO4 { + regulator-name = "VADC_3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + ldo5_reg: LDO5 { + regulator-name = "VTF_2.8V"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + + ldo6_reg: LDO6 { + regulator-name = "LDO6"; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + }; + + ldo7_reg: LDO7 { + regulator-name = "VLCD+VMIPI_1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + ldo8_reg: LDO8 { + regulator-name = "VUSB+VDAC_3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + ldo9_reg: LDO9 { + regulator-name = "VCC_2.8V"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + ldo10_reg: LDO10 { + regulator-name = "VPLL_1.1V"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo11_reg: LDO11 { + regulator-name = "CAM_AF_3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + ldo12_reg: LDO12 { + regulator-name = "PS_2.8V"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + + ldo13_reg: LDO13 { + regulator-name = "VHIC_1.2V"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + ldo14_reg: LDO14 { + regulator-name = "CAM_I_HOST_1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + ldo15_reg: LDO15 { + regulator-name = "CAM_S_DIG+FM33_CORE_1.2V"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + ldo16_reg: LDO16 { + regulator-name = "CAM_S_ANA_2.8V"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + + ldo17_reg: LDO17 { + regulator-name = "VCC_3.0V_LCD"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + }; + + buck1_reg: BUCK1 { + regulator-name = "VINT_1.1V"; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1500000>; + regulator-boot-on; + regulator-always-on; + }; + + buck2_reg: BUCK2 { + regulator-name = "VG3D_1.1V"; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1500000>; + regulator-boot-on; + }; + + buck3_reg: BUCK3 { + regulator-name = "VCC_1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + buck4_reg: BUCK4 { + regulator-name = "VMEM_1.2V"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + }; + + ap32khz_reg: EN32KHz-AP { + regulator-name = "32KHz AP"; + regulator-always-on; + }; + + cp32khz_reg: EN32KHz-CP { + regulator-name = "32KHz CP"; + }; + + vichg_reg: ENVICHG { + regulator-name = "VICHG"; + }; + + safeout1_reg: ESAFEOUT1 { + regulator-name = "SAFEOUT1"; + }; + + safeout2_reg: ESAFEOUT2 { + regulator-name = "SAFEOUT2"; + regulator-boot-on; + }; + }; + }; +}; -- 2.10.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 2/7] ARM: dts: exnyos4210-universl_c210: add i2c_5 and pmic nodes 2017-01-09 5:47 ` [U-Boot] [PATCH V3 2/7] ARM: dts: exnyos4210-universl_c210: add i2c_5 and pmic nodes Jaehoon Chung @ 2017-01-14 17:13 ` Simon Glass 0 siblings, 0 replies; 16+ messages in thread From: Simon Glass @ 2017-01-14 17:13 UTC (permalink / raw) To: u-boot On 8 January 2017 at 22:47, Jaehoon Chung <jh80.chung@samsung.com> wrote: > Add the i2c_5 node and pmic as its child node. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > arch/arm/dts/exynos4210-universal_c210.dts | 164 +++++++++++++++++++++++++++++ > 1 file changed, 164 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <CGME20170109054756epcas1p39ede62645683f758c30ba703c3a68389@epcas1p3.samsung.com>]
* [U-Boot] [PATCH V3 3/7] configs: s5pc210_universal: enable the DM_PMIC and MAX8998 [not found] ` <CGME20170109054756epcas1p39ede62645683f758c30ba703c3a68389@epcas1p3.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung 2017-01-19 13:57 ` Simon Glass 0 siblings, 1 reply; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot Enable the CONFIG_DM_PMIC and CONFIG_DM_PMIC_MAX8998. s5pc210_universal board is using max8998 pmic. To use the i2c/pmic driver model, enable these configurations. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- configs/s5pc210_universal_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/s5pc210_universal_defconfig b/configs/s5pc210_universal_defconfig index b6cefb1..538e0ce 100644 --- a/configs/s5pc210_universal_defconfig +++ b/configs/s5pc210_universal_defconfig @@ -32,6 +32,9 @@ CONFIG_DFU_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_S5P=y +CONFIG_DM_PMIC=y +CONFIG_DM_PMIC_MAX8998=y +CONFIG_SYS_I2C_S3C24X0=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_GADGET=y -- 2.10.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 3/7] configs: s5pc210_universal: enable the DM_PMIC and MAX8998 2017-01-09 5:47 ` [U-Boot] [PATCH V3 3/7] configs: s5pc210_universal: enable the DM_PMIC and MAX8998 Jaehoon Chung @ 2017-01-19 13:57 ` Simon Glass 0 siblings, 0 replies; 16+ messages in thread From: Simon Glass @ 2017-01-19 13:57 UTC (permalink / raw) To: u-boot On 8 January 2017 at 22:47, Jaehoon Chung <jh80.chung@samsung.com> wrote: > Enable the CONFIG_DM_PMIC and CONFIG_DM_PMIC_MAX8998. > s5pc210_universal board is using max8998 pmic. > To use the i2c/pmic driver model, enable these configurations. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > configs/s5pc210_universal_defconfig | 3 +++ > 1 file changed, 3 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <CGME20170109054756epcas1p381df924ba1a4ad00b5716d1c533dca08@epcas1p3.samsung.com>]
* [U-Boot] [PATCH V3 4/7] board: samsung: universal_210: use the driver model for max8998 [not found] ` <CGME20170109054756epcas1p381df924ba1a4ad00b5716d1c533dca08@epcas1p3.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung 2017-01-19 13:57 ` Simon Glass 0 siblings, 1 reply; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot Revmoe the "ifndef CONFIG_DM_I2C". Intead, use the driver model for max8998. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- board/samsung/universal_c210/universal.c | 169 +++++++++++++++++-------------- 1 file changed, 94 insertions(+), 75 deletions(-) diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index c3946ee..0645843 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -27,33 +27,21 @@ DECLARE_GLOBAL_DATA_PTR; unsigned int board_rev; +static int init_pmic_lcd(void); u32 get_board_rev(void) { return board_rev; } -static int get_hwrev(void) +int exynos_power_init(void) { - return board_rev & 0xFF; + return init_pmic_lcd(); } -int exynos_power_init(void) +static int get_hwrev(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - int ret; - - /* - * For PMIC the I2C bus is named as I2C5, but it is connected - * to logical I2C adapter 0 - */ - ret = pmic_init(I2C_0); - if (ret) - return ret; - - init_pmic_lcd(); -#endif - return 0; + return board_rev & 0xFF; } static unsigned short get_adc_value(int channel) @@ -83,23 +71,29 @@ static unsigned short get_adc_value(int channel) static int adc_power_control(int on) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ + struct udevice *dev; int ret; - struct pmic *p = pmic_get("MAX8998_PMIC"); - if (!p) - return -ENODEV; + u8 reg; - if (pmic_probe(p)) - return -1; + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998!\n"); + return ret; + } - ret = pmic_set_output(p, - MAX8998_REG_ONOFF1, - MAX8998_LDO4, !!on); + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); + if (on) + reg |= MAX8998_LDO4; + else + reg &= ~MAX8998_LDO4; + + ret = pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); + if (ret) { + puts("MAX8998 LDO setting error\n"); + return -EINVAL; + } - return ret; -#else return 0; -#endif } static unsigned int get_hw_revision(void) @@ -147,39 +141,50 @@ static void check_hw_revision(void) #ifdef CONFIG_USB_GADGET static int s5pc210_phy_control(int on) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - int ret = 0; - struct pmic *p = pmic_get("MAX8998_PMIC"); - if (!p) - return -ENODEV; + struct udevice *dev; + int ret; + u8 reg; - if (pmic_probe(p)) - return -1; + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998!\n"); + return ret; + } if (on) { - ret |= pmic_set_output(p, - MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, - MAX8998_SAFEOUT1, LDO_ON); - ret |= pmic_set_output(p, MAX8998_REG_ONOFF1, - MAX8998_LDO3, LDO_ON); - ret |= pmic_set_output(p, MAX8998_REG_ONOFF2, - MAX8998_LDO8, LDO_ON); + reg = pmic_reg_read(dev, MAX8998_REG_BUCK_ACTIVE_DISCHARGE3); + reg |= MAX8998_SAFEOUT1; + ret |= pmic_reg_write(dev, + MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); + reg |= MAX8998_LDO3; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2); + reg |= MAX8998_LDO8; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg); } else { - ret |= pmic_set_output(p, MAX8998_REG_ONOFF2, - MAX8998_LDO8, LDO_OFF); - ret |= pmic_set_output(p, MAX8998_REG_ONOFF1, - MAX8998_LDO3, LDO_OFF); - ret |= pmic_set_output(p, - MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, - MAX8998_SAFEOUT1, LDO_OFF); + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2); + reg &= ~MAX8998_LDO8; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); + reg &= ~MAX8998_LDO3; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_BUCK_ACTIVE_DISCHARGE3); + reg &= ~MAX8998_SAFEOUT1; + ret |= pmic_reg_write(dev, + MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, reg); } if (ret) { puts("MAX8998 LDO setting error!\n"); - return -1; + return -EINVAL; } -#endif + return 0; } @@ -205,27 +210,25 @@ int exynos_early_init_f(void) return 0; } -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ -static void init_pmic_lcd(void) +static int init_pmic_lcd(void) { + struct udevice *dev; unsigned char val; int ret = 0; - struct pmic *p = pmic_get("MAX8998_PMIC"); - - if (!p) - return; - - if (pmic_probe(p)) - return; + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998 for init_pmic_lcd()!\n"); + return ret; + } /* LDO7 1.8V */ val = 0x02; /* (1800 - 1600) / 100; */ - ret |= pmic_reg_write(p, MAX8998_REG_LDO7, val); + ret |= pmic_reg_write(dev, MAX8998_REG_LDO7, val); /* LDO17 3.0V */ val = 0xe; /* (3000 - 1600) / 100; */ - ret |= pmic_reg_write(p, MAX8998_REG_LDO17, val); + ret |= pmic_reg_write(dev, MAX8998_REG_LDO17, val); /* Disable unneeded regulators */ /* @@ -234,26 +237,29 @@ static void init_pmic_lcd(void) * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON */ val = 0xB9; - ret |= pmic_reg_write(p, MAX8998_REG_ONOFF1, val); + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF1, val); /* ONOFF2 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON, * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF */ val = 0x50; - ret |= pmic_reg_write(p, MAX8998_REG_ONOFF2, val); + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF2, val); /* ONOFF3 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF */ val = 0x00; - ret |= pmic_reg_write(p, MAX8998_REG_ONOFF3, val); + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF3, val); - if (ret) + if (ret) { puts("LCD pmic initialisation error!\n"); + return -EINVAL; + } + + return 0; } -#endif void exynos_cfg_lcd_gpio(void) { @@ -310,18 +316,31 @@ void exynos_reset_lcd(void) void exynos_lcd_power_on(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - struct pmic *p = pmic_get("MAX8998_PMIC"); + struct udevice *dev; + int ret; + u8 reg; - if (!p) + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998!\n"); return; + } - if (pmic_probe(p)) + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF3); + reg |= MAX8998_LDO17; + ret = pmic_reg_write(dev, MAX8998_REG_ONOFF3, reg); + if (ret) { + puts("MAX8998 LDO setting error\n"); return; + } - pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON); - pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON); -#endif + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2); + reg |= MAX8998_LDO7; + ret = pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg); + if (ret) { + puts("MAX8998 LDO setting error\n"); + return; + } } void exynos_cfg_ldo(void) -- 2.10.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 4/7] board: samsung: universal_210: use the driver model for max8998 2017-01-09 5:47 ` [U-Boot] [PATCH V3 4/7] board: samsung: universal_210: use the driver model for max8998 Jaehoon Chung @ 2017-01-19 13:57 ` Simon Glass 0 siblings, 0 replies; 16+ messages in thread From: Simon Glass @ 2017-01-19 13:57 UTC (permalink / raw) To: u-boot Hi Jaehoon, On 8 January 2017 at 22:47, Jaehoon Chung <jh80.chung@samsung.com> wrote: > Revmoe the "ifndef CONFIG_DM_I2C". > Intead, use the driver model for max8998. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > board/samsung/universal_c210/universal.c | 169 +++++++++++++++++-------------- > 1 file changed, 94 insertions(+), 75 deletions(-) > > diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c > index c3946ee..0645843 100644 > --- a/board/samsung/universal_c210/universal.c > +++ b/board/samsung/universal_c210/universal.c > @@ -27,33 +27,21 @@ > DECLARE_GLOBAL_DATA_PTR; > > unsigned int board_rev; > +static int init_pmic_lcd(void); > > u32 get_board_rev(void) > { > return board_rev; > } > > -static int get_hwrev(void) > +int exynos_power_init(void) > { > - return board_rev & 0xFF; > + return init_pmic_lcd(); > } > > -int exynos_power_init(void) > +static int get_hwrev(void) > { > -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ > - int ret; > - > - /* > - * For PMIC the I2C bus is named as I2C5, but it is connected > - * to logical I2C adapter 0 > - */ > - ret = pmic_init(I2C_0); > - if (ret) > - return ret; > - > - init_pmic_lcd(); > -#endif > - return 0; > + return board_rev & 0xFF; > } > > static unsigned short get_adc_value(int channel) > @@ -83,23 +71,29 @@ static unsigned short get_adc_value(int channel) > > static int adc_power_control(int on) > { > -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ > + struct udevice *dev; > int ret; > - struct pmic *p = pmic_get("MAX8998_PMIC"); > - if (!p) > - return -ENODEV; > + u8 reg; > > - if (pmic_probe(p)) > - return -1; > + ret = pmic_get("max8998-pmic", &dev); > + if (ret) { > + puts("Failed to get MAX8998!\n"); > + return ret; > + } > > - ret = pmic_set_output(p, > - MAX8998_REG_ONOFF1, > - MAX8998_LDO4, !!on); > + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); > + if (on) > + reg |= MAX8998_LDO4; > + else > + reg &= ~MAX8998_LDO4; > + > + ret = pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); > + if (ret) { > + puts("MAX8998 LDO setting error\n"); > + return -EINVAL; > + } > > - return ret; > -#else > return 0; > -#endif > } > > static unsigned int get_hw_revision(void) > @@ -147,39 +141,50 @@ static void check_hw_revision(void) > #ifdef CONFIG_USB_GADGET > static int s5pc210_phy_control(int on) > { > -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ > - int ret = 0; > - struct pmic *p = pmic_get("MAX8998_PMIC"); > - if (!p) > - return -ENODEV; > + struct udevice *dev; > + int ret; > + u8 reg; > > - if (pmic_probe(p)) > - return -1; > + ret = pmic_get("max8998-pmic", &dev); > + if (ret) { > + puts("Failed to get MAX8998!\n"); > + return ret; > + } > > if (on) { > - ret |= pmic_set_output(p, > - MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, > - MAX8998_SAFEOUT1, LDO_ON); > - ret |= pmic_set_output(p, MAX8998_REG_ONOFF1, > - MAX8998_LDO3, LDO_ON); > - ret |= pmic_set_output(p, MAX8998_REG_ONOFF2, > - MAX8998_LDO8, LDO_ON); > + reg = pmic_reg_read(dev, MAX8998_REG_BUCK_ACTIVE_DISCHARGE3); > + reg |= MAX8998_SAFEOUT1; > + ret |= pmic_reg_write(dev, > + MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, reg); > + > + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); > + reg |= MAX8998_LDO3; > + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); Can you use pmic_clrsetbits()? Regards, Simon ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <CGME20170109054756epcas1p303e9d592a30f08ed7ba9e31c227e9788@epcas1p3.samsung.com>]
* [U-Boot] [PATCH V3 5/7] i2c: s3c24x0: fix the compiler error for exynos4 [not found] ` <CGME20170109054756epcas1p303e9d592a30f08ed7ba9e31c227e9788@epcas1p3.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung 2017-01-19 13:57 ` Simon Glass 0 siblings, 1 reply; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot If CONFIG_SYS_I2C_S3C24X0_SLAVE isn't defined, then complie error should be occurred. This patch is for preventing it. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- drivers/i2c/s3c24x0_i2c.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c index 2ece9f4..363cd04 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -24,6 +24,12 @@ #include <i2c.h> #include "s3c24x0_i2c.h" +#ifndef CONFIG_SYS_I2C_S3C24X0_SLAVE +#define SYS_I2C_S3C24X0_SLAVE_ADDR 0 +#else +#define SYS_I2C_S3C24X0_SLAVE_ADDR CONFIG_SYS_I2C_S3C24X0_SLAVE +#endif + DECLARE_GLOBAL_DATA_PTR; /* @@ -87,7 +93,7 @@ static int s3c24x0_i2c_set_bus_speed(struct udevice *dev, unsigned int speed) i2c_bus->clock_frequency = speed; i2c_ch_init(i2c_bus->regs, i2c_bus->clock_frequency, - CONFIG_SYS_I2C_S3C24X0_SLAVE); + SYS_I2C_S3C24X0_SLAVE_ADDR); return 0; } -- 2.10.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 5/7] i2c: s3c24x0: fix the compiler error for exynos4 2017-01-09 5:47 ` [U-Boot] [PATCH V3 5/7] i2c: s3c24x0: fix the compiler error for exynos4 Jaehoon Chung @ 2017-01-19 13:57 ` Simon Glass 0 siblings, 0 replies; 16+ messages in thread From: Simon Glass @ 2017-01-19 13:57 UTC (permalink / raw) To: u-boot On 8 January 2017 at 22:47, Jaehoon Chung <jh80.chung@samsung.com> wrote: > If CONFIG_SYS_I2C_S3C24X0_SLAVE isn't defined, then complie error should > be occurred. > This patch is for preventing it. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > drivers/i2c/s3c24x0_i2c.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <CGME20170109054756epcas1p37bb8d7f90e984aa27cb2eb9c36a41b2b@epcas1p3.samsung.com>]
* [U-Boot] [PATCH V3 6/7] i2c: Kconfig: Add SYS_I2C_S3C24X0 entry [not found] ` <CGME20170109054756epcas1p37bb8d7f90e984aa27cb2eb9c36a41b2b@epcas1p3.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung 2017-01-19 13:57 ` Simon Glass 0 siblings, 1 reply; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot Adding Kconfig for SYS_I2C_S3C24X0. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- drivers/i2c/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 051f911..71cc173 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -155,6 +155,11 @@ config SYS_I2C_SANDBOX }; }; +config SYS_I2C_S3C24X0 + bool "Samsung I2C driver" + depends on ARCH_EXYNOS4 && DM_I2C + help + Support for Samsung I2C controller as Samsung SoCs. config SYS_I2C_UNIPHIER bool "UniPhier I2C driver" -- 2.10.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 6/7] i2c: Kconfig: Add SYS_I2C_S3C24X0 entry 2017-01-09 5:47 ` [U-Boot] [PATCH V3 6/7] i2c: Kconfig: Add SYS_I2C_S3C24X0 entry Jaehoon Chung @ 2017-01-19 13:57 ` Simon Glass 0 siblings, 0 replies; 16+ messages in thread From: Simon Glass @ 2017-01-19 13:57 UTC (permalink / raw) To: u-boot On 8 January 2017 at 22:47, Jaehoon Chung <jh80.chung@samsung.com> wrote: > Adding Kconfig for SYS_I2C_S3C24X0. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > drivers/i2c/Kconfig | 5 +++++ > 1 file changed, 5 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <CGME20170109054756epcas1p37d3a21d6d3c926e6e552b518d8e5114c@epcas1p3.samsung.com>]
* [U-Boot] [PATCH V3 7/7] board: samsung: universal_c210: remove the codes relevant to soft_i2c [not found] ` <CGME20170109054756epcas1p37d3a21d6d3c926e6e552b518d8e5114c@epcas1p3.samsung.com> @ 2017-01-09 5:47 ` Jaehoon Chung 2017-01-19 13:57 ` Simon Glass 0 siblings, 1 reply; 16+ messages in thread From: Jaehoon Chung @ 2017-01-09 5:47 UTC (permalink / raw) To: u-boot Removes the codes of soft_i2c. There is no usasge for universal_c210, also didn't define CONFIG_SOFT_I2C_GPIO_SCL. This code seems a dead code. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- board/samsung/universal_c210/universal.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 0645843..feb8a34 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -355,9 +355,6 @@ void exynos_enable_ldo(unsigned int onoff) int exynos_init(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - char buf[16]; -#endif gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210; switch (get_hwrev()) { @@ -382,14 +379,6 @@ int exynos_init(void) break; } -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - /* Request soft I2C gpios */ - strcpy(buf, "soft_i2c_scl"); - gpio_request(CONFIG_SOFT_I2C_GPIO_SCL, buf); - - strcpy(buf, "soft_i2c_sda"); - gpio_request(CONFIG_SOFT_I2C_GPIO_SDA, buf); -#endif check_hw_revision(); printf("HW Revision:\t0x%x\n", board_rev); -- 2.10.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 7/7] board: samsung: universal_c210: remove the codes relevant to soft_i2c 2017-01-09 5:47 ` [U-Boot] [PATCH V3 7/7] board: samsung: universal_c210: remove the codes relevant to soft_i2c Jaehoon Chung @ 2017-01-19 13:57 ` Simon Glass 0 siblings, 0 replies; 16+ messages in thread From: Simon Glass @ 2017-01-19 13:57 UTC (permalink / raw) To: u-boot On 8 January 2017 at 22:47, Jaehoon Chung <jh80.chung@samsung.com> wrote: > Removes the codes of soft_i2c. > There is no usasge for universal_c210, also didn't define > CONFIG_SOFT_I2C_GPIO_SCL. > This code seems a dead code. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > board/samsung/universal_c210/universal.c | 11 ----------- > 1 file changed, 11 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH V3 0/7] dm: universal_c210: support the DM_PMIC 2017-01-09 5:47 ` [U-Boot] [PATCH V3 0/7] dm: universal_c210: support the DM_PMIC Jaehoon Chung ` (6 preceding siblings ...) [not found] ` <CGME20170109054756epcas1p37d3a21d6d3c926e6e552b518d8e5114c@epcas1p3.samsung.com> @ 2017-01-18 5:17 ` Minkyu Kang 7 siblings, 0 replies; 16+ messages in thread From: Minkyu Kang @ 2017-01-18 5:17 UTC (permalink / raw) To: u-boot Dear Jaehoon, On Monday, 9 January 2017, Jaehoon Chung <jh80.chung@samsung.com> wrote: > This patchset is for supporting pmic driver-mode on universal_c210 board. > It's using i2c-s3c24x0.c file. (Fixes some complier error issue.) > > Remove the soft_i2c codes in universal.c. > It seems a deadcode because of no usage. > Before time, it had used the soft-i2c as gpio_request(), not using > s3c24x0-i2c.c > (gpb6/7 were used the sda/scl.) > There is no reason not to use the s3c24x0-i2c.c > > *dm tree > i2c [ + ] |-- i2c at 138b0000 > pmic [ + ] | `-- max8998-pmic at 66 > > *dm uclass > uclass 20: i2c > - i2c at 13860000 @ 5ae652d8, seq -1, (req 0) > - i2c at 13870000 @ 5ae65330, seq -1, (req 1) > - i2c at 13880000 @ 5ae65388, seq -1, (req 2) > - i2c at 13890000 @ 5ae653e0, seq -1, (req 3) > - i2c at 138a0000 @ 5ae65438, seq -1, (req 4) > - * i2c at 138b0000 @ 5ae65490, seq 5, (req 5) > - i2c at 138c0000 @ 5ae65570, seq -1, (req 6) > - i2c at 138d0000 @ 5ae655c8, seq -1, (req 7) > i2c [ + ] |-- i2c at 138b0000 > pmic [ + ] | `-- max8998-pmic at 66 > > *After using pmic command. > Universal # pmic list > | Name | Parent name | Parent uclass @ > seq > | max8998-pmic at 66 | i2c at 138b0000 | i2c @ 5 > > Changelog on V3: > - Changes the patches sequence for fixing the buildman error > - Adds the commit message in more details. > > Changelog on V2: > - Changes to "depends on ARCH_EXYNOS4" in Kconfig (fixes buildman error.) > > Jaehoon Chung (7): > ARM: dts: exynos4: use the node's name for i2c > ARM: dts: exnyos4210-universl_c210: add i2c_5 and pmic nodes > configs: s5pc210_universal: enable the DM_PMIC and MAX8998 > board: samsung: universal_210: use the driver model for max8998 > i2c: s3c24x0: fix the compiler error for exynos4 > i2c: Kconfig: Add SYS_I2C_S3C24X0 entry > board: samsung: universal_c210: remove the codes relevant to soft_i2c > > arch/arm/dts/exynos4.dtsi | 27 +++-- > arch/arm/dts/exynos4210-universal_c210.dts | 164 > ++++++++++++++++++++++++++ > board/samsung/universal_c210/universal.c | 180 > +++++++++++++++-------------- > configs/s5pc210_universal_defconfig | 3 + > drivers/i2c/Kconfig | 5 + > drivers/i2c/s3c24x0_i2c.c | 8 +- > 6 files changed, 292 insertions(+), 95 deletions(-) > > -- > 2.10.2 > > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de <javascript:;> > http://lists.denx.de/mailman/listinfo/u-boot > applied to u-boot-samsung Thanks -- Thanks. Minkyu Kang. ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2017-01-19 13:57 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20170109054756epcas5p1be84a53e75fbd735f8484587b4b1f3e6@epcas5p1.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 0/7] dm: universal_c210: support the DM_PMIC Jaehoon Chung [not found] ` <CGME20170109054756epcas5p1d88d90590a765e8409c4f2e612761f78@epcas5p1.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 1/7] ARM: dts: exynos4: use the node's name for i2c Jaehoon Chung 2017-01-19 13:57 ` Simon Glass [not found] ` <CGME20170109054756epcas1p3d969efcd6a5a04136f519625b2df8bd2@epcas1p3.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 2/7] ARM: dts: exnyos4210-universl_c210: add i2c_5 and pmic nodes Jaehoon Chung 2017-01-14 17:13 ` Simon Glass [not found] ` <CGME20170109054756epcas1p39ede62645683f758c30ba703c3a68389@epcas1p3.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 3/7] configs: s5pc210_universal: enable the DM_PMIC and MAX8998 Jaehoon Chung 2017-01-19 13:57 ` Simon Glass [not found] ` <CGME20170109054756epcas1p381df924ba1a4ad00b5716d1c533dca08@epcas1p3.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 4/7] board: samsung: universal_210: use the driver model for max8998 Jaehoon Chung 2017-01-19 13:57 ` Simon Glass [not found] ` <CGME20170109054756epcas1p303e9d592a30f08ed7ba9e31c227e9788@epcas1p3.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 5/7] i2c: s3c24x0: fix the compiler error for exynos4 Jaehoon Chung 2017-01-19 13:57 ` Simon Glass [not found] ` <CGME20170109054756epcas1p37bb8d7f90e984aa27cb2eb9c36a41b2b@epcas1p3.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 6/7] i2c: Kconfig: Add SYS_I2C_S3C24X0 entry Jaehoon Chung 2017-01-19 13:57 ` Simon Glass [not found] ` <CGME20170109054756epcas1p37d3a21d6d3c926e6e552b518d8e5114c@epcas1p3.samsung.com> 2017-01-09 5:47 ` [U-Boot] [PATCH V3 7/7] board: samsung: universal_c210: remove the codes relevant to soft_i2c Jaehoon Chung 2017-01-19 13:57 ` Simon Glass 2017-01-18 5:17 ` [U-Boot] [PATCH V3 0/7] dm: universal_c210: support the DM_PMIC Minkyu Kang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.