public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/6] arm: exynos: i2c: Convert exynos boards to use DM_I2C
Date: Mon, 5 Dec 2016 13:21:17 +0100	[thread overview]
Message-ID: <58455BBD.2020809@denx.de> (raw)
In-Reply-To: <1479908085-18336-2-git-send-email-sjg@chromium.org>

Hello Simon,

Am 23.11.2016 um 14:34 schrieb Simon Glass:
> Three boards are still not converting to use DM_I2C. They are also using
> the old PMIC framework. Rather than removing them, add #ifdefs to allow
> them to continue to build. This will give the maintainers a little more
> time to decide whether to convert them or not.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   arch/arm/Kconfig                         |  1 +
>   board/samsung/common/misc.c              |  4 ++++
>   board/samsung/trats/trats.c              | 20 +++++++++++++++++--
>   board/samsung/trats2/trats2.c            | 18 +++++++++++++----
>   board/samsung/universal_c210/universal.c | 22 +++++++++++++++------
>   configs/origen_defconfig                 |  1 +
>   include/configs/s5pc210_universal.h      | 19 ------------------
>   include/configs/trats.h                  | 30 -----------------------------
>   include/configs/trats2.h                 | 33 --------------------------------
>   9 files changed, 54 insertions(+), 94 deletions(-)

