162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * OMAP Crypto driver common support routines.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2017 Texas Instruments Incorporated
662306a36Sopenharmony_ci *   Tero Kristo <t-kristo@ti.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __CRYPTO_OMAP_CRYPTO_H
1062306a36Sopenharmony_ci#define __CRYPTO_OMAP_CRYPTO_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cienum {
1362306a36Sopenharmony_ci	OMAP_CRYPTO_NOT_ALIGNED = 1,
1462306a36Sopenharmony_ci	OMAP_CRYPTO_BAD_DATA_LENGTH,
1562306a36Sopenharmony_ci};
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define OMAP_CRYPTO_DATA_COPIED		BIT(0)
1862306a36Sopenharmony_ci#define OMAP_CRYPTO_SG_COPIED		BIT(1)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define OMAP_CRYPTO_COPY_MASK		0x3
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define OMAP_CRYPTO_COPY_DATA		BIT(0)
2362306a36Sopenharmony_ci#define OMAP_CRYPTO_FORCE_COPY		BIT(1)
2462306a36Sopenharmony_ci#define OMAP_CRYPTO_ZERO_BUF		BIT(2)
2562306a36Sopenharmony_ci#define OMAP_CRYPTO_FORCE_SINGLE_ENTRY	BIT(3)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciint omap_crypto_align_sg(struct scatterlist **sg, int total, int bs,
2862306a36Sopenharmony_ci			 struct scatterlist *new_sg, u16 flags,
2962306a36Sopenharmony_ci			 u8 flags_shift, unsigned long *dd_flags);
3062306a36Sopenharmony_civoid omap_crypto_cleanup(struct scatterlist *sg, struct scatterlist *orig,
3162306a36Sopenharmony_ci			 int offset, int len, u8 flags_shift,
3262306a36Sopenharmony_ci			 unsigned long flags);
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#endif
35