/*
 *
 * Copyright (C) 2012-2019, Samsung Electronics Co., Ltd.
 *
 * Board base registers and structures
 */

#ifndef __BOARD_H__
#define __BOARD_H__

#include "base.h"

#define USE_TOUCH_INTERRUPT

/* Display constants */
#define BOARD_GRAYSCALE_DEPTH              8
#define BOARD_REDBITDEPTH                  8
#define BOARD_GREENBITDEPTH                8
#define BOARD_BLUEBITDEPTH                 8
#define BOARD_ALPHABITDEPTH                8
#define BOARD_BITSPERPIXEL                 32 /* RGBA */

#define BOARD_WDENSITY                     368
#define BOARD_HDENSITY                     368

#define FB_ALIGN                           SIZE_4KB

/* Define for specific values which are dependent by model */
#define SENSOR_MAX_X_DEFAULT               4095
#define SENSOR_MAX_Y_DEFAULT               4095

/* =============================================== */
/* Board memory map */
/* Display controller(DECON) */
#define DISP_DECON_BASE                    0x14850000 /* Display controller(DECON) */
#define DISP_DECON_SEC_BASE                0x14850000 /* Display controller(DECON) */
#define DISP_DPP_SEC_BASE                  0x14841000 /* L0 */
#define DISP_IDMA_SEC_BASE                 0x14891000 /* L0 */
#define DISP_MIPI_BASE                     0x148C0000 /* Display controller(DECON) */
#define DISP_IDMA_COMMON_BASE              0x14890000 /* Display controller(DECON) */

#define SMMUDECON0_BASE                    0x14900000 /* Display system MMU : DPU0_S1 for L0 */
#define SMMUDECON1_BASE                    0x14930000 /* Display system MMU : DPU0_S1_S for L0_S */
/* Interrupt IDs */
#define NUM_SGI                            16
#define NUM_PPI                            16
#define SPI_IRQ(x)                         (NUM_SGI + NUM_PPI + x)

#define TOUCH_INT_NUM                      SPI_IRQ(4)

/* Touch IC Address */
#define SEC_I2C_ADDR                       0x48
#define TOUCH_IC_SLAVE_ADDR                SEC_I2C_ADDR

/* I2C driver name for touch interface */
#define TOUCH_I2C_DRVNAME                  "/dev/hsi2c/hsi2c0"

/* GPIO registers and bits */
#define GPIO_PA_BASE                       0x10E50000

#define GPA0_CON_OFFSET                    0x0000
#define GPA0_3_CONF_MASK                   (0xFu << 12)
#define GPA0_3_CONF_EINT                   (0xFu << 12)

#define WEINT_GPA0_CON_OFFSET              0x0700
#define GPA0_EINT3_MASK                    (0x7u << 12)
#define GPA0_EINT3_LOW                     (0x0u << 12)
#define GPA0_EINT3_HIGH                    (0x1u << 12)
#define GPA0_EINT3_FALL                    (0x2u << 12)
#define GPA0_EINT3_RISE                    (0x3u << 12)

#define WEINT_GPA0_MASK_OFFSET             0x0900

#define WEINT_GPA0_PEND_OFFSET             0x0A00
#define WEINT_MASK_BIT(x)                  (0x1 << (x))
#define WEINT_GPA0_3                       3
#define WEINT_GPA0_3_PEND                  WEINT_MASK_BIT(WEINT_GPA0_3)

#endif /* __BOARD_H__ */
