Skip to content

Commit f923473

Browse files
Scott Woodkumargala
authored andcommitted
[POWERPC] fsl_soc.c cleanup
1. Update the way get_brgfreq() finds things in the device tree. It now uses names that are less namespace polluting. The old names are supported until all boards are converted. 2. "size" is changed from unsigned int to int, to match what of_get_property() expects. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
1 parent 683d00b commit f923473

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

‎arch/powerpc/sysdev/fsl_soc.c‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ phys_addr_t get_immrbase(void)
5252

5353
soc = of_find_node_by_type(NULL, "soc");
5454
if (soc) {
55-
unsigned int size;
55+
int size;
5656
const void *prop = of_get_property(soc, "reg", &size);
5757

5858
if (prop)
5959
immrbase = of_translate_address(soc, prop);
6060
of_node_put(soc);
61-
};
61+
}
6262

6363
return immrbase;
6464
}
@@ -76,16 +76,23 @@ u32 get_brgfreq(void)
7676
if (brgfreq != -1)
7777
return brgfreq;
7878

79-
node = of_find_node_by_type(NULL, "cpm");
79+
node = of_find_compatible_node(NULL, NULL, "fsl,cpm1");
80+
if (!node)
81+
node = of_find_compatible_node(NULL, NULL, "fsl,cpm2");
82+
if (!node)
83+
node = of_find_node_by_type(NULL, "cpm");
8084
if (node) {
81-
unsigned int size;
82-
const unsigned int *prop = of_get_property(node,
83-
"brg-frequency", &size);
85+
int size;
86+
const unsigned int *prop;
8487

85-
if (prop)
88+
prop = of_get_property(node, "fsl,brg-frequency", &size);
89+
if (!prop)
90+
prop = of_get_property(node, "brg-frequency", &size);
91+
if (prop && size == 4)
8692
brgfreq = *prop;
93+
8794
of_node_put(node);
88-
};
95+
}
8996

9097
return brgfreq;
9198
}
@@ -103,14 +110,14 @@ u32 get_baudrate(void)
103110

104111
node = of_find_node_by_type(NULL, "serial");
105112
if (node) {
106-
unsigned int size;
113+
int size;
107114
const unsigned int *prop = of_get_property(node,
108115
"current-speed", &size);
109116

110117
if (prop)
111118
fs_baudrate = *prop;
112119
of_node_put(node);
113-
};
120+
}
114121

115122
return fs_baudrate;
116123
}

0 commit comments

Comments
 (0)