blob: 11819334d7320fa2255a5180480446d930644145 [file] [log] [blame]
l.yangb8fdece2024-10-10 14:56:17 +08001/*
2 * Copyright (C) 2015 ZTE-TSP
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _SPINLOCK_H
16#define _SPINLOCK_H
17
18
19/****************************************************************************
20* Include files
21****************************************************************************/
22//#include <spinlock_com.h>
23
24/****************************************************************************
25* Macros
26****************************************************************************/
27
28/****************************************************************************
29* Types
30****************************************************************************/
31
32
33#define SPINLOCK_IOC_MAGIC 'S'
34
35/*ioctl cmd usd by device*/
36#define SPINLOCK_GET_STATUS _IOWR(SPINLOCK_IOC_MAGIC, 1, char *)
37
38
39
40typedef enum
41{
42 CORE_ID_PS=210,
43 CORE_ID_PHY=211,
44 CORE_ID_ZSP=212,
45 CORE_ID_M0=213,
46 CORE_ID_AP=214,
47 CORE_ID_NUM = 215
48} zte_coreid;
49/* ±êʶӲ¼þËø*/
50typedef enum
51{
52 PCU_HWLOCK = 0,/*PCU*/
53 CLK_HWLOCK = 1,/*Clock*/
54 REGLOCK_HWLOCK,
55 SOFTLOCK_HWLOCK,
56 HWLOCK_NUM
57} emhw_lock_id;
58
59/* ±êʶÈí¼þËø*/
60typedef enum
61{
62 I2C0_SFLOCK = 0,/*i2c0*/
63 I2C1_SFLOCK = 1,/*i2c1*/
64 I2C2_SFLOCK = 2,/*pmic-i2c*/
65 NAND_SFLOCK = 3,/*NAND*/
66 SD0_SFLOCK, /*for sd0*/
67 SD1_SFLOCK, /*for sd1*/
68 ADC_SFLOCK, /*for adc*/
69 UART_SFLOCK,
70 PMIC_SFLOCK,
71#ifdef CONFIG_SYSVIPC_CROSS_SHM
72 SHM_SFLOCK,
73#else
74 SFLOCK_ID9,
75#endif
76 EFUSE_SFLOCK,
77 SFLOCK_ID11,
78 SFLOCK_ID12,
79 SFLOCK_ID13,
80 SFLOCK_ID14,
81 SFLOCK_ID15,
82 SFLOCK_ID16,
83 SFLOCK_ID17,
84 SFLOCK_ID18,
85 SFLOCK_ID19,
86 SFLOCK_ID20,
87 SFLOCK_ID21,
88 SFLOCK_ID22,
89 SFLOCK_ID23,
90 SFLOCK_ID24,
91 SFLOCK_ID25,
92 SFLOCK_ID26,
93 SFLOCK_ID27,
94 SFLOCK_ID28,
95 SFLOCK_ID29,
96 SFLOCK_ID30,
97 REG_SFLOCK = 31,/*REG*/
98 SFLOCK_NUM
99} emsf_lock_id;
100
101
102void hw_spin_lock(u32 hwid);
103void hw_spin_unlock(u32 hwid);
104void soft_spin_lock(u32 sfid);
105void soft_spin_unlock(u32 sfid);
106void reg_spin_lock(void);
107void reg_spin_unlock(void);
108void soft_spin_lock_psm(emsf_lock_id sfid);
109void soft_spin_unlock_psm(emsf_lock_id sfid);
110
111void zx_spinlock_init(void __iomem *spinlock_base);
112int soft_spin_lock_printf(emsf_lock_id sfid);
113
114#endif/* _SPINLOCK_H */
115