Modify mx25l FDT compatible device handling

If we cannot establish compatibility by only looking at the compat_data we
also check the flash_devices structure's names for a compatible device.

Approved by:	adrian (mentor)
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D6026
This commit is contained in:
Stanislav Galabov 2016-04-20 14:33:00 +00:00
parent e3a1a618a3
commit 009e872ef7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298347

View File

@ -443,12 +443,26 @@ static struct ofw_compat_data compat_data[] = {
static int
mx25l_probe(device_t dev)
{
#ifdef FDT
int i;
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
/* First try to match the compatible property to the compat_data */
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 1)
goto found;
/*
* Next, try to find a compatible device using the names in the
* flash_devices structure
*/
for (i = 0; i < nitems(flash_devices); i++)
if (ofw_bus_is_compatible(dev, flash_devices[i].name))
goto found;
return (ENXIO);
found:
#endif
device_set_desc(dev, "M25Pxx Flash Family");