From patchwork Thu Jan 31 09:31:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pi-Hsun Shih X-Patchwork-Id: 10790193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 188E513BF for ; Thu, 31 Jan 2019 09:31:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 159332FC84 for ; Thu, 31 Jan 2019 09:31:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0929A307D0; Thu, 31 Jan 2019 09:31:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B2192FC84 for ; Thu, 31 Jan 2019 09:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=98FioacNnzRZQBhDFdJ4/hbcnWL9M/nUX/igsY/PN5g=; b=kJ4lMKO9ePa9lS HIFuQfcwxdVZufU/+Z6mNq+i5QEMFJMD+o98j98VMSCTVi54GoSgfF41JGW5381u4vSt2x+b+zpGw uXyaL/w7lnSKFTCmnVy1MJe15Ws7bDNHGc/KXHk1gBjAjZt9XHL0hcDpBQTRTg+NVOp5uRqpbxmpY Fy9K1LGMnk8QKtly3QBsL0+UeCpEPIHmX/IquFVg9op02zZ36/xeCUts/5MnCCzdQ2OM84SrMHt+g Wa7Aoy6KVQClcE1O/w8/zDlxpNJGQ/y3dsn8sz+dG1O1cI6ab0LPwS6o/NOl8uCtbKySX3LgYdHie k9kzlIKkDY3k1It8BZ3Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gp8hK-0001Vr-Bl; Thu, 31 Jan 2019 09:31:50 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gp8h7-0001LM-NN for linux-mediatek@lists.infradead.org; Thu, 31 Jan 2019 09:31:39 +0000 Received: by mail-pg1-x544.google.com with SMTP id s198so1130893pgs.2 for ; Thu, 31 Jan 2019 01:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4OtgONdJwDFd234v9Pslh5YREJZOrcQFD7neLLWvizQ=; b=CHZLccXLaDg9+KFMEYFlx4YSl746hZhxGzFP/L+KAFwPw0whxzS99AIiRm0E4pODS3 12Y85ZJJH+A3u/J0Xog2wO8bVROVtVZkfHr9dzT4AH5sGsRTWqLovnEmWlAPOb7bJ5nc nFc6CklsW+XZUmYgGR+QRfWp41rlIAfkySa3o= 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 :content-transfer-encoding; bh=4OtgONdJwDFd234v9Pslh5YREJZOrcQFD7neLLWvizQ=; b=L1pPf0eTGNgpk3wISiffOGA9eral9zGdyzAxi8IT574o2/v8N5xH6aEZMSBuLhJI7H 9uttHFGMdfDFTrmVgwvdklJF0e0kOB0ROgHZ0PxWZYytJ5OCXNTam5jAK+ANJ97iG6sZ U5UVQJxMErWa8w2lIR9B4g4S81XayKpJNXREg4vMRDzrz3+tGWDPvA4ZGIFadi/bMGOO XA5Gp6uuSlSooNsa9iuFkE6/bK7x/zgyVmDplPmk1mrOfukW4H7VDFUPRSVY8Bjk878m enzniJGg8BXumZ3KqGSFLCotGZDaVFOdCzl7MDRcwuwyRir8StzvLQrqEShyZZv5+VJw TFKg== X-Gm-Message-State: AJcUukcprhrwYGednD9a/T6e+pNHpeNB4wedhKkgpPXfuGqXCFyv1qd9 x3sDXTVjmmLvvuHJwVyLCuYl7A== X-Google-Smtp-Source: ALg8bN5TektkrY+Po7AxJfIuDBh0Om3Y3YLa0ivgbaake1UzSqG9jplBvVV29z7Pk5q85F70m+yJug== X-Received: by 2002:a63:dc54:: with SMTP id f20mr31025454pgj.410.1548927096317; Thu, 31 Jan 2019 01:31:36 -0800 (PST) Received: from pihsun-z840.tpe.corp.google.com ([2401:fa00:1:10:7889:7a43:f899:134c]) by smtp.googlemail.com with ESMTPSA id w184sm4531197pgd.34.2019.01.31.01.31.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 01:31:35 -0800 (PST) From: Pi-Hsun Shih To: Subject: [PATCH v4 0/6] Add support for mt8183 SCP. Date: Thu, 31 Jan 2019 17:31:25 +0800 Message-Id: <20190131093131.245531-1-pihsun@chromium.org> X-Mailer: git-send-email 2.20.1.611.gfbb209baf1-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190131_013137_772675_ABEECA22 X-CRM114-Status: GOOD ( 13.04 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthias Brugger , Erin Lo , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" , Pi-Hsun Shih Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for controlling and communicating with mt8183's system control processor (SCP), using the remoteproc & rpmsg framework. And also add a cros_ec driver for CrOS EC host command over rpmsg. The overall structure of the series is: * remoteproc/mtk_scp.c: Control the start / stop of SCP (Patch 2). * remoteproc/mtk_scp_ipi.c: Communicates to SCP using inter-processor interrupt (IPI) and shared memory (Patch 2). * rpmsg/mtk_rpmsg.c: Wrapper to wrap the IPI communication into a rpmsg device. Supports name service for SCP firmware to announce channels (Patch 3). * platform/chrome/cros_ec_rpmsg.c: Communicates with the SCP over the rpmsg framework (like what platform/chrome/cros_ec_{i2c,spi}.c does) (Patch 4). Since I'm not familiar with the remoteproc / rpmsg framework, and there are not much other custom rpmsg driver for reference, would like some review / comments on the overall structure of the driver. Changes from v3: - Make writing to SCP SRAM aligned. - Add a new patch (Patch 6) to load ELF instead of bin firmware. - Add host event support for EC driver. - Fix some bugs found in testing (missing spin_lock_init, rproc_subdev_unprepare to rproc_subdev_stop). - Fix some coding style issue found by checkpatch.pl. Changes from v2: - Fold patch 3 into patch 2 in v2. - Move IPI id around to support cross-testing for old and new firmware. - Finish more TODO items. Changes from v1: - Extract functions and rename variables in mtk_scp.c. - Do cleanup properly in mtk_rpmsg.c, which also removes the problem of short-lived work items. - Code format fix based on feedback for cros_ec_rpmsg.c. - Extract feature detection for SCP into separate patch (Patch 6). Erin Lo (2): dt-bindings: Add a binding for Mediatek SCP remoteproc/mediatek: add SCP support for mt8183 Pi-Hsun Shih (4): rpmsg: add rpmsg support for mt8183 SCP. mfd: add EC host command support using rpmsg. cros_ec: differentiate SCP from EC by feature bit. remoteproc/mediatek: Load ELF instead of bin file for mtk_scp. .../bindings/remoteproc/mtk,scp.txt | 10 + drivers/mfd/cros_ec_dev.c | 9 + drivers/platform/chrome/Kconfig | 9 + drivers/platform/chrome/Makefile | 1 + drivers/platform/chrome/cros_ec_rpmsg.c | 240 ++++++++ drivers/remoteproc/Kconfig | 9 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/mtk_common.h | 78 +++ drivers/remoteproc/mtk_scp.c | 519 ++++++++++++++++++ drivers/remoteproc/mtk_scp_ipi.c | 165 ++++++ drivers/rpmsg/Kconfig | 10 + drivers/rpmsg/Makefile | 1 + drivers/rpmsg/mtk_rpmsg.c | 384 +++++++++++++ include/linux/mfd/cros_ec.h | 1 + include/linux/mfd/cros_ec_commands.h | 2 + include/linux/platform_data/mtk_scp.h | 137 +++++ include/linux/rpmsg/mtk_rpmsg.h | 35 ++ 17 files changed, 1611 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/mtk,scp.txt create mode 100644 drivers/platform/chrome/cros_ec_rpmsg.c create mode 100644 drivers/remoteproc/mtk_common.h create mode 100644 drivers/remoteproc/mtk_scp.c create mode 100644 drivers/remoteproc/mtk_scp_ipi.c create mode 100644 drivers/rpmsg/mtk_rpmsg.c create mode 100644 include/linux/platform_data/mtk_scp.h create mode 100644 include/linux/rpmsg/mtk_rpmsg.h