Beispiel #1
0
static int __devinit emi_driver_probe(struct platform_device *pdev)
{
	struct resource	*res;
	int err;

	BUG_ON(emi_initialised);

	emi_device_state = devm_stm_device_init(&pdev->dev,
		(struct stm_device_config *)pdev->dev.platform_data);

	if (!emi_device_state)
		return -EBUSY;

	err = remap_named_resource(pdev, "emiss config", &emiss_config);
	if (err)
		return err;

	err = remap_named_resource(pdev, "emi4 config", &emi_control);
	if (err)
		return err;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "emi memory");
	if (!res)
		return -ENXIO;
	emi_memory_base = res->start;

	emi_clk = clk_get(&pdev->dev, "emi_clk");
	if (!emi_clk)
		pr_warning("emi_clk not found!\n");

	emi_clk_enable();
	emi = pdev; /* to say the EMI is initialised */

	return 0;
}
Beispiel #2
0
static int emi_resume(struct device *dev)
{
	emi_clk_enable();
	stm_device_power(emi_device_state, stm_device_power_on);
	return 0;
}
Beispiel #3
0
static int emi_hibernation(int resuming)
{
	int idx;
	int bank, data;
	static struct emi_pm *emi_saved_data;

	if (resuming)
		if (emi_saved_data) {
			/* restore the previous common value */
			for (idx = 0; idx < emi_num_common_cfg-4; ++idx)
				writel(emi_saved_data->common_cfg[idx],
				       emi_control+EMI_COMMON_CFG(idx));
			writel(emi_saved_data->common_cfg[12], emi_control
					+ EMI_BANK_ENABLE);
			writel(emi_saved_data->common_cfg[13], emi_control
					+ EMI_BANKNUMBER);
			writel(emi_saved_data->common_cfg[14], emiss_config +
			       EMISS_CONFIG);
			writel(emi_saved_data->common_cfg[15], emiss_config +
			       EMISS_ARBITER_CONFIG);
			/* restore the previous bank values */
			for (bank = 0; bank < emi_num_bank; ++bank) {
			  writel(emi_saved_data->bank[bank].base_address,
				emi_control + BANK_BASEADDRESS(bank));
			  for (data = 0; data < emi_num_bank_cfg; ++data)
				emi_bank_configure(bank, emi_saved_data->bank[bank].cfg);
			}
			kfree(emi_saved_data);
			emi_saved_data = NULL;
			emi_clk_enable();
			stm_device_power(emi_device_state,
				stm_device_power_on);
		}
		return 0;
	/*
	 * hibernationg...
	 */
	emi_saved_data = kmalloc(sizeof(struct emi_pm), GFP_NOWAIT);
	if (!emi_saved_data) {
		printk(KERN_ERR "Unable to freeze the emi registers\n");
		return -ENOMEM;
	}

	/* save the emi common values */
	for (idx = 0; idx < emi_num_common_cfg-4; ++idx)
		emi_saved_data->common_cfg[idx] =
			readl(emi_control + EMI_COMMON_CFG(idx));
	emi_saved_data->common_cfg[12] =
			readl(emi_control + EMI_BANK_ENABLE);
	emi_saved_data->common_cfg[13] =
			readl(emi_control + EMI_BANKNUMBER);
	emi_saved_data->common_cfg[14] =
			readl(emiss_config + EMISS_CONFIG);
	emi_saved_data->common_cfg[15] =
			readl(emiss_config + EMISS_ARBITER_CONFIG);
	/* save the emi bank value */
	for (bank  = 0; bank < emi_num_bank; ++bank) {
		emi_saved_data->bank[bank].base_address =
			readl(emi_control + BANK_BASEADDRESS(bank));
		for (data = 0; data < emi_num_bank_cfg; ++data)
			emi_saved_data->bank[bank].cfg[data] =
			  readl(emi_control + BANK_EMICONFIGDATA(bank, data));
	}
	return 0;
}
Beispiel #4
0
static int emi_resume(void)
{
    emi_clk_enable();
    stm_device_power(emi_device_state, stm_device_power_on);
    return 0;
}