All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Zhang <william.zhang@broadcom.com>
To: Linux ARM List <linux-arm-kernel@lists.infradead.org>
Cc: joel.peshkin@broadcom.com, florian.fainelli@broadcom.com,
	dan.beygelman@broadcom.com, anand.gore@broadcom.com,
	kursad.oney@broadcom.com, samyon.furman@broadcom.com,
	tomer.yacoby@broadcom.com, philippe.reynes@softathome.com,
	William Zhang <william.zhang@broadcom.com>,
	Broadcom internal kernel review list 
	<bcm-kernel-feedback-list@broadcom.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>, Russell King <linux@armlinux.org.uk>,
	Scott Branden <sbranden@broadcom.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ARM: bcmbca: add VFP and NEON fixup for bcm6846 SoC
Date: Tue, 24 May 2022 17:35:09 -0700	[thread overview]
Message-ID: <20220525003509.2812-1-william.zhang@broadcom.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2599 bytes --]

BCM6846 SoC only has VFP and NEON support on core 0. So kernel VPF/NEON
support is disabled in this chip. Add this fixup to manually turn on
VFP/NEON in case userspace app need to access them on core 0.

Signed-off-by: William Zhang <william.zhang@broadcom.com>

---

 arch/arm/mach-bcm/Makefile |  5 ++++
 arch/arm/mach-bcm/bcmbca.c | 54 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 arch/arm/mach-bcm/bcmbca.c

diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index b2394ddb0558..137b24b52139 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -68,3 +68,8 @@ CFLAGS_platsmp-brcmstb.o	+= -march=armv7-a
 obj-y				+= brcmstb.o
 obj-$(CONFIG_SMP)		+= platsmp-brcmstb.o
 endif
+
+# BCMBCA
+ifeq ($(CONFIG_ARCH_BCMBCA),y)
+obj-y				+= bcmbca.o
+endif
diff --git a/arch/arm/mach-bcm/bcmbca.c b/arch/arm/mach-bcm/bcmbca.c
new file mode 100644
index 000000000000..6fcdfe0b94c1
--- /dev/null
+++ b/arch/arm/mach-bcm/bcmbca.c
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Broadcom Ltd
+ *
+ * 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.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/smp.h>
+#include <asm/mach/arch.h>
+#include <asm/vfp.h>
+#include <asm/cp15.h>
+
+#include "../vfp/vfpinstr.h"
+
+/*
+ * In some low end BCA chips, only core 0 has VPF/NEON support. Kernel VPF
+ * NEON are disabled on these platforms. Add this fixup to enable VFP/NEON
+ * on core 0 manually in case some user app need to access vfp/neon on core 0
+ */
+static void __init neon_enable(void *data)
+{
+	u32 access, fpexc;
+	(void)data;
+
+	/* Enable full access to VFP (cp10 and cp11) */
+	access = get_copro_access();
+	set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
+
+	/* enable NEON and VFP extension */
+	fpexc = fmrx(FPEXC);
+	fmxr(FPEXC, fpexc | FPEXC_EN);
+}
+
+static void __init bcmbca_neon_fixup(void)
+{
+	smp_call_function_single(0, neon_enable, NULL, 1);
+}
+
+static const char *const bcmbca_match[] __initconst = {
+	"brcm,bcm6846",
+	NULL
+};
+
+DT_MACHINE_START(BCMBCA, "Broadcom BCMBCA SoC")
+	.dt_compat		= bcmbca_match,
+	.init_late		= bcmbca_neon_fixup,
+MACHINE_END
-- 
2.17.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: William Zhang <william.zhang@broadcom.com>
To: Linux ARM List <linux-arm-kernel@lists.infradead.org>
Cc: joel.peshkin@broadcom.com, florian.fainelli@broadcom.com,
	dan.beygelman@broadcom.com, anand.gore@broadcom.com,
	kursad.oney@broadcom.com, samyon.furman@broadcom.com,
	tomer.yacoby@broadcom.com, philippe.reynes@softathome.com,
	William Zhang <william.zhang@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	 Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>, Russell King <linux@armlinux.org.uk>,
	Scott Branden <sbranden@broadcom.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ARM: bcmbca: add VFP and NEON fixup for bcm6846 SoC
