On CPM2, the SPI parameter RAM is dynamically allocated in the dualport RAM
whereas in CPM1, it is statically allocated to a default address with
capability to relocate it somewhere else via the use of CPM micropatch.
The address of the parameter RAM is given by the boot loader and expected
to be mapped via of_iomap()
In the current implementation, in function fsl_spi_cpm_get_pram() there is
a confusion between the SPI_BASE register and the base of the SPI
parameter RAM. Fortunatly, it is working properly with MPC866 and MPC885
because they do set SPI_BASE, but on MPC860 and other old MPC8xx that doesn't
set SPI_BASE, pram_ofs is not properly set.
Also, the parameter RAM is not properly mapped with of_iomap() as it should
but still gets accessible by chance through the full RAM which is mapped
from somewhere else.
This patch applies to the SPI driver the same principle as for the CPM UART:
when the CPM is of type CPM1, we simply do an of_iomap() of the area provided
via the device tree.
Signed-off-by: Christophe Leroy <redacted>
---
drivers/spi/spi-fsl-cpm.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
From: Mark Brown <broonie@kernel.org> Date: 2015-03-03 18:46:18
On Thu, Feb 26, 2015 at 05:11:42PM +0100, Christophe Leroy wrote:
On CPM2, the SPI parameter RAM is dynamically allocated in the dualport RAM
whereas in CPM1, it is statically allocated to a default address with
capability to relocate it somewhere else via the use of CPM micropatch.
The address of the parameter RAM is given by the boot loader and expected
to be mapped via of_iomap()
Why are we using of_iomap() rather than a generic I/O mapping function
here?
On Thu, Feb 26, 2015 at 05:11:42PM +0100, Christophe Leroy wrote:
quoted
On CPM2, the SPI parameter RAM is dynamically allocated in the dualport RAM
whereas in CPM1, it is statically allocated to a default address with
capability to relocate it somewhere else via the use of CPM micropatch.
The address of the parameter RAM is given by the boot loader and expected
to be mapped via of_iomap()
Why are we using of_iomap() rather than a generic I/O mapping function
here?
Euh ...
because all drivers for powerpc seems to be using of_iomap(), as on
powerpc the HW is described by the bootloader in a OF device tree.
Today, of_iomap() is at least used in FSL SPI, FSL UART, SPI mpc52xx,
UART mpc52xx, i2c-mpc, i2c-cpm, freescale ethernet drivers, etc ....
Is it not correct ?
From: Mark Brown <broonie@kernel.org> Date: 2015-03-06 11:44:26
On Wed, Mar 04, 2015 at 09:00:39AM +0100, leroy christophe wrote:
Le 03/03/2015 19:44, Mark Brown a écrit :
quoted
Why are we using of_iomap() rather than a generic I/O mapping function
here?
because all drivers for powerpc seems to be using of_iomap(), as on powerpc
the HW is described by the bootloader in a OF device tree.
Today, of_iomap() is at least used in FSL SPI, FSL UART, SPI mpc52xx, UART
mpc52xx, i2c-mpc, i2c-cpm, freescale ethernet drivers, etc ....
Is it not correct ?
It's legacy, all that code is really old. Modern code is written in as
architecture and firmware neutral a fashion as possible to make things
more consistent and maintainable.
On Wed, Mar 04, 2015 at 09:00:39AM +0100, leroy christophe wrote:
quoted
Le 03/03/2015 19:44, Mark Brown a écrit :
quoted
Why are we using of_iomap() rather than a generic I/O mapping function
here?
because all drivers for powerpc seems to be using of_iomap(), as on powerpc
the HW is described by the bootloader in a OF device tree.
Today, of_iomap() is at least used in FSL SPI, FSL UART, SPI mpc52xx, UART
mpc52xx, i2c-mpc, i2c-cpm, freescale ethernet drivers, etc ....
Is it not correct ?
It's legacy, all that code is really old. Modern code is written in as
architecture and firmware neutral a fashion as possible to make things
more consistent and maintainable.
This patch is only a small bug fix.
That driver already contains calls to of_iomap() and other related of_
functions.
Is it worth rewriting the driver for just a small bug fix ?
Christophe
From: Mark Brown <broonie@kernel.org> Date: 2015-03-18 12:03:26
On Thu, Mar 12, 2015 at 07:52:53AM +0100, leroy christophe wrote:
Le 06/03/2015 12:44, Mark Brown a écrit :
quoted
It's legacy, all that code is really old. Modern code is written in as
architecture and firmware neutral a fashion as possible to make things
more consistent and maintainable.
This patch is only a small bug fix.
That driver already contains calls to of_iomap() and other related of_
functions.
Is it worth rewriting the driver for just a small bug fix ?
I don't think you need to fix other usages but I'd rather not introduce
new usages of legacy APIs that just need to be fixed up.