blob: eb5e7b761a99bebe135f7669a6b94134009e4dcb [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 SFLOCK_ID9,
72 SFLOCK_ID10,
73 SFLOCK_ID11,
74 SFLOCK_ID12,
75 SFLOCK_ID13,
76 SFLOCK_ID14,
77 SFLOCK_ID15,
78 SFLOCK_ID16,
79 SFLOCK_ID17,
80 SFLOCK_ID18,
81 SFLOCK_ID19,
82 SFLOCK_ID20,
83 SFLOCK_ID21,
84 SFLOCK_ID22,
85 SFLOCK_ID23,
86 SFLOCK_ID24,
87 SFLOCK_ID25,
88 SFLOCK_ID26,
89 SFLOCK_ID27,
90 SFLOCK_ID28,
91 SFLOCK_ID29,
92 SFLOCK_ID30,
93 REG_SFLOCK = 31,/*REG*/
94 SFLOCK_NUM
95} emsf_lock_id;
96
97
98void hw_spin_lock(u32 hwid);
99void hw_spin_unlock(u32 hwid);
100void soft_spin_lock(u32 sfid);
101void soft_spin_unlock(u32 sfid);
102void reg_spin_lock(void);
103void reg_spin_unlock(void);
104void soft_spin_lock_psm(emsf_lock_id sfid);
105void soft_spin_unlock_psm(emsf_lock_id sfid);
106
107void zx_spinlock_init(void __iomem *spinlock_base);
108int soft_spin_lock_printf(emsf_lock_id sfid);
109
110#endif/* _SPINLOCK_H */
111