From patchwork Fri Sep 14 13:22:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Elwell X-Patchwork-Id: 10600759 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 6316915A7 for ; Fri, 14 Sep 2018 13:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 488A32B67C for ; Fri, 14 Sep 2018 13:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C2FC2B683; Fri, 14 Sep 2018 13:24:59 +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 AB8A12B67C for ; Fri, 14 Sep 2018 13:24:58 +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=609xBkPtzLOYpHrJCulvha/tGSE14VJJGv7zhvIRH3E=; b=hUDcEEVpQf3+nF 2qLqR8HdXzjrRFkeYIB/4zzhvXSbx2FM5www0369oarWDtyUB/Yz2Gyk77EjsPPD7yErK2pv44enT VksD4xZ4Q+iBaqxDv/WvgpJcl3PiC8U7s4d1vXbqlRDkF13GVAvHVdn4EAXnC1bBQm4bysQ1MfRUo Ygmkof9mPbFEL2ubIWzdxm/LCBKgKlg3RSOFvTKatCt2oZyrYfYswCTjQycaf9qYzp4Jk+rp7afH+ qE4OXs1uHxLOca/8zS5Kh6LII2R/x3xWKgaGKK1BIBwdskDADP/SSNLmz9y8dCSMUXhNgzgw4jr00 58VG8v7FknrGAQvDvVJQ==; 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 1g0o5U-0001hK-DE; Fri, 14 Sep 2018 13:24:44 +0000 Received: from mx08-00252a01.pphosted.com ([91.207.212.211]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0o4c-0001Ga-GE for linux-arm-kernel@lists.infradead.org; Fri, 14 Sep 2018 13:23:57 +0000 Received: from pps.filterd (m0102629.ppops.net [127.0.0.1]) by mx08-00252a01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8ED8LLV005397 for ; Fri, 14 Sep 2018 14:23:40 +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=4VMo7ZIF5HeO+ZyXfjPkHhDIjaverswf6D8y5mtGoLc=; b=ejk0iVAzf0v7zHPqe8tm363ypka5QYhH6YZXbQm18sKtSj83IO4Hdw9UAgdd/KXuTWFL 86dc+m5FwjhCpvlPNKKW5kpv0C8SV0c5NVlNZqzJgK7jyfHswh1ae31TZL+yaa8oPZte q76543XrFQaAKhiO/kjN1mJiEqJ1dIx7ye+llgh7Wn/cOvGiNR/mzm4nH31B02Twln6C GvkbbnfVuQOjgH29ORqQKDLBy9/bs7L+i5US+cXUZ1gkPE0OVNsmNEkG4SGlzSroNE1r 6wefLgzb4bsZQzzuMBGyGLZHm6xGZ7EXlq46QCRhdN6Y9NeWTfbGiN7Txl2b1uNTTDD7 OA== Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mx08-00252a01.pphosted.com with ESMTP id 2mc2wfu5xc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 14 Sep 2018 14:23:39 +0100 Received: by mail-wr1-f69.google.com with SMTP id z17-v6so9885280wrr.16 for ; Fri, 14 Sep 2018 06:23:39 -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=4VMo7ZIF5HeO+ZyXfjPkHhDIjaverswf6D8y5mtGoLc=; b=KS6w/mnn4UYtInhRIiDV/T/ArBPS8JOGeSH/OgcpHmBoJNo2Pg8MyerrUPckhY/uOc R9RhndWmAND7uqiABGA/dKcpWxoZbvuUJGJAiwK7YsWJvyrclhW7M5MTJpEQ1UkqfN9G pl5yKdoerfuDVs0iUXhY6trnSAGwlsnMVPkRxCMWAcz41HZ/md+cGY9gymIgv1DVSIEe EBgh0VP8s7P863MsKIdWcgeaPN8Spx1LZ2SC/qUocTm1aQw1HE1l6twGJmLBLuy8DVrc Njt/EVpQss9U8CHy/mj3j04lUBuUgpHHlQvIbzC8VfHz8VruZMao+AR7Xvc3dentpTJJ BODA== 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=4VMo7ZIF5HeO+ZyXfjPkHhDIjaverswf6D8y5mtGoLc=; b=XTqv00wRTmCRdjcXwUz//x4lFn5CU176tW5C7OM+jUM+ClFFn8ZttVycUPtEw/tdqf kSuYDbVxTljRuhqRlo3YuwhCixHpipyuNjLiH8BvuyoxiVAsgzCvW9EG4quYJ1kUz7cF uL//pIkNxWScuZFjQh3t4pcX9V/IAy/Ca5UWRO9ghlcpN0W7Ld+2njYrlTxOTRiKgbub JVSNLwTuswlO4uts4syEyS3fEONrfJg1valNZsh6XfY3qox7IF4gLbqwQtI6ODMZQawr W7dhlmOuGUNwjRp8nArz8abD3bjvyzNnNEMazMZv8UXyqzCaptUvQgFE1ROSh/qlnOBg X8Qg== X-Gm-Message-State: APzg51DO7w177UvOnoNSMvRMZoZYTP2m+c+TNQFC+aKKoR0h1iOxlLOY zCynBTNcevbiEQ/Pe4oH2FwGaEstDA2B8n66BcPpMr8JvhsSnwURds3aa2oV3ztiepsI3e7Hq5y 3zMHkV7umBNbqFPBYKop0E2SmVa9WGFL7zOg= X-Received: by 2002:a1c:7d51:: with SMTP id y78-v6mr2382175wmc.37.1536931418340; Fri, 14 Sep 2018 06:23:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaSKJkI2wng4+pI/44/DDU5aNbNrdxJjUkO8uplyiCsXJ9oI7EYH7gVaD6jTK/FZGuiWLfG+g== X-Received: by 2002:a1c:7d51:: with SMTP id y78-v6mr2382150wmc.37.1536931418009; Fri, 14 Sep 2018 06:23:38 -0700 (PDT) Received: from buildbot.pitowers.org ([2a00:2381:fdf7:14:910f:6f88:c896:5552]) by smtp.gmail.com with ESMTPSA id i125-v6sm2505703wmd.23.2018.09.14.06.23.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Sep 2018 06:23:37 -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 v2 1/4] staging/vc04_services: Use correct cache line size Date: Fri, 14 Sep 2018 14:22:52 +0100 Message-Id: <1536931375-48769-2-git-send-email-phil@raspberrypi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536931375-48769-1-git-send-email-phil@raspberrypi.org> References: <1536931375-48769-1-git-send-email-phil@raspberrypi.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-09-14_06:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180914_062350_889552_83F4183D X-CRM114-Status: GOOD ( 19.98 ) 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 Acked-by: Stefan Wahren --- .../interface/vchiq_arm/vchiq_2835_arm.c | 4 ++- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 36 ++++++++++++++++------ .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 5 +++ 3 files changed, 34 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..b2ae9259 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,26 @@ 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; + snd_rpi_simple.dev = &pdev->dev; + of_id = of_match_node(vchiq_of_match, pdev->dev.of_node); + drvdata = of_id->data; + if (!drvdata) + return -EINVAL; + fw_node = of_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware"); if (!fw_node) { @@ -3586,12 +3608,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 +3683,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;