Add support for G2C1 mx28 board (which has no battery)
Subsystems (2)
cover Add support for G2C1 mx28 board (which has no battery)
This series adds support for booting mx28 based boards which do not include a battery as per Freescale application note AN4199
Patch 2 (which implements booting without a battery) is based on a patch submitted to the Freescale community forums by Damien Gotfroi (Cc'd)
The patch series adds the following functionality (in oreder of implementation)
- Debug output for mxs SPL (define DEBUG and CONFIG_SPL_SERIAL_SUPPORT in order to enable)
- Ability to boot mx28 boards without a battery as per AN4199 (define CONFIG_SYS_MXS_VDD5V_ONLY to enable)
- A tight loop (with 'Waiting for JTAG user') at the completion of SPL init if booting with the bootmode jumpers set to JTAG
- Move the PLL power-up to a more logical location and properly initialise and check for PLL lock
- Finally, add the G2C1 board
Graeme Russ (5):
Add debug output to mx29 SPL source files Enable booting of mx28 without battery Add 'Wait for JTAG user' if booted in JTAG mode Move PLL power-up from power init to memory init Add support for ReachTech G2C1 board
arch/arm/Kconfig | 13 + arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 7 + arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c | 13 +- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 49 +++ arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 287 ++++++++++++++++-- board/reachtech/g2c1/Kconfig | 15 + board/reachtech/g2c1/MAINTAINERS | 9 + board/reachtech/g2c1/Makefile | 12 + board/reachtech/g2c1/README | 58 ++++ board/reachtech/g2c1/g2c1.c | 79 +++++ board/reachtech/g2c1/spl_boot.c | 452 ++++++++++++++++++++++++++++ configs/g2c1_defconfig | 3 + doc/README.mxs | 10 + include/configs/g2c1.h | 303 +++++++++++++++++++ 14 files changed, 1281 insertions(+), 29 deletions(-) create mode 100644 board/reachtech/g2c1/Kconfig create mode 100644 board/reachtech/g2c1/MAINTAINERS create mode 100644 board/reachtech/g2c1/Makefile create mode 100644 board/reachtech/g2c1/README create mode 100644 board/reachtech/g2c1/g2c1.c create mode 100644 board/reachtech/g2c1/spl_boot.c create mode 100644 configs/g2c1_defconfig create mode 100644 include/configs/g2c1.h
Signature · 1 line
1.9.3
PATCH 1/5 Add debug output to mx29 SPL source files
---
arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 1 + arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c | 13 +++- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 18 +++++ arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 100 +++++++++++++++++++++++++++- 4 files changed, 127 insertions(+), 5 deletions(-)
arch/arm/cpu/arm926ejs/mxs/spl_boot.c +1 -0
@@ -147,6 +147,7 @@ void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr,mxs_iomux_setup_multiple_pads (iomux_setup, iomux_size);mxs_spl_console_init (); +debug ("SPL: Serial Console Initialised\n" );mxs_power_init ();
arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c +11 -2
@@ -18,6 +18,8 @@ void mxs_lradc_init(void) {struct mxs_lradc_regs *regs = (struct mxs_lradc_regs *)MXS_LRADC_BASE ; +debug ("SPL: Initialisating LRADC" ); +writel (LRADC_CTRL0_SFTRST , ®s->hw_lradc_ctrl0_clr);writel (LRADC_CTRL0_CLKGATE , ®s->hw_lradc_ctrl0_clr);writel (LRADC_CTRL0_ONCHIP_GROUNDREF , ®s->hw_lradc_ctrl0_clr);
@@ -37,9 +39,15 @@ void mxs_lradc_enable_batt_measurement(void) {struct mxs_lradc_regs *regs = (struct mxs_lradc_regs *)MXS_LRADC_BASE ; +debug ("SPL: Enabling LRADC battery measurement\n" ); +/* Check if the channel is present at all. */ -if (!(readl (®s->hw_lradc_status) &LRADC_STATUS_CHANNEL7_PRESENT )) +if (!(readl (®s->hw_lradc_status) &LRADC_STATUS_CHANNEL7_PRESENT )) { +debug ("SPL: LRADC channel 7 is not present - aborting\n" );return ; + } + +debug ("SPL: LRADC channel 7 is present - configuring\n" );writel (LRADC_CTRL1_LRADC7_IRQ_EN , ®s->hw_lradc_ctrl1_clr);writel (LRADC_CTRL1_LRADC7_IRQ , ®s->hw_lradc_ctrl1_clr);
@@ -65,6 +73,7 @@ void mxs_lradc_enable_batt_measurement(void) 100, ®s->hw_lradc_delay3);writel (0xffffffff , ®s->hw_lradc_ch7_clr); -writel (LRADC_DELAY_KICK , ®s->hw_lradc_delay3_set); + +debug ("SPL: LRADC channel 7 configuration complete\n" ); }
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +18 -0
@@ -92,6 +92,7 @@ static uint32_t dram_vals[] = {__weak void mxs_adjust_memory_params (uint32_t *dram_vals) { +debug ("SPL: Using default SDRAM parameters\n" ); }#ifdef CONFIG_MX28
@@ -99,8 +100,10 @@ static void initialize_dram_values(void) {int i; +debug ("SPL: Setting mx28 board specific SDRAM parameters\n" );mxs_adjust_memory_params (dram_vals); +debug ("SPL: Applying SDRAM parameters\n" );for (i =0 ; i <ARRAY_SIZE (dram_vals); i++)writel (dram_vals[i],MXS_DRAM_BASE + (4 * i)); }
@@ -109,6 +112,7 @@ static void initialize_dram_values(void) {int i; +debug ("SPL: Setting mx23 board specific SDRAM parameters\n" );mxs_adjust_memory_params (dram_vals);/*
@@ -120,6 +124,7 @@ static void initialize_dram_values(void)* HW_DRAM_CTL8 is setup as the last element. * So skip the initialization of these HW_DRAM_CTL registers. */ +debug ("SPL: Applying SDRAM parameters\n" );for (i =0 ; i <ARRAY_SIZE (dram_vals); i++) {if (i ==8 || i ==27 || i ==28 || i ==35 )continue ;
@@ -146,6 +151,8 @@ static void mxs_mem_init_clock(void)const unsigned char divider =21 ;#endif +debug ("SPL: Initialising FRAC0\n" ); +/* Gate EMI clock */ writeb (CLKCTRL_FRAC_CLKGATE , &clkctrl_regs->hw_clkctrl_frac0_set[CLKCTRL_FRAC0_EMI ]);
@@ -170,6 +177,7 @@ static void mxs_mem_init_clock(void) &clkctrl_regs->hw_clkctrl_clkseq_clr);early_delay (10000 ); +debug ("SPL: FRAC0 Initialised\n" ); }static void mxs_mem_setup_cpu_and_hbus (void )
@@ -177,6 +185,8 @@ static void mxs_mem_setup_cpu_and_hbus(void)struct mxs_clkctrl_regs *clkctrl_regs = (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE ; +debug ("SPL: Setting CPU and HBUS clock frequencies\n" ); +/* Set fractional divider for ref_cpu to 480 * 18 / 19 = 454MHz * and ungate CPU clock */ writeb(19 & CLKCTRL_FRAC_FRAC_MASK,
@@ -209,6 +219,8 @@ static void mxs_mem_setup_vdda(void)struct mxs_power_regs *power_regs = (struct mxs_power_regs *)MXS_POWER_BASE ; +debug ("SPL: Configuring VDDA\n" ); + writel((0xc << POWER_VDDACTRL_TRG_OFFSET) | (0x7 << POWER_VDDACTRL_BO_OFFSET_OFFSET) | POWER_VDDACTRL_LINREG_OFFSET_1STEPS_BELOW,
@@ -240,6 +252,8 @@ static void mx23_mem_setup_vddmem(void)struct mxs_power_regs *power_regs = (struct mxs_power_regs *)MXS_POWER_BASE ; +debug ("SPL: Setting mx23 VDDMEM\n" ); +/* We must wait before and after disabling the current limiter! */ early_delay (10000 );
@@ -252,6 +266,8 @@ static void mx23_mem_setup_vddmem(void)static void mx23_mem_init (void ) { +debug ("SPL: Initialising mx23 SDRAM Controller\n" ); +/* * Reset/ungate the EMI block. This is essential, otherwise the system * suffers from memory instability. This thing is mx23 specific and is
@@ -297,6 +313,8 @@ static void mx28_mem_init(void)struct mxs_pinctrl_regs *pinctrl_regs = (struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE ; +debug ("SPL: Initialising mx28 SDRAM Controller\n" ); +/* Set DDR2 mode */ writel (PINCTRL_EMI_DS_CTRL_DDR_MODE_DDR2 , &pinctrl_regs->hw_pinctrl_emi_ds_ctrl_set);
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +97 -3
357 lines not on this page · raw message
Signature · 1 line
1.9.3
Fabio Estevam
reviewerPATCH 1/5 Add debug output to mx29 SPL source files
Quoted 1 line · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>
In the subject I guess you meant 'mxs' instead of mx29.
Also, if you send a v2, please keep Marek on Cc.
PATCH 1/5 Add debug output to mx29 SPL source files
In reply to Graeme RussQuoted 1 line · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>
Hi!
- Commit message is missing.
- Some of the debug outputs are missing newline (\n) character
- You can use __func__ and __LINE__ in the debug output to better specify where the debug spit happened.
Oh, and the CC list looks pretty random. You can just add "Cc: " tag into the patches so that git handles it correctly.
Best regards,
Marek Vasut
PATCH 1/5 Add debug output to mx29 SPL source files
Quoted 9 lines · Marek Vasut
Quoted 1 line · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>Hi!
- Commit message is missing.
- Some of the debug outputs are missing newline (\n) character
- You can use__func__and__LINE__in the debug output to better specify where the debug spit happened.
I saw something earlier on the list about this - I thought the feeling was to use descriptive strings that are easy to grep rather than __func__ and __LINE__, or maybe I misread
Quoted 3 lines
Oh, and the CC list looks pretty random. You can just add "Cc: " tag into the patches so that git handles it correctly.
Cc list was generated by patman (I added Damien as his patch is what mine are based on)
Regards,
Graeme
PATCH 2/5 Enable booting of mx28 without battery
In reply to Graeme RussSection 4.1.2 of Freescale Application Note AN4199 describes the configuration required to operate the mx28 from a 5V source without a battery. This patch implements the changes to the Freescale bootlets which allow this configuration to properly boot the mx28 processor
---
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 190 +++++++++++++++++++++++++++- doc/README.mxs | 10 ++ 2 files changed, 197 insertions(+), 3 deletions(-)
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +187 -3
@@ -14,6 +14,22 @@#include "mxs_init.h" +#if defined(CONFIG_MX28 ) +/* +* The minimum DCDC operating voltage for i.MX28 with loading is 3.3V. +* we will set the BRWNOUT_LVL bitfield the 3.2V value for 0.1V margin. +*/ +#define BATTERY_BRWNOUT_BITFIELD_VALUE 20/* 20 = 3.2V */ +#else +/* +* At the time of this writing, 3V is greater than the minimum DCDC +* operating voltage for i.MX233 as listed in by the "Battery / DCDC Input +* Voltage" parameter listed in the reference manual so we will set the +* BRWNOUT_LVL bitfield to 3V value. +*/ +#define BATTERY_BRWNOUT_BITFIELD_VALUE 15/* 15 = 3.0V */ +#endif +/** * mxs_power_clock2xtal() - Switch CPU core clock source to 24MHz XTAL *
@@ -88,6 +104,7 @@ static void mxs_power_set_auto_restart(void)while (readl (&rtc_regs->hw_rtc_ctrl) &RTC_CTRL_CLKGATE ) ; +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY /* Do nothing if flag already set */ if (readl (&rtc_regs->hw_rtc_persistent0) &RTC_PERSISTENT0_AUTO_RESTART )return ;
@@ -103,6 +120,7 @@ static void mxs_power_set_auto_restart(void) ;while (readl (&rtc_regs->hw_rtc_stat) &RTC_STAT_STALE_REGS_MASK ) ; +#endif }/**
@@ -135,6 +153,7 @@ static void mxs_power_set_linreg(void) POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_BELOW); } +#ifndef CONFIG_SYS_MXS_VDD5V_ONLY /** * mxs_get_batt_volt() - Measure battery input voltage *
@@ -217,6 +236,7 @@ static int mxs_is_batt_good(void)debug ("SPL: Battery Voltage too low\n" ); return 0; } +#endif /** * mxs_power_setup_5v_detect() - Start the 5V input detection comparator
@@ -301,10 +321,19 @@ static void mxs_power_init_4p2_params(void)POWER_5VCTRL_HEADROOM_ADJ_MASK , 0x4 << POWER_5VCTRL_HEADROOM_ADJ_OFFSET); +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +debug ("SPL: Configuring 4P2 VDD5V only regulator params\n" ); +clrsetbits_le32 (&power_regs->hw_power_dcdc4p2, +POWER_DCDC4P2_DROPOUT_CTRL_MASK , +POWER_DCDC4P2_DROPOUT_CTRL_100MV | +POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2 ); +#else +debug ("SPL: Configuring VDD5V + Battery 4P2 regulator params\n" );clrsetbits_le32 (&power_regs->hw_power_dcdc4p2,POWER_DCDC4P2_DROPOUT_CTRL_MASK ,POWER_DCDC4P2_DROPOUT_CTRL_100MV |POWER_DCDC4P2_DROPOUT_CTRL_SRC_SEL ); +#endif clrsetbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK,
@@ -387,9 +416,11 @@ static void mxs_enable_4p2_dcdc_input(int xfer)if (!pwd_bo)clrbits_le32 (&power_regs->hw_power_minpwr,POWER_MINPWR_PWD_BO ); -while (readl (&power_regs->hw_power_ctrl) &POWER_CTRL_VBUS_VALID_IRQ ) -writel (POWER_CTRL_VBUS_VALID_IRQ , - &power_regs->hw_power_ctrl_clr); +if (xfer) +while (readl (&power_regs->hw_power_ctrl) & +POWER_CTRL_VBUS_VALID_IRQ ) +writel (POWER_CTRL_VBUS_VALID_IRQ , + &power_regs->hw_power_ctrl_clr);if (prev_5v_brnout) { writel(POWER_5VCTRL_PWDN_5VBRNOUT,
@@ -480,6 +511,23 @@ static void mxs_power_init_4p2_regulator(void)POWER_DCDC4P2_BO_MASK , 22 << POWER_DCDC4P2_BO_OFFSET); /* 4.15V */ +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +debug ("SPL: Ramping up current limit (VDD5V only)\n" ); + + tmp = (readl (&power_regs->hw_power_5vctrl) & +POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK ) >> +POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET ; +while (tmp <0x3f ) { + tmp++; + tmp2 =readl (&power_regs->hw_power_5vctrl); + tmp2 &= ~POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK ; + tmp2 |= tmp << +POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET ; +writel (tmp2, &power_regs->hw_power_5vctrl); +early_delay (100 ); + } +#else +debug ("SPL: Ramping up current limit (VDD5V + Battery)\n" );if (!(readl (&power_regs->hw_power_sts) &POWER_STS_DCDC_4P2_BO )) {setbits_le32 (&power_regs->hw_power_5vctrl,0x3f <<POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET );
@@ -506,6 +554,30 @@ static void mxs_power_init_4p2_regulator(void) } } } +#endif +/* +* TODO: If VDD5V is sourced from USB VBUS, we need to set the +* current limit so we don't exceed the USB specifications. The +* USB standard states that a device can only draw 100mA unless it +* requests more from the host - after which it may draw up to +* 500mA. Then we have Charging Ports which may deliver up to 1.5A +* (without needing a request from the device). +* +* NOTE: The source code for the Freescale bootlets seems to be +* internally inconsistent - The printf() claims 100mA, while +* VBUS_CURRENT_LIMIT is defined as 400mA. +* +* NOTE: We should also limit the CPU clock frequency in order to +* reduce the likelyhood of the USB VBUS current limit being exceeded +* +* The following would limit the USB VBUS current draw to 100mA +* +* clrsetbits_le32(&power_regs->hw_power_5vctrl, +* POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK, +* 0x10 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET); +* +* early_delay(10000); +*/ clrbits_le32 (&power_regs->hw_power_dcdc4p2,POWER_DCDC4P2_BO_MASK );writel (POWER_CTRL_DCDC4P2_BO_IRQ , &power_regs->hw_power_ctrl_clr);
@@ -524,11 +596,13 @@ static void mxs_power_init_dcdc_4p2_source(void)debug ("SPL: Switching DC-DC converters to 4P2\n" ); +#ifndef CONFIG_SYS_MXS_VDD5V_ONLY if (!(readl (&power_regs->hw_power_dcdc4p2) &POWER_DCDC4P2_ENABLE_DCDC )) {debug ("SPL: Already switched - aborting\n" );hang (); } +#endif mxs_enable_4p2_dcdc_input (1 );
@@ -576,6 +650,14 @@ static void mxs_power_enable_4p2(void)mxs_power_init_4p2_regulator ();/* Shutdown battery (none present) */ +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +clrbits_le32 (&power_regs->hw_power_dcdc4p2, +POWER_DCDC4P2_BO_MASK ); +writel (POWER_CTRL_DCDC4P2_BO_IRQ , + &power_regs->hw_power_ctrl_clr); +writel (POWER_CTRL_ENIRQ_DCDC4P2_BO , + &power_regs->hw_power_ctrl_set); +#else if (!mxs_is_batt_ready ()) {clrbits_le32 (&power_regs->hw_power_dcdc4p2,POWER_DCDC4P2_BO_MASK );
@@ -584,6 +666,7 @@ static void mxs_power_enable_4p2(void)writel (POWER_CTRL_ENIRQ_DCDC4P2_BO , &power_regs->hw_power_ctrl_clr); } +#endif mxs_power_init_dcdc_4p2_source ();
@@ -661,6 +744,7 @@ static void mxs_powerdown(void) &power_regs->hw_power_reset); } +#ifndef CONFIG_SYS_MXS_VDD5V_ONLY /** * mxs_batt_boot() - Configure the power block to boot from battery input *
@@ -714,6 +798,7 @@ static void mxs_batt_boot(void) mxs_power_enable_4p2(); } +#endif /** * mxs_handle_5v_conflict() - Test if the 5V input is reliable
@@ -757,6 +842,7 @@ static void mxs_handle_5v_conflict(void)break ; } +#ifndef CONFIG_SYS_MXS_VDD5V_ONLY /* * TODO: I can't see this being reached. We'll either * powerdown or boot from a stable 5V supply.
@@ -766,6 +852,7 @@ static void mxs_handle_5v_conflict(void)mxs_batt_boot (); break; } +#endif } }
@@ -803,6 +890,7 @@ static void mxs_5v_boot(void)mxs_handle_5v_conflict (); } +#ifndef CONFIG_SYS_MXS_VDD5V_ONLY /** * mxs_init_batt_bo() - Configure battery brownout threshold *
@@ -824,6 +912,7 @@ static void mxs_init_batt_bo(void)writel (POWER_CTRL_BATT_BO_IRQ , &power_regs->hw_power_ctrl_clr); writel(POWER_CTRL_ENIRQ_BATT_BO, &power_regs->hw_power_ctrl_clr); } +#endif /** * mxs_switch_vddd_to_dcdc_source() - Switch VDDD rail to DC-DC converter
@@ -858,7 +947,12 @@ static void mxs_switch_vddd_to_dcdc_source(void)*/ static void mxs_power_configure_power_source (void ) { +#ifndef CONFIG_SYS_MXS_VDD5V_ONLY int batt_ready, batt_good; +#else +struct mxs_rtc_regs *rtc_regs = + (struct mxs_rtc_regs *)MXS_RTC_BASE ; +#endif struct mxs_power_regs *power_regs = (struct mxs_power_regs *)MXS_POWER_BASE ; struct mxs_lradc_regs *lradc_regs =
@@ -868,6 +962,44 @@ static void mxs_power_configure_power_source(void)mxs_src_power_init (); +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +/* +* device configured for no source to DCDC_BATT input (5V only power +* source). This boot option doesn't waste time looking for a good +* battery. Battery powered operation and automatic voltage +* measurements are disabled. +*/ + +/* TODO: Find out what the purpose of these two lines is */ +setbits_le32 (&rtc_regs->hw_rtc_persistent1, +TC_PERSISTENT1_GENERAL_USB_BOOT_PLAYER ); +clrbits_le32 (&rtc_regs->hw_rtc_persistent1, +RTC_PERSISTENT1_GENERAL_ENUM_500MA_2X ); + +/* +* Disable automatic battery voltage measurements which seem +* unnecessary for this configuration. +*/ +debug ("SPL: Disabling automatic battery voltage measurements\n" ); +setbits_le32 (&power_regs->hw_power_battmonitor, +POWER_BATTMONITOR_EN_BATADJ ); +writel (LRADC_CONVERSION_AUTOMATIC , + &lradc_regs->hw_lradc_conversion_clr); +writel (525 <<POWER_BATTMONITOR_BATT_VAL_OFFSET , + &power_regs->hw_power_battmonitor); + +clrsetbits_le32 (&power_regs->hw_power_battmonitor, +POWER_BATTMONITOR_BRWNOUT_LVL_MASK , +BATTERY_BRWNOUT_BITFIELD_VALUE << +POWER_BATTMONITOR_BRWNOUT_LVL_OFFSET ); +mxs_5v_boot (); + +/* +* TODO: Do not switch CPU clock to PLL if we are VDD5V is sourced +* from USB VBUS +*/ +mxs_power_clock2pll (); +#else if (readl (&power_regs->hw_power_sts) &POWER_STS_VDD5V_GT_VDDIO ) { batt_ready =mxs_is_batt_ready ();if (batt_ready) {
@@ -896,6 +1028,7 @@ static void mxs_power_configure_power_source(void)mxs_power_clock2pll ();mxs_init_batt_bo (); +#endif mxs_switch_vddd_to_dcdc_source ();
@@ -1197,9 +1330,24 @@ void mxs_power_init(void) {struct mxs_power_regs *power_regs = (struct mxs_power_regs *)MXS_POWER_BASE ; +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +struct mxs_pinctrl_regs *pinctrl_regs = + (struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE ; +struct mxs_lradc_regs *lradc_regs = + (struct mxs_lradc_regs *)MXS_LRADC_BASE ; +#endif debug ("SPL: Initialising Power Block\n" ); +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +debug ("SPL: Configured for VDD 5V only (no battery)\n" ); +/* Set high drive strength to SSP0 */ +clrsetbits_le32 (&pinctrl_regs->hw_pinctrl_drive8, +0x33333333 ,0x22222222 ); +clrsetbits_le32 (&pinctrl_regs->hw_pinctrl_drive9, +0x333 ,0x222 ); +#endif +mxs_ungate_power ();mxs_power_clock2xtal ();
@@ -1215,12 +1363,26 @@ void mxs_power_init(void)debug ("SPL: Setting VDDIO to 3V3 (brownout @ 3v15)\n" );mxs_power_set_vddx (&mxs_vddio_cfg,3300 ,3150 ); +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +setbits_le32 (&power_regs->hw_power_vddioctrl, +0x7 <<POWER_VDDIOCTRL_BO_OFFSET_OFFSET ); +clrbits_le32 (&power_regs->hw_power_vddioctrl, +0x1 <<POWER_VDDIOCTRL_BO_OFFSET_OFFSET ); + +debug ("SPL: Setting VDDD to 1V35 (brownout @ 1v2)\n" ); +mxs_power_set_vddx (&mxs_vddd_cfg,1350 ,1200 ); +#ifdef CONFIG_MX23 +debug ("SPL: Setting VDDMEM to 3V3 (brownout @ 3v15)\n" ); +mxs_power_set_vddx (&mxs_vddmem_cfg,3300 ,3150 ); +#endif +#else debug ("SPL: Setting VDDD to 1V5 (brownout @ 1v0)\n" );mxs_power_set_vddx (&mxs_vddd_cfg,1500 ,1000 );#ifdef CONFIG_MX23 debug ("SPL: Setting mx23 VDDMEM to 2V5 (brownout @ 1v7)\n" );mxs_power_set_vddx (&mxs_vddmem_cfg,2500 ,1700 );#endif +#endif writel(POWER_CTRL_VDDD_BO_IRQ | POWER_CTRL_VDDA_BO_IRQ | POWER_CTRL_VDDIO_BO_IRQ | POWER_CTRL_VDD5V_DROOP_IRQ | POWER_CTRL_VBUS_VALID_IRQ | POWER_CTRL_BATT_BO_IRQ |
@@ -1228,6 +1390,28 @@ void mxs_power_init(void)writel (POWER_5VCTRL_PWDN_5VBRNOUT , &power_regs->hw_power_5vctrl_set); +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY +#if defined(CONFIG_MX28 ) +/* +* On i.MX28, a new bit has been added to allow automatic hardware +* shutdown if VDD4P2 browns out. If we permanently only have a VDD5V +* source, we want to enable this bit. For devices with dead batteries, +* we could also temporarily set this bit until the kernel battery +* charger sufficiently charges the battery but we won't do this for +* now as the latest release kernel versions aren't aware of it +* and thus don't handle the proper setting/clearing of this bit. +*/ +writel (1 <<7 , &power_regs->hw_power_refctrl); +#endif +setbits_le32 (&power_regs->hw_power_battmonitor, +POWER_BATTMONITOR_PWDN_BATTBRNOUT_5VDETECT_EN | +POWER_BATTMONITOR_EN_BATADJ | +POWER_BATTMONITOR_PWDN_BATTBRNOUT ); +clrsetbits_le32 (&lradc_regs->hw_lradc_ctrl4, +LRADC_CTRL4_LRADC6SELECT_MASK , +LRADC_CTRL4_LRADC6SELECT_CHANNEL6 ); +#endif +early_delay (1000 ); }
doc/README.mxs +10 -0
@@ -185,6 +185,16 @@ NOTE: If the user needs to adjust the start sector, the "mxsboot" tool contains a "-p" switch for that purpose. The "-p" switch takes the sector number as an argument. +3.1) MXS Specific Configuration Variables +----------------------------------------- +The following C pre-processor defines can be included in the board specific +configuration file: + +CONFIG_SYS_MXS_VDD5V_ONLY - Board designs implementing a power circuit +consisting of a 5V DC supply only (i.e. without a battery), as per Section +4.1.2 of Freescale Semiconductor Application Note AN4199 MUST include this +configuration variable in the board configuration file + 4) Installation of U-Boot into NAND flash on a MX28 based board ---------------------------------------------------------------
Signature · 1 line
1.9.3
PATCH 2/5 Enable booting of mx28 without battery
Hi Guys,
Quoted 5 lines
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +1
-0@@ -868,6 +962,44 @@ static void mxs_power_configure_power_source(void)mxs_src_power_init (); +#ifdef CONFIG_SYS_MXS_VDD5V_ONLY
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c static void mxs_power_configure_power_source(void) · line 975
Quoted 10 lines
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +10
-0+/* +* device configured for no source to DCDC_BATT input (5V only power +* source). This boot option doesn't waste time looking for a good +* battery. Battery powered operation and automatic voltage +* measurements are disabled. +*/ + +/* TODO: Find out what the purpose of these two lines is */ +setbits_le32 (&rtc_regs->hw_rtc_persistent1, +TC_PERSISTENT1_GENERAL_USB_BOOT_PLAYER );
Never make simple, last minute changes without testing them...
This should be RTC_PERSISTENT1_GENERAL_USB_BOOT_PLAYER
I'll fix it in the next version
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c static void mxs_power_configure_power_source(void) · line 978
Quoted 3 lines
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +3
-0+clrbits_le32 (&rtc_regs->hw_rtc_persistent1, +RTC_PERSISTENT1_GENERAL_ENUM_500MA_2X ); +
Regards,
Graeme
Fabio Estevam
reviewerPATCH 2/5 Enable booting of mx28 without battery
Quoted 5 lines · Graeme Russ
Never make simple, last minute changes without testing them...
This should be
RTC_PERSISTENT1_GENERAL_USB_BOOT_PLAYERI'll fix it in the next version
This looks great, Graeme! Thanks for working on upstream this.
Regards,
Fabio Estevam
PATCH 2/5 Enable booting of mx28 without battery
In reply to Graeme RussQuoted 6 lines · Graeme Russ
Section 4.1.2 of Freescale Application Note AN4199 describes the configuration required to operate the mx28 from a 5V source without a battery. This patch implements the changes to the Freescale bootlets which allow this configuration to properly boot the mx28 processor
Signed-off-by Graeme Russ <[email protected]>
I have to admit I don't really like this boatload of new ifdeffery. Isn't it possible to detect if the battery is or isn't connected at runtime ?
Best regards,
Marek Vasut
PATCH 2/5 Enable booting of mx28 without battery
Hi Marek,
Quoted 10 lines · Marek Vasut
Quoted 6 lines · Graeme Russ
Section 4.1.2 of Freescale Application Note AN4199 describes the configuration required to operate the mx28 from a 5V source without a battery. This patch implements the changes to the Freescale bootlets which allow this configuration to properly boot the mx28 processor
Signed-off-by Graeme Russ <[email protected]>I have to admit I don't really like this boatload of new ifdeffery. Isn't it possible to detect if the battery is or isn't connected at runtime ?
I doubt it. If you look at the circuit in AN4199, the BATTERY and DCDC_BATT pins are hooked up to VDD4P2 via 1k resistors. What the mx28 does internally is measure the voltages on the VDD5V and either BATTERY/DCDC_BATT pins and decides which to use (preferencing the battery unless it goes below a threshold).
Without this patch, the mx28 sees a good battery voltage and switches to battery mode which is drawn of DCDC4P2 which is now trying to be driven by the battery input which, of course, will not work.
So the only way to figure it out at runtime would be to have the battery inputs at 0v so you could see there is no battery.
The only other option would be to use a GPIO pin
Regards,
Graeme
Fabio Estevam
reviewerPATCH 2/5 Enable booting of mx28 without battery
In reply to Graeme RussHi Graeme,
Quoted 10 lines · Graeme Russ
Section 4.1.2 of Freescale Application Note AN4199 describes the configuration required to operate the mx28 from a 5V source without a battery. This patch implements the changes to the Freescale bootlets which allow this configuration to properly boot the mx28 processor
Signed-off-by Graeme Russ <[email protected]>---
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 190 +++++++++++++++++++++++++++- doc/README.mxs | 10 ++
Damien posted today a new version of this patch in the imx community, which is a lot simpler.
Could you please try it?
Thanks
PATCH 2/5 Enable booting of mx28 without battery
Quoted 3 lines · Fabio Estevam
Hi Graeme,
On Wed, Jan 21, 2015 at 9:55 AM, Graeme Russ <[email protected]>
Quoted 8 lines · wrote:
Quoted 8 lines
Section 4.1.2 of Freescale Application Note AN4199 describes the configuration required to operate the mx28 from a 5V source without a battery. This patch implements the changes to the Freescale bootlets which allow this configuration to properly boot the mx28 processor
Signed-off-by Graeme Russ <[email protected]>---
Quoted 6 lines
Quoted 3 lines
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 190+++++++++++++++++++++++++++- doc/README.mxs
| 10 ++Damien posted today a new version of this patch in the imx community, which is a lot simpler.
Guys, we have U-Boot mailing list for posting U-Boot patches. It'd be nice if you could use it to prevent fragmentation of efforts ;-)
But of course, the effort is appreciated, just a rant.
Best regards,
Marek Vasut
PATCH 2/5 Enable booting of mx28 without battery
In reply to Fabio EstevamHi Fabio,
Quoted 11 lines · Fabio Estevam
Hi Graeme,
Quoted 8 lines · Graeme Russ
Section 4.1.2 of Freescale Application Note AN4199 describes the configuration required to operate the mx28 from a 5V source without a battery. This patch implements the changes to the Freescale bootlets which allow this configuration to properly boot the mx28 processor
Signed-off-by Graeme Russ <[email protected]>---
Quoted 7 lines
Quoted 2 lines
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 190 +++++++++++++++++++++++++++- doc/README.mxs | 10 ++Damien posted today a new version of this patch in the imx community, which is a lot simpler.
Could you please try it?
I've taken a look at it, but decided to leave this patch as-is. Here is what I wrote on the Freescale forum:
~~~~
I'm going to keep my U-Boot patch mostly as-is for a few reasons:
- The patch disables battery voltage measurement when there is no battery
- The patch disables all code paths relating to booting from battery
- The power block configuration is based primarily on the Fressscale bootlets which I think should be retained unless we can come up with some pretty clear and convincing arguments as to why an alternative approach is better
I think there is scope for some refactoring of the power block setup code in U-Boot, but for now I think it best to leave it as close to the bootlet code sequence as practical
~~~~
Regards,
Graeme
Fabio Estevam
reviewerPATCH 2/5 Enable booting of mx28 without battery
Quoted 3 lines · Graeme Russ
I've taken a look at it, but decided to leave this patch as-is. Here is what I wrote on the Freescale forum:
Still curious: does the updated patch from Damien allow your system to boot or not?
Quoted 8 lines
~~~~
I'm going to keep my U-Boot patch mostly as-is for a few reasons:
- The patch disables battery voltage measurement when there is no battery
- The patch disables all code paths relating to booting from battery
- The power block configuration is based primarily on the Fressscale bootlets which I think should be retained unless we can come up with some pretty clear and convincing arguments as to why an alternative approach is better
,but my understanding is that the original patch does not work on Damien's board as it gives DDR errors.
Regards,
Fabio Estevam
PATCH 2/5 Enable booting of mx28 without battery
Hi Fabio,
Quoted 7 lines · Fabio Estevam
Quoted 3 lines · Graeme Russ
I've taken a look at it, but decided to leave this patch as-is. Here is what I wrote on the Freescale forum:
Still curious: does the updated patch from Damien allow your system to boot or not?
It is on today's todo list
Quoted 10 lines
Quoted 9 lines
~~~~
I'm going to keep my U-Boot patch mostly as-is for a few reasons:
- The patch disables battery voltage measurement when there is no battery
- The patch disables all code paths relating to booting from battery
- The power block configuration is based primarily on the Fressscale bootlets which I think should be retained unless we can come up with some pretty clear and convincing arguments as to why an alternative approach is better
Quoted 2 lines
,but my understanding is that the original patch does not work on Damien's board as it gives DDR errors.
I thought the DDR errors were fixed with Damien's DDR patch. Damien, can you please confirm?
Regards,
Graeme
Fabio Estevam
reviewerPATCH 2/5 Enable booting of mx28 without battery
Quoted 2 lines · Graeme Russ
I thought the DDR errors were fixed with Damien's DDR patch. Damien, can you please confirm?
His response in the forum was:
"About the patch posted on January, 6th, you can simply delete it, and empty your recycle bin . It generate DDR errors (I searched a long time in spl_mem_init to find why my DDR was not stable, but it was not a DDR configuration mistake, but a power mistake caused by my patch)."
Regards,
Fabio Estevam
PATCH 2/5 Enable booting of mx28 without battery
Hi Fabio,
Quoted 11 lines · Fabio Estevam
Quoted 2 lines · Graeme Russ
I thought the DDR errors were fixed with Damien's DDR patch. Damien, can you please confirm?
His response in the forum was:
"About the patch posted on January, 6th, you can simply delete it, and empty your recycle bin . It generate DDR errors (I searched a long time in
spl_mem_initto find why my DDR was not stable, but it was not a DDR configuration mistake, but a power mistake caused by my patch)."
Ah - I missed that - my bad.
I'll check if his newer patch works. If it does, I'll implement it instead. Best to make these kind of changes one small step at a time :)
Regards,
Graeme
A message that is not in the archive (sent off-list or not yet received): DB3PR05MB252F1D6A1521E87599A5991CB360@DB3PR05MB252.eurprd05.prod.outlook.com
PATCH 2/5 Enable booting of mx28 without battery
Hi Damien,
Quoted 5 lines · Damien GOTFROI
Hi,
I confirm, my first patch for
spl_power_init.cgenerated DDR errors.And my new (small) patch for
spl_power_init.cfixes these errors, it is not my DDR patch.
An I can confirm that your smaller patch allows me to boot the G2C1 board. I'll just implement the smaller patch - we can tackle the rest later
Thanks for your very helpful experimentation
Regards,
Graeme
Quoted 51 lines
Many thanks and best regards,
Damien Gotfroi
Electronics Engineer
GreenWatch S.A.
Avenue Lavoisier, 18A
B-1300 Wavre
Tel. + 32 (0) 10 471 367
dgotfroi at greenwatch.be
www.greenwatch.be
BCE: 0820 144 205Retrouvez l?actu des th?matiques ?nerg?tiques sur notre blog
? Please consider the environment before printing this mail note.
? Ce message ?lectronique et ses ?ventuels fichiers attach?s est(sont) destin?(s) ? l?usage exclusif de la (les) personne(s) mentionn?e(s) comme destinataire. Si vous recevez ce message ?lectronique par erreur, vous n??tes pas autoris? ? utiliser ; d?voiler ; distribuer ; imprimer ou copier tout ou partie de ce message si vous n?en ?tes pas le destinataire. GreenWatch d?cline toute responsabilit? pour tout dommage direct ou indirect li? ? l?utilisation inappropri?e ou frauduleuse de ce message ?lectronique par des personnes non autoris?es. En outre, les informations contenues dans ce message ?lectronique sont ? caract?re exclusivement informatif et GreenWatch ne saurait en garantir l?exactitude ou l? exhaustivit? .Les pr?judices occasionn?s par l?utilisation d?une information erron?e ou incompl?te n?entra?nent en aucun cas la responsabilit? de GreenWatch ?-----Original Message-----
From: Graeme Russ [mailto:gruss at tss-engineering.com]
Sent: vendredi 23 janvier 2015 05:15
To: Fabio Estevam
Cc: U-Boot-Denx; Fabio Estevam; M?rten Wikman; Damien GOTFROI; Stefano Babic; Marek Va?ut
Subject: Re: [U-Boot] [PATCH 2/5] Enable booting of mx28 without batteryHi Fabio,
Quoted 11 lines · Fabio Estevam
Quoted 2 lines · Graeme Russ
I thought the DDR errors were fixed with Damien's DDR patch. Damien, can you please confirm?
His response in the forum was:
"About the patch posted on January, 6th, you can simply delete it, and empty your recycle bin . It generate DDR errors (I searched a long time in
spl_mem_initto find why my DDR was not stable, but it was not a DDR configuration mistake, but a power mistake caused by my patch)."Ah - I missed that - my bad.
I'll check if his newer patch works. If it does, I'll implement it instead. Best to make these kind of changes one small step at a time :)
Regards,
Graeme
PATCH 2/5 Enable booting of mx28 without battery
Hi Graeme,
Quoted 7 lines · Graeme Russ
Hi Damien,
Quoted 4 lines · Damien GOTFROI
Hi,
I confirm, my first patch for
spl_power_init.cgenerated DDR errors.
Quoted 8 lines
Quoted 2 lines
And my new (small) patch for
spl_power_init.cfixes these errors, it is not my DDR patch.An I can confirm that your smaller patch allows me to boot the G2C1 board. I'll just implement the smaller patch - we can tackle the rest later
Thanks for your very helpful experimentation
Thanks all for digging on this issue !
Graeme, if patch is coming from Damien, it should have also his Signed-off-by (Damien, is it ok for you ?).
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 3/5 Add 'Wait for JTAG user' if booted in JTAG mode
In reply to Graeme RussWhen booting in JTAG mode, there is no way to use soft break-points, and no way of knowing when SPL has finished executing (so the user can issue a 'halt' command to load u-boot.bin for example)
Add a debug output and simple loop to stop execution at the completion of the SPL initialisation as a pseudo break-point when booting in JTAG mode
---
arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/cpu/arm926ejs/mxs/spl_boot.c +6 -0
@@ -157,6 +157,12 @@ void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr, data->boot_mode_idx = bootmode;mxs_power_wait_pswitch (); + + +if (mxs_boot_modes[data->boot_mode_idx].boot_pads ==0x06 ) { +debug ("SPL: Waiting for JTAG user\n" ); + asmvolatile ("x: b x" ); + } }/* Support aparatus */
Signature · 1 line
1.9.3
PATCH 3/5 Add 'Wait for JTAG user' if booted in JTAG mode
Quoted 18 lines · Graeme Russ
When booting in JTAG mode, there is no way to use soft break-points, and no way of knowing when SPL has finished executing (so the user can issue a 'halt' command to load u-boot.bin for example)
Add a debug output and simple loop to stop execution at the completion of the SPL initialisation as a pseudo break-point when booting in JTAG mode
Signed-off-by Graeme Russ <[email protected]>---
arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/arm926ejs/mxs/spl_boot.c +0
-0
arch/arm/cpu/arm926ejs/mxs/spl_boot.c void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr, · line 161
Quoted 5 lines
arch/arm/cpu/arm926ejs/mxs/spl_boot.c +2
-0@@ -157,6 +157,12 @@ void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr, data->boot_mode_idx = bootmode;mxs_power_wait_pswitch (); + +
Nitpicking, but please don't add 2 empty lines.
arch/arm/cpu/arm926ejs/mxs/spl_boot.c void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr, · line 162
Quoted 1 line
arch/arm/cpu/arm926ejs/mxs/spl_boot.c +1
-0+if (mxs_boot_modes[data->boot_mode_idx].boot_pads ==0x06 ) {
Would it be possible to add a macro here instead of using this fixed 0x06?
arch/arm/cpu/arm926ejs/mxs/spl_boot.c void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr, · line 165
Quoted 3 lines
arch/arm/cpu/arm926ejs/mxs/spl_boot.c +3
-0+debug ("SPL: Waiting for JTAG user\n" ); + asmvolatile ("x: b x" ); + }
Thanks.
Stefan
PATCH 4/5 Move PLL power-up from power init to memory init
In reply to Graeme Russmxs_power_clock2pll() does not actually switch the CPU clock to the PLL. All it does is power-up the PLL and set the CLKCTRL_CLKSEQ_BYPASS_CPU bit (which was already set by mxs_power_clock2xtal() anyway)
spl_mem_init.c sets up the fractional divisor (which is required to run the CPU from the PLL) and clears the CLKCTRL_CLKSEQ_BYPASS_CPU bit (which switches the CPU clock to the PLL)
It makes more sense to power-up the PLL in spl_mem_init.c. While moving the PLL power-up, we may as well properly configure how the PLL lock is started and confirmed
---
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 31 ++++++++++++++++++++ arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 45 ----------------------------- 2 files changed, 31 insertions(+), 45 deletions(-)
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +31 -0
@@ -340,10 +340,41 @@ static void mx28_mem_init(void) }#endif +/** +* mxs_mem_powerup_pll() - Powerup PLL0 +* +* This function turns on power to PLL0. The CPU clock will be switched to +* PLL0 after the fractional divider and SDRAM have been configured. +*/ +static void mxs_mem_powerup_pll (void ) +{ +struct mxs_clkctrl_regs *clkctrl_regs = + (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE ; + +/* Power up PLL0 */ +debug ("SPL: Powering up PLL0\n" ); +setbits_le32 (&clkctrl_regs->hw_clkctrl_pll0ctrl0, +CLKCTRL_PLL0CTRL0_POWER ); + +/* Toggle FORCE_LOCK to initiate the PLL lock procedure */ +setbits_le32 (&clkctrl_regs->hw_clkctrl_pll0ctrl1, +CLKCTRL_PLL0CTRL1_FORCE_LOCK ); + +clrbits_le32 (&clkctrl_regs->hw_clkctrl_pll0ctrl1, +CLKCTRL_PLL0CTRL1_FORCE_LOCK ); + +/* Wait until the PLL has a stable lock - takes ~50us */ +while (!(readl (&clkctrl_regs->hw_clkctrl_pll0ctrl1) & +CLKCTRL_PLL0CTRL1_LOCK )) + ; +} +void mxs_mem_init (void ) {early_delay (11000 ); +mxs_mem_powerup_pll (); +mxs_mem_init_clock ();mxs_mem_setup_vdda ();
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +0 -45
63 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH 4/5 Move PLL power-up from power init to memory init
Quoted 37 lines · Graeme Russ
mxs_power_clock2pll()does not actually switch the CPU clock to the PLL. All it does is power-up the PLL and set theCLKCTRL_CLKSEQ_BYPASS_CPUbit (which was already set bymxs_power_clock2xtal()anyway)
spl_mem_init.csets up the fractional divisor (which is required to run the CPU from the PLL) and clears theCLKCTRL_CLKSEQ_BYPASS_CPUbit (which switches the CPU clock to the PLL)It makes more sense to power-up the PLL in
spl_mem_init.c. While moving the PLL power-up, we may as well properly configure how the PLL lock is started and confirmedSigned-off-by Graeme Russ <[email protected]>---
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 31 ++++++++++++++++++++ arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 45----------------------------- 2 files changed, 31 insertions(+), 45 deletions(-)
(quoted diff) +0
-0
b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.cindex a744e5d..af4ed8c 100644arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +9
-0@@ -340,10 +340,41 @@ static void mx28_mem_init(void) }#endif +/** +* mxs_mem_powerup_pll() - Powerup PLL0 +* +* This function turns on power to PLL0. The CPU clock will be switched to +* PLL0 after the fractional divider and SDRAM have been configured. +*/ +static void mxs_mem_powerup_pll (void ) +{ + struct mxs_clkctrl_regs *clkctrl_regs =
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c static void mx28_mem_init(void) · line 361
Quoted 10 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +10
-0+ (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE ; + +/* Power up PLL0 */ +debug ("SPL: Powering up PLL0\n" ); +setbits_le32 (&clkctrl_regs->hw_clkctrl_pll0ctrl0, +CLKCTRL_PLL0CTRL0_POWER ); + +/* Toggle FORCE_LOCK to initiate the PLL lock procedure */ +setbits_le32 (&clkctrl_regs->hw_clkctrl_pll0ctrl1, +CLKCTRL_PLL0CTRL1_FORCE_LOCK );
Are you positive that this write really hits the hardware ? You might want to read the register back before issuing another write to it.
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c static void mx28_mem_init(void) · line 369
Quoted 7 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +7
-0+clrbits_le32 (&clkctrl_regs->hw_clkctrl_pll0ctrl1, +CLKCTRL_PLL0CTRL1_FORCE_LOCK ); + +/* Wait until the PLL has a stable lock - takes ~50us */ +while (!(readl (&clkctrl_regs->hw_clkctrl_pll0ctrl1) & +CLKCTRL_PLL0CTRL1_LOCK )) + ;
Use mxs_wait_mask_ here I'd say.
[...]
PATCH 5/5 Add support for ReachTech G2C1 board
In reply to Graeme Russ---
arch/arm/Kconfig | 13 ++ board/reachtech/g2c1/Kconfig | 15 ++ board/reachtech/g2c1/MAINTAINERS | 9 + board/reachtech/g2c1/Makefile | 12 ++ board/reachtech/g2c1/README | 58 +++++ board/reachtech/g2c1/g2c1.c | 79 +++++++ board/reachtech/g2c1/spl_boot.c | 452 +++++++++++++++++++++++++++++++++++++++ configs/g2c1_defconfig | 3 + include/configs/g2c1.h | 303 ++++++++++++++++++++++++++ 9 files changed, 944 insertions(+) create mode 100644 board/reachtech/g2c1/Kconfig create mode 100644 board/reachtech/g2c1/MAINTAINERS create mode 100644 board/reachtech/g2c1/Makefile create mode 100644 board/reachtech/g2c1/README create mode 100644 board/reachtech/g2c1/g2c1.c create mode 100644 board/reachtech/g2c1/spl_boot.c create mode 100644 configs/g2c1_defconfig create mode 100644 include/configs/g2c1.h
arch/arm/Kconfig +13 -0
@@ -278,6 +278,18 @@ config TARGET_XFI3 select CPU_ARM926EJS select SUPPORT_SPL +config TARGET_G2C1 + bool "Support ReachTech G2C1" + select CPU_ARM926EJS + select SUPPORT_SPL + help + This is the Reachtech G2C1 development board. It contains a + Freescale MX28 SoC, 128MB DDR2 SDRAM, 128MB SLC NAND, 1x Ethernet + port, 2x USB Host ports, 1x USB OTG port, 1x RS-232 Debug port, + 1x RS-232 User port, 2x RS485 ports, Onboard audio, LCD Touch + screen interface, SD Card slot, I2C and SPI (with 2x slave select + lines) interfaces, CAN interface, and 8 GPIO (I2C slave interface) + config TARGET_M28EVK bool "Support m28evk" select CPU_ARM926EJS
@@ -940,6 +952,7 @@ source "board/phytec/pcm051/Kconfig" source "board/ppcag/bg0900/Kconfig" source "board/pxa255_idp/Kconfig" source "board/raspberrypi/rpi/Kconfig" +source "board/reachtech/g2c1/Kconfig" source "board/ronetix/pm9261/Kconfig" source "board/ronetix/pm9263/Kconfig" source "board/ronetix/pm9g45/Kconfig"
board/reachtech/g2c1/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_G2C1 + +config SYS_BOARD + default "g2c1" + +config SYS_VENDOR + default "reachtech" + +config SYS_SOC + default "mxs" + +config SYS_CONFIG_NAME + default "g2c1" + +endif
board/reachtech/g2c1/MAINTAINERS new file +9 -0
@@ -0,0 +1,9 @@ +G2C1 BOARD +M: Graeme Russ <[email protected]> +S: Maintained +F: board/reachtech/g2c1/ +F: include/configs/mx28evk.h +F: configs/g2c1_defconfig +F: configs/g2c1_auart_console_defconfig +F: configs/g2c1_nand_defconfig +F: configs/g2c1_spi_defconfig
board/reachtech/g2c1/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifndef CONFIG_SPL_BUILD +obj-y := g2c1.o +else +obj-y := spl_boot.o +endif
board/reachtech/g2c1/README new file +58 -0
58 lines not on this page · raw message
board/reachtech/g2c1/g2c1.c new file +79 -0
79 lines not on this page · raw message
board/reachtech/g2c1/spl_boot.c new file +452 -0
452 lines not on this page · raw message
configs/g2c1_defconfig new file +3 -0
@@ -0,0 +1,3 @@ +CONFIG_SPL=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_G2C1=y
include/configs/g2c1.h new file +303 -0
303 lines not on this page · raw message
Signature · 1 line
1.9.3
Fabio Estevam
reviewerPATCH 5/5 Add support for ReachTech G2C1 board
Quoted 1 line · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>
It would be nice to have a commit log with the text you put in the help section that describes the board.
board/reachtech/g2c1/README line 6
Quoted 9 lines
board/reachtech/g2c1/README new file +6
-0@@ -0,0 +1,58 @@ +ReachTech G2C1 +================== + +Supported hardware: ReachTech G2C1 is supported in U-boot. + +Files of the MX28EVK port
You should remove the references for mx28evk.
Quoted 10 lines
board/reachtech/g2c1/README new file +10
-0+-------------------------- + +arch/arm/cpu/arm926ejs/mxs/ - The CPU support code for the Freescale i.MX28 +arch/arm/include/asm/arch-mxs/ - Header files for the Freescale i.MX28 +board/reachtech/g2c1/ - G2C1 board specific files +include/configs/g2c1.h - G2C1 configuration file + +Jumper configuration +--------------------- +
board/reachtech/g2c1/README line 26
Quoted 10 lines
board/reachtech/g2c1/README new file +10
-0+To boot G2C1 from an SD card, set the boot mode DIP switches as: + + * Boot Mode Select: 1 0 0 1 (Boot from SD card Slot 0 - U42) + * JTAG PSWITCH RESET: To the right (reset disabled) + * Battery Source: Down + * Wall 5V: Up + * VDD 5V: To the left (off) + * Hold Button: Down (off) + +To boot MX28EVK from SPI NOR flash, set the boot mode DIP switches as:
Same here.
Quoted 19 lines
board/reachtech/g2c1/README new file +19
-0+ + * Boot Mode Select: 0 0 1 0 (Boot from SSP2) + * JTAG PSWITCH RESET: To the right (reset disabled) + * Battery Source: Down + * Wall 5V: Up + * VDD 5V: To the left (off) + * Hold Button: Down (off) + +Environment Storage +------------------- + +There are three targets for mx28evk: + +"make mx28evk_config" - store environment variables into MMC + +or + +"make mx28evk_nand_config" - store environment variables into NAND flash +
board/reachtech/g2c1/README line 55
Quoted 10 lines
board/reachtech/g2c1/README new file +10
-0+or + +"make mx28evk_spi_config" - store enviroment variables into SPI NOR flash + +Choose the target accordingly. + +mx28evk does not come with SPI NOR flash populated from the factory either. +It is possible to solder a SOIC memory on U49 or use a DIP8 on J89. +To get SPI communication to work R320, R321,R322 and C178 need to be populated. +Look in the schematics for the proper component values.
And here too.
PATCH 5/5 Add support for ReachTech G2C1 board
Quoted 1 line · Fabio Estevam
On Wed, Jan 21, 2015 at 9:55 AM, Graeme Russ <[email protected]>
Quoted 4 lines · wrote:
Quoted 1 line
Signed-off-by Graeme Russ <[email protected]>It would be nice to have a commit log with the text you put in the help section that describes the board.
Also, the subject should contain proper tags (arm: mxs: blah blah ...)
Best regards,
Marek Vasut
PATCH 5/5 Add support for ReachTech G2C1 board
Quoted 9 lines · Marek Vasut
Quoted 1 line · Fabio Estevam
On Wed, Jan 21, 2015 at 9:55 AM, Graeme Russ <[email protected]>
Quoted 4 lines · wrote:
Quoted 1 line
Signed-off-by Graeme Russ <[email protected]>It would be nice to have a commit log with the text you put in the help section that describes the board.
Also, the subject should contain proper tags (arm: mxs: blah blah ...)
I know - I had them in, but patman complained :(
PATCH 5/5 Add support for ReachTech G2C1 board
In reply to Graeme RussQuoted 1 line · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>
Commit message again ;-)
[...]
Quoted 6 lines
board/reachtech/g2c1/g2c1.c new file +0
-0@@ -0,0 +1,79 @@
[...]
board/reachtech/g2c1/g2c1.c line 77
Quoted 5 lines
board/reachtech/g2c1/g2c1.c new file +5
-0+#ifdef CONFIG_CMD_MMC + +int board_mmc_init (bd_t *bis) +{ +return mxsmmc_initialize (bis,0 ,NULL /* g2c1_mmc_wp */ ,NULL );
Where's the WP function?
Quoted 17 lines
board/reachtech/g2c1/g2c1.c new file +2
-0+} +#endif (quoted diff) +0
-0
b/board/reachtech/g2c1/spl_boot.cnew file mode 100644 index 0000000..25ee0e2board/reachtech/g2c1/spl_boot.c new file +9
-0@@ -0,0 +1,452 @@ +/* +* DENX M28 Boot setup +* +* Copyright (C) 2011 Marek Vasut <[email protected]> +* on behalf of DENX Software Engineering GmbH +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +
board/reachtech/g2c1/spl_boot.c line 19
Quoted 10 lines
board/reachtech/g2c1/spl_boot.c new file +10
-0+#include <common.h> +#include <config.h> +#include <asm/io.h> +#include <asm/arch/iomux-mx28.h> +#include <asm/arch/imx-regs.h> +#include <asm/arch/sys_proto.h> + +/* +* Bank. SoC +* Pin Pin Function Comments
All this stuff should be in some README instead .
[...]
board/reachtech/g2c1/spl_boot.c line 28
Quoted 9 lines
board/reachtech/g2c1/spl_boot.c new file +9
-0+#define CONFIG_EXTRA_ENV_SETTINGS \ + "consdev=ttyAMA0\0" \ + "baudrate=115200\0" \ + "bootscript=boot.scr\0" \ + "bootdev=/dev/mmcblk0p2\0" \ + "rootdev=/dev/mmcblk0p3\0" \ + "netdev=eth0\0" \ + "hostname=g2c1\0" \ + "rootpath=/opt/eldk-5.5/armv5te/rootfs-qte-sdk\0" \
Remove this rootpath var from here.
Thanks!