[{"id":1765916,"web_url":"http://patchwork.ozlabs.org/comment/1765916/","msgid":"<CAP6Zq1jj08RbnUhPKaFuxn_06W1SzDmJoN6x8xV2pc05RKfngw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-10T08:36:30","subject":"Re: [PATCH v5 1/3] arm: npcm: add basic support for Nuvoton BMCs","submitter":{"id":72291,"url":"http://patchwork.ozlabs.org/api/people/72291/","name":"Tomer Maimon","email":"tmaimon77@gmail.com"},"content":"On 9 September 2017 at 04:53, Brendan Higgins <brendanhiggins@google.com> wrote:\n> Adds basic support for the Nuvoton NPCM750 BMC.\n>\n> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>\n> ---\n>  arch/arm/Kconfig             |  2 +\n>  arch/arm/Makefile            |  1 +\n>  arch/arm/mach-npcm/Kconfig   | 48 ++++++++++++++++++++++++\n>  arch/arm/mach-npcm/Makefile  |  3 ++\n>  arch/arm/mach-npcm/headsmp.S | 17 +++++++++\n>  arch/arm/mach-npcm/npcm7xx.c | 34 +++++++++++++++++\n>  arch/arm/mach-npcm/platsmp.c | 88 ++++++++++++++++++++++++++++++++++++++++++++\n>  7 files changed, 193 insertions(+)\n>  create mode 100644 arch/arm/mach-npcm/Kconfig\n>  create mode 100644 arch/arm/mach-npcm/Makefile\n>  create mode 100644 arch/arm/mach-npcm/headsmp.S\n>  create mode 100644 arch/arm/mach-npcm/npcm7xx.c\n>  create mode 100644 arch/arm/mach-npcm/platsmp.c\n>\n> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig\n> index 61a0cb15067e..05543f1cfbde 100644\n> --- a/arch/arm/Kconfig\n> +++ b/arch/arm/Kconfig\n> @@ -782,6 +782,8 @@ source \"arch/arm/mach-netx/Kconfig\"\n>\n>  source \"arch/arm/mach-nomadik/Kconfig\"\n>\n> +source \"arch/arm/mach-npcm/Kconfig\"\n> +\n>  source \"arch/arm/mach-nspire/Kconfig\"\n>\n>  source \"arch/arm/plat-omap/Kconfig\"\n> diff --git a/arch/arm/Makefile b/arch/arm/Makefile\n> index 47d3a1ab08d2..60ca50c7d762 100644\n> --- a/arch/arm/Makefile\n> +++ b/arch/arm/Makefile\n> @@ -191,6 +191,7 @@ machine-$(CONFIG_ARCH_MEDIATEK)             += mediatek\n>  machine-$(CONFIG_ARCH_MXS)             += mxs\n>  machine-$(CONFIG_ARCH_NETX)            += netx\n>  machine-$(CONFIG_ARCH_NOMADIK)         += nomadik\n> +machine-$(CONFIG_ARCH_NPCM)            += npcm\n>  machine-$(CONFIG_ARCH_NSPIRE)          += nspire\n>  machine-$(CONFIG_ARCH_OXNAS)           += oxnas\n>  machine-$(CONFIG_ARCH_OMAP1)           += omap1\n> diff --git a/arch/arm/mach-npcm/Kconfig b/arch/arm/mach-npcm/Kconfig\n> new file mode 100644\n> index 000000000000..21dfa8ce828f\n> --- /dev/null\n> +++ b/arch/arm/mach-npcm/Kconfig\n> @@ -0,0 +1,48 @@\n> +menuconfig ARCH_NPCM\n> +       bool \"Nuvoton NPCM Architecture\"\n> +       select ARCH_REQUIRE_GPIOLIB\n> +       select USE_OF\n> +       select PINCTRL\n> +       select PINCTRL_NPCM7XX\n> +\n> +if ARCH_NPCM\n> +\n> +comment \"NPCMX50 CPU type\"\n> +\n> +config CPU_NPCM750\n> +       depends on ARCH_NPCM && ARCH_MULTI_V7\n> +       bool \"Support for NPCM750 BMC CPU (Poleg)\"\n> +       select CACHE_L2X0\n> +       select CPU_V7\n> +       select ARM_GIC\n> +       select HAVE_SMP\n> +       select SMP\n> +       select SMP_ON_UP\n> +       select HAVE_ARM_SCU\n> +       select HAVE_ARM_TWD if SMP\n> +       select ARM_ERRATA_720789\n> +       select ARM_ERRATA_754322\n> +       select ARM_ERRATA_764369\n> +       select ARM_ERRATA_794072\n> +       select PL310_ERRATA_588369\n> +       select PL310_ERRATA_727915\n> +       select USB_EHCI_ROOT_HUB_TT\n> +       select USB_ARCH_HAS_HCD\n> +       select USB_ARCH_HAS_EHCI\n> +       select USB_EHCI_HCD\n> +       select USB_ARCH_HAS_OHCI\n> +       select USB_OHCI_HCD\n> +       select USB\n> +       select FIQ\n> +       select CPU_USE_DOMAINS\n> +       select GENERIC_CLOCKEVENTS\n> +       select CLKDEV_LOOKUP\n> +       select COMMON_CLK if OF\n> +       select NPCM750_TIMER\n> +       select MFD_SYSCON\n> +       help\n> +         Support for NPCM750 BMC CPU (Poleg).\n> +\n> +         Nuvoton NPCM750 BMC based on the Cortex A9.\n> +\n> +endif\n> diff --git a/arch/arm/mach-npcm/Makefile b/arch/arm/mach-npcm/Makefile\n> new file mode 100644\n> index 000000000000..78416055b854\n> --- /dev/null\n> +++ b/arch/arm/mach-npcm/Makefile\n> @@ -0,0 +1,3 @@\n> +AFLAGS_headsmp.o               += -march=armv7-a\n> +\n> +obj-$(CONFIG_CPU_NPCM750)      += npcm7xx.o platsmp.o headsmp.o\n> diff --git a/arch/arm/mach-npcm/headsmp.S b/arch/arm/mach-npcm/headsmp.S\n> new file mode 100644\n> index 000000000000..9fccbbd49ed4\n> --- /dev/null\n> +++ b/arch/arm/mach-npcm/headsmp.S\n> @@ -0,0 +1,17 @@\n> +/*\n> + * Copyright 2017 Google, Inc.\n> + *\n> + * This program is free software; you can redistribute it and/or modify\n> + * it under the terms of the GNU General Public License version 2 as\n> + * published by the Free Software Foundation.\n> + */\n> +\n> +#include <linux/linkage.h>\n> +#include <linux/init.h>\n> +#include <asm/assembler.h>\n> +\n> +ENTRY(npcm7xx_secondary_startup)\n> +       safe_svcmode_maskall r0\n> +\n> +       b       secondary_startup\n> +ENDPROC(npcm7xx_secondary_startup)\n> diff --git a/arch/arm/mach-npcm/npcm7xx.c b/arch/arm/mach-npcm/npcm7xx.c\n> new file mode 100644\n> index 000000000000..132e9d587857\n> --- /dev/null\n> +++ b/arch/arm/mach-npcm/npcm7xx.c\n> @@ -0,0 +1,34 @@\n> +/*\n> + * Copyright (c) 2017 Nuvoton Technology corporation.\n> + * Copyright 2017 Google, Inc.\n> + *\n> + * This program is free software; you can redistribute it and/or modify\n> + * it under the terms of the GNU General Public License version 2 as\n> + * published by the Free Software Foundation.\n> + */\n> +\n> +#include <linux/kernel.h>\n> +#include <linux/types.h>\n> +#include <asm/mach/arch.h>\n> +#include <asm/mach-types.h>\n> +#include <asm/mach/map.h>\n> +#include <asm/hardware/cache-l2x0.h>\n> +\n> +#define NPCM7XX_AUX_VAL (L310_AUX_CTRL_INSTR_PREFETCH |                               \\\n> +                        L310_AUX_CTRL_DATA_PREFETCH |                         \\\n> +                        L310_AUX_CTRL_NS_LOCKDOWN |                           \\\n> +                        L310_AUX_CTRL_CACHE_REPLACE_RR |                      \\\n> +                        L2C_AUX_CTRL_SHARED_OVERRIDE |                        \\\n> +                        L310_AUX_CTRL_FULL_LINE_ZERO)\n> +\n> +static const char *const npcm7xx_dt_match[] = {\n> +       \"nuvoton,npcm750\",\n> +       NULL\n> +};\n> +\n> +DT_MACHINE_START(NPCM7XX_DT, \"NPCMX50 Chip family\")\n> +       .atag_offset    = 0x100,\n> +       .dt_compat      = npcm7xx_dt_match,\n> +       .l2c_aux_val    = NPCM7XX_AUX_VAL,\n> +       .l2c_aux_mask   = ~NPCM7XX_AUX_VAL,\n> +MACHINE_END\n> diff --git a/arch/arm/mach-npcm/platsmp.c b/arch/arm/mach-npcm/platsmp.c\n> new file mode 100644\n> index 000000000000..450e83c3c531\n> --- /dev/null\n> +++ b/arch/arm/mach-npcm/platsmp.c\n> @@ -0,0 +1,88 @@\n> +/*\n> + * Copyright 2017 Google, Inc.\n> + *\n> + * This program is free software; you can redistribute it and/or modify\n> + * it under the terms of the GNU General Public License version 2 as\n> + * published by the Free Software Foundation.\n> + */\n> +\n> +#define pr_fmt(fmt) \"PLATSMP: \" fmt\n> +\n> +#include <linux/delay.h>\n> +#include <linux/device.h>\n> +#include <linux/smp.h>\n> +#include <linux/io.h>\n> +#include <linux/of.h>\n> +#include <linux/of_device.h>\n> +#include <linux/of_platform.h>\n> +#include <linux/of_address.h>\n> +#include <asm/cacheflush.h>\n> +#include <asm/smp.h>\n> +#include <asm/smp_plat.h>\n> +#include <asm/smp_scu.h>\n> +\n> +#define NPCM7XX_SCRPAD_REG 0x13c\n> +\n> +extern void npcm7xx_secondary_startup(void);\n> +\n> +static int npcm7xx_smp_boot_secondary(unsigned int cpu,\n> +                                     struct task_struct *idle)\n> +{\n> +       struct device_node *gcr_np;\n> +       void __iomem *gcr_base;\n> +       int ret = 0;\n> +\n> +       gcr_np = of_find_compatible_node(NULL, NULL, \"nuvoton,npcm750-gcr\");\n> +       if (!gcr_np) {\n> +               pr_err(\"no gcr device node\\n\");\n> +               ret = -EFAULT;\n> +               goto out;\n> +       }\n> +       gcr_base = of_iomap(gcr_np, 0);\n> +       if (!gcr_base) {\n> +               pr_err(\"could not iomap gcr at: 0x%p\\n\", gcr_base);\n> +               ret = -EFAULT;\n> +               goto out;\n> +       }\n> +\n> +       /* give boot ROM kernel start address. */\n> +       iowrite32(__pa_symbol(npcm7xx_secondary_startup), gcr_base +\n> +                 NPCM7XX_SCRPAD_REG);\n> +       /* make sure npcm7xx_secondary_startup is seen by all observers. */\n> +       smp_wmb();\n> +       dsb_sev();\n> +       /* make sure write buffer is drained */\n> +       mb();\n> +\n> +       iounmap(gcr_base);\n> +out:\n> +       return ret;\n> +}\n> +\n> +static void __init npcm7xx_smp_prepare_cpus(unsigned int max_cpus)\n> +{\n> +       struct device_node *scu_np;\n> +       void __iomem *scu_base;\n> +\n> +       scu_np = of_find_compatible_node(NULL, NULL, \"arm,cortex-a9-scu\");\n> +       if (!scu_np) {\n> +               pr_err(\"no scu device node\\n\");\n> +               return;\n> +       }\n> +       scu_base = of_iomap(scu_np, 0);\n> +       if (!scu_base) {\n> +               pr_err(\"could not iomap scu at: 0x%p\\n\", scu_base);\n> +               return;\n> +       }\n> +\n> +       scu_enable(scu_base);\n> +\n> +       iounmap(scu_base);\n> +}\n> +\n> +static struct smp_operations npcm7xx_smp_ops __initdata = {\n> +       .smp_prepare_cpus = npcm7xx_smp_prepare_cpus,\n> +       .smp_boot_secondary = npcm7xx_smp_boot_secondary,\n> +};\n> +\n> +CPU_METHOD_OF_DECLARE(npcm7xx_smp, \"nuvoton,npcm7xx-smp\", &npcm7xx_smp_ops);\n> --\n> 2.14.1.581.gf28d330327-goog\n>\n\nReviewed-by: Tomer Maimon <tmaimon77@gmail.com>\nReviewed-by: Avi Fishman <avifishman70@gmail.com>\nTested-by: Tomer Maimon <tmaimon77@gmail.com>\nTested-by: Avi Fishman <avifishman70@gmail.com>","headers":{"Return-Path":"<openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","openbmc@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","openbmc@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xqktb1vm0z9sQl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 10 Sep 2017 18:36:39 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xqktb0lKTzDrbr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 10 Sep 2017 18:36:39 +1000 (AEST)","from mail-vk0-x241.google.com (mail-vk0-x241.google.com\n\t[IPv6:2607:f8b0:400c:c05::241])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xqktT6B9KzDrbK\n\tfor <openbmc@lists.ozlabs.org>; Sun, 10 Sep 2017 18:36:33 +1000 (AEST)","by mail-vk0-x241.google.com with SMTP id o22so1499106vke.5\n\tfor <openbmc@lists.ozlabs.org>; Sun, 10 Sep 2017 01:36:33 -0700 (PDT)","by 10.176.90.193 with HTTP; Sun, 10 Sep 2017 01:36:30 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"pk4wxfjr\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"pk4wxfjr\"; dkim-atps=neutral","ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400c:c05::241; helo=mail-vk0-x241.google.com;\n\tenvelope-from=tmaimon77@gmail.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"pk4wxfjr\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=w7wBx9qCnMbtMqBh6sbayIUdXiRONhQxQqzM/7wjChs=;\n\tb=pk4wxfjrcwELopc1uojpjQ91aY0w2rGLm/L7NGWGXFYLhJq+M8c1aKxyNazyj/BpsL\n\tqpTcsR7yGnlEv53NXPxsVQFhE0KRPvxGcnt1OJ2LtKybnqhImvaCjmYpNOdy9k50eFld\n\tdonbPjWjKbioF0c8e82/ISQ3bKe1C7AJ2WzciCiPTanCtmAYygScokNvPeztUMRh8D/l\n\tfj31UbCCd9T+ZR0UBgO7p/qcRSR9BbIQEhdkCKOWJ4evTO+/0PD+f+N5yGIc9tt7fN2v\n\tOogFB0I/N33GxMNeQy+5GKTbalzc2vBsYoJLi8sd7xrv09/HIpxUiqgvwk3jj8qV3Oma\n\txnqA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=w7wBx9qCnMbtMqBh6sbayIUdXiRONhQxQqzM/7wjChs=;\n\tb=jdFPRE+D7RlxokVoBvd0tKVtVSW1JYk+wv6E4UXI3bEiBxPlj5WIPG+lGF3yaXWr9b\n\tTWtal2V0nvOktvCy8mu8tbw9j3hcNTp/VjxZFBSVTYfOWq8dJqU1pk6ogJI4Ps1iNfQw\n\twjYNRVxA3iEWpO5CaOLrDcN3lCZ7nsP1uVG3mNWn7Ar0JbDtFAORKXGy/c5P/Mi9EYPo\n\tZez1rdNyMCz8EzC8lx8nSZVaQTOJeO1MapZL+jd6uxBnr+nFZrA42M1aO1DEk5+tPFcw\n\tnjDCH0J5T3KZymJ4+Qz5d+r3uKSj7O5sRNMQnlon1iJAYAtXgE6qChHnWXLM3Ws56RCu\n\tbIMg==","X-Gm-Message-State":"AHPjjUhqClYiQnuzodJujCSoW9La/kZ1Xrz2jAHKsGeIP1Cn7WEk5VPl\n\tsK2ZYMZKW+ODvMQZR09jsZBbQqRNyA==","X-Google-Smtp-Source":"AOwi7QD/xLaw1LRMicAo7O5jdeGImOUcTUS4+dTMDLgweNgLo3WVZxYz/4MIDR6gHwFA6stjnCt87kVuavjYGh7QBto=","X-Received":"by 10.31.219.3 with SMTP id s3mr5529029vkg.12.1505032591234; Sun,\n\t10 Sep 2017 01:36:31 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170909015308.30001-2-brendanhiggins@google.com>","References":"<20170909015308.30001-1-brendanhiggins@google.com>\n\t<20170909015308.30001-2-brendanhiggins@google.com>","From":"Tomer Maimon <tmaimon77@gmail.com>","Date":"Sun, 10 Sep 2017 11:36:30 +0300","Message-ID":"<CAP6Zq1jj08RbnUhPKaFuxn_06W1SzDmJoN6x8xV2pc05RKfngw@mail.gmail.com>","Subject":"Re: [PATCH v5 1/3] arm: npcm: add basic support for Nuvoton BMCs","To":"Brendan Higgins <brendanhiggins@google.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-BeenThere":"openbmc@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Development list for OpenBMC <openbmc.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/openbmc>,\n\t<mailto:openbmc-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/openbmc/>","List-Post":"<mailto:openbmc@lists.ozlabs.org>","List-Help":"<mailto:openbmc-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/openbmc>,\n\t<mailto:openbmc-request@lists.ozlabs.org?subject=subscribe>","Cc":"mark.rutland@arm.com, devicetree@vger.kernel.org, f.fainelli@gmail.com, \n\tavifishman70@gmail.com, openbmc@lists.ozlabs.org, linux@armlinux.org.uk, \n\tlinux-kernel@vger.kernel.org, robh+dt@kernel.org,\n\tlinux-arm-kernel@lists.infradead.org","Errors-To":"openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"openbmc\"\n\t<openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"}}]