* [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit
@ 2009-02-06 23:09 Anatolij Gustschin
2009-02-06 23:29 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-24 13:11 ` Anatolij Gustschin
0 siblings, 2 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2009-02-06 23:09 UTC (permalink / raw)
To: u-boot
From: Guennadi Liakhovetski <lg@denx.de>
Fix setting the SPI Control register, 8 and 16-bit transfers
and a wrong pointer in the free routine in the mxc_spi driver.
Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just
resetted the board, powering the board down showed, that v2 wasn't
sufficient, it has lost the SPI Control register fix from v1.
Changes since v3: add empty line in spi_free_slave()
I'm going to push it via video tree as Jean-Christophe
mean it is more video related patch and have no objection.
Anatolij
drivers/spi/mxc_spi.c | 31 ++++++++++++++++++++-----------
1 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 5957ada..0ac4e90 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -90,17 +90,15 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
- if (MXC_CSPICTRL_BITCOUNT(bitlen - 1) != (cfg_reg & MXC_CSPICTRL_BITCOUNT(31))) {
- cfg_reg = (cfg_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
- MXC_CSPICTRL_BITCOUNT(bitlen - 1);
- reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
- }
+ mxcs->ctrl_reg = (mxcs->ctrl_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
+ MXC_CSPICTRL_BITCOUNT(bitlen - 1);
- reg_write(mxcs->base + MXC_CSPITXDATA, data);
+ if (cfg_reg != mxcs->ctrl_reg)
+ reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg);
- cfg_reg |= MXC_CSPICTRL_XCH;
+ reg_write(mxcs->base + MXC_CSPITXDATA, data);
- reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
+ reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg | MXC_CSPICTRL_XCH);
while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
;
@@ -122,8 +120,17 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
i < n_blks;
- i++, in_l++, out_l++, bitlen -= 32)
- *in_l = spi_xchg_single(slave, *out_l, bitlen);
+ i++, in_l++, out_l++, bitlen -= 32) {
+ u32 data = spi_xchg_single(slave, *out_l, bitlen);
+
+ /* Check if we're only transfering 8 or 16 bits */
+ if (!i) {
+ if (bitlen < 9)
+ *(u8 *)din = data;
+ else if (bitlen < 17)
+ *(u16 *)din = data;
+ }
+ }
return 0;
}
@@ -169,7 +176,9 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
void spi_free_slave(struct spi_slave *slave)
{
- free(slave);
+ struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+
+ free(mxcs);
}
int spi_claim_bus(struct spi_slave *slave)
--
1.5.3.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit
2009-02-06 23:09 [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit Anatolij Gustschin
@ 2009-02-06 23:29 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-06 23:50 ` Anatolij Gustschin
2009-02-23 11:05 ` Anatolij Gustschin
2009-02-24 13:11 ` Anatolij Gustschin
1 sibling, 2 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-02-06 23:29 UTC (permalink / raw)
To: u-boot
On 00:09 Sat 07 Feb , Anatolij Gustschin wrote:
> From: Guennadi Liakhovetski <lg@denx.de>
>
> Fix setting the SPI Control register, 8 and 16-bit transfers
> and a wrong pointer in the free routine in the mxc_spi driver.
>
> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>
> Changes since v1: chose a simpler fix
> Changes since v2: fix the simpler fix: v2 worked as long as I just
> resetted the board, powering the board down showed, that v2 wasn't
> sufficient, it has lost the SPI Control register fix from v1.
> Changes since v3: add empty line in spi_free_slave()
>
> I'm going to push it via video tree as Jean-Christophe
> mean it is more video related patch and have no objection.
please not I've not ack yet patch 1,2,3,5,9
please apply only after I've add it this 5 patchs
Best Regards,
J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit
2009-02-06 23:29 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-02-06 23:50 ` Anatolij Gustschin
2009-02-23 11:05 ` Anatolij Gustschin
1 sibling, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2009-02-06 23:50 UTC (permalink / raw)
To: u-boot
On Saturday 07 February 2009 12:29:06 am Jean-Christophe PLAGNIOL-VILLARD
wrote:
> On 00:09 Sat 07 Feb , Anatolij Gustschin wrote:
> > From: Guennadi Liakhovetski <lg@denx.de>
> >
> > Fix setting the SPI Control register, 8 and 16-bit transfers
> > and a wrong pointer in the free routine in the mxc_spi driver.
> >
> > Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
> > Signed-off-by: Anatolij Gustschin <agust@denx.de>
> > ---
> >
> > Changes since v1: chose a simpler fix
> > Changes since v2: fix the simpler fix: v2 worked as long as I just
> > resetted the board, powering the board down showed, that v2 wasn't
> > sufficient, it has lost the SPI Control register fix from v1.
> > Changes since v3: add empty line in spi_free_slave()
> >
> > I'm going to push it via video tree as Jean-Christophe
> > mean it is more video related patch and have no objection.
>
> please not I've not ack yet patch 1,2,3,5,9
actually you already ACKed patch 5, see
http://lists.denx.de/pipermail/u-boot/2009-February/047068.html
and it is already in the arm tree, AFAICS. Thanks!
> please apply only after I've add it this 5 patchs
and yes, I'm waiting for your ACK for 1,2,3 and 9 before I push
them, as all these patches touch board files or related headers,
spi, gpio and so on. Thanks!
Best regards,
Anatolij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit
2009-02-06 23:29 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-06 23:50 ` Anatolij Gustschin
@ 2009-02-23 11:05 ` Anatolij Gustschin
2009-02-24 3:11 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2009-02-23 11:05 UTC (permalink / raw)
To: u-boot
Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 00:09 Sat 07 Feb , Anatolij Gustschin wrote:
>> From: Guennadi Liakhovetski <lg@denx.de>
>>
>> Fix setting the SPI Control register, 8 and 16-bit transfers
>> and a wrong pointer in the free routine in the mxc_spi driver.
>>
>> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
>> Signed-off-by: Anatolij Gustschin <agust@denx.de>
>> ---
>>
>> Changes since v1: chose a simpler fix
>> Changes since v2: fix the simpler fix: v2 worked as long as I just
>> resetted the board, powering the board down showed, that v2 wasn't
>> sufficient, it has lost the SPI Control register fix from v1.
>> Changes since v3: add empty line in spi_free_slave()
>>
>> I'm going to push it via video tree as Jean-Christophe
>> mean it is more video related patch and have no objection.
> please not I've not ack yet patch 1,2,3,5,9
>
> please apply only after I've add it this 5 patchs
>
Jean-Christophe, do you ACK v4 of this patch?
Best regards,
Anatolij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit
2009-02-23 11:05 ` Anatolij Gustschin
@ 2009-02-24 3:11 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-02-24 3:11 UTC (permalink / raw)
To: u-boot
On 12:05 Mon 23 Feb , Anatolij Gustschin wrote:
> Jean-Christophe PLAGNIOL-VILLARD wrote:
>
> > On 00:09 Sat 07 Feb , Anatolij Gustschin wrote:
> >> From: Guennadi Liakhovetski <lg@denx.de>
> >>
> >> Fix setting the SPI Control register, 8 and 16-bit transfers
> >> and a wrong pointer in the free routine in the mxc_spi driver.
> >>
> >> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
> >> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> >> ---
> >>
> >> Changes since v1: chose a simpler fix
> >> Changes since v2: fix the simpler fix: v2 worked as long as I just
> >> resetted the board, powering the board down showed, that v2 wasn't
> >> sufficient, it has lost the SPI Control register fix from v1.
> >> Changes since v3: add empty line in spi_free_slave()
> >>
> >> I'm going to push it via video tree as Jean-Christophe
> >> mean it is more video related patch and have no objection.
> > please not I've not ack yet patch 1,2,3,5,9
> >
> > please apply only after I've add it this 5 patchs
> >
>
> Jean-Christophe, do you ACK v4 of this patch?
You've got
Best Regards,
J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit
2009-02-06 23:09 [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit Anatolij Gustschin
2009-02-06 23:29 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-02-24 13:11 ` Anatolij Gustschin
1 sibling, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2009-02-24 13:11 UTC (permalink / raw)
To: u-boot
> From: Guennadi Liakhovetski <lg@denx.de>
>
> Fix setting the SPI Control register, 8 and 16-bit transfers
> and a wrong pointer in the free routine in the mxc_spi driver.
>
> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>
> Changes since v1: chose a simpler fix
> Changes since v2: fix the simpler fix: v2 worked as long as I just
> resetted the board, powering the board down showed, that v2 wasn't
> sufficient, it has lost the SPI Control register fix from v1.
> Changes since v3: add empty line in spi_free_slave()
>
> I'm going to push it via video tree as Jean-Christophe
> mean it is more video related patch and have no objection.
>
> Anatolij
>
> drivers/spi/mxc_spi.c | 31 ++++++++++++++++++++-----------
> 1 files changed, 20 insertions(+), 11 deletions(-)
Applied to u-boot-video/master.
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-02-24 13:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06 23:09 [U-Boot] [PATCH 1/9 v4] i.MX31: fix SPI driver for shorter than 32 bit Anatolij Gustschin
2009-02-06 23:29 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-06 23:50 ` Anatolij Gustschin
2009-02-23 11:05 ` Anatolij Gustschin
2009-02-24 3:11 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-24 13:11 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox