int spi_dw_init(struct device *dev) { struct spi_dw_config *info = dev->config->config_info; struct spi_dw_data *spi = dev->driver_data; _clock_config(dev); _clock_on(dev); #ifndef CONFIG_SOC_QUARK_SE_SS if (read_ssi_comp_version(info->regs) != DW_SSI_COMP_VERSION) { _clock_off(dev); return DEV_NOT_CONFIG; } #endif dev->driver_api = &dw_spi_api; info->config_func(); device_sync_call_init(&spi->sync); _spi_config_cs(dev); /* Masking interrupt and making sure controller is disabled */ write_imr(DW_SPI_IMR_MASK, info->regs); clear_bit_ssienr(info->regs); DBG("Designware SPI driver initialized on device: %p\n", dev); return DEV_OK; }
static int spi_dw_suspend(struct device *dev) { DBG("%s: %p\n", __func__, dev); _clock_off(dev); return DEV_OK; }
static void stop_clock_and_power_off(void) { uint32_t idx; /* Assume clock control mutex is already acquired, and that block is currently off */ BUG_ON(vce_state.clock_enable_count != 0); /* Theoretically, we might consider unmapping VCE regs here */ BUG_ON(vce_base == NULL); /* Flush out the ISR */ { unsigned long flags; spin_lock_irqsave(&vce_state.isrclocks_spin, flags); spin_unlock_irqrestore(&vce_state.isrclocks_spin, flags); } _clock_off(); _power_off(); idx = vce_state.powertrace_idx++ & vce_state.powertrace_idxmask; if (vce_state.powertrace != NULL) vce_state.powertrace[idx] = jiffies; }