Skip to contentSkip to conversation

ARM: Broadcom BCM4760 support

PATCH Superseded Domenico Andreoli 6 participants 20 messages Aug 14, 2013 – Sep 13, 2013

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover ARM: Broadcom BCM4760 support

Howdy,

here is the latest version of my patchest to support this Soc.

I included the sorting (and duplicates removal) of mach-* and plat-* entries by Russel.

Aside CONFIG_ARCH_BCM4760 selecting again mach-bcm (v1), nothing else is changed respect to v2.

Regards,
Domenico

#3 lore raw

PATCH v3 2/5 ARM: bcm4760: Add platform infrastructure

Domenico,

Quoted 21 lines · Domenico Andreoli

From: Domenico Andreoli <[email protected]>

Platform infrastructure for the Broadcom BCM4760 based ARM11 SoCs.

v3:
* dropped the idea of unconditionally build mach-bcm

v2:
* clocks are now configured via DT
* uart DT nodes have been renamed and hooked to the proper clock nodes
* dropped unneeded config options
* dropped misused initialization of system_rev
* dropped unneeded early io mapping
* build rule of mach-bcm is moved to separated patch

v1:
* initial release

Cc devicetree at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org
Quoted 12 lines
---
 Documentation/devicetree/bindings/arm/bcm4760.txt |    8 ++
 MAINTAINERS                                       |    7 ++
 arch/arm/Makefile                                 |    1 +
 arch/arm/boot/dts/Makefile                        |    1 +
 arch/arm/boot/dts/bcm4760-catalina.dts            |   11 +++
 arch/arm/boot/dts/bcm4760.dtsi                    |   71 +++++++++++++++++++++
 arch/arm/configs/bcm4760_defconfig                |   76 ++++++++++++++++++++++
 arch/arm/mach-bcm/Kconfig                         |    7 ++
 arch/arm/mach-bcm/Makefile                        |    2 +
 arch/arm/mach-bcm/bcm4760.c                       |   37 +++++++++++
 10 files changed, 221 insertions(+)

Since I raised the original objection to the unconditional build,

thx,

Jason.

#4 lore raw

PATCH v3 2/5 ARM: bcm4760: Add platform infrastructure

In reply to Domenico Andreoli

Hi,

Quoted 159 lines · Domenico Andreoli

From: Domenico Andreoli <[email protected]>

Platform infrastructure for the Broadcom BCM4760 based ARM11 SoCs.

v3:
* dropped the idea of unconditionally build mach-bcm

v2:
* clocks are now configured via DT
* uart DT nodes have been renamed and hooked to the proper clock nodes
* dropped unneeded config options
* dropped misused initialization of system_rev
* dropped unneeded early io mapping
* build rule of mach-bcm is moved to separated patch

v1:
* initial release

Cc devicetree at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org
---
 Documentation/devicetree/bindings/arm/bcm4760.txt |    8 ++
 MAINTAINERS                                       |    7 ++
 arch/arm/Makefile                                 |    1 +
 arch/arm/boot/dts/Makefile                        |    1 +
 arch/arm/boot/dts/bcm4760-catalina.dts            |   11 +++
 arch/arm/boot/dts/bcm4760.dtsi                    |   71 +++++++++++++++++++++
 arch/arm/configs/bcm4760_defconfig                |   76 ++++++++++++++++++++++
 arch/arm/mach-bcm/Kconfig                         |    7 ++
 arch/arm/mach-bcm/Makefile                        |    2 +
 arch/arm/mach-bcm/bcm4760.c                       |   37 +++++++++++
 10 files changed, 221 insertions(+)

Index: b/Documentation/devicetree/bindings/arm/bcm4760.txt
===================================================================

Documentation/devicetree/bindings/arm/bcm4760.txt new file +8 -0
@@ -0,0 +1,8 @@
+Broadcom BCM4760 ARM11 SoC device tree bindings
+-----------------------------------------------
+
+Boards with the BCM4760 SoC shall have the following properties:
+
+Required root node property:
+
+compatible = "brcm,bcm4760";

Index: b/arch/arm/configs/bcm4760_defconfig
===================================================================

