162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2013 Samsung Electronics Co., Ltd. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Authors: Sylwester Nawrocki <s.nawrocki@samsung.com> 862306a36Sopenharmony_ci * Younghwan Joo <yhwan.joo@samsung.com> 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci#ifndef FIMC_IS_REG_H_ 1162306a36Sopenharmony_ci#define FIMC_IS_REG_H_ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* WDT_ISP register */ 1462306a36Sopenharmony_ci#define REG_WDT_ISP 0x00170000 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* MCUCTL registers base offset */ 1762306a36Sopenharmony_ci#define MCUCTL_BASE 0x00180000 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* MCU Controller Register */ 2062306a36Sopenharmony_ci#define MCUCTL_REG_MCUCTRL (MCUCTL_BASE + 0x00) 2162306a36Sopenharmony_ci#define MCUCTRL_MSWRST (1 << 0) 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci/* Boot Base Offset Address Register */ 2462306a36Sopenharmony_ci#define MCUCTL_REG_BBOAR (MCUCTL_BASE + 0x04) 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* Interrupt Generation Register 0 from Host CPU to VIC */ 2762306a36Sopenharmony_ci#define MCUCTL_REG_INTGR0 (MCUCTL_BASE + 0x08) 2862306a36Sopenharmony_ci/* __n = 0...9 */ 2962306a36Sopenharmony_ci#define INTGR0_INTGC(__n) (1 << ((__n) + 16)) 3062306a36Sopenharmony_ci/* __n = 0...5 */ 3162306a36Sopenharmony_ci#define INTGR0_INTGD(__n) (1 << (__n)) 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci/* Interrupt Clear Register 0 from Host CPU to VIC */ 3462306a36Sopenharmony_ci#define MCUCTL_REG_INTCR0 (MCUCTL_BASE + 0x0c) 3562306a36Sopenharmony_ci/* __n = 0...9 */ 3662306a36Sopenharmony_ci#define INTCR0_INTGC(__n) (1 << ((__n) + 16)) 3762306a36Sopenharmony_ci/* __n = 0...5 */ 3862306a36Sopenharmony_ci#define INTCR0_INTCD(__n) (1 << ((__n) + 16)) 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci/* Interrupt Mask Register 0 from Host CPU to VIC */ 4162306a36Sopenharmony_ci#define MCUCTL_REG_INTMR0 (MCUCTL_BASE + 0x10) 4262306a36Sopenharmony_ci/* __n = 0...9 */ 4362306a36Sopenharmony_ci#define INTMR0_INTMC(__n) (1 << ((__n) + 16)) 4462306a36Sopenharmony_ci/* __n = 0...5 */ 4562306a36Sopenharmony_ci#define INTMR0_INTMD(__n) (1 << (__n)) 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* Interrupt Status Register 0 from Host CPU to VIC */ 4862306a36Sopenharmony_ci#define MCUCTL_REG_INTSR0 (MCUCTL_BASE + 0x14) 4962306a36Sopenharmony_ci/* __n (bit number) = 0...4 */ 5062306a36Sopenharmony_ci#define INTSR0_GET_INTSD(x, __n) (((x) >> (__n)) & 0x1) 5162306a36Sopenharmony_ci/* __n (bit number) = 0...9 */ 5262306a36Sopenharmony_ci#define INTSR0_GET_INTSC(x, __n) (((x) >> ((__n) + 16)) & 0x1) 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* Interrupt Mask Status Register 0 from Host CPU to VIC */ 5562306a36Sopenharmony_ci#define MCUCTL_REG_INTMSR0 (MCUCTL_BASE + 0x18) 5662306a36Sopenharmony_ci/* __n (bit number) = 0...4 */ 5762306a36Sopenharmony_ci#define INTMSR0_GET_INTMSD(x, __n) (((x) >> (__n)) & 0x1) 5862306a36Sopenharmony_ci/* __n (bit number) = 0...9 */ 5962306a36Sopenharmony_ci#define INTMSR0_GET_INTMSC(x, __n) (((x) >> ((__n) + 16)) & 0x1) 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* Interrupt Generation Register 1 from ISP CPU to Host IC */ 6262306a36Sopenharmony_ci#define MCUCTL_REG_INTGR1 (MCUCTL_BASE + 0x1c) 6362306a36Sopenharmony_ci/* __n = 0...9 */ 6462306a36Sopenharmony_ci#define INTGR1_INTGC(__n) (1 << (__n)) 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci/* Interrupt Clear Register 1 from ISP CPU to Host IC */ 6762306a36Sopenharmony_ci#define MCUCTL_REG_INTCR1 (MCUCTL_BASE + 0x20) 6862306a36Sopenharmony_ci/* __n = 0...9 */ 6962306a36Sopenharmony_ci#define INTCR1_INTCC(__n) (1 << (__n)) 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci/* Interrupt Mask Register 1 from ISP CPU to Host IC */ 7262306a36Sopenharmony_ci#define MCUCTL_REG_INTMR1 (MCUCTL_BASE + 0x24) 7362306a36Sopenharmony_ci/* __n = 0...9 */ 7462306a36Sopenharmony_ci#define INTMR1_INTMC(__n) (1 << (__n)) 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci/* Interrupt Status Register 1 from ISP CPU to Host IC */ 7762306a36Sopenharmony_ci#define MCUCTL_REG_INTSR1 (MCUCTL_BASE + 0x28) 7862306a36Sopenharmony_ci/* Interrupt Mask Status Register 1 from ISP CPU to Host IC */ 7962306a36Sopenharmony_ci#define MCUCTL_REG_INTMSR1 (MCUCTL_BASE + 0x2c) 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci/* Interrupt Clear Register 2 from ISP BLK's interrupts to Host IC */ 8262306a36Sopenharmony_ci#define MCUCTL_REG_INTCR2 (MCUCTL_BASE + 0x30) 8362306a36Sopenharmony_ci/* __n = 0...5 */ 8462306a36Sopenharmony_ci#define INTCR2_INTCC(__n) (1 << ((__n) + 16)) 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci/* Interrupt Mask Register 2 from ISP BLK's interrupts to Host IC */ 8762306a36Sopenharmony_ci#define MCUCTL_REG_INTMR2 (MCUCTL_BASE + 0x34) 8862306a36Sopenharmony_ci/* __n = 0...25 */ 8962306a36Sopenharmony_ci#define INTMR2_INTMCIS(__n) (1 << (__n)) 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci/* Interrupt Status Register 2 from ISP BLK's interrupts to Host IC */ 9262306a36Sopenharmony_ci#define MCUCTL_REG_INTSR2 (MCUCTL_BASE + 0x38) 9362306a36Sopenharmony_ci/* Interrupt Mask Status Register 2 from ISP BLK's interrupts to Host IC */ 9462306a36Sopenharmony_ci#define MCUCTL_REG_INTMSR2 (MCUCTL_BASE + 0x3c) 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci/* General Purpose Output Control Register (0~17) */ 9762306a36Sopenharmony_ci#define MCUCTL_REG_GPOCTLR (MCUCTL_BASE + 0x40) 9862306a36Sopenharmony_ci/* __n = 0...17 */ 9962306a36Sopenharmony_ci#define GPOCTLR_GPOG(__n) (1 << (__n)) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci/* General Purpose Pad Output Enable Register (0~17) */ 10262306a36Sopenharmony_ci#define MCUCTL_REG_GPOENCTLR (MCUCTL_BASE + 0x44) 10362306a36Sopenharmony_ci/* __n = 0...17 */ 10462306a36Sopenharmony_ci#define GPOENCTLR_GPOEN(__n) (1 << (__n)) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci/* General Purpose Input Control Register (0~17) */ 10762306a36Sopenharmony_ci#define MCUCTL_REG_GPICTLR (MCUCTL_BASE + 0x48) 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci/* Shared registers between ISP CPU and the host CPU - ISSRxx */ 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci/* ISSR(1): Command Host -> IS */ 11262306a36Sopenharmony_ci/* ISSR(1): Sensor ID for Command, ISSR2...5 = Parameter 1...4 */ 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci/* ISSR(10): Reply IS -> Host */ 11562306a36Sopenharmony_ci/* ISSR(11): Sensor ID for Reply, ISSR12...15 = Parameter 1...4 */ 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci/* ISSR(20): ISP_FRAME_DONE : SENSOR ID */ 11862306a36Sopenharmony_ci/* ISSR(21): ISP_FRAME_DONE : PARAMETER 1 */ 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci/* ISSR(24): SCALERC_FRAME_DONE : SENSOR ID */ 12162306a36Sopenharmony_ci/* ISSR(25): SCALERC_FRAME_DONE : PARAMETER 1 */ 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* ISSR(28): 3DNR_FRAME_DONE : SENSOR ID */ 12462306a36Sopenharmony_ci/* ISSR(29): 3DNR_FRAME_DONE : PARAMETER 1 */ 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci/* ISSR(32): SCALERP_FRAME_DONE : SENSOR ID */ 12762306a36Sopenharmony_ci/* ISSR(33): SCALERP_FRAME_DONE : PARAMETER 1 */ 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci/* __n = 0...63 */ 13062306a36Sopenharmony_ci#define MCUCTL_REG_ISSR(__n) (MCUCTL_BASE + 0x80 + ((__n) * 4)) 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci/* PMU ISP register offsets */ 13362306a36Sopenharmony_ci#define REG_CMU_RESET_ISP_SYS_PWR_REG 0x1174 13462306a36Sopenharmony_ci#define REG_CMU_SYSCLK_ISP_SYS_PWR_REG 0x13b8 13562306a36Sopenharmony_ci#define REG_PMU_ISP_ARM_SYS 0x1050 13662306a36Sopenharmony_ci#define REG_PMU_ISP_ARM_CONFIGURATION 0x2280 13762306a36Sopenharmony_ci#define REG_PMU_ISP_ARM_STATUS 0x2284 13862306a36Sopenharmony_ci#define REG_PMU_ISP_ARM_OPTION 0x2288 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_civoid fimc_is_fw_clear_irq1(struct fimc_is *is, unsigned int bit); 14162306a36Sopenharmony_civoid fimc_is_fw_clear_irq2(struct fimc_is *is); 14262306a36Sopenharmony_ciint fimc_is_hw_get_params(struct fimc_is *is, unsigned int num); 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_civoid fimc_is_hw_set_intgr0_gd0(struct fimc_is *is); 14562306a36Sopenharmony_ciint fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is); 14662306a36Sopenharmony_civoid fimc_is_hw_set_sensor_num(struct fimc_is *is); 14762306a36Sopenharmony_civoid fimc_is_hw_set_isp_buf_mask(struct fimc_is *is, unsigned int mask); 14862306a36Sopenharmony_civoid fimc_is_hw_stream_on(struct fimc_is *is); 14962306a36Sopenharmony_civoid fimc_is_hw_stream_off(struct fimc_is *is); 15062306a36Sopenharmony_ciint fimc_is_hw_set_param(struct fimc_is *is); 15162306a36Sopenharmony_ciint fimc_is_hw_change_mode(struct fimc_is *is); 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_civoid fimc_is_hw_close_sensor(struct fimc_is *is, unsigned int index); 15462306a36Sopenharmony_civoid fimc_is_hw_get_setfile_addr(struct fimc_is *is); 15562306a36Sopenharmony_civoid fimc_is_hw_load_setfile(struct fimc_is *is); 15662306a36Sopenharmony_civoid fimc_is_hw_subip_power_off(struct fimc_is *is); 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ciint fimc_is_itf_s_param(struct fimc_is *is, bool update); 15962306a36Sopenharmony_ciint fimc_is_itf_mode_change(struct fimc_is *is); 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#endif /* FIMC_IS_REG_H_ */ 162