From patchwork Tue Jul 24 07:23:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10220 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 360AE23E56 for ; Tue, 24 Jul 2012 07:18:37 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 055FFA183D3 for ; Tue, 24 Jul 2012 07:18:36 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so6659434ghb.11 for ; Tue, 24 Jul 2012 00:18:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml:x-gm-message-state; bh=+XRQvXEohYFcke3ZrpDCCnsjaim2yC5eF2tCQo1x+QI=; b=j7OOrTuKnZL2va582yRLUjdj0PSVFwbhoI9mQ6fTYfd68Q/SJgKzcKsDchIIQfTCkY PFBFZyRfShNnoOHcwmQNCzIDdUjdlNQs533qv64iH3PlevsYGifqajX8JWXOaGoXs/yh S7LPjMyQXGEpK/1Xa3ENPgIRIFwetSlmhGwukVnEzWD1CURu3Ecrpp4wcy2zmYOpTNbM W2nNf/qiDG+EMW3doN9viF16aJ5ibQL4R3kibHK/VeZL0vsjst3YKxcSz5iUEYjnuQnD Lb9R6CD9Ate4lZqWKBXX2c6+3A66aONx7n7lI5ySLGxd47d8NpOi4urujfGFB/hsPmgm umSQ== Received: by 10.42.75.73 with SMTP id z9mr12901315icj.46.1343114316646; Tue, 24 Jul 2012 00:18:36 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.153.7 with SMTP id i7csp67691ibw; Tue, 24 Jul 2012 00:18:36 -0700 (PDT) Received: by 10.68.226.102 with SMTP id rr6mr42136163pbc.99.1343114315531; Tue, 24 Jul 2012 00:18:35 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id pw3si26952722pbb.211.2012.07.24.00.18.35; Tue, 24 Jul 2012 00:18:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M7N00H0ULMIB9F0@mailout4.samsung.com>; Tue, 24 Jul 2012 16:18:21 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-90-500e4c3d711f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F0.B3.19326.D3C4E005; Tue, 24 Jul 2012 16:18:21 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M7N0070ELLVCSJ1@mmp1.samsung.com>; Tue, 24 Jul 2012 16:18:21 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, alim.akhtar@samsung.com, sjg@chromium.org, hs@denx.de, mk7.kang@samsung.com, chander.kashyap@linaro.org, jy0922.shim@samsung.com, jh80.chung@samsung.com Subject: [PATCH 8/8 V7] CONFIG: SMDK5250: I2C: Enable I2C Date: Tue, 24 Jul 2012 12:53:55 +0530 Message-id: <1343114635-28169-9-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1343114635-28169-1-git-send-email-rajeshwari.s@samsung.com> References: <1343114635-28169-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsVy+t9jAV1bH74Agzc3BS0err/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlNK5pYS/YIlrxtPUKYwPjLsEuRk4OCQETiY97rzNB 2GISF+6tZ+ti5OIQEljEKPF1+2F2CGcik8T/w21gVWwCRhJbT05jBLFFBCQkfvVfZQQpYhbY wihx/NVFNpCEsIClxIlLa1lAbBYBVYnb+4+wg9i8Ah4Sb9ceZ4ZYpyBxbOpXVhCbU8BTYuP1 rWALhIBqnt45xTqBkXcBI8MqRtHUguSC4qT0XEO94sTc4tK8dL3k/NxNjOAAeCa1g3Flg8Uh RgEORiUe3sxW3gAh1sSy4srcQ4wSHMxKIry8HnwBQrwpiZVVqUX58UWlOanFhxilOViUxHmN vb/6CwmkJ5akZqemFqQWwWSZODilGhiPiFjeWPzXc6mds+rnU2nXfdyP8WxxvCceO/941qya b8t+XOqcGp53d9GFriPG53cnHl7tbhLc/qHw/vn05G0nVO8pORSJ/M7TPMwgoz3JOqFHVGmy ui6T2IRPey6HdS35H8z7irlj0U0+6+/Za6e1GTMJbm744LMj7KOtdA2Hr58+S9iivxFKLMUZ iYZazEXFiQALBcbl/AEAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQneZdK7qqfO28msfq+y2OjYI+nk63UoHY4Rh5ifrYRj/CYV2uJF7K49gPRu3E1f6ORbfNCk This enables I2C support on smdk5250. Pinmux setting moved to board file to avoid repeated setting of gpio lines. Signed-off-by: Alim Akhtar Signed-off-by: Doug Anderson Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass --- Changes in V2: - None Changes in V3: - None Changes in V4: - None Changes in V5: - Pinmux setting of gpio lines moved to board_early_init_f. Changes in V6: - EXYNOS_I2C_SPACING moved to cpu.h - board_i2c_init compiled only when CONFIG_DRIVER_S3C24X0_I2C is defined. Changes in V7: - board_i2c_init compiled only when CONFIG_SYS_I2C_INIT_BOARD is defined. board/samsung/smdk5250/smdk5250.c | 30 +++++++++++++++++++++++++++++- include/configs/smdk5250.h | 10 ++++++++++ 2 files changed, 39 insertions(+), 1 deletions(-) diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c index b593325..a5816e4 100644 --- a/board/samsung/smdk5250/smdk5250.c +++ b/board/samsung/smdk5250/smdk5250.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -172,9 +173,36 @@ static int board_uart_init(void) return 0; } +#ifdef CONFIG_SYS_I2C_INIT_BOARD +static int board_i2c_init(void) +{ + int i, err; + + for (i = 0; i < CONFIG_MAX_I2C_NUM; i++) { + err = exynos_pinmux_config((PERIPH_ID_I2C0 + i), + PINMUX_FLAG_NONE); + if (err) { + debug("I2C%d not configured\n", (PERIPH_ID_I2C0 + i)); + return err; + } + } + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + return 0; +} +#endif + #ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f(void) { - return board_uart_init(); + int err; + err = board_uart_init(); + if (err) { + debug("UART init failed\n"); + return err; + } +#ifdef CONFIG_SYS_I2C_INIT_BOARD + err = board_i2c_init(); +#endif + return err; } #endif diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h index c0eaaf8..27dab76 100644 --- a/include/configs/smdk5250.h +++ b/include/configs/smdk5250.h @@ -198,6 +198,16 @@ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - 0x1000000) +/* I2C */ +#define CONFIG_SYS_I2C_INIT_BOARD +#define CONFIG_HARD_I2C +#define CONFIG_CMD_I2C +#define CONFIG_SYS_I2C_SPEED 100000 /* 100 Kbps */ +#define CONFIG_DRIVER_S3C24X0_I2C +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_MAX_I2C_NUM 8 +#define CONFIG_SYS_I2C_SLAVE 0x0 + /* Ethernet Controllor Driver */ #ifdef CONFIG_CMD_NET #define CONFIG_SMC911X