From patchwork Wed Jun 8 02:47:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 631949 X-Patchwork-Delegate: sjg@chromium.org 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 3rPY676DWBz9sBf for ; Wed, 8 Jun 2016 12:58:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=G1FLEb4m; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 727CFA755F; Wed, 8 Jun 2016 04:58:22 +0200 (CEST) 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 2FnlAYJhcYDb; Wed, 8 Jun 2016 04:58:22 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B24D8A754E; Wed, 8 Jun 2016 04:58:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 99A56A7527 for ; Wed, 8 Jun 2016 04:58:18 +0200 (CEST) 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 0TNOxQibNfXk for ; Wed, 8 Jun 2016 04:58:18 +0200 (CEST) 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 mail-io0-f175.google.com (mail-io0-f175.google.com [209.85.223.175]) by theia.denx.de (Postfix) with ESMTPS id 2E305A74D2 for ; Wed, 8 Jun 2016 04:58:14 +0200 (CEST) Received: by mail-io0-f175.google.com with SMTP id m62so6312264iof.0 for ; Tue, 07 Jun 2016 19:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=frfGf+NsakDXfyB7Mno9E0TdGbcC6bMLAZmQaosYJoQ=; b=G1FLEb4mLfBwwINiSbvvR7KUQDdGtqvUJSy97k2PY1wzMEVbMckF4Pmh7ahD6NCNlr kvjxZZGNc28d/Av/hiRKdn95Mv2v5UUWxI7DesapcCQHOgX4OtmIZBHtoQvkgfZYCh4E 0stjmDIAv3Gj5b1PRJJICzYRVEH10aoC6CKl4cRRmzptVN1QSu586IBbCZtGf4TpAzFs gc7mTz5kr7GitNtSOmWIzztK3QV5TwN4Oc5PeFudAOa7FW0BvENQ641s1Wpc+n2qTY5j oLFIPIfM7vFVhanh1PcjO8KuBeraGccNQfrDPavndjw9gDK3xjMybW5dWX3YU5e4qL7N 09kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=frfGf+NsakDXfyB7Mno9E0TdGbcC6bMLAZmQaosYJoQ=; b=eIKc7BHTQzBqnlPHJ+P41J3Up7CjHw8/Z8HZ3nzj3nochXvy1Zt2QXqjRwJ7cCi2RK 54Qjt93/kb4QB6+UauEomOmt0MzRQROFXaFczWrqWq+keR/E9Mo66OuYKBJ1RfCxCrtf +vvrmjBy4cXtLhwvQQFnasHiqY288CN+jBWMhNxQgoHL0zzzfl0HHOx1cTha5aFSWYhN Y3K1Cxwq+LgyTbFpf+F2uf60EEZUdbrL0NqgrnaEcqquTPGd/WQogwrGIxv8zEAdolm7 jnzhy9omSckEJryb9Ey4Dz9xMnCYycdkDSL7k/tdYlbL1LK/u8N3PbYaqLoeFhMRk3JO dsHg== X-Gm-Message-State: ALyK8tL5OJiY4p+Qm3ZiNsx2zuvv5fbOLZYYSz7oBXlfj2+PSEbM490+3/mlMovxceR4MMQl X-Received: by 10.107.174.28 with SMTP id x28mr4635368ioe.76.1465354693571; Tue, 07 Jun 2016 19:58:13 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.202.57]) by smtp.gmail.com with ESMTPSA id a186sm10060408ith.14.2016.06.07.19.58.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jun 2016 19:58:12 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 76B1E223F2A; Tue, 7 Jun 2016 20:48:25 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 7 Jun 2016 20:47:58 -0600 Message-Id: <1465354089-3508-21-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1465354089-3508-1-git-send-email-sjg@chromium.org> References: <1465354089-3508-1-git-send-email-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 20/31] dm: syscon: Add support for of-platdata X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Provide a new function which can cope with obtaining information from of-platdata instead of the device tree. Signed-off-by: Simon Glass --- drivers/core/syscon-uclass.c | 13 +++++++++++++ include/syscon.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c index e03f46a..01bd968 100644 --- a/drivers/core/syscon-uclass.c +++ b/drivers/core/syscon-uclass.c @@ -29,7 +29,20 @@ static int syscon_pre_probe(struct udevice *dev) { struct syscon_uc_info *priv = dev_get_uclass_priv(dev); + /* + * With OF_PLATDATA we really have no way of knowing the format of + * the device-specific platform data. So we assume that it starts with + * a 'reg' member, and this holds a single address and size. Drivers + * using OF_PLATDATA will need to ensure that this is true. + */ +#if CONFIG_IS_ENABLED(OF_PLATDATA) + struct syscon_base_platdata *plat = dev_get_platdata(dev); + + return regmap_init_mem_platdata(dev, plat->reg, ARRAY_SIZE(plat->reg), + &priv->regmap); +#else return regmap_init_mem(dev, &priv->regmap); +#endif } int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp) diff --git a/include/syscon.h b/include/syscon.h index 4593b6e..19c66b3 100644 --- a/include/syscon.h +++ b/include/syscon.h @@ -23,6 +23,12 @@ struct syscon_ops { #define syscon_get_ops(dev) ((struct syscon_ops *)(dev)->driver->ops) +#if CONFIG_IS_ENABLED(OF_PLATDATA) +struct syscon_base_platdata { + u32 reg[2]; +}; +#endif + /** * syscon_get_regmap() - Get access to a register map *