From patchwork Wed Jan 4 10:36:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 89804 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8424891qgi; Wed, 4 Jan 2017 02:36:53 -0800 (PST) X-Received: by 10.84.129.35 with SMTP id 32mr145596012plb.179.1483526213085; Wed, 04 Jan 2017 02:36:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si44556003plj.268.2017.01.04.02.36.52; Wed, 04 Jan 2017 02:36:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934801AbdADKgZ (ORCPT + 25 others); Wed, 4 Jan 2017 05:36:25 -0500 Received: from mail-wj0-f178.google.com ([209.85.210.178]:35157 "EHLO mail-wj0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932179AbdADKgU (ORCPT ); Wed, 4 Jan 2017 05:36:20 -0500 Received: by mail-wj0-f178.google.com with SMTP id i20so6638191wjn.2 for ; Wed, 04 Jan 2017 02:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6AZOwbVaJrsgpB4uQPY44D9cg6pz1P2SgtnRGKv4qKc=; b=fzoSL8IbFg8UyAIgaz2qQkU8lszVVZq2ipbqTSQNYAq3sNaiOK1/KMorac0ole4sF4 cPEUEyPD56TvVo+XhTldLqqTkSS6EdXvQFkKQATT/jicS0J84zFHuLb3DuKO7Yi+02qm 8FNioVwX9B8Q3UdF66+BPRHakEPhatJyRF+IjQyUxiMlKh+24czku9dMtRaXNdei9FtQ R5C8Wd5RlKRsEWsKSB4A+zgidi+XiUGgbgJr/urJSW/PoaAzUggxaSxVaJ4P2r2ZuP+f zsVAkEmu5jmvH84pr4n1y+VnGeALS2ZHqFa1xRB4iags9aqtQ16apq0D6WDsmejdO/as D69Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6AZOwbVaJrsgpB4uQPY44D9cg6pz1P2SgtnRGKv4qKc=; b=go3x6UE5Uehy9OqP5gzj0xtL5TdI+RTteHxsXnK7Xn1vFEffRbco+AAqEjZQeXW1LG +yHtp6ddsosIeXlJ/u7iQeoSuVc+ne5s9BMYimtlGLBQqJxGEubNog3M/rcRTYNgzVua NKQTHNRJzC+FRRUtySb+MamkPaTOFBu0+Vqxf8/j9lobiI75SyM4LrbB1m05cVq9Lkrn osC//b5C5+ahF9biqBpIijcM3MJhENHjPpPvouPPjNShmdxSKRJzHn0vxuMtPW7E/yhS cQAlBj96rx40YRHwiMfFHChWsKNGU9SW5IyORZ9Gv4Jy/AZ7GDQR1AU/DOajKMUe67MA +K2w== X-Gm-Message-State: AIkVDXKzQm6Dpm5ZKZDzJ9mv66KVMVwTQAkCzGGMMQQO7MBzXfTELvYvqQupoQ8zPLPPiLWd X-Received: by 10.194.66.101 with SMTP id e5mr54492146wjt.172.1483526178683; Wed, 04 Jan 2017 02:36:18 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k11sm93887812wmf.24.2017.01.04.02.36.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jan 2017 02:36:18 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Santosh Shilimkar Cc: arm-soc , LKML , Bartosz Golaszewski Subject: [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data Date: Wed, 4 Jan 2017 11:36:06 +0100 Message-Id: <1483526167-24209-2-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1483526167-24209-1-git-send-email-bgolaszewski@baylibre.com> References: <1483526167-24209-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org TI aemif driver creates its own subnodes of the device tree in order to guarantee that all child devices are probed after the AEMIF timing parameters are configured. Some devices (e.g. da850) use struct of_dev_auxdata for clock lookup but nodes created from within the aemif driver can't access the lookup table. Create a platform data structure that holds a pointer to of_dev_auxdata so that we can use it with of_platform_populate(). Signed-off-by: Bartosz Golaszewski --- drivers/memory/ti-aemif.c | 8 +++++++- include/linux/platform_data/ti-aemif.h | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 include/linux/platform_data/ti-aemif.h -- 2.9.3 Acked-by: Sekhar Nori diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index a579a0f..22c1aee 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -20,6 +20,7 @@ #include #include #include +#include #define TA_SHIFT 2 #define RHOLD_SHIFT 4 @@ -335,6 +336,8 @@ static int aemif_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct device_node *child_np; struct aemif_device *aemif; + struct aemif_platform_data *pdata; + struct of_dev_auxdata *dev_lookup; if (np == NULL) return 0; @@ -343,6 +346,9 @@ static int aemif_probe(struct platform_device *pdev) if (!aemif) return -ENOMEM; + pdata = dev_get_platdata(&pdev->dev); + dev_lookup = pdata ? pdata->dev_lookup : NULL; + platform_set_drvdata(pdev, aemif); aemif->clk = devm_clk_get(dev, NULL); @@ -390,7 +396,7 @@ static int aemif_probe(struct platform_device *pdev) * parameters are set. */ for_each_available_child_of_node(np, child_np) { - ret = of_platform_populate(child_np, NULL, NULL, dev); + ret = of_platform_populate(child_np, NULL, dev_lookup, dev); if (ret < 0) goto error; } diff --git a/include/linux/platform_data/ti-aemif.h b/include/linux/platform_data/ti-aemif.h new file mode 100644 index 0000000..ac72e11 --- /dev/null +++ b/include/linux/platform_data/ti-aemif.h @@ -0,0 +1,23 @@ +/* + * TI DaVinci AEMIF platform glue. + * + * Copyright (C) 2017 BayLibre SAS + * + * Author: + * Bartosz Golaszewski + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __TI_DAVINCI_AEMIF_DATA_H__ +#define __TI_DAVINCI_AEMIF_DATA_H__ + +#include + +struct aemif_platform_data { + struct of_dev_auxdata *dev_lookup; +}; + +#endif /* __TI_DAVINCI_AEMIF_DATA_H__ */