* [PATCH 1/2] spi: pxa2xx: Set the max_speed_hz of the master
@ 2015-09-25 7:27 Jarkko Nikula
2015-09-25 7:27 ` [PATCH 2/2] spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device() Jarkko Nikula
[not found] ` <1443166038-31658-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
0 siblings, 2 replies; 4+ messages in thread
From: Jarkko Nikula @ 2015-09-25 7:27 UTC (permalink / raw)
To: linux-spi
Cc: Mark Brown, linux-acpi, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Jarkko Nikula
Carry input clock of the controller in max_speed_hz of struct spi_master
instead of in own driver data. They mean the same thing and more over now
the max_speed_hz is not even set here.
As an added bonus this allows SPI core to validate that transfer speed is
not beyond the maximum input clock. This is not a problem in spi-pxa2xx as
the driver doesn't use transfer speed parameter directly but via input
clock divider calculation which will top at divide by one. However it's
better to validate speed before passing it here.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
drivers/spi/spi-pxa2xx.c | 12 ++++++------
drivers/spi/spi-pxa2xx.h | 3 ---
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 7a4cb07a5f47..36cbb0f10856 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -806,7 +806,7 @@ static unsigned int quark_x1000_get_clk_div(int rate, u32 *dds)
static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate)
{
- unsigned long ssp_clk = drv_data->max_clk_rate;
+ unsigned long ssp_clk = drv_data->master->max_speed_hz;
const struct ssp_device *ssp = drv_data->ssp;
rate = min_t(int, ssp_clk, rate);
@@ -1221,13 +1221,13 @@ static int setup(struct spi_device *spi)
/* NOTE: PXA25x_SSP _could_ use external clocking ... */
cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, spi->bits_per_word);
if (!pxa25x_ssp_comp(drv_data))
- dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
- drv_data->max_clk_rate
+ dev_dbg(&spi->dev, "%u Hz actual, %s\n",
+ drv_data->master->max_speed_hz
/ (1 + ((cr0 & SSCR0_SCR(0xfff)) >> 8)),
chip->enable_dma ? "DMA" : "PIO");
else
- dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
- drv_data->max_clk_rate / 2
+ dev_dbg(&spi->dev, "%u Hz actual, %s\n",
+ drv_data->master->max_speed_hz / 2
/ (1 + ((cr0 & SSCR0_SCR(0x0ff)) >> 8)),
chip->enable_dma ? "DMA" : "PIO");
@@ -1477,7 +1477,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
/* Enable SOC clock */
clk_prepare_enable(ssp->clk);
- drv_data->max_clk_rate = clk_get_rate(ssp->clk);
+ master->max_speed_hz = clk_get_rate(ssp->clk);
/* Load default SSP configuration */
pxa2xx_spi_write(drv_data, SSCR0, 0);
diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h
index b91bda26bfa8..fd7a7bc91b9f 100644
--- a/drivers/spi/spi-pxa2xx.h
+++ b/drivers/spi/spi-pxa2xx.h
@@ -46,9 +46,6 @@ struct driver_data {
u32 clear_sr;
u32 mask_sr;
- /* Maximun clock rate */
- unsigned long max_clk_rate;
-
/* Message Transfer pump */
struct tasklet_struct pump_transfers;
--
2.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device()
2015-09-25 7:27 [PATCH 1/2] spi: pxa2xx: Set the max_speed_hz of the master Jarkko Nikula
@ 2015-09-25 7:27 ` Jarkko Nikula
2015-09-25 23:56 ` Rafael J. Wysocki
[not found] ` <1443166038-31658-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
1 sibling, 1 reply; 4+ messages in thread
From: Jarkko Nikula @ 2015-09-25 7:27 UTC (permalink / raw)
To: linux-spi
Cc: Mark Brown, linux-acpi, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Jarkko Nikula
Get pointer to the struct acpi_device by using ACPI_COMPANION() macro. This
is more efficient than using ACPI_HANDLE() and acpi_bus_get_device().
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
drivers/spi/spi-pxa2xx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 36cbb0f10856..6f834e5b0547 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1316,8 +1316,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
const struct pci_device_id *pcidev_id = NULL;
int devid, type;
- if (!ACPI_HANDLE(&pdev->dev) ||
- acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev))
+ adev = ACPI_COMPANION(&pdev->dev);
+ if (!adev)
return NULL;
if (dev_is_pci(pdev->dev.parent))
--
2.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device()
2015-09-25 7:27 ` [PATCH 2/2] spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device() Jarkko Nikula
@ 2015-09-25 23:56 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2015-09-25 23:56 UTC (permalink / raw)
To: Jarkko Nikula
Cc: linux-spi, Mark Brown, linux-acpi, Daniel Mack, Haojian Zhuang,
Robert Jarzmik
On Friday, September 25, 2015 10:27:18 AM Jarkko Nikula wrote:
> Get pointer to the struct acpi_device by using ACPI_COMPANION() macro. This
> is more efficient than using ACPI_HANDLE() and acpi_bus_get_device().
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/spi/spi-pxa2xx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
> index 36cbb0f10856..6f834e5b0547 100644
> --- a/drivers/spi/spi-pxa2xx.c
> +++ b/drivers/spi/spi-pxa2xx.c
> @@ -1316,8 +1316,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
> const struct pci_device_id *pcidev_id = NULL;
> int devid, type;
>
> - if (!ACPI_HANDLE(&pdev->dev) ||
> - acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev))
> + adev = ACPI_COMPANION(&pdev->dev);
> + if (!adev)
> return NULL;
>
> if (dev_is_pci(pdev->dev.parent))
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] spi: pxa2xx: Set the max_speed_hz of the master
[not found] ` <1443166038-31658-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2015-09-26 9:23 ` Robert Jarzmik
0 siblings, 0 replies; 4+ messages in thread
From: Robert Jarzmik @ 2015-09-26 9:23 UTC (permalink / raw)
To: Jarkko Nikula
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Mark Brown,
linux-acpi-u79uwXL29TY76Z2rM5mHXA, Daniel Mack, Haojian Zhuang
Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> writes:
> Carry input clock of the controller in max_speed_hz of struct spi_master
> instead of in own driver data. They mean the same thing and more over now
> the max_speed_hz is not even set here.
>
> As an added bonus this allows SPI core to validate that transfer speed is
> not beyond the maximum input clock. This is not a problem in spi-pxa2xx as
> the driver doesn't use transfer speed parameter directly but via input
> clock divider calculation which will top at divide by one. However it's
> better to validate speed before passing it here.
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Acked-by: Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>
Cheers.
--
Robert
--
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] 4+ messages in thread
end of thread, other threads:[~2015-09-26 9:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-25 7:27 [PATCH 1/2] spi: pxa2xx: Set the max_speed_hz of the master Jarkko Nikula
2015-09-25 7:27 ` [PATCH 2/2] spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device() Jarkko Nikula
2015-09-25 23:56 ` Rafael J. Wysocki
[not found] ` <1443166038-31658-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-09-26 9:23 ` [PATCH 1/2] spi: pxa2xx: Set the max_speed_hz of the master Robert Jarzmik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).