linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
@ 2014-01-15  7:57 Axel Lin
       [not found] ` <5EB3BFCD089AD643B9BB63439F5FD5E9012BC102FB@SHAASIEXM01.ASIA.ROOT.PRI>
  0 siblings, 1 reply; 8+ messages in thread
From: Axel Lin @ 2014-01-15  7:57 UTC (permalink / raw)
  To: Mark Brown
  Cc: Zhiwu Song, Barry Song, Qipan Li,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

Trivial cleanup to avoid duplicate code in various bits_per_word cases.

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-sirf.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index ed5e501..787683d 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -459,11 +459,6 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
 		regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_8;
 		sspi->rx_word = spi_sirfsoc_rx_word_u8;
 		sspi->tx_word = spi_sirfsoc_tx_word_u8;
-		txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
-					SIRFSOC_SPI_FIFO_WIDTH_BYTE;
-		rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
-					SIRFSOC_SPI_FIFO_WIDTH_BYTE;
-		sspi->word_width = 1;
 		break;
 	case 12:
 	case 16:
@@ -471,26 +466,22 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
 			SIRFSOC_SPI_TRAN_DAT_FORMAT_16;
 		sspi->rx_word = spi_sirfsoc_rx_word_u16;
 		sspi->tx_word = spi_sirfsoc_tx_word_u16;
-		txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
-					SIRFSOC_SPI_FIFO_WIDTH_WORD;
-		rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
-					SIRFSOC_SPI_FIFO_WIDTH_WORD;
-		sspi->word_width = 2;
 		break;
 	case 32:
 		regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_32;
 		sspi->rx_word = spi_sirfsoc_rx_word_u32;
 		sspi->tx_word = spi_sirfsoc_tx_word_u32;
-		txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
-					SIRFSOC_SPI_FIFO_WIDTH_DWORD;
-		rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
-					SIRFSOC_SPI_FIFO_WIDTH_DWORD;
-		sspi->word_width = 4;
 		break;
 	default:
 		BUG();
 	}
 
+	txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
+					   SIRFSOC_SPI_FIFO_WIDTH_WORD;
+	rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
+					   SIRFSOC_SPI_FIFO_WIDTH_WORD;
+	sspi->word_width = DIV_ROUND_UP(bits_per_word, 8);
+
 	if (!(spi->mode & SPI_CS_HIGH))
 		regval |= SIRFSOC_SPI_CS_IDLE_STAT;
 	if (!(spi->mode & SPI_LSB_FIRST))
-- 
1.8.1.2



--
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] 8+ messages in thread

* Re: FW: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
       [not found]   ` <5EB3BFCD089AD643B9BB63439F5FD5E9012BC102FB-W2enlP78h2wYZnBWG7VmBdnKn0HB1kRyVQQcQy+6Uvc@public.gmane.org>
@ 2014-01-15  8:30     ` Barry Song
       [not found]       ` <CAGsJ_4xu2g3K7D-QumwJBCxTvwc06GLE_Mz8uLyAKpHOLgq2Sw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Barry Song @ 2014-01-15  8:30 UTC (permalink / raw)
  To: Axel Lin, Mark Brown
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Qipan Li, Zhiwu Song,
	DL-SHA-WorkGroupLinux

2014/1/15 Barry Song <Barry.Song-kQvG35nSl+M@public.gmane.org>:
>
>
>> -----Original Message-----
>> From: Axel Lin [mailto:axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org]
>> Sent: Wednesday, January 15, 2014 3:57 PM
>> To: Mark Brown
>> Cc: Zhiwu Song; Barry Song; Qipan Li; linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Subject: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word
>> cases
>>
>> Trivial cleanup to avoid duplicate code in various bits_per_word cases.
>>
>> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
>> ---
>>  drivers/spi/spi-sirf.c | 21 ++++++---------------
>>  1 file changed, 6 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index
>> ed5e501..787683d 100644
>> --- a/drivers/spi/spi-sirf.c
>> +++ b/drivers/spi/spi-sirf.c
>> @@ -459,11 +459,6 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi,
>> struct spi_transfer *t)
>>               regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_8;
>>               sspi->rx_word = spi_sirfsoc_rx_word_u8;
>>               sspi->tx_word = spi_sirfsoc_tx_word_u8;
>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>> / 2) |
>> -                                     SIRFSOC_SPI_FIFO_WIDTH_BYTE;
>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>> / 2) |
>> -                                     SIRFSOC_SPI_FIFO_WIDTH_BYTE;
>> -             sspi->word_width = 1;
>>               break;
>>       case 12:
>>       case 16:
>> @@ -471,26 +466,22 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi,
>> struct spi_transfer *t)
>>                       SIRFSOC_SPI_TRAN_DAT_FORMAT_16;
>>               sspi->rx_word = spi_sirfsoc_rx_word_u16;
>>               sspi->tx_word = spi_sirfsoc_tx_word_u16;
>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>> / 2) |
>> -                                     SIRFSOC_SPI_FIFO_WIDTH_WORD;
>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>> / 2) |
>> -                                     SIRFSOC_SPI_FIFO_WIDTH_WORD;
>> -             sspi->word_width = 2;
>>               break;
>>       case 32:
>>               regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_32;
>>               sspi->rx_word = spi_sirfsoc_rx_word_u32;
>>               sspi->tx_word = spi_sirfsoc_tx_word_u32;
>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>> / 2) |
>> -                                     SIRFSOC_SPI_FIFO_WIDTH_DWORD;
>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>> / 2) |
>> -                                     SIRFSOC_SPI_FIFO_WIDTH_DWORD;
>> -             sspi->word_width = 4;
>>               break;
>>       default:
>>               BUG();
>>       }
>>
>> +     txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>> +                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>> +     rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>> +                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>> +     sspi->word_width = DIV_ROUND_UP(bits_per_word, 8);
>> +

Axel, thanks.
it is a good cleanup, but it seems it is not right for txfifo_ctrl and
rxfifo_ctrl?


>>       if (!(spi->mode & SPI_CS_HIGH))
>>               regval |= SIRFSOC_SPI_CS_IDLE_STAT;
>>       if (!(spi->mode & SPI_LSB_FIRST))
>> --
>> 1.8.1.2
>>

-barry
--
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] 8+ messages in thread

* Re: FW: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
       [not found]       ` <CAGsJ_4xu2g3K7D-QumwJBCxTvwc06GLE_Mz8uLyAKpHOLgq2Sw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-01-15  8:35         ` Axel Lin
       [not found]           ` <CAFRkauB7DrFy-v0+14PcKjan4YxFiTzC5OruiaHC7mFdDmOXoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Axel Lin @ 2014-01-15  8:35 UTC (permalink / raw)
  To: Barry Song
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Qipan Li,
	Zhiwu Song, DL-SHA-WorkGroupLinux

2014/1/15 Barry Song <21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> 2014/1/15 Barry Song <Barry.Song-kQvG35nSl+M@public.gmane.org>:
>>
>>
>>> -----Original Message-----
>>> From: Axel Lin [mailto:axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org]
>>> Sent: Wednesday, January 15, 2014 3:57 PM
>>> To: Mark Brown
>>> Cc: Zhiwu Song; Barry Song; Qipan Li; linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Subject: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word
>>> cases
>>>
>>> Trivial cleanup to avoid duplicate code in various bits_per_word cases.
>>>
>>> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
>>> ---
>>>  drivers/spi/spi-sirf.c | 21 ++++++---------------
>>>  1 file changed, 6 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index
>>> ed5e501..787683d 100644
>>> --- a/drivers/spi/spi-sirf.c
>>> +++ b/drivers/spi/spi-sirf.c
>>> @@ -459,11 +459,6 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi,
>>> struct spi_transfer *t)
>>>               regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_8;
>>>               sspi->rx_word = spi_sirfsoc_rx_word_u8;
>>>               sspi->tx_word = spi_sirfsoc_tx_word_u8;
>>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>> / 2) |
>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_BYTE;
>>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>> / 2) |
>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_BYTE;
>>> -             sspi->word_width = 1;
>>>               break;
>>>       case 12:
>>>       case 16:
>>> @@ -471,26 +466,22 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi,
>>> struct spi_transfer *t)
>>>                       SIRFSOC_SPI_TRAN_DAT_FORMAT_16;
>>>               sspi->rx_word = spi_sirfsoc_rx_word_u16;
>>>               sspi->tx_word = spi_sirfsoc_tx_word_u16;
>>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>> / 2) |
>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>> / 2) |
>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>> -             sspi->word_width = 2;
>>>               break;
>>>       case 32:
>>>               regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_32;
>>>               sspi->rx_word = spi_sirfsoc_rx_word_u32;
>>>               sspi->tx_word = spi_sirfsoc_tx_word_u32;
>>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>> / 2) |
>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_DWORD;
>>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>> / 2) |
>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_DWORD;
>>> -             sspi->word_width = 4;
>>>               break;
>>>       default:
>>>               BUG();
>>>       }
>>>
>>> +     txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>> +                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>> +     rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>> +                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>> +     sspi->word_width = DIV_ROUND_UP(bits_per_word, 8);
>>> +
>
> Axel, thanks.
> it is a good cleanup, but it seems it is not right for txfifo_ctrl and
> rxfifo_ctrl?

I don't get it.
I thought there is no functional change with this patch.

Regards,
Axel
--
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] 8+ messages in thread

* Re: FW: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
       [not found]           ` <CAFRkauB7DrFy-v0+14PcKjan4YxFiTzC5OruiaHC7mFdDmOXoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-01-15  8:42             ` Barry Song
  2014-01-15  8:46               ` Axel Lin
  0 siblings, 1 reply; 8+ messages in thread
From: Barry Song @ 2014-01-15  8:42 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Qipan Li,
	Zhiwu Song, DL-SHA-WorkGroupLinux

2014/1/15 Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>:
> 2014/1/15 Barry Song <21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>> 2014/1/15 Barry Song <Barry.Song-kQvG35nSl+M@public.gmane.org>:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Axel Lin [mailto:axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org]
>>>> Sent: Wednesday, January 15, 2014 3:57 PM
>>>> To: Mark Brown
>>>> Cc: Zhiwu Song; Barry Song; Qipan Li; linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>>> Subject: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word
>>>> cases
>>>>
>>>> Trivial cleanup to avoid duplicate code in various bits_per_word cases.
>>>>
>>>> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
>>>> ---
>>>>  drivers/spi/spi-sirf.c | 21 ++++++---------------
>>>>  1 file changed, 6 insertions(+), 15 deletions(-)
>>>>
>>>> diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index
>>>> ed5e501..787683d 100644
>>>> --- a/drivers/spi/spi-sirf.c
>>>> +++ b/drivers/spi/spi-sirf.c
>>>> @@ -459,11 +459,6 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi,
>>>> struct spi_transfer *t)
>>>>               regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_8;
>>>>               sspi->rx_word = spi_sirfsoc_rx_word_u8;
>>>>               sspi->tx_word = spi_sirfsoc_tx_word_u8;
>>>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>>> / 2) |
>>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_BYTE;
>>>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>>> / 2) |
>>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_BYTE;
>>>> -             sspi->word_width = 1;
>>>>               break;
>>>>       case 12:
>>>>       case 16:
>>>> @@ -471,26 +466,22 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi,
>>>> struct spi_transfer *t)
>>>>                       SIRFSOC_SPI_TRAN_DAT_FORMAT_16;
>>>>               sspi->rx_word = spi_sirfsoc_rx_word_u16;
>>>>               sspi->tx_word = spi_sirfsoc_tx_word_u16;
>>>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>>> / 2) |
>>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>>> / 2) |
>>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>>> -             sspi->word_width = 2;
>>>>               break;
>>>>       case 32:
>>>>               regval |= SIRFSOC_SPI_TRAN_DAT_FORMAT_32;
>>>>               sspi->rx_word = spi_sirfsoc_rx_word_u32;
>>>>               sspi->tx_word = spi_sirfsoc_tx_word_u32;
>>>> -             txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>>> / 2) |
>>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_DWORD;
>>>> -             rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE
>>>> / 2) |
>>>> -                                     SIRFSOC_SPI_FIFO_WIDTH_DWORD;
>>>> -             sspi->word_width = 4;
>>>>               break;
>>>>       default:
>>>>               BUG();
>>>>       }
>>>>
>>>> +     txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>>> +                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>>> +     rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>>> +                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>>> +     sspi->word_width = DIV_ROUND_UP(bits_per_word, 8);
>>>> +
>>
>> Axel, thanks.
>> it is a good cleanup, but it seems it is not right for txfifo_ctrl and
>> rxfifo_ctrl?
>
> I don't get it.
> I thought there is no functional change with this patch.