arch/arm/configs/bcm4760_defconfig new file +76 -0
@@ -0,0 +1,76 @@
+CONFIG_IRQ_DOMAIN_DEBUG=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_EMBEDDED=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_ARCH_MULTI_V6=y
+# CONFIG_ARCH_MULTI_V7 is not set
+CONFIG_ARCH_BCM4760=y
+CONFIG_ARM_ERRATA_411920=y
+CONFIG_ARM_ERRATA_364296=y
+CONFIG_AEABI=y
+CONFIG_DEPRECATED_PARAM_STRUCT=y
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_ARM_ATAG_DTB_COMPAT=y
+CONFIG_VFP=y
+# CONFIG_SUSPEND is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_CMA=y
+CONFIG_PROC_DEVICETREE=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_SCSI=y
+# CONFIG_SCSI_PROC_FS is not set
+CONFIG_BLK_DEV_SD=y
+CONFIG_SCSI_MULTI_LUN=y
+# CONFIG_SCSI_LOWLEVEL is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_HWMON is not set
+# CONFIG_HID is not set
+# CONFIG_USB_SUPPORT is not set
+CONFIG_COMMON_CLK_DEBUG=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXT2_FS=y
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_FS_XATTR is not set
+CONFIG_EXT4_FS=y
+CONFIG_FANOTIFY=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+# CONFIG_PROC_PAGE_MONITOR is not set
+CONFIG_TMPFS=y
+CONFIG_CRAMFS=y
+CONFIG_ROMFS_FS=y
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_CODEPAGE_850=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_ISO8859_15=y
+CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_REDUCED=y
+CONFIG_STRIP_ASM_SYMS=y
+CONFIG_DEBUG_SECTION_MISMATCH=y
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHED_DEBUG is not set
+CONFIG_DEBUG_SPINLOCK=y
+CONFIG_DEBUG_MUTEXES=y
+CONFIG_DEBUG_ATOMIC_SLEEP=y
+# CONFIG_FTRACE is not set
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_HW is not set

Index: b/arch/arm/mach-bcm/bcm4760.c
===================================================================

arch/arm/mach-bcm/bcm4760.c new file +26 -0
@@ -0,0 +1,37 @@
+/*
+ * Broadcom BCM4760 based ARM11 SoCs platform support
+ *
+ * Copyright (C) 2012 Domenico Andreoli <[email protected]>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <linux/init.h>
+#include <linux/clk-provider.h>
+#include <linux/of_platform.h>
+
+#include <asm/mach/arch.h>
+
+static void __init bcm4760_init(void)
+{
+	of_clk_init(NULL);
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);

arch/arm/mach-bcm/bcm4760.c line 36

Quoted 10 lines
arch/arm/mach-bcm/bcm4760.c new file +10 -0
+}
+
+static const char * const bcm4760_compat[] __initconst = {
+	"brcm,bcm4760",
+	NULL
+};
+
+DT_MACHINE_START(BCM4760, "Broadcom BCM4760")
+	.init_machine = bcm4760_init,
+	.dt_compat = bcm4760_compat

Please add a , after the last member too, it makes life much easier if someone is scripting a change across all these in the future (such as sorting them).

Quoted 5 lines

Index: b/arch/arm/mach-bcm/Kconfig
===================================================================

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 26

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +7 -0
@@ -17,3 +17,10 @@ config ARCH_BCM
 	  It currently supports the 'BCM281XX' family, which includes
 	  BCM11130, BCM11140, BCM11351, BCM28145 and
 	  BCM28155 variants.
+
+config ARCH_BCM4760
+	bool "Broadcom BCM4760 based SoCs (ARM11)" if ARCH_MULTI_V6
+	select ARM_AMBA
+	select ARM_VIC
+	select CLKSRC_OF
+	select SOC_BUS

So I think I mentioned this during previous discussions, but I think this should be solved by having:

config ARCH_BCM
bool "Broadcom platforms"
help
This enables support for Broadcom based systems

menu "Broadcom platform selection"
depends on ARCH_BCM

config ARCH_BCM281XX
... current ARCH_BCM contents

config ARCH_BCM4760
... above conents
endmenu

Quoted 15 lines

Index: b/arch/arm/mach-bcm/Makefile
===================================================================

arch/arm/mach-bcm/Makefile +2 -0
@@ -13,3 +13,5 @@
 obj-$(CONFIG_ARCH_BCM)		:= board_bcm.o bcm_kona_smc.o bcm_kona_smc_asm.o
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_bcm_kona_smc_asm.o	:=-Wa,-march=armv7-a$(plus_sec)
+
+obj-$(CONFIG_ARCH_BCM4760)	+= bcm4760.o

Index: b/arch/arm/Makefile
===================================================================

arch/arm/Makefile textofs-$(CONFIG_ARCH_MSM8960) := 0x0020 · line 150

Quoted 4 lines
arch/arm/Makefile +1 -0
@@ -147,6 +147,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x0020
 machine-$(CONFIG_ARCH_AT91)		+= at91
 machine-$(CONFIG_ARCH_BCM)		+= bcm
 machine-$(CONFIG_ARCH_BCM2835)		+= bcm2835
+machine-$(CONFIG_ARCH_BCM4760)		+= bcm

With the above change, this isn't needed.

-Olof

#5 lore raw

PATCH v3 2/5 ARM: bcm4760: Add platform infrastructure

Quoted 1 line · Olof Johansson

Hi,

Hi,

Quoted 165 lines · Domenico Andreoli
Quoted 164 lines

From: Domenico Andreoli <[email protected]>

Platform infrastructure for the Broadcom BCM4760 based ARM11 SoCs.

v3:
* dropped the idea of unconditionally build mach-bcm

v2:
* clocks are now configured via DT
* uart DT nodes have been renamed and hooked to the proper clock nodes
* dropped unneeded config options
* dropped misused initialization of system_rev
* dropped unneeded early io mapping
* build rule of mach-bcm is moved to separated patch

v1:
* initial release

Cc devicetree at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org
---
 Documentation/devicetree/bindings/arm/bcm4760.txt |    8 ++
 MAINTAINERS                                       |    7 ++
 arch/arm/Makefile                                 |    1 +
 arch/arm/boot/dts/Makefile                        |    1 +
 arch/arm/boot/dts/bcm4760-catalina.dts            |   11 +++
 arch/arm/boot/dts/bcm4760.dtsi                    |   71 +++++++++++++++++++++
 arch/arm/configs/bcm4760_defconfig                |   76 ++++++++++++++++++++++
 arch/arm/mach-bcm/Kconfig                         |    7 ++
 arch/arm/mach-bcm/Makefile                        |    2 +
 arch/arm/mach-bcm/bcm4760.c                       |   37 +++++++++++
 10 files changed, 221 insertions(+)

Index: b/Documentation/devicetree/bindings/arm/bcm4760.txt
===================================================================

Documentation/devicetree/bindings/arm/bcm4760.txt new file +8 -0
@@ -0,0 +1,8 @@
+Broadcom BCM4760 ARM11 SoC device tree bindings
+-----------------------------------------------
+
+Boards with the BCM4760 SoC shall have the following properties:
+
+Required root node property:
+
+compatible = "brcm,bcm4760";

Index: b/arch/arm/configs/bcm4760_defconfig
===================================================================

arch/arm/configs/bcm4760_defconfig new file +76 -0
@@ -0,0 +1,76 @@
+CONFIG_IRQ_DOMAIN_DEBUG=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_EMBEDDED=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_ARCH_MULTI_V6=y
+# CONFIG_ARCH_MULTI_V7 is not set
+CONFIG_ARCH_BCM4760=y
+CONFIG_ARM_ERRATA_411920=y
+CONFIG_ARM_ERRATA_364296=y
+CONFIG_AEABI=y
+CONFIG_DEPRECATED_PARAM_STRUCT=y
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_ARM_ATAG_DTB_COMPAT=y
+CONFIG_VFP=y
+# CONFIG_SUSPEND is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_CMA=y
+CONFIG_PROC_DEVICETREE=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_SCSI=y
+# CONFIG_SCSI_PROC_FS is not set
+CONFIG_BLK_DEV_SD=y
+CONFIG_SCSI_MULTI_LUN=y
+# CONFIG_SCSI_LOWLEVEL is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_HWMON is not set
+# CONFIG_HID is not set
+# CONFIG_USB_SUPPORT is not set
+CONFIG_COMMON_CLK_DEBUG=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXT2_FS=y
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_FS_XATTR is not set
+CONFIG_EXT4_FS=y
+CONFIG_FANOTIFY=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+# CONFIG_PROC_PAGE_MONITOR is not set
+CONFIG_TMPFS=y
+CONFIG_CRAMFS=y
+CONFIG_ROMFS_FS=y
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_CODEPAGE_850=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_ISO8859_15=y
+CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_REDUCED=y
+CONFIG_STRIP_ASM_SYMS=y
+CONFIG_DEBUG_SECTION_MISMATCH=y
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHED_DEBUG is not set
+CONFIG_DEBUG_SPINLOCK=y
+CONFIG_DEBUG_MUTEXES=y
+CONFIG_DEBUG_ATOMIC_SLEEP=y
+# CONFIG_FTRACE is not set
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_HW is not set

Index: b/arch/arm/mach-bcm/bcm4760.c
===================================================================

arch/arm/mach-bcm/bcm4760.c new file +31 -0
@@ -0,0 +1,37 @@
+/*
+ * Broadcom BCM4760 based ARM11 SoCs platform support
+ *
+ * Copyright (C) 2012 Domenico Andreoli <[email protected]>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <linux/init.h>
+#include <linux/clk-provider.h>
+#include <linux/of_platform.h>
+
+#include <asm/mach/arch.h>
+
+static void __init bcm4760_init(void)
+{
+	of_clk_init(NULL);
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const bcm4760_compat[] __initconst = {
+	"brcm,bcm4760",
+	NULL
Quoted 8 lines

arch/arm/mach-bcm/bcm4760.c line 36

Quoted 5 lines
arch/arm/mach-bcm/bcm4760.c new file +5 -0
+};
+
+DT_MACHINE_START(BCM4760, "Broadcom BCM4760")
+	.init_machine = bcm4760_init,
+	.dt_compat = bcm4760_compat

Please add a , after the last member too, it makes life much easier if someone is scripting a change across all these in the future (such as sorting them).

I usually pay attention to this detail. I'll fix.

Quoted 28 lines
Quoted 6 lines

Index: b/arch/arm/mach-bcm/Kconfig
===================================================================

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 26

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +7 -0
@@ -17,3 +17,10 @@ config ARCH_BCM
 	  It currently supports the 'BCM281XX' family, which includes
 	  BCM11130, BCM11140, BCM11351, BCM28145 and
 	  BCM28155 variants.
+
+config ARCH_BCM4760
+	bool "Broadcom BCM4760 based SoCs (ARM11)" if ARCH_MULTI_V6
+	select ARM_AMBA
+	select ARM_VIC
+	select CLKSRC_OF
+	select SOC_BUS

So I think I mentioned this during previous discussions, but I think this should be solved by having:

config ARCH_BCM
bool "Broadcom platforms"
help
This enables support for Broadcom based systems

menu "Broadcom platform selection"
depends on ARCH_BCM

Quoted 6 lines

config ARCH_BCM281XX
... current ARCH_BCM contents

config ARCH_BCM4760
... above conents
endmenu

got it.

need to sync with Christian, the current owner of ARCH_BCM.

Quoted 15 lines
Quoted 15 lines

Index: b/arch/arm/mach-bcm/Makefile
===================================================================

arch/arm/mach-bcm/Makefile +2 -0
@@ -13,3 +13,5 @@
 obj-$(CONFIG_ARCH_BCM)		:= board_bcm.o bcm_kona_smc.o bcm_kona_smc_asm.o
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_bcm_kona_smc_asm.o	:=-Wa,-march=armv7-a$(plus_sec)
+
+obj-$(CONFIG_ARCH_BCM4760)	+= bcm4760.o

Index: b/arch/arm/Makefile
===================================================================
--- a/arch/arm/Makefile

Quoted 8 lines

arch/arm/mach-bcm/Makefile textofs-$(CONFIG_ARCH_MSM8960) := 0x0020 · line 150

Quoted 6 lines

+++ b/arch/arm/Makefile

arch/arm/mach-bcm/Makefile +1 -0
@@ -147,6 +147,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x0020
 machine-$(CONFIG_ARCH_AT91)		+= at91
 machine-$(CONFIG_ARCH_BCM)		+= bcm
 machine-$(CONFIG_ARCH_BCM2835)		+= bcm2835
+machine-$(CONFIG_ARCH_BCM4760)		+= bcm

With the above change, this isn't needed.

clear

Quoted 3 lines

-Olof

Thanks
Domenico

#6 lore raw

PATCH v3 2/5 ARM: bcm4760: Add platform infrastructure

Quoted 29 lines · Domenico Andreoli
Quoted 29 lines
Quoted 5 lines

Index: b/arch/arm/mach-bcm/Kconfig
===================================================================

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 26

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +7 -0
@@ -17,3 +17,10 @@ config ARCH_BCM
  	  It currently supports the 'BCM281XX' family, which includes
  	  BCM11130, BCM11140, BCM11351, BCM28145 and
  	  BCM28155 variants.
+
+config ARCH_BCM4760
+	bool "Broadcom BCM4760 based SoCs (ARM11)" if ARCH_MULTI_V6
+	select ARM_AMBA
+	select ARM_VIC
+	select CLKSRC_OF
+	select SOC_BUS

So I think I mentioned this during previous discussions, but I think this should be solved by having:

config ARCH_BCM
bool "Broadcom platforms"
help
This enables support for Broadcom based systems

menu "Broadcom platform selection"
depends on ARCH_BCM

config ARCH_BCM281XX
... current ARCH_BCM contents

Quoted 6 lines
Quoted 3 lines

config ARCH_BCM4760
... above conents
endmenu

got it.

need to sync with Christian, the current owner of ARCH_BCM.

This is fine, but it is better to name it MOBILEBCM instead for our platform, as it plan to keep it single zImage. My plan was to switch the current usage of ARCH_BCM for chips to ARCH_MOBILEBCM, and then leave ARCH_BCM as a generic BCM menu option as above. I can send a patch to that effect if everyone is okay with that.

thanks,
csd

#7 lore raw

PATCH v3 2/5 ARM: bcm4760: Add platform infrastructure

Quoted 38 lines · Christian Daudt
Quoted 37 lines · Domenico Andreoli
Quoted 28 lines
Quoted 6 lines

Index: b/arch/arm/mach-bcm/Kconfig
===================================================================

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 26

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +7 -0
@@ -17,3 +17,10 @@ config ARCH_BCM
          It currently supports the 'BCM281XX' family, which includes
          BCM11130, BCM11140, BCM11351, BCM28145 and
          BCM28155 variants.
+
+config ARCH_BCM4760
+       bool "Broadcom BCM4760 based SoCs (ARM11)" if ARCH_MULTI_V6
+       select ARM_AMBA
+       select ARM_VIC
+       select CLKSRC_OF
+       select SOC_BUS

So I think I mentioned this during previous discussions, but I think this should be solved by having:

config ARCH_BCM
bool "Broadcom platforms"
help
This enables support for Broadcom based systems

menu "Broadcom platform selection"
depends on ARCH_BCM

Quoted 6 lines

config ARCH_BCM281XX
... current ARCH_BCM contents

config ARCH_BCM4760
... above conents
endmenu

got it.

Quoted 7 lines
Quoted 1 line

need to sync with Christian, the current owner of ARCH_BCM.

This is fine, but it is better to name it MOBILEBCM instead for our platform, as it plan to keep it single zImage. My plan was to switch the current usage of ARCH_BCM for chips to ARCH_MOBILEBCM, and then leave ARCH_BCM as a generic BCM menu option as above. I can send a patch to that effect if everyone is okay with that.

Sounds good. Let's do that for 2.13.

-Olof

#8 lore raw

PATCH v3 2/5 ARM: bcm4760: Add platform infrastructure

Quoted 41 lines · Olof Johansson
Quoted 40 lines · Christian Daudt
Quoted 38 lines · Domenico Andreoli
Quoted 28 lines
Quoted 6 lines

Index: b/arch/arm/mach-bcm/Kconfig
===================================================================

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 26

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +7 -0
@@ -17,3 +17,10 @@ config ARCH_BCM
          It currently supports the 'BCM281XX' family, which includes
          BCM11130, BCM11140, BCM11351, BCM28145 and
          BCM28155 variants.
+
+config ARCH_BCM4760
+       bool "Broadcom BCM4760 based SoCs (ARM11)" if ARCH_MULTI_V6
+       select ARM_AMBA
+       select ARM_VIC
+       select CLKSRC_OF
+       select SOC_BUS

So I think I mentioned this during previous discussions, but I think this should be solved by having:

config ARCH_BCM
bool "Broadcom platforms"
help
This enables support for Broadcom based systems

menu "Broadcom platform selection"
depends on ARCH_BCM

Quoted 6 lines

config ARCH_BCM281XX
... current ARCH_BCM contents

config ARCH_BCM4760
... above conents
endmenu

got it.

need to sync with Christian, the current owner of ARCH_BCM.

Quoted 7 lines
Quoted 5 lines

This is fine, but it is better to name it MOBILEBCM instead for our platform, as it plan to keep it single zImage. My plan was to switch the current usage of ARCH_BCM for chips to ARCH_MOBILEBCM, and then leave ARCH_BCM as a generic BCM menu option as above. I can send a patch to that effect if everyone is okay with that.

Sounds good. Let's do that for 2.13.

Christian, can I assume you will prepare a patch to rename ARCH_BCM or do you prefer I include it my series, maybe simplifying the merge of it? I'm fine with both.

Regards,
Domenico

#9 lore raw

PATCH v3 2/5 ARM: bcm4760: Add platform infrastructure

Quoted 43 lines · Domenico Andreoli
Quoted 42 lines · Olof Johansson
Quoted 41 lines · Christian Daudt
Quoted 29 lines · Domenico Andreoli
Quoted 29 lines
Quoted 5 lines

Index: b/arch/arm/mach-bcm/Kconfig
===================================================================

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 26

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +7 -0
@@ -17,3 +17,10 @@ config ARCH_BCM
           It currently supports the 'BCM281XX' family, which includes
           BCM11130, BCM11140, BCM11351, BCM28145 and
           BCM28155 variants.
+
+config ARCH_BCM4760
+       bool "Broadcom BCM4760 based SoCs (ARM11)" if ARCH_MULTI_V6
+       select ARM_AMBA
+       select ARM_VIC
+       select CLKSRC_OF
+       select SOC_BUS

So I think I mentioned this during previous discussions, but I think this should be solved by having:

config ARCH_BCM
bool "Broadcom platforms"
help
This enables support for Broadcom based systems

menu "Broadcom platform selection"
depends on ARCH_BCM

config ARCH_BCM281XX
... current ARCH_BCM contents

Quoted 6 lines
Quoted 3 lines

config ARCH_BCM4760
... above conents
endmenu

got it.

need to sync with Christian, the current owner of ARCH_BCM.

This is fine, but it is better to name it MOBILEBCM instead for our platform, as it plan to keep it single zImage. My plan was to switch the current usage of ARCH_BCM for chips to ARCH_MOBILEBCM, and then leave ARCH_BCM as a generic BCM menu option as above. I can send a patch to that effect if everyone is okay with that.

Quoted 8 lines
Quoted 1 line

Sounds good. Let's do that for 2.13.

Christian, can I assume you will prepare a patch to rename ARCH_BCM or do you prefer I include it my series, maybe simplifying the merge of it? I'm fine with both.

Regards,
Domenico

Yes. I have a patch going through internal review, I'll post it early next week.
thanks,
csd

#11 lore raw

PATCH v3 3/5 ARM: bcm4760: Add system timer

Quoted 15 lines · Domenico Andreoli
(quoted diff) +15 -0
+
+static inline void __iomem *to_load(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_LOAD_OFFSET;
+}
+
+static inline void __iomem *to_control(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_CONTROL_OFFSET;
+}
+
+static inline void __iomem *to_intclr(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_INTCLR_OFFSET;
+}

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+static inline void __iomem *to_ris(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_RIS_OFFSET;
+}
+
+static inline void __iomem *to_mis(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_MIS_OFFSET;
+}

Style Nit: This is new. Usually people either make a <my_driver>_{readl,writel}() function that takes the struct and an offset or they just add the offset directly in their readl/writel calls. Can you do that? Probably save some lines of code.

Quoted 5 lines
(quoted diff) +5 -0
+static irqreturn_t bcm4760_timer_interrupt(int irq, void *dev_id)
+{
+	struct bcm4760_timer *timer = dev_id;
+	void (*event_handler)(struct clock_event_device *);
+

Review

Quoted 10 lines
(quoted diff) +10 -0
+	/* check the (masked) interrupt status */
+	if (!readl_relaxed(to_mis(timer)))
+		return IRQ_NONE;
+
+	/* clear the timer interrupt */
+	writel_relaxed(1, to_intclr(timer));
+
+	event_handler = ACCESS_ONCE(timer->evt.event_handler);
+	if (event_handler)
+		event_handler(&timer->evt);

