Commit 48189d6a authored by yankejian's avatar yankejian Committed by David S. Miller
Browse files

net: hns: enet specifies a reference to dsaf



This patch replace the assoication between dsaf and enet from string
matching to object reference. It requires the DTS to be updated within
BIOS. Thanks god it can be done for all released boards.

Signed-off-by: default avatarKejian Yan <yankejian@huawei.com>
Acked-by: default avatarRob Herring <robh@kernel.org>
Acked-by: default avatarYisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e62a123b
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@ Required properties:
- compatible: should be "hisilicon,hns-dsaf-v1" or "hisilicon,hns-dsaf-v2".
  "hisilicon,hns-dsaf-v1" is for hip05.
  "hisilicon,hns-dsaf-v2" is for Hi1610 and Hi1612.
- dsa-name: dsa fabric name who provide this interface.
  should be "dsafX", X is the dsaf id.
- mode: dsa fabric mode string. only support one of dsaf modes like these:
		"2port-64vf",
		"6port-16rss",
@@ -26,9 +24,8 @@ Required properties:

Example:

dsa: dsa@c7000000 {
dsaf0: dsa@c7000000 {
	compatible = "hisilicon,hns-dsaf-v1";
	dsa_name = "dsaf0";
	mode = "6port-16rss";
	interrupt-parent = <&mbigen_dsa>;
	reg = <0x0 0xC0000000 0x0 0x420000
+4 −3
Original line number Diff line number Diff line
@@ -4,8 +4,9 @@ Required properties:
- compatible: "hisilicon,hns-nic-v1" or "hisilicon,hns-nic-v2".
  "hisilicon,hns-nic-v1" is for hip05.
  "hisilicon,hns-nic-v2" is for Hi1610 and Hi1612.
- ae-name: accelerator name who provides this interface,
  is simply a name referring to the name of name in the accelerator node.
- ae-handle: accelerator engine handle for hns,
  specifies a reference to the associating hardware driver node.
  see Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt
- port-id: is the index of port provided by DSAF (the accelerator). DSAF can
  connect to 8 PHYs. Port 0 to 1 are both used for adminstration purpose. They
  are called debug ports.
@@ -41,7 +42,7 @@ Example:

	ethernet@0{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <0>;
		local-mac-address = [a2 14 e4 4b 56 76];
	};
+9 −10
Original line number Diff line number Diff line
@@ -23,9 +23,8 @@ soc0: soc@000000000 {
		};
	};

	dsa: dsa@c7000000 {
	dsaf0: dsa@c7000000 {
		compatible = "hisilicon,hns-dsaf-v1";
		dsa_name = "dsaf0";
		mode = "6port-16rss";
		interrupt-parent = <&mbigen_dsa>;

@@ -127,7 +126,7 @@ soc0: soc@000000000 {

	eth0: ethernet@0{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <0>;
		local-mac-address = [00 00 00 01 00 58];
		status = "disabled";
@@ -135,14 +134,14 @@ soc0: soc@000000000 {
	};
	eth1: ethernet@1{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <1>;
		status = "disabled";
		dma-coherent;
	};
	eth2: ethernet@2{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <2>;
		local-mac-address = [00 00 00 01 00 5a];
		status = "disabled";
@@ -150,7 +149,7 @@ soc0: soc@000000000 {
	};
	eth3: ethernet@3{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <3>;
		local-mac-address = [00 00 00 01 00 5b];
		status = "disabled";
@@ -158,7 +157,7 @@ soc0: soc@000000000 {
	};
	eth4: ethernet@4{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <4>;
		local-mac-address = [00 00 00 01 00 5c];
		status = "disabled";
@@ -166,7 +165,7 @@ soc0: soc@000000000 {
	};
	eth5: ethernet@5{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <5>;
		local-mac-address = [00 00 00 01 00 5d];
		status = "disabled";
@@ -174,7 +173,7 @@ soc0: soc@000000000 {
	};
	eth6: ethernet@6{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <6>;
		local-mac-address = [00 00 00 01 00 5e];
		status = "disabled";
@@ -182,7 +181,7 @@ soc0: soc@000000000 {
	};
	eth7: ethernet@7{
		compatible = "hisilicon,hns-nic-v1";
		ae-name = "dsaf0";
		ae-handle = <&dsaf0>;
		port-id = <7>;
		local-mac-address = [00 00 00 01 00 5f];
		status = "disabled";
+7 −10
Original line number Diff line number Diff line
@@ -95,21 +95,17 @@ static struct hnae_buf_ops hnae_bops = {
static int __ae_match(struct device *dev, const void *data)
{
	struct hnae_ae_dev *hdev = cls_to_ae_dev(dev);
	const char *ae_id = data;

	if (!strncmp(ae_id, hdev->name, AE_NAME_SIZE))
		return 1;

	return 0;
	return hdev->dev->of_node == data;
}

static struct hnae_ae_dev *find_ae(const char *ae_id)
static struct hnae_ae_dev *find_ae(const struct device_node *ae_node)
{
	struct device *dev;

	WARN_ON(!ae_id);
	WARN_ON(!ae_node);

	dev = class_find_device(hnae_class, NULL, ae_id, __ae_match);
	dev = class_find_device(hnae_class, NULL, ae_node, __ae_match);

	return dev ? cls_to_ae_dev(dev) : NULL;
}
@@ -316,7 +312,8 @@ EXPORT_SYMBOL(hnae_reinit_handle);
 * return handle ptr or ERR_PTR
 */
struct hnae_handle *hnae_get_handle(struct device *owner_dev,
				    const char *ae_id, u32 port_id,
				    const struct device_node *ae_node,
				    u32 port_id,
				    struct hnae_buf_ops *bops)
{
	struct hnae_ae_dev *dev;
@@ -324,7 +321,7 @@ struct hnae_handle *hnae_get_handle(struct device *owner_dev,
	int i, j;
	int ret;

	dev = find_ae(ae_id);
	dev = find_ae(ae_node);
	if (!dev)
		return ERR_PTR(-ENODEV);

+5 −2
Original line number Diff line number Diff line
@@ -524,8 +524,11 @@ struct hnae_handle {

#define ring_to_dev(ring) ((ring)->q->dev->dev)

struct hnae_handle *hnae_get_handle(struct device *owner_dev, const char *ae_id,
				    u32 port_id, struct hnae_buf_ops *bops);
struct hnae_handle *hnae_get_handle(struct device *owner_dev,
				    const struct device_node *ae_node,
				    u32 port_id,
				    struct hnae_buf_ops *bops);

void hnae_put_handle(struct hnae_handle *handle);
int hnae_ae_register(struct hnae_ae_dev *dev, struct module *owner);
void hnae_ae_unregister(struct hnae_ae_dev *dev);
Loading