Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/allwinner/if_awg.c
Show First 20 Lines • Show All 1,159 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
awg_setup_extres(device_t dev) | awg_setup_extres(device_t dev) | ||||
{ | { | ||||
struct awg_softc *sc; | struct awg_softc *sc; | ||||
hwreset_t rst_ahb, rst_ephy; | hwreset_t rst_ahb, rst_ephy; | ||||
clk_t clk_ahb, clk_ephy; | clk_t clk_ahb, clk_ephy; | ||||
regulator_t reg; | regulator_t reg; | ||||
phandle_t node; | |||||
uint64_t freq; | uint64_t freq; | ||||
int error, div; | int error, div; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
node = ofw_bus_get_node(dev); | |||||
rst_ahb = rst_ephy = NULL; | rst_ahb = rst_ephy = NULL; | ||||
clk_ahb = clk_ephy = NULL; | clk_ahb = clk_ephy = NULL; | ||||
reg = NULL; | reg = NULL; | ||||
/* Get AHB clock and reset resources */ | /* Get AHB clock and reset resources */ | ||||
error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb); | error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb); | ||||
if (error != 0) { | if (error != 0) { | ||||
device_printf(dev, "cannot get ahb reset\n"); | device_printf(dev, "cannot get ahb reset\n"); | ||||
▲ Show 20 Lines • Show All 420 Lines • ▼ Show 20 Lines | awg_probe(device_t dev) | ||||
return (BUS_PROBE_DEFAULT); | return (BUS_PROBE_DEFAULT); | ||||
} | } | ||||
static int | static int | ||||
awg_attach(device_t dev) | awg_attach(device_t dev) | ||||
{ | { | ||||
uint8_t eaddr[ETHER_ADDR_LEN]; | uint8_t eaddr[ETHER_ADDR_LEN]; | ||||
struct awg_softc *sc; | struct awg_softc *sc; | ||||
phandle_t node; | |||||
int error; | int error; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; | sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; | ||||
node = ofw_bus_get_node(dev); | |||||
if (bus_alloc_resources(dev, awg_spec, sc->res) != 0) { | if (bus_alloc_resources(dev, awg_spec, sc->res) != 0) { | ||||
device_printf(dev, "cannot allocate resources for device\n"); | device_printf(dev, "cannot allocate resources for device\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
mtx_init(&sc->mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); | mtx_init(&sc->mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); | ||||
callout_init_mtx(&sc->stat_ch, &sc->mtx, 0); | callout_init_mtx(&sc->stat_ch, &sc->mtx, 0); | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |