/** * Shutdown is not supported by Quark, so do the closest possible here: * Halt ARC and put the platform in deep sleep. * NOTE: all wake source will be able to reboot the source unless previously * masked. */ void soc_shutdown(void) { /* Halt ARC */ SCSS_REG_VAL(SCSS_SS_CFG) |= ARC_HALT_REQ_A; /* Enable deep sleep */ SCSS_REG_VAL(PM1C_BASE) |= PM1C_SLPEN; /* Deep sleep is not reached immediately, loop in halt mode * while waiting. */ while (1) __asm__("hlt"); /* We never reach here */ }
/* This function is also called at deep sleep resume. */ int _arc_init(struct device *arg) { u32_t *reset_vector; ARG_UNUSED(arg); if (!SCSS_REG_VAL(SCSS_SS_STS)) { /* ARC shouldn't already be running! */ printk("ARC core already running!"); return -EIO; } /* Address of ARC side __reset stored in the first 4 bytes of arc.bin, * we read the value and stick it in shared_mem->arc_start which is * the beginning of the address space at 0xA8000000 */ reset_vector = (u32_t *)RESET_VECTOR; SYS_LOG_DBG("Reset vector address: %x", *reset_vector); shared_data->arc_start = *reset_vector; shared_data->flags = 0; if (!shared_data->arc_start) { /* Reset vector points to NULL => skip ARC init. */ SYS_LOG_DBG("Reset vector is NULL, skipping ARC init."); goto skip_arc_init; } #ifndef CONFIG_ARC_GDB_ENABLE /* Start the CPU */ SCSS_REG_VAL(SCSS_SS_CFG) |= ARC_RUN_REQ_A; #endif SYS_LOG_DBG("Waiting for arc to start..."); /* Block until the ARC core actually starts up */ while (SCSS_REG_VAL(SCSS_SS_STS) & 0x4000) { } /* Block until ARC's quark_se_init() sets a flag indicating it is ready, * if we get stuck here ARC has run but has exploded very early */ SYS_LOG_DBG("Waiting for arc to init..."); while (!(shared_data->flags & ARC_READY)) { } skip_arc_init: return 0; }
void platform_usb_init(void) { /* platform specific init of USB core */ MMIO_REG_VAL(QRK_PMUX_SLEW_RATE_0) = PIN_MUX_SLEW_4mA_driver; MMIO_REG_VAL(QRK_PMUX_SLEW_RATE_1) = PIN_MUX_SLEW_4mA_driver; MMIO_REG_VAL(QRK_PMUX_SLEW_RATE_2) = PIN_MUX_SLEW_4mA_driver; MMIO_REG_VAL(QRK_PMUX_SLEW_RATE_3) = PIN_MUX_SLEW_4mA_driver; enable_usb(); /* Init the USB driver */ SCSS_REG_VAL(SCSS_INT_USB_MASK_OFFSET) = QRK_INT_USB_UNMASK_QRK; }
void soc_reboot(void) { SCSS_REG_VAL(SCSS_RSTC) = RSTC_WARM_RESET; }