From patchwork Sat May 19 06:52:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiang Yu X-Patchwork-Id: 10412587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D323F601F9 for ; Sat, 19 May 2018 06:54:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C717C283DA for ; Sat, 19 May 2018 06:54:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBB4928511; Sat, 19 May 2018 06:54:27 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5950C283DA for ; Sat, 19 May 2018 06:54:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48D156EEC5; Sat, 19 May 2018 06:54:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F4E66EEC5 for ; Sat, 19 May 2018 06:54:16 +0000 (UTC) Received: by mail-pg0-x242.google.com with SMTP id 63-v6so2065961pgg.3 for ; Fri, 18 May 2018 23:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GsQGn2cYHWjcrG6DU02k1D0fhldBak8k5Xj8gmtnQZs=; b=gZT5Ry8t96N7MQ8R2dTYGNEwpBwOH/7hbt5IzZQ7ajxKPSUMxBSf/4YlNKHOtiR88w eYjhs8JOtZz6Xka1urWBK7FOxMjUNeDoFA154foU4g1ccKsz9mMwP23S9ceBUELteQI9 UmGYCt/JBWEyruc8mKCb66pYoDZ10ZgZGHhqr5oeIh6E2XmFt35R9kFnqLWUFtSF9+O/ O6BjT1qpXEbtJGau5U6TYy+2MH97LyOgvMJPstVM+rge+HlOrOWs1gqIiPTB7Lp95lGp 6lUeK17e4ZGy4R6We1ZRRBczwIUXTgdkrtonSXI9aPUJwtRMIDeFGz1bXwEHA4mHejL+ EXrg== 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:in-reply-to :references; bh=GsQGn2cYHWjcrG6DU02k1D0fhldBak8k5Xj8gmtnQZs=; b=qT3ovx0jJx9shUNEqDqled0b0lxFzmdF1+ViSsxADSWi9FHhMwde0CIj0jp8oC+rpZ 9hn5Y0dDYdhkYAfoG2HIKhLxjMsTiRTVvriHhC87J6qmYvf6EqjYuaK9jn3TZ7Pq90rI ee7APUh0xbzi3lm9bIi+4uQG2iqSp1QuV/6VivV9npIDiP7Vc7Mlz3wR5/IeuCGu0uBE 7fFfJhdIoSM/aw0Hjk/QiERTszpWSRodEKEadYrCQOm0aa9g3D3dmOnIXZNA+V0cyoGI LKNDuxnNEKKXGNH4mEkJItjeW9WiQJptfa3tOCl9eYHv5N8Y2w4ZlrqA360SlNrixOfM /siw== X-Gm-Message-State: ALKqPwfCmdSJcZJXhfbk+uYt8qQ/ZSSkqcJS71SYjTZQg4cx5M27CZ5a vXHXu+GPWC6ocIOdzyd8aRqknEc4ln4= X-Google-Smtp-Source: AB8JxZp43Icxqrhf71riTY6tBm2G/lwC1fINgNPTCUe76AZJhwzhAeGOCShkieGMtDy4XL5jKlGqsg== X-Received: by 2002:a62:190f:: with SMTP id 15-v6mr12279742pfz.42.1526712856086; Fri, 18 May 2018 23:54:16 -0700 (PDT) Received: from localhost.localdomain (210-140-84-216.jp-east.compute.idcfcloud.com. [210.140.84.216]) by smtp.gmail.com with ESMTPSA id l63-v6sm18609187pfi.6.2018.05.18.23.54.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 23:54:15 -0700 (PDT) From: Qiang Yu To: dri-devel@lists.freedesktop.org Subject: [PATCH RFC 15/24] drm/lima: add BCAST related function Date: Sat, 19 May 2018 14:52:34 +0800 Message-Id: <20180519065243.27600-16-yuq825@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180519065243.27600-1-yuq825@gmail.com> References: <20180519065243.27600-1-yuq825@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Simon Shields , Marek Vasut , Connor Abbott , Neil Armstrong , Andrei Paulau <7134956@gmail.com>, Vasily Khoruzhick , Qiang Yu , Erico Nunes MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP BCAST is a hardware module to broadcast register read/write for PPs. It can also merge IRQs from different PPs into one IRQ. Signed-off-by: Qiang Yu --- drivers/gpu/drm/lima/lima_bcast.c | 65 +++++++++++++++++++++++++++++++ drivers/gpu/drm/lima/lima_bcast.h | 34 ++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 drivers/gpu/drm/lima/lima_bcast.c create mode 100644 drivers/gpu/drm/lima/lima_bcast.h diff --git a/drivers/gpu/drm/lima/lima_bcast.c b/drivers/gpu/drm/lima/lima_bcast.c new file mode 100644 index 000000000000..32012a61ea6a --- /dev/null +++ b/drivers/gpu/drm/lima/lima_bcast.c @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2017-2018 Lima Project + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#include "lima_device.h" +#include "lima_bcast.h" +#include "lima_regs.h" + +#define bcast_write(reg, data) writel(data, ip->iomem + LIMA_BCAST_##reg) +#define bcast_read(reg) readl(ip->iomem + LIMA_BCAST_##reg) + +void lima_bcast_enable(struct lima_device *dev) +{ + struct lima_sched_pipe *pipe = dev->pipe + lima_pipe_pp; + struct lima_ip *ip = dev->ip + lima_ip_bcast; + int i, mask = 0; + + for (i = 0; i < pipe->num_processor; i++) { + struct lima_ip *pp = pipe->processor[i]; + mask |= 1 << (pp->id - lima_ip_pp0); + } + + bcast_write(BROADCAST_MASK, (mask << 16) | mask); + bcast_write(INTERRUPT_MASK, mask); +} + +void lima_bcast_disable(struct lima_device *dev) +{ + struct lima_ip *ip = dev->ip + lima_ip_bcast; + + bcast_write(BROADCAST_MASK, 0); + bcast_write(INTERRUPT_MASK, 0); +} + +int lima_bcast_init(struct lima_ip *ip) +{ + return 0; +} + +void lima_bcast_fini(struct lima_ip *ip) +{ + +} + diff --git a/drivers/gpu/drm/lima/lima_bcast.h b/drivers/gpu/drm/lima/lima_bcast.h new file mode 100644 index 000000000000..abafd4f613c7 --- /dev/null +++ b/drivers/gpu/drm/lima/lima_bcast.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2017-2018 Lima Project + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIMA_BCAST_H__ +#define __LIMA_BCAST_H__ + +struct lima_ip; + +int lima_bcast_init(struct lima_ip *ip); +void lima_bcast_fini(struct lima_ip *ip); + +void lima_bcast_enable(struct lima_device *dev); +void lima_bcast_disable(struct lima_device *dev); + +#endif