public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Johan Jonker <jbx6244@gmail.com>
To: kever.yang@rock-chips.com
Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, lukma@denx.de,
	seanga2@gmail.com, u-boot@lists.denx.de
Subject: [PATCH v8 02/15] rockchip: rk3066: add grf header file
Date: Tue, 18 Jan 2022 01:36:50 +0100	[thread overview]
Message-ID: <20220118003703.10678-3-jbx6244@gmail.com> (raw)
In-Reply-To: <20220118003703.10678-1-jbx6244@gmail.com>

From: Paweł Jarosz <paweljarosz3691@gmail.com>

grf is needed by various drivers for rk3066 soc.

Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Changed V8:
  add GRF_GPIO3B_IOMUX for SDMMC0
  use GENMASK, __bf_shf and REG defines
  add includes
---
 .../include/asm/arch-rockchip/grf_rk3066.h    | 210 ++++++++++++++++++
 1 file changed, 210 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3066.h

diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk3066.h b/arch/arm/include/asm/arch-rockchip/grf_rk3066.h
new file mode 100644
index 00000000..9863560c
--- /dev/null
+++ b/arch/arm/include/asm/arch-rockchip/grf_rk3066.h
@@ -0,0 +1,210 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2021 Paweł Jarosz <paweljarosz3691@gmail.com>
+ */
+
+#ifndef _ASM_ARCH_GRF_RK3066_H
+#define _ASM_ARCH_GRF_RK3066_H
+
+#include <linux/bitops.h>
+#include <linux/bitfield.h>
+
+#define REG(name, h, l) \
+        name##_MASK = GENMASK(h, l), \
+        name##_SHIFT = __bf_shf(name##_MASK)
+
+struct rk3066_grf_gpio_lh {
+	u32 l;
+	u32 h;
+};
+
+struct rk3066_grf {
+	struct rk3066_grf_gpio_lh gpio_dir[7];
+	struct rk3066_grf_gpio_lh gpio_do[7];
+	struct rk3066_grf_gpio_lh gpio_en[7];
+
+	u32 gpio0a_iomux;
+	u32 gpio0b_iomux;
+	u32 gpio0c_iomux;
+	u32 gpio0d_iomux;
+
+	u32 gpio1a_iomux;
+	u32 gpio1b_iomux;
+	u32 gpio1c_iomux;
+	u32 gpio1d_iomux;
+
+	u32 gpio2a_iomux;
+	u32 gpio2b_iomux;
+	u32 gpio2c_iomux;
+	u32 gpio2d_iomux;
+
+	u32 gpio3a_iomux;
+	u32 gpio3b_iomux;
+	u32 gpio3c_iomux;
+	u32 gpio3d_iomux;
+
+	u32 gpio4a_iomux;
+	u32 gpio4b_iomux;
+	u32 gpio4c_iomux;
+	u32 gpio4d_iomux;
+
+	u32 reserved0[5];
+
+	u32 gpio6b_iomux;
+
+	u32 reserved1[2];
+
+	struct rk3066_grf_gpio_lh gpio_pull[7];
+
+	u32 soc_con0;
+	u32 soc_con1;
+	u32 soc_con2;
+
+	u32 soc_status0;
+
+	u32 dmac1_con[3];
+	u32 dmac2_con[4];
+
+	u32 uoc0_con[3];
+	u32 uoc1_con[4];
+	u32 ddrc_con;
+	u32 ddrc_stat;
+
+	u32 reserved2[10];
+
+	u32 os_reg[4];
+};
+
+check_member(rk3066_grf, os_reg[3], 0x01d4);
+
+/* GRF_GPIO1B_IOMUX */
+enum {
+	REG(GPIO1B1, 2, 2),
+	GPIO1B1_GPIO		= 0,
+	GPIO1B1_UART2_SOUT,
+
+	REG(GPIO1B0, 0, 0),
+	GPIO1B0_GPIO		= 0,
+	GPIO1B0_UART2_SIN
+};
+
+/* GRF_GPIO3B_IOMUX */
+enum {
+	REG(GPIO3B6, 12, 12),
+	GPIO3B6_GPIO		= 0,
+	GPIO3B6_SDMMC0_DECTN,
+
+	REG(GPIO3B5, 10, 10),
+	GPIO3B5_GPIO		= 0,
+	GPIO3B5_SDMMC0_DATA3,
+
+	REG(GPIO3B4, 8, 8),
+	GPIO3B4_GPIO		= 0,
+	GPIO3B4_SDMMC0_DATA2,
+
+	REG(GPIO3B3, 6, 6),
+	GPIO3B3_GPIO		= 0,
+	GPIO3B3_SDMMC0_DATA1,
+
+	REG(GPIO3B2, 4, 4),
+	GPIO3B2_GPIO		= 0,
+	GPIO3B2_SDMMC0_DATA0,
+
+	REG(GPIO3B1, 2, 2),
+	GPIO3B1_GPIO		= 0,
+	GPIO3B1_SDMMC0_CMD,
+
+	REG(GPIO3B0, 0, 0),
+	GPIO3B0_GPIO		= 0,
+	GPIO3B0_SDMMC0_CLKOUT,
+};
+
+/* GRF_SOC_CON0 */
+enum {
+	REG(SMC_MUX_CON, 13, 13),
+
+	REG(NOC_REMAP, 12, 12),
+
+	REG(EMMC_FLASH_SEL, 11, 11),
+
+	REG(TZPC_REVISION, 10, 7),
+
+	REG(L2CACHE_ACC, 6, 5),
+
+	REG(L2RD_WAIT, 4, 3),
+
+	REG(IMEMRD_WAIT, 2, 1),
+
+	REG(SOC_REMAP, 0, 0),
+};
+
+/* GRF_SOC_CON1 */
+enum {
+	REG(RKI2C4_SEL, 15, 15),
+
+	REG(RKI2C3_SEL, 14, 14),
+
+	REG(RKI2C2_SEL, 13, 13),
+
+	REG(RKI2C1_SEL, 12, 12),
+
+	REG(RKI2C0_SEL, 11, 11),
+
+	REG(VCODEC_SEL, 10, 10),
+
+	REG(PERI_EMEM_PAUSE, 9, 9),
+
+	REG(PERI_USB_PAUSE, 8, 8),
+
+	REG(SMC_MUX_MODE_0, 6, 6),
+
+	REG(SMC_SRAM_MW_0, 5, 4),
+
+	REG(SMC_REMAP_0, 3, 3),
+
+	REG(SMC_A_GT_M0_SYNC, 2, 2),
+
+	REG(EMAC_SPEED, 1, 1),
+
+	REG(EMAC_MODE, 0, 0),
+};
+
+/* GRF_SOC_CON2 */
+enum {
+	REG(MSCH4_MAINDDR3, 7, 7),
+	MSCH4_MAINDDR3_DDR3	= 1,
+
+	REG(EMAC_NEWRCV_EN, 6, 6),
+
+	REG(SW_ADDR15_EN, 5, 5),
+
+	REG(SW_ADDR16_EN, 4, 4),
+
+	REG(SW_ADDR17_EN, 3, 3),
+
+	REG(BANK2_TO_RANK_EN, 2, 2),
+
+	REG(RANK_TO_ROW15_EN, 1, 1),
+
+	REG(UPCTL_C_ACTIVE_IN, 0, 0),
+	UPCTL_C_ACTIVE_IN_MAY	= 0,
+	UPCTL_C_ACTIVE_IN_WILL,
+};
+
+/* GRF_DDRC_CON0 */
+enum {
+	REG(DTO_LB, 12, 11),
+
+	REG(DTO_TE, 10, 9),
+
+	REG(DTO_PDR, 8, 7),
+
+	REG(DTO_PDD, 6, 5),
+
+	REG(DTO_IOM, 4, 3),
+
+	REG(DTO_OE, 2, 1),
+
+	REG(ATO_AE, 0, 0),
+};
+#endif
-- 
2.20.1


  parent reply	other threads:[~2022-01-18  0:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18  0:36 [PATCH v8 00/15] Add Rikomagic MK808 board Johan Jonker
2022-01-18  0:36 ` [PATCH v8 01/15] rockchip: rk3066-power: sync power domain dt-binding header from Linux Johan Jonker
2022-01-18  0:36 ` Johan Jonker [this message]
2022-01-18  0:36 ` [PATCH v8 03/15] rockchip: rk3066: add clock driver for rk3066 soc Johan Jonker
2022-01-20  0:31   ` Sean Anderson
2022-01-18  0:36 ` [PATCH v8 04/15] rockchip: rk3066: add rk3066 pinctrl driver Johan Jonker
2022-01-18  0:36 ` [PATCH v8 05/15] rockchip: rk3066: add sdram driver Johan Jonker
2022-01-18  0:36 ` [PATCH v8 06/15] arm: dts: rockchip: fix rk3xxx-u-boot.dtsi Johan Jonker
2022-01-18  0:36 ` [PATCH v8 07/15] arm: dts: rockchip: add rk3066a.dtsi Johan Jonker
2022-01-18  0:36 ` [PATCH v8 08/15] arm: dts: rockchip: add rk3066a-mk808.dts Johan Jonker
2022-01-18  0:36 ` [PATCH v8 09/15] rockchip: rk3066: add include Johan Jonker
2022-01-18  0:36 ` [PATCH v8 10/15] rockchip: rk3066: add rk3066_common.h include Johan Jonker
2022-01-18  0:36 ` [PATCH v8 11/15] rockchip: rk3066: add core support Johan Jonker
2022-01-18  0:37 ` [PATCH v8 12/15] rockchip: rk3066: add Rikomagic MK808 board Johan Jonker
2022-01-18  0:37 ` [PATCH v8 13/15] rockchip: rk3066: add mk808_defconfig Johan Jonker
2022-01-18  0:37 ` [PATCH v8 14/15] rockchip: tools: add rk3066 support to rkcommon.c Johan Jonker
2022-01-18  0:37 ` [PATCH v8 15/15] doc: rockchip: add rk3066 Rikomagic MK808 Johan Jonker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220118003703.10678-3-jbx6244@gmail.com \
    --to=jbx6244@gmail.com \
    --cc=kever.yang@rock-chips.com \
    --cc=lukma@denx.de \
    --cc=philipp.tomsich@vrull.eu \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox