From patchwork Thu Feb 21 08:47:23 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: 10823287 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 8000815AC for ; Thu, 21 Feb 2019 08:48:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69E3E2F7C8 for ; Thu, 21 Feb 2019 08:48:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 590162FFB0; Thu, 21 Feb 2019 08:48: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 E8EAD2F7C8 for ; Thu, 21 Feb 2019 08:48: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=8M7QhBgYhzAYWHVAALUxfdAQdSI8vN0L4X+4yYGuvo8=; b=beng7LoD9nnDjt Y4iKaQCHq9C5jX2atiWsFWnZ8W999xyNN+rQ5dUdtg8EYqQFIS3xQS5o/mQm1Sfx34xI5KAW+DQAC 6nykJ5xnHOAd+GtSIoAG1MwFGNOqJAmMnThgnSE0Cw2UquyD2/AivTFsaQnjWLcX2UqeGZV5oBsnj m5dC92kPLilgnI8M2iJBNgy4tgPvUTsKzp+v03pmwLZmmURTRGwyt2mVl48KToni4IAnVknkmAbbK RLbUR7exY16ZApq2/iUNxPji3+HWix5yIS2OMUzc60pxveiF7wq0HTMOe+AJaFacw2CYTPxxlgj+3 61r3X6UDr96OTCaw38sw==; 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 1gwk25-0006Zz-J3; Thu, 21 Feb 2019 08:48:41 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwk1u-0006QM-KK for linux-mediatek@lists.infradead.org; Thu, 21 Feb 2019 08:48:32 +0000 Received: by mail-pg1-x542.google.com with SMTP id s198so13461208pgs.2 for ; Thu, 21 Feb 2019 00:48:29 -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=vROhy5Plmd50xPCC/Q/QS2fuBqQNtJbtmF30XL2rY0I=; b=OGkxXLAmXTDDTQhksDfNZ3HIwUESqZRKIiXe1lTFBIsfOhKk4vM2yPtQggUEcdTLkX haIPRtLM0cwfZif0RFUPilAP4Tl2WMeSseeLLr1wKr3ghgl7JbN+ujN/4etP7xq4erLK 0qx+huuYpwCCy/itxxpB3zdZ9V8vn/MpZbru4= 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=vROhy5Plmd50xPCC/Q/QS2fuBqQNtJbtmF30XL2rY0I=; b=St3xoPIi3T/CcvkPAXhDnAgrd5w/xYD26sur8Ys8Lcm+luZs0OqA7AUQ+fATojIVyU 78oliyBTfcgvT1UGymeqVeQ08yuZrJQqnxT1rJ1PzJRqvgHhG8KCMeGFfXtXF90i9EEp HRWHS6tbFlbr2V/s80rhVl8oRbUBMdQHuCJRnUVKFf7rAX/EGmnQKksbk8hPUs53FDtM NtPTUQSlL58JmF1GzSqTzETdBfdLuEvLlKidAaUei5cDfWJk/1YeuSjaVaBgyqoo3Tug y17SxDdrN5e2EYhsRSNsHZoeTgtv1eMwQnPCpaVLMRD13NLMrO6iGOxoIXELAayEA55p PTZA== X-Gm-Message-State: AHQUAuYGr17iowHK8ciritQb3s47YOTep2rnCrIbz5q5c/cEOCn3jtEA CPHD9rz5om7uIruDXnAwlxtOiA== X-Google-Smtp-Source: AHgI3IaIXSJgaHD3TpFvI1ZV1oCwiy9yvB+mWo08WPJvnounP2mYhOStOn/R8hmpARgiwYyfGsKrWg== X-Received: by 2002:a63:541:: with SMTP id 62mr4487159pgf.172.1550738908655; Thu, 21 Feb 2019 00:48:28 -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 b4sm23154027pgq.57.2019.02.21.00.48.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 00:48:27 -0800 (PST) From: Pi-Hsun Shih To: Subject: [PATCH v5 0/6] Add support for mt8183 SCP. Date: Thu, 21 Feb 2019 16:47:23 +0800 Message-Id: <20190221084729.101784-1-pihsun@chromium.org> X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_004830_661403_2E3584B2 X-CRM114-Status: GOOD ( 15.19 ) 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 , "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, 3). * remoteproc/mtk_scp_ipi.c: Communicates to SCP using inter-processor interrupt (IPI) and shared memory (Patch 2, 3). * rpmsg/mtk_rpmsg.c: Wrapper to wrap the IPI communication into a rpmsg device. Supports name service for SCP firmware to announce channels (Patch 4). * 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 5, 6). 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 v4: - Merge patch 6 (Load ELF firmware) into patch 2, so the driver loads ELF firmware by default, and no longer accept plain binary. - rpmsg_device listed in device tree (as a child of the SCP node) would have it's device tree node mapped to the rpmsg_device, so the rpmsg driver can use the properties on device tree. 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 (3): dt-bindings: Add a binding for Mediatek SCP remoteproc/mediatek: add SCP support for mt8183 remoteproc: mt8183: add reserved memory manager API Pi-Hsun Shih (3): rpmsg: add rpmsg support for mt8183 SCP. mfd: add EC host command support using rpmsg. cros_ec: differentiate SCP from EC by feature bit. .../bindings/remoteproc/mtk,scp.txt | 37 ++ drivers/mfd/cros_ec_dev.c | 9 + drivers/platform/chrome/Kconfig | 9 + drivers/platform/chrome/Makefile | 1 + drivers/platform/chrome/cros_ec_rpmsg.c | 248 +++++++ drivers/remoteproc/Kconfig | 9 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/mtk_common.h | 77 +++ drivers/remoteproc/mtk_scp.c | 628 ++++++++++++++++++ drivers/remoteproc/mtk_scp_ipi.c | 163 +++++ drivers/rpmsg/Kconfig | 9 + drivers/rpmsg/Makefile | 1 + drivers/rpmsg/mtk_rpmsg.c | 385 +++++++++++ include/linux/mfd/cros_ec.h | 1 + include/linux/mfd/cros_ec_commands.h | 2 + include/linux/platform_data/mtk_scp.h | 157 +++++ include/linux/rpmsg/mtk_rpmsg.h | 35 + 17 files changed, 1772 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