[U-Boot] [POWERPC] mgcoge, mgsuvd: cleanups
Heiko Schocher
hs at denx.de
Fri Oct 17 11:05:32 CEST 2008
mgcoge: Second Flash on CS5
use in_*/out_* accessors
mgsuvd: fix Codingstyle issues
use in_*/out_* accessors
Signed-off-by: Heiko Schocher <hs at denx.de>
---
This Patch replaces the Patches:
http://lists.denx.de/pipermail/u-boot/2008-October/041881.html
[U-Boot] [POWERPC] mgcoge: correct init of the UPIOx
http://lists.denx.de/pipermail/u-boot/2008-October/041892.html
[U-Boot] [POWERPC] mgcoge: Second Flash on CS5 not on CS1
board/keymile/mgcoge/mgcoge.c | 9 +++--
board/keymile/mgsuvd/mgsuvd.c | 73 ++++++++++++++++++----------------------
2 files changed, 39 insertions(+), 43 deletions(-)
diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c
index 7d4d9e6..9c6039d 100644
--- a/board/keymile/mgcoge/mgcoge.c
+++ b/board/keymile/mgcoge/mgcoge.c
@@ -25,6 +25,7 @@
#include <mpc8260.h>
#include <ioports.h>
#include <malloc.h>
+#include <asm/io.h>
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
@@ -295,8 +296,10 @@ int checkboard(void)
int board_early_init_r (void)
{
/* setup the UPIOx */
- *(char *)(CONFIG_SYS_PIGGY_BASE + 0x02) = 0xc0;
- *(char *)(CONFIG_SYS_PIGGY_BASE + 0x03) = 0x15;
+ out_8((volatile unsigned char __iomem *)
+ (CONFIG_SYS_PIGGY_BASE + 0x02), 0xc0);
+ out_8((volatile unsigned char __iomem *)
+ (CONFIG_SYS_PIGGY_BASE + 0x03), 0x15);
return 0;
}
@@ -334,7 +337,7 @@ void ft_blob_update (void *blob, bd_t *bd)
/* update Flash addr, size */
flash_data[2] = cpu_to_be32 (CONFIG_SYS_FLASH_BASE);
flash_data[3] = cpu_to_be32 (CONFIG_SYS_FLASH_SIZE);
- flash_data[4] = cpu_to_be32 (1);
+ flash_data[4] = cpu_to_be32 (5);
flash_data[5] = cpu_to_be32 (0);
flash_data[6] = cpu_to_be32 (CONFIG_SYS_FLASH_BASE_1);
flash_data[7] = cpu_to_be32 (CONFIG_SYS_FLASH_SIZE_1);
diff --git a/board/keymile/mgsuvd/mgsuvd.c b/board/keymile/mgsuvd/mgsuvd.c
index 912e177..ec13746 100644
--- a/board/keymile/mgsuvd/mgsuvd.c
+++ b/board/keymile/mgsuvd/mgsuvd.c
@@ -20,11 +20,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
-
-#if 0
-#define DEBUG
-#endif
-
#include <common.h>
#include <mpc8xx.h>
@@ -142,8 +137,10 @@ phys_size_t initdram (int board_type)
int board_early_init_r(void)
{
/* setup the UPIOx */
- *(char *)(CONFIG_SYS_PIGGY_BASE + 0x02) = 0xc0;
- *(char *)(CONFIG_SYS_PIGGY_BASE + 0x03) = 0x35;
+ out_8((volatile unsigned char __iomem *)
+ (CONFIG_SYS_PIGGY_BASE + 0x02), 0xc0);
+ out_8((volatile unsigned char __iomem *)
+ (CONFIG_SYS_PIGGY_BASE + 0x03), 0x35);
return 0;
}
@@ -157,80 +154,76 @@ int hush_init_var (void)
/*
* update "memory" property in the blob
*/
-void ft_blob_update(void *blob, bd_t *bd)
+void ft_blob_update (void *blob, bd_t *bd)
{
int ret, nodeoffset = 0;
ulong brg_data[1] = {0};
ulong memory_data[2] = {0};
ulong flash_data[4] = {0};
- memory_data[0] = cpu_to_be32(bd->bi_memstart);
- memory_data[1] = cpu_to_be32(bd->bi_memsize);
+ memory_data[0] = cpu_to_be32 (bd->bi_memstart);
+ memory_data[1] = cpu_to_be32 (bd->bi_memsize);
- nodeoffset = fdt_path_offset (blob, "/memory");
- if (nodeoffset >= 0) {
- ret = fdt_setprop(blob, nodeoffset, "reg", memory_data,
- sizeof(memory_data));
+ nodeoffset = fdt_path_offset (blob, "/memory");
+ if (nodeoffset >= 0) {
+ ret = fdt_setprop (blob, nodeoffset, "reg", memory_data,
+ sizeof (memory_data));
if (ret < 0)
printf("ft_blob_update(): cannot set /memory/reg "
- "property err:%s\n", fdt_strerror(ret));
- }
- else {
+ "property err:%s\n", fdt_strerror (ret));
+ } else {
/* memory node is required in dts */
printf("ft_blob_update(): cannot find /memory node "
- "err:%s\n", fdt_strerror(nodeoffset));
+ "err:%s\n", fdt_strerror (nodeoffset));
}
- flash_data[2] = cpu_to_be32(bd->bi_flashstart);
- flash_data[3] = cpu_to_be32(bd->bi_flashsize);
+ flash_data[2] = cpu_to_be32 (bd->bi_flashstart);
+ flash_data[3] = cpu_to_be32 (bd->bi_flashsize);
nodeoffset = fdt_path_offset (blob, "/localbus");
if (nodeoffset >= 0) {
- ret = fdt_setprop(blob, nodeoffset, "ranges", flash_data,
- sizeof(flash_data));
+ ret = fdt_setprop (blob, nodeoffset, "ranges", flash_data,
+ sizeof (flash_data));
if (ret < 0)
printf("ft_blob_update(): cannot set /localbus/ranges "
- "property err:%s\n", fdt_strerror(ret));
- }
- else {
+ "property err:%s\n", fdt_strerror (ret));
+ } else {
/* memory node is required in dts */
printf("ft_blob_update(): cannot find /localbus node "
- "err:%s\n", fdt_strerror(nodeoffset));
+ "err:%s\n", fdt_strerror (nodeoffset));
}
/* BRG */
- brg_data[0] = cpu_to_be32(bd->bi_busfreq);
+ brg_data[0] = cpu_to_be32 (bd->bi_busfreq);
nodeoffset = fdt_path_offset (blob, "/soc/cpm");
if (nodeoffset >= 0) {
- ret = fdt_setprop(blob, nodeoffset, "brg-frequency", brg_data,
- sizeof(brg_data));
+ ret = fdt_setprop (blob, nodeoffset, "brg-frequency", brg_data,
+ sizeof (brg_data));
if (ret < 0)
printf("ft_blob_update(): cannot set /soc/cpm/brg-frequency "
"property err:%s\n", fdt_strerror(ret));
- }
- else {
+ } else {
/* memory node is required in dts */
printf("ft_blob_update(): cannot find /soc/cpm node "
- "err:%s\n", fdt_strerror(nodeoffset));
+ "err:%s\n", fdt_strerror (nodeoffset));
}
/* MAC Adresse */
nodeoffset = fdt_path_offset (blob, "/soc/cpm/ethernet");
if (nodeoffset >= 0) {
- ret = fdt_setprop(blob, nodeoffset, "mac-address", bd->bi_enetaddr,
- sizeof(uchar) * 6);
+ ret = fdt_setprop (blob, nodeoffset, "mac-address", bd->bi_enetaddr,
+ sizeof (uchar) * 6);
if (ret < 0)
printf("ft_blob_update(): cannot set /soc/cpm/scc/mac-address "
- "property err:%s\n", fdt_strerror(ret));
- }
- else {
+ "property err:%s\n", fdt_strerror (ret));
+ } else {
/* memory node is required in dts */
printf("ft_blob_update(): cannot find /soc/cpm/ethernet node "
- "err:%s\n", fdt_strerror(nodeoffset));
+ "err:%s\n", fdt_strerror (nodeoffset));
}
}
void ft_board_setup(void *blob, bd_t *bd)
{
- ft_cpu_setup( blob, bd);
- ft_blob_update(blob, bd);
+ ft_cpu_setup (blob, bd);
+ ft_blob_update (blob, bd);
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
--
1.5.6.1
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list