Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1223695pxa; Thu, 6 Aug 2020 02:40:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNjCve1gyW3OHIRRRLd6ymbQ7/lEx/jhfeTpeGq3uDUy/ZY+2vDtRVlUnfQUELWHXmnoeV X-Received: by 2002:a17:906:7e0a:: with SMTP id e10mr3407555ejr.312.1596706850587; Thu, 06 Aug 2020 02:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596706850; cv=none; d=google.com; s=arc-20160816; b=HfNmPTUdD7SoEfHqX5ZmrtRqsS1xnwaeSX06+3b0h+UtXgl/G0PM+EflwZaXUVdKV1 GfcGHciMPimSI2EKjpAofniSBMR1WZgomaRx9HHkvqZzcYfncn9ShFprLGhTgKjeW5nY oDJZEX03nYPxVbRcIYW0RnJciTRKQ6GYXwBdqarITC65MCE8VQW7O70Y4dv7/uTzq4c/ XdrWQnddfKSxZ2cSg9jdeIPK7Wu47iIz/hFE/UwKPT8Bq9/9JuVycVxkDCO/ZQp2rtIm asURShFHm2YlL2njJMJeqPj0cNLsRVPX3SCIHhcg6aQFvBEAKrX5ERvZcMbm6YZmqpt6 NYqQ== 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=WTzfa/t8bk8sxGScWdoKmOhtLiKTTktmTscE+vpAf7A=; b=nVrDEXdVvetr4mmwkcfS1Tk4SOIdAnBVSMXoIhuyS8qpRSTjLMAx7aE7HTFsALKEJZ njbshONo47MWOWJjuKfs5v3xC+bvwTaR04okqTJlKgp51DYde7kE98eq9ZFxpS1vVTVC IH8ZA8B536Y9B1si01+29EiZfNn20mKDaZEZWekh/06jMS310L60FQxbchI6ffRXa0s6 SlrBazM0rRx7E9rciwWCV7vTvuPskS/Dn4A9ilL0Asg4a2vCnCLCkC0ixtEEIV0GU4f+ s5uN4+ntcMDu9Lt2RE8tdDtnq30DJhC1mSsOgrjQkx98KS6I3FdBBaxgN1XDeF6bOtzD UbpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Y3H2sHxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si2996381ejl.221.2020.08.06.02.40.27; Thu, 06 Aug 2020 02:40:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Y3H2sHxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729027AbgHFJcW (ORCPT + 99 others); Thu, 6 Aug 2020 05:32:22 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:51591 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729008AbgHFJWr (ORCPT ); Thu, 6 Aug 2020 05:22:47 -0400 X-UUID: ca487f489f414c2db250a778624f327c-20200806 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=WTzfa/t8bk8sxGScWdoKmOhtLiKTTktmTscE+vpAf7A=; b=Y3H2sHxrdbxhUsv7i6HYTKbS3X042OhpO2CCpu0wA9AMhC712bvUHe2uc5i+i2OK1Jak8EZ2chZgeufiJLiBCTjuWEveiiFqyrWwTquyUkHCUqB5P22LB5JpKT3G4McQLnougvVnp7mo+vmM3VysHW15UqhJ2pF6N7H2UMY+RVM=; X-UUID: ca487f489f414c2db250a778624f327c-20200806 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1798099553; Thu, 06 Aug 2020 17:22:01 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 Aug 2020 17:21:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 Aug 2020 17:21:59 +0800 From: Weiyi Lu To: Enric Balletbo Serra , Matthias Brugger , Nicolas Boichat , Rob Herring , Sascha Hauer CC: James Liao , Fan Chen , , , , , , Weiyi Lu Subject: [PATCH v17 06/12] soc: mediatek: Add support for hierarchical scpsys device node Date: Thu, 6 Aug 2020 17:21:49 +0800 Message-ID: <1596705715-15320-7-git-send-email-weiyi.lu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1596705715-15320-1-git-send-email-weiyi.lu@mediatek.com> References: <1596705715-15320-1-git-send-email-weiyi.lu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VHJ5IHRvIGxpc3QgYWxsIHRoZSBwb3dlciBkb21haW5zIG9mIHVuZGVyIHBvd2VyIGNvbnRyb2xs ZXINCm5vZGUgdG8gc2hvdyB0aGUgZGVwZW5kZW5jeSBiZXR3ZWVuIGVhY2ggcG93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