diff mbox

[RFC] drivers: ata: Read Rx water mark value from device-tree

Message ID 1455974302-7082-1-git-send-email-anuragku@xilinx.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Anurag Kumar Vulisha Feb. 20, 2016, 1:18 p.m. UTC
This patch updates the driver to read the RX FIFO watermark value
from device tree. This read value is used by the driver for programming
FIFO RxWaterMark level, which sets the minimum number of free
locations within the RX FIFO.When the rx fifo level crosses the
programmed watermark level, sata controller will transmit HOLDS to
the device asking it to wait.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
---
 .../devicetree/bindings/ata/ahci-ceva.txt          |    2 ++
 drivers/ata/ahci_ceva.c                            |   10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

Comments

Arnd Bergmann Feb. 20, 2016, 10:34 p.m. UTC | #1
On Saturday 20 February 2016 18:48:22 Anurag Kumar Vulisha wrote:
> index 7ca8b97..7e48dfc 100644
> --- a/Documentation/devicetree/bindings/ata/ahci-ceva.txt
> +++ b/Documentation/devicetree/bindings/ata/ahci-ceva.txt
> @@ -8,6 +8,7 @@ Required properties:
>  
>  Optional properties:
>    - ceva,broken-gen2: limit to gen1 speed instead of gen2.
> +  - ceva,rx-watermark: RX fifo water mark level for SATA controller.
>  
>  Examples:
>         ahci@fd0c0000 {
> @@ -17,4 +18,5 @@ Examples:
>                 interrupts = <0 133 4>;
>                 clocks = <&clkc SATA_CLK_ID>;
>                 ceva,broken-gen2;
> +               ceva,rx-watermark = <0x40>;
>         };
> 

How would a hardware integrator know which value is right for a
particular SoC?

Could it be keyed off the hardware ID? Could the bootloader
perhaps set an appropriate value in the AHCI_VEND_PTC
register at boot time and the driver read the initial
value from it?

From the description, it sounds like this is a policy decision
rather than hardware description, and shouldn't really be
in here.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anurag Kumar Vulisha Feb. 22, 2016, 10:53 a.m. UTC | #2
Hi Arnd,

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Sunday, February 21, 2016 4:05 AM
> To: Anurag Kumar Vulisha
> Cc: robh+dt@kernel.org; pawel.moll@arm.com; mark.rutland@arm.com;
> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah Choudary
> Kalluri; Anurag Kumar Vulisha
> Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from device-
> tree
> 
> On Saturday 20 February 2016 18:48:22 Anurag Kumar Vulisha wrote:
> > index 7ca8b97..7e48dfc 100644
> > --- a/Documentation/devicetree/bindings/ata/ahci-ceva.txt
> > +++ b/Documentation/devicetree/bindings/ata/ahci-ceva.txt
> > @@ -8,6 +8,7 @@ Required properties:
> >
> >  Optional properties:
> >    - ceva,broken-gen2: limit to gen1 speed instead of gen2.
> > +  - ceva,rx-watermark: RX fifo water mark level for SATA controller.
> >
> >  Examples:
> >         ahci@fd0c0000 {
> > @@ -17,4 +18,5 @@ Examples:
> >                 interrupts = <0 133 4>;
> >                 clocks = <&clkc SATA_CLK_ID>;
> >                 ceva,broken-gen2;
> > +               ceva,rx-watermark = <0x40>;
> >         };
> >
> 
> How would a hardware integrator know which value is right for a particular
> SoC?
> 
> Could it be keyed off the hardware ID? Could the bootloader perhaps set an
> appropriate value in the AHCI_VEND_PTC register at boot time and the driver
> read the initial value from it?
> 
> From the description, it sounds like this is a policy decision rather than
> hardware description, and shouldn't really be in here.
> 

Thanks for reviewing the patch. Can I use module_param() for this watermark instead of reading it from devicetree or
doing it in bootloader. In bootloader we are initializing serdes controller for high speed devices. As a part of this initialization
we will be reseting all the high speed pheripherals which are using serdes, so SATA will also get resetted. Because of this
reason, can I use module_param() for Rxwatermark value  instead?

Thanks,
Anurag Kumar V
  
