spi: pxa2xx: Set the max_speed_hz of the master
Subsystems (4)
PATCH 1/2 spi: pxa2xx: Set the max_speed_hz of the master
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.
--- drivers/spi/spi-pxa2xx.c | 12 ++++++------ drivers/spi/spi-pxa2xx.h | 3 --- 2 files changed, 6 insertions(+), 9 deletions(-)
drivers/spi/spi-pxa2xx.c +6 -6
@@ -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 );
drivers/spi/spi-pxa2xx.h +0 -3
@@ -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;
Signature · 1 line
2.5.3
PATCH 2/2 spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device()
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().
--- drivers/spi/spi-pxa2xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-pxa2xx.c +2 -2
@@ -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))
Signature · 1 line
2.5.3
A message that is not in the archive (sent off-list or not yet received): 1443166038-31658-2-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]
Applied "spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device()" to the spi tree
The patch
spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device()
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
b9f6940a437dcb8481df16b175359e126cf7bc33Mon Sep 17 00:00:00 2001
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Fri, 25 Sep 2015 10:27:18 +0300
Subject: [PATCH] spi: pxa2xx: Use ACPI_COMPANION() instead of
acpi_bus_get_device()
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().
--- drivers/spi/spi-pxa2xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-pxa2xx.c +2 -2
@@ -1312,8 +1312,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))
Signature · 6 lines
2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] spi: pxa2xx: Use ACPI_COMPANION() instead of acpi_bus_get_device()
In reply to Jarkko NikulaQuoted 4 lines · Jarkko Nikula
Get pointer to the struct
acpi_deviceby usingACPI_COMPANION()macro. This is more efficient than usingACPI_HANDLE()andacpi_bus_get_device().Signed-off-by Jarkko Nikula <[email protected]>
Quoted 20 lines
--- drivers/spi/spi-pxa2xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/spi-pxa2xx.c +2
-2@@ -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))
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
A message that is not in the archive (sent off-list or not yet received): 1443166038-31658-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]
Applied "spi: pxa2xx: Set the max_speed_hz of the master" to the spi tree
The patch
spi: pxa2xx: Set the max_speed_hz of the master
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
0eca7cf2696506006463b9d67bb6110c82d3e064Mon Sep 17 00:00:00 2001
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Fri, 25 Sep 2015 10:27:17 +0300
Subject: [PATCH] spi: pxa2xx: Set the max_speed_hz of the master
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.
--- drivers/spi/spi-pxa2xx.c | 12 ++++++------ drivers/spi/spi-pxa2xx.h | 3 --- 2 files changed, 6 insertions(+), 9 deletions(-)
drivers/spi/spi-pxa2xx.c +6 -6
@@ -802,7 +802,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);
@@ -1217,13 +1217,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" );
@@ -1473,7 +1473,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 );
drivers/spi/spi-pxa2xx.h +0 -3
@@ -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;
Signature · 6 lines
2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Robert Jarzmik
Acked-byQuoted 11 lines · Jarkko Nikula
Carry input clock of the controller in
max_speed_hzof structspi_masterinstead of in own driver data. They mean the same thing and more over now themax_speed_hzis 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.
Cheers.
--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html