Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/bhnd/bcma/bcma_subr.c
Show First 20 Lines • Show All 588 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* @retval 0 success | * @retval 0 success | ||||
* @retval ENODEV if @p dinfo does not map an agent register resource. | * @retval ENODEV if @p dinfo does not map an agent register resource. | ||||
* @retval ETIMEDOUT if timeout occurs waiting for reset completion | * @retval ETIMEDOUT if timeout occurs waiting for reset completion | ||||
*/ | */ | ||||
int | int | ||||
bcma_dmp_write_reset(device_t child, struct bcma_devinfo *dinfo, uint32_t value) | bcma_dmp_write_reset(device_t child, struct bcma_devinfo *dinfo, uint32_t value) | ||||
{ | { | ||||
uint32_t rst; | |||||
if (dinfo->res_agent == NULL) | if (dinfo->res_agent == NULL) | ||||
return (ENODEV); | return (ENODEV); | ||||
/* Already in requested reset state? */ | |||||
rst = bhnd_bus_read_4(dinfo->res_agent, BCMA_DMP_RESETCTRL); | |||||
if (rst == value) | |||||
return (0); | |||||
bhnd_bus_write_4(dinfo->res_agent, BCMA_DMP_RESETCTRL, value); | bhnd_bus_write_4(dinfo->res_agent, BCMA_DMP_RESETCTRL, value); | ||||
bhnd_bus_read_4(dinfo->res_agent, BCMA_DMP_RESETCTRL); /* read-back */ | bhnd_bus_read_4(dinfo->res_agent, BCMA_DMP_RESETCTRL); /* read-back */ | ||||
DELAY(10); | DELAY(10); | ||||
return (bcma_dmp_wait_reset(child, dinfo)); | return (bcma_dmp_wait_reset(child, dinfo)); | ||||
} | } |