> 	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann Feb. 22, 2016, 3:19 p.m. UTC | #3
On Monday 22 February 2016 10:53:11 Anurag Kumar Vulisha wrote:
> > >
> > 
> > How would a hardware integrator know which value is right for a particular
> > SoC?
> > 
> > Could it be keyed off the hardware ID? Could the bootloader perhaps set an
> > appropriate value in the AHCI_VEND_PTC register at boot time and the driver
> > read the initial value from it?
> > 
> > From the description, it sounds like this is a policy decision rather than
> > hardware description, and shouldn't really be in here.
> > 
> 
> Thanks for reviewing the patch. Can I use module_param() for this watermark instead of reading it from devicetree or
> doing it in bootloader. In bootloader we are initializing serdes controller for high speed devices. As a part of this initialization
> we will be reseting all the high speed pheripherals which are using serdes, so SATA will also get resetted. Because of this
> reason, can I use module_param() for Rxwatermark value  instead?
> 

I don't know what is appropriate because I have no idea what Rxwatermark
is good for. Can you try describing why we can't just set it to the
correct value for everyone automatically?

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anurag Kumar Vulisha Feb. 23, 2016, 5:58 a.m. UTC | #4
Hi Arnd,

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Monday, February 22, 2016 8:50 PM
> To: Anurag Kumar Vulisha
> Cc: robh+dt@kernel.org; pawel.moll@arm.com; mark.rutland@arm.com;
> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah Choudary
> Kalluri
> Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from device-
> tree
>
> On Monday 22 February 2016 10:53:11 Anurag Kumar Vulisha wrote:
> > > >
> > >
> > > How would a hardware integrator know which value is right for a
> > > particular SoC?
> > >
> > > Could it be keyed off the hardware ID? Could the bootloader perhaps
> > > set an appropriate value in the AHCI_VEND_PTC register at boot time
> > > and the driver read the initial value from it?
> > >
> > > From the description, it sounds like this is a policy decision
> > > rather than hardware description, and shouldn't really be in here.
> > >
> >
> > Thanks for reviewing the patch. Can I use module_param() for this
> > watermark instead of reading it from devicetree or doing it in
> > bootloader. In bootloader we are initializing serdes controller for
> > high speed devices. As a part of this initialization we will be reseting all the
> high speed pheripherals which are using serdes, so SATA will also get
> resetted. Because of this reason, can I use module_param() for Rxwatermark
> value  instead?
> >
>
> I don't know what is appropriate because I have no idea what Rxwatermark is
> good for. Can you try describing why we can't just set it to the correct value
> for everyone automatically?
>

This RX watermark level sets the minimum number of free locations within the RX FIFO .When the rx fifo level crosses the programmed watermark level ,sata controller  will transmit HOLDS to the device asking it to wait. This happens when dma
reads the rx fifo data slower than the device is sending the data. Note that it can take some time for the HOLDs to get to
the other end and in the time there must be enough room in the FIFO to absorb all data that could arrive from the device.
Currently we are using 0x40 for this value, which works fine with all hardware designs  we are currently having. But hoping
that this value may vary for future silicon versions, I wanted to make this as a configurable value. So for this reason I thought
of moving it either to device-tree or making it as a module_param() property.

Thanks,
Anurag Kumar V

>       Arnd


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann Feb. 23, 2016, 10:20 a.m. UTC | #5
On Tuesday 23 February 2016 05:58:32 Anurag Kumar Vulisha wrote:
> >
> > I don't know what is appropriate because I have no idea what Rxwatermark is
> > good for. Can you try describing why we can't just set it to the correct value
> > for everyone automatically?
> >
> 
> This RX watermark level sets the minimum number of free locations within the RX FIFO .When the rx fifo level crosses the programmed watermark level ,sata controller  will transmit HOLDS to the device asking it to wait. This happens when dma
> reads the rx fifo data slower than the device is sending the data. Note that it can take some time for the HOLDs to get to
> the other end and in the time there must be enough room in the FIFO to absorb all data that could arrive from the device.
> Currently we are using 0x40 for this value, which works fine with all hardware designs  we are currently having. But hoping
> that this value may vary for future silicon versions, I wanted to make this as a configurable value. So for this reason I thought
> of moving it either to device-tree or making it as a module_param() property.
> 

Ok, so if this depends on the silicon version, your initial approach
would be better than the module_param.

I would probably make this dependent on the compatible string instead,
and have a table in the device driver that uses a specific value
for each variant of the device, but either way should be fine.

