devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Mark Langsdorf <mark.langsdorf@calxeda.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"tj@kernel.org" <tj@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Pawel Moll <Pawel.Moll@arm.com>,
	"swarren@wwwdotorg.org" <swarren@wwwdotorg.org>,
	"ian.campbell@citrix.com" <ian.campbell@citrix.com>
Subject: Re: [PATCH 5/5] sata, highbank: send extra clock cycles in SGPIO patterns
Date: Fri, 26 Jul 2013 13:34:16 -0500	[thread overview]
Message-ID: <51F2C128.7030905@gmail.com> (raw)
In-Reply-To: <20130726162606.GE3528@e106331-lin.cambridge.arm.com>

On 07/26/2013 11:26 AM, Mark Rutland wrote:
> On Fri, Jul 26, 2013 at 04:11:58PM +0100, Mark Langsdorf wrote:
>> Some SGPIO PICs don't follow the standard very well and expect a
>> certain number of clock cycles or port frames in each SGPIO pattern.
>> Add two optional parameters in the DTB that can provide the number of
>> extra clock cycles to be sent before and after each SGPIO pattern.
>> Read those parameters from the DTB and send the extra clock cycles.
> 
> Is this likely to be very variable, or something we can device based on
> a compatible string?

We have a sample size of 2 to base it on, so there is no way to know.
One slave requires some extra clocks and one doesn't.

The compatible string is based on the SOC block. These properties are
based on the board design.

Rob

