Skip to content

Commit

Permalink
Merge branch 'hns-debug-dsaf'
Browse files Browse the repository at this point in the history
Yisen Zhuang says:

====================
net: hns: add support of debug dsaf device

There are two kinds of dsaf device in hns, one is for service ports,
contains crossbar in it, can work under different mode. Another is for
debug port, only can work under single port mode. The current code only
declares a dsaf device for both service ports and debug ports.It is not so
readability. This patch separates it to three platform devices to make the
code more simple and readability.

The diagram of all port in one platform device(old):
                                        CPU
                                         |
                                         |        DSAF(one platform device)
    --------------------------------------------------------------      /
    |                           |                  |      |      |     /
    |                          PPE                PPE    PPE     |    /
    |                           |                  |      |      |   /
    |                           |                  |      |      |  /
    |                        crossbar              |      |      | /
    |                           |                  |      |      |/
    |    -----------------------------------       |      |      |
    |    |      |      |      |      |      |      |      |      |
    |    |      |      |      |      |      |      |      |      |
    |   MAC    MAC    MAC    MAC    MAC    MAC    MAC    MAC     |
    |    |      |      |      |      |      |      |      |      |
    --------------------------------------------------------------
         |      |      |      |      |      |      |      |
        PHY    PHY    PHY    PHY    PHY    PHY    PHY    PHY

The diagram of separating ports to three platform(new):
                                                         CPU
                                                          |
                                    -----------------------------------
                                    |                     |           |
    ----------------------------------------------    ---------   ---------
    |                         |                  |    |       |   |   |   |
    |                        PPE                 |    |  PPE  |   |  PPE  |
    |                         |                  |    |   |   |   |   |   |
    |                         |                  |    |   |   |   |   |   |
    |                      crossbar              |    |   |   |   |   |   |
    |                         |                  |    |   |   |   |   |   |
    |   ----------------------------------       |    |   |   |   |   |   |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    |  MAC   MAC   MAC    MAC    MAC    MAC      |    |  MAC  |   |  MAC  |
    |   |     |     |      |      |      |       |    |   |   |   |   |   |
    ----------------------------------------------    ---------   ---------
        |     |     |      |      |      |    \        /  |        /  |
       PHY   PHY   PHY    PHY    PHY    PHY    \      /  PHY      /  PHY
                                                \    /           /
                                                 \  /           /
                                             DSAF(three platform device)

We take the compatibility into consideration, and it works well by using the
old dts file(tested on d02 board).

