diff mbox

ARM: dts: keystone: use one to one address translations under netcp

Message ID 1441139324-29296-1-git-send-email-w-kwok2@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

WingMan Kwok Sept. 1, 2015, 8:28 p.m. UTC
Network subsystem NetCP in Keystone-2 devices includes some HW blocks
that are memory mapped to ranges outside that of the NetCP itself.
Thus address space of a child node of the NetCP node needs to be
mapped 1:1 onto the parent address space.  Hence empty ranges
should be used under the NetCP node.

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
---
 arch/arm/boot/dts/k2e-netcp.dtsi  |    8 +++-----
 arch/arm/boot/dts/k2hk-netcp.dtsi |   14 ++++++--------
 arch/arm/boot/dts/k2l-netcp.dtsi  |    8 +++-----
 3 files changed, 12 insertions(+), 18 deletions(-)

Comments

Santosh Shilimkar Sept. 1, 2015, 9:19 p.m. UTC | #1
On 9/1/15 1:28 PM, WingMan Kwok wrote:
> Network subsystem NetCP in Keystone-2 devices includes some HW blocks
> that are memory mapped to ranges outside that of the NetCP itself.
> Thus address space of a child node of the NetCP node needs to be
> mapped 1:1 onto the parent address space.  Hence empty ranges
> should be used under the NetCP node.
>
> Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
> ---
>   arch/arm/boot/dts/k2e-netcp.dtsi  |    8 +++-----
>   arch/arm/boot/dts/k2hk-netcp.dtsi |   14 ++++++--------
>   arch/arm/boot/dts/k2l-netcp.dtsi  |    8 +++-----
>   3 files changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/arch/arm/boot/dts/k2e-netcp.dtsi b/arch/arm/boot/dts/k2e-netcp.dtsi
> index b13b3c9..e103ed9 100644
> --- a/arch/arm/boot/dts/k2e-netcp.dtsi
> +++ b/arch/arm/boot/dts/k2e-netcp.dtsi
> @@ -111,9 +111,7 @@ netcp: netcp@24000000 {
>   	compatible = "ti,netcp-1.0";
>   	#address-cells = <1>;
>   	#size-cells = <1>;
> -
> -	/* NetCP address range */
> -	ranges = <0 0x24000000 0x1000000>;
> +	ranges;
>
What blocks are we talking here. We need to increase the
range if the current range isn't covering entire NETCP
address space. Removing range isn't a solution.

Regards,
Santosh
WingMan Kwok Sept. 2, 2015, 3:31 p.m. UTC | #2
> -----Original Message-----
> From: santosh.shilimkar@oracle.com [mailto:santosh.shilimkar@oracle.com]
> Sent: Tuesday, September 01, 2015 5:19 PM
> To: Kwok, WingMan; robh+dt@kernel.org; pawel.moll@arm.com;
> mark.rutland@arm.com; ijc+devicetree@hellion.org.uk; galak@codeaurora.org;
> linux@arm.linux.org.uk; devicetree@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; ssantosh@kernel.org
> Cc: Karicheri, Muralidharan
> Subject: Re: [PATCH] ARM: dts: keystone: use one to one address translations
> under netcp
> 
> On 9/1/15 1:28 PM, WingMan Kwok wrote:
> > Network subsystem NetCP in Keystone-2 devices includes some HW blocks
> > that are memory mapped to ranges outside that of the NetCP itself.
> > Thus address space of a child node of the NetCP node needs to be
> > mapped 1:1 onto the parent address space.  Hence empty ranges
> > should be used under the NetCP node.
> >
> > Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
> > ---
> >   arch/arm/boot/dts/k2e-netcp.dtsi  |    8 +++-----
> >   arch/arm/boot/dts/k2hk-netcp.dtsi |   14 ++++++--------
> >   arch/arm/boot/dts/k2l-netcp.dtsi  |    8 +++-----
> >   3 files changed, 12 insertions(+), 18 deletions(-)
> >
> > diff --git a/arch/arm/boot/dts/k2e-netcp.dtsi b/arch/arm/boot/dts/k2e-
> netcp.dtsi
> > index b13b3c9..e103ed9 100644
> > --- a/arch/arm/boot/dts/k2e-netcp.dtsi
> > +++ b/arch/arm/boot/dts/k2e-netcp.dtsi
> > @@ -111,9 +111,7 @@ netcp: netcp@24000000 {
> >   	compatible = "ti,netcp-1.0";
> >   	#address-cells = <1>;
> >   	#size-cells = <1>;
> > -
> > -	/* NetCP address range */
> > -	ranges = <0 0x24000000 0x1000000>;
> > +	ranges;
> >
> What blocks are we talking here. We need to increase the
> range if the current range isn't covering entire NETCP
> address space. Removing range isn't a solution.
> 

The Serdes.  It is a HW block inside the NetCP but its address
space starts from 0x0232a000.  We can change the base in the
ranges property to include the serdes.  But then offsets of
other HW blocks that are within the NetCP address range will be
relative to this new base and are not as documented in the HW
user guides.

Regards
WingMan
Santosh Shilimkar Sept. 2, 2015, 3:50 p.m. UTC | #3
On 9/2/2015 8:31 AM, Kwok, WingMan wrote:
>
>
>> -----Original Message-----
>> From: santosh.shilimkar@oracle.com [mailto:santosh.shilimkar@oracle.com]
>> Sent: Tuesday, September 01, 2015 5:19 PM
>> To: Kwok, WingMan; robh+dt@kernel.org; pawel.moll@arm.com;
>> mark.rutland@arm.com; ijc+devicetree@hellion.org.uk; galak@codeaurora.org;
>> linux@arm.linux.org.uk; devicetree@vger.kernel.org; linux-arm-
>> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; ssantosh@kernel.org
>> Cc: Karicheri, Muralidharan
>> Subject: Re: [PATCH] ARM: dts: keystone: use one to one address translations
>> under netcp
>>
>> On 9/1/15 1:28 PM, WingMan Kwok wrote:
>>> Network subsystem NetCP in Keystone-2 devices includes some HW blocks
>>> that are memory mapped to ranges outside that of the NetCP itself.
>>> Thus address space of a child node of the NetCP node needs to be
>>> mapped 1:1 onto the parent address space.  Hence empty ranges
>>> should be used under the NetCP node.
>>>
>>> Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
>>> ---
>>>    arch/arm/boot/dts/k2e-netcp.dtsi  |    8 +++-----
>>>    arch/arm/boot/dts/k2hk-netcp.dtsi |   14 ++++++--------
>>>    arch/arm/boot/dts/k2l-netcp.dtsi  |    8 +++-----
>>>    3 files changed, 12 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/arch/arm/boot/dts/k2e-netcp.dtsi b/arch/arm/boot/dts/k2e-
>> netcp.dtsi
>>> index b13b3c9..e103ed9 100644
>>> --- a/arch/arm/boot/dts/k2e-netcp.dtsi
>>> +++ b/arch/arm/boot/dts/k2e-netcp.dtsi
>>> @@ -111,9 +111,7 @@ netcp: netcp@24000000 {
>>>    	compatible = "ti,netcp-1.0";
>>>    	#address-cells = <1>;
>>>    	#size-cells = <1>;
>>> -
>>> -	/* NetCP address range */
>>> -	ranges = <0 0x24000000 0x1000000>;
>>> +	ranges;
>>>
>> What blocks are we talking here. We need to increase the
>> range if the current range isn't covering entire NETCP
>> address space. Removing range isn't a solution.
>>
>
> The Serdes.  It is a HW block inside the NetCP but its address
> space starts from 0x0232a000.  We can change the base in the
> ranges property to include the serdes.  But then offsets of
> other HW blocks that are within the NetCP address range will be
> relative to this new base and are not as documented in the HW
> user guides.
>
I suspected the same. I know back then we started with SERDES code
with NETCP but as you already know, its a separate block which
is needed for NIC card to work. Its more of phy and hence its
having different address space is not surprising.

IIRC, there was a plan to consolidate the serdes code together
since the PCIE also needs it. Irrespective of that, I suggest
you model the serdes address space in another node and fetch
it from there if that works for you. Please also add DTS
documentation if you are going ahead with that approach.

Regards,
Santosh
Murali Karicheri Sept. 2, 2015, 4:35 p.m. UTC | #4
Santosh,

On 09/02/2015 11:50 AM, santosh shilimkar wrote:
> On 9/2/2015 8:31 AM, Kwok, WingMan wrote:
>>
>>
>>> -----Original Message-----
>>> From: santosh.shilimkar@oracle.com [mailto:santosh.shilimkar@oracle.com]
>>> Sent: Tuesday, September 01, 2015 5:19 PM
>>> To: Kwok, WingMan; robh+dt@kernel.org; pawel.moll@arm.com;
>>> mark.rutland@arm.com; ijc+devicetree@hellion.org.uk;
>>> galak@codeaurora.org;
>>> linux@arm.linux.org.uk; devicetree@vger.kernel.org; linux-arm-
>>> kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
>>> ssantosh@kernel.org
>>> Cc: Karicheri, Muralidharan
>>> Subject: Re: [PATCH] ARM: dts: keystone: use one to one address
>>> translations
>>> under netcp
>>>
>>> On 9/1/15 1:28 PM, WingMan Kwok wrote:
>>>> Network subsystem NetCP in Keystone-2 devices includes some HW blocks
>>>> that are memory mapped to ranges outside that of the NetCP itself.
>>>> Thus address space of a child node of the NetCP node needs to be
>>>> mapped 1:1 onto the parent address space.  Hence empty ranges
>>>> should be used under the NetCP node.
>>>>
>>>> Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
>>>> ---
>>>>    arch/arm/boot/dts/k2e-netcp.dtsi  |    8 +++-----
>>>>    arch/arm/boot/dts/k2hk-netcp.dtsi |   14 ++++++--------
>>>>    arch/arm/boot/dts/k2l-netcp.dtsi  |    8 +++-----
>>>>    3 files changed, 12 insertions(+), 18 deletions(-)
>>>>
>>>> diff --git a/arch/arm/boot/dts/k2e-netcp.dtsi b/arch/arm/boot/dts/k2e-
>>> netcp.dtsi
>>>> index b13b3c9..e103ed9 100644
>>>> --- a/arch/arm/boot/dts/k2e-netcp.dtsi
>>>> +++ b/arch/arm/boot/dts/k2e-netcp.dtsi
>>>> @@ -111,9 +111,7 @@ netcp: netcp@24000000 {
>>>>        compatible = "ti,netcp-1.0";
>>>>        #address-cells = <1>;
>>>>        #size-cells = <1>;
>>>> -
>>>> -    /* NetCP address range */
>>>> -    ranges = <0 0x24000000 0x1000000>;
>>>> +    ranges;
>>>>
>>> What blocks are we talking here. We need to increase the
>>> range if the current range isn't covering entire NETCP
>>> address space. Removing range isn't a solution.
>>>
>>
>> The Serdes.  It is a HW block inside the NetCP but its address
>> space starts from 0x0232a000.  We can change the base in the
>> ranges property to include the serdes.  But then offsets of
>> other HW blocks that are within the NetCP address range will be
>> relative to this new base and are not as documented in the HW
>> user guides.
>>
> I suspected the same. I know back then we started with SERDES code
> with NETCP but as you already know, its a separate block which
> is needed for NIC card to work. Its more of phy and hence its
> having different address space is not surprising.

Using Phy interface is not acceptable to the subsystem maintainer based 
on the communication I had on this. Also the Phy here is tighly coupled 
with the hardware block it is working with. So this model is not right 
for SerDes driver as it require additional enhancements as described 
below if needs to be used.

The serdes initialization procedure requires checking the status in the 
hardware block (PCIe, 1G or 10G) and then taking corrective action. This 
means a Phy driver would require mapping of related hw address space 
(PCIe, 1G and 10G) as well which is already mapped by the hardware 
driver(PCIe, 1G and 10G). One solution is to treat this as a libray 
function that can be called from the respective hardware device driver. 
  A device node of h/w device (PCIe or 1G) in such as looks like

pcie {

	serdes@someaddress {
		reg = <address of serdes>;
	}
}

hw driver will call ks2_serdes_init(node, hw_base_address) to initialize 
the serdes. Other APIs can be added to enable/disable lane or shutdown 
etc. The libary will be added to drivers/soc/ti/ and used by various 
device drivers to initialize and use the phy. As the serdes is slightly 
integrated with the hardware block, IMO, this is a better approach than 
using the phy model. The API definitions will be added to 
include/linux/soc/ti/ folder.

The SerDes will use the firmware interface to download and configure the 
hardware block to use with PCIe/1G/10G/SRIO. I queried the linux forum 
on this and the response was that firmware interface can be used for 
this. The patch will be using the firmware interface instead of 
embedding magic values in the serdes driver.

Murali

>
> IIRC, there was a plan to consolidate the serdes code together
> since the PCIE also needs it. Irrespective of that, I suggest
> you model the serdes address space in another node and fetch
> it from there if that works for you. Please also add DTS
> documentation if you are going ahead with that approach.
>

> Regards,
> Santosh
>
>
>
>
>
Santosh Shilimkar Sept. 2, 2015, 5:24 p.m. UTC | #5
On 9/2/2015 9:35 AM, Murali Karicheri wrote:
> Santosh,
>
> On 09/02/2015 11:50 AM, santosh shilimkar wrote:
>> On 9/2/2015 8:31 AM, Kwok, WingMan wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: santosh.shilimkar@oracle.com
>>>> [mailto:santosh.shilimkar@oracle.com]
>>>> Sent: Tuesday, September 01, 2015 5:19 PM
>>>> To: Kwok, WingMan; robh+dt@kernel.org; pawel.moll@arm.com;
>>>> mark.rutland@arm.com; ijc+devicetree@hellion.org.uk;
>>>> galak@codeaurora.org;
>>>> linux@arm.linux.org.uk; devicetree@vger.kernel.org; linux-arm-
>>>> kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
>>>> ssantosh@kernel.org
>>>> Cc: Karicheri, Muralidharan
>>>> Subject: Re: [PATCH] ARM: dts: keystone: use one to one address
>>>> translations
>>>> under netcp
>>>>
>>>> On 9/1/15 1:28 PM, WingMan Kwok wrote:
>>>>> Network subsystem NetCP in Keystone-2 devices includes some HW blocks
>>>>> that are memory mapped to ranges outside that of the NetCP itself.
>>>>> Thus address space of a child node of the NetCP node needs to be
>>>>> mapped 1:1 onto the parent address space.  Hence empty ranges
>>>>> should be used under the NetCP node.
>>>>>
>>>>> Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
>>>>> ---
>>>>>    arch/arm/boot/dts/k2e-netcp.dtsi  |    8 +++-----
>>>>>    arch/arm/boot/dts/k2hk-netcp.dtsi |   14 ++++++--------
>>>>>    arch/arm/boot/dts/k2l-netcp.dtsi  |    8 +++-----
>>>>>    3 files changed, 12 insertions(+), 18 deletions(-)
>>>>>
>>>>> diff --git a/arch/arm/boot/dts/k2e-netcp.dtsi b/arch/arm/boot/dts/k2e-
>>>> netcp.dtsi
>>>>> index b13b3c9..e103ed9 100644
>>>>> --- a/arch/arm/boot/dts/k2e-netcp.dtsi
>>>>> +++ b/arch/arm/boot/dts/k2e-netcp.dtsi
>>>>> @@ -111,9 +111,7 @@ netcp: netcp@24000000 {
>>>>>        compatible = "ti,netcp-1.0";
>>>>>        #address-cells = <1>;
>>>>>        #size-cells = <1>;
>>>>> -
>>>>> -    /* NetCP address range */
>>>>> -    ranges = <0 0x24000000 0x1000000>;
>>>>> +    ranges;
>>>>>
>>>> What blocks are we talking here. We need to increase the
>>>> range if the current range isn't covering entire NETCP
>>>> address space. Removing range isn't a solution.
>>>>
>>>
>>> The Serdes.  It is a HW block inside the NetCP but its address
>>> space starts from 0x0232a000.  We can change the base in the
>>> ranges property to include the serdes.  But then offsets of
>>> other HW blocks that are within the NetCP address range will be
>>> relative to this new base and are not as documented in the HW
>>> user guides.
>>>
>> I suspected the same. I know back then we started with SERDES code
>> with NETCP but as you already know, its a separate block which
>> is needed for NIC card to work. Its more of phy and hence its
>> having different address space is not surprising.
>
> Using Phy interface is not acceptable to the subsystem maintainer based
> on the communication I had on this. Also the Phy here is tighly coupled
> with the hardware block it is working with. So this model is not right
> for SerDes driver as it require additional enhancements as described
> below if needs to be used.
>
Thanks for update on that.

> The serdes initialization procedure requires checking the status in the
> hardware block (PCIe, 1G or 10G) and then taking corrective action. This
> means a Phy driver would require mapping of related hw address space
> (PCIe, 1G and 10G) as well which is already mapped by the hardware
> driver(PCIe, 1G and 10G). One solution is to treat this as a libray
> function that can be called from the respective hardware device driver.
>   A device node of h/w device (PCIe or 1G) in such as looks like
>
Or SerDes driver can embed the status reg address space.
This is read only access so should be fine.

> pcie {
>
>      serdes@someaddress {
>          reg = <address of serdes>;
>      }
> }
>
> hw driver will call ks2_serdes_init(node, hw_base_address) to initialize
> the serdes. Other APIs can be added to enable/disable lane or shutdown
> etc. The libary will be added to drivers/soc/ti/ and used by various
> device drivers to initialize and use the phy. As the serdes is slightly
> integrated with the hardware block, IMO, this is a better approach than
> using the phy model. The API definitions will be added to
> include/linux/soc/ti/ folder.
>
Serdes Driver with its status register address space might solve this
sharing problem. Library might work but we should try to have driver
considering there is a physical device. I don't have strong opinion
on drivers vs library.


> The SerDes will use the firmware interface to download and configure the
> hardware block to use with PCIe/1G/10G/SRIO. I queried the linux forum
> on this and the response was that firmware interface can be used for
> this. The patch will be using the firmware interface instead of
> embedding magic values in the serdes driver.
>
Firmware interface usage seems to be correct way.
Thanks for giving the details. It helped me to get better picture.

Regards,
Santosh

Regards,
Santosh
Murali Karicheri Sept. 2, 2015, 5:58 p.m. UTC | #6
On 09/02/2015 01:24 PM, santosh shilimkar wrote:
> On 9/2/2015 9:35 AM, Murali Karicheri wrote:
>> Santosh,
>>

---Cut-------------------

>>> I suspected the same. I know back then we started with SERDES code
>>> with NETCP but as you already know, its a separate block which
>>> is needed for NIC card to work. Its more of phy and hence its
>>> having different address space is not surprising.
>>
>> Using Phy interface is not acceptable to the subsystem maintainer based
>> on the communication I had on this. Also the Phy here is tighly coupled
>> with the hardware block it is working with. So this model is not right
>> for SerDes driver as it require additional enhancements as described
>> below if needs to be used.
>>
> Thanks for update on that.
>
>> The serdes initialization procedure requires checking the status in the
>> hardware block (PCIe, 1G or 10G) and then taking corrective action. This
>> means a Phy driver would require mapping of related hw address space
>> (PCIe, 1G and 10G) as well which is already mapped by the hardware
>> driver(PCIe, 1G and 10G). One solution is to treat this as a libray
>> function that can be called from the respective hardware device driver.
>>   A device node of h/w device (PCIe or 1G) in such as looks like
>>
> Or SerDes driver can embed the status reg address space.
> This is read only access so should be fine.
>
>> pcie {
>>
>>      serdes@someaddress {
>>          reg = <address of serdes>;
>>      }
>> }
>>
>> hw driver will call ks2_serdes_init(node, hw_base_address) to initialize
>> the serdes. Other APIs can be added to enable/disable lane or shutdown
>> etc. The libary will be added to drivers/soc/ti/ and used by various
>> device drivers to initialize and use the phy. As the serdes is slightly
>> integrated with the hardware block, IMO, this is a better approach than
>> using the phy model. The API definitions will be added to
>> include/linux/soc/ti/ folder.
>>
> Serdes Driver with its status register address space might solve this
> sharing problem. Library might work but we should try to have driver
> considering there is a physical device. I don't have strong opinion
> on drivers vs library.
>

In addition to checking status in the SerDes, it needs to also check the 
status of the associated hardware block (PCIe, 1G, 10G etc). So this 
means, same needs to be mapped twice, first by the above hardware device 
drivers and then by the serdes driver which causes problem. My point is 
since they both are tightly coupled, a libary is a better option. That 
way the mapped address can be passed to the serdes API to perform the 
required task, instead of using Phy API which doesn't allow us to do the 
same. If SerDes h/w can be brought up independently, the Phy model fits 
well.

Murali
>
>> The SerDes will use the firmware interface to download and configure the
>> hardware block to use with PCIe/1G/10G/SRIO. I queried the linux forum
>> on this and the response was that firmware interface can be used for
>> this. The patch will be using the firmware interface instead of
>> embedding magic values in the serdes driver.
>>
> Firmware interface usage seems to be correct way.
> Thanks for giving the details. It helped me to get better picture.
>
> Regards,
> Santosh
>
> Regards,
> Santosh
>
>
Santosh Shilimkar Sept. 2, 2015, 6:25 p.m. UTC | #7
9/2/2015 10:58 AM, Murali Karicheri wrote:
> On 09/02/2015 01:24 PM, santosh shilimkar wrote:
>> On 9/2/2015 9:35 AM, Murali Karicheri wrote:
>>> Santosh,
>>>
>
> ---Cut-------------------
>
>>>> I suspected the same. I know back then we started with SERDES code
>>>> with NETCP but as you already know, its a separate block which
>>>> is needed for NIC card to work. Its more of phy and hence its
>>>> having different address space is not surprising.
>>>
>>> Using Phy interface is not acceptable to the subsystem maintainer based
>>> on the communication I had on this. Also the Phy here is tighly coupled
>>> with the hardware block it is working with. So this model is not right
>>> for SerDes driver as it require additional enhancements as described
>>> below if needs to be used.
>>>
>> Thanks for update on that.
>>
>>> The serdes initialization procedure requires checking the status in the
>>> hardware block (PCIe, 1G or 10G) and then taking corrective action. This
>>> means a Phy driver would require mapping of related hw address space
>>> (PCIe, 1G and 10G) as well which is already mapped by the hardware
>>> driver(PCIe, 1G and 10G). One solution is to treat this as a libray
>>> function that can be called from the respective hardware device driver.
>>>   A device node of h/w device (PCIe or 1G) in such as looks like
>>>
>> Or SerDes driver can embed the status reg address space.
>> This is read only access so should be fine.
>>
>>> pcie {
>>>
>>>      serdes@someaddress {
>>>          reg = <address of serdes>;
>>>      }
>>> }
>>>
>>> hw driver will call ks2_serdes_init(node, hw_base_address) to initialize
>>> the serdes. Other APIs can be added to enable/disable lane or shutdown
>>> etc. The libary will be added to drivers/soc/ti/ and used by various
>>> device drivers to initialize and use the phy. As the serdes is slightly
>>> integrated with the hardware block, IMO, this is a better approach than
>>> using the phy model. The API definitions will be added to
>>> include/linux/soc/ti/ folder.
>>>
>> Serdes Driver with its status register address space might solve this
>> sharing problem. Library might work but we should try to have driver
>> considering there is a physical device. I don't have strong opinion
>> on drivers vs library.
>>
>
> In addition to checking status in the SerDes, it needs to also check the
> status of the associated hardware block (PCIe, 1G, 10G etc). So this
> means, same needs to be mapped twice, first by the above hardware device
> drivers and then by the serdes driver which causes problem. My point is
> since they both are tightly coupled, a libary is a better option. That
> way the mapped address can be passed to the serdes API to perform the
> required task, instead of using Phy API which doesn't allow us to do the
> same. If SerDes h/w can be brought up independently, the Phy model fits
> well.
>
As I said, I don't have strong preference and fine with library approach.
I suggest you do a RFC to take this further. Include Arnd on CC for
that.

Regards,
Santosh
Murali Karicheri Sept. 2, 2015, 6:42 p.m. UTC | #8
On 09/02/2015 02:25 PM, santosh shilimkar wrote:
> 9/2/2015 10:58 AM, Murali Karicheri wrote:
>> On 09/02/2015 01:24 PM, santosh shilimkar wrote:
>>> On 9/2/2015 9:35 AM, Murali Karicheri wrote:
>>>> Santosh,
>>>>
>>
>> ---Cut-------------------
>>
>>>>> I suspected the same. I know back then we started with SERDES code
>>>>> with NETCP but as you already know, its a separate block which
>>>>> is needed for NIC card to work. Its more of phy and hence its
>>>>> having different address space is not surprising.
>>>>
>>>> Using Phy interface is not acceptable to the subsystem maintainer based
>>>> on the communication I had on this. Also the Phy here is tighly coupled
>>>> with the hardware block it is working with. So this model is not right
>>>> for SerDes driver as it require additional enhancements as described
>>>> below if needs to be used.
>>>>
>>> Thanks for update on that.
>>>
>>>> The serdes initialization procedure requires checking the status in the
>>>> hardware block (PCIe, 1G or 10G) and then taking corrective action.
>>>> This
>>>> means a Phy driver would require mapping of related hw address space
>>>> (PCIe, 1G and 10G) as well which is already mapped by the hardware
>>>> driver(PCIe, 1G and 10G). One solution is to treat this as a libray
>>>> function that can be called from the respective hardware device driver.
>>>>   A device node of h/w device (PCIe or 1G) in such as looks like
>>>>
>>> Or SerDes driver can embed the status reg address space.
>>> This is read only access so should be fine.
>>>
>>>> pcie {
>>>>
>>>>      serdes@someaddress {
>>>>          reg = <address of serdes>;
>>>>      }
>>>> }
>>>>
>>>> hw driver will call ks2_serdes_init(node, hw_base_address) to
>>>> initialize
>>>> the serdes. Other APIs can be added to enable/disable lane or shutdown
>>>> etc. The libary will be added to drivers/soc/ti/ and used by various
>>>> device drivers to initialize and use the phy. As the serdes is slightly
>>>> integrated with the hardware block, IMO, this is a better approach than
>>>> using the phy model. The API definitions will be added to
>>>> include/linux/soc/ti/ folder.
>>>>
>>> Serdes Driver with its status register address space might solve this
>>> sharing problem. Library might work but we should try to have driver
>>> considering there is a physical device. I don't have strong opinion
>>> on drivers vs library.
>>>
>>
>> In addition to checking status in the SerDes, it needs to also check the
>> status of the associated hardware block (PCIe, 1G, 10G etc). So this
>> means, same needs to be mapped twice, first by the above hardware device
>> drivers and then by the serdes driver which causes problem. My point is
>> since they both are tightly coupled, a libary is a better option. That
>> way the mapped address can be passed to the serdes API to perform the
>> required task, instead of using Phy API which doesn't allow us to do the
>> same. If SerDes h/w can be brought up independently, the Phy model fits
>> well.
>>
> As I said, I don't have strong preference and fine with library approach.
> I suggest you do a RFC to take this further. Include Arnd on CC for
> that.

Sure!

Murali
>
> Regards,
> Santosh
>
>
>
>
Tony Lindgren Sept. 3, 2015, 2:26 p.m. UTC | #9
* santosh shilimkar <santosh.shilimkar@oracle.com> [150902 08:55]:
>
> I suspected the same. I know back then we started with SERDES code
> with NETCP but as you already know, its a separate block which
> is needed for NIC card to work. Its more of phy and hence its
> having different address space is not surprising.

The point Santosh is making here though is that any drivers
tinkering with registers belonging to a separate hardware block
is a recipe for a long term maintenance nightmare with mysterious
bugs popping up as things are not clocked or powered properly
or become racy with other drivers.

Each hardware block needs to have it's own driver and then the
drivers can communicate using some Linux generic APIs like clock,
regulator, phy, or mailbox frameworks.

Regards,

Tony
Santosh Shilimkar Sept. 3, 2015, 2:48 p.m. UTC | #10
On 9/3/15 7:26 AM, Tony Lindgren wrote:
> * santosh shilimkar <santosh.shilimkar@oracle.com> [150902 08:55]:
>>
>> I suspected the same. I know back then we started with SERDES code
>> with NETCP but as you already know, its a separate block which
>> is needed for NIC card to work. Its more of phy and hence its
>> having different address space is not surprising.
>
> The point Santosh is making here though is that any drivers
> tinkering with registers belonging to a separate hardware block
> is a recipe for a long term maintenance nightmare with mysterious
> bugs popping up as things are not clocked or powered properly
> or become racy with other drivers.
>
> Each hardware block needs to have it's own driver and then the
> drivers can communicate using some Linux generic APIs like clock,
> regulator, phy, or mailbox frameworks.
>
Right !!

Regards,
Santosh
Murali Karicheri Sept. 3, 2015, 7:18 p.m. UTC | #11
Tony,
On 09/03/2015 10:26 AM, Tony Lindgren wrote:
> * santosh shilimkar <santosh.shilimkar@oracle.com> [150902 08:55]:
>>
>> I suspected the same. I know back then we started with SERDES code
>> with NETCP but as you already know, its a separate block which
>> is needed for NIC card to work. Its more of phy and hence its
>> having different address space is not surprising.
>
> The point Santosh is making here though is that any drivers
> tinkering with registers belonging to a separate hardware block
> is a recipe for a long term maintenance nightmare with mysterious

That is what we want to avoid as well. If I interpret your statement 
correctly, you don't want SerDes driver update the register of say 
SGMII, right? But we will have to based on the hardware design. So it 
can't be a standalone device driver IMO and it has to be part of the 
respective peripheral device driver.

> bugs popping up as things are not clocked or powered properly
> or become racy with other drivers.
>
> Each hardware block needs to have it's own driver and then the
> drivers can communicate using some Linux generic APIs like clock,
> regulator, phy, or mailbox frameworks.

That depends on what your definition of a hardware block is. Inside 
NetCP, there are many hardware blocks that work together to provide the 
NIC functionality, and SerDes is one of them. Where ever possible, we 
have separate drivers :- knav qmss, knav pkt dma, ethss, mdio etc. Ethss 
driver manages Eth subsystem that includes SGMII and SerDes. 
Unfortunately SerDes is tightly integrated with ethss and taking it out 
as a separate driver (Say Phy) is not a good idea. We will posting an 
RFC for this soon and probably we can discuss it more then.

Probably we will fold this into the RFC series to give this a better 
context.

Murali

>
> Regards,
>
> Tony
>
Tony Lindgren Sept. 8, 2015, 3:13 p.m. UTC | #12
* Murali Karicheri <m-karicheri2@ti.com> [150903 12:21]:
> Tony,
> On 09/03/2015 10:26 AM, Tony Lindgren wrote:
> >* santosh shilimkar <santosh.shilimkar@oracle.com> [150902 08:55]:
> >>
> >>I suspected the same. I know back then we started with SERDES code
> >>with NETCP but as you already know, its a separate block which
> >>is needed for NIC card to work. Its more of phy and hence its
> >>having different address space is not surprising.
> >
> >The point Santosh is making here though is that any drivers
> >tinkering with registers belonging to a separate hardware block
> >is a recipe for a long term maintenance nightmare with mysterious
> 
> That is what we want to avoid as well. If I interpret your statement
> correctly, you don't want SerDes driver update the register of say SGMII,
> right? But we will have to based on the hardware design. So it can't be a
> standalone device driver IMO and it has to be part of the respective
> peripheral device driver.

If it's a separate target on the interconnect it should be a separate
driver. Depending on the SoC version these targets can move around
as we've seen.

> >bugs popping up as things are not clocked or powered properly
> >or become racy with other drivers.
> >
> >Each hardware block needs to have it's own driver and then the
> >drivers can communicate using some Linux generic APIs like clock,
> >regulator, phy, or mailbox frameworks.
> 
> That depends on what your definition of a hardware block is. Inside NetCP,
> there are many hardware blocks that work together to provide the NIC
> functionality, and SerDes is one of them. Where ever possible, we have
> separate drivers :- knav qmss, knav pkt dma, ethss, mdio etc. Ethss driver
> manages Eth subsystem that includes SGMII and SerDes. Unfortunately SerDes
> is tightly integrated with ethss and taking it out as a separate driver (Say
> Phy) is not a good idea. We will posting an RFC for this soon and probably
> we can discuss it more then.

A separate target on the interconnect is the best criteria to use
here. This is because two targets may or may not share some resources
and can get rearranged depending on the SoC.

Regards,

Tony
diff mbox

Patch

diff --git a/arch/arm/boot/dts/k2e-netcp.dtsi b/arch/arm/boot/dts/k2e-netcp.dtsi
index b13b3c9..e103ed9 100644
--- a/arch/arm/boot/dts/k2e-netcp.dtsi
+++ b/arch/arm/boot/dts/k2e-netcp.dtsi
@@ -111,9 +111,7 @@  netcp: netcp@24000000 {
 	compatible = "ti,netcp-1.0";
 	#address-cells = <1>;
 	#size-cells = <1>;
-
-	/* NetCP address range */
-	ranges = <0 0x24000000 0x1000000>;
+	ranges;
 
 	clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
 	dma-coherent;
@@ -127,10 +125,10 @@  netcp: netcp@24000000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges;
-		gbe@200000 { /* ETHSS */
+		gbe@24200000 { /* ETHSS */
 			label = "netcp-gbe";
 			compatible = "ti,netcp-gbe-9";
-			reg = <0x200000 0x900>, <0x220000 0x20000>;
+			reg = <0x24200000 0x900>, <0x24220000 0x20000>;
 			/* enable-ale; */
 			tx-queue = <896>;
 			tx-channel = "nettx";
diff --git a/arch/arm/boot/dts/k2hk-netcp.dtsi b/arch/arm/boot/dts/k2hk-netcp.dtsi
index 77a32c3..3b885f5 100644
--- a/arch/arm/boot/dts/k2hk-netcp.dtsi
+++ b/arch/arm/boot/dts/k2hk-netcp.dtsi
@@ -127,9 +127,7 @@  netcp: netcp@2000000 {
 	compatible = "ti,netcp-1.0";
 	#address-cells = <1>;
 	#size-cells = <1>;
-
-	/* NetCP address range */
-	ranges  = <0 0x2000000 0x100000>;
+	ranges;
 
 	clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
 	dma-coherent;
@@ -140,15 +138,15 @@  netcp: netcp@2000000 {
 	ti,navigator-dma-names = "netrx0", "netrx1", "nettx";
 
 	netcp-devices {
-		ranges;
 		#address-cells = <1>;
 		#size-cells = <1>;
-		gbe@90000 { /* ETHSS */
-			#address-cells = <1>;
-			#size-cells = <1>;
+		ranges;
+		gbe@2090000 { /* ETHSS */
 			label = "netcp-gbe";
 			compatible = "ti,netcp-gbe";
-			reg = <0x90000 0x300>, <0x90400 0x400>, <0x90800 0x700>;
+			reg = <0x02090000 0x300>,
+			      <0x02090400 0x400>,
+			      <0x02090800 0x700>;
 			/* enable-ale; */
 			tx-queue = <648>;
 			tx-channel = "nettx";
diff --git a/arch/arm/boot/dts/k2l-netcp.dtsi b/arch/arm/boot/dts/k2l-netcp.dtsi
index 6b95284..97ae805 100644
--- a/arch/arm/boot/dts/k2l-netcp.dtsi
+++ b/arch/arm/boot/dts/k2l-netcp.dtsi
@@ -110,9 +110,7 @@  netcp: netcp@26000000 {
 	compatible = "ti,netcp-1.0";
 	#address-cells = <1>;
 	#size-cells = <1>;
-
-	/* NetCP address range */
-	ranges = <0 0x26000000 0x1000000>;
+	ranges;
 
 	clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
 	dma-coherent;
@@ -126,10 +124,10 @@  netcp: netcp@26000000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges;
-		gbe@200000 { /* ETHSS */
+		gbe@26200000 { /* ETHSS */
 			label = "netcp-gbe";
 			compatible = "ti,netcp-gbe-5";
-			reg = <0x200000 0x900>, <0x220000 0x20000>;
+			reg = <0x26200000 0x900>, <0x26220000 0x20000>;
 			/* enable-ale; */
 			tx-queue = <896>;
 			tx-channel = "nettx";