powerpc/c29xpcie: reverse CPLD register bit
PATCH 1/1 powerpc/c29xpcie: reverse CPLD register bit
The CPLD registers MSB is powerpc's LSB, and LSB is powerpc's MSB. It is not convinient for understand. Reverse the value when read write to the CPLD registers.
Signed-off-by Po Liu <[email protected]>
---
This patch after
http://patchwork.ozlabs.org/patch/278079/
[U-Boot,v2] powerpc/c29xpcie: add DDR ECC on off config setting
board/freescale/c29xpcie/c29xpcie.c | 3 +- board/freescale/c29xpcie/cpld.c | 94 +++++++++++++++++++++++++------------ board/freescale/c29xpcie/cpld.h | 21 +++++++-- board/freescale/c29xpcie/ddr.c | 4 +- 4 files changed, 83 insertions(+), 39 deletions(-)
board/freescale/c29xpcie/c29xpcie.c +1 -2
@@ -28,10 +28,9 @@ DECLARE_GLOBAL_DATA_PTR;int checkboard (void ) {struct cpu_type *cpu = gd->arch.cpu; -struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE );printf ("Board: %sPCIe, " , cpu->name); -printf ("CPLD Ver: 0x%02x\n" ,in_8 (&cpld_data->cpldver)); +printf ("CPLD Ver: %x.%x\n" ,CPLD_READ (hwver),CPLD_READ (cpldver));return 0 ; }
board/freescale/c29xpcie/cpld.c +65 -29
131 lines not on this page · raw message
board/freescale/c29xpcie/cpld.h +16 -5
@@ -32,9 +32,20 @@ struct cpld_data {u8 bootcfg4;/* 0x1b - Boot configure 4 Register */ }; -#define CPLD_BANKSEL_EN 0x02 -#define CPLD_BANKSEL_MASK 0x3f -#define CPLD_SELECT_BANK1 0xc0 -#define CPLD_SELECT_BANK2 0x80 -#define CPLD_SELECT_BANK3 0x40 +/* Pointer to the CPLD register set */ +#define cpld ((struct cpld_data *)CONFIG_SYS_CPLD_BASE) + +u8 cpld_read (unsigned int reg); +void cpld_write (unsigned int reg,u8 value); + +#define CPLD_BANKSEL_EN 0x40 +#define CPLD_BANKSEL_MASK 0xfc +#define CPLD_SELECT_BANK1 0x03 +#define CPLD_SELECT_BANK2 0x01 +#define CPLD_SELECT_BANK3 0x02#define CPLD_SELECT_BANK4 0x00 +#define C29XPCIE_HARDWARE_REVA 0x02 + +#define CPLD_READ (reg) cpld_read(offsetof(struct cpld_data, reg)) +#define CPLD_WRITE (reg, value) cpld_write(offsetof(struct cpld_data, reg), \ + value)
board/freescale/c29xpcie/ddr.c +1 -3
@@ -11,7 +11,6 @@#include "cpld.h" -#define C29XPCIE_HARDWARE_REVA 0x40/* * Micron MT41J128M16HA-15E * */
@@ -64,7 +63,6 @@ void fsl_ddr_board_options(memctl_options_t *popts,dimm_params_t *pdimm, unsigned int ctrl_num) { -struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE ); int i; popts->clk_adjust =2 ;
@@ -84,7 +82,7 @@ void fsl_ddr_board_options(memctl_options_t *popts, popts->trwt_override =1 ; popts->trwt =0 ; -if (in_8 (&cpld_data->hwver) ==C29XPCIE_HARDWARE_REVA ) +if (CPLD_READ (hwver) ==C29XPCIE_HARDWARE_REVA ) popts->ecc_mode =0 ;for (i =0 ; i <CONFIG_CHIP_SELECTS_PER_CTRL ; i++) {
Signature · 1 line
1.8.0