exynos_reg.h revision 1.7.6.3       1  1.7.6.3  jdolecek /*	$NetBSD: exynos_reg.h,v 1.7.6.3 2017/12/03 11:35:56 jdolecek Exp $	*/
      2  1.7.6.3  jdolecek 
      3  1.7.6.2       tls /*-
      4  1.7.6.2       tls  * Copyright (c) 2014 The NetBSD Foundation, Inc.
      5  1.7.6.2       tls  * All rights reserved.
      6  1.7.6.2       tls  *
      7  1.7.6.2       tls  * This code is derived from software contributed to The NetBSD Foundation
      8  1.7.6.2       tls  * by Reinoud Zandijk.
      9  1.7.6.2       tls  *
     10  1.7.6.2       tls  * Redistribution and use in source and binary forms, with or without
     11  1.7.6.2       tls  * modification, are permitted provided that the following conditions
     12  1.7.6.2       tls  * are met:
     13  1.7.6.2       tls  * 1. Redistributions of source code must retain the above copyright
     14  1.7.6.2       tls  *    notice, this list of conditions and the following disclaimer.
     15  1.7.6.2       tls  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.7.6.2       tls  *    notice, this list of conditions and the following disclaimer in the
     17  1.7.6.2       tls  *    documentation and/or other materials provided with the distribution.
     18  1.7.6.2       tls  *
     19  1.7.6.2       tls  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.7.6.2       tls  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.7.6.2       tls  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.7.6.2       tls  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.7.6.2       tls  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.7.6.2       tls  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.7.6.2       tls  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.7.6.2       tls  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.7.6.2       tls  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.7.6.2       tls  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.7.6.2       tls  * POSSIBILITY OF SUCH DAMAGE.
     30  1.7.6.2       tls  */
     31  1.7.6.2       tls 
     32  1.7.6.2       tls #ifndef _ARM_SAMSUNG_EXYNOS_REG_H_
     33  1.7.6.2       tls #define _ARM_SAMSUNG_EXYNOS_REG_H_
     34  1.7.6.2       tls 
     35  1.7.6.2       tls /*
     36  1.7.6.2       tls  *
     37  1.7.6.2       tls  * The exynos can boot from its iROM or from an external Nand memory. Since
     38  1.7.6.2       tls  * these are normally hardly used they are excluded from the normal register
     39  1.7.6.2       tls  * space here.
     40  1.7.6.2       tls  *
     41  1.7.6.2       tls  * XXX What about the audio subsystem region. Where are the docs?
     42  1.7.6.2       tls  *
     43  1.7.6.2       tls  * EXYNOS_CORE_PBASE points to the main SFR region.
     44  1.7.6.2       tls  *
     45  1.7.6.2       tls  * Notes:
     46  1.7.6.2       tls  *
     47  1.7.6.2       tls  * SFR		Special Function Register
     48  1.7.6.2       tls  * ISP		In-System Programming, like a JTAG
     49  1.7.6.2       tls  * ACP		Accelerator Coherency Port
     50  1.7.6.2       tls  * SSS		Security Sub System
     51  1.7.6.2       tls  * GIC		Generic Interurrupt Controller
     52  1.7.6.2       tls  * PMU		Power Management Unit
     53  1.7.6.2       tls  * DMC		2D Graphics engine
     54  1.7.6.2       tls  * LEFTBUS	Data bus / Peripheral bus
     55  1.7.6.2       tls  * RIGHTBUS	,,
     56  1.7.6.2       tls  * G3D		3D Graphics engine
     57  1.7.6.2       tls  * MFC		Multi-Format Codec
     58  1.7.6.2       tls  * LCD0		LCD display
     59  1.7.6.2       tls  * MCT		Multi Core Timer
     60  1.7.6.2       tls  * CMU		Clock Management Unit
     61  1.7.6.2       tls  * TMU		Thermal Management Unit
     62  1.7.6.2       tls  * PPMU		Pin Parametric Measurement Unit (?)
     63  1.7.6.2       tls  * MMU		Memory Management Unit
     64  1.7.6.2       tls  * MCTimer	?
     65  1.7.6.2       tls  * WDT		Watch Dog Timer
     66  1.7.6.2       tls  * RTC		Real Time Clock
     67  1.7.6.2       tls  * KEYIF	Keypad interface
     68  1.7.6.2       tls  * SECKEY	?
     69  1.7.6.2       tls  * TZPC		TrustZone Protection Controller
     70  1.7.6.2       tls  * UART		Universal asynchronous receiver/transmitter
     71  1.7.6.2       tls  * I2C		Inter IC Connect
     72  1.7.6.2       tls  * SPI		Serial Peripheral Interface Bus
     73  1.7.6.2       tls  * I2S		Inter-IC Sound, Integrated Interchip Sound, or IIS
     74  1.7.6.2       tls  * PCM		Pulse-code modulation, audio stream at set fixed rate
     75  1.7.6.2       tls  * SPDIF	Sony/Philips Digital Interface Format
     76  1.7.6.2       tls  * Slimbus	Serial Low-power Inter-chip Media Bus
     77  1.7.6.2       tls  * SMMU		System mmu. No idea as how its programmed (or not)
     78  1.7.6.2       tls  * PERI-L	UART, I2C, SPI, I2S, PCM, SPDIF, PWM, I2CHDMI, Slimbus
     79  1.7.6.2       tls  * PERI-R	CHIPID, SYSREG, PMU/CMU/TMU Bus I/F, MCTimer, WDT, RTC, KEYIF,
     80  1.7.6.2       tls  * 		SECKEY, TZPC
     81  1.7.6.2       tls  */
     82  1.7.6.2       tls 
     83  1.7.6.2       tls /*
     84  1.7.6.2       tls  * Common to Exynos4 and Exynos 5
     85  1.7.6.2       tls  * */
     86  1.7.6.2       tls #define EXYNOS_CORE_PBASE		0x10000000	/* SFR */
     87  1.7.6.2       tls #define EXYNOS_CORE_SIZE		0x10000000
     88  1.7.6.2       tls 
     89  1.7.6.2       tls 
     90  1.7.6.2       tls #define EXYNOS_CHIPID_OFFSET		0x00000000
     91  1.7.6.2       tls #define  EXYNOS_PROD_ID_OFFSET		(EXYNOS_CHIPID_OFFSET + 0)
     92  1.7.6.2       tls #define  EXYNOS_PACKAGE_ID_OFFSET	(EXYNOS_CHIPID_OFFSET + 4)
     93  1.7.6.2       tls 
     94  1.7.6.2       tls #define EXYNOS_PACKAGE_ID_2_GIG		0x06030058
     95  1.7.6.2       tls 
     96  1.7.6.2       tls /* standard block size for offsets defined below */
     97  1.7.6.2       tls #define EXYNOS_BLOCK_SIZE		0x00010000
     98  1.7.6.2       tls 
     99  1.7.6.2       tls 
    100  1.7.6.3  jdolecek #if defined(SOC_EXYNOS5)
    101  1.7.6.2       tls #include <arm/samsung/exynos5_reg.h>
    102  1.7.6.2       tls #endif
    103  1.7.6.3  jdolecek #if defined(SOC_EXYNOS4)
    104  1.7.6.2       tls #include <arm/samsung/exynos4_reg.h>
    105  1.7.6.2       tls #endif
    106  1.7.6.2       tls 
    107  1.7.6.2       tls 
    108  1.7.6.2       tls /* standard frequency settings */
    109  1.7.6.2       tls #define EXYNOS_ACLK_REF_FREQ		(200*1000*1000)	/* 200 Mhz */
    110  1.7.6.2       tls #define EXYNOS_UART_FREQ		(109*1000*1000) /* should be EXYNOS_ACLK_REF_FREQ! */
    111  1.7.6.2       tls 
    112  1.7.6.2       tls #define EXYNOS_F_IN_FREQ		(24*1000*1000)	/* 24 Mhz */
    113  1.7.6.2       tls #define EXYNOS_USB_FREQ			EXYNOS_F_IN_FREQ/* 24 Mhz */
    114  1.7.6.2       tls 
    115  1.7.6.2       tls 
    116  1.7.6.3  jdolecek /* PLLs */
    117  1.7.6.3  jdolecek #define PLL_LOCK_OFFSET			0x000
    118  1.7.6.3  jdolecek #define PLL_CON0_OFFSET			0x100
    119  1.7.6.3  jdolecek #define PLL_CON1_OFFSET			0x104
    120  1.7.6.3  jdolecek 
    121  1.7.6.3  jdolecek #define PLL_CON0_ENABLE			__BIT(31)
    122  1.7.6.3  jdolecek #define PLL_CON0_LOCKED			__BIT(29)	/* has the PLL locked on */
    123  1.7.6.3  jdolecek #define PLL_CON0_M			__BITS(16,25)	/* PLL M divide value */
    124  1.7.6.3  jdolecek #define PLL_CON0_P			__BITS( 8,13)	/* PLL P divide value */
    125  1.7.6.3  jdolecek #define PLL_CON0_S			__BITS( 0, 2)	/* PLL S divide value */
    126  1.7.6.3  jdolecek 
    127  1.7.6.3  jdolecek #define PLL_PMS2FREQ(F, M, P, S) \
    128  1.7.6.3  jdolecek 	((P) == 0 ? 0 : (((M)*(F))/((P)*(1<<(S)))))
    129  1.7.6.3  jdolecek #define PLL_FREQ(f, v) PLL_PMS2FREQ( \
    130  1.7.6.3  jdolecek 	(f),\
    131  1.7.6.3  jdolecek 	__SHIFTOUT((v), PLL_CON0_M),\
    132  1.7.6.3  jdolecek 	__SHIFTOUT((v), PLL_CON0_P),\
    133  1.7.6.3  jdolecek 	__SHIFTOUT((v), PLL_CON0_S))
    134  1.7.6.3  jdolecek 
    135  1.7.6.3  jdolecek 
    136  1.7.6.2       tls /* Watchdog register definitions */
    137  1.7.6.2       tls #define EXYNOS_WDT_WTCON		0x0000
    138  1.7.6.2       tls #define  WTCON_PRESCALER		__BITS(15,8)
    139  1.7.6.2       tls #define  WTCON_ENABLE			__BIT(5)
    140  1.7.6.2       tls #define  WTCON_CLOCK_SELECT		__BITS(4,3)
    141  1.7.6.2       tls #define  WTCON_CLOCK_SELECT_16		__SHIFTIN(0, WTCON_CLOCK_SELECT)
    142  1.7.6.2       tls #define  WTCON_CLOCK_SELECT_32		__SHIFTIN(1, WTCON_CLOCK_SELECT)
    143  1.7.6.2       tls #define  WTCON_CLOCK_SELECT_64		__SHIFTIN(2, WTCON_CLOCK_SELECT)
    144  1.7.6.2       tls #define  WTCON_CLOCK_SELECT_128		__SHIFTIN(3, WTCON_CLOCK_SELECT)
    145  1.7.6.2       tls #define  WTCON_INT_ENABLE		__BIT(2)
    146  1.7.6.2       tls #define  WTCON_RESET_ENABLE		__BIT(0)
    147  1.7.6.2       tls #define EXYNOS_WDT_WTDAT		0x0004
    148  1.7.6.2       tls #define  WTDAT_RELOAD			__BITS(15,0)
    149  1.7.6.2       tls #define EXYNOS_WDT_WTCNT		0x0008
    150  1.7.6.2       tls #define  WTCNT_COUNT			__BITS(15,0)
    151  1.7.6.2       tls #define EXYNOS_WDT_WTCLRINT		0x000C
    152  1.7.6.2       tls 
    153  1.7.6.2       tls 
    154  1.7.6.2       tls /* GPIO register definitions */
    155  1.7.6.2       tls #define EXYNOS_GPIO_GRP_SIZE		0x20
    156  1.7.6.2       tls #define EXYNOS_GPIO_CON			0x00
    157  1.7.6.2       tls #define EXYNOS_GPIO_DAT			0x04
    158  1.7.6.2       tls #define EXYNOS_GPIO_PUD			0x08
    159  1.7.6.2       tls #define EXYNOS_GPIO_DRV			0x0C
    160  1.7.6.2       tls #define EXYNOS_GPIO_CONPWD		0x10
    161  1.7.6.2       tls #define EXYNOS_GPIO_PUDPWD		0x14
    162  1.7.6.2       tls /* rest of space is not used */
    163  1.7.6.2       tls 
    164  1.7.6.2       tls #define EXYNOS_GPIO_FUNC_INPUT		0x0
    165  1.7.6.2       tls #define EXYNOS_GPIO_FUNC_OUTPUT		0x1
    166  1.7.6.2       tls /* intermediate values are devices, definitions dependent on pin */
    167  1.7.6.2       tls #define EXYNOS_GPIO_FUNC_EXTINT		0xF
    168  1.7.6.2       tls 
    169  1.7.6.2       tls #define EXYNOS_GPIO_PIN_FLOAT		0
    170  1.7.6.2       tls #define EXYNOS_GPIO_PIN_PULL_DOWN	1
    171  1.7.6.2       tls #define EXYNOS_GPIO_PIN_PULL_UP		3
    172  1.7.6.2       tls 
    173  1.7.6.2       tls 
    174  1.7.6.2       tls /* used PMU registers */
    175  1.7.6.2       tls /* Exynos 4210 or Exynos 5 */
    176  1.7.6.2       tls #define EXYNOS_PMU_USBDEV_PHY_CTRL	0x704
    177  1.7.6.2       tls #define EXYNOS_PMU_USBHOST_PHY_CTRL	0x708
    178  1.7.6.2       tls /* Exynos 4x12 */
    179  1.7.6.2       tls #define EXYNOS_PMU_USB_PHY_CTRL		0x704
    180  1.7.6.2       tls #define EXYNOS_PMU_USB_HSIC_1_PHY_CTRL	0x708
    181  1.7.6.2       tls #define EXYNOS_PMU_USB_HSIC_2_PHY_CTRL	0x70C
    182  1.7.6.2       tls 
    183  1.7.6.3  jdolecek #define   PMU_PHY_ENABLE		(1 << 0)
    184  1.7.6.3  jdolecek #define   PMU_PHY_DISABLE		(0)
    185  1.7.6.2       tls 
    186  1.7.6.3  jdolecek #define EXYNOS_PMU_DEBUG_CLKOUT		0x0A00
    187  1.7.6.2       tls 
    188  1.7.6.2       tls /* used SYSREG registers */
    189  1.7.6.2       tls #define EXYNOS5_SYSREG_USB20_PHY_TYPE	0x230
    190  1.7.6.3  jdolecek #define   USB20_PHY_HOST_LINK_EN	(1 << 0)
    191  1.7.6.2       tls 
    192  1.7.6.2       tls 
    193  1.7.6.3  jdolecek /* Generic USB registers/constants */
    194  1.7.6.3  jdolecek #define FSEL_CLKSEL_50M			7
    195  1.7.6.3  jdolecek #define FSEL_CLKSEL_24M			5
    196  1.7.6.3  jdolecek #define FSEL_CLKSEL_20M			4
    197  1.7.6.3  jdolecek #define FSEL_CLKSEL_19200K		3
    198  1.7.6.3  jdolecek #define FSEL_CLKSEL_12M			2
    199  1.7.6.3  jdolecek #define FSEL_CLKSEL_10M			1
    200  1.7.6.3  jdolecek #define FSEL_CLKSEL_9600K		0
    201  1.7.6.2       tls 
    202  1.7.6.2       tls #endif /* _ARM_SAMSUNG_EXYNOS_REG_H_ */
    203