Exemplo n.º 1
0
void hw_init(void)
{
	/* Disable watchdog */
	at91_disable_wdt();

	/* At this stage the main oscillator is supposed
	 * to be enabled PCK = MCK = MOSC
	 */

	/* Configure PLLA = MOSC * (PLL_MULA + 1) / PLL_DIVA */
	pmc_cfg_plla(PLLA_SETTINGS, PLL_LOCK_TIMEOUT);

	/* Initialize PLLA charge pump */
	/* not needed for SAMA5D4 */
	pmc_init_pll(0);

	/* Switch MCK on PLLA output */
	pmc_cfg_mck(BOARD_PRESCALER_PLLA, PLL_LOCK_TIMEOUT);

	/* Setup AHB 32-bit Matrix Divisor */
	pmc_cfg_h32mxdiv(BOARD_H32MX, PLL_LOCK_TIMEOUT);

	/* Enable External Reset */
	writel(AT91C_RSTC_KEY_UNLOCK | AT91C_RSTC_URSTEN,
					AT91C_BASE_RSTC + RSTC_RMR);

#if defined(CONFIG_ENTER_NWD)
	cpacr_init();

	/* Program the DACR to allow client access to *all* domains */
	dacr_swd_init();
#endif

#if defined(CONFIG_MATRIX)
	/* Initialize the matrix */
	matrix_init();
#endif

	/* initialize the dbgu */
	initialize_dbgu();

	/* Redirect all interrupts to non-secure AIC */
	redirect_interrupts_to_aic();

#if defined(CONFIG_MATRIX)
	matrix_read_slave_security();
	matrix_read_periperal_security();
#endif

	/* Init timer */
	timer_init();

#ifdef CONFIG_DDR2
	/* Initialize MPDDR Controller */
	ddramc_init();
#endif
	/* load one wire information */
	one_wire_hw_init();

	/* Reset HDMI SiI9022 */
	SiI9022_hw_reset();

	/* Disable software modem device's clock */
	at91_disable_smd_clock();

#ifdef CONFIG_TWI
	twi_init();
#endif

#ifdef CONFIG_ACT8865
	/* Set ACT8865 REG power saving mode */
	act8865_set_power_saving_mode();

	/* Set ACT8865 output voltage */
	sama5d4ek_act8865_set_reg_voltage();

	/* Dsiable ACT8865 I2C interface */
	if (act8865_workaround_disable_i2c())
		while (1)
			;
#endif

#ifdef CONFIG_PM_EXTERNAL_DEVICES
#ifdef CONFIG_HDMI
	SiI9022_enter_power_state_D3_Cold();
#endif
#ifdef CONFIG_WM8904
	wm8904_enter_low_power();
#endif
#ifdef CONFIG_MACB
	/* Make PHYs to power down mode */
	phys_enter_power_down();
#endif
#endif	/* #ifdef CONFIG_PM_EXTERNAL_DEVICES */

#ifdef CONFIG_USER_HW_INIT
	hw_init_hook();
#endif
}
Exemplo n.º 2
0
void hw_init(void)
{
	/* Disable watchdog */
	at91_disable_wdt();

	/*
	 * At this stage the main oscillator
	 * is supposed to be enabled PCK = MCK = MOSC
	 */

	/* Configure PLLA = MOSC * (PLL_MULA + 1) / PLL_DIVA */
	pmc_cfg_plla(PLLA_SETTINGS, PLL_LOCK_TIMEOUT);

	/* Initialize PLLA charge pump */
	pmc_init_pll(AT91C_PMC_IPLLA_3);

	/* Switch PCK/MCK on Main clock output */
	pmc_cfg_mck(BOARD_PRESCALER_MAIN_CLOCK, PLL_LOCK_TIMEOUT);

	/* Switch PCK/MCK on PLLA output */
	pmc_cfg_mck(BOARD_PRESCALER_PLLA, PLL_LOCK_TIMEOUT);

#ifdef CONFIG_USER_HW_INIT
	/* Set GMAC & EMAC pins to output low */
	at91_special_pio_output_low();
#endif

	/* Disable the software modem clock */
	at91_disable_smd_clock();

	/* Init timer */
	timer_init();

#ifdef CONFIG_SCLK
	slowclk_enable_osc32();
#endif

	/* initialize the dbgu */
	initialize_dbgu();

#ifdef CONFIG_DDR2
	/* Initialize MPDDR Controller */
	ddramc_init();
#endif

#ifdef CONFIG_TWI
	twi_init();
#endif

#ifdef CONFIG_ACT8865
	/* Set ACT8865 REG power saving mode */
	act8865_set_power_saving_mode();

	/* Set ACT8865 output voltage */
	sama5d4ek_act8865_set_reg_voltage();

	/* Dsiable ACT8865 I2C interface */
	if (act8865_workaround_disable_i2c())
		while (1)
			;
#endif

#ifdef CONFIG_PM_EXTERNAL_DEVICES
#ifdef CONFIG_MACB
	/* Make PHYs to power down mode */
	phys_enter_power_down();
#endif
#endif	/* #ifdef CONFIG_PM_EXTERNAL_DEVICES */
}