imx233: add emi debug info

Change-Id: I33317ae26b70c825d4c5e3aaac364da5e0dc06c2
This commit is contained in:
Amaury Pouly 2013-07-07 17:29:14 +02:00
parent af4e408555
commit 659febc749
3 changed files with 63 additions and 1 deletions

View file

@ -34,6 +34,7 @@
#include "pinctrl-imx233.h" #include "pinctrl-imx233.h"
#include "ocotp-imx233.h" #include "ocotp-imx233.h"
#include "pwm-imx233.h" #include "pwm-imx233.h"
#include "emi-imx233.h"
#include "string.h" #include "string.h"
#include "stdio.h" #include "stdio.h"
@ -732,12 +733,48 @@ bool dbg_hw_info_usb(void)
} }
} }
bool dbg_hw_info_emi(void)
{
lcd_setfont(FONT_SYSFIXED);
while(1)
{
int button = get_action(CONTEXT_STD, HZ / 10);
switch(button)
{
case ACTION_STD_NEXT:
case ACTION_STD_PREV:
case ACTION_STD_OK:
case ACTION_STD_MENU:
lcd_setfont(FONT_UI);
return true;
case ACTION_STD_CANCEL:
lcd_setfont(FONT_UI);
return false;
}
lcd_clear_display();
struct imx233_emi_info_t info = imx233_emi_get_info();
int line = 0;
lcd_putsf(0, line++, "EMI");
lcd_putsf(0, line++, "rows: %d", info.rows);
lcd_putsf(0, line++, "columns: %d", info.columns);
lcd_putsf(0, line++, "banks: %d", info.banks);
lcd_putsf(0, line++, "chips: %d", info.chips);
lcd_putsf(0, line++, "size: %d MiB", info.size / 1024 / 1024);
lcd_putsf(0, line++, "cas: %d.%d", info.cas / 2, 5 * (info.cas % 2));
lcd_update();
yield();
}
}
bool dbg_hw_info(void) bool dbg_hw_info(void)
{ {
return dbg_hw_info_clkctrl() && dbg_hw_info_dma() && dbg_hw_info_adc() && return dbg_hw_info_clkctrl() && dbg_hw_info_dma() && dbg_hw_info_adc() &&
dbg_hw_info_power() && dbg_hw_info_powermgmt() && dbg_hw_info_rtc() && dbg_hw_info_power() && dbg_hw_info_powermgmt() && dbg_hw_info_rtc() &&
dbg_hw_info_dcp() && dbg_hw_info_pinctrl() && dbg_hw_info_icoll() && dbg_hw_info_dcp() && dbg_hw_info_pinctrl() && dbg_hw_info_icoll() &&
dbg_hw_info_ocotp() && dbg_hw_info_pwm() && dbg_hw_info_usb() && dbg_hw_info_ocotp() && dbg_hw_info_pwm() && dbg_hw_info_usb() && dbg_hw_info_emi() &&
dbg_hw_target_info(); dbg_hw_target_info();
} }

View file

@ -20,6 +20,7 @@
****************************************************************************/ ****************************************************************************/
#include "emi-imx233.h" #include "emi-imx233.h"
#include "clkctrl-imx233.h" #include "clkctrl-imx233.h"
#include "string.h"
struct emi_reg_t struct emi_reg_t
{ {
@ -199,3 +200,16 @@ void imx233_emi_set_frequency(unsigned long freq)
restore_interrupt(oldstatus); restore_interrupt(oldstatus);
} }
#endif #endif
struct imx233_emi_info_t imx233_emi_get_info(void)
{
struct imx233_emi_info_t info;
memset(&info, 0, sizeof(info));
info.rows = 13 - BF_RD(DRAM_CTL10, ADDR_PINS);
info.columns = 12 - BF_RD(DRAM_CTL11, COLUMN_SIZE);
info.cas = BF_RD(DRAM_CTL13, CASLAT_LIN);
info.banks = 4;
info.chips = __builtin_popcount(BF_RD(DRAM_CTL14, CS_MAP));
info.size = 2 * (1 << (info.rows + info.columns)) * info.chips * info.banks;
return info;
}

View file

@ -30,6 +30,16 @@
#define HW_DRAM_CTLxx(xx) (*(&HW_DRAM_CTL00 + (xx))) #define HW_DRAM_CTLxx(xx) (*(&HW_DRAM_CTL00 + (xx)))
struct imx233_emi_info_t
{
int cas; // 1/2 cycle unit
int rows;
int columns;
int banks;
int chips;
int size;
};
/** /**
* Absolute maximum EMI speed: 151.58 MHz (mDDR), 130.91 MHz (DDR) * Absolute maximum EMI speed: 151.58 MHz (mDDR), 130.91 MHz (DDR)
* Intermediate EMI speeds: 130.91 MHz, 120.00 MHz, 64 MHz, 24 MHz * Intermediate EMI speeds: 130.91 MHz, 120.00 MHz, 64 MHz, 24 MHz
@ -41,5 +51,6 @@
#define IMX233_EMIFREQ_24_MHz 24000 #define IMX233_EMIFREQ_24_MHz 24000
void imx233_emi_set_frequency(unsigned long freq); void imx233_emi_set_frequency(unsigned long freq);
struct imx233_emi_info_t imx233_emi_get_info(void);
#endif /* __EMI_IMX233_H__ */ #endif /* __EMI_IMX233_H__ */