All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17  1:47 ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2014-03-17  1:47 UTC (permalink / raw)
  To: linux-spi; +Cc: linux-kernel, Mark Brown, Guenter Roeck, Axel Lin

Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
transfer speed) made the maximum transfer speed much more restrictive
than before. The transfer speed used to be adjusted to 1/4 of the chip
clock rate if a higher transfer speed was requested. Now such transfers are
simply rejected. With default settings, this causes, for example, a transfer
request at 2 mbps to be rejected because the maximum speed with the default
chip clock is 1.843 mbps.

This is unnecessarily restrictive and causes unnecessary failures. Loosen
the limit to accept transfers up to 50% of the clock rate and adjust
the speed as needed when setting up the actualt transfer.

Cc: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
This patch applies to the tip of linux-next.

 drivers/spi/spi-sc18is602.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
index 237f2e7..f0e55aa 100644
--- a/drivers/spi/spi-sc18is602.c
+++ b/drivers/spi/spi-sc18is602.c
@@ -297,7 +297,7 @@ static int sc18is602_probe(struct i2c_client *client,
 	master->transfer_one_message = sc18is602_transfer_one;
 	master->dev.of_node = np;
 	master->min_speed_hz = hw->freq / 128;
-	master->max_speed_hz = hw->freq / 4;
+	master->max_speed_hz = hw->freq / 2;
 
 	error = devm_spi_register_master(dev, master);
 	if (error)
-- 
1.7.9.7


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17  1:47 ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2014-03-17  1:47 UTC (permalink / raw)
  To: linux-spi-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Brown, Guenter Roeck, Axel Lin

Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
transfer speed) made the maximum transfer speed much more restrictive
than before. The transfer speed used to be adjusted to 1/4 of the chip
clock rate if a higher transfer speed was requested. Now such transfers are
simply rejected. With default settings, this causes, for example, a transfer
request at 2 mbps to be rejected because the maximum speed with the default
chip clock is 1.843 mbps.

This is unnecessarily restrictive and causes unnecessary failures. Loosen
the limit to accept transfers up to 50% of the clock rate and adjust
the speed as needed when setting up the actualt transfer.

Cc: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
---
This patch applies to the tip of linux-next.

 drivers/spi/spi-sc18is602.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
index 237f2e7..f0e55aa 100644
--- a/drivers/spi/spi-sc18is602.c
+++ b/drivers/spi/spi-sc18is602.c
@@ -297,7 +297,7 @@ static int sc18is602_probe(struct i2c_client *client,
 	master->transfer_one_message = sc18is602_transfer_one;
 	master->dev.of_node = np;
 	master->min_speed_hz = hw->freq / 128;
-	master->max_speed_hz = hw->freq / 4;
+	master->max_speed_hz = hw->freq / 2;
 
 	error = devm_spi_register_master(dev, master);
 	if (error)
-- 
1.7.9.7

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

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17  2:07   ` Axel Lin
  0 siblings, 0 replies; 12+ messages in thread
From: Axel Lin @ 2014-03-17  2:07 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-spi, linux-kernel, Mark Brown

2014-03-17 9:47 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
> transfer speed) made the maximum transfer speed much more restrictive
> than before. The transfer speed used to be adjusted to 1/4 of the chip
> clock rate if a higher transfer speed was requested. Now such transfers are
> simply rejected. With default settings, this causes, for example, a transfer
> request at 2 mbps to be rejected because the maximum speed with the default
> chip clock is 1.843 mbps.
>
> This is unnecessarily restrictive and causes unnecessary failures. Loosen
> the limit to accept transfers up to 50% of the clock rate and adjust
> the speed as needed when setting up the actualt transfer.

I suppose this controller can only set to SC18IS602_MODE_CLOCK_DIV_4 for the
highest transfer speed. If this is the case, master->max_speed_hz should be
hw->freq / 4.

Now I'm thinking if it is ok to use master->max_speed_hz as transfer speed when
xfer->speed_hz > master->max_speed_hz. And it should be handled in spi core.
I'm sending a RFC patch now.

Regards,
Axel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17  2:07   ` Axel Lin
  0 siblings, 0 replies; 12+ messages in thread
From: Axel Lin @ 2014-03-17  2:07 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Brown

2014-03-17 9:47 GMT+08:00 Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>:
> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
> transfer speed) made the maximum transfer speed much more restrictive
> than before. The transfer speed used to be adjusted to 1/4 of the chip
> clock rate if a higher transfer speed was requested. Now such transfers are
> simply rejected. With default settings, this causes, for example, a transfer
> request at 2 mbps to be rejected because the maximum speed with the default
> chip clock is 1.843 mbps.
>
> This is unnecessarily restrictive and causes unnecessary failures. Loosen
> the limit to accept transfers up to 50% of the clock rate and adjust
> the speed as needed when setting up the actualt transfer.

I suppose this controller can only set to SC18IS602_MODE_CLOCK_DIV_4 for the
highest transfer speed. If this is the case, master->max_speed_hz should be
hw->freq / 4.

Now I'm thinking if it is ok to use master->max_speed_hz as transfer speed when
xfer->speed_hz > master->max_speed_hz. And it should be handled in spi core.
I'm sending a RFC patch now.

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

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17  3:53     ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2014-03-17  3:53 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-spi, linux-kernel, Mark Brown

On 03/16/2014 07:07 PM, Axel Lin wrote:
> 2014-03-17 9:47 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
>> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
>> transfer speed) made the maximum transfer speed much more restrictive
>> than before. The transfer speed used to be adjusted to 1/4 of the chip
>> clock rate if a higher transfer speed was requested. Now such transfers are
>> simply rejected. With default settings, this causes, for example, a transfer
>> request at 2 mbps to be rejected because the maximum speed with the default
>> chip clock is 1.843 mbps.
>>
>> This is unnecessarily restrictive and causes unnecessary failures. Loosen
>> the limit to accept transfers up to 50% of the clock rate and adjust
>> the speed as needed when setting up the actualt transfer.
>
> I suppose this controller can only set to SC18IS602_MODE_CLOCK_DIV_4 for the
> highest transfer speed. If this is the case, master->max_speed_hz should be
> hw->freq / 4.
>

That really depends on one's point of view. The chip does not support a transfer
speed of, say, hw->freq / 5 or hw->freq / 6 either, but adjusts it to the next
available speed. Following your logic, every non-exact speed should be rejected,
which would make it a pain for a user to find a working speed.

> Now I'm thinking if it is ok to use master->max_speed_hz as transfer speed when
> xfer->speed_hz > master->max_speed_hz. And it should be handled in spi core.
> I'm sending a RFC patch now.
>
That is an acceptable alternate solution for me.

Guenter


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17  3:53     ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2014-03-17  3:53 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Brown

On 03/16/2014 07:07 PM, Axel Lin wrote:
> 2014-03-17 9:47 GMT+08:00 Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>:
>> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
>> transfer speed) made the maximum transfer speed much more restrictive
>> than before. The transfer speed used to be adjusted to 1/4 of the chip
>> clock rate if a higher transfer speed was requested. Now such transfers are
>> simply rejected. With default settings, this causes, for example, a transfer
>> request at 2 mbps to be rejected because the maximum speed with the default
>> chip clock is 1.843 mbps.
>>
>> This is unnecessarily restrictive and causes unnecessary failures. Loosen
>> the limit to accept transfers up to 50% of the clock rate and adjust
>> the speed as needed when setting up the actualt transfer.
>
> I suppose this controller can only set to SC18IS602_MODE_CLOCK_DIV_4 for the
> highest transfer speed. If this is the case, master->max_speed_hz should be
> hw->freq / 4.
>

That really depends on one's point of view. The chip does not support a transfer
speed of, say, hw->freq / 5 or hw->freq / 6 either, but adjusts it to the next
available speed. Following your logic, every non-exact speed should be rejected,
which would make it a pain for a user to find a working speed.

> Now I'm thinking if it is ok to use master->max_speed_hz as transfer speed when
> xfer->speed_hz > master->max_speed_hz. And it should be handled in spi core.
> I'm sending a RFC patch now.
>
That is an acceptable alternate solution for me.

Guenter

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

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17 11:27       ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2014-03-17 11:27 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Axel Lin, linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

On Sun, Mar 16, 2014 at 08:53:09PM -0700, Guenter Roeck wrote:
> On 03/16/2014 07:07 PM, Axel Lin wrote:

> >Now I'm thinking if it is ok to use master->max_speed_hz as transfer speed when
> >xfer->speed_hz > master->max_speed_hz. And it should be handled in spi core.
> >I'm sending a RFC patch now.

> That is an acceptable alternate solution for me.

That's what I'd expect, take the maximum possible given the available
constraints.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17 11:27       ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2014-03-17 11:27 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Axel Lin, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

On Sun, Mar 16, 2014 at 08:53:09PM -0700, Guenter Roeck wrote:
> On 03/16/2014 07:07 PM, Axel Lin wrote:

> >Now I'm thinking if it is ok to use master->max_speed_hz as transfer speed when
> >xfer->speed_hz > master->max_speed_hz. And it should be handled in spi core.
> >I'm sending a RFC patch now.

> That is an acceptable alternate solution for me.

That's what I'd expect, take the maximum possible given the available
constraints.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17 11:52   ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2014-03-17 11:52 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-spi, linux-kernel, Axel Lin

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

On Sun, Mar 16, 2014 at 06:47:50PM -0700, Guenter Roeck wrote:
> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
> transfer speed) made the maximum transfer speed much more restrictive
> than before. The transfer speed used to be adjusted to 1/4 of the chip
> clock rate if a higher transfer speed was requested. Now such transfers are
> simply rejected. With default settings, this causes, for example, a transfer
> request at 2 mbps to be rejected because the maximum speed with the default
> chip clock is 1.843 mbps.

> This is unnecessarily restrictive and causes unnecessary failures. Loosen
> the limit to accept transfers up to 50% of the clock rate and adjust
> the speed as needed when setting up the actualt transfer.

Given this description I'd expect to see a change in the core not a
driver - like the other fork of the thread said I'd expect to deal with
the issue by improving the constraint handling code.

>  	master->transfer_one_message = sc18is602_transfer_one;
>  	master->dev.of_node = np;
>  	master->min_speed_hz = hw->freq / 128;
> -	master->max_speed_hz = hw->freq / 4;
> +	master->max_speed_hz = hw->freq / 2;

That said, if this is something that the hardware can support it makes
sense to do it anyway - is there an actual spec constraint available?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17 11:52   ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2014-03-17 11:52 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Axel Lin

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

On Sun, Mar 16, 2014 at 06:47:50PM -0700, Guenter Roeck wrote:
> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
> transfer speed) made the maximum transfer speed much more restrictive
> than before. The transfer speed used to be adjusted to 1/4 of the chip
> clock rate if a higher transfer speed was requested. Now such transfers are
> simply rejected. With default settings, this causes, for example, a transfer
> request at 2 mbps to be rejected because the maximum speed with the default
> chip clock is 1.843 mbps.

> This is unnecessarily restrictive and causes unnecessary failures. Loosen
> the limit to accept transfers up to 50% of the clock rate and adjust
> the speed as needed when setting up the actualt transfer.

Given this description I'd expect to see a change in the core not a
driver - like the other fork of the thread said I'd expect to deal with
the issue by improving the constraint handling code.

>  	master->transfer_one_message = sc18is602_transfer_one;
>  	master->dev.of_node = np;
>  	master->min_speed_hz = hw->freq / 128;
> -	master->max_speed_hz = hw->freq / 4;
> +	master->max_speed_hz = hw->freq / 2;

That said, if this is something that the hardware can support it makes
sense to do it anyway - is there an actual spec constraint available?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17 13:25     ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2014-03-17 13:25 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, linux-kernel, Axel Lin

On 03/17/2014 04:52 AM, Mark Brown wrote:
> On Sun, Mar 16, 2014 at 06:47:50PM -0700, Guenter Roeck wrote:
>> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
>> transfer speed) made the maximum transfer speed much more restrictive
>> than before. The transfer speed used to be adjusted to 1/4 of the chip
>> clock rate if a higher transfer speed was requested. Now such transfers are
>> simply rejected. With default settings, this causes, for example, a transfer
>> request at 2 mbps to be rejected because the maximum speed with the default
>> chip clock is 1.843 mbps.
>
>> This is unnecessarily restrictive and causes unnecessary failures. Loosen
>> the limit to accept transfers up to 50% of the clock rate and adjust
>> the speed as needed when setting up the actualt transfer.
>
> Given this description I'd expect to see a change in the core not a
> driver - like the other fork of the thread said I'd expect to deal with
> the issue by improving the constraint handling code.
>
Agreed.

>>   	master->transfer_one_message = sc18is602_transfer_one;
>>   	master->dev.of_node = np;
>>   	master->min_speed_hz = hw->freq / 128;
>> -	master->max_speed_hz = hw->freq / 4;
>> +	master->max_speed_hz = hw->freq / 2;
>
> That said, if this is something that the hardware can support it makes
> sense to do it anyway - is there an actual spec constraint available?
>

No, the technical fastest transfer speed is hz / 4, so this would be just an
arbitrary limit to be less restrictive. Axel's patch for the spi core works
perfectly, so I would suggest to go with it if that is acceptable for you.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed
@ 2014-03-17 13:25     ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2014-03-17 13:25 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Axel Lin

On 03/17/2014 04:52 AM, Mark Brown wrote:
> On Sun, Mar 16, 2014 at 06:47:50PM -0700, Guenter Roeck wrote:
>> Commit 09e99bca8 (spi: sc18is602: Convert to let spi core validate
>> transfer speed) made the maximum transfer speed much more restrictive
>> than before. The transfer speed used to be adjusted to 1/4 of the chip
>> clock rate if a higher transfer speed was requested. Now such transfers are
>> simply rejected. With default settings, this causes, for example, a transfer
>> request at 2 mbps to be rejected because the maximum speed with the default
>> chip clock is 1.843 mbps.
>
>> This is unnecessarily restrictive and causes unnecessary failures. Loosen
>> the limit to accept transfers up to 50% of the clock rate and adjust
>> the speed as needed when setting up the actualt transfer.
>
> Given this description I'd expect to see a change in the core not a
> driver - like the other fork of the thread said I'd expect to deal with
> the issue by improving the constraint handling code.
>
Agreed.

>>   	master->transfer_one_message = sc18is602_transfer_one;
>>   	master->dev.of_node = np;
>>   	master->min_speed_hz = hw->freq / 128;
>> -	master->max_speed_hz = hw->freq / 4;
>> +	master->max_speed_hz = hw->freq / 2;
>
> That said, if this is something that the hardware can support it makes
> sense to do it anyway - is there an actual spec constraint available?
>

No, the technical fastest transfer speed is hz / 4, so this would be just an
arbitrary limit to be less restrictive. Axel's patch for the spi core works
perfectly, so I would suggest to go with it if that is acceptable for you.

Thanks,
Guenter

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

end of thread, other threads:[~2014-03-17 13:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-17  1:47 [PATCH] spi: sc18is602: Don't be that restrictive with the maximum transfer speed Guenter Roeck
2014-03-17  1:47 ` Guenter Roeck
2014-03-17  2:07 ` Axel Lin
2014-03-17  2:07   ` Axel Lin
2014-03-17  3:53   ` Guenter Roeck
2014-03-17  3:53     ` Guenter Roeck
2014-03-17 11:27     ` Mark Brown
2014-03-17 11:27       ` Mark Brown
2014-03-17 11:52 ` Mark Brown
2014-03-17 11:52   ` Mark Brown
2014-03-17 13:25   ` Guenter Roeck
2014-03-17 13:25     ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.