For more details, please see individual patches.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Apr 26, 2016
2 parents 5a5f079 + 218afd6 commit 218afa1
Show file tree
Hide file tree
Showing 16 changed files with 610 additions and 496 deletions.
59 changes: 49 additions & 10 deletions Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,47 @@ Required properties:
- mode: dsa fabric mode string. only support one of dsaf modes like these:
"2port-64vf",
"6port-16rss",
"6port-16vf".
"6port-16vf",
"single-port".
- interrupt-parent: the interrupt parent of this device.
- interrupts: should contain the DSA Fabric and rcb interrupt.
- reg: specifies base physical address(es) and size of the device registers.
The first region is external interface control register base and size.
The second region is SerDes base register and size.
The first region is external interface control register base and size(optional,
only be used when subctrl-syscon is not exists). It is recommended using
subctrl-syscon rather than this address.
The second region is SerDes base register and size(optional, only be used when
serdes-syscon in port node is not exists. It is recommended using
serdes-syscon rather than this address.
The third region is the PPE register base and size.
The fourth region is dsa fabric base register and size.
The fifth region is cpld base register and size, it is not required if do not use cpld.
- phy-handle: phy handle of physicl port, 0 if not any phy device. see ethernet.txt [1].
The fourth region is dsa fabric base register and size. It is not required for
single-port mode.
- reg-names: may be ppe-base and(or) dsaf-base. It is used to find the
corresponding reg's index.

- phy-handle: phy handle of physicl port, 0 if not any phy device. It is optional
attribute. If port node is exists, phy-handle in each port node will be used.
see ethernet.txt [1].
- subctrl-syscon: is syscon handle for external interface control register.
- reset-field-offset: is offset of reset field. Its value depends on the hardware
user manual.
- buf-size: rx buffer size, should be 16-1024.
- desc-num: number of description in TX and RX queue, should be 512, 1024, 2048 or 4096.

- port: subnodes of dsaf. A dsaf node may contain several port nodes(Depending
on mode of dsaf). Port node contain some attributes listed below:
- port-id: is physical port index in one dsaf.
- phy-handle: phy handle of physicl port. It is not required if there isn't
phy device. see ethernet.txt [1].
- serdes-syscon: is syscon handle for SerDes register.
- cpld-syscon: is syscon handle for cpld register. It is not required if there
isn't cpld device.
- cpld-ctrl-reg: is cpld register offset. It is not required if there isn't
cpld-syscon.
- port-rst-offset: is offset of reset field for each port in dsaf. Its value
depends on the hardware user manual.
- port-mode-offset: is offset of port mode field for each port in dsaf. Its
value depends on the hardware user manual.

[1] Documentation/devicetree/bindings/net/phy.txt

Example:
Expand All @@ -28,11 +56,11 @@ dsaf0: dsa@c7000000 {
compatible = "hisilicon,hns-dsaf-v1";
mode = "6port-16rss";
interrupt-parent = <&mbigen_dsa>;
reg = <0x0 0xC0000000 0x0 0x420000
0x0 0xC2000000 0x0 0x300000
0x0 0xc5000000 0x0 0x890000
reg = <0x0 0xc5000000 0x0 0x890000
0x0 0xc7000000 0x0 0x60000>;
phy-handle = <0 0 0 0 &soc0_phy4 &soc0_phy5 0 0>;
reg-names = "ppe-base", "dsaf-base";
subctrl-syscon = <&subctrl>;
reset-field-offset = 0;
interrupts = <131 4>,<132 4>, <133 4>,<134 4>,
<135 4>,<136 4>, <137 4>,<138 4>,
<139 4>,<140 4>, <141 4>,<142 4>,
Expand All @@ -43,4 +71,15 @@ dsaf0: dsa@c7000000 {
buf-size = <4096>;
desc-num = <1024>;
dma-coherent;

prot@0 {
port-id = 0;
phy-handle = <&phy0>;
serdes-syscon = <&serdes>;
};

prot@1 {
port-id = 1;
serdes-syscon = <&serdes>;
};
};
30 changes: 29 additions & 1 deletion Documentation/devicetree/bindings/net/hisilicon-hns-nic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,41 @@ Required properties:
| | | | | |
external port

This attribute is remained for compatible purpose. It is not recommended to
use it in new code.

- port-idx-in-ae: is the index of port provided by AE.
In NIC mode of DSAF, all 6 PHYs of service DSAF are taken as ethernet ports
to the CPU. The port-idx-in-ae can be 0 to 5. Here is the diagram:
+-----+---------------+
| CPU |
+-+-+-+---+-+-+-+-+-+-+
| | | | | | | |
debug debug service
port port port
(0) (0) (0-5)

In Switch mode of DSAF, all 6 PHYs of service DSAF are taken as physical
ports connected to a LAN Switch while the CPU side assume itself have one
single NIC connected to this switch. In this case, the port-idx-in-ae
will be 0 only.
+-----+-----+------+------+
| CPU |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | service| port(0)
debug debug +------------+
port port | switch |
(0) (0) +-+-+-+-+-+-++
| | | | | |
external port

- local-mac-address: mac addr of the ethernet interface

Example:

ethernet@0{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <0>;
port-idx-in-ae = <0>;
local-mac-address = [a2 14 e4 4b 56 76];
};
72 changes: 30 additions & 42 deletions arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ soc0: soc@000000000 {
mode = "6port-16rss";
interrupt-parent = <&mbigen_dsa>;

reg = <0x0 0xC0000000 0x0 0x420000
0x0 0xC2000000 0x0 0x300000
0x0 0xc5000000 0x0 0x890000
reg = <0x0 0xc5000000 0x0 0x890000
0x0 0xc7000000 0x0 0x60000
>;

phy-handle = <0 0 0 0 &soc0_phy0 &soc0_phy1 0 0>;
reg-names = "ppe-base","dsaf-base";
subctrl-syscon = <&dsaf_subctrl>;
reset-field-offset = <0>;
interrupts = <
/* [14] ge fifo err 8 / xge 6**/
149 0x4 150 0x4 151 0x4 152 0x4
Expand Down Expand Up @@ -122,69 +122,57 @@ soc0: soc@000000000 {
buf-size = <4096>;
desc-num = <1024>;
dma-coherent;

port@0 {
port-id = <0>;
serdes-syscon = <&serdes_ctrl0>;
};
port@1 {
port-id = <1>;
serdes-syscon = <&serdes_ctrl0>;
};
port@4 {
port-id = <4>;
phy-handle = <&soc0_phy0>;
serdes-syscon = <&serdes_ctrl1>;
};
port@5 {
port-id = <5>;
phy-handle = <&soc0_phy1>;
serdes-syscon = <&serdes_ctrl1>;
};
};

eth0: ethernet@0{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <0>;
port-idx-in-ae = <0>;
local-mac-address = [00 00 00 01 00 58];
status = "disabled";
dma-coherent;
};
eth1: ethernet@1{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <1>;
port-idx-in-ae = <1>;
local-mac-address = [00 00 00 01 00 59];
status = "disabled";
dma-coherent;
};
eth2: ethernet@2{
eth2: ethernet@4{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <2>;
port-idx-in-ae = <4>;
local-mac-address = [00 00 00 01 00 5a];
status = "disabled";
dma-coherent;
};
eth3: ethernet@3{
eth3: ethernet@5{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <3>;
port-idx-in-ae = <5>;
local-mac-address = [00 00 00 01 00 5b];
status = "disabled";
dma-coherent;
};
eth4: ethernet@4{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <4>;
local-mac-address = [00 00 00 01 00 5c];
status = "disabled";
dma-coherent;
};
eth5: ethernet@5{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <5>;
local-mac-address = [00 00 00 01 00 5d];
status = "disabled";
dma-coherent;
};
eth6: ethernet@6{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <6>;
local-mac-address = [00 00 00 01 00 5e];
status = "disabled";
dma-coherent;
};
eth7: ethernet@7{
compatible = "hisilicon,hns-nic-v1";
ae-handle = <&dsaf0>;
port-id = <7>;
local-mac-address = [00 00 00 01 00 5f];
status = "disabled";
dma-coherent;
};
};
Loading

0 comments on commit 218afa1

Please sign in to comment.