Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbdIBHhz (ORCPT ); Sat, 2 Sep 2017 03:37:55 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37772 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbdIBHhw (ORCPT ); Sat, 2 Sep 2017 03:37:52 -0400 X-Google-Smtp-Source: ADKCNb5nzgsPuyKioTExmNvaowup/LKjrl1x7deWATmIPNTucsIMTlPq0hmMNgy5ThKwyKyPTMGPoU1xv65wdNsZEek= MIME-Version: 1.0 In-Reply-To: <1502097434-11136-1-git-send-email-zhongkaihua@huawei.com> References: <1502097434-11136-1-git-send-email-zhongkaihua@huawei.com> From: Jassi Brar Date: Sat, 2 Sep 2017 13:07:50 +0530 Message-ID: Subject: Re: [PATCH 1/3] driver: mailbox: add support for Hi3660 To: Zhong Kaihua Cc: Rob Herring , Pawel Moll , Mark Rutland , "ijc+devicetree@hellion.org.uk" , Kumar Gala , Catalin Marinas , Will Deacon , Chen Feng , Leo Yan , wangruyi@huawei.com, Devicetree List , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , john.stultz@linaro.org, Guodong Xu , zhangfei.gao@linaro.org, jason.liu@linaro.org, Dan Zhao , suzhuangluan@hisilicon.com, xuezhiliang@hisilicon.com, xupeng7@huawei.com, chenjun14@huawei.com, hanwei.hanwei@huawei.com, hezetong@huawei.com, wuze1@huawei.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4011 Lines: 111 On Mon, Aug 7, 2017 at 2:47 PM, Zhong Kaihua wrote: > From: Kaihua Zhong > > Add mailbox driver for Hi3660. > > Signed-off-by: Leo Yan > Signed-off-by: Ruyi Wang > Tested-by: Kaihua Zhong > > --- > drivers/mailbox/Kconfig | 6 + > drivers/mailbox/Makefile | 2 + > drivers/mailbox/hi3660-mailbox.c | 688 +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 696 insertions(+) > create mode 100644 drivers/mailbox/hi3660-mailbox.c > > diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig > index ee1a3d9..778ba85 100644 > --- a/drivers/mailbox/Kconfig > +++ b/drivers/mailbox/Kconfig > @@ -116,6 +116,12 @@ config HI6220_MBOX > between application processors and MCU. Say Y here if you want to > build Hi6220 mailbox controller driver. > > +config HI3660_MBOX > + tristate "Hi3660 Mailbox" > + depends on ARCH_HISI > + help > + Mailbox implementation for Hi3660. > + > config MAILBOX_TEST > tristate "Mailbox Test Client" > depends on OF > diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile > index e2bcb03..f1c2fc4 100644 > --- a/drivers/mailbox/Makefile > +++ b/drivers/mailbox/Makefile > @@ -28,6 +28,8 @@ obj-$(CONFIG_XGENE_SLIMPRO_MBOX) += mailbox-xgene-slimpro.o > > obj-$(CONFIG_HI6220_MBOX) += hi6220-mailbox.o > > +obj-$(CONFIG_HI3660_MBOX) += hi3660-mailbox.o > + > obj-$(CONFIG_BCM_PDC_MBOX) += bcm-pdc-mailbox.o > > obj-$(CONFIG_BCM_FLEXRM_MBOX) += bcm-flexrm-mailbox.o > diff --git a/drivers/mailbox/hi3660-mailbox.c b/drivers/mailbox/hi3660-mailbox.c > new file mode 100644 > index 0000000..14f469d > --- /dev/null > +++ b/drivers/mailbox/hi3660-mailbox.c > @@ -0,0 +1,688 @@ > +/* > + * Hisilicon's Hi3660 mailbox driver > + * > + * Copyright (c) 2017 Hisilicon Limited. > + * Copyright (c) 2017 Linaro Limited. > + * > + * Author: Leo Yan > + * > + * This program is free software: you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation, version 2 of the License. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "mailbox.h" > + > +#define MBOX_CHAN_MAX 32 > + > +#define MBOX_TX 0x1 > + > +/* Mailbox message length: 2 words */ > +#define MBOX_MSG_LEN 2 > + > +#define MBOX_OFF(m) (0x40 * (m)) > +#define MBOX_SRC_REG(m) MBOX_OFF(m) > +#define MBOX_DST_REG(m) (MBOX_OFF(m) + 0x04) > +#define MBOX_DCLR_REG(m) (MBOX_OFF(m) + 0x08) > +#define MBOX_DSTAT_REG(m) (MBOX_OFF(m) + 0x0C) > +#define MBOX_MODE_REG(m) (MBOX_OFF(m) + 0x10) > +#define MBOX_IMASK_REG(m) (MBOX_OFF(m) + 0x14) > +#define MBOX_ICLR_REG(m) (MBOX_OFF(m) + 0x18) > +#define MBOX_SEND_REG(m) (MBOX_OFF(m) + 0x1C) > +#define MBOX_DATA_REG(m, i) (MBOX_OFF(m) + 0x20 + ((i) << 2)) > + > +#define MBOX_CPU_IMASK(cpu) (((cpu) << 3) + 0x800) > +#define MBOX_CPU_IRST(cpu) (((cpu) << 3) + 0x804) > +#define MBOX_IPC_LOCK (0xA00) > + How is this controller different than the PL320? Thanks.