Having a separate property is most appropriate if for each hardware
revision there is exactly one ideal value, while a table in the
driver makes more sense if this takes a bit of tuning and the driver
might choose to optimize it differently based on other constraints,
such as its own interrupt handler implementation.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anurag Kumar Vulisha Feb. 23, 2016, 3:29 p.m. UTC | #6
Hi Arnd,

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Tuesday, February 23, 2016 3:51 PM
> To: Anurag Kumar Vulisha
> Cc: robh+dt@kernel.org; pawel.moll@arm.com; mark.rutland@arm.com;
> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah Choudary
> Kalluri
> Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from device-
> tree
> 
> On Tuesday 23 February 2016 05:58:32 Anurag Kumar Vulisha wrote:
> > >
> > > I don't know what is appropriate because I have no idea what
> > > Rxwatermark is good for. Can you try describing why we can't just
> > > set it to the correct value for everyone automatically?
> > >
> >
> > This RX watermark level sets the minimum number of free locations
> > within the RX FIFO .When the rx fifo level crosses the programmed
> > watermark level ,sata controller  will transmit HOLDS to the device asking it
> to wait. This happens when dma reads the rx fifo data slower than the device
> is sending the data. Note that it can take some time for the HOLDs to get to
> the other end and in the time there must be enough room in the FIFO to
> absorb all data that could arrive from the device.
> > Currently we are using 0x40 for this value, which works fine with all
> > hardware designs  we are currently having. But hoping that this value
> > may vary for future silicon versions, I wanted to make this as a configurable
> value. So for this reason I thought of moving it either to device-tree or
> making it as a module_param() property.
> >
> 
> Ok, so if this depends on the silicon version, your initial approach would be
> better than the module_param.
> 
> I would probably make this dependent on the compatible string instead, and
> have a table in the device driver that uses a specific value for each variant of
> the device, but either way should be fine.
> 
> Having a separate property is most appropriate if for each hardware revision
> there is exactly one ideal value, while a table in the driver makes more sense
> if this takes a bit of tuning and the driver might choose to optimize it
> differently based on other constraints, such as its own interrupt handler
> implementation.
> 

Since we are  currently having one value in common for all the hardware and also changing
the rx water mark does not require any changes other than vendor specific PTC register update ,
I think it would be better  to  use device tree property for that rx watermark value. Doing
this makes the updating of rx watermark value easy, if any changes required.

In future, if any silicon version rx water mark value doesn't work with the current versions,
then  I will do as you said by maintaining the table in device driver. But at present  I feel
that single rx watermark property in device tree would be enough, since it works with all the
hardware versions we have.

Thanks,
Anurag Kumar V
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Feb. 23, 2016, 7:29 p.m. UTC | #7
On Tue, Feb 23, 2016 at 03:29:55PM +0000, Anurag Kumar Vulisha wrote:
> Hi Arnd,
> 
> > -----Original Message-----
> > From: Arnd Bergmann [mailto:arnd@arndb.de]
> > Sent: Tuesday, February 23, 2016 3:51 PM
> > To: Anurag Kumar Vulisha
> > Cc: robh+dt@kernel.org; pawel.moll@arm.com; mark.rutland@arm.com;
> > ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> > ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah Choudary
> > Kalluri
> > Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from device-
> > tree
> > 
> > On Tuesday 23 February 2016 05:58:32 Anurag Kumar Vulisha wrote:
> > > >
> > > > I don't know what is appropriate because I have no idea what
> > > > Rxwatermark is good for. Can you try describing why we can't just
> > > > set it to the correct value for everyone automatically?
> > > >
> > >
> > > This RX watermark level sets the minimum number of free locations
> > > within the RX FIFO .When the rx fifo level crosses the programmed
> > > watermark level ,sata controller  will transmit HOLDS to the device asking it
> > to wait. This happens when dma reads the rx fifo data slower than the device
> > is sending the data. Note that it can take some time for the HOLDs to get to
> > the other end and in the time there must be enough room in the FIFO to
> > absorb all data that could arrive from the device.
> > > Currently we are using 0x40 for this value, which works fine with all
> > > hardware designs  we are currently having. But hoping that this value
> > > may vary for future silicon versions, I wanted to make this as a configurable
> > value. So for this reason I thought of moving it either to device-tree or
> > making it as a module_param() property.
> > >
> > 
> > Ok, so if this depends on the silicon version, your initial approach would be
> > better than the module_param.
> > 
> > I would probably make this dependent on the compatible string instead, and
> > have a table in the device driver that uses a specific value for each variant of
> > the device, but either way should be fine.
> > 
> > Having a separate property is most appropriate if for each hardware revision
> > there is exactly one ideal value, while a table in the driver makes more sense
> > if this takes a bit of tuning and the driver might choose to optimize it
> > differently based on other constraints, such as its own interrupt handler
> > implementation.
> > 
> 
> Since we are  currently having one value in common for all the hardware and also changing
> the rx water mark does not require any changes other than vendor specific PTC register update ,
> I think it would be better  to  use device tree property for that rx watermark value. Doing
> this makes the updating of rx watermark value easy, if any changes required.
> 
> In future, if any silicon version rx water mark value doesn't work with the current versions,
> then  I will do as you said by maintaining the table in device driver. But at present  I feel
> that single rx watermark property in device tree would be enough, since it works with all the
> hardware versions we have.