Thanks!

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 993485a..2427285 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -399,6 +399,7 @@ config TARGET_BCMNSP
>   config ARCH_EXYNOS
>   	bool "Samsung EXYNOS"
>   	select DM
> +	select DM_I2C
>   	select DM_SPI_FLASH
>   	select DM_SERIAL
>   	select DM_SPI
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index 77d0a4e..203136f 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -101,6 +101,7 @@ void set_board_info(void)
>   #ifdef CONFIG_LCD_MENU
>   static int power_key_pressed(u32 reg)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	struct pmic *pmic;
>   	u32 status;
>   	u32 mask;
> @@ -123,6 +124,9 @@ static int power_key_pressed(u32 reg)
>   		return 0;
>
>   	return !!(status & mask);
> +#else
> +	return 0;
> +#endif
>   }
>
>   static int key_pressed(int key)
> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> index 66a54d4..7200c2e 100644
> --- a/board/samsung/trats/trats.c
> +++ b/board/samsung/trats/trats.c
> @@ -53,6 +53,7 @@ int exynos_init(void)
>
>   void i2c_init_board(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	int err;
>
>   	/* I2C_5 -> PMIC */
> @@ -67,8 +68,10 @@ void i2c_init_board(void)
>   	gpio_request(EXYNOS4_GPIO_Y41, "i2c_data");
>   	gpio_direction_output(EXYNOS4_GPIO_Y40, 1);
>   	gpio_direction_output(EXYNOS4_GPIO_Y41, 1);
> +#endif
>   }
>
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   static void trats_low_power_mode(void)
>   {
>   	struct exynos4_clock *clk =
> @@ -273,11 +276,14 @@ static int pmic_init_max8997(void)
>   		puts("MAX8997 PMIC setting error!\n");
>   		return -1;
>   	}
> +
>   	return 0;
>   }
> +#endif
>
>   int exynos_power_init(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	int chrg, ret;
>   	struct power_battery *pb;
>   	struct pmic *p_fg, *p_chrg, *p_muic, *p_bat;
> @@ -341,6 +347,7 @@ int exynos_power_init(void)
>
>   	if (pb->bat->state == CHARGE && chrg == CHARGER_USB)
>   		puts("CHARGE Battery !\n");
> +#endif
>
>   	return 0;
>   }
> @@ -384,6 +391,7 @@ 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;
>   	u32 val = 0;
>   	struct pmic *p = pmic_get("MAX8997_PMIC");
> @@ -415,6 +423,7 @@ static int s5pc210_phy_control(int on)
>   		puts("MAX8997 LDO setting error!\n");
>   		return -1;
>   	}
> +#endif
>
>   	return 0;
>   }
> @@ -435,11 +444,16 @@ int board_usb_init(int index, enum usb_init_type init)
>
>   int g_dnl_board_usb_cable_connected(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	struct pmic *muic = pmic_get("MAX8997_MUIC");
>   	if (!muic)
>   		return 0;
>
>   	return !!muic->chrg->chrg_type(muic);
> +#else
> +	return false;
> +#endif
> +
>   }
>   #endif
>
> @@ -552,6 +566,7 @@ void exynos_reset_lcd(void)
>
>   int lcd_power(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	int ret = 0;
>   	struct pmic *p = pmic_get("MAX8997_PMIC");
>   	if (!p)
> @@ -569,12 +584,13 @@ int lcd_power(void)
>   		puts("MAX8997 LDO setting error!\n");
>   		return -1;
>   	}
> -
> +#endif
>   	return 0;
>   }
>
>   int mipi_power(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	int ret = 0;
>   	struct pmic *p = pmic_get("MAX8997_PMIC");
>   	if (!p)
> @@ -592,7 +608,7 @@ int mipi_power(void)
>   		puts("MAX8997 LDO setting error!\n");
>   		return -1;
>   	}
> -
> +#endif
>   	return 0;
>   }
>
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index 7b28ae8..150503e 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -151,8 +151,6 @@ int exynos_early_init_f(void)
>   	return 0;
>   }
>
> -static int pmic_init_max77686(void);
> -
>   int exynos_init(void)
>   {
>   	struct exynos4_power *pwr =
> @@ -176,6 +174,7 @@ int exynos_init(void)
>
>   int exynos_power_init(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	int chrg;
>   	struct power_battery *pb;
>   	struct pmic *p_chrg, *p_muic, *p_fg, *p_bat;
> @@ -236,13 +235,14 @@ int exynos_power_init(void)
>
>   	if (pb->bat->state == CHARGE && chrg == CHARGER_USB)
>   		puts("CHARGE Battery !\n");
> -
> +#endif
>   	return 0;
>   }
>
>   #ifdef CONFIG_USB_GADGET
>   static int s5pc210_phy_control(int on)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	int ret = 0;
>   	unsigned int val;
>   	struct pmic *p, *p_pmic, *p_muic;
> @@ -299,7 +299,7 @@ static int s5pc210_phy_control(int on)
>
>   	if (ret)
>   		return -1;
> -
> +#endif
>   	return 0;
>   }
>
> @@ -319,14 +319,19 @@ int board_usb_init(int index, enum usb_init_type init)
>
>   int g_dnl_board_usb_cable_connected(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	struct pmic *muic = pmic_get("MAX77693_MUIC");
>   	if (!muic)
>   		return 0;
>
>   	return !!muic->chrg->chrg_type(muic);
> +#else
> +	return false;
> +#endif
>   }
>   #endif
>
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   static int pmic_init_max77686(void)
>   {
>   	struct pmic *p = pmic_get("MAX77686_PMIC");
> @@ -379,6 +384,7 @@ static int pmic_init_max77686(void)
>
>   	return 0;
>   }
> +#endif
>
>   /*
>    * LCD
> @@ -387,18 +393,21 @@ static int pmic_init_max77686(void)
>   #ifdef CONFIG_LCD
>   int mipi_power(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	struct pmic *p = pmic_get("MAX77686_PMIC");
>
>   	/* LDO8 VMIPI_1.0V_AP */
>   	max77686_set_ldo_mode(p, 8, OPMODE_ON);
>   	/* LDO10 VMIPI_1.8V_AP */
>   	max77686_set_ldo_mode(p, 10, OPMODE_ON);
> +#endif
>
>   	return 0;
>   }
>
>   void exynos_lcd_power_on(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	struct pmic *p = pmic_get("MAX77686_PMIC");
>
>   	/* LCD_2.2V_EN: GPC0[1] */
> @@ -410,6 +419,7 @@ void exynos_lcd_power_on(void)
>   	pmic_probe(p);
>   	max77686_set_ldo_voltage(p, 25, 3100000);
>   	max77686_set_ldo_mode(p, 25, OPMODE_LPM);
> +#endif
>   }
>
>   void exynos_reset_lcd(void)
> diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
> index 81e35b6..c3946ee 100644
> --- a/board/samsung/universal_c210/universal.c
> +++ b/board/samsung/universal_c210/universal.c
> @@ -38,10 +38,9 @@ static int get_hwrev(void)
>   	return board_rev & 0xFF;
>   }
>
> -static void init_pmic_lcd(void);
> -
>   int exynos_power_init(void)
>   {
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   	int ret;
>
>   	/*
> @@ -53,7 +52,7 @@ int exynos_power_init(void)
>   		return ret;
>
>   	init_pmic_lcd();
> -
> +#endif
>   	return 0;
>   }
>
> @@ -84,6 +83,7 @@ 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 */
>   	int ret;
>   	struct pmic *p = pmic_get("MAX8998_PMIC");
>   	if (!p)
> @@ -97,6 +97,9 @@ static int adc_power_control(int on)
>   			      MAX8998_LDO4, !!on);
>
>   	return ret;
> +#else
> +	return 0;
> +#endif
>   }
>
>   static unsigned int get_hw_revision(void)
> @@ -144,6 +147,7 @@ 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)
> @@ -175,7 +179,7 @@ static int s5pc210_phy_control(int on)
>   		puts("MAX8998 LDO setting error!\n");
>   		return -1;
>   	}
> -
> +#endif
>   	return 0;
>   }
>
> @@ -201,6 +205,7 @@ int exynos_early_init_f(void)
>   	return 0;
>   }
>
> +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
>   static void init_pmic_lcd(void)
>   {
>   	unsigned char val;
> @@ -248,6 +253,7 @@ static void init_pmic_lcd(void)
>   	if (ret)
>   		puts("LCD pmic initialisation error!\n");
>   }
> +#endif
>
>   void exynos_cfg_lcd_gpio(void)
>   {
> @@ -304,6 +310,7 @@ 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");
>
>   	if (!p)
> @@ -314,6 +321,7 @@ void exynos_lcd_power_on(void)
>
>   	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
>   	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
> +#endif
>   }
>
>   void exynos_cfg_ldo(void)
> @@ -328,8 +336,9 @@ 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()) {
> @@ -354,13 +363,14 @@ 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);
>
> diff --git a/configs/origen_defconfig b/configs/origen_defconfig
> index 0d91ec1..7b9826a 100644
> --- a/configs/origen_defconfig
> +++ b/configs/origen_defconfig
> @@ -37,3 +37,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y
>   CONFIG_G_DNL_MANUFACTURER="Samsung"
>   CONFIG_G_DNL_VENDOR_NUM=0x04e8
>   CONFIG_G_DNL_PRODUCT_NUM=0x6601
> +CONFIG_DM_I2C=y
> diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
> index 0210c5b..1bfefe9 100644
> --- a/include/configs/s5pc210_universal.h
> +++ b/include/configs/s5pc210_universal.h
> @@ -153,25 +153,6 @@
>   #define CONFIG_SAMSUNG_ONENAND
>   #define CONFIG_SYS_ONENAND_BASE		0x0C000000
>
> -#include <asm/arch/gpio.h>
> -/*
> - * I2C Settings
> - */
> -#define CONFIG_SOFT_I2C_GPIO_SCL EXYNOS4_GPIO_B7
> -#define CONFIG_SOFT_I2C_GPIO_SDA EXYNOS4_GPIO_B6
> -
> -#define CONFIG_SYS_I2C
> -#define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
> -#define CONFIG_SYS_I2C_SOFT_SPEED	50000
> -#define CONFIG_SYS_I2C_SOFT_SLAVE	0
> -#define CONFIG_SOFT_I2C_READ_REPEATED_START
> -#define CONFIG_I2C_MULTI_BUS
> -#define CONFIG_SYS_MAX_I2C_BUS	7
> -
> -#define CONFIG_POWER
> -#define CONFIG_POWER_I2C
> -#define CONFIG_POWER_MAX8998
> -
>   #define CONFIG_USB_GADGET_DWC2_OTG_PHY
>
>   /*
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index a26d663..a771ddb 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -178,36 +178,6 @@
>   /* GPT */
>   #define CONFIG_RANDOM_UUID
>
> -/* I2C */
> -#include <asm/arch/gpio.h>
> -
> -#define CONFIG_SYS_I2C
> -#define CONFIG_SYS_I2C_S3C24X0
> -#define CONFIG_SYS_I2C_S3C24X0_SPEED	100000
> -#define CONFIG_SYS_I2C_S3C24X0_SLAVE	0xFE
> -#define CONFIG_MAX_I2C_NUM		8
> -#define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
> -#define CONFIG_SYS_I2C_SOFT_SPEED	50000
> -#define CONFIG_SYS_I2C_SOFT_SLAVE	0x7F
> -#define CONFIG_SOFT_I2C_READ_REPEATED_START
> -#define CONFIG_SYS_I2C_INIT_BOARD
> -
> -/* I2C FG */
> -#define CONFIG_SOFT_I2C_GPIO_SCL EXYNOS4_GPIO_Y41
> -#define CONFIG_SOFT_I2C_GPIO_SDA EXYNOS4_GPIO_Y40
> -
> -/* POWER */
> -#define CONFIG_POWER
> -#define CONFIG_POWER_I2C
> -#define CONFIG_POWER_MAX8997
> -
> -#define CONFIG_POWER_FG
> -#define CONFIG_POWER_FG_MAX17042
> -#define CONFIG_POWER_MUIC
> -#define CONFIG_POWER_MUIC_MAX8997
> -#define CONFIG_POWER_BATTERY
> -#define CONFIG_POWER_BATTERY_TRATS
> -
>   /* Security subsystem - enable hw_rand() */
>   #define CONFIG_EXYNOS_ACE_SHA
>   #define CONFIG_LIB_HW_RAND
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 1633c67..1cd3e14 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -155,39 +155,6 @@
>   /* GPT */
>   #define CONFIG_RANDOM_UUID
>
> -/* I2C */
> -#include <asm/arch/gpio.h>
> -
> -#define CONFIG_SYS_I2C
> -#define CONFIG_SYS_I2C_S3C24X0
> -#define CONFIG_SYS_I2C_S3C24X0_SPEED	100000
> -#define CONFIG_SYS_I2C_S3C24X0_SLAVE	0
> -#define CONFIG_MAX_I2C_NUM		8
> -#define CONFIG_SYS_I2C_SOFT
> -#define CONFIG_SYS_I2C_SOFT_SPEED	50000
> -#define CONFIG_SYS_I2C_SOFT_SLAVE	0x00
> -#define I2C_SOFT_DECLARATIONS2
> -#define CONFIG_SYS_I2C_SOFT_SPEED_2     50000
> -#define CONFIG_SYS_I2C_SOFT_SLAVE_2     0x00
> -#define CONFIG_SOFT_I2C_READ_REPEATED_START
> -#define CONFIG_SYS_I2C_INIT_BOARD
> -
> -#ifndef __ASSEMBLY__
> -int get_soft_i2c_scl_pin(void);
> -int get_soft_i2c_sda_pin(void);
> -#endif
> -#define CONFIG_SOFT_I2C_GPIO_SCL	get_soft_i2c_scl_pin()
> -#define CONFIG_SOFT_I2C_GPIO_SDA	get_soft_i2c_sda_pin()
> -
> -/* POWER */
> -#define CONFIG_POWER
> -#define CONFIG_POWER_I2C
> -#define CONFIG_POWER_MAX77686
> -#define CONFIG_POWER_PMIC_MAX77693
> -#define CONFIG_POWER_MUIC_MAX77693
> -#define CONFIG_POWER_FG_MAX77693
> -#define CONFIG_POWER_BATTERY_TRATS2
> -
>   /* Security subsystem - enable hw_rand() */
>   #define CONFIG_EXYNOS_ACE_SHA
>   #define CONFIG_LIB_HW_RAND
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2016-12-05 12:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161123133513epcas2p188fdff5c8a25f7fa796e11fb53becf20@epcas2p1.samsung.com>
2016-11-23 13:34 ` [U-Boot] [PATCH 0/6] dm: i2c: Set a timeline for conversion of i2c drivers Simon Glass
2016-11-23 13:34   ` [U-Boot] [PATCH 1/6] arm: exynos: i2c: Convert exynos boards to use DM_I2C Simon Glass
2016-12-05 12:21     ` Heiko Schocher [this message]
2016-11-23 13:34   ` [U-Boot] [PATCH 2/6] arm: samsung: Convert s5p_goni and smdkc100 to DM_I2C Simon Glass
2016-12-05 12:21     ` Heiko Schocher
2016-11-23 13:34   ` [U-Boot] [PATCH 3/6] samsung: i2c: Drop old code from I2C driver Simon Glass
2016-12-05 12:22     ` Heiko Schocher
2016-11-23 13:34   ` [U-Boot] [PATCH 4/6] samsung: i2c: Split the high-speed I2C code into a new driver Simon Glass
2016-12-05 12:23     ` Heiko Schocher
2016-11-23 13:34   ` [U-Boot] [PATCH 5/6] dm: i2c: Add a note to I2C drivers which need conversion Simon Glass
2016-12-05 12:25     ` Heiko Schocher
2016-11-23 13:34   ` [U-Boot] [PATCH 6/6] dm: Add timeline and guide for porting I2C drivers Simon Glass
2016-11-23 14:52     ` Michal Simek
2016-11-23 16:13       ` Simon Glass
2016-12-05 12:25     ` Heiko Schocher
2016-12-05 22:47   ` [U-Boot] [PATCH 0/6] dm: i2c: Set a timeline for conversion of i2c drivers Jaehoon Chung
2016-12-07  0:53     ` Minkyu Kang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58455BBD.2020809@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox