linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Daniel Mack <daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>,
	Haojian Zhuang
	<haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andy Shevchenko
	<andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: Re: [PATCH 6/7] spi: pxa2xx: Add support for multiple LPSS chip select signals
Date: Mon, 26 Oct 2015 11:35:04 +0200	[thread overview]
Message-ID: <562DF3C8.1060401@linux.intel.com> (raw)
In-Reply-To: <87bnbnkvg9.fsf-4ty26DBLk+jEm7gnYqmdkQ@public.gmane.org>

On 10/25/2015 02:02 PM, Robert Jarzmik wrote:
> Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> writes:
>
>> LPSS SPI devices in a successor of Intel Sunrisepoint can have up to 4 chip
>                     is ?

Intel Low Power Subsystem SPI host controller(s) after Sunrisepoint can 
have multiple chip selects. I'll clarify this since patch 7/7 outdates 
the comment by adding support for two variants.

>> @@ -64,6 +65,10 @@ MODULE_ALIAS("platform:pxa2xx-spi");
>>   #define GENERAL_REG_RXTO_HOLDOFF_DISABLE	BIT(24)
>>   #define SPI_CS_CONTROL_SW_MODE			BIT(0)
>>   #define SPI_CS_CONTROL_CS_HIGH			BIT(1)
>
>> +#define SPI_CS_CONTROL_CS_SEL_SHIFT		8
>> +#define SPI_CS_CONTROL_CS_SEL_MASK		(3 << SPI_CS_CONTROL_CS_SEL_SHIFT)
>> +#define SPI_CAPS_CS_EN_SHIFT			9
>> +#define SPI_CAPS_CS_EN_MASK			(0xf << SPI_CAPS_CS_EN_SHIFT)
> This is intel specific, not pxa oriented, right ?
> If so, I'd like to have it namespaced, with LPSS or whatever you see fit.
>
Good point. I'll check also couple other existing defines as they are 
LPSS specific.

>> @@ -103,6 +111,7 @@ static const struct lpss_config lpss_platforms[] = {
>>   		.reg_general = -1,
>>   		.reg_ssp = 0x20,
>>   		.reg_cs_ctrl = 0x24,
>> +		.reg_capabilities = 0xfc,
> Immediate value ? I suppose a defines usage was not possible here ?
>
I removed register defines for these three registers earlier when code 
started accessing registers using this configuration data. There are 
differences in these registers between platforms and it didn't look much 
clearer to have separate defines for them.

>> @@ -271,15 +280,34 @@ static void lpss_ssp_setup(struct driver_data *drv_data)
>>   static void lpss_ssp_cs_control(struct driver_data *drv_data, bool enable)
>>   {
>>   	const struct lpss_config *config;
>> -	u32 value;
>> +	u32 value, cs;
>>
>>   	config = lpss_get_config(drv_data);
>>
>>   	value = __lpss_ssp_read_priv(drv_data, config->reg_cs_ctrl);
>> -	if (enable)
>> +	if (enable) {
>> +		cs = drv_data->cur_msg->spi->chip_select;
>> +		cs <<= SPI_CS_CONTROL_CS_SEL_SHIFT;
>> +		if (cs != (value & SPI_CS_CONTROL_CS_SEL_MASK)) {
>> +			/*
>> +			 * When switching another chip select output active
>> +			 * the output must be selected first and wait 2 ssp_clk
>> +			 * cycles before changing state to active. Otherwise
>> +			 * a short glitch will occur on the previous chip
>> +			 * select since output select is latched but state
>> +			 * control is not.
>> +			 */
>> +			value &= ~SPI_CS_CONTROL_CS_SEL_MASK;
>> +			value |= cs;
>> +			__lpss_ssp_write_priv(drv_data,
>> +					      config->reg_cs_ctrl, value);
>> +			ndelay(1000000000 /
>> +			       (drv_data->master->max_speed_hz / 2));
> That ndelay() looks weird, why delay and not sleep ?
> And wouldn't that be targeted at another patch ? If I got it right, this patch
> deals with capabilites, not chip select timings, doesn't it ?
>
Typically we are seeing input clock of SSP being around a few or tens of 
megahertz so sleep instead of <1 us delay would slow down the transfers 
needlessly.

That said, we may have a need to change this to use delay or sleep 
conditionally later. Andy has been looking at changing input clock 
according to transfer speed which means that needed delay can be up to 
milliseconds if we use really low transfer speed.

Actually this patch deals with output control and number of chip select 
detection. Maybe it calls for two patches. Output control prepares for 
multiple chip selects and detection adds actual support for them.

-- 
Jarkko
--
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

  parent reply	other threads:[~2015-10-26  9:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 13:44 [PATCH 1/7] spi: pxa2xx: move debug messages to pump_transfer() Jarkko Nikula
     [not found] ` <1445521485-2029-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-22 13:44   ` [PATCH 2/7] spi: pxa2xx: derive struct chip_data from struct drv_data Jarkko Nikula
     [not found]     ` <1445521485-2029-2-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-22 23:57       ` Applied "spi: pxa2xx: derive struct chip_data from struct drv_data" to the spi tree Mark Brown
2015-10-25 11:42       ` [PATCH 2/7] spi: pxa2xx: derive struct chip_data from struct drv_data Robert Jarzmik
2015-10-22 13:44   ` [PATCH 3/7] spi: pxa2xx: Convert unique ID string of ACPI device as unsigned integer Jarkko Nikula
     [not found]     ` <1445521485-2029-3-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-22 23:57       ` Applied "spi: pxa2xx: Convert unique ID string of ACPI device as unsigned integer" to the spi tree Mark Brown
2015-10-22 13:44   ` [PATCH 4/7] spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select Jarkko Nikula
     [not found]     ` <1445521485-2029-4-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-22 23:57       ` Applied "spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select" to the spi tree Mark Brown
2015-10-25 11:49       ` [PATCH 4/7] spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select Robert Jarzmik
2015-10-22 13:44   ` [PATCH 5/7] spi: pxa2xx: Align a few defines Jarkko Nikula
     [not found]     ` <1445521485-2029-5-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-22 23:57       ` Applied "spi: pxa2xx: Align a few defines" to the spi tree Mark Brown
2015-10-25 11:50       ` [PATCH 5/7] spi: pxa2xx: Align a few defines Robert Jarzmik
2015-10-22 13:44   ` [PATCH 6/7] spi: pxa2xx: Add support for multiple LPSS chip select signals Jarkko Nikula
     [not found]     ` <1445521485-2029-6-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-25 12:02       ` Robert Jarzmik
     [not found]         ` <87bnbnkvg9.fsf-4ty26DBLk+jEm7gnYqmdkQ@public.gmane.org>
2015-10-26  9:35           ` Jarkko Nikula [this message]
2015-10-22 13:44   ` [PATCH 7/7] spi: pxa2xx: Add support for Intel Broxton Jarkko Nikula
     [not found]     ` <1445521485-2029-7-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-10-30  2:20       ` Mark Brown
2015-10-22 23:57   ` Applied "spi: pxa2xx: move debug messages to pump_transfer()" to the spi tree Mark Brown
2015-10-25 11:39   ` [PATCH 1/7] spi: pxa2xx: move debug messages to pump_transfer() Robert Jarzmik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562DF3C8.1060401@linux.intel.com \
    --to=jarkko.nikula-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org \
    --cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robert.jarzmik-GANU6spQydw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).