Skip to contentSkip to conversation

net: ethernet: faraday: To support device tree usage.

PATCH Superseded Greentime Hu 3 participants 5 messages Dec 30, 2016 – Jan 4, 2017 2 messages not in the archive

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: ethernet: faraday: To support device tree usage.

---
Changes in v3:
- Nothing changed in this patch but I have committed andestech to vendor-prefixes.txt.

 drivers/net/ethernet/faraday/ftmac100.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/ethernet/faraday/ftmac100.c +7 -0
index dce5f7b..5d70ee9 100644
@@ -1172,11 +1172,17 @@ static int __exit ftmac100_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id ftmac100_of_ids[] = {
+	{ .compatible = "andestech,atmac100" },
+	{ }
+};
+
 static struct platform_driver ftmac100_driver = {
 	.probe		= ftmac100_probe,
 	.remove		= __exit_p(ftmac100_remove),
 	.driver		= {
 		.name	= DRV_NAME,
+		.of_match_table = ftmac100_of_ids
 	},
 };
 
@@ -1200,3 +1206,4 @@ static void __exit ftmac100_exit(void)
 MODULE_AUTHOR("Po-Yu Chuang <[email protected]>");
 MODULE_DESCRIPTION("FTMAC100 driver");
 MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, ftmac100_of_ids);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 1 line · Greentime Hu

This is not enough, you need to add a Device Tree binding document under Documentation/devicetree/bindings/net/ which documents this compatible string, as well as additional properties that may be required to describe this hardware block.

Signature · 5 lines
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 8 lines · CET Florian Fainelli
Quoted 1 line · Greentime Hu

This is not enough, you need to add a Device Tree binding document under Documentation/devicetree/bindings/net/ which documents this compatible string, as well as additional properties that may be required to describe this hardware block.

We already have

Documentation/devicetree/bindings/net/moxa,moxart-mac.txt

for the same hardware (though used by a different driver).

I'd suggest renaming that one to a more generic file name and adding the new compatible string there.

Aside from that, every patch should also have a changelog comment.

Arnd

#4 lore raw
In reply to a message not in the archive
Quoted 4 lines · CET Greentime Hu

​I am not sure if atmac and moxa-art are exactly hardware compatible though they are based on faraday ftmac.
It may be better if we use 2 different device tree binding documents to describe for these 2 different drivers to use.

They are probably slightly different, but close enough to have the same binding document, as there is no technical reason to have two separate drivers for them. The binding should be about the hardware type, not the way that Linux currently implements the drivers.

Arnd

#6 lore raw
In reply to a message not in the archive
Quoted 21 lines · CET Greentime Hu
Quoted 7 lines · Arnd Bergmann
Quoted 1 line · CET Greentime Hu

​I am not sure if atmac and moxa-art are exactly hardware compatible

though

Quoted 3 lines

they are based on faraday ftmac.
It may be better if we use 2 different device tree binding documents to describe for these 2 different drivers to use.

Quoted 8 lines

They are probably slightly different, but close enough to have the same binding document, as there is no technical reason to have two separate drivers for them. The binding should be about the hardware type, not the way that Linux currently implements the drivers.

Arnd

OK.

How about this?

Quoted 7 lines

rename Documentation/devicetree/bindings/net/moxa,moxart-mac.txt to Documentation/devicetree/bindings/net/faraday,ftmac.txt

and the content to
Faraday Ethernet Controller

Sounds good. Note that you can use 'git patch -M' to produce this as a renaming patch.

Quoted 5 lines

Required properties:

- compatible : Must be "moxa,moxart-mac" or "andestech,atmac" or "faraday,ftmac"

I'd write this as

compatible: Must contain "faraday,ftmac", as well as one of
the SoC specific identifiers:
"andestec,atmac" "moxa,moxart-mac"

This makes it easier to extend, plus it makes the generic string mandatory.

Arnd