From patchwork Mon Nov 6 12:02:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 834668 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="IYJQJLXE"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yVrv65cGSz9s7M for ; Mon, 6 Nov 2017 23:08:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 861D2C21D7E; Mon, 6 Nov 2017 12:05:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 602BAC21EBD; Mon, 6 Nov 2017 12:03:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0274DC21DDE; Mon, 6 Nov 2017 12:03:10 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by lists.denx.de (Postfix) with ESMTPS id 49C2BC21DE5 for ; Mon, 6 Nov 2017 12:02:59 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id u40so8312286wrf.10 for ; Mon, 06 Nov 2017 04:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=MLkWxIk5/SSQy7Be2KQrUj/cLd5pNZ4eEgzXJx3X4Uw=; b=IYJQJLXESxIo4kJWf2jsPHsZEEbf3pl23ixwMRhc77VgRC1XGZA624kR5jf6QUl8sk EOdwyrTz+Ghhwk1NtaUMvU/zVKQSDI1y+XRl5lFqYatP7oa18vsV0iVgQ56PXLaHs1iW psUGmcbsZo65OgKmXf18oiNrVatv9vn4vJddaZ2uoTYPrQrV6eCUCTwTqtoLFSUJd4dU nCsclf72WFSGc6n7xDeJCVuYNMIbjYBCf4cTxMC9VNcCoJXwVVjembxMic54AqjLJfxp jlIBzjXqH+hf1Ok1ZTAyvLgZPLZDsIiW+aEIU6Takj/kx/boIzXA9CzeuTbylG36lDFj +d9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=MLkWxIk5/SSQy7Be2KQrUj/cLd5pNZ4eEgzXJx3X4Uw=; b=BwU4hJhQxG3d1c3zbVV/35P3qz4OMylxDrOyma131TASv6I7O/TPEKwajhDbziX3hc f9QJeZYUc5iMxthYbxMMxN+PWaYJnZ13cexNEbuIBz6u4CMZEMIXAA4l3gaj7GGaCl68 4BsguQFx2kkRLmGU7kiVLGrE97FB/HbBoG1KH5ym4vqTfsCQmBVsXDX1MUMu4UkPVQ76 xuG7odMAx421aiqbcCjk4fFnwdi6WsCjjdNLvaw8sw7Dgc8zqNoHqBbqA+uSVPTQPbQE wtfJUXIF8qPptOwYpl2xFE9HUV+vkT3jszZjBFJj6JBgpx3zi+5oHGn/vhy4x1HPJjiz k4Ig== X-Gm-Message-State: AJaThX5IHbAAzmhgAAqP32YDs6v20mAn+VKzrVsUOAD98IIurpNSONxo m3G1Vfi/xoZGbP3iCgaIrHt2AhjS X-Google-Smtp-Source: ABhQp+QnGB/BvVFTmyrkjcSVGqlwu0/8lW+OTI6gCBm029Ev36evFksrlFJJFdItiHvZ78ND77Ptqg== X-Received: by 10.223.161.84 with SMTP id r20mr7036428wrr.168.1509969778802; Mon, 06 Nov 2017 04:02:58 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id 68sm7238804wmh.2.2017.11.06.04.02.58 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 06 Nov 2017 04:02:58 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de Date: Mon, 6 Nov 2017 13:02:44 +0100 Message-Id: <49270da6a0d2ddfb574e7e868152132dc25e57c5.1509969762.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <3133b3b4955ec21b2869136e7c13f69cb8c2caee.1509969762.git.michal.simek@xilinx.com> References: <3133b3b4955ec21b2869136e7c13f69cb8c2caee.1509969762.git.michal.simek@xilinx.com> In-Reply-To: <3133b3b4955ec21b2869136e7c13f69cb8c2caee.1509969762.git.michal.simek@xilinx.com> References: <3133b3b4955ec21b2869136e7c13f69cb8c2caee.1509969762.git.michal.simek@xilinx.com> Subject: [U-Boot] [PATCH 08/11] arm64: zynqmp: Add support for CG/EG/EV device detection X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Version string has unused fields 31:20 which can be used for exporting 9 bits from efuse IPDISABLE regs to recognize eg/cg/ev devices. These efuse bits are setup for certain devices. Signed-off-by: Michal Simek --- arch/arm/include/asm/arch-zynqmp/hardware.h | 2 + arch/arm/include/asm/arch-zynqmp/sys_proto.h | 1 + board/xilinx/zynqmp/zynqmp.c | 68 +++++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/arch-zynqmp/hardware.h b/arch/arm/include/asm/arch-zynqmp/hardware.h index 5f2c98d633e3..327046bf1b29 100644 --- a/arch/arm/include/asm/arch-zynqmp/hardware.h +++ b/arch/arm/include/asm/arch-zynqmp/hardware.h @@ -128,6 +128,8 @@ struct apu_regs { #define ZYNQMP_CSU_VERSION_VELOCE 0x2 #define ZYNQMP_CSU_VERSION_QEMU 0x3 +#define ZYNQMP_CSU_VERSION_EMPTY_SHIFT 20 + #define ZYNQMP_SILICON_VER_MASK 0xF000 #define ZYNQMP_SILICON_VER_SHIFT 12 diff --git a/arch/arm/include/asm/arch-zynqmp/sys_proto.h b/arch/arm/include/asm/arch-zynqmp/sys_proto.h index db1d5ef306f8..f256c7d4a996 100644 --- a/arch/arm/include/asm/arch-zynqmp/sys_proto.h +++ b/arch/arm/include/asm/arch-zynqmp/sys_proto.h @@ -15,6 +15,7 @@ enum { IDCODE, VERSION, + IDCODE2, }; enum { diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 5e22cc54ba69..2b1d8119f567 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -28,6 +28,7 @@ static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC; static const struct { u32 id; + u32 ver; char *name; } zynqmp_devices[] = { { @@ -35,33 +36,88 @@ static const struct { .name = "3eg", }, { + .id = 0x10, + .ver = 0x2c, + .name = "3cg", + }, + { .id = 0x11, .name = "2eg", }, { + .id = 0x11, + .ver = 0x2c, + .name = "2cg", + }, + { .id = 0x20, .name = "5ev", }, { + .id = 0x20, + .ver = 0x100, + .name = "5eg", + }, + { + .id = 0x20, + .ver = 0x12c, + .name = "5cg", + }, + { .id = 0x21, .name = "4ev", }, { + .id = 0x21, + .ver = 0x100, + .name = "4eg", + }, + { + .id = 0x21, + .ver = 0x12c, + .name = "4cg", + }, + { .id = 0x30, .name = "7ev", }, { + .id = 0x30, + .ver = 0x100, + .name = "7eg", + }, + { + .id = 0x30, + .ver = 0x12c, + .name = "7cg", + }, + { .id = 0x38, .name = "9eg", }, { + .id = 0x38, + .ver = 0x2c, + .name = "9cg", + }, + { .id = 0x39, .name = "6eg", }, { + .id = 0x39, + .ver = 0x2c, + .name = "6cg", + }, + { .id = 0x40, .name = "11eg", }, + { /* For testing purpose only */ + .id = 0x50, + .ver = 0x2c, + .name = "15cg", + }, { .id = 0x50, .name = "15eg", @@ -95,6 +151,7 @@ int chip_id(unsigned char id) * regs[0][31:0] = status of the operation * regs[0][63:32] = CSU.IDCODE register * regs[1][31:0] = CSU.version register + * regs[1][63:32] = CSU.IDCODE2 register */ switch (id) { case IDCODE: @@ -109,6 +166,11 @@ int chip_id(unsigned char id) regs.regs[1] &= ZYNQMP_CSU_SILICON_VER_MASK; val = regs.regs[1]; break; + case IDCODE2: + regs.regs[1] = lower_32_bits(regs.regs[1]); + regs.regs[1] >>= ZYNQMP_CSU_VERSION_EMPTY_SHIFT; + val = regs.regs[1]; + break; default: printf("%s, Invalid Req:0x%x\n", __func__, id); } @@ -136,11 +198,13 @@ int chip_id(unsigned char id) !defined(CONFIG_SPL_BUILD) static char *zynqmp_get_silicon_idcode_name(void) { - u32 i, id; + u32 i, id, ver; id = chip_id(IDCODE); + ver = chip_id(IDCODE2); + for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { - if (zynqmp_devices[i].id == id) + if (zynqmp_devices[i].id == id && zynqmp_devices[i].ver == ver) return zynqmp_devices[i].name; } return "unknown";