This is unfortunate. Do you have a pending timer interrupt left by the bootloader?

Review

Quoted 8 lines
(quoted diff) +8 -0
+
+	return IRQ_HANDLED;
+}
+
+static void __init bcm4760_init_time(struct device_node *node)
+{
+	void __iomem *base;
+	u32 freq = 24000000;

Why have freq in the DT binding at all then?

Quoted 21 lines
(quoted diff) +21 -0
+	int irq;
+	struct bcm4760_timer *timer;
+
+	base = of_iomap(node, 0);
+	if (!base)
+		panic("Can't remap timer registers");
+
+	timer = kzalloc(sizeof(*timer), GFP_KERNEL);
+	if (!timer)
+		panic("Can't allocate timer struct\n");
+
+	irq = irq_of_parse_and_map(node, 0);
+	if (irq <= 0)
+		panic("Can't parse timer IRQ");
+
+	timer->base = base;
+	timer->evt.name = node->name;
+	timer->evt.rating = 300;
+	timer->evt.features = CLOCK_EVT_FEAT_ONESHOT;
+	timer->evt.set_mode = bcm4760_timer_set_mode;
+	timer->evt.set_next_event = bcm4760_timer_set_next_event;

Review

Quoted 10 lines
(quoted diff) +10 -0
+	timer->evt.cpumask = cpumask_of(0);
+	timer->act.name = node->name;
+	timer->act.flags = IRQF_TIMER | IRQF_SHARED;
+	timer->act.dev_id = timer;
+	timer->act.handler = bcm4760_timer_interrupt;
+
+	if (setup_irq(irq, &timer->act))
+		panic("Can't set up timer IRQ\n");
+
+	clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff);

