diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-07-07 17:29:14 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-07-07 17:36:20 +0200 |
commit | 659febc749627a92c59f2d765da59eb9c995c50d (patch) | |
tree | 5a15f6f7641f11985b7e55cad5ee7db490b8532b | |
parent | af4e408555659f42db5b8c9a1d6a68143b2328da (diff) | |
download | rockbox-659febc749627a92c59f2d765da59eb9c995c50d.tar.gz rockbox-659febc749627a92c59f2d765da59eb9c995c50d.zip |
imx233: add emi debug info
Change-Id: I33317ae26b70c825d4c5e3aaac364da5e0dc06c2
-rw-r--r-- | firmware/target/arm/imx233/debug-imx233.c | 39 | ||||
-rw-r--r-- | firmware/target/arm/imx233/emi-imx233.c | 14 | ||||
-rw-r--r-- | firmware/target/arm/imx233/emi-imx233.h | 11 |
3 files changed, 63 insertions, 1 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index 84d68a780d..e350b5a8ba 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "pinctrl-imx233.h" | 34 | #include "pinctrl-imx233.h" |
35 | #include "ocotp-imx233.h" | 35 | #include "ocotp-imx233.h" |
36 | #include "pwm-imx233.h" | 36 | #include "pwm-imx233.h" |
37 | #include "emi-imx233.h" | ||
37 | #include "string.h" | 38 | #include "string.h" |
38 | #include "stdio.h" | 39 | #include "stdio.h" |
39 | 40 | ||
@@ -732,12 +733,48 @@ bool dbg_hw_info_usb(void) | |||
732 | } | 733 | } |
733 | } | 734 | } |
734 | 735 | ||
736 | bool dbg_hw_info_emi(void) | ||
737 | { | ||
738 | lcd_setfont(FONT_SYSFIXED); | ||
739 | |||
740 | while(1) | ||
741 | { | ||
742 | int button = get_action(CONTEXT_STD, HZ / 10); | ||
743 | switch(button) | ||
744 | { | ||
745 | case ACTION_STD_NEXT: | ||
746 | case ACTION_STD_PREV: | ||
747 | case ACTION_STD_OK: | ||
748 | case ACTION_STD_MENU: | ||
749 | lcd_setfont(FONT_UI); | ||
750 | return true; | ||
751 | case ACTION_STD_CANCEL: | ||
752 | lcd_setfont(FONT_UI); | ||
753 | return false; | ||
754 | } | ||
755 | |||
756 | lcd_clear_display(); | ||
757 | struct imx233_emi_info_t info = imx233_emi_get_info(); | ||
758 | int line = 0; | ||
759 | lcd_putsf(0, line++, "EMI"); | ||
760 | lcd_putsf(0, line++, "rows: %d", info.rows); | ||
761 | lcd_putsf(0, line++, "columns: %d", info.columns); | ||
762 | lcd_putsf(0, line++, "banks: %d", info.banks); | ||
763 | lcd_putsf(0, line++, "chips: %d", info.chips); | ||
764 | lcd_putsf(0, line++, "size: %d MiB", info.size / 1024 / 1024); | ||
765 | lcd_putsf(0, line++, "cas: %d.%d", info.cas / 2, 5 * (info.cas % 2)); | ||
766 | |||
767 | lcd_update(); | ||
768 | yield(); | ||
769 | } | ||
770 | } | ||
771 | |||
735 | bool dbg_hw_info(void) | 772 | bool dbg_hw_info(void) |
736 | { | 773 | { |
737 | return dbg_hw_info_clkctrl() && dbg_hw_info_dma() && dbg_hw_info_adc() && | 774 | return dbg_hw_info_clkctrl() && dbg_hw_info_dma() && dbg_hw_info_adc() && |
738 | dbg_hw_info_power() && dbg_hw_info_powermgmt() && dbg_hw_info_rtc() && | 775 | dbg_hw_info_power() && dbg_hw_info_powermgmt() && dbg_hw_info_rtc() && |
739 | dbg_hw_info_dcp() && dbg_hw_info_pinctrl() && dbg_hw_info_icoll() && | 776 | dbg_hw_info_dcp() && dbg_hw_info_pinctrl() && dbg_hw_info_icoll() && |
740 | dbg_hw_info_ocotp() && dbg_hw_info_pwm() && dbg_hw_info_usb() && | 777 | dbg_hw_info_ocotp() && dbg_hw_info_pwm() && dbg_hw_info_usb() && dbg_hw_info_emi() && |
741 | dbg_hw_target_info(); | 778 | dbg_hw_target_info(); |
742 | } | 779 | } |
743 | 780 | ||
diff --git a/firmware/target/arm/imx233/emi-imx233.c b/firmware/target/arm/imx233/emi-imx233.c index c62fa58a99..7e44c17c05 100644 --- a/firmware/target/arm/imx233/emi-imx233.c +++ b/firmware/target/arm/imx233/emi-imx233.c | |||
@@ -20,6 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "emi-imx233.h" | 21 | #include "emi-imx233.h" |
22 | #include "clkctrl-imx233.h" | 22 | #include "clkctrl-imx233.h" |
23 | #include "string.h" | ||
23 | 24 | ||
24 | struct emi_reg_t | 25 | struct emi_reg_t |
25 | { | 26 | { |
@@ -199,3 +200,16 @@ void imx233_emi_set_frequency(unsigned long freq) | |||
199 | restore_interrupt(oldstatus); | 200 | restore_interrupt(oldstatus); |
200 | } | 201 | } |
201 | #endif | 202 | #endif |
203 | |||
204 | struct imx233_emi_info_t imx233_emi_get_info(void) | ||
205 | { | ||
206 | struct imx233_emi_info_t info; | ||
207 | memset(&info, 0, sizeof(info)); | ||
208 | info.rows = 13 - BF_RD(DRAM_CTL10, ADDR_PINS); | ||
209 | info.columns = 12 - BF_RD(DRAM_CTL11, COLUMN_SIZE); | ||
210 | info.cas = BF_RD(DRAM_CTL13, CASLAT_LIN); | ||
211 | info.banks = 4; | ||
212 | info.chips = __builtin_popcount(BF_RD(DRAM_CTL14, CS_MAP)); | ||
213 | info.size = 2 * (1 << (info.rows + info.columns)) * info.chips * info.banks; | ||
214 | return info; | ||
215 | } \ No newline at end of file | ||
diff --git a/firmware/target/arm/imx233/emi-imx233.h b/firmware/target/arm/imx233/emi-imx233.h index cab2e5e8c0..71aae3e884 100644 --- a/firmware/target/arm/imx233/emi-imx233.h +++ b/firmware/target/arm/imx233/emi-imx233.h | |||
@@ -30,6 +30,16 @@ | |||
30 | 30 | ||
31 | #define HW_DRAM_CTLxx(xx) (*(&HW_DRAM_CTL00 + (xx))) | 31 | #define HW_DRAM_CTLxx(xx) (*(&HW_DRAM_CTL00 + (xx))) |
32 | 32 | ||
33 | struct imx233_emi_info_t | ||
34 | { | ||
35 | int cas; // 1/2 cycle unit | ||
36 | int rows; | ||
37 | int columns; | ||
38 | int banks; | ||
39 | int chips; | ||
40 | int size; | ||
41 | }; | ||
42 | |||
33 | /** | 43 | /** |
34 | * Absolute maximum EMI speed: 151.58 MHz (mDDR), 130.91 MHz (DDR) | 44 | * Absolute maximum EMI speed: 151.58 MHz (mDDR), 130.91 MHz (DDR) |
35 | * Intermediate EMI speeds: 130.91 MHz, 120.00 MHz, 64 MHz, 24 MHz | 45 | * Intermediate EMI speeds: 130.91 MHz, 120.00 MHz, 64 MHz, 24 MHz |
@@ -41,5 +51,6 @@ | |||
41 | #define IMX233_EMIFREQ_24_MHz 24000 | 51 | #define IMX233_EMIFREQ_24_MHz 24000 |
42 | 52 | ||
43 | void imx233_emi_set_frequency(unsigned long freq); | 53 | void imx233_emi_set_frequency(unsigned long freq); |
54 | struct imx233_emi_info_t imx233_emi_get_info(void); | ||
44 | 55 | ||
45 | #endif /* __EMI_IMX233_H__ */ | 56 | #endif /* __EMI_IMX233_H__ */ |