> 
>>
>> Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
>> ---
>>  Documentation/devicetree/bindings/ata/sata_highbank.txt |  4 ++++
>>  drivers/ata/sata_highbank.c                             | 16 +++++++++++++---
>>  2 files changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/ata/sata_highbank.txt b/Documentation/devicetree/bindings/ata/sata_highbank.txt
>> index d692e9e..a05eb92 100644
>> --- a/Documentation/devicetree/bindings/ata/sata_highbank.txt
>> +++ b/Documentation/devicetree/bindings/ata/sata_highbank.txt
>> @@ -22,6 +22,10 @@ Optional properties:
>>  			SGPIO bitstream.
>>  - calxeda,tx-atten  : a u8 array that contains TX attenuation override
>>  			codes, one per port.
>> +- calxeda,pre-clocks : a u32 that indicates the number of additional clock
>> +			cycles to transmit before sending an SGPIO pattern
>> +- calxeda,post-clocks: a u32 that indicates the number of additional clock
>> +			cycles to transmit after sending an SGPIO pattern
>>  
>>  Example:
>>          sata@ffe08000 {
>> diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
>> index 4c8444f..0ca27fe 100644
>> --- a/drivers/ata/sata_highbank.c
>> +++ b/drivers/ata/sata_highbank.c
>> @@ -82,9 +82,11 @@ static DEFINE_SPINLOCK(sgpio_lock);
>>  #define SGPIO_PINS			3
>>  #define SGPIO_PORTS			8
>>  
>> -/* can be cast as an ahci_host_priv for compatibility with most functions */
>>  struct ecx_plat_data {
>>  	u32		n_ports;
>> +	/* number of extra clocks that the SGPIO PIC controller expects */
>> +	u32		pre_clocks;
>> +	u32		post_clocks;
>>  	unsigned	sgpio_gpio[SGPIO_PINS];
>>  	u32		sgpio_pattern;
>>  	u32		port_to_sgpio[SGPIO_PORTS];
>> @@ -144,7 +146,7 @@ static ssize_t ecx_transmit_led_message(struct ata_port *ap, u32 state,
>>  	struct ecx_plat_data *pdata = (struct ecx_plat_data *) hpriv->plat_data;
>>  	struct ahci_port_priv *pp = ap->private_data;
>>  	unsigned long flags;
>> -	int pmp, i;
>> +	int pmp, i, patt_len;
>>  	struct ahci_em_priv *emp;
>>  	u32 sgpio_out;
>>  
>> @@ -161,6 +163,9 @@ static ssize_t ecx_transmit_led_message(struct ata_port *ap, u32 state,
>>  	spin_lock_irqsave(&sgpio_lock, flags);
>>  	ecx_parse_sgpio(pdata, ap->port_no, state);
>>  	sgpio_out = pdata->sgpio_pattern;
>> +	for (i = 0; i < pdata->pre_clocks; i++)
>> +		ecx_led_cycle_clock(pdata);
>> +
>>  	gpio_set_value(pdata->sgpio_gpio[SLOAD], 1);
>>  	ecx_led_cycle_clock(pdata);
>>  	gpio_set_value(pdata->sgpio_gpio[SLOAD], 0);
>> @@ -168,11 +173,14 @@ static ssize_t ecx_transmit_led_message(struct ata_port *ap, u32 state,
>>  	 * bit-bang out the SGPIO pattern, by consuming a bit and then
>>  	 * clocking it out.
>>  	 */
>> -	for (i = 0; i < (SGPIO_SIGNALS * pdata->n_ports); i++) {
>> +	patt_len = SGPIO_SIGNALS * pdata->n_ports;
>> +	for (i = 0; i < patt_len; i++) {
>>  		gpio_set_value(pdata->sgpio_gpio[SDATA], sgpio_out & 1);
>>  		sgpio_out >>= 1;
>>  		ecx_led_cycle_clock(pdata);
>>  	}
>> +	for (i = 0; i < pdata->post_clocks; i++)
>> +		ecx_led_cycle_clock(pdata);
>>  
>>  	/* save off new led state for port/slot */
>>  	emp->led_state = state;
>> @@ -207,6 +215,8 @@ static void highbank_set_em_messages(struct device *dev,
>>  	of_property_read_u32_array(np, "calxeda,led-order",
>>  						pdata->port_to_sgpio,
>>  						pdata->n_ports);
>> +	of_property_read_u32(np, "calxeda,pre-clocks", &pdata->pre_clocks);
>> +	of_property_read_u32(np, "calxeda,post-clocks", &pdata->post_clocks);
> 
> Are the pdata values initialised anywhere if those dt properties aren't
> present? It's not clear from the patch context.
> 
> Thanks,
> Mark.
> 

  reply	other threads:[~2013-07-26 18:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 15:11 [PATCH 1/5] sata, highbank: fix ordering of SGPIO signals Mark Langsdorf
2013-07-26 15:11 ` [PATCH 2/5] sata highbank: enable 64-bit DMA mask when using LPAE Mark Langsdorf
2013-07-26 15:11 ` [PATCH 3/5] devicetree: create a separate binding description for sata_highbank Mark Langsdorf
2013-07-26 15:45   ` Rob Herring
2013-07-26 15:11 ` [PATCH 4/5] sata, highbank: set tx_atten override bits Mark Langsdorf
2013-07-26 16:22   ` Mark Rutland
2013-07-26 18:38     ` Rob Herring
2013-07-30 16:42       ` Mark Rutland
2013-08-02 15:24         ` Mark Langsdorf
2013-07-26 15:11 ` [PATCH 5/5] sata, highbank: send extra clock cycles in SGPIO patterns Mark Langsdorf
2013-07-26 15:48   ` Rob Herring
2013-07-26 16:26   ` Mark Rutland
2013-07-26 18:34     ` Rob Herring [this message]
2013-07-29 16:55 ` [PATCH 1/5] sata, highbank: fix ordering of SGPIO signals Tejun Heo
2013-08-02 15:23   ` Mark Langsdorf
2013-08-02 19:29     ` Tejun Heo
2013-08-14 18:23 ` [PATCH v4 1/3] devicetree: create a separate binding description for sata_highbank Mark Langsdorf
2013-08-14 18:23   ` [PATCH v4 2/3] sata, highbank: set tx_atten override bits Mark Langsdorf
2013-08-14 18:23   ` [PATCH v4 3/3] sata, highbank: send extra clock cycles in SGPIO patterns Mark Langsdorf
2013-08-14 20:27   ` [PATCH v4 1/3] devicetree: create a separate binding description for sata_highbank Tejun Heo
2013-08-14 20:36     ` Mark Langsdorf
2013-08-14 20:37       ` Tejun Heo
2013-08-14 20:40 ` Mark Langsdorf
2013-08-14 20:44   ` Tejun Heo

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=51F2C128.7030905@gmail.com \
    --to=robherring2@gmail.com \
    --cc=Pawel.Moll@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ian.campbell@citrix.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.langsdorf@calxeda.com \
    --cc=mark.rutland@arm.com \
    --cc=swarren@wwwdotorg.org \
    --cc=tj@kernel.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).