Move fdt_is_type to be a Marvell specific function. It's not used by any

other SoCs.

Sponsored by:	DARPA, AFRL
This commit is contained in:
Andrew Turner 2018-04-08 12:20:06 +00:00
parent efcf28ef77
commit 626a198305
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332274
7 changed files with 26 additions and 23 deletions

View File

@ -377,7 +377,8 @@ platform_devmap_init(void)
* PCI range(s) and localbus.
*/
for (child = OF_child(root); child != 0; child = OF_peer(child)) {
if (fdt_is_type(child, "pci") || fdt_is_type(child, "pciep")) {
if (mv_fdt_is_type(child, "pci") ||
mv_fdt_is_type(child, "pciep")) {
/*
* Check space: each PCI node will consume 2 devmap
* entries.

View File

@ -397,7 +397,8 @@ mv_a38x_platform_devmap_init(platform_t plat)
* PCI range(s) and localbus.
*/
for (child = OF_child(root); child != 0; child = OF_peer(child)) {
if (fdt_is_type(child, "pci") || fdt_is_type(child, "pciep")) {
if (mv_fdt_is_type(child, "pci") ||
mv_fdt_is_type(child, "pciep")) {
/*
* Check space: each PCI node will consume 2 devmap
* entries.

View File

@ -483,6 +483,26 @@ pm_disable_device(int mask)
#endif
}
int
mv_fdt_is_type(phandle_t node, const char *typestr)
{
#define FDT_TYPE_LEN 64
char type[FDT_TYPE_LEN];
if (OF_getproplen(node, "device_type") <= 0)
return (0);
if (OF_getprop(node, "device_type", type, FDT_TYPE_LEN) < 0)
return (0);
if (strncasecmp(type, typestr, FDT_TYPE_LEN) == 0)
/* This fits. */
return (1);
return (0);
#undef FDT_TYPE_LEN
}
int
mv_fdt_pm(phandle_t node)
{

View File

@ -420,7 +420,7 @@ mv_pcib_probe(device_t self)
phandle_t node;
node = ofw_bus_get_node(self);
if (!fdt_is_type(node, "pci"))
if (!mv_fdt_is_type(node, "pci"))
return (ENXIO);
if (!(ofw_bus_is_compatible(self, "mrvl,pcie") ||

View File

@ -141,6 +141,7 @@ int mv_pci_devmap(phandle_t, struct devmap_entry *, vm_offset_t,
int fdt_localbus_devmap(phandle_t, struct devmap_entry *, int, int *);
enum soc_family mv_check_soc_family(void);
int mv_fdt_is_type(phandle_t, const char *);
int mv_fdt_pm(phandle_t);
uint32_t get_tclk_armadaxp(void);

View File

@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
#endif
#define FDT_COMPAT_LEN 255
#define FDT_TYPE_LEN 64
#define FDT_REG_CELLS 4
#define FDT_RANGES_SIZE 48
@ -334,24 +333,6 @@ fdt_depth_search_compatible(phandle_t start, const char *compat, int strict)
return (0);
}
int
fdt_is_type(phandle_t node, const char *typestr)
{
char type[FDT_TYPE_LEN];
if (OF_getproplen(node, "device_type") <= 0)
return (0);
if (OF_getprop(node, "device_type", type, FDT_TYPE_LEN) < 0)
return (0);
if (strncasecmp(type, typestr, FDT_TYPE_LEN) == 0)
/* This fits. */
return (1);
return (0);
}
int
fdt_parent_addr_cells(phandle_t node)
{

View File

@ -91,7 +91,6 @@ int fdt_get_range(phandle_t, int, u_long *, u_long *);
int fdt_immr_addr(vm_offset_t);
int fdt_regsize(phandle_t, u_long *, u_long *);
int fdt_is_compatible_strict(phandle_t, const char *);
int fdt_is_type(phandle_t, const char *);
int fdt_parent_addr_cells(phandle_t);
int fdt_get_chosen_bootargs(char *bootargs, size_t max_size);