Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
db8500-prcmu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) STMicroelectronics 2009
3  * Copyright (C) ST-Ericsson SA 2010
4  *
5  * License Terms: GNU General Public License v2
6  * Author: Kumar Sanghvi <[email protected]>
7  *
8  * PRCMU f/w APIs
9  */
10 #ifndef __MFD_DB8500_PRCMU_H
11 #define __MFD_DB8500_PRCMU_H
12 
13 #include <linux/interrupt.h>
14 #include <linux/bitops.h>
15 
16 /*
17  * Registers
18  */
19 #define DB8500_PRCM_GPIOCR 0x138
20 #define DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0 BIT(0)
21 #define DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD BIT(9)
22 #define DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 BIT(11)
23 #define DB8500_PRCM_GPIOCR_SPI2_SELECT BIT(23)
24 
25 #define DB8500_PRCM_LINE_VALUE 0x170
26 #define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3)
27 
28 #define DB8500_PRCM_DSI_SW_RESET 0x324
29 #define DB8500_PRCM_DSI_SW_RESET_DSI0_SW_RESETN BIT(0)
30 #define DB8500_PRCM_DSI_SW_RESET_DSI1_SW_RESETN BIT(1)
31 #define DB8500_PRCM_DSI_SW_RESET_DSI2_SW_RESETN BIT(2)
32 
33 /* This portion previously known as <mach/prcmu-fw-defs_v1.h> */
34 
41 enum state {
42  OFF = 0x0,
43  ON = 0x1,
44 };
45 
50 enum ret_state {
51  OFFST = 0,
52  ONST = 1,
53  RETST = 2
54 };
55 
64 enum clk_arm {
70 };
71 
78 enum clk_gen {
82 };
83 
84 /* some information between arm and xp70 */
85 
93  RDY_2_DS = 0x09,
95 };
96 
113  INIT = 0x00,
114  FS_2_DS = 0x0A,
115  END_DS = 0x0B,
116  DS_TO_FS = 0x0C,
117  END_FS = 0x0D,
118  SWR = 0x0E,
119  END_SWR = 0x0F
120 };
121 
132 enum ap_pwrst {
133  NO_PWRST = 0x00,
134  AP_BOOT = 0x01,
135  AP_EXECUTE = 0x02,
137  AP_SLEEP = 0x04,
138  AP_IDLE = 0x05,
139  AP_RESET = 0x06
140 };
141 
155  APIDLE_TO_APSLEEP = 0x02, /* To be removed */
158  APEXECUTE_TO_APDEEPSLEEP = 0x04, /* To be removed */
160  APEXECUTE_TO_APIDLE = 0x05, /* To be removed */
163 };
164 
177  HW_NO_CHANGE = 0x00,
178  HW_OFF = 0x01,
180  HW_ON = 0x04
181 };
182 
212  DEEPSLEEPOK = 0xFE,
213  SLEEPOK = 0xFD,
214  IDLEOK = 0xFC,
215  SOFTRESETOK = 0xFB,
216  SOFTRESETGO = 0xFA,
231  INIT_STATUS = 0xEB,
232 
233  /*error messages */
234  INITERROR = 0x00,
239  ARMWFI_ER = 0x05,
240  SYSCLKOK_ER = 0x06,
242  BOOT_ER = 0x08,
255  WUPBEFOREDS = 0x51,
256  DDRCONFIG_ER = 0x52,
259 }; /* earlier called as mbox_2_arm_stat */
260 
271 enum dvfs_stat {
272  DVFS_GO = 0xFF,
278 };
279 
286  SVA_MMDSP_GO = 0xFF,
288 };
289 
296  SIA_MMDSP_GO = 0xFF,
298 };
299 
358  INIT_ERR = 0x00,
363  ARMWFI_ERR = 0x05,
364  SYSCLKOK_ERR = 0x06,
365  BOOT_ERR = 0x07,
389 };
390 
391 enum hw_acc {
392  SVAMMDSP = 0,
393  SVAPIPE = 1,
394  SIAMMDSP = 2,
395  SIAPIPE = 3,
396  SGA = 4,
397  B2R2MCDE = 5,
398  ESRAM12 = 6,
399  ESRAM34 = 7,
400 };
401 
402 enum cs_pwrmgt {
403  PWRDNCS0 = 0,
404  WKUPCS0 = 1,
405  PWRDNCS1 = 2,
407 };
408 
409 /* Defs related to autonomous power management */
410 
421  NO_CHGT = 0x0,
426 };
427 
435  AUTO_OFF = 0x0,
436  AUTO_ON = 0x1,
437 };
438 
439 /* End of file previously known as prcmu-fw-defs_v1.h */
440 
458 };
459 
460 /*
461  * Definitions for autonomous power management configuration.
462  */
463 
464 #define PRCMU_AUTO_PM_OFF 0
465 #define PRCMU_AUTO_PM_ON 1
466 
467 #define PRCMU_AUTO_PM_POWER_ON_HSEM BIT(0)
468 #define PRCMU_AUTO_PM_POWER_ON_ABB_FIFO_IT BIT(1)
469 
476 };
477 
494 };
495 
496 #define PRCMU_FW_PROJECT_U8500 2
497 #define PRCMU_FW_PROJECT_U9500 4
498 #define PRCMU_FW_PROJECT_U8500_C2 7
499 #define PRCMU_FW_PROJECT_U9500_C2 11
500 #define PRCMU_FW_PROJECT_U8520 13
501 #define PRCMU_FW_PROJECT_U8420 14
502 
508 };
509 
510 #ifdef CONFIG_MFD_DB8500_PRCMU
511 
512 void db8500_prcmu_early_init(void);
514 enum romcode_read prcmu_get_rc_p2a(void);
516 bool prcmu_has_arm_maxopp(void);
521  struct prcmu_auto_pm_config *idle);
522 bool prcmu_is_auto_pm_enabled(void);
523 
524 int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
525 int prcmu_set_clock_divider(u8 clock, u8 divider);
528 int db8500_prcmu_start_temp_sense(u16 cycles32k);
532 
533 int prcmu_ac_wake_req(void);
534 void prcmu_ac_sleep_req(void);
535 void db8500_prcmu_modem_reset(void);
536 
537 int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
542 
543 void db8500_prcmu_system_reset(u16 reset_code);
544 int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
546 int db8500_prcmu_gic_decouple(void);
547 int db8500_prcmu_gic_recouple(void);
550 bool db8500_prcmu_pending_irq(void);
552 void db8500_prcmu_enable_wakeups(u32 wakeups);
553 int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
564 int db8500_prcmu_get_arm_opp(void);
566 int db8500_prcmu_get_ape_opp(void);
568 int db8500_prcmu_get_ddr_opp(void);
569 
570 u32 db8500_prcmu_read(unsigned int reg);
571 void db8500_prcmu_write(unsigned int reg, u32 value);
572 void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
573 
574 #else /* !CONFIG_MFD_DB8500_PRCMU */
575 
576 static inline void db8500_prcmu_early_init(void) {}
577 
578 static inline int prcmu_set_rc_a2p(enum romcode_write code)
579 {
580  return 0;
581 }
582 
583 static inline enum romcode_read prcmu_get_rc_p2a(void)
584 {
585  return INIT;
586 }
587 
588 static inline enum ap_pwrst prcmu_get_xp70_current_state(void)
589 {
590  return AP_EXECUTE;
591 }
592 
593 static inline bool prcmu_has_arm_maxopp(void)
594 {
595  return false;
596 }
597 
598 static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
599 {
600  return NULL;
601 }
602 
603 static inline int db8500_prcmu_set_ape_opp(u8 opp)
604 {
605  return 0;
606 }
607 
608 static inline int db8500_prcmu_get_ape_opp(void)
609 {
610  return APE_100_OPP;
611 }
612 
613 static inline int prcmu_request_ape_opp_100_voltage(bool enable)
614 {
615  return 0;
616 }
617 
618 static inline int prcmu_release_usb_wakeup_state(void)
619 {
620  return 0;
621 }
622 
623 static inline int db8500_prcmu_set_ddr_opp(u8 opp)
624 {
625  return 0;
626 }
627 
628 static inline int db8500_prcmu_get_ddr_opp(void)
629 {
630  return DDR_100_OPP;
631 }
632 
633 static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
634  struct prcmu_auto_pm_config *idle)
635 {
636 }
637 
638 static inline bool prcmu_is_auto_pm_enabled(void)
639 {
640  return false;
641 }
642 
643 static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
644 {
645  return 0;
646 }
647 
648 static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
649 {
650  return 0;
651 }
652 
653 static inline int db8500_prcmu_config_hotdog(u8 threshold)
654 {
655  return 0;
656 }
657 
658 static inline int db8500_prcmu_config_hotmon(u8 low, u8 high)
659 {
660  return 0;
661 }
662 
663 static inline int db8500_prcmu_start_temp_sense(u16 cycles32k)
664 {
665  return 0;
666 }
667 
668 static inline int db8500_prcmu_stop_temp_sense(void)
669 {
670  return 0;
671 }
672 
673 static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
674 {
675  return -ENOSYS;
676 }
677 
678 static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
679 {
680  return -ENOSYS;
681 }
682 
683 static inline int prcmu_ac_wake_req(void)
684 {
685  return 0;
686 }
687 
688 static inline void prcmu_ac_sleep_req(void) {}
689 
690 static inline void db8500_prcmu_modem_reset(void) {}
691 
692 static inline void db8500_prcmu_system_reset(u16 reset_code) {}
693 
694 static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
695  bool keep_ap_pll)
696 {
697  return 0;
698 }
699 
700 static inline u8 db8500_prcmu_get_power_state_result(void)
701 {
702  return 0;
703 }
704 
705 static inline void db8500_prcmu_enable_wakeups(u32 wakeups) {}
706 
707 static inline int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state)
708 {
709  return 0;
710 }
711 
712 static inline int db8500_prcmu_request_clock(u8 clock, bool enable)
713 {
714  return 0;
715 }
716 
717 static inline int db8500_prcmu_set_display_clocks(void)
718 {
719  return 0;
720 }
721 
722 static inline int db8500_prcmu_disable_dsipll(void)
723 {
724  return 0;
725 }
726 
727 static inline int db8500_prcmu_enable_dsipll(void)
728 {
729  return 0;
730 }
731 
733 {
734  return 0;
735 }
736 
738 
739 static inline void db8500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
740 
741 static inline u16 db8500_prcmu_get_reset_code(void)
742 {
743  return 0;
744 }
745 
746 static inline int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
747 {
748  return 0;
749 }
750 
751 static inline int db8500_prcmu_enable_a9wdog(u8 id)
752 {
753  return 0;
754 }
755 
756 static inline int db8500_prcmu_disable_a9wdog(u8 id)
757 {
758  return 0;
759 }
760 
761 static inline int db8500_prcmu_kick_a9wdog(u8 id)
762 {
763  return 0;
764 }
765 
766 static inline int db8500_prcmu_load_a9wdog(u8 id, u32 val)
767 {
768  return 0;
769 }
770 
771 static inline bool db8500_prcmu_is_ac_wake_requested(void)
772 {
773  return 0;
774 }
775 
776 static inline int db8500_prcmu_set_arm_opp(u8 opp)
777 {
778  return 0;
779 }
780 
781 static inline int db8500_prcmu_get_arm_opp(void)
782 {
783  return 0;
784 }
785 
786 static inline u32 db8500_prcmu_read(unsigned int reg)
787 {
788  return 0;
789 }
790 
791 static inline void db8500_prcmu_write(unsigned int reg, u32 value) {}
792 
793 static inline void db8500_prcmu_write_masked(unsigned int reg, u32 mask,
794  u32 value) {}
795 
796 #endif /* !CONFIG_MFD_DB8500_PRCMU */
797 
798 #endif /* __MFD_DB8500_PRCMU_H */