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: 91295 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp111815qgi; Fri, 13 Jan 2017 02:01:06 -0800 (PST) X-Received: by 10.98.141.194 with SMTP id p63mr5826813pfk.185.1484301666198; Fri, 13 Jan 2017 02:01:06 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si12241220pgc.88.2017.01.13.02.01.05; Fri, 13 Jan 2017 02:01:06 -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 S1751442AbdAMKBE (ORCPT + 25 others); Fri, 13 Jan 2017 05:01:04 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37156 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751343AbdAMKAs (ORCPT ); Fri, 13 Jan 2017 05:00:48 -0500 Received: by mail-wm0-f42.google.com with SMTP id c206so63471964wme.0 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=Nesvz8h3sTpJh66uBBglZB+KIA+T6WlXuciurk2z94un/6SH3lvs42AIGCmq+PYE1+ CW+77dExD6B2xMeEWMYQa7/qnqSGCzsKNeNTWfPYWPP5x2fEcANtpWHT6laEfpuPOId4 ri+u5q74gkB11kuxH2vYaKXxj4QImoX73kWyNJbXWdIdjgqSV105jSgfcjelCAPOjF/h QHRPgAyDFYJIY5mJlthzlfTi2MLnOO1DG5kadrArLGax6SQLkxGMQWYCMmagEursAUHA af9TmzBMhiyK1PpcGObQAC0YDxFl3/d/wB6xHoos3zc+AdxH1LlyCbut1eCpzWfsAJKa DRyg== X-Gm-Message-State: AIkVDXLBcqsUvF6SfV3UpKz/L8z3br+v7KEvrJPJ4Ft3DHNZVMz8W0Wg8BvBYqIWHcrYzzR9 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 Cc: LKML , arm-soc , Bartosz Golaszewski 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> 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 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 -- 2.9.3 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__ */