If you currently have no reason to modify it now, then add it later when 
you actually have a use case.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anurag Kumar Vulisha Feb. 26, 2016, 1:48 p.m. UTC | #8
Hi Rob,

> -----Original Message-----
> From: Rob Herring [mailto:robh@kernel.org]
> Sent: Wednesday, February 24, 2016 1:00 AM
> To: Anurag Kumar Vulisha
> Cc: Arnd Bergmann; pawel.moll@arm.com; mark.rutland@arm.com;
> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah Choudary
> Kalluri
> Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from device-
> tree
> 
> On Tue, Feb 23, 2016 at 03:29:55PM +0000, Anurag Kumar Vulisha wrote:
> > Hi Arnd,
> >
> > > -----Original Message-----
> > > From: Arnd Bergmann [mailto:arnd@arndb.de]
> > > Sent: Tuesday, February 23, 2016 3:51 PM
> > > To: Anurag Kumar Vulisha
> > > Cc: robh+dt@kernel.org; pawel.moll@arm.com; mark.rutland@arm.com;
> > > ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> > > ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah
> > > Choudary Kalluri
> > > Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from
> > > device- tree
> > >
> > > On Tuesday 23 February 2016 05:58:32 Anurag Kumar Vulisha wrote:
> > > > >
> > > > > I don't know what is appropriate because I have no idea what
> > > > > Rxwatermark is good for. Can you try describing why we can't
> > > > > just set it to the correct value for everyone automatically?
> > > > >
> > > >
> > > > This RX watermark level sets the minimum number of free locations
> > > > within the RX FIFO .When the rx fifo level crosses the programmed
> > > > watermark level ,sata controller  will transmit HOLDS to the
> > > > device asking it
> > > to wait. This happens when dma reads the rx fifo data slower than
> > > the device is sending the data. Note that it can take some time for
> > > the HOLDs to get to the other end and in the time there must be
> > > enough room in the FIFO to absorb all data that could arrive from the
> device.
> > > > Currently we are using 0x40 for this value, which works fine with
> > > > all hardware designs  we are currently having. But hoping that
> > > > this value may vary for future silicon versions, I wanted to make
> > > > this as a configurable
> > > value. So for this reason I thought of moving it either to
> > > device-tree or making it as a module_param() property.
> > > >
> > >
> > > Ok, so if this depends on the silicon version, your initial approach
> > > would be better than the module_param.
> > >
> > > I would probably make this dependent on the compatible string
> > > instead, and have a table in the device driver that uses a specific
> > > value for each variant of the device, but either way should be fine.
> > >
> > > Having a separate property is most appropriate if for each hardware
> > > revision there is exactly one ideal value, while a table in the
> > > driver makes more sense if this takes a bit of tuning and the driver
> > > might choose to optimize it differently based on other constraints,
> > > such as its own interrupt handler implementation.
> > >
> >
> > Since we are  currently having one value in common for all the
> > hardware and also changing the rx water mark does not require any
> > changes other than vendor specific PTC register update , I think it
> > would be better  to  use device tree property for that rx watermark value.
> Doing this makes the updating of rx watermark value easy, if any changes
> required.
> >
> > In future, if any silicon version rx water mark value doesn't work
> > with the current versions, then  I will do as you said by maintaining
> > the table in device driver. But at present  I feel that single rx
> > watermark property in device tree would be enough, since it works with all
> the hardware versions we have.
> 
> If you currently have no reason to modify it now, then add it later when you
> actually have a use case.
>

This property may vary from board to board . It also depends on the phy reference clock
frequency which can be changed based on use case. So moving this property to device
tree will make it easy for the  user  to  configure  this property based on the requirement.

Thanks,
Anuarg Kumar V
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anurag Kumar Vulisha March 2, 2016, 5:53 a.m. UTC | #9
+ Michal

> -----Original Message-----
> From: Anurag Kumar Vulisha
> Sent: Friday, February 26, 2016 7:18 PM
> To: 'Rob Herring'
> Cc: Arnd Bergmann; pawel.moll@arm.com; mark.rutland@arm.com;
> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah Choudary
> Kalluri
> Subject: RE: [RFC PATCH] drivers: ata: Read Rx water mark value from device-
> tree
>
> Hi Rob,
>
> > -----Original Message-----
> > From: Rob Herring [mailto:robh@kernel.org]
> > Sent: Wednesday, February 24, 2016 1:00 AM
> > To: Anurag Kumar Vulisha
> > Cc: Arnd Bergmann; pawel.moll@arm.com; mark.rutland@arm.com;
> > ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> > ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah
> > Choudary Kalluri
> > Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from
> > device- tree
> >
> > On Tue, Feb 23, 2016 at 03:29:55PM +0000, Anurag Kumar Vulisha wrote:
> > > Hi Arnd,
> > >
> > > > -----Original Message-----
> > > > From: Arnd Bergmann [mailto:arnd@arndb.de]
> > > > Sent: Tuesday, February 23, 2016 3:51 PM
> > > > To: Anurag Kumar Vulisha
> > > > Cc: robh+dt@kernel.org; pawel.moll@arm.com;
> mark.rutland@arm.com;
> > > > ijc+devicetree@hellion.org.uk; galak@codeaurora.org;
> > > > ijc+tj@kernel.org;
> > > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> > > > ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah
> > > > Choudary Kalluri
> > > > Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value
> > > > from
> > > > device- tree
> > > >
> > > > On Tuesday 23 February 2016 05:58:32 Anurag Kumar Vulisha wrote:
> > > > > >
> > > > > > I don't know what is appropriate because I have no idea what
> > > > > > Rxwatermark is good for. Can you try describing why we can't
> > > > > > just set it to the correct value for everyone automatically?
> > > > > >
> > > > >
> > > > > This RX watermark level sets the minimum number of free
> > > > > locations within the RX FIFO .When the rx fifo level crosses the
> > > > > programmed watermark level ,sata controller  will transmit HOLDS
> > > > > to the device asking it
> > > > to wait. This happens when dma reads the rx fifo data slower than
> > > > the device is sending the data. Note that it can take some time
> > > > for the HOLDs to get to the other end and in the time there must
> > > > be enough room in the FIFO to absorb all data that could arrive
> > > > from the
> > device.
> > > > > Currently we are using 0x40 for this value, which works fine
> > > > > with all hardware designs  we are currently having. But hoping
> > > > > that this value may vary for future silicon versions, I wanted
> > > > > to make this as a configurable
> > > > value. So for this reason I thought of moving it either to
> > > > device-tree or making it as a module_param() property.
> > > > >
> > > >
> > > > Ok, so if this depends on the silicon version, your initial
> > > > approach would be better than the module_param.
> > > >
> > > > I would probably make this dependent on the compatible string
> > > > instead, and have a table in the device driver that uses a
> > > > specific value for each variant of the device, but either way should be
> fine.
> > > >
> > > > Having a separate property is most appropriate if for each
> > > > hardware revision there is exactly one ideal value, while a table
> > > > in the driver makes more sense if this takes a bit of tuning and
> > > > the driver might choose to optimize it differently based on other
> > > > constraints, such as its own interrupt handler implementation.
> > > >
> > >
> > > Since we are  currently having one value in common for all the
> > > hardware and also changing the rx water mark does not require any
> > > changes other than vendor specific PTC register update , I think it
> > > would be better  to  use device tree property for that rx watermark
> value.
> > Doing this makes the updating of rx watermark value easy, if any
> > changes required.
> > >
> > > In future, if any silicon version rx water mark value doesn't work
> > > with the current versions, then  I will do as you said by
> > > maintaining the table in device driver. But at present  I feel that
> > > single rx watermark property in device tree would be enough, since
> > > it works with all
> > the hardware versions we have.
> >
> > If you currently have no reason to modify it now, then add it later
> > when you actually have a use case.
> >
>
> This property may vary from board to board . It also depends on the phy
> reference clock frequency which can be changed based on use case. So
> moving this property to device tree will make it easy for the  user  to
> configure  this property based on the requirement.
>
> Thanks,
> Anuarg Kumar V


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Simek March 2, 2016, 8:05 a.m. UTC | #10
Hi Rob and Arnd,

