From patchwork Tue Jul 21 06:46:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11675041 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9FED513B4 for ; Tue, 21 Jul 2020 06:47:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DBBA3206E3 for ; Tue, 21 Jul 2020 06:47:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QQl6cuQj"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="go4DHpIP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBBA3206E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=5HdM3UCRG5GjGI1pqb64WY0/uUzz9uDrONg5Pi6+gSc=; b=QQl6cuQjPsposEzn5BhBQhhUgC sVIawkSrps4BAwWsGyKSgt+01vSdKt8TNkYw1U8pRdrwWfRJAKOAvWBFEngHj1fRPOOZzp1OCd9zE x+VA7YWb6CiYJisuUPygoOqOm9g++4zbkgIgj5UqNyWXqGILShE1eS3mAbLOzZ734X9zsRMALOg00 y0Bnrv6STUdxWw5klNEkN5nQrUlO3Adi9pPggivU86ly3C4SlCx8VlzqNoAYztFJ+Z5wnLXfO/rb8 Vk2ipTAUSMwF+zi8WRGKpeFbCCwt3/PvUWzjmHKpcJQVZBHrEssV66nkrAl42pxm1hAuVe9cxLPdP YQVD473Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxm3b-00051v-5C; Tue, 21 Jul 2020 06:47:19 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxm3Z-00051H-GW for linux-rockchip@lists.infradead.org; Tue, 21 Jul 2020 06:47:18 +0000 Received: by mail-pj1-x1041.google.com with SMTP id k1so1086762pjt.5 for ; Mon, 20 Jul 2020 23:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UkGKEv13mo3TJK7H11nNYLnVoCcbJM+l3q5zgVjuRW0=; b=go4DHpIPB4MPY56bq0gT2dNtTzt+Juf+LekvqK21Wvr8/fjR+IL7FEKPsgTT5smPOL 5DznNMgldePa8izy9taN9+VtLOChcFCP613JrU/HrrRXMxggrUoiY5gnwi8GdpqGuQiy hNzm0bVIAXGb8xG4F0egWipjO32j1kQ2ieeNY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UkGKEv13mo3TJK7H11nNYLnVoCcbJM+l3q5zgVjuRW0=; b=iIpTAZpdvIDInL/mJh56EW0h7vWpcEQ5mM09nd+WPOJGflLYSSXqDllGs9RDCEGYp3 B1VdIPL5QzttWAHETeZOrTR5rAjZVC+S21hgxA7k7RTj4rOT5C0vGEuEJIhBC27E8XJL aqbZea4rRxXkmmXxyJR97JtPawjfmuOsAAFuug4zgH1UDi2O7eKlRDQl9PyCKxxHFVRT HxY/MqIyMmq1Z8n7mjWQ6/b/H2ux2zHbOZEvwSACHmM+JGfNieyMLm6CoYvtFWjcQVis qyXJ5+DmC231ibJuu6/pwOUngd4EKaJ0iMZFOuZmb3M1ahydjVj7phI/cAWzpYOorjK0 RFFA== X-Gm-Message-State: AOAM533d0z4oiOhXfwgTRs62+kQNlanSL9ciZ+vRqkkHgh/+yFGoPIY6 Xdt50VT0WCIUGsSpUCbh4Mbdcg== X-Google-Smtp-Source: ABdhPJypSc+YQ7krhNvhwgDg6D0JvZmmEe4ymumMf2oWyJ8bs2jcpaGOEOvcKlZCoG0URXAjOVZ16g== X-Received: by 2002:a17:902:9a4b:: with SMTP id x11mr21179729plv.255.1595314031816; Mon, 20 Jul 2020 23:47:11 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:38b9:d6b4:d935:307b]) by smtp.gmail.com with ESMTPSA id mv6sm1709069pjb.57.2020.07.20.23.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 23:47:10 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Subject: [PATCH v3 1/2] rockchip: Add rk3288 SoC detection helper Date: Tue, 21 Jul 2020 12:16:37 +0530 Message-Id: <20200721064638.16236-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_024717_668161_2AE318AA X-CRM114-Status: GOOD ( 12.25 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1041 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki , Suniel Mahesh Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Rockchip SoC's has a new revision chip for rk3288 SoCs. RK3288 has a new revision chip called RK3288W which is similar but different hclk_vio clock and fixed OHCI host. Add common Rockchip SoC detection helper to support this rk3288w detection. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- Changes for v3: - add rk3288 cpu spec header .../include/asm/arch-rockchip/cpu_rk3288.h | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/cpu_rk3288.h diff --git a/arch/arm/include/asm/arch-rockchip/cpu_rk3288.h b/arch/arm/include/asm/arch-rockchip/cpu_rk3288.h new file mode 100644 index 0000000000..7445e64b8c --- /dev/null +++ b/arch/arm/include/asm/arch-rockchip/cpu_rk3288.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Rockchip Electronics Co., Ltd. + */ + +#ifndef __ASM_ARCH_CPU_RK3288_H +#define __ASM_ARCH_CPU_RK3288_H + +#include + +#define ROCKCHIP_CPU_MASK 0xffff0000 +#define ROCKCHIP_CPU_RK3288 0x32880000 + +#define ROCKCHIP_SOC_MASK (ROCKCHIP_CPU_MASK | 0xff) +#define ROCKCHIP_SOC_RK3288 (ROCKCHIP_CPU_RK3288 | 0x00) +#define ROCKCHIP_SOC_RK3288W (ROCKCHIP_CPU_RK3288 | 0x01) + +#define RK3288_HDMI_PHYS 0xff980000 +#define HDMI_CONFIG0_ID 0x4 +#define RK3288W_HDMI_REVID 0x1a + +static inline int rockchip_soc_id(void) +{ + u8 reg; + +#if defined(CONFIG_ROCKCHIP_RK3288) + reg = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); + if (reg == RK3288W_HDMI_REVID) + return ROCKCHIP_SOC_RK3288W; + else + return ROCKCHIP_SOC_RK3288; +#else + return 0; +#endif +} + +#define ROCKCHIP_SOC(id, ID) \ +static inline bool soc_is_##id(void) \ +{ \ + int soc_id = rockchip_soc_id(); \ + if (soc_id) \ + return ((soc_id & ROCKCHIP_SOC_MASK) == ROCKCHIP_SOC_ ##ID); \ + return false; \ +} + +ROCKCHIP_SOC(rk3288, RK3288) +ROCKCHIP_SOC(rk3288w, RK3288W) + +#endif /* __ASM_ARCH_CPU_RK3288_H */