Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m
| Show All 30 Lines | |||||
| INTERFACE bhnd_chipc; | INTERFACE bhnd_chipc; | ||||
| # | # | ||||
| # bhnd(4) ChipCommon interface. | # bhnd(4) ChipCommon interface. | ||||
| # | # | ||||
| HEADER { | HEADER { | ||||
| #include <dev/bhnd/nvram/bhnd_nvram.h> | |||||
| /* forward declarations */ | /* forward declarations */ | ||||
| struct chipc_caps; | struct chipc_caps; | ||||
| struct chipc_caps *bhnd_chipc_generic_get_caps(device_t dev); | |||||
| } | } | ||||
| CODE { | CODE { | ||||
| static struct chipc_caps * | |||||
| /** | bhnd_chipc_null_get_caps(device_t dev) | ||||
| * Helper function for implementing BHND_CHIPC_GET_CAPS(). | |||||
| * | |||||
| * This implementation of BHND_CHIPC_GET_CAPS() simply calls the | |||||
| * BHND_CHIPC_GET_CAPS() method of the parent of @p dev. | |||||
| */ | |||||
| struct chipc_caps* | |||||
| bhnd_chipc_generic_get_caps(device_t dev) | |||||
| { | { | ||||
| if (device_get_parent(dev) != NULL) | |||||
| return (BHND_CHIPC_GET_CAPS(device_get_parent(dev))); | |||||
| panic("bhnd_chipc_generic_get_caps unimplemented"); | panic("bhnd_chipc_generic_get_caps unimplemented"); | ||||
| /* Unreachable */ | |||||
| return (NULL); | |||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Write @p value with @p mask directly to the chipctrl register. | * Write @p value with @p mask directly to the chipctrl register. | ||||
| * | * | ||||
| * @param dev A bhnd(4) ChipCommon device. | * @param dev A bhnd(4) ChipCommon device. | ||||
| * @param value The value to write. | * @param value The value to write. | ||||
| * @param mask The mask of bits to be written from @p value. | * @param mask The mask of bits to be written from @p value. | ||||
| Show All 13 Lines | |||||
| /** | /** | ||||
| * Return a borrowed reference to ChipCommon's capability | * Return a borrowed reference to ChipCommon's capability | ||||
| * table. | * table. | ||||
| * | * | ||||
| * @param dev A bhnd(4) ChipCommon device | * @param dev A bhnd(4) ChipCommon device | ||||
| */ | */ | ||||
| METHOD struct chipc_caps * get_caps { | METHOD struct chipc_caps * get_caps { | ||||
| device_t dev; | device_t dev; | ||||
| } DEFAULT bhnd_chipc_generic_get_caps; | } DEFAULT bhnd_chipc_null_get_caps; | ||||
| /** | /** | ||||
| * Enable hardware access to the SPROM/OTP source. | * Enable hardware access to the SPROM/OTP source. | ||||
| * | * | ||||
| * @param sc chipc driver state. | * @param sc chipc driver state. | ||||
| * | * | ||||
| * @retval 0 success | * @retval 0 success | ||||
| * @retval EBUSY If enabling the hardware may conflict with | * @retval EBUSY If enabling the hardware may conflict with | ||||
| * other active devices. | * other active devices. | ||||
| */ | */ | ||||
| METHOD int enable_sprom { | METHOD int enable_sprom { | ||||
| device_t dev; | device_t dev; | ||||
| } | } | ||||
| /** | /** | ||||
| * Release hardware access to the SPROM/OTP source. | * Release hardware access to the SPROM/OTP source. | ||||
| * | * | ||||
| * @param sc chipc driver state. | * @param sc chipc driver state. | ||||
| */ | */ | ||||
| METHOD void disable_sprom { | METHOD void disable_sprom { | ||||
| device_t dev; | |||||
| } | |||||
| /** | |||||
| * Return the flash configuration register value | |||||
| * | |||||
| * @param dev A bhnd(4) ChipCommon device | |||||
| */ | |||||
| METHOD uint32_t get_flash_cfg { | |||||
| device_t dev; | device_t dev; | ||||
| } | } | ||||