[U-Boot] [RESEND PATCH] ARM: davici_emac: Fix condition for number of phy detects

2011-11-17 Thread prabhakar . csengg
From: Prabhakar Lad 

Fix the condition for number of phys in
davinci_eth_phy_detect() function.
CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT indicates number of
phys. From this commit id dc02badab480563b0bf9d3908046ea9d6b22ae63
davinci emac initilazed one less than the number of phy count.

Signed-off-by: Prabhakar Lad 
---
 drivers/net/davinci_emac.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 36c33af..34b6f94 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -176,7 +176,7 @@ static int davinci_eth_phy_detect(void)
for (i = 0, j = 0; i < 32; i++)
if (phy_act_state & (1 << i)) {
count++;
-   if (count < CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT) {
+   if (count <= CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT) {
active_phy_addr[j++] = i;
} else {
printf("%s: to many PHYs detected.\n",
-- 
1.7.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ARM: davici_emac: Fix condition for number of phy detects

2011-11-17 Thread prabhakar . csengg
From: Prabhakar Lad 

Fix the condition for number of phys in
davinci_eth_phy_detect() function.
CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT indicates number of
phys. From this commit id dc02badab480563b0bf9d3908046ea9d6b22ae63
davinci emac initilazed one less than the number of phy count.

Signed-off-by: Prabhakar Lad 
---
 drivers/net/davinci_emac.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 36c33af..34b6f94 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -176,7 +176,7 @@ static int davinci_eth_phy_detect(void)
for (i = 0, j = 0; i < 32; i++)
if (phy_act_state & (1 << i)) {
count++;
-   if (count < CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT) {
+   if (count <= CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT) {
active_phy_addr[j++] = i;
} else {
printf("%s: to many PHYs detected.\n",
-- 
1.7.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] da8xxevm: fix build error

2011-11-07 Thread prabhakar . csengg
From: Prabhakar Lad 

This patch fixes following compile error for da8xx evm

da830evm.c: In function 'board_init':
da830evm.c:222: error: 'DAVINCI_SYSCFG_SUSPSRC_UART2' undeclared (first use in 
this function)
da830evm.c:222: error: (Each undeclared identifier is reported only once
da830evm.c:222: error: for each function it appears in.)
make[2]: *** [da830evm.o] Error 1

similarly for da850evm.

introduced through commit:
f9fc237f1f07d4e5ff7c9c2da39cabc8d3d7b339

Signed-off-by: Prabhakar Lad 
---
 arch/arm/include/asm/arch-davinci/hardware.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/hardware.h 
b/arch/arm/include/asm/arch-davinci/hardware.h
index bea1499..ee8fd43 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -468,6 +468,7 @@ struct davinci_syscfg_regs {
 #define DAVINCI_SYSCFG_SUSPSRC_SPI0(1 << 21)
 #define DAVINCI_SYSCFG_SUSPSRC_SPI1(1 << 22)
 #define DAVINCI_SYSCFG_SUSPSRC_UART0   (1 << 18)
+#define DAVINCI_SYSCFG_SUSPSRC_UART2   (1 << 20)
 #define DAVINCI_SYSCFG_SUSPSRC_TIMER0  (1 << 27)
 
 struct davinci_syscfg1_regs {
-- 
1.7.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RESEND PATCH] mpc86xx: implement clocks command

2011-10-10 Thread prabhakar . csengg
From: Prabhakar Lad 

print the clock information while booting causes additional
delay. Implemented the clocks command for printing the CPU,
MPX, DDR and LBC frequency info.

Signed-off-by: Prabhakar Lad 
---
 arch/powerpc/cpu/mpc86xx/cpu.c |   50 ++-
 1 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index ffcc8e6..32f9932 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -46,7 +46,6 @@ void board_reset(void) __attribute__((weak, 
alias("__board_reset")));
 int
 checkcpu(void)
 {
-   sys_info_t sysinfo;
uint pvr, svr;
uint ver;
uint major, minor;
@@ -88,22 +87,6 @@ checkcpu(void)
 
printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
 
-   get_sys_info(&sysinfo);
-
-   puts("Clock Configuration:\n");
-   printf("   CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freqProcessor));
-   printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freqSystemBus));
-   printf("   DDR:%-4s MHz (%s MT/s data rate), ",
-   strmhz(buf1, sysinfo.freqSystemBus / 2),
-   strmhz(buf2, sysinfo.freqSystemBus));
-
-   if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
-   printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
-   } else {
-   printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
-  sysinfo.freqLocalBus);
-   }
-
puts("L1:D-cache 32 KB enabled\n");
puts("   I-cache 32 KB enabled\n");
 
@@ -219,3 +202,36 @@ void setup_ddr_bat(phys_addr_t dram_size)
write_bat(DBAT0, batu, CONFIG_SYS_DBAT0L);
write_bat(IBAT0, batu, CONFIG_SYS_IBAT0L);
 }
+
+/*
+ * Dump some core clocks.
+ */
+int mpc8xx_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
+{
+   sys_info_t sysinfo;
+
+   get_sys_info(&sysinfo);
+
+   printf("   CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freqProcessor));
+   printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freqSystemBus));
+   printf("   DDR:%-4s MHz (%s MT/s data rate), ",
+   strmhz(buf1, sysinfo.freqSystemBus / 2),
+   strmhz(buf2, sysinfo.freqSystemBus));
+
+   if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
+   printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
+   } else {
+   printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
+  sysinfo.freqLocalBus);
+   }
+
+   return 0;
+}
+
+/***/
+
+U_BOOT_CMD(
+   clocks, CONFIG_SYS_MAXARGS, 1, mpc8xx_showclocks,
+   "Clock Configuration",
+   "  clocks"
+);
-- 
1.7.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] squash build warning in cmd_sf.c

2011-10-04 Thread prabhakar . csengg
From: Prabhakar Lad 

Fix build warning and returning early in case of failure

cmd_sf.c: In function 'do_spi_flash':
cmd_sf.c:164: warning: 'skipped' may be used uninitialized in this function
cmd_sf.c:164: note: 'skipped' was declared here

Signed-off-by: Prabhakar Lad 
---
 common/cmd_sf.c |   20 +---
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index c8c547a..bdf7915 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -164,21 +164,19 @@ static int spi_flash_update(struct spi_flash *flash, u32 
offset,
size_t skipped; /* statistics */
 
cmp_buf = malloc(flash->sector_size);
-   if (cmp_buf) {
-   for (skipped = 0; buf < end && !err_oper;
-   buf += todo, offset += todo) {
-   todo = min(end - buf, flash->sector_size);
-   err_oper = spi_flash_update_block(flash, offset, todo,
-   buf, cmp_buf, &skipped);
-   }
-   } else {
+   if (!cmp_buf) {
err_oper = "malloc";
-   }
-   free(cmp_buf);
-   if (err_oper) {
printf("SPI flash failed in %s step\n", err_oper);
return 1;
}
+
+   for (skipped = 0; buf < end && !err_oper;
+   buf += todo, offset += todo) {
+   todo = min(end - buf, flash->sector_size);
+   err_oper = spi_flash_update_block(flash, offset, todo,
+   buf, cmp_buf, &skipped);
+   }
+   free(cmp_buf);
printf("%zu bytes written, %zu bytes skipped\n", len - skipped,
   skipped);
return 0;
-- 
1.7.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot