* [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz
@ 2014-02-10 13:48 Axel Lin
2014-02-10 13:49 ` [PATCH 2/3] spi: tegra20-sflash: " Axel Lin
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Axel Lin @ 2014-02-10 13:48 UTC (permalink / raw)
To: Mark Brown
Cc: Laxman Dewangan, Stephen Warren, Thierry Reding,
linux-spi-u79uwXL29TY76Z2rM5mHXA
Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
handle checking transfer speed.
In additional, since commit 052eb2d49006 'spi: core: Set max_speed_hz of
spi_device default to max_speed_hz of controller',
spi core will also set default spi->max_speed_hz if it is not set.
So remove the duplicate code in tegra_spi_setup.
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-tegra114.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
index 0930d60..2f8aba5 100644
--- a/drivers/spi/spi-tegra114.c
+++ b/drivers/spi/spi-tegra114.c
@@ -171,7 +171,6 @@ struct tegra_spi_data {
void __iomem *base;
phys_addr_t phys;
unsigned irq;
- u32 spi_max_frequency;
u32 cur_speed;
struct spi_device *cur_spi;
@@ -762,9 +761,6 @@ static int tegra_spi_setup(struct spi_device *spi)
BUG_ON(spi->chip_select >= MAX_CHIP_SELECT);
- /* Set speed to the spi max fequency if spi device has not set */
- spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency;
-
ret = pm_runtime_get_sync(tspi->dev);
if (ret < 0) {
dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
@@ -1018,16 +1014,6 @@ static irqreturn_t tegra_spi_isr(int irq, void *context_data)
return IRQ_WAKE_THREAD;
}
-static void tegra_spi_parse_dt(struct platform_device *pdev,
- struct tegra_spi_data *tspi)
-{
- struct device_node *np = pdev->dev.of_node;
-
- if (of_property_read_u32(np, "spi-max-frequency",
- &tspi->spi_max_frequency))
- tspi->spi_max_frequency = 25000000; /* 25MHz */
-}
-
static struct of_device_id tegra_spi_of_match[] = {
{ .compatible = "nvidia,tegra114-spi", },
{}
@@ -1049,8 +1035,9 @@ static int tegra_spi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, master);
tspi = spi_master_get_devdata(master);
- /* Parse DT */
- tegra_spi_parse_dt(pdev, tspi);
+ if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency",
+ &master->max_speed_hz))
+ master->max_speed_hz = 25000000; /* 25MHz */
/* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] spi: tegra20-sflash: Convert to use master->max_speed_hz
2014-02-10 13:48 [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz Axel Lin
@ 2014-02-10 13:49 ` Axel Lin
2014-02-10 13:51 ` [PATCH 3/3] spi: tegra20-slink: " Axel Lin
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Axel Lin @ 2014-02-10 13:49 UTC (permalink / raw)
To: Mark Brown
Cc: Laxman Dewangan, Stephen Warren, Thierry Reding,
linux-spi-u79uwXL29TY76Z2rM5mHXA
Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
handle checking transfer speed.
In additional, since commit 052eb2d49006 'spi: core: Set max_speed_hz of
spi_device default to max_speed_hz of controller',
spi core will also set default spi->max_speed_hz if it is not set.
So remove tegra_sflash_setup().
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-tegra20-sflash.c | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
index 18037ab..5db73c0 100644
--- a/drivers/spi/spi-tegra20-sflash.c
+++ b/drivers/spi/spi-tegra20-sflash.c
@@ -120,7 +120,6 @@ struct tegra_sflash_data {
struct reset_control *rst;
void __iomem *base;
unsigned irq;
- u32 spi_max_frequency;
u32 cur_speed;
struct spi_device *cur_spi;
@@ -314,15 +313,6 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi,
return tegra_sflash_start_cpu_based_transfer(tsd, t);
}
-static int tegra_sflash_setup(struct spi_device *spi)
-{
- struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master);
-
- /* Set speed to the spi max fequency if spi device has not set */
- spi->max_speed_hz = spi->max_speed_hz ? : tsd->spi_max_frequency;
- return 0;
-}
-
static int tegra_sflash_transfer_one_message(struct spi_master *master,
struct spi_message *msg)
{
@@ -429,15 +419,6 @@ static irqreturn_t tegra_sflash_isr(int irq, void *context_data)
return handle_cpu_based_xfer(tsd);
}
-static void tegra_sflash_parse_dt(struct tegra_sflash_data *tsd)
-{
- struct device_node *np = tsd->dev->of_node;
-
- 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[] = {
{ .compatible = "nvidia,tegra20-sflash", },
{}
@@ -466,7 +447,6 @@ static int tegra_sflash_probe(struct platform_device *pdev)
/* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA;
- master->setup = tegra_sflash_setup;
master->transfer_one_message = tegra_sflash_transfer_one_message;
master->auto_runtime_pm = true;
master->num_chipselect = MAX_CHIP_SELECT;
@@ -478,7 +458,9 @@ static int tegra_sflash_probe(struct platform_device *pdev)
tsd->dev = &pdev->dev;
spin_lock_init(&tsd->lock);
- tegra_sflash_parse_dt(tsd);
+ if (of_property_read_u32(tsd->dev->of_node, "spi-max-frequency",
+ &master->max_speed_hz))
+ master->max_speed_hz = 25000000; /* 25MHz */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
tsd->base = devm_ioremap_resource(&pdev->dev, r);
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] spi: tegra20-slink: Convert to use master->max_speed_hz
2014-02-10 13:48 [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz Axel Lin
2014-02-10 13:49 ` [PATCH 2/3] spi: tegra20-sflash: " Axel Lin
@ 2014-02-10 13:51 ` Axel Lin
2014-02-10 16:53 ` [PATCH 1/3] spi: tegra114: " Stephen Warren
2014-02-11 12:09 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Axel Lin @ 2014-02-10 13:51 UTC (permalink / raw)
To: Mark Brown
Cc: Laxman Dewangan, Stephen Warren, Thierry Reding,
linux-spi-u79uwXL29TY76Z2rM5mHXA
Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
handle checking transfer speed.
In additional, since commit 052eb2d49006 'spi: core: Set max_speed_hz of
spi_device default to max_speed_hz of controller',
spi core will also set default spi->max_speed_hz if it is not set.
So remove the duplicate code in tegra_slink_setup.
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-tegra20-slink.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 8d62710..9a060aa 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -170,7 +170,6 @@ struct tegra_slink_data {
void __iomem *base;
phys_addr_t phys;
unsigned irq;
- u32 spi_max_frequency;
u32 cur_speed;
struct spi_device *cur_spi;
@@ -762,8 +761,6 @@ static int tegra_slink_setup(struct spi_device *spi)
BUG_ON(spi->chip_select >= MAX_CHIP_SELECT);
- /* Set speed to the spi max fequency if spi device has not set */
- spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency;
ret = pm_runtime_get_sync(tspi->dev);
if (ret < 0) {
dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
@@ -998,15 +995,6 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data)
return IRQ_WAKE_THREAD;
}
-static void tegra_slink_parse_dt(struct tegra_slink_data *tspi)
-{
- struct device_node *np = tspi->dev->of_node;
-
- if (of_property_read_u32(np, "spi-max-frequency",
- &tspi->spi_max_frequency))
- tspi->spi_max_frequency = 25000000; /* 25MHz */
-}
-
static const struct tegra_slink_chip_data tegra30_spi_cdata = {
.cs_hold_time = true,
};
@@ -1061,7 +1049,9 @@ static int tegra_slink_probe(struct platform_device *pdev)
tspi->chip_data = cdata;
spin_lock_init(&tspi->lock);
- tegra_slink_parse_dt(tspi);
+ if (of_property_read_u32(tspi->dev->of_node, "spi-max-frequency",
+ &master->max_speed_hz))
+ master->max_speed_hz = 25000000; /* 25MHz */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) {
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz
2014-02-10 13:48 [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz Axel Lin
2014-02-10 13:49 ` [PATCH 2/3] spi: tegra20-sflash: " Axel Lin
2014-02-10 13:51 ` [PATCH 3/3] spi: tegra20-slink: " Axel Lin
@ 2014-02-10 16:53 ` Stephen Warren
[not found] ` <52F903EF.4030606-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-02-11 12:09 ` Mark Brown
3 siblings, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2014-02-10 16:53 UTC (permalink / raw)
To: Axel Lin, Mark Brown
Cc: Laxman Dewangan, Thierry Reding, linux-spi-u79uwXL29TY76Z2rM5mHXA
On 02/10/2014 06:48 AM, Axel Lin wrote:
> Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
> handle checking transfer speed.
>
> In additional, since commit 052eb2d49006 'spi: core: Set max_speed_hz of
> spi_device default to max_speed_hz of controller',
> spi core will also set default spi->max_speed_hz if it is not set.
> So remove the duplicate code in tegra_spi_setup.
The series,
Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
I wonder ...
> diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
> @@ -1049,8 +1035,9 @@ static int tegra_spi_probe(struct platform_device *pdev)
> - /* Parse DT */
> - tegra_spi_parse_dt(pdev, tspi);
> + if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency",
> + &master->max_speed_hz))
> + master->max_speed_hz = 25000000; /* 25MHz */
... if that DT parsing can be done in common code too?
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz
[not found] ` <52F903EF.4030606-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
@ 2014-02-10 18:27 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-02-10 18:27 UTC (permalink / raw)
To: Stephen Warren
Cc: Axel Lin, Laxman Dewangan, Thierry Reding,
linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
On Mon, Feb 10, 2014 at 09:53:03AM -0700, Stephen Warren wrote:
> On 02/10/2014 06:48 AM, Axel Lin wrote:
> I wonder ...
> > + if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency",
> > + &master->max_speed_hz))
> > + master->max_speed_hz = 25000000; /* 25MHz */
> ... if that DT parsing can be done in common code too?
Yes, there is in general a lot of opportunity in the SPI subsystem to
factor code out into the core. The DT stuff (things like this and also
GPIO chip selects) is part of it.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz
2014-02-10 13:48 [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz Axel Lin
` (2 preceding siblings ...)
2014-02-10 16:53 ` [PATCH 1/3] spi: tegra114: " Stephen Warren
@ 2014-02-11 12:09 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-02-11 12:09 UTC (permalink / raw)
To: Axel Lin
Cc: Laxman Dewangan, Stephen Warren, Thierry Reding,
linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 194 bytes --]
On Mon, Feb 10, 2014 at 09:48:16PM +0800, Axel Lin wrote:
> Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
> handle checking transfer speed.
Applied all, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-11 12:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-10 13:48 [PATCH 1/3] spi: tegra114: Convert to use master->max_speed_hz Axel Lin
2014-02-10 13:49 ` [PATCH 2/3] spi: tegra20-sflash: " Axel Lin
2014-02-10 13:51 ` [PATCH 3/3] spi: tegra20-slink: " Axel Lin
2014-02-10 16:53 ` [PATCH 1/3] spi: tegra114: " Stephen Warren
[not found] ` <52F903EF.4030606-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-02-10 18:27 ` Mark Brown
2014-02-11 12:09 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.