Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2683122ybb; Fri, 27 Mar 2020 10:07:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsZxSCtaTITIuZ//Fzsz1r3IN9/94m05wzMrxXmHCP+nHonSekiGbpaHFp2TfwqcGYj59Gc X-Received: by 2002:aca:f591:: with SMTP id t139mr4424074oih.153.1585328834413; Fri, 27 Mar 2020 10:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585328834; cv=none; d=google.com; s=arc-20160816; b=PSk9Xjt5SgZAOc7S/oHc8aR1FPsfnkLX+AXz+4stTZeizhMcLcVS7QtnkN6Pksq2na 0xoDpg115TJET/G0xjr0/h2q6GMYyEP33Rn5LfVnR3pOLMJHdWdSP5AMsWruYDvidCIA C9kaKANGFbbEyzI/wk+zPaOE4lEPeycSMnCosQEMxosbBdVOJQEROSrRnsodtYu+RM5d SrrjPlSBCoeBb8y65siyHgyCHooda2VWJhKbGac84xKWf+vHk8dgesEduvbJA1YPixHY oUv0hF69QzRe/MkLIJVl5d/e/m55Q+j29SVIj4xgUd+O1MTuKmB5om4SHXluulqS7hRh 1F3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OKLY8TX9PBKTkw1igDhhrZ1fVl9lcNMkwfQ7KL1HIxA=; b=rnUhQ0eS0arkU6668Ld85lhh8eUgnOYQ/0Ez3tnpS4CU7toS1bn9N+WWMKu7GMd8Nz pNa9YpTETQu7YISuRnm4CnNGYuDXJ5mPNDKhclPQJKmMRFpW5imOiiTovnxKfB3VCgz9 7OijprL1xOj8zi2nkwZSO7ubsRwYWxbpULhcPbqHCezqo9AwSrEfx699zxouPTCm+BC/ jKAzi2vh1/szSzpTwk8A3wJT469yIbct8LCGxMGNN+1E4JS+mPubMCJhyzLH8e8DtnPg PsIA41hMQXl+ZMwfoz1tIX2LNXR6KgYqAenWUvVfu5aZYT0qgiitclPc+jbXnh1/iJDa aT8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tnykoHw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p189si2611199oic.178.2020.03.27.10.06.54; Fri, 27 Mar 2020 10:07:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tnykoHw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727575AbgC0REt (ORCPT + 99 others); Fri, 27 Mar 2020 13:04:49 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:41542 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbgC0REt (ORCPT ); Fri, 27 Mar 2020 13:04:49 -0400 Received: by mail-io1-f67.google.com with SMTP id y24so10535632ioa.8 for ; Fri, 27 Mar 2020 10:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OKLY8TX9PBKTkw1igDhhrZ1fVl9lcNMkwfQ7KL1HIxA=; b=tnykoHw2n3S9fOwdLtVZZtlKip0gSPE8cylLNt1heu7ggdMFbgkq0l6Rk38A4P5oEV dCcoDTC+hU/tx629HLHBQCYAxl6VGpA/uNEh2PpSn/oiTcfjcjAk0kfEXmKDAW2lv8I/ wAs6rsd1FHtjpCji0GVFM3CNkd2t0UoBL+SksWwmXdmTY9iyHD/thM94OJPDqU2GU4us 4gP8AdM3EOMI9h9skNjoXuLMgUz58KBzgXI96mG4pWNy/YY4TSGi7zG8XICNDOEh80/x vIjleBpy3FKkpgV8JpqwBqKZVRBEvkgptJg0midoZRfhf91sOUWXJm89KTuzAb184Dlb iVmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OKLY8TX9PBKTkw1igDhhrZ1fVl9lcNMkwfQ7KL1HIxA=; b=MkgzZkZmhUS2FnExFDojFX3DO89KrVF5XhD3Tqim/outmwcyAXdyXXfR5dMyQxiiCM OWoT6QJ7BxhsCPMRzVfdmhCRgj4dAa/UNFSiAMl1LTcV6TzIXMO7QMo3E+SltY+ubG3i sl+A+v9RGTQYSdAPZOuRDB7FTvMeqZ3sI4JGQBxGLc/81jfcSddYYUZI6iuIcVhLXrQL urBLpeW/0QVZYV2DS3bVB1VHwBGxSM7Q13OQg2yw7ua2s/MB9dawyWp/YQGpcH/jQzdT nl02qO2GqKAymXiPnAo98FzhA8P46auw4RrgxI4tejDVGENxyrYv9tSGElp2VswL46DZ bOEA== X-Gm-Message-State: ANhLgQ0xxwCnC6cS+mDFme5Cw20A/p3E/bCHxNpJAiLcHb+4eidClXDU HXA7Fq0sjR8vueqyRy8bPkvETX66S1/vvPNlH08= X-Received: by 2002:a5d:954c:: with SMTP id a12mr6842138ios.25.1585328686840; Fri, 27 Mar 2020 10:04:46 -0700 (PDT) MIME-Version: 1.0 References: <20200326174232.23365-1-andrew.smirnov@gmail.com> In-Reply-To: <20200326174232.23365-1-andrew.smirnov@gmail.com> From: Chris Healy Date: Fri, 27 Mar 2020 10:04:37 -0700 Message-ID: Subject: Re: [PATCH] ARM: vf610: report soc info via soc device To: Andrey Smirnov Cc: Shawn Guo , Lucas Stach , linux ARM , linux-kernel , linux-imx@nxp.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On a VF610 Vybrid: Tested-by: Chris Healy On Thu, Mar 26, 2020 at 10:42 AM Andrey Smirnov wrote: > > The patch adds plumbing to soc device info code necessary to support > Vybrid devices. Use case in mind for this is CAAM driver, which > utilizes said API. > > Signed-off-by: Andrey Smirnov > Cc: Lucas Stach > Cc: Chris Healy > Cc: Shawn Guo > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Cc: linux-imx@nxp.com > --- > arch/arm/mach-imx/cpu.c | 16 ++++++++++ > arch/arm/mach-imx/mach-vf610.c | 53 ++++++++++++++++++++++++++++++++++ > arch/arm/mach-imx/mxc.h | 6 ++++ > 3 files changed, 75 insertions(+) > > diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c > index 06f8d64b65af..e3d12b21d6f6 100644 > --- a/arch/arm/mach-imx/cpu.c > +++ b/arch/arm/mach-imx/cpu.c > @@ -172,6 +172,22 @@ struct device * __init imx_soc_device_init(void) > ocotp_compat = "fsl,imx7ulp-ocotp"; > soc_id = "i.MX7ULP"; > break; > + case MXC_CPU_VF500: > + ocotp_compat = "fsl,vf610-ocotp"; > + soc_id = "VF500"; > + break; > + case MXC_CPU_VF510: > + ocotp_compat = "fsl,vf610-ocotp"; > + soc_id = "VF510"; > + break; > + case MXC_CPU_VF600: > + ocotp_compat = "fsl,vf610-ocotp"; > + soc_id = "VF600"; > + break; > + case MXC_CPU_VF610: > + ocotp_compat = "fsl,vf610-ocotp"; > + soc_id = "VF610"; > + break; > default: > soc_id = "Unknown"; > } > diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c > index 9c929b09310c..565dc08412a2 100644 > --- a/arch/arm/mach-imx/mach-vf610.c > +++ b/arch/arm/mach-imx/mach-vf610.c > @@ -3,11 +3,63 @@ > * Copyright 2012-2013 Freescale Semiconductor, Inc. > */ > > +#include > #include > +#include > + > #include > #include > #include > > +#include "common.h" > +#include "hardware.h" > + > +#define MSCM_CPxCOUNT 0x00c > +#define MSCM_CPxCFG1 0x014 > + > +static void __init vf610_detect_cpu(void) > +{ > + struct device_node *np; > + u32 cpxcount, cpxcfg1; > + unsigned int cpu_type; > + void __iomem *mscm; > + > + np = of_find_compatible_node(NULL, NULL, "fsl,vf610-mscm-cpucfg"); > + if (WARN_ON(!np)) > + return; > + > + mscm = of_iomap(np, 0); > + of_node_put(np); > + > + if (WARN_ON(!mscm)) > + return; > + > + cpxcount = readl_relaxed(mscm + MSCM_CPxCOUNT); > + cpxcfg1 = readl_relaxed(mscm + MSCM_CPxCFG1); > + > + iounmap(mscm); > + > + cpu_type = cpxcount ? MXC_CPU_VF600 : MXC_CPU_VF500; > + > + if (cpxcfg1) > + cpu_type |= MXC_CPU_VFx10; > + > + mxc_set_cpu_type(cpu_type); > +} > + > +static void __init vf610_init_machine(void) > +{ > + struct device *parent; > + > + vf610_detect_cpu(); > + > + parent = imx_soc_device_init(); > + if (parent == NULL) > + pr_warn("failed to initialize soc device\n"); > + > + of_platform_default_populate(NULL, NULL, parent); > +} > + > static const char * const vf610_dt_compat[] __initconst = { > "fsl,vf500", > "fsl,vf510", > @@ -20,5 +72,6 @@ static const char * const vf610_dt_compat[] __initconst = { > DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF5xx/VF6xx (Device Tree)") > .l2c_aux_val = 0, > .l2c_aux_mask = ~0, > + .init_machine = vf610_init_machine, > .dt_compat = vf610_dt_compat, > MACHINE_END > diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h > index 2bfd2d59b4a6..48e6d781f15b 100644 > --- a/arch/arm/mach-imx/mxc.h > +++ b/arch/arm/mach-imx/mxc.h > @@ -33,6 +33,12 @@ > #define MXC_CPU_IMX7D 0x72 > #define MXC_CPU_IMX7ULP 0xff > > +#define MXC_CPU_VFx10 0x010 > +#define MXC_CPU_VF500 0x500 > +#define MXC_CPU_VF510 (MXC_CPU_VF500 | MXC_CPU_VFx10) > +#define MXC_CPU_VF600 0x600 > +#define MXC_CPU_VF610 (MXC_CPU_VF600 | MXC_CPU_VFx10) > + > #define IMX_DDR_TYPE_LPDDR2 1 > > #ifndef __ASSEMBLY__ > -- > 2.21.0