Skip to contentSkip to conversation

MV SATA: Add per channel clk/clkdev support.

RFC New Jason 2 participants 2 messages Mar 7, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jason

author
#1 lore raw

RFC 9/14 MV SATA: Add per channel clk/clkdev support.

Quoted 23 lines · Andrew Lunn
Quoted 23 lines

Date: Tue, 6 Mar 2012 14:01:39 -0500
From: Jason <[email protected]>
To: Andrew Lunn <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org
Subject: Re: [RFC 09/14] MV SATA: Add per channel clk/clkdev support.
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Quoted 1 line · Andrew Lunn

The Orion kirkwood chips have a gatable clock per SATA channel. Add

+mv_sata_platform_data *sata_data)

Review

Quoted 6 lines
      if (sata_data->n_ports > 1)
              kirkwood_clk_ctrl |= CGC_SATA1;
(quoted diff) +3 -0
+     orion_clkdev_add("0", "sata_mv.0", &clk_sata0);
+     orion_clkdev_add("1", "sata_mv.0", &clk_sata1);
+

This is a problem for devicetree. With devicetree, neither kirkwood_sata_init(), nor orion_sata_init() are ever called. The same is true for all the other drivers as well.

Quoted 6 lines
Quoted 1 line

Could this be moved into the driver's _probe() function?

No, this cannot be in the driver. This is setting up the mapping between the device name and the clk the device should use. dove, orion5x, mv78xx0 need a different clk to kirkwood and this is hidden by clkdev, so the driver does not have to care.

Thanks for the clarification.

Quoted 8 lines

BTW: Not all drivers which orion uses are only used by orion. So we have to be careful not to add orion specific stuff into some of the drivers. This is particularly true for Ethernet and SATA.

There are two possible solutions to clkdev:

1) Add DT bindings for clkdev. I don't know if this is currently supported?

I came to the same conclusion late last night and started poking around. I didn't see it in any of Mike's patches.

Quoted 3 lines

2) I can refactor the code. Currently i create the clkdev entries on demand. However i could just create them all just after creating the clocks.

Hmmm, I wouldn't worry about it too much, absent == disabled. Which is what I'm thinking for the dt bindings.

Quoted 2 lines

Maybe you can take a look at 1) and see if its possible, while i look at refactoring the code.

drivers/clk/of_clk.c ? I'll start looking at it.

thx,

Jason.

#2 lore raw

RFC 9/14 MV SATA: Add per channel clk/clkdev support.

Quoted 37 lines · Jason
Quoted 23 lines · Andrew Lunn
Quoted 23 lines

Date: Tue, 6 Mar 2012 14:01:39 -0500
From: Jason <[email protected]>
To: Andrew Lunn <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org
Subject: Re: [RFC 09/14] MV SATA: Add per channel clk/clkdev support.
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Quoted 1 line · Andrew Lunn

The Orion kirkwood chips have a gatable clock per SATA channel. Add

+mv_sata_platform_data *sata_data)

Review

Quoted 6 lines
      if (sata_data->n_ports > 1)
              kirkwood_clk_ctrl |= CGC_SATA1;
(quoted diff) +3 -0
+     orion_clkdev_add("0", "sata_mv.0", &clk_sata0);
+     orion_clkdev_add("1", "sata_mv.0", &clk_sata1);
+

This is a problem for devicetree. With devicetree, neither kirkwood_sata_init(), nor orion_sata_init() are ever called. The same is true for all the other drivers as well.

Quoted 6 lines
Quoted 1 line

Could this be moved into the driver's _probe() function?

No, this cannot be in the driver. This is setting up the mapping between the device name and the clk the device should use. dove, orion5x, mv78xx0 need a different clk to kirkwood and this is hidden by clkdev, so the driver does not have to care.

Thanks for the clarification.

Quoted 4 lines

BTW: Not all drivers which orion uses are only used by orion. So we have to be careful not to add orion specific stuff into some of the drivers. This is particularly true for Ethernet and SATA.

Quoted 7 lines
Quoted 4 lines

There are two possible solutions to clkdev:

1) Add DT bindings for clkdev. I don't know if this is currently supported?

I came to the same conclusion late last night and started poking around. I didn't see it in any of Mike's patches.

You are missing up clk and clkdev. Mike's patches are for clk. You need clkdev bindings.

Quoted 5 lines
Quoted 3 lines

2) I can refactor the code. Currently i create the clkdev entries on demand. However i could just create them all just after creating the clocks.

drivers/clk/of_clk.c ? I'll start looking at it.

drivers/clk/of_clkdev.c, or maybe drivers/of/of_clkdev.c. You should probably run this by Grant before investing too much effort. It might be a stupid idea...

Also, most of the refactoring is done. Needs some testing and then i can send RFCv2 patches.

Andrew