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