aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/nmf-cm/configuration.c
blob: 175b6152b40ad537fd0cf37eb876de70d8f96362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 * Copyright (C) ST-Ericsson SA 2010
 * Author: Pierre Peiffer <pierre.peiffer@stericsson.com> for ST-Ericsson.
 * License terms: GNU General Public License (GPL), version 2.
 */

/** \file configuration.c
 *
 * Nomadik Multiprocessing Framework Linux Driver
 *
 */

#include <cm/engine/api/configuration_engine.h>
#include <cm/engine/configuration/inc/configuration_status.h>

#include "osal-kernel.h"

/* Per-driver environment */
struct OsalEnvironment osalEnv =
{
	.mpc = {
		{
			.coreId        = SVA_CORE_ID,
			.name          = "sva",
			.baseP         = (void*)SVA_BASE_ADDR,
			.interrupt0     = IRQ_DB8500_SVA,
			.interrupt1     = IRQ_DB8500_SVA2,
			.mmdsp_regulator = NULL,
			.pipe_regulator  = NULL,
			.monitor_tsk     = NULL,
			.hwmemCode       = NULL,
			.hwmemData       = NULL,
		},
		{
			.coreId        = SIA_CORE_ID,
			.name          = "sia",
			.baseP         = (void*)SIA_BASE_ADDR,
			.interrupt0     = IRQ_DB8500_SIA,
			.interrupt1     = IRQ_DB8500_SIA2,
			.mmdsp_regulator = NULL,
			.pipe_regulator  = NULL,
			.monitor_tsk     = NULL,
			.hwmemCode       = NULL,
			.hwmemData       = NULL,
		}
	},
	.esram_regulator = { NULL, NULL},
	.dsp_sleep = {
		.sia_auto_pm_enable = PRCMU_AUTO_PM_OFF,
		.sia_power_on       = 0,
		.sia_policy         = PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,
		.sva_auto_pm_enable = PRCMU_AUTO_PM_OFF,
		.sva_power_on       = 0,
		.sva_policy         = PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,		
	},
	.dsp_idle = {
		.sia_auto_pm_enable = PRCMU_AUTO_PM_OFF,
		.sia_power_on       = 0,
		.sia_policy         = PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,
		.sva_auto_pm_enable = PRCMU_AUTO_PM_OFF,
		.sva_power_on       = 0,
		.sva_policy         = PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,		
	},
};

module_param_call(cm_debug_level, param_set_int, param_get_int,
                  &cm_debug_level, S_IWUSR|S_IRUGO);
MODULE_PARM_DESC(cm_debug_level, "Debug level of NMF Core");

module_param_call(cm_error_break, param_set_bool, param_get_bool,
                  &cm_error_break, S_IWUSR|S_IRUGO);
MODULE_PARM_DESC(cm_error_break, "Stop on error (in an infinite loop, for debugging purpose)");

module_param_call(cmIntensiveCheckState, param_set_bool, param_get_bool,
                  &cmIntensiveCheckState, S_IWUSR|S_IRUGO);
MODULE_PARM_DESC(cmIntensiveCheckState, "Add additional intensive checks");

DECLARE_MPC_PARAM(SVA, SDRAM_DATA_SIZE, "", 1);

DECLARE_MPC_PARAM(SIA, 0, "\n\t\t\t(0 means shared with SVA)", 2);

int cfgCommunicationLocationInSDRAM = 1;
module_param(cfgCommunicationLocationInSDRAM, bool, S_IRUGO);
MODULE_PARM_DESC(cfgCommunicationLocationInSDRAM, "Location of communications (SDRAM or ESRAM)");

int cfgSemaphoreTypeHSEM = 1;
module_param(cfgSemaphoreTypeHSEM, bool, S_IRUGO);
MODULE_PARM_DESC(cfgSemaphoreTypeHSEM, "Semaphore used (HSEM or LSEM)");

int cfgESRAMSize = ESRAM_SIZE;
module_param(cfgESRAMSize, uint, S_IRUGO);
MODULE_PARM_DESC(cfgESRAMSize, "Size of ESRAM used in the CM (in Kb)");

int init_config(void)
{
	if (cfgMpcSDRAMCodeSize_SVA == 0 || cfgMpcSDRAMCodeSize_SIA == 0) {
		pr_err("SDRAM code size must be greater than 0\n");
		return -EINVAL;
	}

	if (cfgMpcSDRAMDataSize_SVA == 0) {
		pr_err("SDRAM data size for SVA must be greater than 0\n");
		return -EINVAL;
	}
	osalEnv.mpc[SVA].nbYramBanks   = cfgMpcYBanks_SVA;
	osalEnv.mpc[SVA].eeId          = cfgSchedulerTypeHybrid_SVA ? HYBRID_EXECUTIVE_ENGINE : SYNCHRONOUS_EXECUTIVE_ENGINE;
	osalEnv.mpc[SVA].sdramCodeSize = cfgMpcSDRAMCodeSize_SVA * ONE_KB;
	osalEnv.mpc[SVA].sdramDataSize = cfgMpcSDRAMDataSize_SVA * ONE_KB;
	osalEnv.mpc[SIA].nbYramBanks   = cfgMpcYBanks_SIA;
	osalEnv.mpc[SIA].eeId          = cfgSchedulerTypeHybrid_SIA ? HYBRID_EXECUTIVE_ENGINE : SYNCHRONOUS_EXECUTIVE_ENGINE;
	osalEnv.mpc[SIA].sdramCodeSize = cfgMpcSDRAMCodeSize_SIA * ONE_KB;
	osalEnv.mpc[SIA].sdramDataSize = cfgMpcSDRAMDataSize_SIA * ONE_KB;

	return 0;
}