Skip to contentSkip to conversation

can: mcp251x: Replace power callbacks with regulator API

PATCH RESEND Superseded Alexander Shiyan 3 participants 11 messages Aug 8, 2013 – Aug 21, 2013

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 can: mcp251x: Replace power callbacks with regulator API

---
 arch/arm/mach-pxa/icontrol.c         |  3 --
 arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------
 drivers/net/can/mcp251x.c            | 81 +++++++++++++++++++-----------------
 include/linux/can/platform/mcp251x.h | 13 +-----
 4 files changed, 69 insertions(+), 74 deletions(-)
arch/arm/mach-pxa/icontrol.c +0 -3
index fe31bfc..c98511c 100644
@@ -73,9 +73,6 @@ static struct pxa2xx_spi_chip mcp251x_chip_info4 = {
 
 static struct mcp251x_platform_data mcp251x_info = {
 	.oscillator_frequency = 16E6,
-	.board_specific_setup = NULL,
-	.power_enable         = NULL,
-	.transceiver_enable   = NULL
 };
 
 static struct spi_board_info mcp251x_board_info[] = {
arch/arm/mach-pxa/zeus.c +25 -21

70 lines not on this page · raw message

drivers/net/can/mcp251x.c +43 -38

200 lines not on this page · raw message

include/linux/can/platform/mcp251x.h +1 -12
index 089fe43..8a27256 100644
@@ -9,26 +9,15 @@
 
 #include <linux/spi/spi.h>
 
-/**
+/*
  * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data
  * @oscillator_frequency:       - oscillator frequency in Hz
  * @irq_flags:                  - IRQF configuration flags
- * @board_specific_setup:       - called before probing the chip (power,reset)
- * @transceiver_enable:         - called to power on/off the transceiver
- * @power_enable:               - called to power on/off the mcp *and* the
- *                                transceiver
- *
- * Please note that you should define power_enable or transceiver_enable or
- * none of them. Defining both of them is no use.
- *
  */
 
 struct mcp251x_platform_data {
 	unsigned long oscillator_frequency;
 	unsigned long irq_flags;
-	int (*board_specific_setup)(struct spi_device *spi);
-	int (*transceiver_enable)(int enable);
-	int (*power_enable) (int enable);
 };
 
 #endif /* __CAN_PLATFORM_MCP251X_H__ */
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 4 lines · Alexander Shiyan
---
 arch/arm/mach-pxa/icontrol.c         |  3 --
 arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------

What's pxa's status of DT conversion? Do you (still) accept patches to board files?

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130809/1e24b0f3/attachment.sig>
maintainer
#2 lore raw
Quoted 11 lines · Marc Kleine-Budde
Quoted 4 lines · Alexander Shiyan
---
  arch/arm/mach-pxa/icontrol.c         |  3 --
  arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------

What's pxa's status of DT conversion? Do you (still) accept patches to board files?

Marc

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Regards
Haojian

maintainer
#3 lore raw
In reply to Marc Kleine-Budde
Quoted 11 lines · Marc Kleine-Budde
Quoted 4 lines · Alexander Shiyan
---
  arch/arm/mach-pxa/icontrol.c         |  3 --
  arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------

What's pxa's status of DT conversion? Do you (still) accept patches to board files?

Marc

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Regards
Haojian

#4 lore raw
Quoted 10 lines · On Sat, 17 Aug 2013 10:19:20 +0800 Haojian Zhuang <[email protected]>…
Quoted 9 lines · Marc Kleine-Budde
Quoted 4 lines · Alexander Shiyan
---
  arch/arm/mach-pxa/icontrol.c         |  3 --
  arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------

What's pxa's status of DT conversion? Do you (still) accept patches to board files?

Quoted 6 lines
Quoted 2 lines

Marc

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Patch cannot be splitted because this can create hole which break git-bisect.

In any case, I want to create a v2 with a more detailed description, and I have a supplementary question for the CAN subsystem maintainers. "Transciever power" is not used by any of the boards, can we remove it completely? This will greatly simplify driver.
Thanks.

Signature · 1 line
Alexander Shiyan <[email protected]>
maintainer
#5 lore raw
Quoted 22 lines · Alexander Shiyan
Quoted 10 lines · On Sat, 17 Aug 2013 10:19:20 +0800 Haojian Zhuang <[email protected]>…
Quoted 9 lines · Marc Kleine-Budde
Quoted 4 lines · Alexander Shiyan
---
  arch/arm/mach-pxa/icontrol.c         |  3 --
  arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------

What's pxa's status of DT conversion? Do you (still) accept patches to board files?

Quoted 6 lines
Quoted 2 lines

Marc

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Patch cannot be splitted because this can create hole which break git-bisect.

Quoted 8 lines

In any case, I want to create a v2 with a more detailed description, and I have a supplementary question for the CAN subsystem maintainers. "Transciever power" is not used by any of the boards, can we remove it completely? This will greatly simplify driver.
Thanks.

--
Alexander Shiyan <[email protected]>

If you want to make the patch go through pxa tree, you need to get the Ack from CAN maintainer.

Regards
Haojian

#8 lore raw
In reply to Alexander Shiyan

On 08/17/2013 06:30 AM, Alexander Shiyan wrote:
[...]

Quoted 10 lines
Quoted 3 lines

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Patch cannot be splitted because this can create hole which break git-bisect.

In any case, I want to create a v2 with a more detailed description, and I have a supplementary question for the CAN subsystem maintainers. "Transciever power" is not used by any of the boards, can we remove it completely? This will greatly simplify driver.

Do you mean the former transceiver_enable() callback?

include/linux/can/platform/mcp251x.h line 21

Quoted 7 lines

struct mcp251x_platform_data {

include/linux/can/platform/mcp251x.h +0 -3
 	unsigned long oscillator_frequency;
 	unsigned long irq_flags;
-	int (*board_specific_setup)(struct spi_device *spi);
-	int (*transceiver_enable)(int enable);
-	int (*power_enable) (int enable);
 };

Having a switchable transceiver is a quite common thing. So I'd like that you keep it. The flexcan driver was just converted from a callback to a regulator too. It already has device tree bindings and I'd like to use these bindings as a standard for new drivers. From flexcan's dt bindings:

Quoted 1 line

- xceiver-supply: Regulator that powers the CAN transceiver

which translates into:

Quoted 1 line

priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");

Can you please use "xceiver" instead of "transceiver", so that future DT binding will fit the scheme.

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130817/bb6c21aa/attachment-0001.sig>
#9 lore raw
Quoted 6 lines · Alexander Shiyan

[...]

Quoted 4 lines
Quoted 3 lines

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Quoted 8 lines
Quoted 6 lines

Patch cannot be splitted because this can create hole which break git-bisect.

In any case, I want to create a v2 with a more detailed description, and I have a supplementary question for the CAN subsystem maintainers. "Transciever power" is not used by any of the boards, can we remove it completely? This will greatly simplify driver.

Do you mean the former transceiver_enable() callback?

Yes.

Quoted 14 lines

include/linux/can/platform/mcp251x.h line 21

Quoted 7 lines

struct mcp251x_platform_data {

include/linux/can/platform/mcp251x.h +0 -3
 	unsigned long oscillator_frequency;
 	unsigned long irq_flags;
-	int (*board_specific_setup)(struct spi_device *spi);
-	int (*transceiver_enable)(int enable);
-	int (*power_enable) (int enable);
 };

Having a switchable transceiver is a quite common thing. So I'd like that you keep it. The flexcan driver was just converted from a callback to a regulator too. It already has device tree bindings and I'd like to use these bindings as a standard for new drivers. From flexcan's dt bindings:

Quoted 8 lines
Quoted 1 line

- xceiver-supply: Regulator that powers the CAN transceiver

which translates into:

Quoted 1 line

priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");

Can you please use "xceiver" instead of "transceiver", so that future DT binding will fit the scheme.

OK. I am not ready to add DT support yet, but it can be added later, so v2 will contain 3 parts:
1 - Replace power callbacks with regulator API
2 - Eliminate mcp251x_platform_data->irq_flags
3 - Replace oscillator_frequency with CLK API (and remove mcp251x.h header)

Are you OK with such changes?

---

#10 lore raw

On 08/17/2013 11:10 PM, Alexander Shiyan wrote:
[...]

Quoted 10 lines
Quoted 8 lines
Quoted 1 line

- xceiver-supply: Regulator that powers the CAN transceiver

which translates into:

Quoted 1 line

priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");

Can you please use "xceiver" instead of "transceiver", so that future DT binding will fit the scheme.

OK. I am not ready to add DT support yet, but it can be added later,

DT support can be added later, I just want to make sure that you use "xceiver" for the regulator, so that you don't need to change any code if DT is added.

Quoted 1 line

so v2 will contain 3 parts:

If you mean series v3 consists of three patches....

Quoted 5 lines

1 - Replace power callbacks with regulator API
2 - Eliminate mcp251x_platform_data->irq_flags
3 - Replace oscillator_frequency with CLK API (and remove mcp251x.h header)

Are you OK with such changes?

...them I'm okay :)

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130818/53d32f03/attachment-0001.sig>
#6 lore raw
In reply to Haojian Zhuang
Quoted 29 lines · Haojian Zhuang
Quoted 28 lines · Alexander Shiyan
Quoted 10 lines · On Sat, 17 Aug 2013 10:19:20 +0800 Haojian Zhuang <[email protected]>…
Quoted 9 lines · Marc Kleine-Budde
Quoted 4 lines · Alexander Shiyan
---
  arch/arm/mach-pxa/icontrol.c         |  3 --
  arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------

What's pxa's status of DT conversion? Do you (still) accept patches to board files?

Quoted 6 lines
Quoted 2 lines

Marc

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Patch cannot be splitted because this can create hole which break git-bisect.

In any case, I want to create a v2 with a more detailed description, and I have a supplementary question for the CAN subsystem maintainers. "Transciever power" is not used by any of the boards, can we remove it completely? This will greatly simplify driver.
Thanks.

Quoted 5 lines
Quoted 2 lines

--
Alexander Shiyan <[email protected]>

If you want to make the patch go through pxa tree, you need to get the Ack from CAN maintainer.

The current series consists of 3 patches, only the first one touches "arch/arm/mach-pxa", so I'd like the patches to go via linux-can. Can I have your Acked-by for the first patch "[PATCH v2 1/3] can: mcp251x:
Replace power callbacks with regulator AP"

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130820/58a9d4f3/attachment-0001.sig>
maintainer Acked-by
#7 lore raw
Quoted 41 lines · Marc Kleine-Budde
Quoted 29 lines · Haojian Zhuang
Quoted 28 lines · Alexander Shiyan
Quoted 10 lines · On Sat, 17 Aug 2013 10:19:20 +0800 Haojian Zhuang <[email protected]>…
Quoted 9 lines · Marc Kleine-Budde
Quoted 4 lines · Alexander Shiyan
---
  arch/arm/mach-pxa/icontrol.c         |  3 --
  arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------

What's pxa's status of DT conversion? Do you (still) accept patches to board files?

Quoted 6 lines
Quoted 2 lines

Marc

Since DT conversion isn't finished, I still accept the board files. But this patch should be split into two parts. One is for pxa, and the other one is for net.

Patch cannot be splitted because this can create hole which break git-bisect.

In any case, I want to create a v2 with a more detailed description, and I have a supplementary question for the CAN subsystem maintainers. "Transciever power" is not used by any of the boards, can we remove it completely? This will greatly simplify driver.
Thanks.

Quoted 5 lines
Quoted 2 lines

--
Alexander Shiyan <[email protected]>

If you want to make the patch go through pxa tree, you need to get the Ack from CAN maintainer.

The current series consists of 3 patches, only the first one touches "arch/arm/mach-pxa", so I'd like the patches to go via linux-can. Can I have your Acked-by for the first patch "[PATCH v2 1/3] can: mcp251x:
Replace power callbacks with regulator AP"

Quoted 7 lines

Marc
--

Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |