* [PATCH 2/4] spi: tegra sflash: assume CONFIG_OF, remove platform data
[not found] ` <1360965830-19795-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
@ 2013-02-15 22:03 ` Stephen Warren
2013-02-15 22:03 ` [PATCH 3/4] spi: tegra slink: " Stephen Warren
2013-02-15 22:03 ` [PATCH 4/4] spi: remove unused Tegra platform data header Stephen Warren
2 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2013-02-15 22:03 UTC (permalink / raw)
To: Grant Likely, Mark Brown, Laxman Dewangan
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Tegra only supports, and always enables, device tree. Remove all ifdefs
and runtime checks for DT support from the driver. Platform data is
therefore no longer required. Rework the driver to parse the device tree
directly into struct tegra_sflash_data.
Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-tegra20-sflash.c | 41 +++++++++-----------------------------
1 file changed, 9 insertions(+), 32 deletions(-)
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
index 3d6a12b..d65c000 100644
--- a/drivers/spi/spi-tegra20-sflash.c
+++ b/drivers/spi/spi-tegra20-sflash.c
@@ -33,7 +33,6 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
-#include <linux/spi/spi-tegra.h>
#include <linux/clk/tegra.h>
#define SPI_COMMAND 0x000
@@ -439,23 +438,13 @@ static irqreturn_t tegra_sflash_isr(int irq, void *context_data)
return handle_cpu_based_xfer(tsd);
}
-static struct tegra_spi_platform_data *tegra_sflash_parse_dt(
- struct platform_device *pdev)
+static void tegra_sflash_parse_dt(struct tegra_sflash_data *tsd)
{
- struct tegra_spi_platform_data *pdata;
- struct device_node *np = pdev->dev.of_node;
- u32 max_freq;
-
- pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- dev_err(&pdev->dev, "Memory alloc for pdata failed\n");
- return NULL;
- }
-
- if (!of_property_read_u32(np, "spi-max-frequency", &max_freq))
- pdata->spi_max_frequency = max_freq;
+ struct device_node *np = tsd->dev->of_node;
- return pdata;
+ if (of_property_read_u32(np, "spi-max-frequency",
+ &tsd->spi_max_frequency))
+ tsd->spi_max_frequency = 25000000; /* 25MHz */
}
static struct of_device_id tegra_sflash_of_match[] = {
@@ -469,28 +458,15 @@ static int tegra_sflash_probe(struct platform_device *pdev)
struct spi_master *master;
struct tegra_sflash_data *tsd;
struct resource *r;
- struct tegra_spi_platform_data *pdata = pdev->dev.platform_data;
int ret;
const struct of_device_id *match;
- match = of_match_device(of_match_ptr(tegra_sflash_of_match),
- &pdev->dev);
+ match = of_match_device(tegra_sflash_of_match, &pdev->dev);
if (!match) {
dev_err(&pdev->dev, "Error: No device match found\n");
return -ENODEV;
}
- if (!pdata && pdev->dev.of_node)
- pdata = tegra_sflash_parse_dt(pdev);
-
- if (!pdata) {
- dev_err(&pdev->dev, "No platform data, exiting\n");
- return -ENODEV;
- }
-
- if (!pdata->spi_max_frequency)
- pdata->spi_max_frequency = 25000000; /* 25MHz */
-
master = spi_alloc_master(&pdev->dev, sizeof(*tsd));
if (!master) {
dev_err(&pdev->dev, "master allocation failed\n");
@@ -510,6 +486,8 @@ static int tegra_sflash_probe(struct platform_device *pdev)
tsd->dev = &pdev->dev;
spin_lock_init(&tsd->lock);
+ tegra_sflash_parse_dt(tsd);
+
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) {
dev_err(&pdev->dev, "No IO memory resource\n");
@@ -538,7 +516,6 @@ static int tegra_sflash_probe(struct platform_device *pdev)
goto exit_free_irq;
}
- tsd->spi_max_frequency = pdata->spi_max_frequency;
init_completion(&tsd->xfer_completion);
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
@@ -658,7 +635,7 @@ static struct platform_driver tegra_sflash_driver = {
.name = "spi-tegra-sflash",
.owner = THIS_MODULE,
.pm = &slink_pm_ops,
- .of_match_table = of_match_ptr(tegra_sflash_of_match),
+ .of_match_table = tegra_sflash_of_match,
},
.probe = tegra_sflash_probe,
.remove = tegra_sflash_remove,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] spi: tegra slink: assume CONFIG_OF, remove platform data
[not found] ` <1360965830-19795-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-15 22:03 ` [PATCH 2/4] spi: tegra sflash: assume CONFIG_OF, remove platform data Stephen Warren
@ 2013-02-15 22:03 ` Stephen Warren
2013-02-15 22:03 ` [PATCH 4/4] spi: remove unused Tegra platform data header Stephen Warren
2 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2013-02-15 22:03 UTC (permalink / raw)
To: Grant Likely, Mark Brown, Laxman Dewangan
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Tegra only supports, and always enables, device tree. Remove all ifdefs
and runtime checks for DT support from the driver. Platform data is
therefore no longer required. Rework the driver to parse the device tree
directly into struct tegra_slink_data.
Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-tegra20-slink.c | 45 ++++++++++-----------------------------
1 file changed, 11 insertions(+), 34 deletions(-)
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 00f1b06..6a15f63 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -34,7 +34,6 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
-#include <linux/spi/spi-tegra.h>
#include <linux/clk/tegra.h>
#define SLINK_COMMAND 0x000
@@ -1042,29 +1041,18 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data)
return IRQ_WAKE_THREAD;
}
-static struct tegra_spi_platform_data *tegra_slink_parse_dt(
- struct platform_device *pdev)
+static void tegra_slink_parse_dt(struct tegra_slink_data *tspi)
{
- struct tegra_spi_platform_data *pdata;
- const unsigned int *prop;
- struct device_node *np = pdev->dev.of_node;
+ struct device_node *np = tspi->dev->of_node;
u32 of_dma[2];
- pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- dev_err(&pdev->dev, "Memory alloc for pdata failed\n");
- return NULL;
- }
-
if (of_property_read_u32_array(np, "nvidia,dma-request-selector",
of_dma, 2) >= 0)
- pdata->dma_req_sel = of_dma[1];
+ tspi->dma_req_sel = of_dma[1];
- prop = of_get_property(np, "spi-max-frequency", NULL);
- if (prop)
- pdata->spi_max_frequency = be32_to_cpup(prop);
-
- return pdata;
+ if (of_property_read_u32(np, "spi-max-frequency",
+ &tspi->spi_max_frequency))
+ tspi->spi_max_frequency = 25000000; /* 25MHz */
}
const struct tegra_slink_chip_data tegra30_spi_cdata = {
@@ -1087,27 +1075,16 @@ static int tegra_slink_probe(struct platform_device *pdev)
struct spi_master *master;
struct tegra_slink_data *tspi;
struct resource *r;
- struct tegra_spi_platform_data *pdata = pdev->dev.platform_data;
int ret, spi_irq;
const struct tegra_slink_chip_data *cdata = NULL;
const struct of_device_id *match;
- match = of_match_device(of_match_ptr(tegra_slink_of_match), &pdev->dev);
+ match = of_match_device(tegra_slink_of_match, &pdev->dev);
if (!match) {
dev_err(&pdev->dev, "Error: No device match found\n");
return -ENODEV;
}
cdata = match->data;
- if (!pdata && pdev->dev.of_node)
- pdata = tegra_slink_parse_dt(pdev);
-
- if (!pdata) {
- dev_err(&pdev->dev, "No platform data, exiting\n");
- return -ENODEV;
- }
-
- if (!pdata->spi_max_frequency)
- pdata->spi_max_frequency = 25000000; /* 25MHz */
master = spi_alloc_master(&pdev->dev, sizeof(*tspi));
if (!master) {
@@ -1127,11 +1104,12 @@ static int tegra_slink_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, master);
tspi = spi_master_get_devdata(master);
tspi->master = master;
- tspi->dma_req_sel = pdata->dma_req_sel;
tspi->dev = &pdev->dev;
tspi->chip_data = cdata;
spin_lock_init(&tspi->lock);
+ tegra_slink_parse_dt(tspi);
+
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) {
dev_err(&pdev->dev, "No IO memory resource\n");
@@ -1165,9 +1143,8 @@ static int tegra_slink_probe(struct platform_device *pdev)
tspi->max_buf_size = SLINK_FIFO_DEPTH << 2;
tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN;
- tspi->spi_max_frequency = pdata->spi_max_frequency;
- if (pdata->dma_req_sel) {
+ if (tspi->dma_req_sel) {
ret = tegra_slink_init_dma_param(tspi, true);
if (ret < 0) {
dev_err(&pdev->dev, "RxDma Init failed, err %d\n", ret);
@@ -1310,7 +1287,7 @@ static struct platform_driver tegra_slink_driver = {
.name = "spi-tegra-slink",
.owner = THIS_MODULE,
.pm = &slink_pm_ops,
- .of_match_table = of_match_ptr(tegra_slink_of_match),
+ .of_match_table = tegra_slink_of_match,
},
.probe = tegra_slink_probe,
.remove = tegra_slink_remove,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] spi: remove unused Tegra platform data header
[not found] ` <1360965830-19795-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-15 22:03 ` [PATCH 2/4] spi: tegra sflash: assume CONFIG_OF, remove platform data Stephen Warren
2013-02-15 22:03 ` [PATCH 3/4] spi: tegra slink: " Stephen Warren
@ 2013-02-15 22:03 ` Stephen Warren
[not found] ` <1360965830-19795-4-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2 siblings, 1 reply; 8+ messages in thread
From: Stephen Warren @ 2013-02-15 22:03 UTC (permalink / raw)
To: Grant Likely, Mark Brown, Laxman Dewangan
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
The platform data header is no longer used. Delete it.
Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
include/linux/spi/spi-tegra.h | 40 ----------------------------------------
1 file changed, 40 deletions(-)
delete mode 100644 include/linux/spi/spi-tegra.h
diff --git a/include/linux/spi/spi-tegra.h b/include/linux/spi/spi-tegra.h
deleted file mode 100644
index 786932c..0000000
--- a/include/linux/spi/spi-tegra.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * spi-tegra.h: SPI interface for Nvidia Tegra20 SLINK controller.
- *
- * Copyright (C) 2011 NVIDIA Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _LINUX_SPI_TEGRA_H
-#define _LINUX_SPI_TEGRA_H
-
-struct tegra_spi_platform_data {
- int dma_req_sel;
- unsigned int spi_max_frequency;
-};
-
-/*
- * Controller data from device to pass some info like
- * hw based chip select can be used or not and if yes
- * then CS hold and setup time.
- */
-struct tegra_spi_device_controller_data {
- bool is_hw_based_cs;
- int cs_setup_clk_count;
- int cs_hold_clk_count;
-};
-
-#endif /* _LINUX_SPI_TEGRA_H */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread