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: 9497911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 561AC60237 for ; Wed, 4 Jan 2017 21:45:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55FCD26E8A for ; Wed, 4 Jan 2017 21:45:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AE0827D8D; Wed, 4 Jan 2017 21:45:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 783FA26E8A for ; Wed, 4 Jan 2017 21:45:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cOtLU-0002e7-I0; Wed, 04 Jan 2017 21:43:44 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cOsqx-00062J-G2 for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Jan 2017 21:12:11 +0000 Received: from mail-wj0-x231.google.com ([2a00:1450:400c:c01::231]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cOivw-00072U-OV for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2017 10:36:42 +0000 Received: by mail-wj0-x231.google.com with SMTP id tn15so7092711wjb.1 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=hzuf4FCNsrJdGWGImWdVp0iH2bmkJZqwEfop8osaLvfjjtGWiWxAFssP5BhBDpjVxA b09d3vwyWyyAD1qBLMW5wPDCGrHytHLCOttFLC0NQMMjqynr8di/MXi5BDqn5AGmy3V1 IRBDok9BSP62lGhM58rYv2hHJy1T9PPEvsOTI4r8n6nU+QlJSyspYVV2oD7/G5kukseX CxIWvoiiysu+sG52qzDG8ZMk6zxafo41A0JttkWmHPfTX4M3KECFa67sowfN1O/iWXl8 0sdznjMTzRNzusvr+HPFeBuMbOsvybAf2MOuLEoE5s7Ec4ShPpBK8LzFAORR4UDl1ZUA mw2g== X-Gm-Message-State: AIkVDXLk6yNIEIdjk0iG8Q0uM4uh6G3w0HUHHMbBbcUu3aA2CCs0Od3+kyXPTj7sLOspBdOn 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170104_103640_838875_C66DC4FC X-CRM114-Status: GOOD ( 21.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , LKML , arm-soc MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Sekhar Nori --- 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 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__ */