diff options
author | Mattias Nilsson <mattias.i.nilsson@stericsson.com> | 2011-08-12 04:28:10 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-10-24 08:09:18 -0400 |
commit | 73180f85f4ffbb66843f8248811b2ade29b22df2 (patch) | |
tree | 26b48bd3369e2f38d741bae92ceef25e8da35948 /drivers/mfd/db8500-prcmu.c | |
parent | fea799e3d3ab84ac675de7e48a13a79fb76b6e63 (diff) |
mfd: Move to the new db500 PRCMU API
Now that we have a shared API between the DB8500 and DB5500
PRCMU's, switch to using this neutral API instead. We delete the
parts of db8500-prcmu.h that is now PRCMU-neutral, and calls will
be diverted to respective driver. Common registers are in
dbx500-prcmu-regs.h and common accessors and defines in
<linux/mfd/dbx500-prcmu.h> This way we get a a lot more
abstraction and code reuse.
Signed-off-by: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/db8500-prcmu.c')
-rw-r--r-- | drivers/mfd/db8500-prcmu.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index e2c4a26a9eb1..cea814509a6f 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -27,14 +27,14 @@ | |||
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
29 | #include <linux/mfd/core.h> | 29 | #include <linux/mfd/core.h> |
30 | #include <linux/mfd/db8500-prcmu.h> | 30 | #include <linux/mfd/dbx500-prcmu.h> |
31 | #include <linux/regulator/db8500-prcmu.h> | 31 | #include <linux/regulator/db8500-prcmu.h> |
32 | #include <linux/regulator/machine.h> | 32 | #include <linux/regulator/machine.h> |
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <mach/irqs.h> | 34 | #include <mach/irqs.h> |
35 | #include <mach/db8500-regs.h> | 35 | #include <mach/db8500-regs.h> |
36 | #include <mach/id.h> | 36 | #include <mach/id.h> |
37 | #include "db8500-prcmu-regs.h" | 37 | #include "dbx500-prcmu-regs.h" |
38 | 38 | ||
39 | /* Offset for the firmware version within the TCPM */ | 39 | /* Offset for the firmware version within the TCPM */ |
40 | #define PRCMU_FW_VERSION_OFFSET 0xA4 | 40 | #define PRCMU_FW_VERSION_OFFSET 0xA4 |
@@ -507,7 +507,7 @@ static struct { | |||
507 | } prcmu_version; | 507 | } prcmu_version; |
508 | 508 | ||
509 | 509 | ||
510 | int prcmu_enable_dsipll(void) | 510 | int db8500_prcmu_enable_dsipll(void) |
511 | { | 511 | { |
512 | int i; | 512 | int i; |
513 | unsigned int plldsifreq; | 513 | unsigned int plldsifreq; |
@@ -542,7 +542,7 @@ int prcmu_enable_dsipll(void) | |||
542 | return 0; | 542 | return 0; |
543 | } | 543 | } |
544 | 544 | ||
545 | int prcmu_disable_dsipll(void) | 545 | int db8500_prcmu_disable_dsipll(void) |
546 | { | 546 | { |
547 | /* Disable dsi pll */ | 547 | /* Disable dsi pll */ |
548 | writel(PRCMU_DISABLE_PLLDSI, PRCM_PLLDSI_ENABLE); | 548 | writel(PRCMU_DISABLE_PLLDSI, PRCM_PLLDSI_ENABLE); |
@@ -551,7 +551,7 @@ int prcmu_disable_dsipll(void) | |||
551 | return 0; | 551 | return 0; |
552 | } | 552 | } |
553 | 553 | ||
554 | int prcmu_set_display_clocks(void) | 554 | int db8500_prcmu_set_display_clocks(void) |
555 | { | 555 | { |
556 | unsigned long flags; | 556 | unsigned long flags; |
557 | unsigned int dsiclk; | 557 | unsigned int dsiclk; |
@@ -734,7 +734,7 @@ unlock_and_return: | |||
734 | return r; | 734 | return r; |
735 | } | 735 | } |
736 | 736 | ||
737 | int prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll) | 737 | int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll) |
738 | { | 738 | { |
739 | unsigned long flags; | 739 | unsigned long flags; |
740 | 740 | ||
@@ -791,7 +791,7 @@ static void config_wakeups(void) | |||
791 | last_abb_events = abb_events; | 791 | last_abb_events = abb_events; |
792 | } | 792 | } |
793 | 793 | ||
794 | void prcmu_enable_wakeups(u32 wakeups) | 794 | void db8500_prcmu_enable_wakeups(u32 wakeups) |
795 | { | 795 | { |
796 | unsigned long flags; | 796 | unsigned long flags; |
797 | u32 bits; | 797 | u32 bits; |
@@ -812,7 +812,7 @@ void prcmu_enable_wakeups(u32 wakeups) | |||
812 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | 812 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); |
813 | } | 813 | } |
814 | 814 | ||
815 | void prcmu_config_abb_event_readout(u32 abb_events) | 815 | void db8500_prcmu_config_abb_event_readout(u32 abb_events) |
816 | { | 816 | { |
817 | unsigned long flags; | 817 | unsigned long flags; |
818 | 818 | ||
@@ -824,7 +824,7 @@ void prcmu_config_abb_event_readout(u32 abb_events) | |||
824 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | 824 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); |
825 | } | 825 | } |
826 | 826 | ||
827 | void prcmu_get_abb_event_buffer(void __iomem **buf) | 827 | void db8500_prcmu_get_abb_event_buffer(void __iomem **buf) |
828 | { | 828 | { |
829 | if (readb(tcdm_base + PRCM_ACK_MB0_READ_POINTER) & 1) | 829 | if (readb(tcdm_base + PRCM_ACK_MB0_READ_POINTER) & 1) |
830 | *buf = (tcdm_base + PRCM_ACK_MB0_WAKEUP_1_4500); | 830 | *buf = (tcdm_base + PRCM_ACK_MB0_WAKEUP_1_4500); |
@@ -833,13 +833,13 @@ void prcmu_get_abb_event_buffer(void __iomem **buf) | |||
833 | } | 833 | } |
834 | 834 | ||
835 | /** | 835 | /** |
836 | * prcmu_set_arm_opp - set the appropriate ARM OPP | 836 | * db8500_prcmu_set_arm_opp - set the appropriate ARM OPP |
837 | * @opp: The new ARM operating point to which transition is to be made | 837 | * @opp: The new ARM operating point to which transition is to be made |
838 | * Returns: 0 on success, non-zero on failure | 838 | * Returns: 0 on success, non-zero on failure |
839 | * | 839 | * |
840 | * This function sets the the operating point of the ARM. | 840 | * This function sets the the operating point of the ARM. |
841 | */ | 841 | */ |
842 | int prcmu_set_arm_opp(u8 opp) | 842 | int db8500_prcmu_set_arm_opp(u8 opp) |
843 | { | 843 | { |
844 | int r; | 844 | int r; |
845 | 845 | ||
@@ -870,11 +870,11 @@ int prcmu_set_arm_opp(u8 opp) | |||
870 | } | 870 | } |
871 | 871 | ||
872 | /** | 872 | /** |
873 | * prcmu_get_arm_opp - get the current ARM OPP | 873 | * db8500_prcmu_get_arm_opp - get the current ARM OPP |
874 | * | 874 | * |
875 | * Returns: the current ARM OPP | 875 | * Returns: the current ARM OPP |
876 | */ | 876 | */ |
877 | int prcmu_get_arm_opp(void) | 877 | int db8500_prcmu_get_arm_opp(void) |
878 | { | 878 | { |
879 | return readb(tcdm_base + PRCM_ACK_MB1_CURRENT_ARM_OPP); | 879 | return readb(tcdm_base + PRCM_ACK_MB1_CURRENT_ARM_OPP); |
880 | } | 880 | } |
@@ -1024,14 +1024,14 @@ int prcmu_release_usb_wakeup_state(void) | |||
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | /** | 1026 | /** |
1027 | * prcmu_set_epod - set the state of a EPOD (power domain) | 1027 | * db8500_prcmu_set_epod - set the state of a EPOD (power domain) |
1028 | * @epod_id: The EPOD to set | 1028 | * @epod_id: The EPOD to set |
1029 | * @epod_state: The new EPOD state | 1029 | * @epod_state: The new EPOD state |
1030 | * | 1030 | * |
1031 | * This function sets the state of a EPOD (power domain). It may not be called | 1031 | * This function sets the state of a EPOD (power domain). It may not be called |
1032 | * from interrupt context. | 1032 | * from interrupt context. |
1033 | */ | 1033 | */ |
1034 | int prcmu_set_epod(u16 epod_id, u8 epod_state) | 1034 | int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state) |
1035 | { | 1035 | { |
1036 | int r = 0; | 1036 | int r = 0; |
1037 | bool ram_retention = false; | 1037 | bool ram_retention = false; |
@@ -1221,14 +1221,14 @@ static int request_reg_clock(u8 clock, bool enable) | |||
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | /** | 1223 | /** |
1224 | * prcmu_request_clock() - Request for a clock to be enabled or disabled. | 1224 | * db8500_prcmu_request_clock() - Request for a clock to be enabled or disabled. |
1225 | * @clock: The clock for which the request is made. | 1225 | * @clock: The clock for which the request is made. |
1226 | * @enable: Whether the clock should be enabled (true) or disabled (false). | 1226 | * @enable: Whether the clock should be enabled (true) or disabled (false). |
1227 | * | 1227 | * |
1228 | * This function should only be used by the clock implementation. | 1228 | * This function should only be used by the clock implementation. |
1229 | * Do not use it from any other place! | 1229 | * Do not use it from any other place! |
1230 | */ | 1230 | */ |
1231 | int prcmu_request_clock(u8 clock, bool enable) | 1231 | int db8500_prcmu_request_clock(u8 clock, bool enable) |
1232 | { | 1232 | { |
1233 | if (clock < PRCMU_NUM_REG_CLOCKS) | 1233 | if (clock < PRCMU_NUM_REG_CLOCKS) |
1234 | return request_reg_clock(clock, enable); | 1234 | return request_reg_clock(clock, enable); |
@@ -1240,7 +1240,7 @@ int prcmu_request_clock(u8 clock, bool enable) | |||
1240 | return -EINVAL; | 1240 | return -EINVAL; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | int prcmu_config_esram0_deep_sleep(u8 state) | 1243 | int db8500_prcmu_config_esram0_deep_sleep(u8 state) |
1244 | { | 1244 | { |
1245 | if ((state > ESRAM0_DEEP_SLEEP_STATE_RET) || | 1245 | if ((state > ESRAM0_DEEP_SLEEP_STATE_RET) || |
1246 | (state < ESRAM0_DEEP_SLEEP_STATE_OFF)) | 1246 | (state < ESRAM0_DEEP_SLEEP_STATE_OFF)) |
@@ -1515,18 +1515,18 @@ unlock_and_return: | |||
1515 | mutex_unlock(&mb0_transfer.ac_wake_lock); | 1515 | mutex_unlock(&mb0_transfer.ac_wake_lock); |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | bool prcmu_is_ac_wake_requested(void) | 1518 | bool db8500_prcmu_is_ac_wake_requested(void) |
1519 | { | 1519 | { |
1520 | return (atomic_read(&ac_wake_req_state) != 0); | 1520 | return (atomic_read(&ac_wake_req_state) != 0); |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | /** | 1523 | /** |
1524 | * prcmu_system_reset - System reset | 1524 | * db8500_prcmu_system_reset - System reset |
1525 | * | 1525 | * |
1526 | * Saves the reset reason code and then sets the APE_SOFRST register which | 1526 | * Saves the reset reason code and then sets the APE_SOFTRST register which |
1527 | * fires interrupt to fw | 1527 | * fires interrupt to fw |
1528 | */ | 1528 | */ |
1529 | void prcmu_system_reset(u16 reset_code) | 1529 | void db8500_prcmu_system_reset(u16 reset_code) |
1530 | { | 1530 | { |
1531 | writew(reset_code, (tcdm_base + PRCM_SW_RST_REASON)); | 1531 | writew(reset_code, (tcdm_base + PRCM_SW_RST_REASON)); |
1532 | writel(1, PRCM_APE_SOFTRST); | 1532 | writel(1, PRCM_APE_SOFTRST); |
@@ -1782,7 +1782,7 @@ static struct irq_chip prcmu_irq_chip = { | |||
1782 | .irq_unmask = prcmu_irq_unmask, | 1782 | .irq_unmask = prcmu_irq_unmask, |
1783 | }; | 1783 | }; |
1784 | 1784 | ||
1785 | void __init prcmu_early_init(void) | 1785 | void __init db8500_prcmu_early_init(void) |
1786 | { | 1786 | { |
1787 | unsigned int i; | 1787 | unsigned int i; |
1788 | 1788 | ||