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: 1435 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5DE4B3F03F for ; Sat, 4 Jul 2020 11:15:28 +0200 (CEST) Received: by mail-pj1-f70.google.com with SMTP id bf1sf15909759pjb.6 for ; Sat, 04 Jul 2020 02:15:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1593854126; cv=pass; d=google.com; s=arc-20160816; b=fwEw8nLE6GebTscm1G9b86E+A5Bjf8ANWtLWfzCKgB2uC+aTo3jpJeGL7NCq/2T1Mu um3S/U0AWFsd/mfDNMlVT08u7m6AxxHbUy2kHZM21CjbAySjLrnA40yZWmcmAc5VpAzg ZmzOkiyPmLZPXUtEr6fafyO+PDvRDgDm8TWkkOJjdo4CgbJONXAvbgejBljD2O4Lo5/G Wwo/P4HUAreW9idGsY6Nj7k+YoM3gSquqoASxsE3oU9RjY4MApe5uwLShkb47rQHHat5 twYrZuqNawSKyHYimoTGRBicaQ/xZh5vIitIerkT4e7usYqkJk0YCYgtQKaP88SvDStR gewg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=td46qC0j7NGJjuOT3lulaF0XBi7DRpbvAYaa83kGQSA=; b=wP8FsiktjWxXlKfsUuxkW5hnuQEuE5wk5DZzrcFOo/YxvnNV2vGo4d5s8Ur96mU+8I I7xeEI5ZQ1l1O+EJyp3FVx1I9e4EfY3VztnSwOCRd0kvcV1R02J6ToWXlArvuUQAbaQg M6f3T8DayG6mB81B5fOvDJkF3oOFvhybnU6wjZn4yb9PS+d54b5Gjg7C5gDeTUJ53AW9 G6eIYHgVwpFPN/fyTCgNUy51rFHNZ41sbKmRq5LrIedepnDaqvAbtShuMw0GflztLB7Z FYV4NfOUQa+42UhyXnzNNzXELxHoPJiD8OrBg89JcG45L5mYvdG9jbYDiVwSIJcZtrtR 1ZuQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XR6vkglI; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=td46qC0j7NGJjuOT3lulaF0XBi7DRpbvAYaa83kGQSA=; b=mS1nAfcRlySNl4Sn4/+ykEWkHSilWDVXn7hYg1N2hvnVQplfl5OHzA+cem2848QtWD nops50knvUzScKLZAd01wozIUKSPOJ1VZ00/HoGX2ZAwGUd6nowm/LVDtl9vhaM0Yrdc RDc0odtvbcU1drvYymHYnArE/dNrYg3rDFWOY= 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 :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=td46qC0j7NGJjuOT3lulaF0XBi7DRpbvAYaa83kGQSA=; b=sY74iYWf51UYz32FHsuPbTywnklZxSVJhUJzZCJXO2RwQgDelNRE9iqiD8JPYKv848 VwmUn87OowaFm6Bg1Cq0F2mPzPDygcV3euKdKNHyxDDvfrZlmUYgLhX/us4BmmlN6OEg H2h8DuWjKq58ii9F1ASD56aRWCmbriE6ap6sDwlQxojtJS0COnm7r3YWRj2vEqgU9KL7 bgf0QfO/o6WC6uPbLdpDMORGoHHs+u7OgJoN30en9d7kYOz8QxoVMGJfKmV1NLduuu/6 NnzWGvccNoHu50goQ3jpIA0TawUIZxQwOQS2BhGSgiFe3S/Ve0auRLhEazzEKqSf1mWE fsZw== X-Gm-Message-State: AOAM530o+zJTQbUQif2YtEctoM1eY5aEInUT+ZtTYCN/5SJ2U0mzKAiz uxvTLwHgVppaEuNSlaOaUu/ypfJ4 X-Google-Smtp-Source: ABdhPJxCDcxp3UbxQqeFNmuHcxS0ne5kiBzS9K5wSGbI6uMDRe2QseRfvSiVhfE0xfEkT9Btach0Ow== X-Received: by 2002:a63:5a20:: with SMTP id o32mr23798915pgb.15.1593854125987; Sat, 04 Jul 2020 02:15:25 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:f450:: with SMTP id p16ls3684282pgk.5.gmail; Sat, 04 Jul 2020 02:15:25 -0700 (PDT) X-Received: by 2002:a62:7f55:: with SMTP id a82mr27705358pfd.61.1593854125550; Sat, 04 Jul 2020 02:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593854125; cv=none; d=google.com; s=arc-20160816; b=CQ+YDBijNFS26xY2iSFviVRyh8TUnXX4MwoxrEwRCBQs/5W9SDWKipYfTVUsK2qR9U wOGbLgtHYdR93Fi99DQyeb2Nbv8jeKoI4c9LK99THR2B/3uhbBbRGwgo9F0Ujzii5Ca6 FcsfjcYprmW7W+oRLQg3ER2jBXAIxIqQpT7ad+lmVn460CT3ITfA125eise9Y4Zp7AfD jjmTJFtn7++kw2dMHz6Kl54T6F2A4BxCvQsSQxWDTmn6l3mH6gDjN1W4OqSTw0XYlrRF 2emVve75Zr+rjuLrKNRONDYyMzf4otzX2uHPYSqXe6Tg14Jol2vYXxXPuwz4Vq9X7eH4 l9zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Ch7t7JgFjiW4lKYC1YSWH86G7kdXoDb/7ukyKuQkWyA=; b=omWrm9nkZqRRjAxGQ7EprDbTm7ejA6/161xHWhTowGCdYXWeFlukT9c6sWKgFTnOhL LHRqKVar4cF7f8jBGYyYd342X6l8SFUC5h+Q8Ed6wVTIxF2tfvQXp9YotuzcAd+1tdtY vn7jI1oIK05e2yrmaMUQFb3eecqXeHUKvIavo53u220F7b2GXiltZlaqtleFskqJu0nP zov+lEIOLP9n3ihJoljtS96Tf1eHV7NaVbeQvdr0z3bbRBnfOZ2pwcKK/DlyB4OHt3pe K67xtdVUCby6WbFq1gnUGv4cBuKaKZ+vu6INd5769VVB0XKrtY7kzn0nwsJ514+SDDEN 8h8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XR6vkglI; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c20sor19294728pls.63.2020.07.04.02.15.25 for (Google Transport Security); Sat, 04 Jul 2020 02:15:25 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; 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 Cc: Suniel Mahesh , Michael Trimarchi , U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki 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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XR6vkglI; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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