* [PATCH 1/3] spi: Add addr_width field to struct spi_message
@ 2015-05-10 14:47 Zhiqiang Hou
[not found] ` <1431269253-22890-1-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Zhiqiang Hou @ 2015-05-10 14:47 UTC (permalink / raw)
To: linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, B21284-KZfg59tc24xl57MIdRCFDg,
Hou Zhiqiang
From: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Make SPI controller can get address width of the SPI device.
Signed-off-by: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Based on git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git.
Tested on T1040RDB and T2080RDB.
---
include/linux/spi/spi.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index d673072..c9cef2c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -682,6 +682,9 @@ struct spi_message {
unsigned actual_length;
int status;
+ /* deliver the address width of spi device to spi controller */
+ u8 addr_width;
+
/* for optional use by whatever driver currently owns the
* spi_message ... between calls to spi_async and then later
* complete(), that's the spi_master controller driver.
--
2.1.0.27.g96db324
--
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] 11+ messages in thread
* [PATCH 2/3] mtd: m25p80: Initialize the addr_width field of spi_message
[not found] ` <1431269253-22890-1-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2015-05-10 14:47 ` Zhiqiang Hou
2015-05-10 14:47 ` [PATCH 3/3] spi/fsl-espi: Add the 4Byte address width device support Zhiqiang Hou
2015-05-11 7:43 ` [PATCH 1/3] spi: Add addr_width field to struct spi_message Geert Uytterhoeven
2 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2015-05-10 14:47 UTC (permalink / raw)
To: linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, B21284-KZfg59tc24xl57MIdRCFDg,
Hou Zhiqiang
From: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Add the addr_width information of spi_nor delivery to SPI controller.
For the Freescale eSPI controller, the address width is needed to do
the correct operations.
Signed-off-by: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 7c8b169..0ae72a0 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -85,6 +85,7 @@ static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
int cmd_sz = m25p_cmdsz(nor);
spi_message_init(&m);
+ m.addr_width = flash->spi_nor.addr_width;
if (nor->program_opcode == SPINOR_OP_AAI_WP && nor->sst_write_second)
cmd_sz = 1;
@@ -134,6 +135,7 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
dummy /= 8;
spi_message_init(&m);
+ m.addr_width = flash->spi_nor.addr_width;
memset(t, 0, (sizeof t));
flash->command[0] = nor->read_opcode;
--
2.1.0.27.g96db324
--
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] 11+ messages in thread
* [PATCH 3/3] spi/fsl-espi: Add the 4Byte address width device support
[not found] ` <1431269253-22890-1-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-10 14:47 ` [PATCH 2/3] mtd: m25p80: Initialize the addr_width field of spi_message Zhiqiang Hou
@ 2015-05-10 14:47 ` Zhiqiang Hou
[not found] ` <1431269253-22890-3-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-11 7:43 ` [PATCH 1/3] spi: Add addr_width field to struct spi_message Geert Uytterhoeven
2 siblings, 1 reply; 11+ messages in thread
From: Zhiqiang Hou @ 2015-05-10 14:47 UTC (permalink / raw)
To: linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, B21284-KZfg59tc24xl57MIdRCFDg,
Hou Zhiqiang
From: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Get the address width information from the spi_message to correct the
address to operate.
when the one-time transfer length exceed the max limited length of eSPI
controller 0xFFFF, for the subsequent transfer, the address to operate
need to be corrected.
Signed-off-by: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
drivers/spi/spi-fsl-espi.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index d0a73a0..59931d3 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -250,19 +250,31 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
return mpc8xxx_spi->count;
}
-static inline void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd)
+static inline void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd, u8 addr_width)
{
if (cmd) {
- cmd[1] = (u8)(addr >> 16);
- cmd[2] = (u8)(addr >> 8);
- cmd[3] = (u8)(addr >> 0);
+ if (addr_width == 3) {
+ cmd[1] = (u8)(addr >> 16);
+ cmd[2] = (u8)(addr >> 8);
+ cmd[3] = (u8)(addr >> 0);
+ } else if (addr_width == 4) {
+ cmd[1] = (u8)(addr >> 24);
+ cmd[2] = (u8)(addr >> 16);
+ cmd[3] = (u8)(addr >> 8);
+ cmd[4] = (u8)(addr >> 0);
+ }
}
}
-static inline unsigned int fsl_espi_cmd2addr(u8 *cmd)
+static inline unsigned int fsl_espi_cmd2addr(u8 *cmd, u8 addr_width)
{
- if (cmd)
- return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0;
+ if (cmd) {
+ if (addr_width == 3)
+ return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0;
+ else if (addr_width == 4)
+ return cmd[1] << 24 | cmd[2] << 16
+ | cmd[3] << 8 | cmd[4] << 0;
+ }
return 0;
}
@@ -367,7 +379,9 @@ static void fsl_espi_rw_trans(struct spi_message *m,
unsigned int trans_len;
unsigned int addr;
int i, pos, loop;
+ u8 addr_width;
+ addr_width = m->addr_width;
local_buf = kzalloc(SPCOM_TRANLEN_MAX, GFP_KERNEL);
if (!local_buf) {
espi_trans->status = -ENOMEM;
@@ -388,9 +402,9 @@ static void fsl_espi_rw_trans(struct spi_message *m,
}
if (pos > 0) {
- addr = fsl_espi_cmd2addr(local_buf);
+ addr = fsl_espi_cmd2addr(local_buf, addr_width);
addr += pos;
- fsl_espi_addr2cmd(addr, local_buf);
+ fsl_espi_addr2cmd(addr, local_buf, addr_width);
}
espi_trans->n_tx = n_tx;
--
2.1.0.27.g96db324
--
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] 11+ messages in thread
* Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
[not found] ` <1431269253-22890-1-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-10 14:47 ` [PATCH 2/3] mtd: m25p80: Initialize the addr_width field of spi_message Zhiqiang Hou
2015-05-10 14:47 ` [PATCH 3/3] spi/fsl-espi: Add the 4Byte address width device support Zhiqiang Hou
@ 2015-05-11 7:43 ` Geert Uytterhoeven
[not found] ` <CAMuHMdUakeDgLZ4hXe0DBu97Xx4eiC9K_Qfc-imkDBrDBXNs6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-05-11 7:43 UTC (permalink / raw)
To: Zhiqiang Hou; +Cc: linux-spi, Mark Brown, B21284-KZfg59tc24xl57MIdRCFDg
On Sun, May 10, 2015 at 4:47 PM, Zhiqiang Hou <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> From: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>
> Make SPI controller can get address width of the SPI device.
What does "address wdith" mean? From your other patches, I infer it's either
24 or 32 bit addressing as used by nor-jedec ("m25p80").
Why does the generic spi_message needs to have nor-jedec-specific fields?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] 11+ messages in thread
* Re: [PATCH 3/3] spi/fsl-espi: Add the 4Byte address width device support
[not found] ` <1431269253-22890-3-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2015-05-11 7:45 ` Geert Uytterhoeven
0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-05-11 7:45 UTC (permalink / raw)
To: Zhiqiang Hou; +Cc: linux-spi, Mark Brown, B21284-KZfg59tc24xl57MIdRCFDg
On Sun, May 10, 2015 at 4:47 PM, Zhiqiang Hou <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> From: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>
> Get the address width information from the spi_message to correct the
> address to operate.
>
> when the one-time transfer length exceed the max limited length of eSPI
> controller 0xFFFF, for the subsequent transfer, the address to operate
> need to be corrected.
>
> Signed-off-by: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> ---
> drivers/spi/spi-fsl-espi.c | 32 +++++++++++++++++++++++---------
> 1 file changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
> index d0a73a0..59931d3 100644
> --- a/drivers/spi/spi-fsl-espi.c
> +++ b/drivers/spi/spi-fsl-espi.c
> @@ -250,19 +250,31 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
> return mpc8xxx_spi->count;
> }
>
> -static inline void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd)
> +static inline void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd, u8 addr_width)
> {
> if (cmd) {
> - cmd[1] = (u8)(addr >> 16);
> - cmd[2] = (u8)(addr >> 8);
> - cmd[3] = (u8)(addr >> 0);
> + if (addr_width == 3) {
As your SPI master driver is already nor-jedec-specific, can't you derive
this from cmd[0]?
> + cmd[1] = (u8)(addr >> 16);
> + cmd[2] = (u8)(addr >> 8);
> + cmd[3] = (u8)(addr >> 0);
> + } else if (addr_width == 4) {
> + cmd[1] = (u8)(addr >> 24);
> + cmd[2] = (u8)(addr >> 16);
> + cmd[3] = (u8)(addr >> 8);
> + cmd[4] = (u8)(addr >> 0);
> + }
> }
> }
>
> -static inline unsigned int fsl_espi_cmd2addr(u8 *cmd)
> +static inline unsigned int fsl_espi_cmd2addr(u8 *cmd, u8 addr_width)
> {
> - if (cmd)
> - return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0;
> + if (cmd) {
> + if (addr_width == 3)
> + return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0;
> + else if (addr_width == 4)
> + return cmd[1] << 24 | cmd[2] << 16
> + | cmd[3] << 8 | cmd[4] << 0;
> + }
>
> return 0;
> }
> @@ -367,7 +379,9 @@ static void fsl_espi_rw_trans(struct spi_message *m,
> unsigned int trans_len;
> unsigned int addr;
> int i, pos, loop;
> + u8 addr_width;
>
> + addr_width = m->addr_width;
> local_buf = kzalloc(SPCOM_TRANLEN_MAX, GFP_KERNEL);
> if (!local_buf) {
> espi_trans->status = -ENOMEM;
> @@ -388,9 +402,9 @@ static void fsl_espi_rw_trans(struct spi_message *m,
> }
>
> if (pos > 0) {
So your SPI master driver supports nor-jedec only, ugh.
> - addr = fsl_espi_cmd2addr(local_buf);
> + addr = fsl_espi_cmd2addr(local_buf, addr_width);
> addr += pos;
Why is the address changed?
> - fsl_espi_addr2cmd(addr, local_buf);
> + fsl_espi_addr2cmd(addr, local_buf, addr_width);
> }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] 11+ messages in thread
* Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
[not found] ` <CAMuHMdUakeDgLZ4hXe0DBu97Xx4eiC9K_Qfc-imkDBrDBXNs6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-05-11 16:17 ` Mark Brown
2015-05-12 8:06 ` Hou Zhiqiang
1 sibling, 0 replies; 11+ messages in thread
From: Mark Brown @ 2015-05-11 16:17 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Zhiqiang Hou, linux-spi, B21284-KZfg59tc24xl57MIdRCFDg
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
On Mon, May 11, 2015 at 09:43:21AM +0200, Geert Uytterhoeven wrote:
> On Sun, May 10, 2015 at 4:47 PM, Zhiqiang Hou <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> > Make SPI controller can get address width of the SPI device.
> What does "address wdith" mean? From your other patches, I infer it's either
> 24 or 32 bit addressing as used by nor-jedec ("m25p80").
> Why does the generic spi_message needs to have nor-jedec-specific fields?
Indeed, if this is flash specific then it's questionable if the SPI
framework should be involved at all - it's sounding like a controller
that's flash specific and ought to be in the MTD subsystem.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 1/3] spi: Add addr_width field to struct spi_message
[not found] ` <CAMuHMdUakeDgLZ4hXe0DBu97Xx4eiC9K_Qfc-imkDBrDBXNs6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-11 16:17 ` Mark Brown
@ 2015-05-12 8:06 ` Hou Zhiqiang
[not found] ` <CY1PR0301MB0780A4057DBB4DEBC45A631F8BDA0-YrwGdl+PljnwWZenWrSUgZwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
1 sibling, 1 reply; 11+ messages in thread
From: Hou Zhiqiang @ 2015-05-12 8:06 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-spi, Mark Brown, Hu Vincent
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1872 bytes --]
Hi Geert,
> -----Original Message-----
> From: geert.uytterhoeven@gmail.com [mailto:geert.uytterhoeven@gmail.com]
> On Behalf Of Geert Uytterhoeven
> Sent: 2015å¹´5æ11æ¥ 15:43
> To: Hou Zhiqiang-B48286
> Cc: linux-spi; Mark Brown; Hu Mingkai-B21284
> Subject: Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
>
> On Sun, May 10, 2015 at 4:47 PM, Zhiqiang Hou <B48286@freescale.com>
> wrote:
> > From: Hou Zhiqiang <B48286@freescale.com>
> >
> > Make SPI controller can get address width of the SPI device.
>
> What does "address wdith" mean? From your other patches, I infer it's
> either
> 24 or 32 bit addressing as used by nor-jedec ("m25p80").
> Why does the generic spi_message needs to have nor-jedec-specific fields?
>
Yes, the address width is the address width of spi flash.
The reason to add this nor-jedec-specific field to spi_message is the eSPI controller
of Freescale limits the MAX transaction length(TRANLEN) to 0x10000 each transaction, so if the
data size transferred exceed the TRANLEN, the eSPI controller can only transfer data for
the first TRANLEN, and need to issue new write/read commands to complete the remainders.
So, eSPI controller need getting the address width of spi flash, and then calculate the
new address to initialize the new write/read commands.
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
>
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
> -- Linus Torvalds
Thanks,
Zhiqiang
N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·¥{±²¢Ø^nr¡ö¦zË\x1aëh¨èÚ&¢îý»\x05ËÛÔØï¦v¬Îf\x1dp)¹¹br ê+Ê+zf£¢·h§~Ûiÿûàz¹\x1e®w¥¢¸?¨èÚ&¢)ߢ^[f
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
[not found] ` <CY1PR0301MB0780A4057DBB4DEBC45A631F8BDA0-YrwGdl+PljnwWZenWrSUgZwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
@ 2015-05-12 8:11 ` Geert Uytterhoeven
[not found] ` <CAMuHMdUzkr6_evPD5y-gaH=rtEgyZ+bHAddD+UmpTssQXZry1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-05-12 8:11 UTC (permalink / raw)
To: Hou Zhiqiang; +Cc: linux-spi, Mark Brown, Hu Vincent
Hi Zhiqiang,
On Tue, May 12, 2015 at 10:06 AM, Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
>> From: geert.uytterhoeven-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [mailto:geert.uytterhoeven@gmail.com]
>> On Behalf Of Geert Uytterhoeven
>> Sent: 2015年5月11日 15:43
>> To: Hou Zhiqiang-B48286
>> Cc: linux-spi; Mark Brown; Hu Mingkai-B21284
>> Subject: Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
>>
>> On Sun, May 10, 2015 at 4:47 PM, Zhiqiang Hou <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>> wrote:
>> > From: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>> >
>> > Make SPI controller can get address width of the SPI device.
>>
>> What does "address wdith" mean? From your other patches, I infer it's
>> either
>> 24 or 32 bit addressing as used by nor-jedec ("m25p80").
>> Why does the generic spi_message needs to have nor-jedec-specific fields?
>
> Yes, the address width is the address width of spi flash.
> The reason to add this nor-jedec-specific field to spi_message is the eSPI controller
> of Freescale limits the MAX transaction length(TRANLEN) to 0x10000 each transaction, so if the
> data size transferred exceed the TRANLEN, the eSPI controller can only transfer data for
> the first TRANLEN, and need to issue new write/read commands to complete the remainders.
> So, eSPI controller need getting the address width of spi flash, and then calculate the
> new address to initialize the new write/read commands.
Shouldn't this be handled by the m25p80 driver instead?
I see spi_master has a max_dma_len field.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] 11+ messages in thread
* RE: [PATCH 1/3] spi: Add addr_width field to struct spi_message
[not found] ` <CAMuHMdUzkr6_evPD5y-gaH=rtEgyZ+bHAddD+UmpTssQXZry1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-05-12 8:27 ` Hou Zhiqiang
[not found] ` <CY1PR0301MB078056CF0855A97334FD96458BDA0-YrwGdl+PljnwWZenWrSUgZwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Hou Zhiqiang @ 2015-05-12 8:27 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-spi, Mark Brown, Hu Vincent
> -----Original Message-----
> From: geert.uytterhoeven@gmail.com [mailto:geert.uytterhoeven@gmail.com]
> On Behalf Of Geert Uytterhoeven
> Sent: 2015年5月12日 16:12
> To: Hou Zhiqiang-B48286
> Cc: linux-spi; Mark Brown; Hu Mingkai-B21284
> Subject: Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
>
> Hi Zhiqiang,
>
> On Tue, May 12, 2015 at 10:06 AM, Hou Zhiqiang <B48286@freescale.com>
> wrote:
> >> From: geert.uytterhoeven@gmail.com
> >> [mailto:geert.uytterhoeven@gmail.com]
> >> On Behalf Of Geert Uytterhoeven
> >> Sent: 2015年5月11日 15:43
> >> To: Hou Zhiqiang-B48286
> >> Cc: linux-spi; Mark Brown; Hu Mingkai-B21284
> >> Subject: Re: [PATCH 1/3] spi: Add addr_width field to struct
> >> spi_message
> >>
> >> On Sun, May 10, 2015 at 4:47 PM, Zhiqiang Hou <B48286@freescale.com>
> >> wrote:
> >> > From: Hou Zhiqiang <B48286@freescale.com>
> >> >
> >> > Make SPI controller can get address width of the SPI device.
> >>
> >> What does "address wdith" mean? From your other patches, I infer it's
> >> either
> >> 24 or 32 bit addressing as used by nor-jedec ("m25p80").
> >> Why does the generic spi_message needs to have nor-jedec-specific
> fields?
> >
> > Yes, the address width is the address width of spi flash.
> > The reason to add this nor-jedec-specific field to spi_message is the
> > eSPI controller of Freescale limits the MAX transaction
> > length(TRANLEN) to 0x10000 each transaction, so if the data size
> > transferred exceed the TRANLEN, the eSPI controller can only transfer
> data for the first TRANLEN, and need to issue new write/read commands to
> complete the remainders.
> > So, eSPI controller need getting the address width of spi flash, and
> > then calculate the new address to initialize the new write/read
> commands.
>
> Shouldn't this be handled by the m25p80 driver instead?
>
> I see spi_master has a max_dma_len field.
No, only the eSPI controller need to do this, it caused by the eSPI controller's
feature and other SPI controller have not this TRANLEN limit.
And it has no relation with DMA.
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
>
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
> -- Linus Torvalds
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
[not found] ` <CY1PR0301MB078056CF0855A97334FD96458BDA0-YrwGdl+PljnwWZenWrSUgZwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
@ 2015-05-12 8:57 ` Geert Uytterhoeven
[not found] ` <CAMuHMdXFY_W6Rd37rNeNUnztZ=8xUcZBS3=eLQwK52N6byGgBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-05-12 8:57 UTC (permalink / raw)
To: Hou Zhiqiang; +Cc: linux-spi, Mark Brown, Hu Vincent
Hi Zhiqiang,
On Tue, May 12, 2015 at 10:27 AM, Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
>> -----Original Message-----
>> From: geert.uytterhoeven-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [mailto:geert.uytterhoeven@gmail.com]
>> On Behalf Of Geert Uytterhoeven
>> Sent: 2015年5月12日 16:12
>> To: Hou Zhiqiang-B48286
>> Cc: linux-spi; Mark Brown; Hu Mingkai-B21284
>> Subject: Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
>>
>> On Tue, May 12, 2015 at 10:06 AM, Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>> wrote:
>> >> From: geert.uytterhoeven-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> >> [mailto:geert.uytterhoeven-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
>> >> On Behalf Of Geert Uytterhoeven
>> >> Sent: 2015年5月11日 15:43
>> >> To: Hou Zhiqiang-B48286
>> >> Cc: linux-spi; Mark Brown; Hu Mingkai-B21284
>> >> Subject: Re: [PATCH 1/3] spi: Add addr_width field to struct
>> >> spi_message
>> >>
>> >> On Sun, May 10, 2015 at 4:47 PM, Zhiqiang Hou <B48286@freescale.com>
>> >> wrote:
>> >> > From: Hou Zhiqiang <B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>> >> >
>> >> > Make SPI controller can get address width of the SPI device.
>> >>
>> >> What does "address wdith" mean? From your other patches, I infer it's
>> >> either
>> >> 24 or 32 bit addressing as used by nor-jedec ("m25p80").
>> >> Why does the generic spi_message needs to have nor-jedec-specific
>> fields?
>> >
>> > Yes, the address width is the address width of spi flash.
>> > The reason to add this nor-jedec-specific field to spi_message is the
>> > eSPI controller of Freescale limits the MAX transaction
>> > length(TRANLEN) to 0x10000 each transaction, so if the data size
>> > transferred exceed the TRANLEN, the eSPI controller can only transfer
>> data for the first TRANLEN, and need to issue new write/read commands to
>> complete the remainders.
>> > So, eSPI controller need getting the address width of spi flash, and
>> > then calculate the new address to initialize the new write/read
>> commands.
>>
>> Shouldn't this be handled by the m25p80 driver instead?
>>
>> I see spi_master has a max_dma_len field.
>
> No, only the eSPI controller need to do this, it caused by the eSPI controller's
> feature and other SPI controller have not this TRANLEN limit.
> And it has no relation with DMA.
IC.
Still, your doing m25p80-specific handling in your spi master driver.
Worse, you cannot connect any other type of spi device to your spi controller,
right?
So it looks like we need something like i2c_adapter_quirks, where spi masters
can advertise their limitations?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] 11+ messages in thread
* Re: [PATCH 1/3] spi: Add addr_width field to struct spi_message
[not found] ` <CAMuHMdXFY_W6Rd37rNeNUnztZ=8xUcZBS3=eLQwK52N6byGgBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-05-12 10:23 ` Mark Brown
0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2015-05-12 10:23 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Hou Zhiqiang, linux-spi, Hu Vincent
[-- Attachment #1: Type: text/plain, Size: 283 bytes --]
On Tue, May 12, 2015 at 10:57:03AM +0200, Geert Uytterhoeven wrote:
> So it looks like we need something like i2c_adapter_quirks, where spi masters
> can advertise their limitations?
We already have some flags for features/limitations (mostly only used by
the core) like _MUST_TX.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-05-12 10:23 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-10 14:47 [PATCH 1/3] spi: Add addr_width field to struct spi_message Zhiqiang Hou
[not found] ` <1431269253-22890-1-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-10 14:47 ` [PATCH 2/3] mtd: m25p80: Initialize the addr_width field of spi_message Zhiqiang Hou
2015-05-10 14:47 ` [PATCH 3/3] spi/fsl-espi: Add the 4Byte address width device support Zhiqiang Hou
[not found] ` <1431269253-22890-3-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-11 7:45 ` Geert Uytterhoeven
2015-05-11 7:43 ` [PATCH 1/3] spi: Add addr_width field to struct spi_message Geert Uytterhoeven
[not found] ` <CAMuHMdUakeDgLZ4hXe0DBu97Xx4eiC9K_Qfc-imkDBrDBXNs6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-11 16:17 ` Mark Brown
2015-05-12 8:06 ` Hou Zhiqiang
[not found] ` <CY1PR0301MB0780A4057DBB4DEBC45A631F8BDA0-YrwGdl+PljnwWZenWrSUgZwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2015-05-12 8:11 ` Geert Uytterhoeven
[not found] ` <CAMuHMdUzkr6_evPD5y-gaH=rtEgyZ+bHAddD+UmpTssQXZry1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-12 8:27 ` Hou Zhiqiang
[not found] ` <CY1PR0301MB078056CF0855A97334FD96458BDA0-YrwGdl+PljnwWZenWrSUgZwN6zqB+hSMnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2015-05-12 8:57 ` Geert Uytterhoeven
[not found] ` <CAMuHMdXFY_W6Rd37rNeNUnztZ=8xUcZBS3=eLQwK52N6byGgBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-12 10:23 ` Mark Brown
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).