18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * OMAP Crypto driver common support routines.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2017 Texas Instruments Incorporated
68c2ecf20Sopenharmony_ci *   Tero Kristo <t-kristo@ti.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __CRYPTO_OMAP_CRYPTO_H
108c2ecf20Sopenharmony_ci#define __CRYPTO_OMAP_CRYPTO_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cienum {
138c2ecf20Sopenharmony_ci	OMAP_CRYPTO_NOT_ALIGNED = 1,
148c2ecf20Sopenharmony_ci	OMAP_CRYPTO_BAD_DATA_LENGTH,
158c2ecf20Sopenharmony_ci};
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define OMAP_CRYPTO_DATA_COPIED		BIT(0)
188c2ecf20Sopenharmony_ci#define OMAP_CRYPTO_SG_COPIED		BIT(1)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define OMAP_CRYPTO_COPY_MASK		0x3
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define OMAP_CRYPTO_COPY_DATA		BIT(0)
238c2ecf20Sopenharmony_ci#define OMAP_CRYPTO_FORCE_COPY		BIT(1)
248c2ecf20Sopenharmony_ci#define OMAP_CRYPTO_ZERO_BUF		BIT(2)
258c2ecf20Sopenharmony_ci#define OMAP_CRYPTO_FORCE_SINGLE_ENTRY	BIT(3)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciint omap_crypto_align_sg(struct scatterlist **sg, int total, int bs,
288c2ecf20Sopenharmony_ci			 struct scatterlist *new_sg, u16 flags,
298c2ecf20Sopenharmony_ci			 u8 flags_shift, unsigned long *dd_flags);
308c2ecf20Sopenharmony_civoid omap_crypto_cleanup(struct scatterlist *sg, struct scatterlist *orig,
318c2ecf20Sopenharmony_ci			 int offset, int len, u8 flags_shift,
328c2ecf20Sopenharmony_ci			 unsigned long flags);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif
35