From patchwork Wed Dec 5 12:51:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 13373 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 06DEE23FC0 for ; Wed, 5 Dec 2012 12:47:36 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 91D74A18464 for ; Wed, 5 Dec 2012 12:47:35 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so7771324ieb.11 for ; Wed, 05 Dec 2012 04:47:35 -0800 (PST) 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 :dlp-filter:x-mtr:x-brightmail-tracker:x-brightmail-tracker :x-cfilter-loop:x-gm-message-state; bh=+vbF6dp3uQZ7J1fx/n3wfkh75OjLjKIfyqYUBJfDjXw=; b=UhxC8SeukNQiW4hyTwETGKqZ2XoODdnoN7wKYNV7HCCN/jGJgNHuiZxAeVqlxKzKLw TrGDIs9ZfZ5PElkCdFQA1/yDlV3URWwLfZua0/UDwS2WDygvjWHyz/GdrqIn6L6xM6FK 9dxVrjXXoNkk7LR1SPSXnI8uEHQ0B/njbF1YtAQH2STpZxbsJ3fpSl9pjSzgkhfZuogh i/B9zXvy1bTkxIja7fMFutIsc7kwf3yQucviDmM2ZZn0OcGrca/VKkHn/CzV++KLCU+l X+C9tCvn90me+ttQjWLmcHrwNUBAwcGy51hkbAPHth8ge4kZtvcrWg5q9x5018r7D9M2 phug== Received: by 10.50.185.166 with SMTP id fd6mr1597801igc.62.1354711655047; Wed, 05 Dec 2012 04:47:35 -0800 (PST) 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.50.67.148 with SMTP id n20csp336878igt; Wed, 5 Dec 2012 04:47:34 -0800 (PST) Received: by 10.68.189.228 with SMTP id gl4mr49528012pbc.40.1354711654410; Wed, 05 Dec 2012 04:47:34 -0800 (PST) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id zz3si6831775pbc.271.2012.12.05.04.47.33; Wed, 05 Dec 2012 04:47:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEK00A6K675BG01@mailout1.samsung.com>; Wed, 05 Dec 2012 21:47:32 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 3A.6B.12699.4624FB05; Wed, 05 Dec 2012 21:47:32 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-6f-50bf4264b2ac Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D9.6B.12699.4624FB05; Wed, 05 Dec 2012 21:47:32 +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 <0MEK00CKF6300130@mmp1.samsung.com>; Wed, 05 Dec 2012 21:47:32 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org Subject: [PATCH 3/3 V2] PMIC: MAX77686: Add FDT Support Date: Wed, 05 Dec 2012 18:21:00 +0530 Message-id: <1354711860-10575-4-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1354711860-10575-1-git-send-email-rajeshwari.s@samsung.com> References: <1354711860-10575-1-git-send-email-rajeshwari.s@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsWyRsSkTjfFaX+AweO9uhYP199ksZhy+AuL A5PHnWt72AIYo7hsUlJzMstSi/TtErgynvStYSto4K248+g7awPjCa4uRk4OCQETiSeN3cwQ tpjEhXvr2UBsIYGljBLP+31gam42zGLsYuQCii9ilNjUuwLKmcgkcebqfRaQKjYBI4mtJ6cx gtgiAhISv/qvgtnMAjESr/f/AJrKwSEsYC6xcx8nSJhFQFXi5veZYMt4BTwkHu6cDnWEgsSx qV9ZQWxOAU+Jbz9fMUIc5CFxr/sGM0SvgMS3yYdYQEZKCMhKbDrADHKOhMBtNol1ffOYIOZI ShxccYNlAqPwAkaGVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxiBwXj63zPpHYyrGiwOMQpw MCrx8EoY7wsQYk0sK67MPcQowcGsJMI7T2Z/gBBvSmJlVWpRfnxRaU5q8SFGH6BLJjJLiSbn AyMlryTe0NjE3NTY1NLIyMzUFIewkjhvs0dKgJBAemJJanZqakFqEcw4Jg5OqQbGrU+dzyr0 2VoKPw1slor91LWhOiOn7MaDjZ/P/Ttk9e7cSqvZs2r3B31awG8019T/hIJjt5XHfu1djl2d z0oYX53a6+o5N7379of5e5huRnVH5is/kJhZwDsh6+yFxbtywvOVToj9XagWEMTeMul8VzLz Ki/utb3iE5lW9GVmO8t3pc/ktLZWYinOSDTUYi4qTgQAn+++tHMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsVy+t9jAd0Up/0BBkd/K1g8XH+TxWLK4S8s Dkwed67tYQtgjGpgtMlITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLx CdB1y8wBmq2kUJaYUwoUCkgsLlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzHjSt4atoIG3 4s6j76wNjCe4uhg5OSQETCRuNsxihLDFJC7cW8/WxcjFISSwiFFiU+8KRghnIpPEmav3WUCq 2ASMJLaenAbWISIgIfGr/yqYzSwQI/F6/w+gbg4OYQFziZ37OEHCLAKqEje/z2QDsXkFPCQe 7pzODLFMQeLY1K+sIDangKfEt5+vwMYIAdXc677BPIGRdwEjwypG0dSC5ILipPRcI73ixNzi 0rx0veT83E2M4GB/Jr2DcVWDxSFGAQ5GJR5eCeN9AUKsiWXFlbmHGCU4mJVEeOfJ7A8Q4k1J rKxKLcqPLyrNSS0+xOgDdNVEZinR5HxgJOaVxBsam5ibGptamliYmFniEFYS5232SAkQEkhP LEnNTk0tSC2CGcfEwSnVwKhWxhd+/pHpV8GudzsLw6sSXJ/WhcT8mlMoNzcxN+Fbo8eyeSvk nl0NiW/uKyqR/Mq0xbXqZH+2o9ykq1aLP81Y/LA42uHXaqbtDBp33DXq1wlnfntW48TGleDJ fzNtw4sTH27+y10hf8zXcvt2M9UlJ3tmqj147SX6KevA7pdSNsnlHgz8IkosxRmJhlrMRcWJ AIQdsmCjAgAA X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQmVI+u05El3QYjZP8Zt7pED6I9rlArKRpinUaCF3UUT1F9tyhIsfeIJktvGbkdkpDIOXYYY This patch adds fdt support to MAX77686. Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass --- Changes in V2: - Corrected indentation errors. drivers/misc/pmic_max77686.c | 35 ++++++++++++++++++++++++++++++----- 1 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/misc/pmic_max77686.c b/drivers/misc/pmic_max77686.c index 36f7f4d..a370d35 100644 --- a/drivers/misc/pmic_max77686.c +++ b/drivers/misc/pmic_max77686.c @@ -22,21 +22,46 @@ */ #include +#include +#include #include #include +DECLARE_GLOBAL_DATA_PTR; + int pmic_init(void) { struct pmic *p = get_pmic(); static const char name[] = "MAX77686_PMIC"; - puts("Board PMIC init\n"); +#ifdef CONFIG_OF_CONTROL + const void *blob = gd->fdt_blob; + int node, parent; + + node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC); + if (node < 0) { + debug("PMIC: No node for PMIC Chip in device tree\n"); + debug("node = %d\n", node); + return -1; + } + + parent = fdt_parent_offset(blob, node); + if (parent < 0) { + debug("%s: Cannot find node parent\n", __func__); + return -1; + } + + p->bus = i2c_get_bus_num_fdt(parent); + p->hw.i2c.addr = fdtdec_get_int(blob, node, "reg", 0); +#else + p->bus = I2C_PMIC; + p->hw.i2c.addr = MAX77686_I2C_ADDR; +#endif + p->name = name; + p->hw.i2c.tx_num = 1; p->interface = PMIC_I2C; p->number_of_regs = PMIC_NUM_OF_REGS; - p->hw.i2c.addr = MAX77686_I2C_ADDR; - p->hw.i2c.tx_num = 1; - p->bus = I2C_PMIC; - + puts("Board PMIC init MAX77686\n"); return 0; }