162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Handles the M-Systems DiskOnChip G3 chip
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2011 Robert Jarzmik
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _MTD_DOCG3_H
962306a36Sopenharmony_ci#define _MTD_DOCG3_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/mtd/mtd.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/*
1462306a36Sopenharmony_ci * Flash memory areas :
1562306a36Sopenharmony_ci *   - 0x0000 .. 0x07ff : IPL
1662306a36Sopenharmony_ci *   - 0x0800 .. 0x0fff : Data area
1762306a36Sopenharmony_ci *   - 0x1000 .. 0x17ff : Registers
1862306a36Sopenharmony_ci *   - 0x1800 .. 0x1fff : Unknown
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci#define DOC_IOSPACE_IPL			0x0000
2162306a36Sopenharmony_ci#define DOC_IOSPACE_DATA		0x0800
2262306a36Sopenharmony_ci#define DOC_IOSPACE_SIZE		0x2000
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/*
2562306a36Sopenharmony_ci * DOC G3 layout and adressing scheme
2662306a36Sopenharmony_ci *   A page address for the block "b", plane "P" and page "p":
2762306a36Sopenharmony_ci *   address = [bbbb bPpp pppp]
2862306a36Sopenharmony_ci */
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define DOC_ADDR_PAGE_MASK		0x3f
3162306a36Sopenharmony_ci#define DOC_ADDR_BLOCK_SHIFT		6
3262306a36Sopenharmony_ci#define DOC_LAYOUT_NBPLANES		2
3362306a36Sopenharmony_ci#define DOC_LAYOUT_PAGES_PER_BLOCK	64
3462306a36Sopenharmony_ci#define DOC_LAYOUT_PAGE_SIZE		512
3562306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_SIZE		16
3662306a36Sopenharmony_ci#define DOC_LAYOUT_WEAR_SIZE		8
3762306a36Sopenharmony_ci#define DOC_LAYOUT_PAGE_OOB_SIZE				\
3862306a36Sopenharmony_ci	(DOC_LAYOUT_PAGE_SIZE + DOC_LAYOUT_OOB_SIZE)
3962306a36Sopenharmony_ci#define DOC_LAYOUT_WEAR_OFFSET		(DOC_LAYOUT_PAGE_OOB_SIZE * 2)
4062306a36Sopenharmony_ci#define DOC_LAYOUT_BLOCK_SIZE					\
4162306a36Sopenharmony_ci	(DOC_LAYOUT_PAGES_PER_BLOCK * DOC_LAYOUT_PAGE_SIZE)
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/*
4462306a36Sopenharmony_ci * ECC related constants
4562306a36Sopenharmony_ci */
4662306a36Sopenharmony_ci#define DOC_ECC_BCH_M			14
4762306a36Sopenharmony_ci#define DOC_ECC_BCH_T			4
4862306a36Sopenharmony_ci#define DOC_ECC_BCH_PRIMPOLY		0x4443
4962306a36Sopenharmony_ci#define DOC_ECC_BCH_SIZE		7
5062306a36Sopenharmony_ci#define DOC_ECC_BCH_COVERED_BYTES				\
5162306a36Sopenharmony_ci	(DOC_LAYOUT_PAGE_SIZE + DOC_LAYOUT_OOB_PAGEINFO_SZ +	\
5262306a36Sopenharmony_ci	 DOC_LAYOUT_OOB_HAMMING_SZ)
5362306a36Sopenharmony_ci#define DOC_ECC_BCH_TOTAL_BYTES					\
5462306a36Sopenharmony_ci	(DOC_ECC_BCH_COVERED_BYTES + DOC_LAYOUT_OOB_BCH_SZ)
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/*
5762306a36Sopenharmony_ci * Blocks distribution
5862306a36Sopenharmony_ci */
5962306a36Sopenharmony_ci#define DOC_LAYOUT_BLOCK_BBT		0
6062306a36Sopenharmony_ci#define DOC_LAYOUT_BLOCK_OTP		0
6162306a36Sopenharmony_ci#define DOC_LAYOUT_BLOCK_FIRST_DATA	6
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define DOC_LAYOUT_PAGE_BBT		4
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/*
6662306a36Sopenharmony_ci * Extra page OOB (16 bytes wide) layout
6762306a36Sopenharmony_ci */
6862306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_PAGEINFO_OFS	0
6962306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_HAMMING_OFS	7
7062306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_BCH_OFS		8
7162306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_UNUSED_OFS	15
7262306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_PAGEINFO_SZ	7
7362306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_HAMMING_SZ	1
7462306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_BCH_SZ		7
7562306a36Sopenharmony_ci#define DOC_LAYOUT_OOB_UNUSED_SZ	1
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define DOC_CHIPID_G3			0x200
7962306a36Sopenharmony_ci#define DOC_ERASE_MARK			0xaa
8062306a36Sopenharmony_ci#define DOC_MAX_NBFLOORS		4
8162306a36Sopenharmony_ci/*
8262306a36Sopenharmony_ci * Flash registers
8362306a36Sopenharmony_ci */
8462306a36Sopenharmony_ci#define DOC_CHIPID			0x1000
8562306a36Sopenharmony_ci#define DOC_TEST			0x1004
8662306a36Sopenharmony_ci#define DOC_BUSLOCK			0x1006
8762306a36Sopenharmony_ci#define DOC_ENDIANCONTROL		0x1008
8862306a36Sopenharmony_ci#define DOC_DEVICESELECT		0x100a
8962306a36Sopenharmony_ci#define DOC_ASICMODE			0x100c
9062306a36Sopenharmony_ci#define DOC_CONFIGURATION		0x100e
9162306a36Sopenharmony_ci#define DOC_INTERRUPTCONTROL		0x1010
9262306a36Sopenharmony_ci#define DOC_READADDRESS			0x101a
9362306a36Sopenharmony_ci#define DOC_DATAEND			0x101e
9462306a36Sopenharmony_ci#define DOC_INTERRUPTSTATUS		0x1020
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define DOC_FLASHSEQUENCE		0x1032
9762306a36Sopenharmony_ci#define DOC_FLASHCOMMAND		0x1034
9862306a36Sopenharmony_ci#define DOC_FLASHADDRESS		0x1036
9962306a36Sopenharmony_ci#define DOC_FLASHCONTROL		0x1038
10062306a36Sopenharmony_ci#define DOC_NOP				0x103e
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci#define DOC_ECCCONF0			0x1040
10362306a36Sopenharmony_ci#define DOC_ECCCONF1			0x1042
10462306a36Sopenharmony_ci#define DOC_ECCPRESET			0x1044
10562306a36Sopenharmony_ci#define DOC_HAMMINGPARITY		0x1046
10662306a36Sopenharmony_ci#define DOC_BCH_HW_ECC(idx)		(0x1048 + idx)
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci#define DOC_PROTECTION			0x1056
10962306a36Sopenharmony_ci#define DOC_DPS0_KEY			0x105c
11062306a36Sopenharmony_ci#define DOC_DPS1_KEY			0x105e
11162306a36Sopenharmony_ci#define DOC_DPS0_ADDRLOW		0x1060
11262306a36Sopenharmony_ci#define DOC_DPS0_ADDRHIGH		0x1062
11362306a36Sopenharmony_ci#define DOC_DPS1_ADDRLOW		0x1064
11462306a36Sopenharmony_ci#define DOC_DPS1_ADDRHIGH		0x1066
11562306a36Sopenharmony_ci#define DOC_DPS0_STATUS			0x106c
11662306a36Sopenharmony_ci#define DOC_DPS1_STATUS			0x106e
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci#define DOC_ASICMODECONFIRM		0x1072
11962306a36Sopenharmony_ci#define DOC_CHIPID_INV			0x1074
12062306a36Sopenharmony_ci#define DOC_POWERMODE			0x107c
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci/*
12362306a36Sopenharmony_ci * Flash sequences
12462306a36Sopenharmony_ci * A sequence is preset before one or more commands are input to the chip.
12562306a36Sopenharmony_ci */
12662306a36Sopenharmony_ci#define DOC_SEQ_RESET			0x00
12762306a36Sopenharmony_ci#define DOC_SEQ_PAGE_SIZE_532		0x03
12862306a36Sopenharmony_ci#define DOC_SEQ_SET_FASTMODE		0x05
12962306a36Sopenharmony_ci#define DOC_SEQ_SET_RELIABLEMODE	0x09
13062306a36Sopenharmony_ci#define DOC_SEQ_READ			0x12
13162306a36Sopenharmony_ci#define DOC_SEQ_SET_PLANE1		0x0e
13262306a36Sopenharmony_ci#define DOC_SEQ_SET_PLANE2		0x10
13362306a36Sopenharmony_ci#define DOC_SEQ_PAGE_SETUP		0x1d
13462306a36Sopenharmony_ci#define DOC_SEQ_ERASE			0x27
13562306a36Sopenharmony_ci#define DOC_SEQ_PLANES_STATUS		0x31
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/*
13862306a36Sopenharmony_ci * Flash commands
13962306a36Sopenharmony_ci */
14062306a36Sopenharmony_ci#define DOC_CMD_READ_PLANE1		0x00
14162306a36Sopenharmony_ci#define DOC_CMD_SET_ADDR_READ		0x05
14262306a36Sopenharmony_ci#define DOC_CMD_READ_ALL_PLANES		0x30
14362306a36Sopenharmony_ci#define DOC_CMD_READ_PLANE2		0x50
14462306a36Sopenharmony_ci#define DOC_CMD_READ_FLASH		0xe0
14562306a36Sopenharmony_ci#define DOC_CMD_PAGE_SIZE_532		0x3c
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define DOC_CMD_PROG_BLOCK_ADDR		0x60
14862306a36Sopenharmony_ci#define DOC_CMD_PROG_CYCLE1		0x80
14962306a36Sopenharmony_ci#define DOC_CMD_PROG_CYCLE2		0x10
15062306a36Sopenharmony_ci#define DOC_CMD_PROG_CYCLE3		0x11
15162306a36Sopenharmony_ci#define DOC_CMD_ERASECYCLE2		0xd0
15262306a36Sopenharmony_ci#define DOC_CMD_READ_STATUS		0x70
15362306a36Sopenharmony_ci#define DOC_CMD_PLANES_STATUS		0x71
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci#define DOC_CMD_RELIABLE_MODE		0x22
15662306a36Sopenharmony_ci#define DOC_CMD_FAST_MODE		0xa2
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define DOC_CMD_RESET			0xff
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/*
16162306a36Sopenharmony_ci * Flash register : DOC_FLASHCONTROL
16262306a36Sopenharmony_ci */
16362306a36Sopenharmony_ci#define DOC_CTRL_VIOLATION		0x20
16462306a36Sopenharmony_ci#define DOC_CTRL_CE			0x10
16562306a36Sopenharmony_ci#define DOC_CTRL_UNKNOWN_BITS		0x08
16662306a36Sopenharmony_ci#define DOC_CTRL_PROTECTION_ERROR	0x04
16762306a36Sopenharmony_ci#define DOC_CTRL_SEQUENCE_ERROR		0x02
16862306a36Sopenharmony_ci#define DOC_CTRL_FLASHREADY		0x01
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci/*
17162306a36Sopenharmony_ci * Flash register : DOC_ASICMODE
17262306a36Sopenharmony_ci */
17362306a36Sopenharmony_ci#define DOC_ASICMODE_RESET		0x00
17462306a36Sopenharmony_ci#define DOC_ASICMODE_NORMAL		0x01
17562306a36Sopenharmony_ci#define DOC_ASICMODE_POWERDOWN		0x02
17662306a36Sopenharmony_ci#define DOC_ASICMODE_MDWREN		0x04
17762306a36Sopenharmony_ci#define DOC_ASICMODE_BDETCT_RESET	0x08
17862306a36Sopenharmony_ci#define DOC_ASICMODE_RSTIN_RESET	0x10
17962306a36Sopenharmony_ci#define DOC_ASICMODE_RAM_WE		0x20
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci/*
18262306a36Sopenharmony_ci * Flash register : DOC_ECCCONF0
18362306a36Sopenharmony_ci */
18462306a36Sopenharmony_ci#define DOC_ECCCONF0_WRITE_MODE		0x0000
18562306a36Sopenharmony_ci#define DOC_ECCCONF0_READ_MODE		0x8000
18662306a36Sopenharmony_ci#define DOC_ECCCONF0_AUTO_ECC_ENABLE	0x4000
18762306a36Sopenharmony_ci#define DOC_ECCCONF0_HAMMING_ENABLE	0x1000
18862306a36Sopenharmony_ci#define DOC_ECCCONF0_BCH_ENABLE		0x0800
18962306a36Sopenharmony_ci#define DOC_ECCCONF0_DATA_BYTES_MASK	0x07ff
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci/*
19262306a36Sopenharmony_ci * Flash register : DOC_ECCCONF1
19362306a36Sopenharmony_ci */
19462306a36Sopenharmony_ci#define DOC_ECCCONF1_BCH_SYNDROM_ERR	0x80
19562306a36Sopenharmony_ci#define DOC_ECCCONF1_UNKOWN1		0x40
19662306a36Sopenharmony_ci#define DOC_ECCCONF1_PAGE_IS_WRITTEN	0x20
19762306a36Sopenharmony_ci#define DOC_ECCCONF1_UNKOWN3		0x10
19862306a36Sopenharmony_ci#define DOC_ECCCONF1_HAMMING_BITS_MASK	0x0f
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci/*
20162306a36Sopenharmony_ci * Flash register : DOC_PROTECTION
20262306a36Sopenharmony_ci */
20362306a36Sopenharmony_ci#define DOC_PROTECT_FOUNDRY_OTP_LOCK	0x01
20462306a36Sopenharmony_ci#define DOC_PROTECT_CUSTOMER_OTP_LOCK	0x02
20562306a36Sopenharmony_ci#define DOC_PROTECT_LOCK_INPUT		0x04
20662306a36Sopenharmony_ci#define DOC_PROTECT_STICKY_LOCK		0x08
20762306a36Sopenharmony_ci#define DOC_PROTECT_PROTECTION_ENABLED	0x10
20862306a36Sopenharmony_ci#define DOC_PROTECT_IPL_DOWNLOAD_LOCK	0x20
20962306a36Sopenharmony_ci#define DOC_PROTECT_PROTECTION_ERROR	0x80
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci/*
21262306a36Sopenharmony_ci * Flash register : DOC_DPS0_STATUS and DOC_DPS1_STATUS
21362306a36Sopenharmony_ci */
21462306a36Sopenharmony_ci#define DOC_DPS_OTP_PROTECTED		0x01
21562306a36Sopenharmony_ci#define DOC_DPS_READ_PROTECTED		0x02
21662306a36Sopenharmony_ci#define DOC_DPS_WRITE_PROTECTED		0x04
21762306a36Sopenharmony_ci#define DOC_DPS_HW_LOCK_ENABLED		0x08
21862306a36Sopenharmony_ci#define DOC_DPS_KEY_OK			0x80
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci/*
22162306a36Sopenharmony_ci * Flash register : DOC_CONFIGURATION
22262306a36Sopenharmony_ci */
22362306a36Sopenharmony_ci#define DOC_CONF_IF_CFG			0x80
22462306a36Sopenharmony_ci#define DOC_CONF_MAX_ID_MASK		0x30
22562306a36Sopenharmony_ci#define DOC_CONF_VCCQ_3V		0x01
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ci/*
22862306a36Sopenharmony_ci * Flash register : DOC_READADDRESS
22962306a36Sopenharmony_ci */
23062306a36Sopenharmony_ci#define DOC_READADDR_INC		0x8000
23162306a36Sopenharmony_ci#define DOC_READADDR_ONE_BYTE		0x4000
23262306a36Sopenharmony_ci#define DOC_READADDR_ADDR_MASK		0x1fff
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci/*
23562306a36Sopenharmony_ci * Flash register : DOC_POWERMODE
23662306a36Sopenharmony_ci */
23762306a36Sopenharmony_ci#define DOC_POWERDOWN_READY		0x80
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci/*
24062306a36Sopenharmony_ci * Status of erase and write operation
24162306a36Sopenharmony_ci */
24262306a36Sopenharmony_ci#define DOC_PLANES_STATUS_FAIL		0x01
24362306a36Sopenharmony_ci#define DOC_PLANES_STATUS_PLANE0_KO	0x02
24462306a36Sopenharmony_ci#define DOC_PLANES_STATUS_PLANE1_KO	0x04
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci/*
24762306a36Sopenharmony_ci * DPS key management
24862306a36Sopenharmony_ci *
24962306a36Sopenharmony_ci * Each floor of docg3 has 2 protection areas: DPS0 and DPS1. These areas span
25062306a36Sopenharmony_ci * across block boundaries, and define whether these blocks can be read or
25162306a36Sopenharmony_ci * written.
25262306a36Sopenharmony_ci * The definition is dynamically stored in page 0 of blocks (2,3) for DPS0, and
25362306a36Sopenharmony_ci * page 0 of blocks (4,5) for DPS1.
25462306a36Sopenharmony_ci */
25562306a36Sopenharmony_ci#define DOC_LAYOUT_DPS_KEY_LENGTH	8
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci/**
25862306a36Sopenharmony_ci * struct docg3_cascade - Cascade of 1 to 4 docg3 chips
25962306a36Sopenharmony_ci * @floors: floors (ie. one physical docg3 chip is one floor)
26062306a36Sopenharmony_ci * @base: IO space to access all chips in the cascade
26162306a36Sopenharmony_ci * @bch: the BCH correcting control structure
26262306a36Sopenharmony_ci * @lock: lock to protect docg3 IO space from concurrent accesses
26362306a36Sopenharmony_ci */
26462306a36Sopenharmony_cistruct docg3_cascade {
26562306a36Sopenharmony_ci	struct mtd_info *floors[DOC_MAX_NBFLOORS];
26662306a36Sopenharmony_ci	void __iomem *base;
26762306a36Sopenharmony_ci	struct bch_control *bch;
26862306a36Sopenharmony_ci	struct mutex lock;
26962306a36Sopenharmony_ci};
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci/**
27262306a36Sopenharmony_ci * struct docg3 - DiskOnChip driver private data
27362306a36Sopenharmony_ci * @dev: the device currently under control
27462306a36Sopenharmony_ci * @cascade: the cascade this device belongs to
27562306a36Sopenharmony_ci * @device_id: number of the cascaded DoCG3 device (0, 1, 2 or 3)
27662306a36Sopenharmony_ci * @if_cfg: if true, reads are on 16bits, else reads are on 8bits
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci * @reliable: if 0, docg3 in normal mode, if 1 docg3 in fast mode, if 2 in
27962306a36Sopenharmony_ci *            reliable mode
28062306a36Sopenharmony_ci *            Fast mode implies more errors than normal mode.
28162306a36Sopenharmony_ci *            Reliable mode implies that page 2*n and 2*n+1 are clones.
28262306a36Sopenharmony_ci * @bbt: bad block table cache
28362306a36Sopenharmony_ci * @oob_write_ofs: offset of the MTD where this OOB should belong (ie. in next
28462306a36Sopenharmony_ci *                 page_write)
28562306a36Sopenharmony_ci * @oob_autoecc: if 1, use only bytes 0-7, 15, and fill the others with HW ECC
28662306a36Sopenharmony_ci *               if 0, use all the 16 bytes.
28762306a36Sopenharmony_ci * @oob_write_buf: prepared OOB for next page_write
28862306a36Sopenharmony_ci */
28962306a36Sopenharmony_cistruct docg3 {
29062306a36Sopenharmony_ci	struct device *dev;
29162306a36Sopenharmony_ci	struct docg3_cascade *cascade;
29262306a36Sopenharmony_ci	unsigned int device_id:4;
29362306a36Sopenharmony_ci	unsigned int if_cfg:1;
29462306a36Sopenharmony_ci	unsigned int reliable:2;
29562306a36Sopenharmony_ci	int max_block;
29662306a36Sopenharmony_ci	u8 *bbt;
29762306a36Sopenharmony_ci	loff_t oob_write_ofs;
29862306a36Sopenharmony_ci	int oob_autoecc;
29962306a36Sopenharmony_ci	u8 oob_write_buf[DOC_LAYOUT_OOB_SIZE];
30062306a36Sopenharmony_ci};
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci#define doc_err(fmt, arg...) dev_err(docg3->dev, (fmt), ## arg)
30362306a36Sopenharmony_ci#define doc_info(fmt, arg...) dev_info(docg3->dev, (fmt), ## arg)
30462306a36Sopenharmony_ci#define doc_dbg(fmt, arg...) dev_dbg(docg3->dev, (fmt), ## arg)
30562306a36Sopenharmony_ci#define doc_vdbg(fmt, arg...) dev_vdbg(docg3->dev, (fmt), ## arg)
30662306a36Sopenharmony_ci#endif
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci/*
30962306a36Sopenharmony_ci * Trace events part
31062306a36Sopenharmony_ci */
31162306a36Sopenharmony_ci#undef TRACE_SYSTEM
31262306a36Sopenharmony_ci#define TRACE_SYSTEM docg3
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci#if !defined(_MTD_DOCG3_TRACE) || defined(TRACE_HEADER_MULTI_READ)
31562306a36Sopenharmony_ci#define _MTD_DOCG3_TRACE
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci#include <linux/tracepoint.h>
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ciTRACE_EVENT(docg3_io,
32062306a36Sopenharmony_ci	    TP_PROTO(int op, int width, u16 reg, int val),
32162306a36Sopenharmony_ci	    TP_ARGS(op, width, reg, val),
32262306a36Sopenharmony_ci	    TP_STRUCT__entry(
32362306a36Sopenharmony_ci		    __field(int, op)
32462306a36Sopenharmony_ci		    __field(unsigned char, width)
32562306a36Sopenharmony_ci		    __field(u16, reg)
32662306a36Sopenharmony_ci		    __field(int, val)),
32762306a36Sopenharmony_ci	    TP_fast_assign(
32862306a36Sopenharmony_ci		    __entry->op = op;
32962306a36Sopenharmony_ci		    __entry->width = width;
33062306a36Sopenharmony_ci		    __entry->reg = reg;
33162306a36Sopenharmony_ci		    __entry->val = val;),
33262306a36Sopenharmony_ci	    TP_printk("docg3: %s%02d reg=%04x, val=%04x",
33362306a36Sopenharmony_ci		      __entry->op ? "write" : "read", __entry->width,
33462306a36Sopenharmony_ci		      __entry->reg, __entry->val)
33562306a36Sopenharmony_ci	);
33662306a36Sopenharmony_ci#endif
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci/* This part must be outside protection */
33962306a36Sopenharmony_ci#undef TRACE_INCLUDE_PATH
34062306a36Sopenharmony_ci#undef TRACE_INCLUDE_FILE
34162306a36Sopenharmony_ci#define TRACE_INCLUDE_PATH .
34262306a36Sopenharmony_ci#define TRACE_INCLUDE_FILE docg3
34362306a36Sopenharmony_ci#include <trace/define_trace.h>
344