Skip to content

Commit c0fc8dd

Browse files
prabhakarladhverkuil
authored andcommitted
media: rzg2l-cru: Move register definitions to a separate file
Move the RZ/G2L CRU register definitions from `rzg2l-video.c` to a dedicated header file, `rzg2l-cru-regs.h`. Separating these definitions into their own file improves the readability of the code. Suggested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20241018133446.223516-23-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
1 parent 0477b08 commit c0fc8dd

File tree

4 files changed

+82
-70
lines changed

4 files changed

+82
-70
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/* SPDX-License-Identifier: GPL-2.0+ */
2+
/*
3+
* rzg2l-cru-regs.h--RZ/G2L (and alike SoCs) CRU Registers Definitions
4+
*
5+
* Copyright (C) 2024 Renesas Electronics Corp.
6+
*/
7+
8+
#ifndef __RZG2L_CRU_REGS_H__
9+
#define __RZG2L_CRU_REGS_H__
10+
11+
/* HW CRU Registers Definition */
12+
13+
/* CRU Control Register */
14+
#define CRUnCTRL 0x0
15+
#define CRUnCTRL_VINSEL(x) ((x) << 0)
16+
17+
/* CRU Interrupt Enable Register */
18+
#define CRUnIE 0x4
19+
#define CRUnIE_EFE BIT(17)
20+
21+
/* CRU Interrupt Status Register */
22+
#define CRUnINTS 0x8
23+
#define CRUnINTS_SFS BIT(16)
24+
25+
/* CRU Reset Register */
26+
#define CRUnRST 0xc
27+
#define CRUnRST_VRESETN BIT(0)
28+
29+
/* Memory Bank Base Address (Lower) Register for CRU Image Data */
30+
#define AMnMBxADDRL(x) (0x100 + ((x) * 8))
31+
32+
/* Memory Bank Base Address (Higher) Register for CRU Image Data */
33+
#define AMnMBxADDRH(x) (0x104 + ((x) * 8))
34+
35+
/* Memory Bank Enable Register for CRU Image Data */
36+
#define AMnMBVALID 0x148
37+
#define AMnMBVALID_MBVALID(x) GENMASK(x, 0)
38+
39+
/* Memory Bank Status Register for CRU Image Data */
40+
#define AMnMBS 0x14c
41+
#define AMnMBS_MBSTS 0x7
42+
43+
/* AXI Master Transfer Setting Register for CRU Image Data */
44+
#define AMnAXIATTR 0x158
45+
#define AMnAXIATTR_AXILEN_MASK GENMASK(3, 0)
46+
#define AMnAXIATTR_AXILEN (0xf)
47+
48+
/* AXI Master FIFO Pointer Register for CRU Image Data */
49+
#define AMnFIFOPNTR 0x168
50+
#define AMnFIFOPNTR_FIFOWPNTR GENMASK(7, 0)
51+
#define AMnFIFOPNTR_FIFORPNTR_Y GENMASK(23, 16)
52+
53+
/* AXI Master Transfer Stop Register for CRU Image Data */
54+
#define AMnAXISTP 0x174
55+
#define AMnAXISTP_AXI_STOP BIT(0)
56+
57+
/* AXI Master Transfer Stop Status Register for CRU Image Data */
58+
#define AMnAXISTPACK 0x178
59+
#define AMnAXISTPACK_AXI_STOP_ACK BIT(0)
60+
61+
/* CRU Image Processing Enable Register */
62+
#define ICnEN 0x200
63+
#define ICnEN_ICEN BIT(0)
64+
65+
/* CRU Image Processing Main Control Register */
66+
#define ICnMC 0x208
67+
#define ICnMC_CSCTHR BIT(5)
68+
#define ICnMC_INF(x) ((x) << 16)
69+
#define ICnMC_VCSEL(x) ((x) << 22)
70+
#define ICnMC_INF_MASK GENMASK(21, 16)
71+
72+
/* CRU Module Status Register */
73+
#define ICnMS 0x254
74+
#define ICnMS_IA BIT(2)
75+
76+
/* CRU Data Output Mode Register */
77+
#define ICnDMR 0x26c
78+
#define ICnDMR_YCMODE_UYVY (1 << 4)
79+
80+
#endif /* __RZG2L_CRU_REGS_H__ */

drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
#define RZG2L_CRU_MIN_INPUT_HEIGHT 240
3232
#define RZG2L_CRU_MAX_INPUT_HEIGHT 4095
3333

34-
#define ICnDMR_YCMODE_UYVY (1 << 4)
35-
3634
enum rzg2l_csi2_pads {
3735
RZG2L_CRU_IP_SINK = 0,
3836
RZG2L_CRU_IP_SOURCE,

drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <media/mipi-csi2.h>
1010

1111
#include "rzg2l-cru.h"
12+
#include "rzg2l-cru-regs.h"
1213

1314
static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
1415
{

drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -20,74 +20,7 @@
2020
#include <media/videobuf2-dma-contig.h>
2121

2222
#include "rzg2l-cru.h"
23-
24-
/* HW CRU Registers Definition */
25-
26-
/* CRU Control Register */
27-
#define CRUnCTRL 0x0
28-
#define CRUnCTRL_VINSEL(x) ((x) << 0)
29-
30-
/* CRU Interrupt Enable Register */
31-
#define CRUnIE 0x4
32-
#define CRUnIE_EFE BIT(17)
33-
34-
/* CRU Interrupt Status Register */
35-
#define CRUnINTS 0x8
36-
#define CRUnINTS_SFS BIT(16)
37-
38-
/* CRU Reset Register */
39-
#define CRUnRST 0xc
40-
#define CRUnRST_VRESETN BIT(0)
41-
42-
/* Memory Bank Base Address (Lower) Register for CRU Image Data */
43-
#define AMnMBxADDRL(x) (0x100 + ((x) * 8))
44-
45-
/* Memory Bank Base Address (Higher) Register for CRU Image Data */
46-
#define AMnMBxADDRH(x) (0x104 + ((x) * 8))
47-
48-
/* Memory Bank Enable Register for CRU Image Data */
49-
#define AMnMBVALID 0x148
50-
#define AMnMBVALID_MBVALID(x) GENMASK(x, 0)
51-
52-
/* Memory Bank Status Register for CRU Image Data */
53-
#define AMnMBS 0x14c
54-
#define AMnMBS_MBSTS 0x7
55-
56-
/* AXI Master Transfer Setting Register for CRU Image Data */
57-
#define AMnAXIATTR 0x158
58-
#define AMnAXIATTR_AXILEN_MASK GENMASK(3, 0)
59-
#define AMnAXIATTR_AXILEN (0xf)
60-
61-
/* AXI Master FIFO Pointer Register for CRU Image Data */
62-
#define AMnFIFOPNTR 0x168
63-
#define AMnFIFOPNTR_FIFOWPNTR GENMASK(7, 0)
64-
#define AMnFIFOPNTR_FIFORPNTR_Y GENMASK(23, 16)
65-
66-
/* AXI Master Transfer Stop Register for CRU Image Data */
67-
#define AMnAXISTP 0x174
68-
#define AMnAXISTP_AXI_STOP BIT(0)
69-
70-
/* AXI Master Transfer Stop Status Register for CRU Image Data */
71-
#define AMnAXISTPACK 0x178
72-
#define AMnAXISTPACK_AXI_STOP_ACK BIT(0)
73-
74-
/* CRU Image Processing Enable Register */
75-
#define ICnEN 0x200
76-
#define ICnEN_ICEN BIT(0)
77-
78-
/* CRU Image Processing Main Control Register */
79-
#define ICnMC 0x208
80-
#define ICnMC_CSCTHR BIT(5)
81-
#define ICnMC_INF(x) ((x) << 16)
82-
#define ICnMC_VCSEL(x) ((x) << 22)
83-
#define ICnMC_INF_MASK GENMASK(21, 16)
84-
85-
/* CRU Module Status Register */
86-
#define ICnMS 0x254
87-
#define ICnMS_IA BIT(2)
88-
89-
/* CRU Data Output Mode Register */
90-
#define ICnDMR 0x26c
23+
#include "rzg2l-cru-regs.h"
9124

9225
#define RZG2L_TIMEOUT_MS 100
9326
#define RZG2L_RETRIES 10

0 commit comments

Comments
 (0)