On 2.3.2016 06:53, Anurag Kumar Vulisha wrote:
> + Michal
> 
>> -----Original Message-----
>> From: Anurag Kumar Vulisha
>> Sent: Friday, February 26, 2016 7:18 PM
>> To: 'Rob Herring'
>> Cc: Arnd Bergmann; pawel.moll@arm.com; mark.rutland@arm.com;
>> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
>> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
>> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah Choudary
>> Kalluri
>> Subject: RE: [RFC PATCH] drivers: ata: Read Rx water mark value from device-
>> tree
>>
>> Hi Rob,
>>
>>> -----Original Message-----
>>> From: Rob Herring [mailto:robh@kernel.org]
>>> Sent: Wednesday, February 24, 2016 1:00 AM
>>> To: Anurag Kumar Vulisha
>>> Cc: Arnd Bergmann; pawel.moll@arm.com; mark.rutland@arm.com;
>>> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; tj@kernel.org;
>>> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
>>> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah
>>> Choudary Kalluri
>>> Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value from
>>> device- tree
>>>
>>> On Tue, Feb 23, 2016 at 03:29:55PM +0000, Anurag Kumar Vulisha wrote:
>>>> Hi Arnd,
>>>>
>>>>> -----Original Message-----
>>>>> From: Arnd Bergmann [mailto:arnd@arndb.de]
>>>>> Sent: Tuesday, February 23, 2016 3:51 PM
>>>>> To: Anurag Kumar Vulisha
>>>>> Cc: robh+dt@kernel.org; pawel.moll@arm.com;
>> mark.rutland@arm.com;
>>>>> ijc+devicetree@hellion.org.uk; galak@codeaurora.org;
>>>>> ijc+tj@kernel.org;
>>>>> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
>>>>> ide@vger.kernel.org; Anirudha Sarangi; Srikanth Vemula; Punnaiah
>>>>> Choudary Kalluri
>>>>> Subject: Re: [RFC PATCH] drivers: ata: Read Rx water mark value
>>>>> from
>>>>> device- tree
>>>>>
>>>>> On Tuesday 23 February 2016 05:58:32 Anurag Kumar Vulisha wrote:
>>>>>>>
>>>>>>> I don't know what is appropriate because I have no idea what
>>>>>>> Rxwatermark is good for. Can you try describing why we can't
>>>>>>> just set it to the correct value for everyone automatically?
>>>>>>>
>>>>>>
>>>>>> This RX watermark level sets the minimum number of free
>>>>>> locations within the RX FIFO .When the rx fifo level crosses the
>>>>>> programmed watermark level ,sata controller  will transmit HOLDS
>>>>>> to the device asking it
>>>>> to wait. This happens when dma reads the rx fifo data slower than
>>>>> the device is sending the data. Note that it can take some time
>>>>> for the HOLDs to get to the other end and in the time there must
>>>>> be enough room in the FIFO to absorb all data that could arrive
>>>>> from the
>>> device.
>>>>>> Currently we are using 0x40 for this value, which works fine
>>>>>> with all hardware designs  we are currently having. But hoping
>>>>>> that this value may vary for future silicon versions, I wanted
>>>>>> to make this as a configurable
>>>>> value. So for this reason I thought of moving it either to
>>>>> device-tree or making it as a module_param() property.
>>>>>>
>>>>>
>>>>> Ok, so if this depends on the silicon version, your initial
>>>>> approach would be better than the module_param.
>>>>>
>>>>> I would probably make this dependent on the compatible string
>>>>> instead, and have a table in the device driver that uses a
>>>>> specific value for each variant of the device, but either way should be
>> fine.
>>>>>
>>>>> Having a separate property is most appropriate if for each
>>>>> hardware revision there is exactly one ideal value, while a table
>>>>> in the driver makes more sense if this takes a bit of tuning and
>>>>> the driver might choose to optimize it differently based on other
>>>>> constraints, such as its own interrupt handler implementation.

that 0x40 is value choose based on testing that it is not causing any
visible problem and this is used as default value in the driver
(PTC_RX_WM_VAL - ahci_ceva.c)

Values which you can setup are in range 0x0 - 0x7f (7bits). It means
hardware fifo size is probably 0x80.

And this dt/module parameter is IMHO just sw setting setup by user.
It means I am not quite sure that this is DT parameter because it is
just SW setting.
I expect this range will be valid for all silicon revisions.
If happen that any silicon revision can't setup certain level because of
HW bug we can handle it via DT parameter or specific compatible string.
But setting up watermark SW level via DT doesn't look correct to me.

Please let me know what you think.

Thanks,
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann March 2, 2016, 9:11 a.m. UTC | #11
On Wednesday 02 March 2016 09:05:49 Michal Simek wrote:
> On 2.3.2016 06:53, Anurag Kumar Vulisha wrote:
> >>>>>
> >>>>> I would probably make this dependent on the compatible string
> >>>>> instead, and have a table in the device driver that uses a
> >>>>> specific value for each variant of the device, but either way should be
> >> fine.
> >>>>>
> >>>>> Having a separate property is most appropriate if for each
> >>>>> hardware revision there is exactly one ideal value, while a table
> >>>>> in the driver makes more sense if this takes a bit of tuning and
> >>>>> the driver might choose to optimize it differently based on other
> >>>>> constraints, such as its own interrupt handler implementation.
> 
> that 0x40 is value choose based on testing that it is not causing any
> visible problem and this is used as default value in the driver
> (PTC_RX_WM_VAL - ahci_ceva.c)
> 
> Values which you can setup are in range 0x0 - 0x7f (7bits). It means
> hardware fifo size is probably 0x80.
> 
> And this dt/module parameter is IMHO just sw setting setup by user.
> It means I am not quite sure that this is DT parameter because it is
> just SW setting.
> I expect this range will be valid for all silicon revisions.
> If happen that any silicon revision can't setup certain level because of
> HW bug we can handle it via DT parameter or specific compatible string.
> But setting up watermark SW level via DT doesn't look correct to me.
> 
> Please let me know what you think.

Ok, thanks for the background. I think we should just leave it to be
set by the driver then. Please make sure that each SoC specific .dtsi
file has a unique "compatible" string for the device though, so that
the driver can later override it based on the specific variant if
that ends up being necessary for performance or bug-avoidance.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Simek March 2, 2016, 9:27 a.m. UTC | #12
On 2.3.2016 10:11, Arnd Bergmann wrote:
> On Wednesday 02 March 2016 09:05:49 Michal Simek wrote:
>> On 2.3.2016 06:53, Anurag Kumar Vulisha wrote:
>>>>>>>
>>>>>>> I would probably make this dependent on the compatible string
>>>>>>> instead, and have a table in the device driver that uses a
>>>>>>> specific value for each variant of the device, but either way should be
>>>> fine.
>>>>>>>
>>>>>>> Having a separate property is most appropriate if for each
>>>>>>> hardware revision there is exactly one ideal value, while a table
>>>>>>> in the driver makes more sense if this takes a bit of tuning and
>>>>>>> the driver might choose to optimize it differently based on other
>>>>>>> constraints, such as its own interrupt handler implementation.
>>
>> that 0x40 is value choose based on testing that it is not causing any
>> visible problem and this is used as default value in the driver
>> (PTC_RX_WM_VAL - ahci_ceva.c)
>>
>> Values which you can setup are in range 0x0 - 0x7f (7bits). It means
>> hardware fifo size is probably 0x80.
>>
>> And this dt/module parameter is IMHO just sw setting setup by user.
>> It means I am not quite sure that this is DT parameter because it is
>> just SW setting.
>> I expect this range will be valid for all silicon revisions.
>> If happen that any silicon revision can't setup certain level because of
>> HW bug we can handle it via DT parameter or specific compatible string.
>> But setting up watermark SW level via DT doesn't look correct to me.
>>
>> Please let me know what you think.
> 
> Ok, thanks for the background. I think we should just leave it to be
> set by the driver then. Please make sure that each SoC specific .dtsi
> file has a unique "compatible" string for the device though, so that
> the driver can later override it based on the specific variant if
> that ends up being necessary for performance or bug-avoidance.

No problem with default value in driver. Something has to be setup.
Reset value based on reg spec I was checking is 0x20. Based on our
testing we saw some issues that's why 0x40 was setup as default value.
There is a need to be able to configure this value for example for
testing different values that's why I think module parameter should be
the right way to go.

If this should be DT parameters there should be different ceva IP which
allows different fifo size and different watermark level to be setup by
user.

What do you think? Does it sound reasonable.

Thanks,
Michal



