Skip to contentSkip to conversation

ARM: kirkwood: covert orion-spi to fdt.

PATCH New Andrew Lunn 3 participants 3 messages Feb 28, 2012

lore
Share & tools
lore
#0 lore raw
Quoted 9 lines

Review static int __init kirkwood_clock_gate(void) · line 534

Quoted 8 lines
(quoted diff) +4 -0
@@ -524,6 +528,13 @@ static int __init kirkwood_clock_gate(void)
      } else  /* keep this bit set for devices that don't have PCIe1 */
              kirkwood_clk_ctrl |= CGC_PEX1;
 
+#ifdef CONFIG_OF
+     dp = of_find_node_by_path("/");
+     if (of_device_is_available(of_find_compatible_node(dp, NULL,
+

+"marvell,orion-spi")))

Quoted 10 lines

Review static int __init kirkwood_clock_gate(void) · line 540

Quoted 6 lines
(quoted diff) +3 -0
+             kirkwood_clk_ctrl |= CGC_RUNIT;
+#endif
+
      /* Now gate clock the required units */
      writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL);
      printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL));

This looks like it could be improved by only enabling the clock if we actually start using the device from the spi driver, in its probe function. Not sure if that's worth it.

I have two comments about this:

I think this code belongs on the board-dts.c file. kirkwood_clk_ctrl is a global so can be set from anywhere. It is also set in other files than common.c, eg pcie.c.

In the end, i hope this all goes away. I have patches based on Mike's generic clk infrastructure, which adds clk/clkdev to all orion based machines. So the SPI driver, in its probe function will get its clock, enable it, and also find out the speed of it. The release function also disables the clock, turning it off if nobody else is using it.

I just hope the generic clk does not take too long to land.

Andrew

#1 lore raw

PATCH 1/1 ARM: kirkwood: covert orion-spi to fdt.

Quoted 3 lines · Andrew Lunn

I think this code belongs on the board-dts.c file. kirkwood_clk_ctrl is a global so can be set from anywhere. It is also set in other files than common.c, eg pcie.c.

Ok, that makes sense.

Quoted 7 lines

In the end, i hope this all goes away. I have patches based on Mike's generic clk infrastructure, which adds clk/clkdev to all orion based machines. So the SPI driver, in its probe function will get its clock, enable it, and also find out the speed of it. The release function also disables the clock, turning it off if nobody else is using it.

I just hope the generic clk does not take too long to land.

Excellent, that will of course be the best solution in the long run.

Arnd

#2 lore raw

PATCH 1/1 ARM: kirkwood: covert orion-spi to fdt.

Quoted 6 lines · Arnd Bergmann
Quoted 3 lines · Andrew Lunn

I think this code belongs on the board-dts.c file. kirkwood_clk_ctrl is a global so can be set from anywhere. It is also set in other files than common.c, eg pcie.c.

Ok, that makes sense.

Yes, my goal is to eventually eliminate common.c, pcie.c, etc. If we do it right, kirkwood_clock_gate() won't be necessary.

Quoted 9 lines
Quoted 7 lines

In the end, i hope this all goes away. I have patches based on Mike's generic clk infrastructure, which adds clk/clkdev to all orion based machines. So the SPI driver, in its probe function will get its clock, enable it, and also find out the speed of it. The release function also disables the clock, turning it off if nobody else is using it.

I just hope the generic clk does not take too long to land.

Excellent, that will of course be the best solution in the long run.

Agreed.

thx,

Jason.