crypto: rockchip: permit to pass self-tests
Subsystems (4)
Corentin Labbe
maintainerv2 cover crypto: rockchip: permit to pass self-tests
Hello
The rockchip crypto driver is broken and do not pass self-tests. This serie's goal is to permit to become usable and pass self-tests.
This whole serie is tested on a rk3328-rock64 with selftests (with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y)
Regards
Changes since v1:
- select CRYPTO_ENGINE
- forgot to free fallbacks TFMs
- fixed kernel test robots warning
- add the PM patch
Corentin Labbe (18):
crypto: rockchip: use dev_err for error message about interrupt
crypto: rockchip: do not use uninit variable
crypto: rockchip: do not do custom power management
crypto: rockchip: fix privete/private typo
crypto: rockchip: do not store mode globally
crypto: rockchip: add fallback for cipher
crypto: rockchip: add fallback for ahash
crypto: rockchip: better handle cipher key
crypto: rockchip: remove non-aligned handling
crypto: rockchip: rework by using crypto_engine
crypto: rockhip: do not handle dma clock
ARM: dts: rk3288: crypto do not need dma clock
crypto: rockchip: rewrite type
crypto: rockchip: add debugfs
crypto: rockchip: introduce PM
arm64: dts: rockchip: add rk3328 crypto node
dt-bindings: crypto: convert rockchip-crypto to yaml
crypto: rockchip: add myself as maintainer
.../crypto/rockchip,rk3288-crypto.yaml | 64 +++ .../bindings/crypto/rockchip-crypto.txt | 28 -- MAINTAINERS | 6 + arch/arm/boot/dts/rk3288.dtsi | 4 +- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 11 + drivers/crypto/Kconfig | 12 + drivers/crypto/rockchip/rk3288_crypto.c | 307 +++++------- drivers/crypto/rockchip/rk3288_crypto.h | 69 ++- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 222 +++++---- .../crypto/rockchip/rk3288_crypto_skcipher.c | 452 +++++++++++------- 10 files changed, 648 insertions(+), 527 deletions(-) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml delete mode 100644 Documentation/devicetree/bindings/crypto/rockchip-crypto.txt
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 1/18 crypto: rockchip: use dev_err for error message about interrupt
Interrupt is mandatory so the message should be printed as error.
--- drivers/crypto/rockchip/rk3288_crypto.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.c +1 -2
@@ -371,8 +371,7 @@ static int rk_crypto_probe(struct platform_device *pdev) crypto_info->irq =platform_get_irq (pdev,0 );if (crypto_info->irq <0 ) { -dev_warn (crypto_info->dev, -"control Interrupt is not available.\n" ); +dev_err (&pdev->dev,"control Interrupt is not available.\n" ); err = crypto_info->irq; goto err_crypto; }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 2/18 crypto: rockchip: do not use uninit variable
In reply to Corentin Labbecrypto_info->dev is not yet set, so use pdev-dev instead.
--- drivers/crypto/rockchip/rk3288_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/rockchip/rk3288_crypto.c +1 -1
@@ -381,7 +381,7 @@ static int rk_crypto_probe(struct platform_device *pdev) "rk-crypto", pdev);if (err) { -dev_err (crypto_info->dev,"irq request failed.\n" ); +dev_err (&pdev->dev,"irq request failed.\n" ); goto err_crypto; }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 3/18 crypto: rockchip: do not do custom power management
In reply to Corentin LabbeThe clock enable/disable at tfm init/exit is fragile, if 2 tfm are init in the same time and one is removed just after, it will leave the hardware uncloked even if a user remains.
Instead simply enable clocks at probe time.
We will do PM later.
--- drivers/crypto/rockchip/rk3288_crypto.c | 4 ++-- drivers/crypto/rockchip/rk3288_crypto.h | 2 -- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 3 +-- drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 5 +++-- 4 files changed, 6 insertions(+), 8 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.c +2 -2
@@ -394,8 +394,7 @@ static int rk_crypto_probe(struct platform_device *pdev) rk_crypto_done_task_cb, (unsigned long)crypto_info);crypto_init_queue (&crypto_info->queue,50 ); - crypto_info->enable_clk = rk_crypto_enable_clk; - crypto_info->disable_clk = rk_crypto_disable_clk; +rk_crypto_enable_clk (crypto_info); crypto_info->load_data = rk_load_data; crypto_info->unload_data = rk_unload_data; crypto_info->enqueue = rk_crypto_enqueue;
@@ -422,6 +421,7 @@ static int rk_crypto_remove(struct platform_device *pdev)struct rk_crypto_info *crypto_tmp =platform_get_drvdata (pdev);rk_crypto_unregister (); +rk_crypto_disable_clk (crypto_tmp);tasklet_kill (&crypto_tmp->done_task);tasklet_kill (&crypto_tmp->queue_task);return 0 ;
drivers/crypto/rockchip/rk3288_crypto.h +0 -2
@@ -220,8 +220,6 @@ struct rk_crypto_info {int (*start)(struct rk_crypto_info *dev);int (*update)(struct rk_crypto_info *dev);void (*complete)(struct crypto_async_request *base,int err); -int (*enable_clk)(struct rk_crypto_info *dev); -void (*disable_clk)(struct rk_crypto_info *dev);int (*load_data)(struct rk_crypto_info *dev,struct scatterlist *sg_src,struct scatterlist *sg_dst);
drivers/crypto/rockchip/rk3288_crypto_ahash.c +1 -2
@@ -301,7 +301,7 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm)sizeof (struct rk_ahash_rctx ) + crypto_ahash_reqsize(tctx->fallback_tfm)); -return tctx->dev->enable_clk (tctx->dev); +return 0 ; }static void rk_cra_hash_exit (struct crypto_tfm *tfm)
@@ -309,7 +309,6 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm);free_page ((unsigned long )tctx->dev->addr_vir); -return tctx->dev->disable_clk (tctx->dev); }struct rk_crypto_tmp rk_ahash_sha1 = {
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +3 -2
@@ -388,8 +388,10 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm) ctx->dev->update = rk_ablk_rx; ctx->dev->complete = rk_crypto_complete; ctx->dev->addr_vir = (char *)__get_free_page (GFP_KERNEL ); +if (!ctx->dev->addr_vir) +return -ENOMEM ; -return ctx->dev->addr_vir ? ctx->dev->enable_clk (ctx->dev) : -ENOMEM ; +return 0 ; }static void rk_ablk_exit_tfm (struct crypto_skcipher *tfm)
@@ -397,7 +399,6 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)struct rk_cipher_ctx *ctx =crypto_skcipher_ctx (tfm);free_page ((unsigned long )ctx->dev->addr_vir); - ctx->dev->disable_clk (ctx->dev); }struct rk_crypto_tmp rk_ecb_aes_alg = {
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 4/18 crypto: rockchip: fix privete/private typo
In reply to Corentin LabbeThis fix a simple typo on private word.
--- drivers/crypto/rockchip/rk3288_crypto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/rockchip/rk3288_crypto.h +1 -1
@@ -235,7 +235,7 @@ struct rk_ahash_ctx {struct crypto_ahash *fallback_tfm; }; -/* the privete variable of hash for fallback */ +/* the private variable of hash for fallback */ struct rk_ahash_rctx {struct ahash_request fallback_req;u32 mode;
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 6/18 crypto: rockchip: add fallback for cipher
In reply to Corentin LabbeThe hardware does not handle 0 size length request, let's add a fallback.
Furthermore fallback will be used for all unaligned case the hardware cannot handle.
--- drivers/crypto/rockchip/rk3288_crypto.h | 2 + .../crypto/rockchip/rk3288_crypto_skcipher.c | 97 ++++++++++++++++--- 2 files changed, 86 insertions(+), 13 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.h +2 -0
@@ -246,10 +246,12 @@ struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen;u8 iv[AES_BLOCK_SIZE ]; +struct crypto_skcipher *fallback_tfm; };struct rk_cipher_rctx {u32 mode; +struct skcipher_request fallback_req;// keep at the end };enum alg_type {
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +84 -13
181 lines not on this page · raw message
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 5/18 crypto: rockchip: do not store mode globally
In reply to Corentin LabbeStoring the mode globally does not work if 2 requests are handled in the same time.
We should store it in a request context.
--- drivers/crypto/rockchip/rk3288_crypto.h | 5 +- .../crypto/rockchip/rk3288_crypto_skcipher.c | 58 ++++++++++++------- 2 files changed, 41 insertions(+), 22 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.h +4 -1
@@ -245,10 +245,13 @@ struct rk_ahash_rctx {struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen; -u32 mode;u8 iv[AES_BLOCK_SIZE ]; }; +struct rk_cipher_rctx { +u32 mode; +}; +enum alg_type {ALG_TYPE_HASH ,ALG_TYPE_CIPHER ,
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +37 -21
208 lines not on this page · raw message
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 7/18 crypto: rockchip: add fallback for ahash
In reply to Corentin LabbeAdds a fallback for all case hardware cannot handle.
--- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/crypto/rockchip/rk3288_crypto_ahash.c +38 -0
@@ -16,6 +16,40 @@* so we put the fixed hash out when met zero message. */ +static bool rk_ahash_need_fallback (struct ahash_request *req) +{ +struct scatterlist *sg; + + sg = req->src; +while (sg) { +if (!IS_ALIGNED (sg->offset,sizeof (u32))) { +return true; + } +if (sg->length %4 ) { +return true; + } + sg =sg_next (sg); + } +return false; +} + +static int rk_ahash_digest_fb (struct ahash_request *areq) +{ +struct rk_ahash_rctx *rctx =ahash_request_ctx (areq); +struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq); +struct rk_ahash_ctx *tfmctx =crypto_ahash_ctx (tfm); + +ahash_request_set_tfm (&rctx->fallback_req, tfmctx->fallback_tfm); + rctx->fallback_req.base.flags = areq->base.flags & +CRYPTO_TFM_REQ_MAY_SLEEP ; + + rctx->fallback_req.nbytes = areq->nbytes; + rctx->fallback_req.src = areq->src; + rctx->fallback_req.result = areq->result; + +return crypto_ahash_digest (&rctx->fallback_req); +} +static int zero_message_process (struct ahash_request *req) {struct crypto_ahash *tfm =crypto_ahash_reqtfm (req);
@@ -167,6 +201,9 @@ static int rk_ahash_digest(struct ahash_request *req)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (req->base.tfm);struct rk_crypto_info *dev = tctx->dev; +if (rk_ahash_need_fallback (req)) +return rk_ahash_digest_fb (req); +if (!req->nbytes)return zero_message_process (req);else
@@ -309,6 +346,7 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm);free_page ((unsigned long )tctx->dev->addr_vir); +crypto_free_ahash (tctx->fallback_tfm); }struct rk_crypto_tmp rk_ahash_sha1 = {
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 8/18 crypto: rockchip: better handle cipher key
In reply to Corentin LabbeThe key should not be set in hardware too much in advance, this will fail it 2 TFM with different keys generate alternative requests. The key should be stored and used just before doing cipher operations.
--- drivers/crypto/rockchip/rk3288_crypto.h | 1 + drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.h +1 -0
@@ -245,6 +245,7 @@ struct rk_ahash_rctx {struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen; +u32 key[AES_MAX_KEY_SIZE /4 ];u8 iv[AES_BLOCK_SIZE ];struct crypto_skcipher *fallback_tfm; };
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +7 -3
@@ -95,7 +95,7 @@ static int rk_aes_setkey(struct crypto_skcipher *cipher, keylen != AES_KEYSIZE_256)return -EINVAL ; ctx->keylen = keylen; -memcpy_toio (ctx->dev->reg +RK_CRYPTO_AES_KEY_0 , key, keylen); +memcpy (ctx->key, key, keylen);return crypto_skcipher_setkey (ctx->fallback_tfm, key, keylen); }
@@ -111,7 +111,7 @@ static int rk_des_setkey(struct crypto_skcipher *cipher,return err; ctx->keylen = keylen; -memcpy_toio (ctx->dev->reg +RK_CRYPTO_TDES_KEY1_0 , key, keylen); +memcpy (ctx->key, key, keylen);return crypto_skcipher_setkey (ctx->fallback_tfm, key, keylen); }
@@ -127,7 +127,8 @@ static int rk_tdes_setkey(struct crypto_skcipher *cipher,return err; ctx->keylen = keylen; -memcpy_toio (ctx->dev->reg +RK_CRYPTO_TDES_KEY1_0 , key, keylen); +memcpy (ctx->key, key, keylen); +return crypto_skcipher_setkey (ctx->fallback_tfm, key, keylen); }
@@ -283,6 +284,7 @@ static void rk_ablk_hw_init(struct rk_crypto_info *dev)RK_CRYPTO_TDES_BYTESWAP_IV ;CRYPTO_WRITE (dev,RK_CRYPTO_TDES_CTRL , rctx->mode);memcpy_toio (dev->reg +RK_CRYPTO_TDES_IV_0 , req->iv, ivsize); +memcpy_toio (ctx->dev->reg +RK_CRYPTO_TDES_KEY1_0 , ctx->key, ctx->keylen); conf_reg =RK_CRYPTO_DESSEL ; }else { rctx->mode |= RK_CRYPTO_AES_FIFO_MODE |
@@ -295,6 +297,7 @@ static void rk_ablk_hw_init(struct rk_crypto_info *dev) rctx->mode |= RK_CRYPTO_AES_256BIT_key;CRYPTO_WRITE (dev,RK_CRYPTO_AES_CTRL , rctx->mode);memcpy_toio (dev->reg +RK_CRYPTO_AES_IV_0 , req->iv, ivsize); +memcpy_toio (ctx->dev->reg +RK_CRYPTO_AES_KEY_0 , ctx->key, ctx->keylen); } conf_reg |=RK_CRYPTO_BYTESWAP_BTFIFO |RK_CRYPTO_BYTESWAP_BRFIFO ;
@@ -484,6 +487,7 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm) {struct rk_cipher_ctx *ctx =crypto_skcipher_ctx (tfm); +memzero_explicit (ctx->key, ctx->keylen);free_page ((unsigned long )ctx->dev->addr_vir);crypto_free_skcipher (ctx->fallback_tfm); }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 9/18 crypto: rockchip: remove non-aligned handling
In reply to Corentin LabbeNow driver have fallback for un-aligned cases, remove all code handling those cases.
--- drivers/crypto/rockchip/rk3288_crypto.c | 69 +++++-------------- drivers/crypto/rockchip/rk3288_crypto.h | 4 -- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 22 ++---- .../crypto/rockchip/rk3288_crypto_skcipher.c | 39 +++-------- 4 files changed, 31 insertions(+), 103 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.c +16 -53
@@ -88,63 +88,26 @@ static int rk_load_data(struct rk_crypto_info *dev, {unsigned int count; - dev->aligned = dev->aligned ? -check_alignment (sg_src, sg_dst, dev->align_size) : - dev->aligned; -if (dev->aligned) { - count =min (dev->left_bytes, sg_src->length); - dev->left_bytes -= count; - -if (!dma_map_sg (dev->dev, sg_src,1 ,DMA_TO_DEVICE )) { -dev_err (dev->dev,"[%s:%d] dma_map_sg(src) error\n" , + count =min (dev->left_bytes, sg_src->length); + dev->left_bytes -= count; + +if (!dma_map_sg (dev->dev, sg_src,1 ,DMA_TO_DEVICE )) { +dev_err (dev->dev,"[%s:%d] dma_map_sg(src) error\n" , __func__, __LINE__); -return -EINVAL ; - } - dev->addr_in =sg_dma_address (sg_src); +return -EINVAL ; + } + dev->addr_in =sg_dma_address (sg_src); -if (sg_dst) { -if (!dma_map_sg (dev->dev, sg_dst,1 ,DMA_FROM_DEVICE )) { -dev_err (dev->dev, +if (sg_dst) { +if (!dma_map_sg (dev->dev, sg_dst,1 ,DMA_FROM_DEVICE )) { +dev_err (dev->dev,"[%s:%d] dma_map_sg(dst) error\n" , __func__, __LINE__); -dma_unmap_sg (dev->dev, sg_src,1 , -DMA_TO_DEVICE ); -return -EINVAL ; - } - dev->addr_out =sg_dma_address (sg_dst); - } - }else { - count = (dev->left_bytes >PAGE_SIZE ) ? -PAGE_SIZE : dev->left_bytes; - -if (!sg_pcopy_to_buffer (dev->first, dev->src_nents, - dev->addr_vir, count, - dev->total - dev->left_bytes)) { -dev_err (dev->dev,"[%s:%d] pcopy err\n" , - __func__, __LINE__); +dma_unmap_sg (dev->dev, sg_src,1 , +DMA_TO_DEVICE );return -EINVAL ; } - dev->left_bytes -= count; -sg_init_one (&dev->sg_tmp, dev->addr_vir, count); -if (!dma_map_sg (dev->dev, &dev->sg_tmp,1 ,DMA_TO_DEVICE )) { -dev_err (dev->dev,"[%s:%d] dma_map_sg(sg_tmp) error\n" , - __func__, __LINE__); -return -ENOMEM ; - } - dev->addr_in =sg_dma_address (&dev->sg_tmp); - -if (sg_dst) { -if (!dma_map_sg (dev->dev, &dev->sg_tmp,1 , -DMA_FROM_DEVICE )) { -dev_err (dev->dev, -"[%s:%d] dma_map_sg(sg_tmp) error\n" , - __func__, __LINE__); -dma_unmap_sg (dev->dev, &dev->sg_tmp,1 , -DMA_TO_DEVICE ); -return -ENOMEM ; - } - dev->addr_out =sg_dma_address (&dev->sg_tmp); - } + dev->addr_out =sg_dma_address (sg_dst); } dev->count = count;return 0 ;
@@ -154,11 +117,11 @@ static void rk_unload_data(struct rk_crypto_info *dev) {struct scatterlist *sg_in, *sg_out; - sg_in = dev->aligned ? dev->sg_src : &dev->sg_tmp; + sg_in = dev->sg_src;dma_unmap_sg (dev->dev, sg_in,1 ,DMA_TO_DEVICE );if (dev->sg_dst) { - sg_out = dev->aligned ? dev->sg_dst : &dev->sg_tmp; + sg_out = dev->sg_dst;dma_unmap_sg (dev->dev, sg_out,1 ,DMA_FROM_DEVICE ); } }
drivers/crypto/rockchip/rk3288_crypto.h +0 -4
@@ -204,12 +204,8 @@ struct rk_crypto_info {/* the public variable */ struct scatterlist *sg_src;struct scatterlist *sg_dst; -struct scatterlist sg_tmp;struct scatterlist *first;unsigned int left_bytes; -void *addr_vir; -int aligned; -int align_size;size_t src_nents;size_t dst_nents;unsigned int total;
drivers/crypto/rockchip/rk3288_crypto_ahash.c +6 -16
@@ -236,8 +236,6 @@ static int rk_ahash_start(struct rk_crypto_info *dev) dev->total = req->nbytes; dev->left_bytes = req->nbytes; - dev->aligned =0 ; - dev->align_size =4 ; dev->sg_dst =NULL ; dev->sg_src = req->src; dev->first = req->src;
@@ -272,15 +270,13 @@ static int rk_ahash_crypto_rx(struct rk_crypto_info *dev) dev->unload_data (dev);if (dev->left_bytes) { -if (dev->aligned) { -if (sg_is_last (dev->sg_src)) { -dev_warn (dev->dev,"[%s:%d], Lack of data\n" , - __func__, __LINE__); - err = -ENOMEM ; - goto out_rx; - } - dev->sg_src =sg_next (dev->sg_src); +if (sg_is_last (dev->sg_src)) { +dev_warn (dev->dev,"[%s:%d], Lack of data\n" , + __func__, __LINE__); + err = -ENOMEM ; + goto out_rx; } + dev->sg_src =sg_next (dev->sg_src); err =rk_ahash_set_data_start (dev); }else {/*
@@ -318,11 +314,6 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm) algt = container_of(alg, struct rk_crypto_tmp, alg.hash); tctx->dev = algt->dev; - tctx->dev->addr_vir = (void *)__get_free_page (GFP_KERNEL ); -if (!tctx->dev->addr_vir) { -dev_err (tctx->dev->dev,"failed to kmalloc for addr_vir\n" ); -return -ENOMEM ; - } tctx->dev->start = rk_ahash_start; tctx->dev->update = rk_ahash_crypto_rx; tctx->dev->complete = rk_ahash_crypto_complete;
@@ -345,7 +336,6 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm) {struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm); -free_page ((unsigned long )tctx->dev->addr_vir);crypto_free_ahash (tctx->fallback_tfm); }
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +9 -30
@@ -356,7 +356,6 @@ static int rk_ablk_start(struct rk_crypto_info *dev) dev->src_nents =sg_nents (req->src); dev->sg_dst = req->dst; dev->dst_nents =sg_nents (req->dst); - dev->aligned =1 ;spin_lock_irqsave (&dev->lock, flags);rk_ablk_hw_init (dev);
@@ -376,13 +375,9 @@ static void rk_iv_copyback(struct rk_crypto_info *dev)/* Update the IV buffer to contain the next IV for encryption mode. */ if (!(rctx->mode &RK_CRYPTO_DEC )) { -if (dev->aligned) { -memcpy (req->iv,sg_virt (dev->sg_dst) + - dev->sg_dst->length - ivsize, ivsize); - }else { -memcpy (req->iv, dev->addr_vir + - dev->count - ivsize, ivsize); - } +memcpy (req->iv, +sg_virt (dev->sg_dst) + dev->sg_dst->length - ivsize, + ivsize); } }
@@ -420,27 +415,16 @@ static int rk_ablk_rx(struct rk_crypto_info *dev)skcipher_request_cast (dev->async_req); dev->unload_data (dev); -if (!dev->aligned) { -if (!sg_pcopy_from_buffer (req->dst, dev->dst_nents, - dev->addr_vir, dev->count, - dev->total - dev->left_bytes - - dev->count)) { - err = -EINVAL ; - goto out_rx; - } - }if (dev->left_bytes) {rk_update_iv (dev); -if (dev->aligned) { -if (sg_is_last (dev->sg_src)) { -dev_err (dev->dev,"[%s:%d] Lack of data\n" , +if (sg_is_last (dev->sg_src)) { +dev_err (dev->dev,"[%s:%d] Lack of data\n" , __func__, __LINE__); - err = -ENOMEM ; - goto out_rx; - } - dev->sg_src =sg_next (dev->sg_src); - dev->sg_dst =sg_next (dev->sg_dst); + err = -ENOMEM ; + goto out_rx; } + dev->sg_src =sg_next (dev->sg_src); + dev->sg_dst =sg_next (dev->sg_dst); err =rk_set_data_start (dev); }else {rk_iv_copyback (dev);
@@ -462,13 +446,9 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm) algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher); ctx->dev = algt->dev; - ctx->dev->align_size =crypto_tfm_alg_alignmask (crypto_skcipher_tfm (tfm)) +1 ; ctx->dev->start = rk_ablk_start; ctx->dev->update = rk_ablk_rx; ctx->dev->complete = rk_crypto_complete; - ctx->dev->addr_vir = (char *)__get_free_page (GFP_KERNEL ); -if (!ctx->dev->addr_vir) -return -ENOMEM ; ctx->fallback_tfm =crypto_alloc_skcipher (name,0 ,CRYPTO_ALG_NEED_FALLBACK );if (IS_ERR (ctx->fallback_tfm)) {
@@ -488,7 +468,6 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)struct rk_cipher_ctx *ctx =crypto_skcipher_ctx (tfm);memzero_explicit (ctx->key, ctx->keylen); -free_page ((unsigned long )ctx->dev->addr_vir);crypto_free_skcipher (ctx->fallback_tfm); }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 11/18 crypto: rockhip: do not handle dma clock
In reply to Corentin LabbeThe DMA clock is handled by the DMA controller, so the crypto does not have to touch it.
--- drivers/crypto/rockchip/rk3288_crypto.c | 16 +--------------- drivers/crypto/rockchip/rk3288_crypto.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.c +1 -15
@@ -40,15 +40,8 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev) __func__, __LINE__); goto err_hclk; } - err =clk_prepare_enable (dev->dmaclk); -if (err) { -dev_err (dev->dev,"[%s:%d], Couldn't enable clock dmaclk\n" , - __func__, __LINE__); - goto err_dmaclk; - } +return err; -err_dmaclk: -clk_disable_unprepare (dev->hclk); err_hclk:clk_disable_unprepare (dev->aclk); err_aclk:
@@ -59,7 +52,6 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev)static void rk_crypto_disable_clk (struct rk_crypto_info *dev) { -clk_disable_unprepare (dev->dmaclk);clk_disable_unprepare (dev->hclk);clk_disable_unprepare (dev->aclk);clk_disable_unprepare (dev->sclk);
@@ -199,12 +191,6 @@ static int rk_crypto_probe(struct platform_device *pdev) goto err_crypto; } - crypto_info->dmaclk =devm_clk_get (&pdev->dev,"apb_pclk" ); -if (IS_ERR (crypto_info->dmaclk)) { - err =PTR_ERR (crypto_info->dmaclk); - goto err_crypto; - } - crypto_info->irq =platform_get_irq (pdev,0 );if (crypto_info->irq <0 ) {dev_err (&pdev->dev,"control Interrupt is not available.\n" );
drivers/crypto/rockchip/rk3288_crypto.h +0 -1
@@ -191,7 +191,6 @@ struct rk_crypto_info {struct clk *aclk;struct clk *hclk;struct clk *sclk; -struct clk *dmaclk;struct reset_control *rst;void __iomem *reg;int irq;
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 10/18 crypto: rockchip: rework by using crypto_engine
In reply to Corentin LabbeInstead of doing manual queue management, let's use the crypto/engine for that.
In the same time, rework the requests handling to be easier to understand (and fix all bugs related to them).
--- drivers/crypto/Kconfig | 1 + drivers/crypto/rockchip/rk3288_crypto.c | 150 +---------- drivers/crypto/rockchip/rk3288_crypto.h | 39 +-- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 144 +++++----- .../crypto/rockchip/rk3288_crypto_skcipher.c | 252 +++++++++--------- 5 files changed, 221 insertions(+), 365 deletions(-)
drivers/crypto/Kconfig +1 -0
@@ -785,6 +785,7 @@ config CRYPTO_DEV_ROCKCHIP tristate "Rockchip's Cryptographic Engine driver" depends on OF && ARCH_ROCKCHIP select CRYPTO_AES + select CRYPTO_ENGINE select CRYPTO_LIB_DES select CRYPTO_MD5 select CRYPTO_SHA1
drivers/crypto/rockchip/rk3288_crypto.c +7 -143
198 lines not on this page · raw message
drivers/crypto/rockchip/rk3288_crypto.h +10 -29
@@ -5,9 +5,11 @@#include <crypto/aes.h> #include <crypto/internal/des.h> #include <crypto/algapi.h> +#include <linux/dma-mapping.h> #include <linux/interrupt.h> #include <linux/delay.h> #include <linux/scatterlist.h> +#include <crypto/engine.h> #include <crypto/internal/hash.h> #include <crypto/internal/skcipher.h>
@@ -193,39 +195,15 @@ struct rk_crypto_info {struct reset_control *rst;void __iomem *reg;int irq; -struct crypto_queue queue; -struct tasklet_struct queue_task; -struct tasklet_struct done_task; -struct crypto_async_request *async_req; -int err; -/* device lock */ -spinlock_t lock; - -/* the public variable */ -struct scatterlist *sg_src; -struct scatterlist *sg_dst; -struct scatterlist *first; -unsigned int left_bytes; -size_t src_nents; -size_t dst_nents; -unsigned int total; -unsigned int count; -dma_addr_t addr_in; -dma_addr_t addr_out; -bool busy; -int (*start)(struct rk_crypto_info *dev); -int (*update)(struct rk_crypto_info *dev); -void (*complete)(struct crypto_async_request *base,int err); -int (*load_data)(struct rk_crypto_info *dev, -struct scatterlist *sg_src, -struct scatterlist *sg_dst); -void (*unload_data)(struct rk_crypto_info *dev); -int (*enqueue)(struct rk_crypto_info *dev, -struct crypto_async_request *async_req); + +struct crypto_engine *engine; +struct completion complete; +int status; };/* the private variable of hash */ struct rk_ahash_ctx { +struct crypto_engine_ctx enginectx;struct rk_crypto_info *dev;/* for fallback */ struct crypto_ahash *fallback_tfm;
@@ -235,10 +213,12 @@ struct rk_ahash_ctx {struct rk_ahash_rctx {struct ahash_request fallback_req;u32 mode; +int nrsg; };/* the private variable of cipher */ struct rk_cipher_ctx { +struct crypto_engine_ctx enginectx;struct rk_crypto_info *dev;unsigned int keylen;u32 key[AES_MAX_KEY_SIZE /4 ];
@@ -247,6 +227,7 @@ struct rk_cipher_ctx { };struct rk_cipher_rctx { +u8 backup_iv[AES_BLOCK_SIZE ];u32 mode;struct skcipher_request fallback_req;// keep at the end };
drivers/crypto/rockchip/rk3288_crypto_ahash.c +78 -66
218 lines not on this page · raw message
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +125 -127
330 lines not on this page · raw message
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 12/18 ARM: dts: rk3288: crypto do not need dma clock
In reply to Corentin LabbeThe DMA clock is already enabled by DMA and so crypto does not need to handle it.
--- arch/arm/boot/dts/rk3288.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/rk3288.dtsi +2 -2
@@ -976,8 +976,8 @@ crypto: crypto@ff8a0000 { reg = <0x0 0xff8a0000 0x0 0x4000>; interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>, - <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC1>; - clock-names = "aclk", "hclk", "sclk", "apb_pclk"; + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk"; resets = <&cru SRST_CRYPTO>; reset-names = "crypto-rst"; };
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 13/18 crypto: rockchip: rewrite type
In reply to Corentin LabbeInstead of using a custom type for classify algorithms, let's just use already defined ones.
And let's made a bit more verbose about what is registered.
--- drivers/crypto/rockchip/rk3288_crypto.c | 26 +++++++++++++------ drivers/crypto/rockchip/rk3288_crypto.h | 7 +---- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 6 ++--- .../crypto/rockchip/rk3288_crypto_skcipher.c | 12 ++++----- 4 files changed, 28 insertions(+), 23 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.c +18 -8
@@ -94,12 +94,22 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info)for (i =0 ; i <ARRAY_SIZE (rk_cipher_algs); i++) { rk_cipher_algs[i]->dev = crypto_info; -if (rk_cipher_algs[i]->type ==ALG_TYPE_CIPHER ) - err =crypto_register_skcipher ( - &rk_cipher_algs[i]->alg.skcipher); -else - err =crypto_register_ahash ( - &rk_cipher_algs[i]->alg.hash); +switch (rk_cipher_algs[i]->type) { +case CRYPTO_ALG_TYPE_SKCIPHER : +dev_info (crypto_info->dev,"Register %s as %s\n" , + rk_cipher_algs[i]->alg.skcipher.base.cra_name, + rk_cipher_algs[i]->alg.skcipher.base.cra_driver_name); + err =crypto_register_skcipher (&rk_cipher_algs[i]->alg.skcipher); +break ; +case CRYPTO_ALG_TYPE_AHASH : +dev_info (crypto_info->dev,"Register %s as %s\n" , + rk_cipher_algs[i]->alg.hash.halg.base.cra_name, + rk_cipher_algs[i]->alg.hash.halg.base.cra_driver_name); + err =crypto_register_ahash (&rk_cipher_algs[i]->alg.hash); +break ; +default : +dev_err (crypto_info->dev,"unknown algorithm\n" ); + }if (err) goto err_cipher_algs; }
@@ -107,7 +117,7 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info) err_cipher_algs:for (k =0 ; k < i; k++) { -if (rk_cipher_algs[i]->type ==ALG_TYPE_CIPHER ) +if (rk_cipher_algs[i]->type ==CRYPTO_ALG_TYPE_SKCIPHER )crypto_unregister_skcipher (&rk_cipher_algs[k]->alg.skcipher);else crypto_unregister_ahash (&rk_cipher_algs[i]->alg.hash);
@@ -120,7 +130,7 @@ static void rk_crypto_unregister(void)unsigned int i;for (i =0 ; i <ARRAY_SIZE (rk_cipher_algs); i++) { -if (rk_cipher_algs[i]->type ==ALG_TYPE_CIPHER ) +if (rk_cipher_algs[i]->type ==CRYPTO_ALG_TYPE_SKCIPHER )crypto_unregister_skcipher (&rk_cipher_algs[i]->alg.skcipher);else crypto_unregister_ahash (&rk_cipher_algs[i]->alg.hash);
drivers/crypto/rockchip/rk3288_crypto.h +1 -6
@@ -231,18 +231,13 @@ struct rk_cipher_rctx {struct skcipher_request fallback_req;// keep at the end }; -enum alg_type { -ALG_TYPE_HASH , -ALG_TYPE_CIPHER , -}; -struct rk_crypto_tmp { +u32 type;struct rk_crypto_info *dev;union {struct skcipher_alg skcipher;struct ahash_alg hash; } alg; -enum alg_type type; };extern struct rk_crypto_tmp rk_ecb_aes_alg;
drivers/crypto/rockchip/rk3288_crypto_ahash.c +3 -3
@@ -352,7 +352,7 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm) }struct rk_crypto_tmp rk_ahash_sha1 = { - .type =ALG_TYPE_HASH , + .type =CRYPTO_ALG_TYPE_AHASH , .alg.hash = { .init = rk_ahash_init, .update = rk_ahash_update,
@@ -382,7 +382,7 @@ struct rk_crypto_tmp rk_ahash_sha1 = { };struct rk_crypto_tmp rk_ahash_sha256 = { - .type =ALG_TYPE_HASH , + .type =CRYPTO_ALG_TYPE_AHASH , .alg.hash = { .init = rk_ahash_init, .update = rk_ahash_update,
@@ -412,7 +412,7 @@ struct rk_crypto_tmp rk_ahash_sha256 = { };struct rk_crypto_tmp rk_ahash_md5 = { - .type =ALG_TYPE_HASH , + .type =CRYPTO_ALG_TYPE_AHASH , .alg.hash = { .init = rk_ahash_init, .update = rk_ahash_update,
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +6 -6
@@ -470,7 +470,7 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm) }struct rk_crypto_tmp rk_ecb_aes_alg = { - .type =ALG_TYPE_CIPHER , + .type =CRYPTO_ALG_TYPE_SKCIPHER , .alg.skcipher = { .base.cra_name ="ecb(aes)" , .base.cra_driver_name ="ecb-aes-rk" ,
@@ -492,7 +492,7 @@ struct rk_crypto_tmp rk_ecb_aes_alg = { };struct rk_crypto_tmp rk_cbc_aes_alg = { - .type =ALG_TYPE_CIPHER , + .type =CRYPTO_ALG_TYPE_SKCIPHER , .alg.skcipher = { .base.cra_name ="cbc(aes)" , .base.cra_driver_name ="cbc-aes-rk" ,
@@ -515,7 +515,7 @@ struct rk_crypto_tmp rk_cbc_aes_alg = { };struct rk_crypto_tmp rk_ecb_des_alg = { - .type =ALG_TYPE_CIPHER , + .type =CRYPTO_ALG_TYPE_SKCIPHER , .alg.skcipher = { .base.cra_name ="ecb(des)" , .base.cra_driver_name ="ecb-des-rk" ,
@@ -537,7 +537,7 @@ struct rk_crypto_tmp rk_ecb_des_alg = { };struct rk_crypto_tmp rk_cbc_des_alg = { - .type =ALG_TYPE_CIPHER , + .type =CRYPTO_ALG_TYPE_SKCIPHER , .alg.skcipher = { .base.cra_name ="cbc(des)" , .base.cra_driver_name ="cbc-des-rk" ,
@@ -560,7 +560,7 @@ struct rk_crypto_tmp rk_cbc_des_alg = { };struct rk_crypto_tmp rk_ecb_des3_ede_alg = { - .type =ALG_TYPE_CIPHER , + .type =CRYPTO_ALG_TYPE_SKCIPHER , .alg.skcipher = { .base.cra_name ="ecb(des3_ede)" , .base.cra_driver_name ="ecb-des3-ede-rk" ,
@@ -582,7 +582,7 @@ struct rk_crypto_tmp rk_ecb_des3_ede_alg = { };struct rk_crypto_tmp rk_cbc_des3_ede_alg = { - .type =ALG_TYPE_CIPHER , + .type =CRYPTO_ALG_TYPE_SKCIPHER , .alg.skcipher = { .base.cra_name ="cbc(des3_ede)" , .base.cra_driver_name ="cbc-des3-ede-rk" ,
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 14/18 crypto: rockchip: add debugfs
In reply to Corentin LabbeThis patch enable to access usage stats for each algorithm.
--- drivers/crypto/Kconfig | 10 ++++ drivers/crypto/rockchip/rk3288_crypto.c | 47 +++++++++++++++++++ drivers/crypto/rockchip/rk3288_crypto.h | 11 +++++ drivers/crypto/rockchip/rk3288_crypto_ahash.c | 8 ++++ .../crypto/rockchip/rk3288_crypto_skcipher.c | 19 +++++++- 5 files changed, 94 insertions(+), 1 deletion(-)
drivers/crypto/Kconfig +10 -0
@@ -797,6 +797,16 @@ config CRYPTO_DEV_ROCKCHIP This driver interfaces with the hardware crypto accelerator. Supporting cbc/ecb chainmode, and aes/des/des3_ede cipher mode. +config CRYPTO_DEV_ROCKCHIP_DEBUG + bool "Enable Rockchip crypto stats" + depends on CRYPTO_DEV_ROCKCHIP + depends on DEBUG_FS + help + Say y to enable Rockchip crypto debug stats. + This will create /sys/kernel/debug/rk3288_crypto/stats for displaying + the number of requests per algorithm and other internal stats. + + config CRYPTO_DEV_ZYNQMP_AES tristate "Support for Xilinx ZynqMP AES hw accelerator" depends on ZYNQMP_FIRMWARE || COMPILE_TEST
drivers/crypto/rockchip/rk3288_crypto.c +47 -0
65 lines not on this page · raw message
drivers/crypto/rockchip/rk3288_crypto.h +11 -0
@@ -7,6 +7,7 @@#include <crypto/algapi.h> #include <linux/dma-mapping.h> #include <linux/interrupt.h> +#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/scatterlist.h> #include <crypto/engine.h>
@@ -198,6 +199,10 @@ struct rk_crypto_info {struct crypto_engine *engine;struct completion complete;int status; +#ifdef CONFIG_CRYPTO_DEV_ROCKCHIP_DEBUG +struct dentry *dbgfs_dir; +struct dentry *dbgfs_stats; +#endif };/* the private variable of hash */
@@ -238,6 +243,12 @@ struct rk_crypto_tmp {struct skcipher_alg skcipher;struct ahash_alg hash; } alg; +unsigned long stat_req; +unsigned long stat_fb; +unsigned long stat_fb_len; +unsigned long stat_fb_sglen; +unsigned long stat_fb_align; +unsigned long stat_fb_sgdiff; };extern struct rk_crypto_tmp rk_ecb_aes_alg;
drivers/crypto/rockchip/rk3288_crypto_ahash.c +8 -0
@@ -39,6 +39,10 @@ static int rk_ahash_digest_fb(struct ahash_request *areq)struct rk_ahash_rctx *rctx =ahash_request_ctx (areq);struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq);struct rk_ahash_ctx *tfmctx =crypto_ahash_ctx (tfm); +struct ahash_alg *alg =__crypto_ahash_alg (tfm->base.__crt_alg); + struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.hash); + + algt->stat_fb++;ahash_request_set_tfm (&rctx->fallback_req, tfmctx->fallback_tfm); rctx->fallback_req.base.flags = areq->base.flags &
@@ -249,6 +253,8 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq)struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq);struct rk_ahash_rctx *rctx =ahash_request_ctx (areq);struct rk_ahash_ctx *tctx =crypto_ahash_ctx (tfm); +struct ahash_alg *alg =__crypto_ahash_alg (tfm->base.__crt_alg); + struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.hash);struct scatterlist *sg = areq->src;int err =0 ;int i;
@@ -256,6 +262,8 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq) rctx->mode =0 ; + algt->stat_req++; +switch (crypto_ahash_digestsize (tfm)) {case SHA1_DIGEST_SIZE : rctx->mode =RK_CRYPTO_HASH_SHA1 ;
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +18 -1
@@ -16,6 +16,9 @@static int rk_cipher_need_fallback (struct skcipher_request *req) { +struct crypto_skcipher *tfm =crypto_skcipher_reqtfm (req); +struct skcipher_alg *alg =crypto_skcipher_alg (tfm); + struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher);struct scatterlist *sgs, *sgd;if (!req->cryptlen)
@@ -24,9 +27,11 @@ static int rk_cipher_need_fallback(struct skcipher_request *req) sgs = req->src;while (sgs) {if (!IS_ALIGNED (sgs->offset,sizeof (u32))) { + algt->stat_fb_align++;return true; }if (sgs->length %16 ) { + algt->stat_fb_len++;return true; } sgs =sg_next (sgs);
@@ -34,9 +39,11 @@ static int rk_cipher_need_fallback(struct skcipher_request *req) sgd = req->dst;while (sgd) {if (!IS_ALIGNED (sgd->offset,sizeof (u32))) { + algt->stat_fb_align++;return true; }if (sgd->length %16 ) { + algt->stat_fb_len++;return true; } sgd =sg_next (sgd);
@@ -44,8 +51,10 @@ static int rk_cipher_need_fallback(struct skcipher_request *req) sgs = req->src; sgd = req->dst;while (sgs && sgd) { -if (sgs->length != sgd->length) +if (sgs->length != sgd->length) { + algt->stat_fb_sgdiff++;return true; + } sgs =sg_next (sgs); sgd =sg_next (sgd); }
@@ -57,8 +66,12 @@ static int rk_cipher_fallback(struct skcipher_request *areq)struct crypto_skcipher *tfm =crypto_skcipher_reqtfm (areq);struct rk_cipher_ctx *op =crypto_skcipher_ctx (tfm);struct rk_cipher_rctx *rctx =skcipher_request_ctx (areq); +struct skcipher_alg *alg =crypto_skcipher_alg (tfm); + struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher);int err; + algt->stat_fb++; +skcipher_request_set_tfm (&rctx->fallback_req, op->fallback_tfm);skcipher_request_set_callback (&rctx->fallback_req, areq->base.flags, areq->base.complete, areq->base.data);
@@ -325,6 +338,10 @@ static int rk_cipher_run(struct crypto_engine *engine, void *async_req)u8 *ivtouse = areq->iv;unsigned int len = areq->cryptlen;unsigned int todo; +struct skcipher_alg *alg =crypto_skcipher_alg (tfm); + struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher); + + algt->stat_req++; ivsize =crypto_skcipher_ivsize (tfm);if (areq->iv &&crypto_skcipher_ivsize (tfm) >0 ) {
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 15/18 crypto: rockchip: introduce PM
In reply to Corentin LabbeAdd runtime PM support for rockchip crypto.
--- drivers/crypto/Kconfig | 1 + drivers/crypto/rockchip/rk3288_crypto.c | 50 ++++++++++++++++++- drivers/crypto/rockchip/rk3288_crypto.h | 1 + drivers/crypto/rockchip/rk3288_crypto_ahash.c | 11 ++++ .../crypto/rockchip/rk3288_crypto_skcipher.c | 10 ++++ 5 files changed, 71 insertions(+), 2 deletions(-)
drivers/crypto/Kconfig +1 -0
@@ -784,6 +784,7 @@ config CRYPTO_DEV_IMGTEC_HASH config CRYPTO_DEV_ROCKCHIP tristate "Rockchip's Cryptographic Engine driver" depends on OF && ARCH_ROCKCHIP + depends on PM select CRYPTO_AES select CRYPTO_ENGINE select CRYPTO_LIB_DES
drivers/crypto/rockchip/rk3288_crypto.c +48 -2
80 lines not on this page · raw message
drivers/crypto/rockchip/rk3288_crypto.h +1 -0
@@ -9,6 +9,7 @@#include <linux/interrupt.h> #include <linux/debugfs.h> #include <linux/delay.h> +#include <linux/pm_runtime.h> #include <linux/scatterlist.h> #include <crypto/engine.h> #include <crypto/internal/hash.h>
drivers/crypto/rockchip/rk3288_crypto_ahash.c +11 -0
@@ -328,6 +328,7 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm)struct ahash_alg *alg =__crypto_ahash_alg (tfm->__crt_alg);const char *alg_name =crypto_tfm_alg_name (tfm); +int err; algt = container_of(alg, struct rk_crypto_tmp, alg.hash);
@@ -349,7 +350,16 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm) tctx->enginectx.op.prepare_request = rk_hash_prepare; tctx->enginectx.op.unprepare_request = rk_hash_unprepare; + err =pm_runtime_get_sync (tctx->dev->dev); +if (err <0 ) + goto error_pm; +return 0 ; +error_pm: +pm_runtime_put_noidle (tctx->dev->dev); +crypto_free_ahash (tctx->fallback_tfm); + +return err; }static void rk_cra_hash_exit (struct crypto_tfm *tfm)
@@ -357,6 +367,7 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm);crypto_free_ahash (tctx->fallback_tfm); +pm_runtime_put_sync_suspend (tctx->dev->dev); }struct rk_crypto_tmp rk_ahash_sha1 = {
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +10 -0
@@ -458,6 +458,7 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm)struct skcipher_alg *alg =crypto_skcipher_alg (tfm);const char *name =crypto_tfm_alg_name (&tfm->base);struct rk_crypto_tmp *algt; +int err; algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher);
@@ -475,7 +476,15 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm) ctx->enginectx.op.do_one_request = rk_cipher_run; + err =pm_runtime_get_sync (ctx->dev->dev); +if (err <0 ) + goto error_pm; +return 0 ; +error_pm: +pm_runtime_put_noidle (ctx->dev->dev); +crypto_free_skcipher (ctx->fallback_tfm); +return err; }static void rk_ablk_exit_tfm (struct crypto_skcipher *tfm)
@@ -484,6 +493,7 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)memzero_explicit (ctx->key, ctx->keylen);crypto_free_skcipher (ctx->fallback_tfm); +pm_runtime_put_sync_suspend (ctx->dev->dev); }struct rk_crypto_tmp rk_ecb_aes_alg = {
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 17/18 dt-bindings: crypto: convert rockchip-crypto to yaml
In reply to Corentin Labbeconvert rockchip-crypto to yaml
--- .../crypto/rockchip,rk3288-crypto.yaml | 64 +++++++++++++++++++ .../bindings/crypto/rockchip-crypto.txt | 28 -------- 2 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml delete mode 100644 Documentation/devicetree/bindings/crypto/rockchip-crypto.txt
Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml new file +64 -0
@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/rockchip,rk3288-crypto.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip Electronics And Security Accelerator + +maintainers: + - Heiko Stuebner <[email protected]> + +properties: + compatible: + const: rockchip,rk3288-crypto + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: clock data + - description: clock data + - description: clock crypto accelerator + + clock-names: + items: + - const: aclk + - const: hclk + - const: sclk + + resets: + maxItems: 1 + + reset-names: + const: crypto-rst + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - resets + - reset-names + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/rk3288-cru.h> + crypto@ff8a0000 { + compatible = "rockchip,rk3288-crypto"; + reg = <0xff8a0000 0x4000>; + interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>, + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk"; + resets = <&cru SRST_CRYPTO>; + reset-names = "crypto-rst"; + };
Documentation/devicetree/bindings/crypto/rockchip-crypto.txt deleted +0 -28
@@ -1,28 +0,0 @@ -Rockchip Electronics And Security Accelerator - -Required properties: -- compatible: Should be "rockchip,rk3288-crypto" -- reg: Base physical address of the engine and length of memory mapped - region -- interrupts: Interrupt number -- clocks: Reference to the clocks about crypto -- clock-names: "aclk" used to clock data - "hclk" used to clock data - "sclk" used to clock crypto accelerator - "apb_pclk" used to clock dma -- resets: Must contain an entry for each entry in reset-names. - See ../reset/reset.txt for details. -- reset-names: Must include the name "crypto-rst". - -Examples: - - crypto: cypto-controller@ff8a0000 { - compatible = "rockchip,rk3288-crypto"; - reg = <0xff8a0000 0x4000>; - interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>, - <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC1>; - clock-names = "aclk", "hclk", "sclk", "apb_pclk"; - resets = <&cru SRST_CRYPTO>; - reset-names = "crypto-rst"; - };
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 18/18 crypto: rockchip: add myself as maintainer
In reply to Corentin LabbeNobody is set as maintainer of rockchip crypto, I propose to do it as I have already reworked lot of this code.
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -16831,6 +16831,12 @@ F: Documentation/ABI/*/sysfs-driver-hid-roccat* F: drivers/hid/hid-roccat* F: include/linux/hid-roccat* +ROCKCHIP CRYPTO DRIVERS +M: Corentin Labbe <[email protected]> +L: [email protected] +S: Maintained +F: drivers/crypto/rockchip/ + ROCKCHIP I2S TDM DRIVER M: Nicolas Frattaroli <[email protected]> L: [email protected]
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH v2 16/18 arm64: dts: rockchip: add rk3328 crypto node
In reply to Corentin Labberk3328 has a crypto IP handled by the rk3288 crypto driver so adds a node for it.
--- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +11 -0
@@ -1007,6 +1007,17 @@ gic: interrupt-controller@ff811000 { (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; }; + crypto: crypto@ff060000 { + compatible = "rockchip,rk3288-crypto"; + reg = <0x0 0xff060000 0x0 0x4000>; + interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru HCLK_CRYPTO_MST>, <&cru HCLK_CRYPTO_SLV>, + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk"; + resets = <&cru SRST_CRYPTO>; + reset-names = "crypto-rst"; + }; + pinctrl: pinctrl { compatible = "rockchip,rk3328-pinctrl"; rockchip,grf = <&grf>;
Signature · 1 line
2.34.1
Re: [PATCH v2 15/18] crypto: rockchip: introduce PM
In reply to Corentin LabbeQuoted 16 lines · Corentin Labbe
Add runtime PM support for rockchip crypto.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/Kconfig | 1 + drivers/crypto/rockchip/rk3288_crypto.c | 50 ++++++++++++++++++- drivers/crypto/rockchip/rk3288_crypto.h | 1 + drivers/crypto/rockchip/rk3288_crypto_ahash.c | 11 ++++ .../crypto/rockchip/rk3288_crypto_skcipher.c | 10 ++++ 5 files changed, 71 insertions(+), 2 deletions(-)drivers/crypto/Kconfig +0
-0
drivers/crypto/Kconfig config CRYPTO_DEV_IMGTEC_HASH · line 787
Quoted 4 lines
drivers/crypto/Kconfig +1
-0@@ -784,6 +784,7 @@ config CRYPTO_DEV_IMGTEC_HASH config CRYPTO_DEV_ROCKCHIP tristate "Rockchip's Cryptographic Engine driver" depends on OF && ARCH_ROCKCHIP + depends on PM
Does this need to depend on PM? If you enable the clock in _probe then use pm_runtime_put_autosuspend() the no-op helpers when !PM will mean this works whether PM is enabled or not.
Quoted 117 lines
drivers/crypto/Kconfig +0
-0select CRYPTO_AES select CRYPTO_ENGINE select CRYPTO_LIB_DESdrivers/crypto/rockchip/rk3288_crypto.c +48
-2@@ -57,6 +57,48 @@ static void rk_crypto_disable_clk(struct rk_crypto_info *dev)clk_disable_unprepare (dev->sclk); } +/* +* Power management strategy: The device is suspended unless a TFM exists for +* one of the algorithms proposed by this driver. +*/ +static int rk_crypto_pm_suspend (struct device *dev) +{ +struct rk_crypto_info *rkdev =dev_get_drvdata (dev); + +rk_crypto_disable_clk (rkdev); +return 0 ; +} + +static int rk_crypto_pm_resume (struct device *dev) +{ +struct rk_crypto_info *rkdev =dev_get_drvdata (dev); + +return rk_crypto_enable_clk (rkdev); +} + +static const struct dev_pm_ops rk_crypto_pm_ops = { +SET_RUNTIME_PM_OPS (rk_crypto_pm_suspend, rk_crypto_pm_resume,NULL ) +}; + +static int rk_crypto_pm_init (struct rk_crypto_info *rkdev) +{ +int err; + +pm_runtime_use_autosuspend (rkdev->dev); +pm_runtime_set_autosuspend_delay (rkdev->dev,2000 ); + + err =pm_runtime_set_suspended (rkdev->dev); +if (err) +return err; +pm_runtime_enable (rkdev->dev); +return err; +} + +static void rk_crypto_pm_exit (struct rk_crypto_info *rkdev) +{ +pm_runtime_disable (rkdev->dev); +} +static irqreturn_t rk_crypto_irq_handle (int irq,void *dev_id) {struct rk_crypto_info *dev =platform_get_drvdata (dev_id);@@ -259,7 +301,9 @@ static int rk_crypto_probe(struct platform_device *pdev)crypto_engine_start (crypto_info->engine);init_completion (&crypto_info->complete); -rk_crypto_enable_clk (crypto_info); + err =rk_crypto_pm_init (crypto_info); +if (err) + goto err_crypto; err =rk_crypto_register (crypto_info);if (err) {@@ -280,6 +324,7 @@ static int rk_crypto_probe(struct platform_device *pdev)return 0 ; err_register_alg: +rk_crypto_pm_exit (crypto_info); err_crypto:dev_err (dev,"Crypto Accelerator not successfully registered\n" );return err;@@ -293,7 +338,7 @@ static int rk_crypto_remove(struct platform_device *pdev)debugfs_remove_recursive (crypto_tmp->dbgfs_dir);#endif rk_crypto_unregister (); -rk_crypto_disable_clk (crypto_tmp); +rk_crypto_pm_exit (crypto_tmp);return 0 ; }@@ -302,6 +347,7 @@ static struct platform_driver crypto_driver = { .remove = rk_crypto_remove, .driver = { .name = "rk3288-crypto", + .pm = &rk_crypto_pm_ops, .of_match_table = crypto_of_id_table, }, };drivers/crypto/rockchip/rk3288_crypto.h +1
-0@@ -9,6 +9,7 @@#include <linux/interrupt.h> #include <linux/debugfs.h> #include <linux/delay.h> +#include <linux/pm_runtime.h> #include <linux/scatterlist.h> #include <crypto/engine.h> #include <crypto/internal/hash.h> drivers/crypto/rockchip/rk3288_crypto_ahash.c +1
-0@@ -328,6 +328,7 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm)struct ahash_alg *alg =__crypto_ahash_alg (tfm->__crt_alg);const char *alg_name =crypto_tfm_alg_name (tfm); +int err; algt = container_of(alg, struct rk_crypto_tmp, alg.hash);
drivers/crypto/rockchip/rk3288_crypto_ahash.c static int rk_cra_hash_init(struct crypto_tfm *tfm) · line 353
Quoted 4 lines
drivers/crypto/rockchip/rk3288_crypto_ahash.c +1
-0@@ -349,7 +350,16 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm) tctx->enginectx.op.prepare_request = rk_hash_prepare; tctx->enginectx.op.unprepare_request = rk_hash_unprepare; + err =pm_runtime_get_sync (tctx->dev->dev);
pm_runtime_resume_and_get() ? The error handling is nicer with that.
Quoted 13 lines
drivers/crypto/rockchip/rk3288_crypto_ahash.c +8
-0+if (err <0 ) + goto error_pm; +return 0 ; +error_pm: +pm_runtime_put_noidle (tctx->dev->dev); +crypto_free_ahash (tctx->fallback_tfm); + +return err; }static void rk_cra_hash_exit (struct crypto_tfm *tfm)
drivers/crypto/rockchip/rk3288_crypto_ahash.c static void rk_cra_hash_exit(struct crypto_tfm *tfm) · line 370
Quoted 4 lines
drivers/crypto/rockchip/rk3288_crypto_ahash.c +1
-0@@ -357,6 +367,7 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm);crypto_free_ahash (tctx->fallback_tfm); +pm_runtime_put_sync_suspend (tctx->dev->dev);
Why use sync_suspend here? Could this be pm_runtime_put_autosuspend()?
Quoted 16 lines
drivers/crypto/rockchip/rk3288_crypto_ahash.c +0
-0}struct rk_crypto_tmp rk_ahash_sha1 = {drivers/crypto/rockchip/rk3288_crypto_skcipher.c +1
-0@@ -458,6 +458,7 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm)struct skcipher_alg *alg =crypto_skcipher_alg (tfm);const char *name =crypto_tfm_alg_name (&tfm->base);struct rk_crypto_tmp *algt; +int err; algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher);
drivers/crypto/rockchip/rk3288_crypto_skcipher.c static int rk_ablk_init_tfm(struct crypto_skcipher *tfm) · line 479
Quoted 4 lines
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +1
-0@@ -475,7 +476,15 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm) ctx->enginectx.op.do_one_request = rk_cipher_run; + err =pm_runtime_get_sync (ctx->dev->dev);
Another place for pm_runtime_resume_and_get() ?
Quoted 12 lines
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +7
-0+if (err <0 ) + goto error_pm; +return 0 ; +error_pm: +pm_runtime_put_noidle (ctx->dev->dev); +crypto_free_skcipher (ctx->fallback_tfm); +return err; }static void rk_ablk_exit_tfm (struct crypto_skcipher *tfm)
drivers/crypto/rockchip/rk3288_crypto_skcipher.c static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm) · line 496
Quoted 4 lines
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +1
-0@@ -484,6 +493,7 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)memzero_explicit (ctx->key, ctx->keylen);crypto_free_skcipher (ctx->fallback_tfm); +pm_runtime_put_sync_suspend (ctx->dev->dev);
Again, can this be pm_runtime_put_autosuspend() ?
Rob Herring
maintainerRe: [PATCH v2 17/18] dt-bindings: crypto: convert rockchip-crypto to yaml
In reply to Corentin LabbeQuoted 10 lines · Corentin Labbe
convert rockchip-crypto to yaml
Signed-off-by Corentin Labbe <[email protected]>--- .../crypto/rockchip,rk3288-crypto.yaml | 64 +++++++++++++++++++ .../bindings/crypto/rockchip-crypto.txt | 28 -------- 2 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml delete mode 100644 Documentation/devicetree/bindings/crypto/rockchip-crypto.txt
Running 'make dtbs_check' with the schema in this patch gives the following warnings. Consider if they are expected or the schema is incorrect. These may not be new warnings.
Note that it is not yet a requirement to have 0 warnings for dtbs_check. This will change in the future.
Full log is available here: https://patchwork.ozlabs.org/patch/1600075
cypto-controller@ff8a0000: clock-names: ['aclk', 'hclk', 'sclk', 'apb_pclk'] is too long
arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml arch/arm/boot/dts/rk3288-evb-rk808.dt.yaml arch/arm/boot/dts/rk3288-firefly-beta.dt.yaml arch/arm/boot/dts/rk3288-firefly.dt.yaml arch/arm/boot/dts/rk3288-firefly-reload.dt.yaml arch/arm/boot/dts/rk3288-miqi.dt.yaml arch/arm/boot/dts/rk3288-phycore-rdk.dt.yaml arch/arm/boot/dts/rk3288-popmetal.dt.yaml arch/arm/boot/dts/rk3288-r89.dt.yaml arch/arm/boot/dts/rk3288-rock2-square.dt.yaml arch/arm/boot/dts/rk3288-rock-pi-n8.dt.yaml arch/arm/boot/dts/rk3288-tinker.dt.yaml arch/arm/boot/dts/rk3288-tinker-s.dt.yaml arch/arm/boot/dts/rk3288-veyron-brain.dt.yaml arch/arm/boot/dts/rk3288-veyron-fievel.dt.yaml arch/arm/boot/dts/rk3288-veyron-jaq.dt.yaml arch/arm/boot/dts/rk3288-veyron-jerry.dt.yaml arch/arm/boot/dts/rk3288-veyron-mickey.dt.yaml arch/arm/boot/dts/rk3288-veyron-mighty.dt.yaml arch/arm/boot/dts/rk3288-veyron-minnie.dt.yaml arch/arm/boot/dts/rk3288-veyron-pinky.dt.yaml arch/arm/boot/dts/rk3288-veyron-speedy.dt.yaml arch/arm/boot/dts/rk3288-veyron-tiger.dt.yaml arch/arm/boot/dts/rk3288-vyasa.dt.yaml
cypto-controller@ff8a0000: clocks: [[7, 199], [7, 461], [7, 125], [7, 193]] is too long
arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml arch/arm/boot/dts/rk3288-evb-rk808.dt.yaml arch/arm/boot/dts/rk3288-firefly-beta.dt.yaml arch/arm/boot/dts/rk3288-firefly.dt.yaml arch/arm/boot/dts/rk3288-firefly-reload.dt.yaml arch/arm/boot/dts/rk3288-miqi.dt.yaml arch/arm/boot/dts/rk3288-phycore-rdk.dt.yaml arch/arm/boot/dts/rk3288-popmetal.dt.yaml arch/arm/boot/dts/rk3288-r89.dt.yaml arch/arm/boot/dts/rk3288-rock2-square.dt.yaml arch/arm/boot/dts/rk3288-rock-pi-n8.dt.yaml arch/arm/boot/dts/rk3288-tinker.dt.yaml arch/arm/boot/dts/rk3288-tinker-s.dt.yaml arch/arm/boot/dts/rk3288-veyron-brain.dt.yaml arch/arm/boot/dts/rk3288-veyron-fievel.dt.yaml arch/arm/boot/dts/rk3288-veyron-jaq.dt.yaml arch/arm/boot/dts/rk3288-veyron-jerry.dt.yaml arch/arm/boot/dts/rk3288-veyron-mickey.dt.yaml arch/arm/boot/dts/rk3288-veyron-mighty.dt.yaml arch/arm/boot/dts/rk3288-veyron-minnie.dt.yaml arch/arm/boot/dts/rk3288-veyron-pinky.dt.yaml arch/arm/boot/dts/rk3288-veyron-speedy.dt.yaml arch/arm/boot/dts/rk3288-veyron-tiger.dt.yaml arch/arm/boot/dts/rk3288-vyasa.dt.yaml
Re: [PATCH v2 06/18] crypto: rockchip: add fallback for cipher
In reply to Corentin LabbeQuoted 40 lines · Corentin Labbe
The hardware does not handle 0 size length request, let's add a fallback.
Furthermore fallback will be used for all unaligned case the hardware cannot handle.Fixes ce0183cb6464b ("crypto: rockchip - switch to skcipher API")Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/rk3288_crypto.h | 2 + .../crypto/rockchip/rk3288_crypto_skcipher.c | 97 ++++++++++++++++--- 2 files changed, 86 insertions(+), 13 deletions(-)drivers/crypto/rockchip/rk3288_crypto.h +2
-0@@ -246,10 +246,12 @@ struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen;u8 iv[AES_BLOCK_SIZE ]; +struct crypto_skcipher *fallback_tfm; };struct rk_cipher_rctx {u32 mode; +struct skcipher_request fallback_req;// keep at the end };enum alg_type {drivers/crypto/rockchip/rk3288_crypto_skcipher.c +3
-0@@ -13,6 +13,63 @@#define RK_CRYPTO_DEC BIT(0) +static int rk_cipher_need_fallback (struct skcipher_request *req) +{ +struct scatterlist *sgs, *sgd;
drivers/crypto/rockchip/rk3288_crypto_skcipher.c line 28
Quoted 10 lines
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +10
-0+ +if (!req->cryptlen) +return true; + + sgs = req->src; +while (sgs) { +if (!IS_ALIGNED (sgs->offset,sizeof (u32))) { +return true; + } +if (sgs->length %16 ) {
Can this be relaxed to check for alignment to 4 rather than 16? That's the requirement for programming the registers.
But I think this check is wrong in general as it doesn't account for cryptlen; with fscrypt I'm seeing sgs->length == 255 but cryptlen == 16 so the hardware can be used but at the moment the fallback path is triggered.
LABBE Corentin
maintainerRe: [PATCH v2 17/18] dt-bindings: crypto: convert rockchip-crypto to yaml
In reply to Rob HerringQuoted 65 lines · Rob Herring
Quoted 10 lines · Corentin Labbe
convert rockchip-crypto to yaml
Signed-off-by Corentin Labbe <[email protected]>--- .../crypto/rockchip,rk3288-crypto.yaml | 64 +++++++++++++++++++ .../bindings/crypto/rockchip-crypto.txt | 28 -------- 2 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml delete mode 100644 Documentation/devicetree/bindings/crypto/rockchip-crypto.txtRunning 'make
dtbs_check' with the schema in this patch gives the following warnings. Consider if they are expected or the schema is incorrect. These may not be new warnings.Note that it is not yet a requirement to have 0 warnings for
dtbs_check. This will change in the future.Full log is available here: https://patchwork.ozlabs.org/patch/1600075
cypto-controller@ff8a0000: clock-names: ['aclk', 'hclk', 'sclk', '
apb_pclk'] is too longarch/arm/boot/dts/rk3288-evb-act8846.dt.yaml arch/arm/boot/dts/rk3288-evb-rk808.dt.yaml arch/arm/boot/dts/rk3288-firefly-beta.dt.yaml arch/arm/boot/dts/rk3288-firefly.dt.yaml arch/arm/boot/dts/rk3288-firefly-reload.dt.yaml arch/arm/boot/dts/rk3288-miqi.dt.yaml arch/arm/boot/dts/rk3288-phycore-rdk.dt.yaml arch/arm/boot/dts/rk3288-popmetal.dt.yaml arch/arm/boot/dts/rk3288-r89.dt.yaml arch/arm/boot/dts/rk3288-rock2-square.dt.yaml arch/arm/boot/dts/rk3288-rock-pi-n8.dt.yaml arch/arm/boot/dts/rk3288-tinker.dt.yaml arch/arm/boot/dts/rk3288-tinker-s.dt.yaml arch/arm/boot/dts/rk3288-veyron-brain.dt.yaml arch/arm/boot/dts/rk3288-veyron-fievel.dt.yaml arch/arm/boot/dts/rk3288-veyron-jaq.dt.yaml arch/arm/boot/dts/rk3288-veyron-jerry.dt.yaml arch/arm/boot/dts/rk3288-veyron-mickey.dt.yaml arch/arm/boot/dts/rk3288-veyron-mighty.dt.yaml arch/arm/boot/dts/rk3288-veyron-minnie.dt.yaml arch/arm/boot/dts/rk3288-veyron-pinky.dt.yaml arch/arm/boot/dts/rk3288-veyron-speedy.dt.yaml arch/arm/boot/dts/rk3288-veyron-tiger.dt.yaml arch/arm/boot/dts/rk3288-vyasa.dt.yamlcypto-controller@ff8a0000: clocks: [[7, 199], [7, 461], [7, 125], [7, 193]] is too long
arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml arch/arm/boot/dts/rk3288-evb-rk808.dt.yaml arch/arm/boot/dts/rk3288-firefly-beta.dt.yaml arch/arm/boot/dts/rk3288-firefly.dt.yaml arch/arm/boot/dts/rk3288-firefly-reload.dt.yaml arch/arm/boot/dts/rk3288-miqi.dt.yaml arch/arm/boot/dts/rk3288-phycore-rdk.dt.yaml arch/arm/boot/dts/rk3288-popmetal.dt.yaml arch/arm/boot/dts/rk3288-r89.dt.yaml arch/arm/boot/dts/rk3288-rock2-square.dt.yaml arch/arm/boot/dts/rk3288-rock-pi-n8.dt.yaml arch/arm/boot/dts/rk3288-tinker.dt.yaml arch/arm/boot/dts/rk3288-tinker-s.dt.yaml arch/arm/boot/dts/rk3288-veyron-brain.dt.yaml arch/arm/boot/dts/rk3288-veyron-fievel.dt.yaml arch/arm/boot/dts/rk3288-veyron-jaq.dt.yaml
Quoted 9 lines
arch/arm/boot/dts/rk3288-veyron-jerry.dt.yaml arch/arm/boot/dts/rk3288-veyron-mickey.dt.yaml arch/arm/boot/dts/rk3288-veyron-mighty.dt.yaml arch/arm/boot/dts/rk3288-veyron-minnie.dt.yaml arch/arm/boot/dts/rk3288-veyron-pinky.dt.yaml arch/arm/boot/dts/rk3288-veyron-speedy.dt.yaml arch/arm/boot/dts/rk3288-veyron-tiger.dt.yaml arch/arm/boot/dts/rk3288-vyasa.dt.yaml
The patch fixing thoses warning is in the serie.
Regards
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
LABBE Corentin
maintainerRe: [PATCH v2 06/18] crypto: rockchip: add fallback for cipher
In reply to John KeepingQuoted 38 lines · John Keeping
Quoted 37 lines · Corentin Labbe
The hardware does not handle 0 size length request, let's add a fallback.
Furthermore fallback will be used for all unaligned case the hardware cannot handle.Fixes ce0183cb6464b ("crypto: rockchip - switch to skcipher API")Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/rk3288_crypto.h | 2 + .../crypto/rockchip/rk3288_crypto_skcipher.c | 97 ++++++++++++++++--- 2 files changed, 86 insertions(+), 13 deletions(-)drivers/crypto/rockchip/rk3288_crypto.h +2
-0@@ -246,10 +246,12 @@ struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen;u8 iv[AES_BLOCK_SIZE ]; +struct crypto_skcipher *fallback_tfm; };struct rk_cipher_rctx {u32 mode; +struct skcipher_request fallback_req;// keep at the end };enum alg_type {drivers/crypto/rockchip/rk3288_crypto_skcipher.c +0
-0@@ -13,6 +13,63 @@#define RK_CRYPTO_DEC BIT(0)
Quoted 16 lines
drivers/crypto/rockchip/rk3288_crypto_skcipher.c line 28
Quoted 13 lines
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +13
-0+static int rk_cipher_need_fallback (struct skcipher_request *req) +{ +struct scatterlist *sgs, *sgd; + +if (!req->cryptlen) +return true; + + sgs = req->src; +while (sgs) { +if (!IS_ALIGNED (sgs->offset,sizeof (u32))) { +return true; + } +if (sgs->length %16 ) {Can this be relaxed to check for alignment to 4 rather than 16? That's the requirement for programming the registers.
No we cannot, the hardware could operate only one SG at a time, and the cipher operation need to be complete, so the length should be a multiple of AES_BLOCK_SIZE. The original driver already have this size check.
But for DES/3DES this check is bad and should be 8, so a fix is needed anyway.
Quoted 5 lines
But I think this check is wrong in general as it doesn't account for cryptlen; with fscrypt I'm seeing
sgs->length== 255 but cryptlen == 16 so the hardware can be used but at the moment the fallback path is triggered.
Yes, I need to check min(sg->length, cryptlen_remaining) instead. I will fix that.
Thanks.
Re: [PATCH v2 11/18] crypto: rockhip: do not handle dma clock
In reply to Corentin LabbeHi Corentin,
Make your clock driver parsing portable.
===
oneOf:
- const: rockchip,rk3288-crypto
- items:
- enum:
- rockchip,rk3328-crypto
- const: rockchip,rk3288-crypto
Compatible string must be SoC related!
rk3288 was the first in line that had support, so we use that as fall back string.
===
Make binding fit for more SoC types.
Allow more clocks by using devm_clk_bulk_get_all.
Drop reset-names requirement for devm_reset_control_array_get_exclusive.
===
Use a patch order to prevent the scripts generate notifications.
- dt-bindings conversion
- add rk3328 compatible string in a separate patch
- your driver changes
- dts patches
A proposed maintainer must be able to submit patch series without errors. ;)
===
When you remove a clock in a YAML conversion you must add a note to the DT maintainer.
===
Johan
Quoted 39 lines · Corentin Labbe
The DMA clock is handled by the DMA controller, so the crypto does not have to touch it.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/rk3288_crypto.c | 16 +--------------- drivers/crypto/rockchip/rk3288_crypto.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-)drivers/crypto/rockchip/rk3288_crypto.c +1
-9@@ -40,15 +40,8 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev) __func__, __LINE__); goto err_hclk; } - err =clk_prepare_enable (dev->dmaclk); -if (err) { -dev_err (dev->dev,"[%s:%d], Couldn't enable clock dmaclk\n" , - __func__, __LINE__); - goto err_dmaclk; - } +return err; -err_dmaclk: -clk_disable_unprepare (dev->hclk); err_hclk:clk_disable_unprepare (dev->aclk); err_aclk:@@ -59,7 +52,6 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev)static void rk_crypto_disable_clk (struct rk_crypto_info *dev) { -clk_disable_unprepare (dev->dmaclk);clk_disable_unprepare (dev->hclk);clk_disable_unprepare (dev->aclk);clk_disable_unprepare (dev->sclk);
drivers/crypto/rockchip/rk3288_crypto.c static int rk_crypto_probe(struct platform_device *pdev) · line 208
Quoted 10 lines
drivers/crypto/rockchip/rk3288_crypto.c +0
-6@@ -199,12 +191,6 @@ static int rk_crypto_probe(struct platform_device *pdev) goto err_crypto; } - crypto_info->dmaclk =devm_clk_get (&pdev->dev,"apb_pclk" ); -if (IS_ERR (crypto_info->dmaclk)) { - err =PTR_ERR (crypto_info->dmaclk); - goto err_crypto; - } -
rk3288:
clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>,
- <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC1>;
- clock-names = "aclk", "hclk", "sclk", "apb_pclk";
+ <&cru SCLK_CRYPTO>;
+ clock-names = "aclk", "hclk", "sclk";
rk3328:
+ clocks = <&cru HCLK_CRYPTO_MST>, <&cru HCLK_CRYPTO_SLV>,
+ <&cru SCLK_CRYPTO>;
+ clock-names = "aclk", "hclk", "sclk";
The HCLK_CRYPTO_MST not is related to ACLK_CRYPTO. You are reusing rk3288 names to not to change the driver. Give it an other name.
===
The sclk goes through a crypto_div_con.
Does that need a frequency set?
Or does that come from nowhere?
From crypto_v1.c
priv->frequency = dev_read_u32_default(dev, "clock-frequency", CRYPTO_V1_DEFAULT_RATE); ret = clk_set_rate(&priv->sclk, priv->frequency);
===
Could you make this portable?
Example:
int i;
priv->num_clks = devm_clk_bulk_get_all(dev, &priv->clks);
if (priv->num_clks < 1)
return -EINVAL;
priv->sclk = NULL;
for (i = 0; i < priv->num_clks; i++) {
if (!strncmp(priv->clks[i].id, "sclk", 3)) {
priv->sclk = priv->clks[i].clk;
break;
}
}
if (!priv->sclk) {
dev_err(dev, "no sclk found\n");
return -EINVAL;
}Also add optional "sclk1" clock for rk3399. Use "sclk" and not "sclk0" to be backwards compatible.
===
Also make the resets portable for rk3399.
Remove the requirement for "reset-names".
Example:
priv->phy_rst = devm_reset_control_array_get_exclusive(dev); if (IS_ERR(priv->phy_rst)) return dev_err_probe(dev, PTR_ERR(priv->phy_rst), "failed to get phy
reset\n");
drivers/crypto/rockchip/rk3288_crypto.h struct rk_crypto_info { · line 195
Quoted 13 lines
drivers/crypto/rockchip/rk3288_crypto.c +0
-0crypto_info->irq =platform_get_irq (pdev,0 );if (crypto_info->irq <0 ) {drivers/crypto/rockchip/rk3288_crypto.c +0
-0dev_err (&pdev->dev,"control Interrupt is not available.\n" );drivers/crypto/rockchip/rk3288_crypto.h +0
-1@@ -191,7 +191,6 @@ struct rk_crypto_info {struct clk *aclk;struct clk *hclk;struct clk *sclk; -struct clk *dmaclk;
int num_clks; struct clk_bulk_data *clks; struct clk *sclk; struct clk *sclk1;
Quoted 3 lines
drivers/crypto/rockchip/rk3288_crypto.h +0
-0struct reset_control *rst;void __iomem *reg;int irq;
Re: [PATCH v2 17/18] dt-bindings: crypto: convert rockchip-crypto to yaml
In reply to Corentin LabbeQuoted 10 lines · Corentin Labbe
convert rockchip-crypto to yaml
Signed-off-by Corentin Labbe <[email protected]>--- .../crypto/rockchip,rk3288-crypto.yaml | 64 +++++++++++++++++++ .../bindings/crypto/rockchip-crypto.txt | 28 -------- 2 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml delete mode 100644 Documentation/devicetree/bindings/crypto/rockchip-crypto.txt
LABBE Corentin
maintainerRe: [PATCH v2 11/18] crypto: rockhip: do not handle dma clock
In reply to Johan JonkerQuoted 14 lines · Johan Jonker
Hi Corentin,
Make your clock driver parsing portable.
===
oneOf:
- const: rockchip,rk3288-crypto
- items:
- enum:
- rockchip,rk3328-crypto
- const: rockchip,rk3288-cryptoCompatible string must be SoC related!
Quoted 7 lines
rk3288 was the first in line that had support, so we use that as fall back string.
===
Make binding fit for more SoC types.
Allow more clocks by usingdevm_clk_bulk_get_all.
Hello
Thanks for the hint of devm_clk_bulk_get_all, I will switch to it as it simplify clock handling.
Quoted 5 lines
Drop reset-names requirement for
devm_reset_control_array_get_exclusive.===
Use a patch order to prevent the scripts generate notifications.
which scripts ?
Quoted 84 lines
- dt-bindings conversion
- add rk3328 compatible string in a separate patch
- your driver changes
- dts patches
A proposed maintainer must be able to submit patch series without errors. ;)
===
When you remove a clock in a YAML conversion you must add a note to the DT maintainer.
===
Johan
Quoted 39 lines · Corentin Labbe
The DMA clock is handled by the DMA controller, so the crypto does not have to touch it.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/rk3288_crypto.c | 16 +--------------- drivers/crypto/rockchip/rk3288_crypto.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-)drivers/crypto/rockchip/rk3288_crypto.c +1
-9@@ -40,15 +40,8 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev) __func__, __LINE__); goto err_hclk; } - err =clk_prepare_enable (dev->dmaclk); -if (err) { -dev_err (dev->dev,"[%s:%d], Couldn't enable clock dmaclk\n" , - __func__, __LINE__); - goto err_dmaclk; - } +return err; -err_dmaclk: -clk_disable_unprepare (dev->hclk); err_hclk:clk_disable_unprepare (dev->aclk); err_aclk:@@ -59,7 +52,6 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev)static void rk_crypto_disable_clk (struct rk_crypto_info *dev) { -clk_disable_unprepare (dev->dmaclk);clk_disable_unprepare (dev->hclk);clk_disable_unprepare (dev->aclk);clk_disable_unprepare (dev->sclk);drivers/crypto/rockchip/rk3288_crypto.c static int rk_crypto_probe(struct platform_device *pdev) · line 208
Quoted 10 lines
drivers/crypto/rockchip/rk3288_crypto.c +0
-6@@ -199,12 +191,6 @@ static int rk_crypto_probe(struct platform_device *pdev) goto err_crypto; } - crypto_info->dmaclk =devm_clk_get (&pdev->dev,"apb_pclk" ); -if (IS_ERR (crypto_info->dmaclk)) { - err =PTR_ERR (crypto_info->dmaclk); - goto err_crypto; - } -rk3288:
(quoted diff) +2
-2clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>, - <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC1>; - clock-names = "aclk", "hclk", "sclk", "apb_pclk"; + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk";rk3328:
(quoted diff) +3
-0+ clocks = <&cru HCLK_CRYPTO_MST>, <&cru HCLK_CRYPTO_SLV>, + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk";
Quoted 3 lines
The
HCLK_CRYPTO_MSTnot is related toACLK_CRYPTO. You are reusing rk3288 names to not to change the driver. Give it an other name.
You are right, I will change them.
Quoted 7 lines
===
The sclk goes through a
crypto_div_con.
Does that need a frequency set?
Or does that come from nowhere?
Quoted 6 lines
From
crypto_v1.cpriv->frequency = dev_read_u32_default(dev, "clock-frequency", CRYPTO_V1_DEFAULT_RATE); ret = clk_set_rate(&priv->sclk, priv->frequency);
The problem is that I dont see any hints for this in TRM, and their rockchips source are inconsistent, they do this in uboot not in linux....
Quoted 49 lines
===
Could you make this portable?
Example:int i; priv->num_clks = devm_clk_bulk_get_all(dev, &priv->clks); if (priv->num_clks < 1) return -EINVAL; priv->sclk = NULL; for (i = 0; i < priv->num_clks; i++) { if (!strncmp(priv->clks[i].id, "sclk", 3)) { priv->sclk = priv->clks[i].clk; break; } } if (!priv->sclk) { dev_err(dev, "no sclk found\n"); return -EINVAL; }Also add optional "sclk1" clock for rk3399. Use "sclk" and not "sclk0" to be backwards compatible.
===
Also make the resets portable for rk3399.
Remove the requirement for "reset-names".Example:
priv->phy_rst = devm_reset_control_array_get_exclusive(dev); if (IS_ERR(priv->phy_rst)) return dev_err_probe(dev, PTR_ERR(priv->phy_rst), "failed to get phyreset\n");
Quoted 8 lines
drivers/crypto/rockchip/rk3288_crypto.c +0
-0crypto_info->irq =platform_get_irq (pdev,0 );if (crypto_info->irq <0 ) {drivers/crypto/rockchip/rk3288_crypto.c +0
-0dev_err (&pdev->dev,"control Interrupt is not available.\n" );drivers/crypto/rockchip/rk3288_crypto.h +0
-0@@ -191,7 +191,6 @@ struct rk_crypto_info {
Quoted 15 lines
drivers/crypto/rockchip/rk3288_crypto.h struct rk_crypto_info { · line 194
Quoted 4 lines
drivers/crypto/rockchip/rk3288_crypto.h +0
-1struct clk *aclk;struct clk *hclk;struct clk *sclk; -struct clk *dmaclk;int num_clks; struct clk_bulk_data *clks; struct clk *sclk; struct clk *sclk1;Quoted 3 lines
drivers/crypto/rockchip/rk3288_crypto.h +0
-0struct reset_control *rst;void __iomem *reg;int irq;
For handling rk3399, I have no hardware so I cannot do anything for it easily. I have asked on IRC for some tests, so let's see if it works.
Anyway we can always add support for it later, the priority is to fix the driver breakage.
Regards
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH v2 11/18] crypto: rockhip: do not handle dma clock
Quoted 27 lines · LABBE Corentin
Quoted 14 lines · Johan Jonker
Hi Corentin,
Make your clock driver parsing portable.
===
oneOf:
- const: rockchip,rk3288-crypto
- items:
- enum:
- rockchip,rk3328-crypto
- const: rockchip,rk3288-cryptoCompatible string must be SoC related!
Quoted 7 lines
rk3288 was the first in line that had support, so we use that as fall back string.
===
Make binding fit for more SoC types.
Allow more clocks by usingdevm_clk_bulk_get_all.Hello
Thanks for the hint of
devm_clk_bulk_get_all, I will switch to it as it simplify clock handling.
Quoted 8 lines
Quoted 5 lines
Drop reset-names requirement for
devm_reset_control_array_get_exclusive.===
Use a patch order to prevent the scripts generate notifications.
which scripts ?
For Linux users:./scripts/checkpatch.pl --strict <patch1> <patch2>
Device tree maintainer rob+dt:
A bot with unknown scripts.
Quoted 2 lines
Quoted 2 lines
- dts rk3288 clock removal
Quoted 3 lines
Quoted 3 lines
- dt-bindings conversion
- add rk3328 compatible string in a separate patch
+ new clock names
Quoted 99 lines
Quoted 80 lines
- your driver changes
- dts patches
A proposed maintainer must be able to submit patch series without errors. ;)
===
When you remove a clock in a YAML conversion you must add a note to the DT maintainer.
===
Johan
Quoted 39 lines · Corentin Labbe
The DMA clock is handled by the DMA controller, so the crypto does not have to touch it.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/rk3288_crypto.c | 16 +--------------- drivers/crypto/rockchip/rk3288_crypto.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-)drivers/crypto/rockchip/rk3288_crypto.c +1
-9@@ -40,15 +40,8 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev) __func__, __LINE__); goto err_hclk; } - err =clk_prepare_enable (dev->dmaclk); -if (err) { -dev_err (dev->dev,"[%s:%d], Couldn't enable clock dmaclk\n" , - __func__, __LINE__); - goto err_dmaclk; - } +return err; -err_dmaclk: -clk_disable_unprepare (dev->hclk); err_hclk:clk_disable_unprepare (dev->aclk); err_aclk:@@ -59,7 +52,6 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev)static void rk_crypto_disable_clk (struct rk_crypto_info *dev) { -clk_disable_unprepare (dev->dmaclk);clk_disable_unprepare (dev->hclk);clk_disable_unprepare (dev->aclk);clk_disable_unprepare (dev->sclk);drivers/crypto/rockchip/rk3288_crypto.c static int rk_crypto_probe(struct platform_device *pdev) · line 208
Quoted 10 lines
drivers/crypto/rockchip/rk3288_crypto.c +0
-6@@ -199,12 +191,6 @@ static int rk_crypto_probe(struct platform_device *pdev) goto err_crypto; } - crypto_info->dmaclk =devm_clk_get (&pdev->dev,"apb_pclk" ); -if (IS_ERR (crypto_info->dmaclk)) { - err =PTR_ERR (crypto_info->dmaclk); - goto err_crypto; - } -rk3288:
(quoted diff) +2
-2clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>, - <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC1>; - clock-names = "aclk", "hclk", "sclk", "apb_pclk"; + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk";rk3328:
(quoted diff) +3
-0+ clocks = <&cru HCLK_CRYPTO_MST>, <&cru HCLK_CRYPTO_SLV>, + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk";Quoted 3 lines
The
HCLK_CRYPTO_MSTnot is related toACLK_CRYPTO. You are reusing rk3288 names to not to change the driver. Give it an other name.You are right, I will change them.
Quoted 12 lines
===
The sclk goes through a
crypto_div_con.
Does that need a frequency set?
Or does that come from nowhere?From
crypto_v1.cpriv->frequency = dev_read_u32_default(dev, "clock-frequency", CRYPTO_V1_DEFAULT_RATE);
Quoted 5 lines
Quoted 2 lines
ret = clk_set_rate(&priv->sclk, priv->frequency);The problem is that I dont see any hints for this in TRM, and their rockchips source are inconsistent, they do this in uboot not in linux....
Rockchip RK3288TRM V1.2 Part2-20170321.pdf
page 1419
Make sure F crypto do not exceed 150M.
===
For rk3228/rk3328:
Rockchip RK3228TRM V0.1 20151016-Part3 Graphic and Multi-media.pdf page 476
Make sure F crypto do not exceed 150M.
===
Rockchip RK3399TRM V1.1 Part3 20160728.pdf
page 781
Make sure F crypto do not exceed 200M.
===
They all have a limit.
Rockchip uses a default in there drivers and in there TRM tables. Then stay consistant and use that too what is already set by the bootloader. (till someone comes up with a better (yet unknown) approuch)
#define CRYPTO_V1_DEFAULT_RATE 100000000
===
Could you disclose your sclk frequency table from:
/sys/kernel/debug/clk/clk_summary
Does that fit within the limits?
Quoted 62 lines
Quoted 62 lines
===
Could you make this portable?
Example:int i; priv->num_clks = devm_clk_bulk_get_all(dev, &priv->clks); if (priv->num_clks < 1) return -EINVAL; priv->sclk = NULL; for (i = 0; i < priv->num_clks; i++) { if (!strncmp(priv->clks[i].id, "sclk", 3)) { priv->sclk = priv->clks[i].clk; break; } } if (!priv->sclk) { dev_err(dev, "no sclk found\n"); return -EINVAL; }Also add optional "sclk1" clock for rk3399. Use "sclk" and not "sclk0" to be backwards compatible.
===
Also make the resets portable for rk3399.
Remove the requirement for "reset-names".Example:
priv->phy_rst = devm_reset_control_array_get_exclusive(dev); if (IS_ERR(priv->phy_rst)) return dev_err_probe(dev, PTR_ERR(priv->phy_rst), "failed to get phyreset\n");
drivers/crypto/rockchip/rk3288_crypto.h struct rk_crypto_info { · line 195
Quoted 13 lines
drivers/crypto/rockchip/rk3288_crypto.c +0
-0crypto_info->irq =platform_get_irq (pdev,0 );if (crypto_info->irq <0 ) {drivers/crypto/rockchip/rk3288_crypto.c +0
-0dev_err (&pdev->dev,"control Interrupt is not available.\n" );drivers/crypto/rockchip/rk3288_crypto.h +0
-1@@ -191,7 +191,6 @@ struct rk_crypto_info {struct clk *aclk;struct clk *hclk;struct clk *sclk; -struct clk *dmaclk;int num_clks; struct clk_bulk_data *clks; struct clk *sclk; struct clk *sclk1;
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
drivers/crypto/rockchip/rk3288_crypto.h +0
-0struct reset_control *rst;void __iomem *reg;int irq;
For handling rk3399, I have no hardware so I cannot do anything for it easily. I have asked on IRC for some tests, so let's see if it works.
Anyway we can always add support for it later, the priority is to fix the driver breakage.
The problem with "later" is always that people "forget". Now you have all people there attention, so get it right for rk3228/rk3328 (and probably for rk3399).
Success!
Johan
Quoted 2 lines
Regards
LABBE Corentin
maintainerRe: [PATCH v2 11/18] crypto: rockhip: do not handle dma clock
Quoted 191 lines · Johan Jonker
Quoted 27 lines · LABBE Corentin
Quoted 14 lines · Johan Jonker
Hi Corentin,
Make your clock driver parsing portable.
===
oneOf:
- const: rockchip,rk3288-crypto
- items:
- enum:
- rockchip,rk3328-crypto
- const: rockchip,rk3288-cryptoCompatible string must be SoC related!
Quoted 7 lines
rk3288 was the first in line that had support, so we use that as fall back string.
===
Make binding fit for more SoC types.
Allow more clocks by usingdevm_clk_bulk_get_all.Hello
Thanks for the hint of
devm_clk_bulk_get_all, I will switch to it as it simplify clock handling.Quoted 8 lines
Quoted 5 lines
Drop reset-names requirement for
devm_reset_control_array_get_exclusive.===
Use a patch order to prevent the scripts generate notifications.
which scripts ?
For Linux users:
./scripts/checkpatch.pl--strict <patch1> <patch2>Device tree maintainer rob+dt:
A bot with unknown scripts.Quoted 2 lines
Quoted 2 lines
- dts rk3288 clock removal
Quoted 3 lines
Quoted 3 lines
- dt-bindings conversion
- add rk3328 compatible string in a separate patch
+ new clock names
Quoted 99 lines
Quoted 80 lines
- your driver changes
- dts patches
A proposed maintainer must be able to submit patch series without errors. ;)
===
When you remove a clock in a YAML conversion you must add a note to the DT maintainer.
===
Johan
Quoted 39 lines · Corentin Labbe
The DMA clock is handled by the DMA controller, so the crypto does not have to touch it.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/rk3288_crypto.c | 16 +--------------- drivers/crypto/rockchip/rk3288_crypto.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-)drivers/crypto/rockchip/rk3288_crypto.c +1
-9@@ -40,15 +40,8 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev) __func__, __LINE__); goto err_hclk; } - err =clk_prepare_enable (dev->dmaclk); -if (err) { -dev_err (dev->dev,"[%s:%d], Couldn't enable clock dmaclk\n" , - __func__, __LINE__); - goto err_dmaclk; - } +return err; -err_dmaclk: -clk_disable_unprepare (dev->hclk); err_hclk:clk_disable_unprepare (dev->aclk); err_aclk:@@ -59,7 +52,6 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev)static void rk_crypto_disable_clk (struct rk_crypto_info *dev) { -clk_disable_unprepare (dev->dmaclk);clk_disable_unprepare (dev->hclk);clk_disable_unprepare (dev->aclk);clk_disable_unprepare (dev->sclk);drivers/crypto/rockchip/rk3288_crypto.c static int rk_crypto_probe(struct platform_device *pdev) · line 208
Quoted 10 lines
drivers/crypto/rockchip/rk3288_crypto.c +0
-6@@ -199,12 +191,6 @@ static int rk_crypto_probe(struct platform_device *pdev) goto err_crypto; } - crypto_info->dmaclk =devm_clk_get (&pdev->dev,"apb_pclk" ); -if (IS_ERR (crypto_info->dmaclk)) { - err =PTR_ERR (crypto_info->dmaclk); - goto err_crypto; - } -rk3288:
(quoted diff) +2
-2clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>, - <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC1>; - clock-names = "aclk", "hclk", "sclk", "apb_pclk"; + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk";rk3328:
(quoted diff) +3
-0+ clocks = <&cru HCLK_CRYPTO_MST>, <&cru HCLK_CRYPTO_SLV>, + <&cru SCLK_CRYPTO>; + clock-names = "aclk", "hclk", "sclk";Quoted 3 lines
The
HCLK_CRYPTO_MSTnot is related toACLK_CRYPTO. You are reusing rk3288 names to not to change the driver. Give it an other name.You are right, I will change them.
Quoted 12 lines
===
The sclk goes through a
crypto_div_con.
Does that need a frequency set?
Or does that come from nowhere?From
crypto_v1.cpriv->frequency = dev_read_u32_default(dev, "clock-frequency", CRYPTO_V1_DEFAULT_RATE);Quoted 5 lines
Quoted 2 lines
ret = clk_set_rate(&priv->sclk, priv->frequency);The problem is that I dont see any hints for this in TRM, and their rockchips source are inconsistent, they do this in uboot not in linux....
Rockchip RK3288TRM V1.2 Part2-20170321.pdf
page 1419Make sure F crypto do not exceed 150M.
===
For rk3228/rk3328:
Rockchip RK3228TRM V0.1 20151016-Part3 Graphic and Multi-media.pdf page 476Make sure F crypto do not exceed 150M.
===
Rockchip RK3399TRM V1.1 Part3 20160728.pdf
page 781Make sure F crypto do not exceed 200M.
===
They all have a limit.
Rockchip uses a default in there drivers and in there TRM tables. Then stay consistant and use that too what is already set by the bootloader. (till someone comes up with a better (yet unknown) approuch)#define
CRYPTO_V1_DEFAULT_RATE100000000
Quoted 8 lines
===
Could you disclose your sclk frequency table from:
/sys/kernel/debug/clk/clk_summaryDoes that fit within the limits?
Hello
On my rk3328-rock64, sclk is 240Mhz, so far beyond the limit.
[ 32.416633] rk3288-crypto ff060000.crypto: CLK 0 hclk_master 75000000 75Mhz [ 32.417292] rk3288-crypto ff060000.crypto: CLK 1 hclk_slave 75000000 75Mhz [ 32.417926] rk3288-crypto ff060000.crypto: CLK 2 sclk 240000000 240Mhz
But everything is stable even with this value.
I remember trying overcloacking allwinner crypto, things broke really fast.
I will try to collect values from other SoCs.
enable prepare protect duty hardware
clock count count count rate accuracy phase cycle enable
-------------------------------------------------------------------------------------------------------
rk805-clkout2 0 0 0 32768 0 0 50000 Y
xin32k 0 0 0 32768 0 0 50000 Y
gmac_clkin 1 1 0 125000000 0 0 50000 Y
clk_mac2io 2 2 0 125000000 0 0 50000 Y
clk_mac2io_ref 0 0 0 125000000 0 0 50000 N
clk_mac2io_rx 0 0 0 125000000 0 0 50000 N
clk_mac2io_tx 1 1 0 125000000 0 0 50000 Y
clk_mac2io_refout 0 0 0 125000000 0 0 50000 N
clk_mac2io_ext 0 0 0 125000000 0 0 50000 Y
xin24m 8 8 0 24000000 0 0 50000 Y
hdmi_phy 0 0 0 148500000 0 0 50000 Y
usb480m_phy 4 4 0 480000000 0 0 50000 Y
usb480m 0 0 0 480000000 0 0 50000 Y
sclk_uart1 0 0 0 24000000 0 0 50000 Y
sclk_uart0 0 0 0 24000000 0 0 50000 Y
xin12m 0 0 0 12000000 0 0 50000 Y
clk_usb3otg_suspend 0 0 0 30770 0 0 50000 N
clk_usb3otg_ref 0 0 0 24000000 0 0 50000 N
clk_ref_usb3otg 0 0 0 24000000 0 0 50000 Y
clk_emmc 0 0 0 200000 0 0 50000 N
emmc_sample 0 0 0 100000 0 0 50000 Y
emmc_drv 0 0 0 100000 0 90 50000 Y
sclk_hdmi_sfc 0 0 0 24000000 0 0 50000 N
sclk_timer5 0 0 0 24000000 0 0 50000 N
sclk_timer4 0 0 0 24000000 0 0 50000 N
sclk_timer3 0 0 0 24000000 0 0 50000 N
sclk_timer2 0 0 0 24000000 0 0 50000 N
sclk_timer1 0 0 0 24000000 0 0 50000 N
sclk_timer0 0 0 0 24000000 0 0 50000 N
clk_efuse 0 0 0 12000000 0 0 50000 N
clk_otp 0 0 0 24000000 0 0 50000 N
sclk_uart2 1 1 0 24000000 0 0 50000 Y
clk_ddrmon 0 0 0 24000000 0 0 50000 Y
hdmiphy 0 0 0 24000000 0 0 50000 Y
dclk_lcdc 0 0 0 24000000 0 0 50000 Y
hdmiphy_peri 0 0 0 24000000 0 0 50000 Y
clk_24m 1 1 0 24000000 0 0 50000 Y
clk_saradc 0 0 0 49897 0 0 50000 N
clk_tsadc 1 1 0 50000 0 0 50000 Y
pll_npll 1 1 0 1200000000 0 0 50000 Y
npll 1 1 0 1200000000 0 0 50000 Y
npll_core 1 1 0 1200000000 0 0 50000 Y
armclk 2 2 0 1200000000 0 0 50000 Y
pclk_dbg 1 1 0 200000000 0 0 50000 Y
aclk_core 2 2 0 600000000 0 0 50000 Y
aclk_gic400 1 1 0 600000000 0 0 50000 Y
aclk_core_niu 1 1 0 600000000 0 0 50000 Y
pll_gpll 1 1 0 491520000 0 0 50000 Y
gpll 3 3 0 491520000 0 0 50000 Y
clk_rtc32k 0 0 0 32768 0 0 50000 N
aclk_gmac 3 3 0 163840000 0 0 50000 Y
aclk_gmac_niu 1 1 0 163840000 0 0 50000 Y
aclk_mac2io 1 1 0 163840000 0 0 50000 Y
aclk_mac2phy 0 0 0 163840000 0 0 50000 N
pclk_gmac 2 2 0 54613334 0 0 50000 Y
pclk_gmac_niu 1 1 0 54613334 0 0 50000 Y
pclk_mac2io 1 1 0 54613334 0 0 50000 Y
pclk_mac2phy 0 0 0 54613334 0 0 50000 N
gpll_peri 0 0 0 491520000 0 0 50000 N
clk_rga 0 0 0 163840000 0 0 50000 N
clk_spi 0 0 0 15360000 0 0 50000 N
aclk_gpu_pre 1 1 0 163840000 0 0 50000 Y
aclk_gpu_niu 1 1 0 163840000 0 0 50000 Y
aclk_gpu 0 0 0 163840000 0 0 50000 N
gpll_core 1 1 0 491520000 0 0 50000 Y
pll_cpll 1 1 0 1200000000 0 0 50000 Y
cpll 10 11 0 1200000000 0 0 50000 Y
clk_sdmmc 0 0 0 100000000 0 0 50000 N
sdmmc_sample 0 0 0 50000000 0 0 50000 Y
sdmmc_drv 0 0 0 50000000 0 90 50000 Y
aclk_bus_pre 4 5 0 150000000 0 0 50000 Y
aclk_dmac_bus 0 1 0 150000000 0 0 50000 N
aclk_intmem 1 1 0 150000000 0 0 50000 Y
aclk_tsp 0 0 0 150000000 0 0 50000 N
aclk_dcf 0 0 0 150000000 0 0 50000 N
aclk_bus_niu 1 1 0 150000000 0 0 50000 Y
pclk_bus_pre 2 2 0 75000000 0 0 50000 Y
pclk_phy_pre 3 3 0 75000000 0 0 50000 Y
pclk_phy_niu 1 1 0 75000000 0 0 50000 Y
pclk_vdacphy 0 0 0 75000000 0 0 50000 Y
pclk_hdmiphy 1 1 0 75000000 0 0 50000 Y
pclk_acodecphy 0 0 0 75000000 0 0 50000 N
pclk_ddrphy 1 1 0 75000000 0 0 50000 N
pclk_usb2_grf 0 0 0 75000000 0 0 50000 Y
pclk_usb3_grf 0 0 0 75000000 0 0 50000 Y
pclk_usb3phy_pipe 0 0 0 75000000 0 0 50000 N
pclk_usb3phy_otg 0 0 0 75000000 0 0 50000 N
pclk_bus 14 15 0 75000000 0 0 50000 Y
pclk_wdt 1 1 0 75000000 0 0 50000 Y
pclk_pmu 1 1 0 75000000 0 0 50000 Y
pclk_saradc 0 0 0 75000000 0 0 50000 N
pclk_sim 0 0 0 75000000 0 0 50000 Y
pclk_sgrf 1 1 0 75000000 0 0 50000 Y
pclk_cru 1 1 0 75000000 0 0 50000 Y
pclk_grf 1 1 0 75000000 0 0 50000 Y
pclk_dcf 0 0 0 75000000 0 0 50000 N
pclk_tsadc 1 1 0 75000000 0 0 50000 Y
pclk_uart2 1 1 0 75000000 0 0 50000 Y
pclk_uart1 0 0 0 75000000 0 0 50000 N
pclk_uart0 0 0 0 75000000 0 0 50000 N
pclk_gpio3 1 1 0 75000000 0 0 50000 Y
pclk_gpio2 1 1 0 75000000 0 0 50000 Y
pclk_gpio1 1 1 0 75000000 0 0 50000 Y
pclk_gpio0 1 1 0 75000000 0 0 50000 Y
pclk_rk_pwm 0 0 0 75000000 0 0 50000 N
pclk_spi 0 0 0 75000000 0 0 50000 N
pclk_stimer 0 0 0 75000000 0 0 50000 N
pclk_timer0 1 1 0 75000000 0 0 50000 Y
pclk_i2c3 0 0 0 75000000 0 0 50000 N
pclk_i2c2 0 0 0 75000000 0 0 50000 N
pclk_i2c1 0 1 0 75000000 0 0 50000 N
pclk_i2c0 0 0 0 75000000 0 0 50000 N
pclk_otp 0 0 0 75000000 0 0 50000 Y
pclk_efuse 0 0 0 75000000 0 0 50000 Y
pclk_bus_niu 1 1 0 75000000 0 0 50000 Y
hclk_bus_pre 2 2 0 75000000 0 0 50000 Y
hclk_pdm 0 0 0 75000000 0 0 50000 N
hclk_bus_niu 1 1 0 75000000 0 0 50000 Y
hclk_crypto_slv 0 0 0 75000000 0 0 50000 N
hclk_crypto_mst 0 0 0 75000000 0 0 50000 N
hclk_tsp 0 0 0 75000000 0 0 50000 N
hclk_spdif_8ch 0 0 0 75000000 0 0 50000 N
hclk_i2s2_2ch 0 0 0 75000000 0 0 50000 N
hclk_i2s1_8ch 0 0 0 75000000 0 0 50000 N
hclk_i2s0_8ch 0 0 0 75000000 0 0 50000 N
hclk_rom 1 1 0 75000000 0 0 50000 Y
clk_wifi 0 0 0 24000000 0 0 50000 N
sclk_vdec_core 0 0 0 100000000 0 0 50000 N
sclk_vdec_cabac 0 0 0 100000000 0 0 50000 N
aclk_vpu_pre 2 3 0 400000000 0 0 50000 Y
aclk_vpu_niu 1 1 0 400000000 0 0 50000 Y
aclk_vpu 0 5 0 400000000 0 0 50000 N
hclk_vpu_pre 1 2 0 100000000 0 0 50000 Y
hclk_vpu_niu 1 1 0 100000000 0 0 50000 Y
hclk_vpu 0 5 0 100000000 0 0 50000 N
aclk_rga_pre 1 1 0 100000000 0 0 50000 Y
aclk_rga_niu 1 1 0 100000000 0 0 50000 Y
aclk_rga 0 0 0 100000000 0 0 50000 N
aclk_vio_pre 2 2 0 100000000 0 0 50000 Y
aclk_vio_niu 1 1 0 100000000 0 0 50000 Y
aclk_hdcp 0 0 0 100000000 0 0 50000 N
aclk_cif 0 0 0 100000000 0 0 50000 N
aclk_iep 0 0 0 100000000 0 0 50000 N
hclk_vio_pre 5 6 0 33333334 0 0 50000 Y
pclk_hdcp 0 0 0 33333334 0 0 50000 N
pclk_hdmi 0 0 0 33333334 0 0 50000 N
hclk_vio_niu 1 1 0 33333334 0 0 50000 Y
hclk_hdcp 0 0 0 33333334 0 0 50000 N
hclk_vio_h2p 1 1 0 33333334 0 0 50000 Y
pclk_vio_h2p 1 1 0 33333334 0 0 50000 Y
hclk_ahb1tom 1 1 0 33333334 0 0 50000 Y
hclk_rga 0 0 0 33333334 0 0 50000 N
hclk_cif 0 0 0 33333334 0 0 50000 N
hclk_iep 0 0 0 33333334 0 0 50000 N
hclk_vop_niu 1 1 0 33333334 0 0 50000 Y
hclk_vop 0 1 0 33333334 0 0 50000 N
clk_mac2phy_src 0 0 0 75000000 0 0 50000 N
clk_mac2phy 0 0 0 75000000 0 0 50000 Y
clk_mac2phy_ref 0 0 0 75000000 0 0 50000 N
clk_mac2phy_rxtx 0 0 0 75000000 0 0 50000 N
clk_mac2phy_out 0 0 0 75000000 0 0 50000 N
clk_mac2io_out 0 0 0 150000000 0 0 50000 N
clk_mac2io_src 0 0 0 200000000 0 0 50000 N
clk_ref_usb3otg_src 0 0 0 37500000 0 0 50000 N
clk_sdmmc_ext 0 0 0 300000000 0 0 50000 N
sdmmc_ext_sample 0 0 0 150000000 0 0 50000 Y
sdmmc_ext_drv 0 0 0 150000000 0 180 50000 Y
clk_sdio 0 0 0 50000000 0 0 50000 N
sdio_sample 0 0 0 25000000 0 0 50000 Y
sdio_drv 0 0 0 25000000 0 180 50000 Y
cpll_peri 1 1 0 1200000000 0 0 50000 Y
aclk_peri_pre 3 3 0 150000000 0 0 50000 Y
aclk_peri 1 1 0 150000000 0 0 50000 Y
aclk_usb3otg 0 0 0 150000000 0 0 50000 N
aclk_peri_noc 0 0 0 150000000 0 0 50000 Y
hclk_peri 7 7 0 75000000 0 0 50000 Y
pclk_peri_niu 1 1 0 75000000 0 0 50000 Y
hclk_peri_niu 1 1 0 75000000 0 0 50000 Y
hclk_otg_pmu 1 1 0 75000000 0 0 50000 Y
hclk_otg 1 1 0 75000000 0 0 50000 Y
hclk_host0_arb 0 0 0 75000000 0 0 50000 Y
hclk_host0 2 2 0 75000000 0 0 50000 Y
hclk_sdmmc_ext 0 0 0 75000000 0 0 50000 N
hclk_emmc 0 0 0 75000000 0 0 50000 N
hclk_sdio 0 0 0 75000000 0 0 50000 N
hclk_sdmmc 1 1 0 75000000 0 0 50000 Y
pclk_peri 1 1 0 75000000 0 0 50000 Y
dclk_lcdc_src 1 1 0 24000000 0 0 50000 Y
dclk_hdmiphy 1 1 0 8000000 0 0 50000 Y
clk_cif_src 0 0 0 1200000000 0 0 50000 N
clk_cif_out 0 0 0 60000000 0 0 50000 Y
aclk_vop_pre 1 2 0 100000000 0 0 50000 Y
aclk_vop_niu 1 1 0 100000000 0 0 50000 Y
aclk_vop 0 1 0 100000000 0 0 50000 N
sclk_venc_dsp 0 0 0 50000000 0 0 50000 N
sclk_venc_core 0 0 0 50000000 0 0 50000 N
aclk_rkvenc 2 2 0 50000000 0 0 50000 Y
aclk_axisram 0 0 0 50000000 0 0 50000 Y
aclk_h264 0 0 0 50000000 0 0 50000 N
aclk_h265 0 0 0 50000000 0 0 50000 N
aclk_rkvenc_niu 1 1 0 50000000 0 0 50000 Y
hclk_rkvenc 1 1 0 12500000 0 0 50000 Y
hclk_h264 0 0 0 12500000 0 0 50000 N
pclk_h265 0 0 0 12500000 0 0 50000 N
hclk_rkvenc_niu 1 1 0 12500000 0 0 50000 Y
aclk_rkvdec_pre 2 2 0 100000000 0 0 50000 Y
aclk_rkvdec_niu 1 1 0 100000000 0 0 50000 Y
aclk_rkvdec 0 0 0 100000000 0 0 50000 N
hclk_rkvdec_pre 1 1 0 25000000 0 0 50000 Y
hclk_rkvdec_niu 1 1 0 25000000 0 0 50000 Y
hclk_rkvdec 0 0 0 25000000 0 0 50000 N
clk_pwm 0 0 0 150000000 0 0 50000 N
clk_crypto 0 0 0 240000000 0 0 50000 N
clk_i2c3 0 0 0 150000000 0 0 50000 N
clk_i2c2 0 0 0 150000000 0 0 50000 N
clk_i2c1 0 1 0 150000000 0 0 50000 N
clk_i2c0 0 0 0 150000000 0 0 50000 N
clk_uart2_div 0 0 0 150000000 0 0 50000 N
clk_uart2_frac 0 0 0 7500000 0 0 50000 N
clk_uart1_div 0 0 0 150000000 0 0 50000 N
clk_uart1_frac 0 0 0 7500000 0 0 50000 N
clk_uart0_div 0 0 0 150000000 0 0 50000 N
clk_uart0_frac 0 0 0 7500000 0 0 50000 N
clk_spdif_div 0 0 0 75000000 0 0 50000 N
sclk_spdif 0 0 0 75000000 0 0 50000 Y
clk_spdif_frac 0 0 0 3750000 0 0 50000 N
clk_i2s2_div 0 0 0 75000000 0 0 50000 N
i2s2_pre 0 0 0 75000000 0 0 50000 Y
clk_i2s2 0 0 0 75000000 0 0 50000 N
i2s2_out 0 0 0 75000000 0 0 50000 N
clk_i2s2_frac 0 0 0 3750000 0 0 50000 N
clk_i2s1_div 0 0 0 75000000 0 0 50000 N
i2s1_pre 0 0 0 75000000 0 0 50000 Y
clk_i2s1 0 0 0 75000000 0 0 50000 N
i2s1_out 0 0 0 75000000 0 0 50000 N
clk_i2s1_frac 0 0 0 3750000 0 0 50000 N
clk_i2s0_div 0 0 0 75000000 0 0 50000 N
i2s0_pre 0 0 0 75000000 0 0 50000 Y
clk_i2s0 0 0 0 75000000 0 0 50000 N
clk_i2s0_frac 0 0 0 3750000 0 0 50000 N
clk_tsp 0 0 0 50000000 0 0 50000 N
pclk_ddr 3 3 0 150000000 0 0 50000 Y
pclk_ddr_grf 1 1 0 150000000 0 0 50000 Y
pclk_ddrstdby 0 0 0 150000000 0 0 50000 Y
pclk_ddr_mon 1 1 0 150000000 0 0 50000 Y
pclk_ddr_msch 1 1 0 150000000 0 0 50000 Y
pclk_ddrupctl 0 0 0 150000000 0 0 50000 Y
pll_dpll 1 1 0 1596000000 0 0 50000 Y
dpll 1 1 0 1596000000 0 0 50000 Y
clk_ddr 2 2 0 1596000000 0 0 50000 Y
aclk_ddrupctl 0 0 0 1596000000 0 0 50000 Y
clk_ddrupctl 1 1 0 1596000000 0 0 50000 Y
clk_ddrmsch 1 1 0 1596000000 0 0 50000 Y
dpll_core 0 0 0 1596000000 0 0 50000 Y
pll_apll 0 0 0 61440000 0 0 50000 Y
apll 0 0 0 61440000 0 0 50000 Y
clk_pdm 0 0 0 61440000 0 0 50000 N
apll_core 0 0 0 61440000 0 0 50000 Y
clk_hsadc_tsp 0 0 0 0 0 0 50000 N
clk_jtag 1 1 0 0 0 0 50000 Y