diff options
| author | Alexander Shiyan <shc_work@mail.ru> | 2013-08-19 07:39:19 -0400 |
|---|---|---|
| committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2013-08-21 03:28:29 -0400 |
| commit | 1ddff7da0faecffdcdeab3d981fb8241453cea44 (patch) | |
| tree | 7388e85b2a844917fe3103c47bdb044799fba95f /arch/arm/mach-pxa | |
| parent | 954c396756e3d31985f7bc6a414a988a4736a7d0 (diff) | |
can: mcp251x: Replace power callbacks with regulator API
This patch replaces power callbacks to the regulator API. To improve
the readability of the code, helper for the regulator enable/disable
was added.
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-pxa')
| -rw-r--r-- | arch/arm/mach-pxa/icontrol.c | 3 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/zeus.c | 46 |
2 files changed, 25 insertions, 24 deletions
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c index fe31bfcbb8df..c98511c5abd1 100644 --- a/arch/arm/mach-pxa/icontrol.c +++ b/arch/arm/mach-pxa/icontrol.c | |||
| @@ -73,9 +73,6 @@ static struct pxa2xx_spi_chip mcp251x_chip_info4 = { | |||
| 73 | 73 | ||
| 74 | static struct mcp251x_platform_data mcp251x_info = { | 74 | static struct mcp251x_platform_data mcp251x_info = { |
| 75 | .oscillator_frequency = 16E6, | 75 | .oscillator_frequency = 16E6, |
| 76 | .board_specific_setup = NULL, | ||
| 77 | .power_enable = NULL, | ||
| 78 | .transceiver_enable = NULL | ||
| 79 | }; | 76 | }; |
| 80 | 77 | ||
| 81 | static struct spi_board_info mcp251x_board_info[] = { | 78 | static struct spi_board_info mcp251x_board_info[] = { |
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c index f5d436434566..04a0aea23873 100644 --- a/arch/arm/mach-pxa/zeus.c +++ b/arch/arm/mach-pxa/zeus.c | |||
| @@ -29,6 +29,8 @@ | |||
| 29 | #include <linux/i2c/pca953x.h> | 29 | #include <linux/i2c/pca953x.h> |
| 30 | #include <linux/apm-emulation.h> | 30 | #include <linux/apm-emulation.h> |
| 31 | #include <linux/can/platform/mcp251x.h> | 31 | #include <linux/can/platform/mcp251x.h> |
| 32 | #include <linux/regulator/fixed.h> | ||
| 33 | #include <linux/regulator/machine.h> | ||
| 32 | 34 | ||
| 33 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
| 34 | #include <asm/suspend.h> | 36 | #include <asm/suspend.h> |
| @@ -391,33 +393,34 @@ static struct pxa2xx_spi_master pxa2xx_spi_ssp3_master_info = { | |||
| 391 | }; | 393 | }; |
| 392 | 394 | ||
| 393 | /* CAN bus on SPI */ | 395 | /* CAN bus on SPI */ |
| 394 | static int zeus_mcp2515_setup(struct spi_device *sdev) | 396 | static struct regulator_consumer_supply can_regulator_consumer = |
| 395 | { | 397 | REGULATOR_SUPPLY("vdd", "spi3.0"); |
| 396 | int err; | ||
| 397 | |||
| 398 | err = gpio_request(ZEUS_CAN_SHDN_GPIO, "CAN shutdown"); | ||
| 399 | if (err) | ||
| 400 | return err; | ||
| 401 | 398 | ||
| 402 | err = gpio_direction_output(ZEUS_CAN_SHDN_GPIO, 1); | 399 | static struct regulator_init_data can_regulator_init_data = { |
| 403 | if (err) { | 400 | .constraints = { |
| 404 | gpio_free(ZEUS_CAN_SHDN_GPIO); | 401 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 405 | return err; | 402 | }, |
| 406 | } | 403 | .consumer_supplies = &can_regulator_consumer, |
| 404 | .num_consumer_supplies = 1, | ||
| 405 | }; | ||
| 407 | 406 | ||
| 408 | return 0; | 407 | static struct fixed_voltage_config can_regulator_pdata = { |
| 409 | } | 408 | .supply_name = "CAN_SHDN", |
| 409 | .microvolts = 3300000, | ||
| 410 | .gpio = ZEUS_CAN_SHDN_GPIO, | ||
| 411 | .init_data = &can_regulator_init_data, | ||
| 412 | }; | ||
| 410 | 413 | ||
| 411 | static int zeus_mcp2515_transceiver_enable(int enable) | 414 | static struct platform_device can_regulator_device = { |
| 412 | { | 415 | .name = "reg-fixed-volage", |
| 413 | gpio_set_value(ZEUS_CAN_SHDN_GPIO, !enable); | 416 | .id = -1, |
| 414 | return 0; | 417 | .dev = { |
| 415 | } | 418 | .platform_data = &can_regulator_pdata, |
| 419 | }, | ||
| 420 | }; | ||
| 416 | 421 | ||
| 417 | static struct mcp251x_platform_data zeus_mcp2515_pdata = { | 422 | static struct mcp251x_platform_data zeus_mcp2515_pdata = { |
| 418 | .oscillator_frequency = 16*1000*1000, | 423 | .oscillator_frequency = 16*1000*1000, |
| 419 | .board_specific_setup = zeus_mcp2515_setup, | ||
| 420 | .power_enable = zeus_mcp2515_transceiver_enable, | ||
| 421 | }; | 424 | }; |
| 422 | 425 | ||
| 423 | static struct spi_board_info zeus_spi_board_info[] = { | 426 | static struct spi_board_info zeus_spi_board_info[] = { |
| @@ -516,6 +519,7 @@ static struct platform_device *zeus_devices[] __initdata = { | |||
| 516 | &zeus_leds_device, | 519 | &zeus_leds_device, |
| 517 | &zeus_pcmcia_device, | 520 | &zeus_pcmcia_device, |
| 518 | &zeus_max6369_device, | 521 | &zeus_max6369_device, |
| 522 | &can_regulator_device, | ||
| 519 | }; | 523 | }; |
| 520 | 524 | ||
| 521 | /* AC'97 */ | 525 | /* AC'97 */ |
