ppc4xx: Update DLVision 10G support
cover ppc4xx: Update DLVision 10G support
Dirk Eibach (8):
ppc4xx: Improve DLVision-10G PLL setup
ppc4xx: Improve video board detection
hwmon: Extend lm63.c to support LM64
ppc4xx: Adapt DLVision 10G to new FPGA firmware
ppc4xx: Set DLVision 10G osd position to linux defaults
ppc4xx: Enable MPC92469AC on DLVision 10G
ppc4xx: Improve fan PWM curve on DLVision 10G
ppc4xx: Do not stop booting on any keypress on dlvision-10g
board/gdsys/405ep/405ep.c | 9 +++++- board/gdsys/405ep/dlvision-10g.c | 41 ++++++++++++++++++++++----- board/gdsys/common/osd.c | 57 ++++++++++++++++++++++++++++++++++++-- drivers/hwmon/lm63.c | 28 ++++++++++++++++-- include/configs/dlvision-10g.h | 12 ++++++- include/gdsys_fpga.h | 13 +++++--- 6 files changed, 137 insertions(+), 23 deletions(-)
PATCH 1/8 ppc4xx: Improve DLVision-10G PLL setup
--- board/gdsys/common/osd.c | 55 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 52 insertions(+), 3 deletions(-)
board/gdsys/common/osd.c +52 -3
@@ -30,7 +30,12 @@#define CH7301_I2C_ADDR 0x75#define ICS8N3QV01_I2C_ADDR 0x6E -#define ICS8N3QV01_FREF 114285 +#define ICS8N3QV01_FREF 114285000 +#define ICS8N3QV01_FREF_LL 114285000LL +#define ICS8N3QV01_F_DEFAULT_0 156250000LL +#define ICS8N3QV01_F_DEFAULT_1 125000000LL +#define ICS8N3QV01_F_DEFAULT_2 100000000LL +#define ICS8N3QV01_F_DEFAULT_3 25175000LL#define SIL1178_MASTER_I2C_ADDRESS 0x38#define SIL1178_SLAVE_I2C_ADDRESS 0x39
@@ -150,6 +155,41 @@ static void mpc92469ac_set(unsigned screen, unsigned int fout)#endif #ifdef CONFIG_SYS_ICS8N3QV01 + +static unsigned int ics8n3qv01_get_fout_calc (unsigned screen,unsigned index) +{ +unsigned long long n; +unsigned long long mint; +unsigned long long mfrac; +u8 reg_a, reg_b, reg_c, reg_d, reg_f; +unsigned long long fout_calc; + +if (index >3 ) +return 0 ; + + reg_a =fpga_iic_read (screen,ICS8N3QV01_I2C_ADDR ,0 + index); + reg_b =fpga_iic_read (screen,ICS8N3QV01_I2C_ADDR ,4 + index); + reg_c =fpga_iic_read (screen,ICS8N3QV01_I2C_ADDR ,8 + index); + reg_d =fpga_iic_read (screen,ICS8N3QV01_I2C_ADDR ,12 + index); + reg_f =fpga_iic_read (screen,ICS8N3QV01_I2C_ADDR ,20 + index); + + mint = ((reg_a >>1 ) &0x1f ) | (reg_f &0x20 ); + mfrac = ((reg_a &0x01 ) <<17 ) | (reg_b <<9 ) | (reg_c <<1 ) + | (reg_d >>7 ); + n = reg_d &0x7f ; + + fout_calc = (mint *ICS8N3QV01_FREF_LL + + mfrac *ICS8N3QV01_FREF_LL /262144LL + +ICS8N3QV01_FREF_LL /524288LL + + n /2 ) + / n + *1000000 + / (1000000 -100 ); + +return fout_calc; +} + +static void ics8n3qv01_calc_parameters (unsigned int fout,unsigned int *_mint,unsigned int *_mfrac,unsigned int *_n)
@@ -160,7 +200,7 @@ static void ics8n3qv01_calc_parameters(unsigned int fout,unsigned int mint;unsigned long long mfrac; - n =2550000000U / fout; + n = (2215000000U + fout /2 ) / fout;if ((n &1 ) && (n >5 )) n -=1 ;
@@ -184,9 +224,18 @@ static void ics8n3qv01_set(unsigned screen, unsigned int fout)unsigned int n;unsigned int mint;unsigned int mfrac; +unsigned int fout_calc; +unsigned long long fout_prog; +long long off_ppm;u8 reg0, reg4, reg8, reg12, reg18, reg20; -ics8n3qv01_calc_parameters (fout, &mint, &mfrac, &n); + fout_calc =ics8n3qv01_get_fout_calc (screen,1 ); + off_ppm = (fout_calc -ICS8N3QV01_F_DEFAULT_1 ) *1000000 + /ICS8N3QV01_F_DEFAULT_1 ; +printf (" PLL is off by %lld ppm\n" , off_ppm); + fout_prog = (unsigned long long )fout * (unsigned long long )fout_calc + /ICS8N3QV01_F_DEFAULT_1 ; +ics8n3qv01_calc_parameters (fout_prog, &mint, &mfrac, &n); reg0 =fpga_iic_read (screen,ICS8N3QV01_I2C_ADDR ,0 ) &0xc0 ; reg0 |= (mint &0x1f ) <<1 ;
Signature · 1 line
1.5.6.5
PATCH 2/8 ppc4xx: Improve video board detection
--- board/gdsys/405ep/dlvision-10g.c | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-)
board/gdsys/405ep/dlvision-10g.c +18 -8
@@ -31,6 +31,9 @@#include "../common/osd.h" +#define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200) +#define LATCH2_MC2_PRESENT_N 0x0080 +enum {UNITTYPE_VIDEO_USER =0 ,UNITTYPE_MAIN_USER =1 ,
@@ -206,8 +209,8 @@ static void print_fpga_info(unsigned dev)*/ int checkboard (void ) { -unsigned k;char *s =getenv ("serial#" ); +u16 latch2 =in_le16 ((void *)LATCH2_BASE );printf ("Board: " );
@@ -220,20 +223,27 @@ int checkboard(void)puts ("\n" ); -for (k =0 ; k <CONFIG_SYS_FPGA_COUNT ; ++k) -print_fpga_info (k); +print_fpga_info (0 ); +if (!(latch2 &LATCH2_MC2_PRESENT_N )) +print_fpga_info (1 );return 0 ; }int last_stage_init (void ) { -unsigned k; +ihs_fpga_t *fpga = (ihs_fpga_t *)CONFIG_SYS_FPGA_BASE (0 ); +u16 versions =in_le16 (&fpga->versions); +u16 latch2 =in_le16 ((void *)LATCH2_BASE ); + +if (((versions >>4 ) &0x000f ) !=UNITTYPE_MAIN_USER ) +return 0 ; + +if (!get_fpga_state (0 )) +osd_probe (0 ); -for (k =0 ; k <CONFIG_SYS_OSD_SCREENS ; ++k) -if (!get_fpga_state (k) - || (get_fpga_state (k) ==FPGA_STATE_DONE_FAILED )) -osd_probe (k); +if (!(latch2 &LATCH2_MC2_PRESENT_N ) && !get_fpga_state (1 )) +osd_probe (1 );return 0 ; }
Signature · 1 line
1.5.6.5
PATCH 3/8 hwmon: Extend lm63.c to support LM64
This patch adds support for the National LM64 temperature sensor with integrated fan control to lm63.c. It's used on the GDSys DLVision-10G board (405EP).
Main difference between LM63 and LM64 is 16?C offset in sensor readings.
--- drivers/hwmon/lm63.c | 28 ++++++++++++++++++++++++---- include/configs/dlvision-10g.h | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/hwmon/lm63.c +24 -4
@@ -23,14 +23,15 @@*/ /* -* National LM63 Temperature Sensor +* National LM63/LM64 Temperature Sensor +* Main difference: LM 64 has -16 Kelvin temperature offset */ #include <common.h> #include <i2c.h> #include <dtt.h> -#define DTT_I2C_DEV_CODE 0x4C/* National LM63 device */ +#define DTT_I2C_LM63_ADDR 0x4C/* National LM63 device */ #define DTT_READ_TEMP_RMT_MSB 0x01#define DTT_CONFIG 0x03
@@ -58,7 +59,8 @@ int dtt_read(int sensor, int reg)/* * Calculate sensor address and register. */ - sensor =DTT_I2C_DEV_CODE ;/* address of lm63 is not adjustable */ +if (!sensor) + sensor =DTT_I2C_LM63_ADDR ;/* legacy config */ dlen =1 ;
@@ -79,7 +81,8 @@ int dtt_write(int sensor, int reg, int val)/* * Calculate sensor address and register. */ - sensor =DTT_I2C_DEV_CODE ;/* address of lm63 is not adjustable */ +if (!sensor) + sensor =DTT_I2C_LM63_ADDR ;/* legacy config */ dlen =1 ; data[0 ] = (char )(val &0xff );
@@ -93,6 +96,11 @@ int dtt_write(int sensor, int reg, int val)return 0 ; }/* dtt_write() */ +static int is_lm64 (int sensor) +{ +return sensor && (sensor !=DTT_I2C_LM63_ADDR ); +} +static int _dtt_init (int sensor) {int i;
@@ -117,14 +125,23 @@ static int _dtt_init(int sensor)return 1 ;/* +* Make sure PWM Lookup-Table is writeable +*/ +if (dtt_write (sensor,DTT_FAN_CONFIG ,0x20 ) !=0 ) +return 1 ; + +/* * Setup PWM Lookup-Table */ for (i =0 ; i <sizeof (pwm_lookup) /sizeof (struct pwm_lookup_entry ); i++) {int address =DTT_PWM_LOOKUP_BASE +2 * i; val = pwm_lookup[i].temp; +if (is_lm64 (sensor)) + val -=16 ;if (dtt_write (sensor, address, val) !=0 )return 1 ; + val =dtt_read (sensor, address); val = pwm_lookup[i].pwm;if (dtt_write (sensor, address +1 , val) !=0 )return 1 ;
@@ -152,6 +169,9 @@ int dtt_get_temp(int sensor)s16 temp = (dtt_read (sensor,DTT_READ_TEMP_RMT_MSB ) <<8 ) | (dtt_read (sensor,DTT_READ_TEMP_RMT_LSB )); +if (is_lm64 (sensor)) + temp +=16 <<8 ; +/* Ignore LSB for now, U-Boot only prints natural numbers */ return temp >>8 ; }
include/configs/dlvision-10g.h +1 -1
@@ -111,7 +111,7 @@/* Temp sensor/hwmon/dtt */ #define CONFIG_DTT_LM63 1/* National LM63 */ -#define CONFIG_DTT_SENSORS { 0 }/* Sensor addresses */ +#define CONFIG_DTT_SENSORS { 0x4c, 0x4e }/* Sensor addresses */ #define CONFIG_DTT_PWM_LOOKUPTABLE \ { { 40, 10 }, { 50, 20 }, { 60, 40 } }#define CONFIG_DTT_TACH_LIMIT 0xa10
Signature · 1 line
1.5.6.5
PATCH 4/8 ppc4xx: Adapt DLVision 10G to new FPGA firmware
--- board/gdsys/405ep/405ep.c | 9 ++++++++- board/gdsys/405ep/dlvision-10g.c | 25 ++++++++++++++++++++----- include/configs/dlvision-10g.h | 2 ++ include/gdsys_fpga.h | 8 +++----- 4 files changed, 33 insertions(+), 11 deletions(-)
board/gdsys/405ep/405ep.c +8 -1
@@ -110,6 +110,11 @@ int board_early_init_f(void)for (k =0 ; k <CONFIG_SYS_FPGA_COUNT ; ++k) {ihs_fpga_t *fpga = (ihs_fpga_t *)CONFIG_SYS_FPGA_BASE (k); +#ifdef CONFIG_SYS_FPGA_NO_RFL_HI +u16 *reflection_target = &fpga->reflection_low; +#else +u16 *reflection_target = &fpga->reflection_high; +#endif /* * wait for fpga out of reset */
@@ -117,9 +122,11 @@ int board_early_init_f(void)while (1 ) {out_le16 (&fpga->reflection_low,REFLECTION_TESTPATTERN ); -if (in_le16 (&fpga->reflection_high) == + +if (in_le16 (reflection_target) ==REFLECTION_TESTPATTERN_INV )break ; +udelay (100000 );if (ctr++ >5 ) { gd->fpga_state[k] |=
board/gdsys/405ep/dlvision-10g.c +20 -5
@@ -34,6 +34,8 @@#define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200)#define LATCH2_MC2_PRESENT_N 0x0080 +#define LATCH3_BASE (CONFIG_SYS_LATCH_BASE + 0x300) +enum {UNITTYPE_VIDEO_USER =0 ,UNITTYPE_MAIN_USER =1 ,
@@ -63,6 +65,20 @@ enum { RAM_DDR2_64 = 2, }; +static unsigned int get_hwver (void ) +{ +u16 latch3 =in_le16 ((void *)LATCH3_BASE ); + +return latch3 &0x0003 ; +} + +static unsigned int get_mc2_present (void ) +{ +u16 latch2 =in_le16 ((void *)LATCH2_BASE ); + +return !(latch2 &LATCH2_MC2_PRESENT_N ); +} +static void print_fpga_info (unsigned dev) {ihs_fpga_t *fpga = (ihs_fpga_t *)CONFIG_SYS_FPGA_BASE (dev);
@@ -210,7 +226,6 @@ static void print_fpga_info(unsigned dev)int checkboard (void ) {char *s =getenv ("serial#" ); -u16 latch2 =in_le16 ((void *)LATCH2_BASE );printf ("Board: " );
@@ -224,7 +239,7 @@ int checkboard(void)puts ("\n" );print_fpga_info (0 ); -if (!(latch2 &LATCH2_MC2_PRESENT_N )) +if (get_mc2_present ())print_fpga_info (1 );return 0 ;
@@ -234,15 +249,15 @@ int last_stage_init(void) {ihs_fpga_t *fpga = (ihs_fpga_t *)CONFIG_SYS_FPGA_BASE (0 );u16 versions =in_le16 (&fpga->versions); -u16 latch2 =in_le16 ((void *)LATCH2_BASE );if (((versions >>4 ) &0x000f ) !=UNITTYPE_MAIN_USER )return 0 ; -if (!get_fpga_state (0 )) +if (!get_fpga_state (0 ) || (get_hwver () ==HWVER_101 ))osd_probe (0 ); -if (!(latch2 &LATCH2_MC2_PRESENT_N ) && !get_fpga_state (1 )) +if (get_mc2_present () && + (!get_fpga_state (1 ) || (get_hwver () ==HWVER_101 )))osd_probe (1 );return 0 ;
include/configs/dlvision-10g.h +2 -0
@@ -136,6 +136,8 @@#define CONFIG_SYS_LATCH1_RESET 0xffcf#define CONFIG_SYS_LATCH1_BOOT 0xffff +#define CONFIG_SYS_FPGA_NO_RFL_HI +/* * FLASH organization */
include/gdsys_fpga.h +3 -5
@@ -94,13 +94,11 @@ typedef struct ihs_fpga {u16 extended_interrupt;/* 0x001c */ u16 reserved_1[9 ];/* 0x001e */ ihs_i2c_t i2c;/* 0x0030 */ -u16 reserved_2[35 ];/* 0x0038 */ -u16 reflection_high;/* 0x007e */ -u16 reserved_3[15 ];/* 0x0080 */ +u16 reserved_2[51 ];/* 0x0038 */ u16 videocontrol;/* 0x009e */ -u16 reserved_4[176 ];/* 0x00a0 */ +u16 reserved_3[176 ];/* 0x00a0 */ ihs_osd_t osd;/* 0x0200 */ -u16 reserved_5[764 ];/* 0x0208 */ +u16 reserved_4[764 ];/* 0x0208 */ u16 videomem; /* 0x0800 */ } ihs_fpga_t;#endif
Signature · 1 line
1.5.6.5
PATCH 5/8 ppc4xx: Set DLVision 10G osd position to linux defaults
--- board/gdsys/common/osd.c | 2 ++ include/gdsys_fpga.h | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
board/gdsys/common/osd.c +2 -0
@@ -376,6 +376,8 @@ int osd_probe(unsigned screen)out_le16 (&osd->control,0x0049 );out_le16 (&osd->xy_size, ((32 -1 ) <<8 ) | (16 -1 )); +out_le16 (&osd->x_pos,0x007f ); +out_le16 (&osd->y_pos,0x005f );return 0 ; }
include/gdsys_fpga.h +5 -2
@@ -50,6 +50,9 @@ typedef struct ihs_osd {u16 features;u16 control;u16 xy_size; +u16 xy_scale; +u16 x_pos; +u16 y_pos; } ihs_osd_t;#ifdef CONFIG_IO
@@ -79,7 +82,7 @@ typedef struct ihs_fpga {u16 reserved_2[93 ];/* 0x0044 */ u16 reflection_high;/* 0x00fe */ ihs_osd_t osd;/* 0x0100 */ -u16 reserved_3[892 ];/* 0x0108 */ +u16 reserved_3[88 ];/* 0x010e */ u16 videomem; /* 0x0800 */ } ihs_fpga_t;#endif
@@ -98,7 +101,7 @@ typedef struct ihs_fpga {u16 videocontrol;/* 0x009e */ u16 reserved_3[176 ];/* 0x00a0 */ ihs_osd_t osd;/* 0x0200 */ -u16 reserved_4[764 ];/* 0x0208 */ +u16 reserved_4[761 ];/* 0x020e */ u16 videomem; /* 0x0800 */ } ihs_fpga_t;#endif
Signature · 1 line
1.5.6.5
PATCH 6/8 ppc4xx: Enable MPC92469AC on DLVision 10G
--- include/configs/dlvision-10g.h | 1 + include/gdsys_fpga.h | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-)
include/configs/dlvision-10g.h +1 -0
@@ -312,6 +312,7 @@* OSD Setup */ #define CONFIG_SYS_ICS8N3QV01 +#define CONFIG_SYS_MPC92469AC #define CONFIG_SYS_SIL1178 #define CONFIG_SYS_OSD_SCREENS CONFIG_SYS_FPGA_COUNT
include/gdsys_fpga.h +5 -3
@@ -97,11 +97,13 @@ typedef struct ihs_fpga {u16 extended_interrupt;/* 0x001c */ u16 reserved_1[9 ];/* 0x001e */ ihs_i2c_t i2c;/* 0x0030 */ -u16 reserved_2[51 ];/* 0x0038 */ +u16 reserved_2[16 ];/* 0x0038 */ +u16 mpc3w_control;/* 0x0058 */ +u16 reserved_3[34 ];/* 0x005a */ u16 videocontrol;/* 0x009e */ -u16 reserved_3[176 ];/* 0x00a0 */ +u16 reserved_4[176 ];/* 0x00a0 */ ihs_osd_t osd;/* 0x0200 */ -u16 reserved_4[761 ];/* 0x020e */ +u16 reserved_5[761 ];/* 0x020e */ u16 videomem; /* 0x0800 */ } ihs_fpga_t;#endif
Signature · 1 line
1.5.6.5
PATCH 7/8 ppc4xx: Improve fan PWM curve on DLVision 10G
--- include/configs/dlvision-10g.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
include/configs/dlvision-10g.h +2 -1
@@ -113,7 +113,8 @@#define CONFIG_DTT_LM63 1/* National LM63 */ #define CONFIG_DTT_SENSORS { 0x4c, 0x4e }/* Sensor addresses */ #define CONFIG_DTT_PWM_LOOKUPTABLE \ - { { 40, 10 }, { 50, 20 }, { 60, 40 } } + { { 40, 10 }, { 43, 13 }, { 46, 16 }, \ + { 50, 20 }, { 53, 27 }, { 56, 34 }, { 60, 40 } }#define CONFIG_DTT_TACH_LIMIT 0xa10/* EBC peripherals */
Signature · 1 line
1.5.6.5
PATCH 8/8 ppc4xx: Do not stop booting on any keypress on dlvision-10g
Use CONFIG_AUTOBOOT_KEYED on dlvision-10g so that booting can only be stopped with well defined keypresses.
--- include/configs/dlvision-10g.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/configs/dlvision-10g.h +4 -0
@@ -42,6 +42,10 @@#define CONFIG_SYS_CLK_FREQ 33333333/* external frequency to pll */ +#undef CONFIG_ZERO_BOOTDELAY_CHECK/* ignore keypress on bootdelay==0 */ +#define CONFIG_AUTOBOOT_KEYED /* use key strings to stop autoboot */ +#define CONFIG_AUTOBOOT_STOP_STR " " +/* * Configure PLL */
Signature · 1 line
1.5.6.5
PATCH 3/8 hwmon: Extend lm63.c to support LM64
In reply to Dirk EibachHi Dirk,
Quoted 4 lines · On Wednesday 06 April 2011 13:53:45 Dirk Eibach wrote:
This patch adds support for the National LM64 temperature sensor with integrated fan control to
lm63.c. It's used on the GDSys DLVision-10G board (405EP).
Quoted 8 lines
Main difference between LM63 and LM64 is 16?C offset in sensor readings.
Signed-off-by Dirk Eibach <[email protected]>--- drivers/hwmon/lm63.c | 28 ++++++++++++++++++++++++---- include/configs/dlvision-10g.h | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-)
Please split this patch, one patch to extend the lm63 driver and one to add its support to your board config header. This way I can apply the ppc4xx specific patches without the hwmon change.
And while at it, I suggest to remove the hwmon change from this patchset and send it as a separate patch.
Thanks.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
PATCH v2 3/8 ppc4xx: Enable LM64 on DLVision 10G
---
Changes since v1:
- original Subject was "hwmon: Extend lm63.c to support LM64"
- separated LM64 implementation from this patch series
include/configs/dlvision-10g.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/dlvision-10g.h +1 -1
@@ -111,7 +111,7 @@/* Temp sensor/hwmon/dtt */ #define CONFIG_DTT_LM63 1/* National LM63 */ -#define CONFIG_DTT_SENSORS { 0 }/* Sensor addresses */ +#define CONFIG_DTT_SENSORS { 0x4c, 0x4e }/* Sensor addresses */ #define CONFIG_DTT_PWM_LOOKUPTABLE \ { { 40, 10 }, { 50, 20 }, { 60, 40 } }#define CONFIG_DTT_TACH_LIMIT 0xa10
Signature · 1 line
1.5.6.5
cover ppc4xx: Update DLVision 10G support
In reply to Dirk EibachQuoted 9 lines · On Wednesday 06 April 2011 13:53:42 Dirk Eibach wrote:
Dirk Eibach (8):
ppc4xx: Improve DLVision-10G PLL setup
ppc4xx: Improve video board detection
hwmon: Extendlm63.cto support LM64
ppc4xx: Adapt DLVision 10G to new FPGA firmware
ppc4xx: Set DLVision 10G osd position to linux defaults
ppc4xx: Enable MPC92469AC on DLVision 10G
ppc4xx: Improve fan PWM curve on DLVision 10G
ppc4xx: Do not stop booting on any keypress on dlvision-10g
Applied whole patch series with the exception of patch 3 "hwmon: Extend lm63.c to support LM64". Here the 2nd ppc4xx specific version has been applied:
"ppc4xx: Enable LM64 on DLVision 10G".
Thanks.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de