From patchwork Wed Nov 21 10:30:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 10692347 X-Patchwork-Delegate: geert@linux-m68k.org 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 4902515A7 for ; Wed, 21 Nov 2018 10:30:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3582D2B71C for ; Wed, 21 Nov 2018 10:30:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A1C82B742; Wed, 21 Nov 2018 10:30:44 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92DBE2B71C for ; Wed, 21 Nov 2018 10:30:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729488AbeKUVEc (ORCPT ); Wed, 21 Nov 2018 16:04:32 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44069 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729485AbeKUVEb (ORCPT ); Wed, 21 Nov 2018 16:04:31 -0500 Received: by mail-pl1-f195.google.com with SMTP id s5-v6so4920590plq.11 for ; Wed, 21 Nov 2018 02:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=IURu9l24ujb2TvG0nr00MdBk/UojR7FyXY78KzKms8M=; b=qKXmi2n+Z7KFUWo3xUy73At7dthqWGO99CNPCw7jlz5jCcnqTFcUopADVYBo80Bw4y mlBgt5UvWuBiJ/sL8J+i+hNvq67U/YnFsIqi+wV2YfypJQTah0oLcQK6rd3E6JOk35ly TVAAf6yCmGxIa+2VFhfe8N8DQKSmD+2/PLqVuFGTT5tRO8/9qxFuxyghT6l5p9j6iKIC 1DNjpfRU7FQnAYo0xPujeuAgSRxLQVdo3veUjz7Z8S/8Eih+UWRPkm/1yNSGOOfgQbPs mWHI0K80b87L6Re4C/DkyODFxIrcfeGg75/eH3MjuxS0t5xo0WdybpuvQKfxw13rPLGk pPJQ== 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:date:message-id:in-reply-to :references:subject; bh=IURu9l24ujb2TvG0nr00MdBk/UojR7FyXY78KzKms8M=; b=kEuF3RrCTO56oHW8IntOUT2T9uTx6gCWqWRos/myHuokuY/0Ykia/JUVDQ+M+ncMjg V26q0v86ANuJecNaesGgGgWBqK/dg1ISXyKGdKQOwxnPwxKbNar5aavSmXlEpwJ56DF3 QSwX2N14Ivrc2uwwx8eahuEVEkj8z/HZzzbZBV4WDNAoOb8kFOj6SNOynKyPR44TN/3Y RrNVALcCqfZeDiZejBO3ALtY9LudqYCuY/toT2Aeq5b3kjMMmPGvA58LP1B3PsanC2x7 LgHkttJR2P9mlgrppvzbeCajM5Yce5nbWSCMvIiBL4eQe2GYO2NQkMNiGvRpqpJWk5W0 JhnQ== X-Gm-Message-State: AGRZ1gK3Og7ViFXg3AnXoB8gy7ID2p/EkjohC/DUHZ6lmrRHOluuUXM+ mw1EFvVurtfrf0lNKwQ4uH1phkXG X-Google-Smtp-Source: AJdET5eJOT3/e9Zmm/aXzi6AS/9oEnw+NWdShdf656JB5csQTE5H4ngwhvCpqepWaBnpV+bowEqgPg== X-Received: by 2002:a62:2545:: with SMTP id l66-v6mr6208991pfl.207.1542796237703; Wed, 21 Nov 2018 02:30:37 -0800 (PST) Received: from [127.0.0.1] (l193216.ppp.asahi-net.or.jp. [218.219.193.216]) by smtp.gmail.com with ESMTPSA id n186sm12847308pfn.137.2018.11.21.02.30.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 02:30:36 -0800 (PST) From: Magnus Damm To: linux-renesas-soc@vger.kernel.org Cc: Magnus Damm Date: Wed, 21 Nov 2018 19:30:56 +0900 Message-Id: <154279625682.29528.16840605699274594629.sendpatchset@octo> In-Reply-To: <154279624819.29528.954090919447072739.sendpatchset@octo> References: <154279624819.29528.954090919447072739.sendpatchset@octo> Subject: [PATCH 01/05] Hack FCP driver to poke at FCPCS and VDPB during probe Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Hack up the FCP driver to test the power domains and dump registers. This prototype level code is not intended for upstream merge. Not-Signed-off-by: Magnus Damm --- drivers/media/platform/rcar-fcp.c | 42 ++++++++++++++++++++++++++++++++++++- drivers/soc/renesas/rcar-sysc.c | 1 2 files changed, 42 insertions(+), 1 deletion(-) --- 0002/drivers/media/platform/rcar-fcp.c +++ work/drivers/media/platform/rcar-fcp.c 2018-11-21 18:32:58.792603934 +0900 @@ -8,10 +8,12 @@ */ #include +#include #include #include #include #include +#include #include #include #include @@ -26,6 +28,8 @@ struct rcar_fcp_device { static LIST_HEAD(fcp_devices); static DEFINE_MUTEX(fcp_lock); +#define FCP_VCR 0 /* Version register at offset 0 */ + /* ----------------------------------------------------------------------------- * Public API */ @@ -118,7 +122,7 @@ EXPORT_SYMBOL_GPL(rcar_fcp_enable); void rcar_fcp_disable(struct rcar_fcp_device *fcp) { if (fcp) - pm_runtime_put(fcp->dev); + pm_runtime_put_sync(fcp->dev); } EXPORT_SYMBOL_GPL(rcar_fcp_disable); @@ -144,6 +148,41 @@ static int rcar_fcp_probe(struct platfor platform_set_drvdata(pdev, fcp); + /* self-test VCPCS on ->probe() */ + if (of_device_get_match_data(&pdev->dev)) { + struct resource *io; + void __iomem *mmio, *mmio2; + + printk("Enabling FCPCS device (Runtime PM on)\n"); + rcar_fcp_enable(fcp); + + io = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mmio = devm_ioremap_resource(&pdev->dev, io); + if (!IS_ERR(mmio)) + printk("Power-on FCPCS version is 0x%08lx\n", + (unsigned long) ioread32(mmio + FCP_VCR)); + + io = platform_get_resource(pdev, IORESOURCE_MEM, 1); + mmio2 = devm_ioremap_resource(&pdev->dev, io); + + if (!IS_ERR(mmio2)) + printk("Power-on VDPB read at offset 0x200 is 0x%08lx\n", + (unsigned long) ioread32(mmio2 + 0x200)); + + printk("Disabling FCPCS device (Runtime PM off)\n"); + rcar_fcp_disable(fcp); + +#ifdef IOREAD_POWER_OFF_TEST + if (!IS_ERR(mmio)) + printk("Power-off FCPCS version is 0x%08lx\n", + (unsigned long) ioread32(mmio + FCP_VCR)); + + if (!IS_ERR(mmio2)) + printk("Power-off VDPB read at offset 0x200 is 0x%08lx\n", + (unsigned long) ioread32(mmio2 + 0x200)); +#endif + } + return 0; } @@ -163,6 +202,7 @@ static int rcar_fcp_remove(struct platfo static const struct of_device_id rcar_fcp_of_match[] = { { .compatible = "renesas,fcpf" }, { .compatible = "renesas,fcpv" }, + { .compatible = "renesas,fcpc", .data = &rcar_fcp_of_match[0] }, { }, }; MODULE_DEVICE_TABLE(of, rcar_fcp_of_match); --- 0002/drivers/soc/renesas/rcar-sysc.c +++ work/drivers/soc/renesas/rcar-sysc.c 2018-11-21 17:16:50.411091041 +0900 @@ -6,6 +6,7 @@ * Copyright (C) 2015-2017 Glider bvba */ +#define DEBUG #include #include #include