[PATCH 3/6] mv643xx.c: Add basic device tree support.

STALE5154d

5 messages, 4 authors, 2012-07-31 · open the first message on its own page

[PATCH 3/6] mv643xx.c: Add basic device tree support.

From: Arnaud Patard Rtp <hidden>
Date: 2012-07-31 07:14:54

Ian Molton [off-list ref] writes:
Hi,

[...]
quoted hunk
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number", &pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr", &pd->phy_addr);
I guess we need something for tx_csum_limit in the device tree too. It's
important for kirkwood and dove.

Arnaud

[PATCH 3/6] mv643xx.c: Add basic device tree support.

From: Ian Molton <hidden>
Date: 2012-07-31 08:19:52

On 31/07/12 08:14, Arnaud Patard (Rtp) wrote:
Ian Molton [off-list ref] writes:
Hi,

[...]
quoted
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number", &pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr", &pd->phy_addr);
I guess we need something for tx_csum_limit in the device tree too. It's
important for kirkwood and dove.
It was my intention to keep the patch as non-invasive as possible - none
of the platforms using D-T at present require this.

Furthermore, git grep shows nothing in mach-kirkwood or mach-dove using
at all...

Are you sure this is required? It can always be added if anything
actually uses it :)

-Ian

[PATCH 3/6] mv643xx.c: Add basic device tree support.

From: andrew@lunn.ch (Andrew Lunn)
Date: 2012-07-31 08:27:42

On Tue, Jul 31, 2012 at 09:19:52AM +0100, Ian Molton wrote:
On 31/07/12 08:14, Arnaud Patard (Rtp) wrote:
quoted
Ian Molton [off-list ref] writes:
Hi,

[...]
quoted
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number", &pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr", &pd->phy_addr);
I guess we need something for tx_csum_limit in the device tree too. It's
important for kirkwood and dove.
It was my intention to keep the patch as non-invasive as possible - none
of the platforms using D-T at present require this.

Furthermore, git grep shows nothing in mach-kirkwood or mach-dove using
at all...

Are you sure this is required? It can always be added if anything
actually uses it :)
Hi Ian

Try using jumbo packets on kirkwood.

http://comments.gmane.org/gmane.linux.ports.arm.kernel/178785
http://www.spinics.net/lists/arm-kernel/msg186152.html

	Andrew

[PATCH 3/6] mv643xx.c: Add basic device tree support.

From: Ian Molton <hidden>
Date: 2012-07-31 08:45:37

On 31/07/12 09:27, Andrew Lunn wrote:
On Tue, Jul 31, 2012 at 09:19:52AM +0100, Ian Molton wrote:
quoted
Are you sure this is required? It can always be added if anything
actually uses it :)
Hi Ian

Try using jumbo packets on kirkwood.

http://comments.gmane.org/gmane.linux.ports.arm.kernel/178785
http://www.spinics.net/lists/arm-kernel/msg186152.html
Ah, this postdates the D-T branches on which I am working being forked.

I'll fold this into my patchset.

-Ian

[PATCH 3/6] mv643xx.c: Add basic device tree support.

From: Ben Dooks <hidden>
Date: 2012-07-31 14:30:00

On 31/07/12 08:14, Arnaud Patard (Rtp) wrote:
Ian Molton[off-list ref]  writes:
Hi,

[...]
quoted
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
  	struct resource *res;
  	int err;

-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number",&pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr",&pd->phy_addr);
I guess we need something for tx_csum_limit in the device tree too. It's
important for kirkwood and dove.
Is this something for all kirkwood devices? I think the best way of
doing this is to give the driver a new device-tree name and having
it set this field in the init sequence.

However we could also do with some of these as dt parameters just in
case people want to try and alter them for their own systems.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help