Esempio n. 1
0
static void
smu_send_cmd(device_t dev, struct smu_cmd *cmd)
{
	struct smu_softc *sc;

	sc = device_get_softc(dev);

	mtx_assert(&sc->sc_mtx, MA_OWNED);

	if (sc->sc_u3)
		powerpc_pow_enabled = 0; /* SMU cannot work if we go to NAP */

	sc->sc_cur_cmd = cmd;

	/* Copy the command to the mailbox */
	sc->sc_cmd->cmd = cmd->cmd;
	sc->sc_cmd->len = cmd->len;
	memcpy(sc->sc_cmd->data, cmd->data, sizeof(cmd->data));
	bus_dmamap_sync(sc->sc_dmatag, sc->sc_cmd_dmamap, BUS_DMASYNC_PREWRITE);
	bus_space_write_4(sc->sc_bt, sc->sc_mailbox, 0, sc->sc_cmd_phys);

	/* Flush the cacheline it is in -- SMU bypasses the cache */
	__asm __volatile("sync; dcbf 0,%0; sync" :: "r"(sc->sc_cmd): "memory");

	/* Ring SMU doorbell */
	macgpio_write(smu_doorbell, GPIO_DDR_OUTPUT);
}
Esempio n. 2
0
static void
vcoregpio_post_change(device_t dev, const struct cf_level *level)
{
	if (level->rel_set[0].freq < 10000 /* max */) {
		DELAY(1000);
		/* We are safe to reduce CPU voltage now */
		macgpio_write(dev, GPIO_DDR_OUTPUT | 0);
	}
}
Esempio n. 3
0
static void
vcoregpio_pre_change(device_t dev, const struct cf_level *level)
{
	if (level->rel_set[0].freq == 10000 /* max */) {
		/*
		 * Make sure the CPU voltage is raised before we raise
		 * the clock.
		 */
		macgpio_write(dev, GPIO_DDR_OUTPUT | 1);
		DELAY(1000);
	}
}
Esempio n. 4
0
static void
gpio_write(enum gpio_ctrl ctrl, u_int x)
{
	struct aoagpio_softc 	*sc;
	u_int 			 reg;

	if ((sc = gpio_ctrls[ctrl]) == NULL)
		return;

	reg = GPIO_DDR_OUTPUT;
	if (x)
		reg |= GPIO_DATA;

	macgpio_write(sc->dev, reg);
}