Example #1
0
void at91_disable_mac_clock(void)
{
#if defined(CONFIG_MAC0_PHY)
	pmc_disable_periph_clock(AT91C_ID_GMAC);
#endif
#if defined(CONFIG_MAC1_PHY)
	pmc_disable_periph_clock(AT91C_ID_GMAC1);
#endif
}
static int phys_enter_power_down(void)
{
	struct mii_bus macb_mii_bus;

#if defined(CONFIG_MAC0_PHY)
	gmac0_hw_init();

	macb_mii_bus.name = "GMAC0 KSZ8081RNB";
	macb_mii_bus.reg_base = (void *)AT91C_BASE_GMAC;
	macb_mii_bus.phy_addr = 1;

	pmc_enable_periph_clock(AT91C_ID_GMAC);

	if (phy_power_down_mode(&macb_mii_bus)) {
		dbg_loud("%s: Failed to enter power down mode\n",
						macb_mii_bus.name);
	}

	pmc_disable_periph_clock(AT91C_ID_GMAC);
#endif

#if defined(CONFIG_MAC1_PHY)
	gmac1_hw_init();

	macb_mii_bus.name = "GMAC1 KSZ8081RNB";
	macb_mii_bus.reg_base = (void *)AT91C_BASE_GMAC1;
	macb_mii_bus.phy_addr = 1;

	pmc_enable_periph_clock(AT91C_ID_GMAC1);

	if (phy_power_down_mode(&macb_mii_bus)) {
		dbg_loud("%s: Failed to enter power down mode\n",
						macb_mii_bus.name);
	}

	pmc_disable_periph_clock(AT91C_ID_GMAC1);
#endif

	return 0;
}
static void at91_disable_smd_clock(void)
{
	/*
	 * set pin DIBP to pull-up and DIBN to pull-down
	 * to save power on VDDIOP0
	 */
	pmc_enable_system_clock(AT91C_PMC_SMDCK);
	pmc_set_smd_clock_divider(AT91C_PMC_SMDDIV);
	pmc_enable_periph_clock(AT91C_ID_SMD);
	writel(0xF, (0x0C + AT91C_BASE_SMD));
	pmc_disable_periph_clock(AT91C_ID_SMD);
	pmc_disable_system_clock(AT91C_PMC_SMDCK);
}