If you switch this registration and the setup_irq() call you shouldn't need the ACCESS_ONCE() and that check in the irq handler. Please switch the order and or clear the interrupt before registering the clockevent and remove the checks in the interrupt handler.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#12 lore raw

PATCH v3 3/5 ARM: bcm4760: Add system timer

Quoted 24 lines · Stephen Boyd
Quoted 23 lines · Domenico Andreoli
(quoted diff) +23 -0
+
+static inline void __iomem *to_load(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_LOAD_OFFSET;
+}
+
+static inline void __iomem *to_control(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_CONTROL_OFFSET;
+}
+
+static inline void __iomem *to_intclr(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_INTCLR_OFFSET;
+}
+
+static inline void __iomem *to_ris(struct bcm4760_timer *timer)
+{
+	return timer->base + TIMER_RIS_OFFSET;
+}
+
+static inline void __iomem *to_mis(struct bcm4760_timer *timer)
+{
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	return timer->base + TIMER_MIS_OFFSET;
+}

Style Nit: This is new. Usually people either make a <my_driver>_{readl,writel}() function that takes the struct and an offset or they just add the offset directly in their readl/writel calls. Can you do that? Probably save some lines of code.

yes, sure.

Quoted 11 lines
Quoted 11 lines
(quoted diff) +10 -0
+static irqreturn_t bcm4760_timer_interrupt(int irq, void *dev_id)
+{
+	struct bcm4760_timer *timer = dev_id;
+	void (*event_handler)(struct clock_event_device *);
+
+	/* check the (masked) interrupt status */
+	if (!readl_relaxed(to_mis(timer)))
+		return IRQ_NONE;
+
+	/* clear the timer interrupt */
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+	writel_relaxed(1, to_intclr(timer));
+
+	event_handler = ACCESS_ONCE(timer->evt.event_handler);
+	if (event_handler)
+		event_handler(&timer->evt);

This is unfortunate. Do you have a pending timer interrupt left by the bootloader?

Do you mean that if no interrupts are expected beween the irq request and the call clockevents_config_and_register(), I can assume event_handler is always set?

Quoted 11 lines

Review

Quoted 9 lines
(quoted diff) +8 -0
+
+	return IRQ_HANDLED;
+}
+
+static void __init bcm4760_init_time(struct device_node *node)
+{
+	void __iomem *base;
+	u32 freq = 24000000;

Why have freq in the DT binding at all then?

To get an HW address and remap it at runtime, I guess. I copied it but would also prefer to use DT only where really needed.

Quoted 30 lines
Quoted 30 lines
(quoted diff) +29 -0
+	int irq;
+	struct bcm4760_timer *timer;
+
+	base = of_iomap(node, 0);
+	if (!base)
+		panic("Can't remap timer registers");
+
+	timer = kzalloc(sizeof(*timer), GFP_KERNEL);
+	if (!timer)
+		panic("Can't allocate timer struct\n");
+
+	irq = irq_of_parse_and_map(node, 0);
+	if (irq <= 0)
+		panic("Can't parse timer IRQ");
+
+	timer->base = base;
+	timer->evt.name = node->name;
+	timer->evt.rating = 300;
+	timer->evt.features = CLOCK_EVT_FEAT_ONESHOT;
+	timer->evt.set_mode = bcm4760_timer_set_mode;
+	timer->evt.set_next_event = bcm4760_timer_set_next_event;
+	timer->evt.cpumask = cpumask_of(0);
+	timer->act.name = node->name;
+	timer->act.flags = IRQF_TIMER | IRQF_SHARED;
+	timer->act.dev_id = timer;
+	timer->act.handler = bcm4760_timer_interrupt;
+
+	if (setup_irq(irq, &timer->act))
+		panic("Can't set up timer IRQ\n");
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff);