you might want to change

 txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
 rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
                                       SIRFSOC_SPI_FIFO_WIDTH_WORD;

to "SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2)  I sspi->word_width" ?

>
> Regards,
> Axel

-barry
--
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] 8+ messages in thread

* Re: FW: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
  2014-01-15  8:42             ` Barry Song
@ 2014-01-15  8:46               ` Axel Lin
       [not found]                 ` <CAFRkauCK3JJcmSx_1xi_EteY48o7vaatjBTp0L5xF-bRS+JF6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Axel Lin @ 2014-01-15  8:46 UTC (permalink / raw)
  To: Barry Song
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Qipan Li,
	Zhiwu Song, DL-SHA-WorkGroupLinux

>>> Axel, thanks.
>>> it is a good cleanup, but it seems it is not right for txfifo_ctrl and
>>> rxfifo_ctrl?
>>
>> I don't get it.
>> I thought there is no functional change with this patch.
>
> you might want to change
>
>  txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>                                         SIRFSOC_SPI_FIFO_WIDTH_WORD;
>  rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>
> to "SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2)  I sspi->word_width" ?
So it is a bug in original code, right? (I mean a bug before applying
this patch.)
I'll re-generate the patch and separate it to 2 patches.
( one for bug fix which may need for stable, the other one for the clean up)

Thanks,
Axel
--
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] 8+ messages in thread

* Re: FW: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
       [not found]                 ` <CAFRkauCK3JJcmSx_1xi_EteY48o7vaatjBTp0L5xF-bRS+JF6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-01-15  8:48                   ` Barry Song
       [not found]                     ` <CAGsJ_4wp+wcPTOpCfxe61uuQ2xkY4HkKCd2OD9wF=oPaP-U9mg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2014-01-15  8:48                   ` Axel Lin
  1 sibling, 1 reply; 8+ messages in thread
From: Barry Song @ 2014-01-15  8:48 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Qipan Li,
	Zhiwu Song, DL-SHA-WorkGroupLinux

2014/1/15 Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>:
>>>> Axel, thanks.
>>>> it is a good cleanup, but it seems it is not right for txfifo_ctrl and
>>>> rxfifo_ctrl?
>>>
>>> I don't get it.
>>> I thought there is no functional change with this patch.
>>
>> you might want to change
>>
>>  txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>                                         SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>  rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>
>> to "SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2)  I sspi->word_width" ?
> So it is a bug in original code, right? (I mean a bug before applying
> this patch.)
> I'll re-generate the patch and separate it to 2 patches.
> ( one for bug fix which may need for stable, the other one for the clean up)

no. the original codes are right. because it does orr with:
SIRFSOC_SPI_FIFO_WIDTH_BYTE;
SIRFSOC_SPI_FIFO_WIDTH_WORD;
SIRFSOC_SPI_FIFO_WIDTH_DWORD;

but you move to orr
SIRFSOC_SPI_FIFO_WIDTH_WORD

actually, the register set is fortunately same with the real width.

>
> Thanks,
> Axel

-barry
--
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] 8+ messages in thread

* Re: FW: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
       [not found]                 ` <CAFRkauCK3JJcmSx_1xi_EteY48o7vaatjBTp0L5xF-bRS+JF6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2014-01-15  8:48                   ` Barry Song
@ 2014-01-15  8:48                   ` Axel Lin
  1 sibling, 0 replies; 8+ messages in thread
From: Axel Lin @ 2014-01-15  8:48 UTC (permalink / raw)
  To: Barry Song
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Qipan Li,
	Zhiwu Song, DL-SHA-WorkGroupLinux

