From patchwork Sat Jul 4 09:15:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11643383 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 BEACF913 for ; Sat, 4 Jul 2020 09:15:35 +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 8DA82214F1 for ; Sat, 4 Jul 2020 09:15:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NLINBJN8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="XR6vkglI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DA82214F1 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=UlBOkTAczkbKdD/oMtkizcFpL8+psD8WdBsTZ3uVaL0=; b=NLINBJN8Lq/RHK3xM/XraNIAWj M04RxuXg6BI/uLCvUddf2+InMNRisLQtEZPm4rvvQDrSMSSwQcjQjfkwDY5Nqg/2fhvyJVdpTXwG0 t4k0upOMjoz6o6hvuP8Qid9kgM3SdF0drGfBv26lMXRijLN7Qua2cfw9SrQrTDEnp12N6mBh7kLq6 L7PAkmHA1x+OK6CP9EdhRREl7VguuDZ78pzgijZRZItXi15gEgxXYYChbenkHHFDVJ82IJxnN8bY8 cFM6Z5p5PiGv0Z182mP/F+NHzMthL0o/92OamlkexnGsa/jrR1MM1Z2pfEIVBK501C6wxhpOyaJew N/HyrwVg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jreGf-0006bF-NT; Sat, 04 Jul 2020 09:15:29 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jreGd-0006ar-N5 for linux-rockchip@lists.infradead.org; Sat, 04 Jul 2020 09:15:29 +0000 Received: by mail-pl1-x644.google.com with SMTP id s14so13463975plq.6 for ; Sat, 04 Jul 2020 02:15:26 -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=Ch7t7JgFjiW4lKYC1YSWH86G7kdXoDb/7ukyKuQkWyA=; b=XR6vkglI8GOcfUdc+ejlj3E043EeTZ0wQrNZvRoX2sabaDea2E1JM28Cf5U/CNyObf 6Inlc0ABFxRG5OX6jVA+2Wcm1Ehl1X2+iBw4f6AuPhW5/eoygADoClfNSkknIny+HXym VKq7Mdc38z/hIIgB59OwekKV9H3uxhkzaMnjM= 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=Ch7t7JgFjiW4lKYC1YSWH86G7kdXoDb/7ukyKuQkWyA=; b=OJkDYEfIolgbHnh4mriMU0mkV8G0XUco9VeVbs+ZXZEarsQfjGIRIKvF99xm1Ow1UH +IAh5IzrKSR+he/Yt6KNxlo5LfKrvVTowyaMSwPGyb1zSDdjJtQ+kwQnS632t30uR1+/ e6Zo1QiFglmYkzkmZ3iIpu63SuUtdc+2knHEXTLrS8w92iVKXZapJxF+vUN2Gdd8owQ0 Knfb69YlaLBy0/2/Fv1yATvgKv4ZZZiGM3P29RDbVfm6u5I+1yjOyfpRdVn23CuYncAd KB8KzXm7j9rkH1Q0duKsN3G38NlRABpcAXTpr1dZUkzDuv8R4RhEXXPcS3gvoUO8yi2R 8iOw== X-Gm-Message-State: AOAM530+Tg8EPwFjGYKIq9srS66rdAIvYvdM6cIX7Xy0UwveiAtoUK64 KCxD3pKama//4XTt8s4y0J8OZg== X-Google-Smtp-Source: ABdhPJxezkDJpIGWWJcZg83OLvIpJxcFGw44RZc27f2WZ+2AfJzuugZhkGfCPqcjMFXDxQsTea3LCA== X-Received: by 2002:a17:902:b197:: with SMTP id s23mr26553343plr.157.1593854124559; Sat, 04 Jul 2020 02:15:24 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:bdf4:3289:4b66:dcc0]) by smtp.gmail.com with ESMTPSA id h194sm13946930pfe.201.2020.07.04.02.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 02:15:23 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass , heiko@sntech.de, mylene.josserand@collabora.com, Ezequiel Garcia , Robin Murphy Subject: [PATCH v2 1/2] rockchip: Add SoC detection helper Date: Sat, 4 Jul 2020 14:45:02 +0530 Message-Id: <20200704091503.71121-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-20200704_051528_501239_7DF67985 X-CRM114-Status: GOOD ( 12.02 ) 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:644 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: linux-rockchip@lists.infradead.org, U-Boot-Denx , Jagan Teki , Suniel Mahesh , Michael Trimarchi , linux-amarula 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, rk3308 based SoCs. RK3288 has a new revision chip called RK3288W which is relevantly similar but different hclk_vio clock and working ohci host. Add common rockchip SoC detection helper to support this rk3288w detection. Signed-off-by: Jagan Teki --- Changes for v2: - new patch arch/arm/include/asm/arch-rockchip/cpu.h | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/cpu.h diff --git a/arch/arm/include/asm/arch-rockchip/cpu.h b/arch/arm/include/asm/arch-rockchip/cpu.h new file mode 100644 index 0000000000..d0d22e4967 --- /dev/null +++ b/arch/arm/include/asm/arch-rockchip/cpu.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Rockchip Electronics Co., Ltd. + */ + +#ifndef __ASM_ARCH_CPU_H +#define __ASM_ARCH_CPU_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