If you switch this registration and the setup_irq() call you shouldn't need the ACCESS_ONCE() and that check in the irq handler. Please switch the order and or clear the interrupt before registering the clockevent and remove the checks in the interrupt handler.

got it. Thank you.

Domenico

#13 lore raw

PATCH v3 3/5 ARM: bcm4760: Add system timer

In reply to Domenico Andreoli
Quoted 11 lines · Domenico Andreoli

From: Domenico Andreoli <[email protected]>

System timer implementation for the BCM4760 based SoCs.

v3:
* unchanged

v2:
* dropped clock-frequency property, its allowed value was anyway fixed to 24MHz and not clearly related to any known clock

Quoted 8 lines

v1:
* initial release

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc devicetree at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org
#15 lore raw

PATCH v3 3/5 ARM: bcm4760: Add system timer

Quoted 6 lines · Olof Johansson
Quoted 1 line · Olof Johansson

Sorry, should have clarified: Acked if the changes requested by Stephen are done.

I've already prepared them. Will repost later.

Quoted 3 lines

-Olof

Domenico

#18 lore raw

PATCH v3 5/5 ARM: bcm4760: Add restart hook

Hi,

Quoted 3 lines · Domenico Andreoli

From: Domenico Andreoli <[email protected]>

Restart hook implementation for the Broadcom BCM4760 based ARM11 SoCs.

This essentially implements a wdt driver under mach-bcm. It'd be better to contain this under drivers/watchdog and use the reboot notifier to do the restart from there.

-Olof

#19 lore raw

PATCH v3 5/5 ARM: bcm4760: Add restart hook

Quoted 10 lines · Olof Johansson

Hi,

Quoted 3 lines · Domenico Andreoli

From: Domenico Andreoli <[email protected]>

Restart hook implementation for the Broadcom BCM4760 based ARM11 SoCs.

This essentially implements a wdt driver under mach-bcm. It'd be better to contain this under drivers/watchdog and use the reboot notifier to do the restart from there.

do I need also a config option? I don't think I need one unless I have also a complete implementation.

Domenico