Date: Tue, 24 May 2022 17:35:09 -0700	[thread overview]
Message-ID: <20220525003509.2812-1-william.zhang@broadcom.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2599 bytes --]

BCM6846 SoC only has VFP and NEON support on core 0. So kernel VPF/NEON
support is disabled in this chip. Add this fixup to manually turn on
VFP/NEON in case userspace app need to access them on core 0.

Signed-off-by: William Zhang <william.zhang@broadcom.com>

---

 arch/arm/mach-bcm/Makefile |  5 ++++
 arch/arm/mach-bcm/bcmbca.c | 54 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 arch/arm/mach-bcm/bcmbca.c

diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index b2394ddb0558..137b24b52139 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -68,3 +68,8 @@ CFLAGS_platsmp-brcmstb.o	+= -march=armv7-a
 obj-y				+= brcmstb.o
 obj-$(CONFIG_SMP)		+= platsmp-brcmstb.o
 endif
+
+# BCMBCA
+ifeq ($(CONFIG_ARCH_BCMBCA),y)
+obj-y				+= bcmbca.o
+endif
diff --git a/arch/arm/mach-bcm/bcmbca.c b/arch/arm/mach-bcm/bcmbca.c
new file mode 100644
index 000000000000..6fcdfe0b94c1
--- /dev/null
+++ b/arch/arm/mach-bcm/bcmbca.c
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Broadcom Ltd
+ *
+ * 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.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/smp.h>
+#include <asm/mach/arch.h>
+#include <asm/vfp.h>
+#include <asm/cp15.h>
+
+#include "../vfp/vfpinstr.h"
+
+/*
+ * In some low end BCA chips, only core 0 has VPF/NEON support. Kernel VPF
+ * NEON are disabled on these platforms. Add this fixup to enable VFP/NEON
+ * on core 0 manually in case some user app need to access vfp/neon on core 0
+ */
+static void __init neon_enable(void *data)
+{
+	u32 access, fpexc;
+	(void)data;
+
+	/* Enable full access to VFP (cp10 and cp11) */
+	access = get_copro_access();
+	set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
+
+	/* enable NEON and VFP extension */
+	fpexc = fmrx(FPEXC);
+	fmxr(FPEXC, fpexc | FPEXC_EN);
+}
+
+static void __init bcmbca_neon_fixup(void)
+{
+	smp_call_function_single(0, neon_enable, NULL, 1);
+}
+
+static const char *const bcmbca_match[] __initconst = {
+	"brcm,bcm6846",
+	NULL
+};
+
+DT_MACHINE_START(BCMBCA, "Broadcom BCMBCA SoC")
+	.dt_compat		= bcmbca_match,
+	.init_late		= bcmbca_neon_fixup,
+MACHINE_END
-- 
2.17.1


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-05-25  0:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25  0:35 William Zhang [this message]
2022-05-25  0:35 ` [PATCH] ARM: bcmbca: add VFP and NEON fixup for bcm6846 SoC William Zhang
2022-06-15 17:43 ` Florian Fainelli
2022-06-15 17:43   ` Florian Fainelli
2022-06-15 18:14   ` Russell King (Oracle)
2022-06-15 18:14     ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220525003509.2812-1-william.zhang@broadcom.com \
    --to=william.zhang@broadcom.com \
    --cc=anand.gore@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dan.beygelman@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=joel.peshkin@broadcom.com \
    --cc=kursad.oney@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=philippe.reynes@softathome.com \
    --cc=rjui@broadcom.com \
    --cc=samyon.furman@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=tomer.yacoby@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.