From patchwork Fri Jan 13 10:00:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9514957 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 061E460762 for ; Fri, 13 Jan 2017 10:01:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED3C7285FD for ; Fri, 13 Jan 2017 10:01:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1CB028606; Fri, 13 Jan 2017 10:01: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 97016285FD for ; Fri, 13 Jan 2017 10:01:09 +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 1cRyfS-0003RQ-Qm; Fri, 13 Jan 2017 10:01:06 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRyfO-0003OO-2S for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2017 10:01:04 +0000 Received: by mail-wm0-x22d.google.com with SMTP id r144so63302139wme.1 for ; Fri, 13 Jan 2017 02:00:41 -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=Iz58hA4z59sQ7lpk8t9C7RsqFpGtNogpmIyGc9Y4gp4=; b=FVEgPLbtkErJCnTETaBdH/6+gQ/BIXuunvobxU/Lg85J9mpIeGqlMh0kQo0MpDRIml C01PyMrFxNRh58utIbywKSIfd8V+qTqU1WQcY71bgnKP2mF/wwYGcj/Q/J1v0wFyRBKe ySjzN/kvjcZlFSRUoRc1su7Q0TRsw5lfEcwLeBe4MFH5IzWkZiv3pwq4XWk25FPaNYun /I8BI0850kVcMBUqzK15PEwpcwhpSAojPCejK5l/39Te/AgEDUCbQLxmNmiEttr2eX0i Xm4UDri+H7oWgCEyWU7EgOCYRe7TRojouUag0pLlWNCIWjTwDO4qzhi60CQk+JWh2B6C /K0Q== 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=Iz58hA4z59sQ7lpk8t9C7RsqFpGtNogpmIyGc9Y4gp4=; b=qyKaA91yfF8Ne8Rjx3S4uTTa5ODtqIIqCrWmGfPOkkAMkaRiCjYiSjtbicS7NRDHiP QrgDsUfGVpO2t284aplwYLVnqp1B7pD5AHNVJg+hzgPAEq2KjS+P2+XDjuFtBEQq2YAO Q99xKjHD7rFMCrthgQFSyh53muKH7rpgSWWZquH5WqjeZNImbo+aKtIR/ZE8WptNfGjZ jVXDZ7qktVL+qI6FcbFOvN0pvp9Crs4v4juXoNP9OLxhlJJChGW1YsOLxZA29xSZ3Gv5 P/2Dm+/P+EZ55nFYUW/cvM1B8BY0Mh1MAhK+8lQOAomby+sN+bvuyb/gtWXac6sGNnDA d0Ng== X-Gm-Message-State: AIkVDXKT7j/SpptOAWdoCjc9RotPstLu/nbLdlbeEft5GktXqiG+DpEDmObAeHgVgsFtLz5g X-Received: by 10.223.139.94 with SMTP id v30mr10828564wra.35.1484301640619; Fri, 13 Jan 2017 02:00:40 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id y145sm3138842wmc.17.2017.01.13.02.00.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jan 2017 02:00:40 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Santosh Shilimkar , Greg Kroah-Hartman Subject: [PATCH RESEND 1/2] memory: aemif: allow passing device lookup table as platform data Date: Fri, 13 Jan 2017 11:00:25 +0100 Message-Id: <1484301626-30345-2-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1484301626-30345-1-git-send-email-bgolaszewski@baylibre.com> References: <1484301626-30345-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170113_020102_268592_5B1EB824 X-CRM114-Status: GOOD ( 17.65 ) 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 Acked-by: Santosh Shilimkar --- 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__ */