From patchwork Tue Mar 13 08:05:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 146358 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 34A9AB6EE8 for ; Tue, 13 Mar 2012 19:06:29 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 21F4A28086; Tue, 13 Mar 2012 09:06:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CXC8pgsRbMom; Tue, 13 Mar 2012 09:06:25 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE7722807C; Tue, 13 Mar 2012 09:06:23 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B46662807C for ; Tue, 13 Mar 2012 09:06:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jlM0OpXCe9g0 for ; Tue, 13 Mar 2012 09:06:16 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout3.w1.samsung.com (mailout3.w1.samsung.com [210.118.77.13]) by theia.denx.de (Postfix) with ESMTP id 9D32628078 for ; Tue, 13 Mar 2012 09:06:15 +0100 (CET) MIME-version: 1.0 Received: from euspt2 ([210.118.77.13]) by mailout3.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0M0T00GESD6CRG50@mailout3.w1.samsung.com> for u-boot@lists.denx.de; Tue, 13 Mar 2012 08:06:12 +0000 (GMT) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M0T0038MD6CO2@spt2.w1.samsung.com> for u-boot@lists.denx.de; Tue, 13 Mar 2012 08:06:12 +0000 (GMT) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 6AAB127005B; Tue, 13 Mar 2012 09:17:00 +0100 (CET) Date: Tue, 13 Mar 2012 09:05:59 +0100 From: Lukasz Majewski To: u-boot@lists.denx.de Message-id: <1331625959-20474-1-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.9.1 Cc: Minkyu Kang , Kyungmin Park , Marek Szyprowski Subject: [U-Boot] [PATCH] ARM: Exynos4: ADC: Universal_C210: Enable LDO4 power line for ADC measurement X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch enables LDO4 power line for preparing proper voltages to be measured by ADC converter. This measurement is used for determination of target board HW revision. Test HW: Universal_C210 (Exynos4210) rev. 0.0 Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Cc: Minkyu Kang --- board/samsung/universal_c210/universal.c | 30 +++++++++++++++++++++++++++--- include/max8998_pmic.h | 1 + 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index d0ff834..f166c3e 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -58,13 +58,13 @@ int board_init(void) gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; - check_hw_revision(); - printf("HW Revision:\t0x%x\n", board_rev); - #if defined(CONFIG_PMIC) pmic_init(); #endif + check_hw_revision(); + printf("HW Revision:\t0x%x\n", board_rev); + return 0; } @@ -109,10 +109,32 @@ static unsigned short get_adc_value(int channel) return ret; } +static int adc_power_control(int on) +{ + int ret; + struct pmic *p = get_pmic(); + + if (pmic_probe(p)) + return -1; + + if (on) + ret = pmic_set_output(p, + MAX8998_REG_ONOFF1, + MAX8998_LDO4, LDO_ON); + else + ret = pmic_set_output(p, + MAX8998_REG_ONOFF1, + MAX8998_LDO4, LDO_OFF); + + return ret; +} + static unsigned int get_hw_revision(void) { int hwrev, mode0, mode1; + adc_power_control(1); + mode0 = get_adc_value(1); /* HWREV_MODE0 */ mode1 = get_adc_value(2); /* HWREV_MODE1 */ @@ -135,6 +157,8 @@ static unsigned int get_hw_revision(void) debug("mode0: %d, mode1: %d, hwrev 0x%x\n", mode0, mode1, hwrev); + adc_power_control(0); + return hwrev; } diff --git a/include/max8998_pmic.h b/include/max8998_pmic.h index 10c892a..ca21f88 100644 --- a/include/max8998_pmic.h +++ b/include/max8998_pmic.h @@ -75,6 +75,7 @@ enum { }; #define MAX8998_LDO3 (1 << 2) +#define MAX8998_LDO4 (1 << 1) #define MAX8998_LDO8 (1 << 5) #define MAX8998_SAFEOUT1 (1 << 4)