From patchwork Mon Sep 17 08:22:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Elwell X-Patchwork-Id: 10602179 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 433B313AD for ; Mon, 17 Sep 2018 08:26:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 320432900C for ; Mon, 17 Sep 2018 08:26:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25EFC29418; Mon, 17 Sep 2018 08:26:09 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 919022900C for ; Mon, 17 Sep 2018 08:26:08 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zeuEIN2Yl1z+7whjsB8nPTgSvNkErFOKi5rEVgjAfgA=; b=ZhWcx3JuxexnpG 919Bzw8reNdoYR9jipeOaE3W/Zmgmhox9zFJlJggOUxcfZAdjUr+Lq4QorxXbaIdnFtSNInOa1L8l c5v3zsAV92InmttELGbnv3I/TUrbByOesUCLKHTTOlFSf7UpKj4KiPn8x8UtRUg6AtGdsxUUrspEI JE6SRyZRkntC7yPkki/KN/uLncYwjkHVn/1KTmF5kDWM78eU8lkNHgjug7XOXT4DDWumNMjaUDlAp Un3G6PRUuLi6jH+uyTssSwEcv1x0J9mmOUgxsPaw01W1WfV0pxJ/qeYedTUpTqufyoA7V6IH8Y3Ib GweRVrIzWDmzj3Q82few==; 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 1g1or2-0007pF-TA; Mon, 17 Sep 2018 08:26:00 +0000 Received: from mx07-00252a01.pphosted.com ([62.209.51.214]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g1oo3-0005Jm-Jw for linux-arm-kernel@lists.infradead.org; Mon, 17 Sep 2018 08:24:52 +0000 Received: from pps.filterd (m0102628.ppops.net [127.0.0.1]) by mx07-00252a01.pphosted.com (8.16.0.23/8.16.0.23) with SMTP id w8H8MTWi024128 for ; Mon, 17 Sep 2018 09:22:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : to : subject : date : message-id : in-reply-to : references; s=pp; bh=d8/3g/wC73NO39Rmv8w6+YZgBT7bR9MynuvXSs3s7/0=; b=2EpmjGbObLsMN83fCZLM7KP83YM48JJaJDR24NMwcnRyruE4wtibMZgm8fVG0qHQd6r+ I6dl2U9ElvgWtE/AwbJm6vekHtqQDFXll7+Xft37tsLDNhHosWVOLvt3ZQm0PLUCeC5v zF3gJ0mTER20v5PgJtO61DQSlehbPjxt1BVa3siOGl2JiF4QiAvnPIqkHYs3jed0Ca1D f7MORy/ptQLMn2KIpY4XyNFrVPTCxy/A3Uu1x593R9kxBCT2pw97QzYDbN1k9Jqk3Aph W8v0PKrm1CK4CjEWYlYe+xOZKk9/Sqsd7w6xpP6hl9YVOfHmh4a0TjVgTxZ07D9L4m6A XA== Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mx07-00252a01.pphosted.com with ESMTP id 2mgw8f0v9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Mon, 17 Sep 2018 09:22:41 +0100 Received: by mail-wr1-f70.google.com with SMTP id w6-v6so21895892wrc.22 for ; Mon, 17 Sep 2018 01:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=d8/3g/wC73NO39Rmv8w6+YZgBT7bR9MynuvXSs3s7/0=; b=AUPtNKSiyrj2Zdk776WGBgBVkjM3KjC74RtKg08L/5Nu4RzkbteaumxpJ0cIUJQdTf NWRLn+Z5wPy2+YHlmhCz0QXJvDi0DE7gR5m/TIb2rkK2QSm1b/cf/N26+9C3o5CN4a2z avbOdB2UOyugXN5LkT3HkkwLacIbOl/DP5NEpgviWFxnVLpC6AKRYQbwiV2W5jMqaovc j/iYaYrWIbw7AKhH37x/piIAIqSdwykzRoij7GAQ4O+pXEGQ+GvVBOsIg1/j13Y6N14/ lHCDE39uN4tLJhUJfOBH82bkVi4iCTl99Xs2VNMO0nOCSVBalPaCT+zyYl26UkQLyqx3 i6gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=d8/3g/wC73NO39Rmv8w6+YZgBT7bR9MynuvXSs3s7/0=; b=MmJlupX6MYH3h5Iq/7W76mJNeiWQJ1oH8bYyyIzGqQOOzKmqiGonwyzC+cTPMlpzNb auvBhAFHJ1S2SVkyeH6B+UkMZ31t7N+2vwfcmt4+3+MIvZ6JgAglx2Kub6PT0OChczUk fVe61DsqfNBM51a1O9HKs58mukqbT2u6urJB+DP4YFH+lFTmYGrq+8GtUI+U1rU2t7rR PS7x97HZh4BhqjSYvCGVlNUQlzNeP9aB64i6BhIJ9s24Sy9wg7ougQnjoZBknmeNPtz2 xsxrqijutckyrWOj7sT9CgLmoey/jHaBtfvfg0DcR0a4biq5WoA6Si4hSJDNfCobr0Gf ib4g== X-Gm-Message-State: APzg51DLYjNrkX6Hhg8x1GfMIGk3q5guZXmMURUafLrMvvEXnqmu9Kei jhQ/DQcBLyJe0AcerQoRcxt+Ye7ZIe9Ay+++Q2Prw8NQo85eM+KiBe9mEeBsLqFUXaJsxI4/UpY 3aFMo/laHpMJlbt0qdmAFp8V5OIDm9L6DD18= X-Received: by 2002:adf:bd90:: with SMTP id l16-v6mr17888213wrh.250.1537172560971; Mon, 17 Sep 2018 01:22:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFPK8YApA7Bn5Q31CDYMZH6oSweLWXJN7NyclspkasoZm1cXuw9XBRY5pXAYh+wVo/s52Azg== X-Received: by 2002:adf:bd90:: with SMTP id l16-v6mr17888188wrh.250.1537172560700; Mon, 17 Sep 2018 01:22:40 -0700 (PDT) Received: from buildbot.pitowers.org ([2a00:2381:fdf7:14:14e2:e2a0:5538:c448]) by smtp.gmail.com with ESMTPSA id 198-v6sm7938315wmm.0.2018.09.17.01.22.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Sep 2018 01:22:40 -0700 (PDT) From: Phil Elwell To: Rob Herring , Stefan Wahren , Greg Kroah-Hartman , Phil Elwell , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, Russell King , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, devel@driverdev.osuosl.org Subject: [PATCH v3 1/4] staging/vc04_services: Use correct cache line size Date: Mon, 17 Sep 2018 09:22:21 +0100 Message-Id: <1537172544-104852-2-git-send-email-phil@raspberrypi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537172544-104852-1-git-send-email-phil@raspberrypi.org> References: <1537172544-104852-1-git-send-email-phil@raspberrypi.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-09-17_04:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180917_012256_062494_6B30E1F2 X-CRM114-Status: GOOD ( 20.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the compatible string in the DTB to select the correct cache line size for the SoC - 32 for BCM2835, and 64 for BCM2836 and BCM2837. Signed-off-by: Phil Elwell Tested-by: Stefan Wahren --- .../interface/vchiq_arm/vchiq_2835_arm.c | 4 ++- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 35 +++++++++++++++------- .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 5 ++++ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index e767209..83d740f 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -109,7 +109,8 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo, int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) { struct device *dev = &pdev->dev; - struct rpi_firmware *fw = platform_get_drvdata(pdev); + struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev); + struct rpi_firmware *fw = drvdata->fw; VCHIQ_SLOT_ZERO_T *vchiq_slot_zero; struct resource *res; void *slot_mem; @@ -127,6 +128,7 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) if (err < 0) return err; + g_cache_line_size = drvdata->cache_line_size; g_fragments_size = 2 * g_cache_line_size; /* Allocate space for the channels in coherent memory */ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index bc05c69..ea78937 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -170,6 +170,14 @@ static struct device *vchiq_dev; static DEFINE_SPINLOCK(msg_queue_spinlock); static struct platform_device *bcm2835_camera; +static struct vchiq_drvdata bcm2835_drvdata = { + .cache_line_size = 32, +}; + +static struct vchiq_drvdata bcm2836_drvdata = { + .cache_line_size = 64, +}; + static const char *const ioctl_names[] = { "CONNECT", "SHUTDOWN", @@ -3573,12 +3581,25 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, } } +static const struct of_device_id vchiq_of_match[] = { + { .compatible = "brcm,bcm2835-vchiq", .data = &bcm2835_drvdata }, + { .compatible = "brcm,bcm2836-vchiq", .data = &bcm2836_drvdata }, + {}, +}; +MODULE_DEVICE_TABLE(of, vchiq_of_match); + static int vchiq_probe(struct platform_device *pdev) { struct device_node *fw_node; - struct rpi_firmware *fw; + const struct of_device_id *of_id; + struct vchiq_drvdata *drvdata; int err; + of_id = of_match_node(vchiq_of_match, pdev->dev.of_node); + drvdata = (struct vchiq_drvdata *)of_id->data; + if (!drvdata) + return -EINVAL; + fw_node = of_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware"); if (!fw_node) { @@ -3586,12 +3607,12 @@ static int vchiq_probe(struct platform_device *pdev) return -ENOENT; } - fw = rpi_firmware_get(fw_node); + drvdata->fw = rpi_firmware_get(fw_node); of_node_put(fw_node); - if (!fw) + if (!drvdata->fw) return -EPROBE_DEFER; - platform_set_drvdata(pdev, fw); + platform_set_drvdata(pdev, drvdata); err = vchiq_platform_init(pdev, &g_state); if (err != 0) @@ -3661,12 +3682,6 @@ static int vchiq_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id vchiq_of_match[] = { - { .compatible = "brcm,bcm2835-vchiq", }, - {}, -}; -MODULE_DEVICE_TABLE(of, vchiq_of_match); - static struct platform_driver vchiq_driver = { .driver = { .name = "bcm2835_vchiq", diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h index 40bb0c6..2f3ebc9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h @@ -123,6 +123,11 @@ typedef struct vchiq_arm_state_struct { } VCHIQ_ARM_STATE_T; +struct vchiq_drvdata { + const unsigned int cache_line_size; + struct rpi_firmware *fw; +}; + extern int vchiq_arm_log_level; extern int vchiq_susp_log_level;