summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-09-07 22:19:49 +0200
committerWolfgang Denk <wd@denx.de>2010-09-07 22:19:49 +0200
commitf91506e28387fece392b5dd3bb3aa309e4ce7e4d (patch)
tree3e46227d94b7b379341fba534df5aa3dd3948f68 /common
parent5549d22b656550d36b2cc46743c7220ab0e9dcc4 (diff)
parent2df0e6fc6b71448e1752e4ce1d5577d8977f3e5e (diff)
downloadblackbird-obmc-uboot-f91506e28387fece392b5dd3bb3aa309e4ce7e4d.tar.gz
blackbird-obmc-uboot-f91506e28387fece392b5dd3bb3aa309e4ce7e4d.zip
Merge branch 'master' of /home/wd/git/u-boot/master
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bdinfo.c19
-rw-r--r--common/cmd_i2c.c17
-rw-r--r--common/fdt_support.c58
3 files changed, 47 insertions, 47 deletions
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index fbe73f1b3d..d43867f10b 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -348,6 +348,25 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+#elif defined(CONFIG_SH)
+
+int do_bdinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ bd_t *bd = gd->bd;
+ print_num ("mem start ", (ulong)bd->bi_memstart);
+ print_lnum ("mem size ", (u64)bd->bi_memsize);
+ print_num ("flash start ", (ulong)bd->bi_flashstart);
+ print_num ("flash size ", (ulong)bd->bi_flashsize);
+ print_num ("flash offset ", (ulong)bd->bi_flashoffset);
+
+#if defined(CONFIG_CMD_NET)
+ print_eth(0);
+ printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
+#endif
+ printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
+ return 0;
+}
+
#else
#error "a case for this architecture does not exist!"
#endif
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 371e022f79..1283c82afb 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -152,7 +152,7 @@ int i2c_set_bus_speed(unsigned int)
/*
* get_alen: small parser helper function to get address length
- * returns the address length,or 0 on error
+ * returns the address length
*/
static uint get_alen(char *arg)
{
@@ -163,9 +163,6 @@ static uint get_alen(char *arg)
for (j = 0; j < 8; j++) {
if (arg[j] == '.') {
alen = arg[j+1] - '0';
- if (alen > 3) {
- return 0;
- }
break;
} else if (arg[j] == '\0')
break;
@@ -198,7 +195,7 @@ static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
*/
devaddr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -255,7 +252,7 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -337,7 +334,7 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -399,7 +396,7 @@ static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -477,7 +474,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
}
@@ -621,7 +618,7 @@ static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 33336be062..aef4fe23e0 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -874,35 +874,6 @@ static inline u64 of_read_number(const __be32 *cell, int size)
return r;
}
-static int of_n_cells(const void *blob, int nodeoffset, const char *name)
-{
- int np;
- const int *ip;
-
- do {
- np = fdt_parent_offset(blob, nodeoffset);
-
- if (np >= 0)
- nodeoffset = np;
- ip = (int *)fdt_getprop(blob, nodeoffset, name, NULL);
- if (ip)
- return be32_to_cpup(ip);
- } while (np >= 0);
-
- /* No #<NAME>-cells property for the root node */
- return 1;
-}
-
-int of_n_addr_cells(const void *blob, int nodeoffset)
-{
- return of_n_cells(blob, nodeoffset, "#address-cells");
-}
-
-int of_n_size_cells(const void *blob, int nodeoffset)
-{
- return of_n_cells(blob, nodeoffset, "#size-cells");
-}
-
#define PRu64 "%llx"
/* Max address size we deal with */
@@ -928,7 +899,7 @@ static void of_dump_addr(const char *s, const u32 *addr, int na) { }
struct of_bus {
const char *name;
const char *addresses;
- void (*count_cells)(void *blob, int offset,
+ void (*count_cells)(void *blob, int parentoffset,
int *addrc, int *sizec);
u64 (*map)(u32 *addr, const u32 *range,
int na, int ns, int pna);
@@ -936,13 +907,26 @@ struct of_bus {
};
/* Default translator (generic bus) */
-static void of_bus_default_count_cells(void *blob, int offset,
+static void of_bus_default_count_cells(void *blob, int parentoffset,
int *addrc, int *sizec)
{
- if (addrc)
- *addrc = of_n_addr_cells(blob, offset);
- if (sizec)
- *sizec = of_n_size_cells(blob, offset);
+ const u32 *prop;
+
+ if (addrc) {
+ prop = fdt_getprop(blob, parentoffset, "#address-cells", NULL);
+ if (prop)
+ *addrc = be32_to_cpup(prop);
+ else
+ *addrc = 2;
+ }
+
+ if (sizec) {
+ prop = fdt_getprop(blob, parentoffset, "#size-cells", NULL);
+ if (prop)
+ *sizec = be32_to_cpup(prop);
+ else
+ *sizec = 1;
+ }
}
static u64 of_bus_default_map(u32 *addr, const u32 *range,
@@ -1068,7 +1052,7 @@ u64 __of_translate_address(void *blob, int node_offset, const u32 *in_addr,
bus = &of_busses[0];
/* Cound address cells & copy address locally */
- bus->count_cells(blob, node_offset, &na, &ns);
+ bus->count_cells(blob, parent, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
fdt_get_name(blob, node_offset, NULL));
@@ -1095,7 +1079,7 @@ u64 __of_translate_address(void *blob, int node_offset, const u32 *in_addr,
/* Get new parent bus and counts */
pbus = &of_busses[0];
- pbus->count_cells(blob, node_offset, &pna, &pns);
+ pbus->count_cells(blob, parent, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
fdt_get_name(blob, node_offset, NULL));
OpenPOWER on IntegriCloud