blob: 8aece3e10294cabc59e6981f1533f750779ce753 [file] [log] [blame]
chuangcheng peng021cfea2023-09-12 18:37:42 +08001/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2/*
3 * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
4 */
5
6#ifndef _AMSMC_H
7#define _AMSMC_H
8
9/* #include <asm/types.h> */
10#include <linux/types.h>
11
12#define AMSMC_MAX_ATR_LEN 33
13
14enum {
15 AMSMC_CARDOUT = 0,
16 AMSMC_CARDIN = 1
17};
18
19struct am_smc_atr {
20 char atr[AMSMC_MAX_ATR_LEN];
21 int atr_len;
22};
23
24struct am_smc_param {
25 int f;
26 int d;
27 int n;
28 int bwi;
29 int cwi;
30 int bgt;
31 int freq;
32 int recv_invert;
33 int recv_lsb_msb;
34 int recv_no_parity;
35 int recv_parity;
36 int xmit_invert;
37 int xmit_lsb_msb;
38 int xmit_retries;
39 int xmit_repeat_dis;
40 int xmit_parity;
41};
42
43#define AMSMC_IOC_MAGIC 'C'
44
45#define AMSMC_IOC_RESET _IOR(AMSMC_IOC_MAGIC, 0x00, struct am_smc_atr)
46#define AMSMC_IOC_GET_STATUS _IOR(AMSMC_IOC_MAGIC, 0x01, int)
47#define AMSMC_IOC_ACTIVE _IO(AMSMC_IOC_MAGIC, 0x02)
48#define AMSMC_IOC_DEACTIVE _IO(AMSMC_IOC_MAGIC, 0x03)
49#define AMSMC_IOC_GET_PARAM _IOR(AMSMC_IOC_MAGIC, 0x04, struct am_smc_param)
50#define AMSMC_IOC_SET_PARAM _IOW(AMSMC_IOC_MAGIC, 0x05, struct am_smc_param)
51#define AMSMC_IOC_HOT_RESET _IOR(AMSMC_IOC_MAGIC, 0x06, struct am_smc_atr)
52
53#endif