--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann March 2, 2016, 11:42 a.m. UTC | #13
On Wednesday 02 March 2016 10:27:51 Michal Simek wrote:
> 
> No problem with default value in driver. Something has to be setup.
> Reset value based on reg spec I was checking is 0x20. Based on our
> testing we saw some issues that's why 0x40 was setup as default value.
> There is a need to be able to configure this value for example for
> testing different values that's why I think module parameter should be
> the right way to go.

I don't object to the module parameter, but I don't understand how important
that kind of testing is to normal users. Who would set it, aside from
the person writing that driver to come up with the correct default?

> If this should be DT parameters there should be different ceva IP which
> allows different fifo size and different watermark level to be setup by
> user.
> 
> What do you think? Does it sound reasonable.

Having a property for the actual hardware fifo size once you get
different implementations seems like the correct approach, but it's
moot as long as all implementations are hardwired to 128 entries.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Simek March 2, 2016, 11:51 a.m. UTC | #14
On 2.3.2016 12:42, Arnd Bergmann wrote:
> On Wednesday 02 March 2016 10:27:51 Michal Simek wrote:
>>
>> No problem with default value in driver. Something has to be setup.
>> Reset value based on reg spec I was checking is 0x20. Based on our
>> testing we saw some issues that's why 0x40 was setup as default value.
>> There is a need to be able to configure this value for example for
>> testing different values that's why I think module parameter should be
>> the right way to go.
> 
> I don't object to the module parameter, but I don't understand how important
> that kind of testing is to normal users. Who would set it, aside from
> the person writing that driver to come up with the correct default?
> 
>> If this should be DT parameters there should be different ceva IP which
>> allows different fifo size and different watermark level to be setup by
>> user.
>>
>> What do you think? Does it sound reasonable.
> 
> Having a property for the actual hardware fifo size once you get
> different implementations seems like the correct approach, but it's
> moot as long as all implementations are hardwired to 128 entries.

yep right now and we don't know what can happen in future. I just wanted
to point to example where this property can be specified or wired to
particular compatible string.

Anurag: Please make it as module parameter instead of DT parameter.

Thanks,
Michal

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/ata/ahci-ceva.txt b/Documentation/devicetree/bindings/ata/ahci-ceva.txt
index 7ca8b97..7e48dfc 100644
--- a/Documentation/devicetree/bindings/ata/ahci-ceva.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-ceva.txt
@@ -8,6 +8,7 @@  Required properties:
 
 Optional properties:
   - ceva,broken-gen2: limit to gen1 speed instead of gen2.
+  - ceva,rx-watermark: RX fifo water mark level for SATA controller.
 
 Examples:
 	ahci@fd0c0000 {
@@ -17,4 +18,5 @@  Examples:
 		interrupts = <0 133 4>;
 		clocks = <&clkc SATA_CLK_ID>;
 		ceva,broken-gen2;
+		ceva,rx-watermark = <0x40>;
 	};
diff --git a/drivers/ata/ahci_ceva.c b/drivers/ata/ahci_ceva.c
index 207649d..ea01f7d 100644
--- a/drivers/ata/ahci_ceva.c
+++ b/drivers/ata/ahci_ceva.c
@@ -88,6 +88,7 @@ 
 struct ceva_ahci_priv {
 	struct platform_device *ahci_pdev;
 	int flags;
+	u32 rx_watermark;
 };
 
 static struct ata_port_operations ahci_ceva_ops = {
@@ -147,7 +148,7 @@  static void ahci_ceva_setup(struct ahci_host_priv *hpriv)
 		writel(tmp, mmio + AHCI_VEND_PP5C);
 
 		/* Rx Watermark setting  */
-		tmp = PTC_RX_WM_VAL | PTC_RSVD;
+		tmp = cevapriv->rx_watermark | PTC_RSVD;
 		writel(tmp, mmio + AHCI_VEND_PTC);
 
 		/* Default to Gen 2 Speed and Gen 1 if Gen2 is broken */
@@ -187,6 +188,13 @@  static int ceva_ahci_probe(struct platform_device *pdev)
 	if (of_property_read_bool(np, "ceva,broken-gen2"))
 		cevapriv->flags = CEVA_FLAG_BROKEN_GEN2;
 
+	/* Read RX WATERMARK value from device tree */
+	if (of_property_read_u32(np, "ceva,rx-watermark",
+				&cevapriv->rx_watermark) < 0) {
+		/* using default RX water mark, if not in device tree */
+		cevapriv->rx_watermark = PTC_RX_WM_VAL;
+	}
+
 	hpriv->plat_data = cevapriv;
 
 	/* CEVA specific initialization */