Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5016024imb; Thu, 7 Mar 2019 06:02:33 -0800 (PST) X-Google-Smtp-Source: APXvYqwRc9CeS/DqMFlbhZawdDfs6woLL8F/D5ZLeni8hsRbOAgOQzK43eQqiMa+jn/wkNs8U30I X-Received: by 2002:a17:902:3283:: with SMTP id z3mr13136538plb.155.1551967353882; Thu, 07 Mar 2019 06:02:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551967353; cv=none; d=google.com; s=arc-20160816; b=Qj4PJiveSovDdHv4vpHXErZ18I8xXdL8PapiFJ3G56zQMquHxwF6z4rWn/8yTSvvcd AwlIgQQ6Tp/Nx8T8NLIQYmf7/6tHYEVSdXRnX1Ew3/fh2RWPPWUI4HFBfoxHgwPcrfcx HWRPaYGqWz7mNt/Qg3nCOuRK5T0nL3LNQ8TwbWQE/d6c3WwkW5YP9yD+vTCrVuJ40Bn8 Voewz5SMEk4lxYeHQJJwWLm62ZnOisqYWu9UVXggD9PjpiRtrNKOjXf70XJb9cAGEWC5 uan34RrTJZHNfcn89KxeoNNFDKyQyiND6hkZYJeBpyk1CQmKkSfQpC7/WDe6zvx8+eGc CPMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g3rdNZIUpTTqTQJmw0LRepuQplSBP1o3fYoThoCVA3M=; b=Zu5+Pw/XdWmP6ZdrOauYnBYOoKPolgLfARpT1WarQcTNZW6JqBQ8kA4z+MPY5nk3c3 PR7bNr0XA57UdCtgugVZvtV6BaUAedLnq3Azc0UBXJgIGnOKWkienUrQ6azYHbwUHfFA rpc/Mom40vtIf2LQI4QOtiedvmTOtCSUoBE4KVNl7FXGWdOFaaKTWtdheJkioP89qQB7 sKuS4YZkqGdvpSmRdbwYBMiLXij6MfRlQDcVONLUvV0DafBkV5z04yMj8eBNVViwVmuy AP8Qh2W+wYoFJxa+BxfvJGiuk1nkMVxlJjgV7igynypAVWJCoemylQsyhPwBYDnEIoD3 w6Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=rxa6bD5c; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l33si4409347pld.113.2019.03.07.06.02.16; Thu, 07 Mar 2019 06:02:33 -0800 (PST) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=rxa6bD5c; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726267AbfCGOBz (ORCPT + 99 others); Thu, 7 Mar 2019 09:01:55 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35317 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbfCGOBy (ORCPT ); Thu, 7 Mar 2019 09:01:54 -0500 Received: by mail-wm1-f65.google.com with SMTP id y15so9390940wma.0 for ; Thu, 07 Mar 2019 06:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g3rdNZIUpTTqTQJmw0LRepuQplSBP1o3fYoThoCVA3M=; b=rxa6bD5c6GFjEdLxNCwqYuY9O4NG6H+mN7M+a2w8/tGIlq5TKqeCH8mXuEdLXZImdl Nhl7W13NZliJ53EJ6PSn4qZASZln+GrOGBRfGaS0ZaCV3TQ44meqNQRkOMF4iSi8dr83 UYST3ydvZjCQTXo3JcqimBDvV/2MvQWtH7Ykoq7de9WM+/x5F/Q6Q6vnbMD4Px1CFOV5 aTfmmstRM6UmZOFdI57YC1+7EflZBaPhJWHBqxoq342ceo1hY0BoDf4Sjff2W7ZeuaI+ cvTnsTNA+bYaf5vJYA8itX23+o41/a0hA4yTTG/uZV/uFm6ly2Z2Qd48Pe3l1ivKJdTv W+jg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=g3rdNZIUpTTqTQJmw0LRepuQplSBP1o3fYoThoCVA3M=; b=oz56hSR206JG7rjanTSbPoC2WkrdVz06ZRDUz9416UlMnv9zfkO9ZVs+ug1+86HYNU fZSXtXgjbSuJRj8GurRfnJ5JusMO8B8bvPkQBXuL59ApKjUnVk3rFYGiZXH6BHxrYvi2 L9Sps7lzZrGF99y5Y0CnjMpUPfmpq6bcoM26YcFMjAPpRiRa7jnzOCppX7I90935eE+2 n1qaTMbdZBgr+W3f+Dk4htpWumzYL441zw20tYMGAC0xJCzdedk/ujeJa8+UEaNH+njW w2Z5k9+7aepeYSxTksrLdTEeUMeP/zV5LyHTrE77d0g1PMXIq5+//4DpT2tQt6gS41a5 SxXg== X-Gm-Message-State: APjAAAUZS2LEjA4iym/q7RXJO/N0OC+vdBsDlcNfZYgjL2g/n2HYGbvj GNUhI6zEjqTOnL2ILvfonPQGiA== X-Received: by 2002:a1c:f707:: with SMTP id v7mr5848642wmh.109.1551967312309; Thu, 07 Mar 2019 06:01:52 -0800 (PST) Received: from bender.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id h137sm9892098wmg.41.2019.03.07.06.01.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Mar 2019 06:01:51 -0800 (PST) From: Neil Armstrong To: khilman@baylibre.com Cc: Neil Armstrong , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] soc: amlogic: gx-socinfo: Add mask for each SoC packages Date: Thu, 7 Mar 2019 15:01:45 +0100 Message-Id: <20190307140147.22047-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190307140147.22047-1-narmstrong@baylibre.com> References: <20190307140147.22047-1-narmstrong@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When updated IDs on f842c41adc04 ("amlogic: meson-gx-socinfo: Update soc ids") we introduced packages ids using the full 8bit value, but in the function socinfo_to_package_id() the id was filtered with the 0xf0 mask. While the 0xf0 mask is valid for most board, it filters out the lower 4 bits which encodes some characteristics of the chip. This patch moves the mask into the meson_gx_package_id table to be applied on each package name independently and add the correct mask for some specific entries. An example is the S905, in the vendor code the S905 is package_id different from 0x20, and S905M is exactly 0x20. Another example are the The Wetek Hub & Play2 boards using a S905-H variant, which is the S905 SoC with some licence bits enabled. These licence bits are encoded in the lower 4bits, so to detect the -H variant, we must detect the id == 0x3 with the 0xf mask. Fixes: f842c41adc04 ("amlogic: meson-gx-socinfo: Update soc ids") Signed-off-by: Neil Armstrong --- drivers/soc/amlogic/meson-gx-socinfo.c | 32 ++++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c index 37ea0a1c24c8..1ae339f5eadb 100644 --- a/drivers/soc/amlogic/meson-gx-socinfo.c +++ b/drivers/soc/amlogic/meson-gx-socinfo.c @@ -43,20 +43,21 @@ static const struct meson_gx_package_id { const char *name; unsigned int major_id; unsigned int pack_id; + unsigned int pack_mask; } soc_packages[] = { - { "S905", 0x1f, 0 }, - { "S905H", 0x1f, 0x13 }, - { "S905M", 0x1f, 0x20 }, - { "S905D", 0x21, 0 }, - { "S905X", 0x21, 0x80 }, - { "S905W", 0x21, 0xa0 }, - { "S905L", 0x21, 0xc0 }, - { "S905M2", 0x21, 0xe0 }, - { "S912", 0x22, 0 }, - { "962X", 0x24, 0x10 }, - { "962E", 0x24, 0x20 }, - { "A113X", 0x25, 0x37 }, - { "A113D", 0x25, 0x22 }, + { "S905", 0x1f, 0, 0x20 }, /* pack_id != 0x20 */ + { "S905H", 0x1f, 0x3, 0xf }, /* pack_id & 0xf == 0x3 */ + { "S905M", 0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */ + { "S905D", 0x21, 0, 0xf0 }, + { "S905X", 0x21, 0x80, 0xf0 }, + { "S905W", 0x21, 0xa0, 0xf0 }, + { "S905L", 0x21, 0xc0, 0xf0 }, + { "S905M2", 0x21, 0xe0, 0xf0 }, + { "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */ + { "962X", 0x24, 0x10, 0xf0 }, + { "962E", 0x24, 0x20, 0xf0 }, + { "A113X", 0x25, 0x37, 0xff }, + { "A113D", 0x25, 0x22, 0xff }, }; static inline unsigned int socinfo_to_major(u32 socinfo) @@ -81,13 +82,14 @@ static inline unsigned int socinfo_to_misc(u32 socinfo) static const char *socinfo_to_package_id(u32 socinfo) { - unsigned int pack = socinfo_to_pack(socinfo) & 0xf0; + unsigned int pack = socinfo_to_pack(socinfo); unsigned int major = socinfo_to_major(socinfo); int i; for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) { if (soc_packages[i].major_id == major && - soc_packages[i].pack_id == pack) + soc_packages[i].pack_id == + (pack & soc_packages[i].pack_mask)) return soc_packages[i].name; } -- 2.20.1