2014/1/15 Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>:
>>>> Axel, thanks.
>>>> it is a good cleanup, but it seems it is not right for txfifo_ctrl and
>>>> rxfifo_ctrl?
>>>
>>> I don't get it.
>>> I thought there is no functional change with this patch.
>>
>> you might want to change
>>
>>  txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>                                         SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>  rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>
>> to "SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2)  I sspi->word_width" ?
> So it is a bug in original code, right? (I mean a bug before applying
> this patch.)
> I'll re-generate the patch and separate it to 2 patches.
> ( one for bug fix which may need for stable, the other one for the clean up)

Sorry. Current code is ok.
But my patch breaks things.
Pls just ignore the patch.

Regards,
Axel
--
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] 8+ messages in thread

* Re: FW: [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases
       [not found]                     ` <CAGsJ_4wp+wcPTOpCfxe61uuQ2xkY4HkKCd2OD9wF=oPaP-U9mg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-01-15  8:52                       ` Axel Lin
  0 siblings, 0 replies; 8+ messages in thread
From: Axel Lin @ 2014-01-15  8:52 UTC (permalink / raw)
  To: Barry Song
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Qipan Li,
	Zhiwu Song, DL-SHA-WorkGroupLinux

2014/1/15 Barry Song <21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> 2014/1/15 Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>:
>>>>> Axel, thanks.
>>>>> it is a good cleanup, but it seems it is not right for txfifo_ctrl and
>>>>> rxfifo_ctrl?
>>>>
>>>> I don't get it.
>>>> I thought there is no functional change with this patch.
>>>
>>> you might want to change
>>>
>>>  txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>>                                         SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>>  rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
>>>                                        SIRFSOC_SPI_FIFO_WIDTH_WORD;
>>>
>>> to "SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2)  I sspi->word_width" ?
>> So it is a bug in original code, right? (I mean a bug before applying
>> this patch.)
>> I'll re-generate the patch and separate it to 2 patches.
>> ( one for bug fix which may need for stable, the other one for the clean up)
>
> no. the original codes are right. because it does orr with:
> SIRFSOC_SPI_FIFO_WIDTH_BYTE;
> SIRFSOC_SPI_FIFO_WIDTH_WORD;
> SIRFSOC_SPI_FIFO_WIDTH_DWORD;
>
> but you move to orr
> SIRFSOC_SPI_FIFO_WIDTH_WORD
>
> actually, the register set is fortunately same with the real width.
Yes, I see it now.
v2 is on the way.

Thanks for the review,
Axel
--
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] 8+ messages in thread

end of thread, other threads:[~2014-01-15  8:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15  7:57 [PATCH] spi: sirf: Avoid duplicate code in various bits_per_word cases Axel Lin
     [not found] ` <5EB3BFCD089AD643B9BB63439F5FD5E9012BC102FB@SHAASIEXM01.ASIA.ROOT.PRI>
     [not found]   ` <5EB3BFCD089AD643B9BB63439F5FD5E9012BC102FB-W2enlP78h2wYZnBWG7VmBdnKn0HB1kRyVQQcQy+6Uvc@public.gmane.org>
2014-01-15  8:30     ` FW: " Barry Song
     [not found]       ` <CAGsJ_4xu2g3K7D-QumwJBCxTvwc06GLE_Mz8uLyAKpHOLgq2Sw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-15  8:35         ` Axel Lin
     [not found]           ` <CAFRkauB7DrFy-v0+14PcKjan4YxFiTzC5OruiaHC7mFdDmOXoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-15  8:42             ` Barry Song
2014-01-15  8:46               ` Axel Lin
     [not found]                 ` <CAFRkauCK3JJcmSx_1xi_EteY48o7vaatjBTp0L5xF-bRS+JF6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-15  8:48                   ` Barry Song
     [not found]                     ` <CAGsJ_4wp+wcPTOpCfxe61uuQ2xkY4HkKCd2OD9wF=oPaP-U9mg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-15  8:52                       ` Axel Lin
2014-01-15  8:48                   ` Axel Lin

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).