MIPS: Add support for OCTEON cn78xx and cn73xx.
Subsystems (2)
v2 cover MIPS: Add support for OCTEON cn78xx and cn73xx.
From: David Daney <[email protected]>
The OCTEON III cn78xx and cn73xx family of SoCs has some architectural differences from previous OCTEON processors.
Here we add support for the new interrupt controller and related IPI machinery. This is enough to be able to boot an initrd based system to a command prompt on the serial console.
Still pending are support for: PCI, Watchdog, I2C, Sata, USB, Ethernet, etc.
This set depends on these two sets:
http://www.linux-mips.org/archives/linux-mips/2016-02/msg00051.html
http://www.linux-mips.org/archives/linux-mips/2016-02/msg00041.html
All patches are to the MIPS tree except the device tree binding definition. Probably they could be merged via Ralf's tree if there were no objections.
Changes from v1: Added Acked-by: Rob Herring to 6/8. Simplifications
suggested by tglx. Added 8/8.
David Daney (8):
MIPS: OCTEON: Remove some code limiting NR_IRQS to 255
MIPS: Select CONFIG_HANDLE_DOMAIN_IRQ and make it work.
MIPS: OCTEON: Add register definitions for cn73xx, cnf75xx and
cn78xx.
MIPS: OCTEON: Add model checking support for cn73xx, cnf75xx and
cn78xx MIPS: OCTEON: Don't attempt to use nonexistent registers on OCTEON
III models.
MIPS: OCTEON: Add support for OCTEON III interrupt controller.
MIPS: OCTEON: Add SMP support for OCTEON cn78xx et al.
MIPS: OCTEON: Simplify code in octeon_irq_ciu_gpio_set_type()
.../devicetree/bindings/mips/cavium/ciu3.txt | 27 + arch/mips/Kconfig | 1 + arch/mips/cavium-octeon/csrc-octeon.c | 13 +- arch/mips/cavium-octeon/executive/octeon-model.c | 82 ++- arch/mips/cavium-octeon/octeon-irq.c | 679 ++++++++++++++++++++- arch/mips/cavium-octeon/setup.c | 36 +- arch/mips/cavium-octeon/smp.c | 145 ++++- arch/mips/include/asm/irq_regs.h | 10 + arch/mips/include/asm/octeon/cvmx-ciu3-defs.h | 353 +++++++++++ arch/mips/include/asm/octeon/cvmx-fpa-defs.h | 1 + arch/mips/include/asm/octeon/cvmx-mio-defs.h | 410 ++++++++++++- arch/mips/include/asm/octeon/cvmx.h | 27 +- arch/mips/include/asm/octeon/octeon-feature.h | 19 +- arch/mips/include/asm/octeon/octeon-model.h | 5 + arch/mips/include/asm/octeon/octeon.h | 25 + 15 files changed, 1750 insertions(+), 83 deletions(-) create mode 100644 Documentation/devicetree/bindings/mips/cavium/ciu3.txt create mode 100644 arch/mips/include/asm/octeon/cvmx-ciu3-defs.h
Signature · 1 line
1.7.11.7
PATCH v2 1/8 MIPS: OCTEON: Remove some code limiting NR_IRQS to 255
From: David Daney <[email protected]>
Follow-on patches for OCTEON III will increase the number of irqs to potentially more than 256.
Increase the width of the octeon_irq_ciu_to_irq to int to be able to handle this case. Remove the hacky code that verified that u8 would not be overflowed.
--- arch/mips/cavium-octeon/octeon-irq.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-)
arch/mips/cavium-octeon/octeon-irq.c +2 -25
@@ -3,7 +3,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (C) 2004-2014 Cavium, Inc. +* Copyright (C) 2004-2016 Cavium, Inc. */ #include <linux/of_address.h>
@@ -28,7 +28,7 @@ struct octeon_irq_ciu_domain_data {int num_sum;/* number of sum registers (2 or 3). */ }; -static __read_mostly u8 octeon_irq_ciu_to_irq[8 ][64 ]; +static __read_mostly int octeon_irq_ciu_to_irq[8 ][64 ]; struct octeon_ciu_chip_data { union {
@@ -1158,16 +1158,6 @@ static struct irq_chip *octeon_irq_ciu_chip;static struct irq_chip *octeon_irq_ciu_chip_edge;static struct irq_chip *octeon_irq_gpio_chip; -static bool octeon_irq_virq_in_range (unsigned int virq) -{ -/* We cannot let it overflow the mapping array. */ -if (virq < (1ul <<8 *sizeof (octeon_irq_ciu_to_irq[0 ][0 ]))) -return true; - -WARN_ONCE (true,"virq out of range %u.\n" , virq); -return false; -} -static int octeon_irq_ciu_map (struct irq_domain *d,unsigned int virq,irq_hw_number_t hw) {
@@ -1176,13 +1166,6 @@ static int octeon_irq_ciu_map(struct irq_domain *d,unsigned int bit = hw &63 ;struct octeon_irq_ciu_domain_data *dd = d->host_data; -if (!octeon_irq_virq_in_range (virq)) -return -EINVAL ; - -/* Don't map irq if it is reserved for GPIO. */ -if (line ==0 && bit >=16 && bit <32 ) -return 0 ; -if (line >= dd->num_sum || octeon_irq_ciu_to_irq[line][bit] !=0 )return -EINVAL ;
@@ -1215,9 +1198,6 @@ static int octeon_irq_gpio_map(struct irq_domain *d,unsigned int line, bit;int r; -if (!octeon_irq_virq_in_range (virq)) -return -EINVAL ; - line = (hw + gpiod->base_hwirq) >>6 ; bit = (hw + gpiod->base_hwirq) &63 ; if (line > ARRAY_SIZE(octeon_irq_ciu_to_irq) ||
@@ -1899,9 +1879,6 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,unsigned int line = hw >>6 ;unsigned int bit = hw &63 ; -if (!octeon_irq_virq_in_range (virq)) -return -EINVAL ; -/* * Don't map irq if it is reserved for GPIO. * (Line 7 are the GPIO lines.)
Signature · 1 line
1.7.11.7
PATCH v2 2/8 MIPS: Select CONFIG_HANDLE_DOMAIN_IRQ and make it work.
In reply to David DaneyFrom: David Daney <[email protected]>
Per the subject, always select HANDLE_DOMAIN_IRQ, and implement set_irq_regs() so that it actually works.
--- arch/mips/Kconfig | 1 + arch/mips/include/asm/irq_regs.h | 10 ++++++++++ 2 files changed, 11 insertions(+)
arch/mips/Kconfig +1 -0
@@ -62,6 +62,7 @@ config MIPS select HAVE_IRQ_TIME_ACCOUNTING select GENERIC_TIME_VSYSCALL select ARCH_CLOCKSOURCE_DATA + select HANDLE_DOMAIN_IRQ menu "Machine selection"
arch/mips/include/asm/irq_regs.h +10 -0
@@ -18,4 +18,14 @@ static inline struct pt_regs *get_irq_regs(void) return current_thread_info()->regs; } +static inline struct pt_regs *set_irq_regs (struct pt_regs *new_regs) +{ +struct pt_regs *old_regs; + + old_regs =get_irq_regs (); +current_thread_info ()->regs = new_regs; + +return old_regs; +} +#endif /* __ASM_IRQ_REGS_H */
Signature · 1 line
1.7.11.7
PATCH v2 3/8 MIPS: OCTEON: Add register definitions for cn73xx, cnf75xx and cn78xx.
In reply to David DaneyFrom: David Daney <[email protected]>
These new members of the OCTEON III family have some new registers, update some of the definitions for use in follow on patches.
--- arch/mips/include/asm/octeon/cvmx-ciu3-defs.h | 353 ++++++++++++++++++++++ arch/mips/include/asm/octeon/cvmx-fpa-defs.h | 1 + arch/mips/include/asm/octeon/cvmx-mio-defs.h | 410 +++++++++++++++++++++++++- 3 files changed, 748 insertions(+), 16 deletions(-) create mode 100644 arch/mips/include/asm/octeon/cvmx-ciu3-defs.h
arch/mips/include/asm/octeon/cvmx-ciu3-defs.h new file +353 -0
@@ -0,0 +1,353 @@ +/* +* Copyright (c) 2003-2016 Cavium Inc. +* +* This file is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License, Version 2, as +* published by the Free Software Foundation. +* +* This file is distributed in the hope that it will be useful, but +* AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or +* NONINFRINGEMENT. See the GNU General Public License for more +* details. +* +*/ + +#ifndef __CVMX_CIU3_DEFS_H__ +#define __CVMX_CIU3_DEFS_H__ + +#define CVMX_CIU3_FUSE CVMX_ADD_IO_SEG(0x00010100000001A0ull) +#define CVMX_CIU3_BIST CVMX_ADD_IO_SEG(0x00010100000001C0ull) +#define CVMX_CIU3_CONST CVMX_ADD_IO_SEG(0x0001010000000220ull) +#define CVMX_CIU3_CTL CVMX_ADD_IO_SEG(0x00010100000000E0ull) +#define CVMX_CIU3_DESTX_IO_INT (offset) (CVMX_ADD_IO_SEG(0x0001010000210000ull) + ((offset) & 7) * 8) +#define CVMX_CIU3_DESTX_PP_INT (offset) (CVMX_ADD_IO_SEG(0x0001010000200000ull) + ((offset) & 255) * 8) +#define CVMX_CIU3_GSTOP CVMX_ADD_IO_SEG(0x0001010000000140ull) +#define CVMX_CIU3_IDTX_CTL (offset) (CVMX_ADD_IO_SEG(0x0001010000110000ull) + ((offset) & 255) * 8) +#define CVMX_CIU3_IDTX_IO (offset) (CVMX_ADD_IO_SEG(0x0001010000130000ull) + ((offset) & 255) * 8) +#define CVMX_CIU3_IDTX_PPX (offset, block_id) (CVMX_ADD_IO_SEG(0x0001010000120000ull) + ((block_id) & 255) * 0x20ull) +#define CVMX_CIU3_INTR_RAM_ECC_CTL CVMX_ADD_IO_SEG(0x0001010000000260ull) +#define CVMX_CIU3_INTR_RAM_ECC_ST CVMX_ADD_IO_SEG(0x0001010000000280ull) +#define CVMX_CIU3_INTR_READY CVMX_ADD_IO_SEG(0x00010100000002A0ull) +#define CVMX_CIU3_INTR_SLOWDOWN CVMX_ADD_IO_SEG(0x0001010000000240ull) +#define CVMX_CIU3_ISCX_CTL (offset) (CVMX_ADD_IO_SEG(0x0001010080000000ull) + ((offset) & 1048575) * 8) +#define CVMX_CIU3_ISCX_W1C (offset) (CVMX_ADD_IO_SEG(0x0001010090000000ull) + ((offset) & 1048575) * 8) +#define CVMX_CIU3_ISCX_W1S (offset) (CVMX_ADD_IO_SEG(0x00010100A0000000ull) + ((offset) & 1048575) * 8) +#define CVMX_CIU3_NMI CVMX_ADD_IO_SEG(0x0001010000000160ull) +#define CVMX_CIU3_SISCX (offset) (CVMX_ADD_IO_SEG(0x0001010000220000ull) + ((offset) & 255) * 8) +#define CVMX_CIU3_TIMX (offset) (CVMX_ADD_IO_SEG(0x0001010000010000ull) + ((offset) & 15) * 8) + +union cvmx_ciu3_bist { +uint64_t u64; +struct cvmx_ciu3_bist_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_9_63 :55 ; +uint64_t bist :9 ; +#else +uint64_t bist :9 ; +uint64_t reserved_9_63 :55 ; +#endif + } s; +}; + +union cvmx_ciu3_const { +uint64_t u64; +struct cvmx_ciu3_const_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t dests_io :16 ; +uint64_t pintsn :16 ; +uint64_t dests_pp :16 ; +uint64_t idt :16 ; +#else +uint64_t idt :16 ; +uint64_t dests_pp :16 ; +uint64_t pintsn :16 ; +uint64_t dests_io :16 ; +#endif + } s; +}; + +union cvmx_ciu3_ctl { +uint64_t u64; +struct cvmx_ciu3_ctl_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_5_63 :59 ; +uint64_t mcd_sel :2 ; +uint64_t iscmem_le :1 ; +uint64_t seq_dis :1 ; +uint64_t cclk_dis :1 ; +#else +uint64_t cclk_dis :1 ; +uint64_t seq_dis :1 ; +uint64_t iscmem_le :1 ; +uint64_t mcd_sel :2 ; +uint64_t reserved_5_63 :59 ; +#endif + } s; +}; + +union cvmx_ciu3_destx_io_int { +uint64_t u64; +struct cvmx_ciu3_destx_io_int_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_52_63 :12 ; +uint64_t intsn :20 ; +uint64_t reserved_10_31 :22 ; +uint64_t intidt :8 ; +uint64_t newint :1 ; +uint64_t intr :1 ; +#else +uint64_t intr :1 ; +uint64_t newint :1 ; +uint64_t intidt :8 ; +uint64_t reserved_10_31 :22 ; +uint64_t intsn :20 ; +uint64_t reserved_52_63 :12 ; +#endif + } s; +}; + +union cvmx_ciu3_destx_pp_int { +uint64_t u64; +struct cvmx_ciu3_destx_pp_int_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_52_63 :12 ; +uint64_t intsn :20 ; +uint64_t reserved_10_31 :22 ; +uint64_t intidt :8 ; +uint64_t newint :1 ; +uint64_t intr :1 ; +#else +uint64_t intr :1 ; +uint64_t newint :1 ; +uint64_t intidt :8 ; +uint64_t reserved_10_31 :22 ; +uint64_t intsn :20 ; +uint64_t reserved_52_63 :12 ; +#endif + } s; +}; + +union cvmx_ciu3_gstop { +uint64_t u64; +struct cvmx_ciu3_gstop_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_1_63 :63 ; +uint64_t gstop :1 ; +#else +uint64_t gstop :1 ; +uint64_t reserved_1_63 :63 ; +#endif + } s; +}; + +union cvmx_ciu3_idtx_ctl { +uint64_t u64; +struct cvmx_ciu3_idtx_ctl_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_52_63 :12 ; +uint64_t intsn :20 ; +uint64_t reserved_4_31 :28 ; +uint64_t intr :1 ; +uint64_t newint :1 ; +uint64_t ip_num :2 ; +#else +uint64_t ip_num :2 ; +uint64_t newint :1 ; +uint64_t intr :1 ; +uint64_t reserved_4_31 :28 ; +uint64_t intsn :20 ; +uint64_t reserved_52_63 :12 ; +#endif + } s; +}; + +union cvmx_ciu3_idtx_io { +uint64_t u64; +struct cvmx_ciu3_idtx_io_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_5_63 :59 ; +uint64_t io :5 ; +#else +uint64_t io :5 ; +uint64_t reserved_5_63 :59 ; +#endif + } s; +}; + +union cvmx_ciu3_idtx_ppx { +uint64_t u64; +struct cvmx_ciu3_idtx_ppx_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_48_63 :16 ; +uint64_t pp :48 ; +#else +uint64_t pp :48 ; +uint64_t reserved_48_63 :16 ; +#endif + } s; +}; + +union cvmx_ciu3_intr_ram_ecc_ctl { +uint64_t u64; +struct cvmx_ciu3_intr_ram_ecc_ctl_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_3_63 :61 ; +uint64_t flip_synd :2 ; +uint64_t ecc_ena :1 ; +#else +uint64_t ecc_ena :1 ; +uint64_t flip_synd :2 ; +uint64_t reserved_3_63 :61 ; +#endif + } s; +}; + +union cvmx_ciu3_intr_ram_ecc_st { +uint64_t u64; +struct cvmx_ciu3_intr_ram_ecc_st_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_52_63 :12 ; +uint64_t addr :20 ; +uint64_t reserved_6_31 :26 ; +uint64_t sisc_dbe :1 ; +uint64_t sisc_sbe :1 ; +uint64_t idt_dbe :1 ; +uint64_t idt_sbe :1 ; +uint64_t isc_dbe :1 ; +uint64_t isc_sbe :1 ; +#else +uint64_t isc_sbe :1 ; +uint64_t isc_dbe :1 ; +uint64_t idt_sbe :1 ; +uint64_t idt_dbe :1 ; +uint64_t sisc_sbe :1 ; +uint64_t sisc_dbe :1 ; +uint64_t reserved_6_31 :26 ; +uint64_t addr :20 ; +uint64_t reserved_52_63 :12 ; +#endif + } s; +}; + +union cvmx_ciu3_intr_ready { +uint64_t u64; +struct cvmx_ciu3_intr_ready_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_46_63 :18 ; +uint64_t index :14 ; +uint64_t reserved_1_31 :31 ; +uint64_t ready :1 ; +#else +uint64_t ready :1 ; +uint64_t reserved_1_31 :31 ; +uint64_t index :14 ; +uint64_t reserved_46_63 :18 ; +#endif + } s; +}; + +union cvmx_ciu3_intr_slowdown { +uint64_t u64; +struct cvmx_ciu3_intr_slowdown_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_3_63 :61 ; +uint64_t ctl :3 ; +#else +uint64_t ctl :3 ; +uint64_t reserved_3_63 :61 ; +#endif + } s; +}; + +union cvmx_ciu3_iscx_ctl { +uint64_t u64; +struct cvmx_ciu3_iscx_ctl_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_24_63 :40 ; +uint64_t idt :8 ; +uint64_t imp :1 ; +uint64_t reserved_2_14 :13 ; +uint64_t en :1 ; +uint64_t raw :1 ; +#else +uint64_t raw :1 ; +uint64_t en :1 ; +uint64_t reserved_2_14 :13 ; +uint64_t imp :1 ; +uint64_t idt :8 ; +uint64_t reserved_24_63 :40 ; +#endif + } s; +}; + +union cvmx_ciu3_iscx_w1c { +uint64_t u64; +struct cvmx_ciu3_iscx_w1c_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_2_63 :62 ; +uint64_t en :1 ; +uint64_t raw :1 ; +#else +uint64_t raw :1 ; +uint64_t en :1 ; +uint64_t reserved_2_63 :62 ; +#endif + } s; +}; + +union cvmx_ciu3_iscx_w1s { +uint64_t u64; +struct cvmx_ciu3_iscx_w1s_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_2_63 :62 ; +uint64_t en :1 ; +uint64_t raw :1 ; +#else +uint64_t raw :1 ; +uint64_t en :1 ; +uint64_t reserved_2_63 :62 ; +#endif + } s; +}; + +union cvmx_ciu3_nmi { +uint64_t u64; +struct cvmx_ciu3_nmi_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_48_63 :16 ; +uint64_t nmi :48 ; +#else +uint64_t nmi :48 ; +uint64_t reserved_48_63 :16 ; +#endif + } s; +}; + +union cvmx_ciu3_siscx { +uint64_t u64; +struct cvmx_ciu3_siscx_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t en :64 ; +#else +uint64_t en :64 ; +#endif + } s; +}; + +union cvmx_ciu3_timx { +uint64_t u64; +struct cvmx_ciu3_timx_s { +#ifdef __BIG_ENDIAN_BITFIELD +uint64_t reserved_37_63 :27 ; +uint64_t one_shot :1 ; +uint64_t len :36 ; +#else +uint64_t len :36 ; +uint64_t one_shot :1 ; +uint64_t reserved_37_63 :27 ; +#endif + } s; +}; + +#endif
arch/mips/include/asm/octeon/cvmx-fpa-defs.h +1 -0
@@ -66,6 +66,7 @@#define CVMX_FPA_WART_CTL (CVMX_ADD_IO_SEG(0x00011800280000D8ull))#define CVMX_FPA_WART_STATUS (CVMX_ADD_IO_SEG(0x00011800280000E0ull))#define CVMX_FPA_WQE_THRESHOLD (CVMX_ADD_IO_SEG(0x0001180028000468ull)) +#define CVMX_FPA_CLK_COUNT (CVMX_ADD_IO_SEG(0x00012800000000F0ull))union cvmx_fpa_addr_range_error {uint64_t u64;
arch/mips/include/asm/octeon/cvmx-mio-defs.h +394 -16
465 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH v2 4/8 MIPS: OCTEON: Add model checking support for cn73xx, cnf75xx and cn78xx
In reply to David DaneyFrom: David Daney <[email protected]>
Follow on patchs need to be able to distinguish the new models.
--- arch/mips/cavium-octeon/executive/octeon-model.c | 82 +++++++++++++++++++++++- arch/mips/include/asm/octeon/cvmx.h | 27 +++++++- arch/mips/include/asm/octeon/octeon-feature.h | 19 +++++- arch/mips/include/asm/octeon/octeon-model.h | 5 ++ 4 files changed, 125 insertions(+), 8 deletions(-)
arch/mips/cavium-octeon/executive/octeon-model.c +79 -3
@@ -71,11 +71,11 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,uint32_t fuse_data =0 ; fus3.u64 =0 ; -if (!OCTEON_IS_MODEL (OCTEON_CN6XXX )) +if (OCTEON_IS_MODEL (OCTEON_CN3XXX ) ||OCTEON_IS_MODEL (OCTEON_CN5XXX )) fus3.u64 =cvmx_read_csr (CVMX_L2D_FUS3 ); fus_dat2.u64 =cvmx_read_csr (CVMX_MIO_FUS_DAT2 ); fus_dat3.u64 =cvmx_read_csr (CVMX_MIO_FUS_DAT3 ); - num_cores =cvmx_pop (cvmx_read_csr (CVMX_CIU_FUSE )); + num_cores =cvmx_octeon_num_cores ();/* Make sure the non existent devices look disabled */ switch ((chip_id >>8 ) &0xff ) {
@@ -121,6 +121,15 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,* later. */ switch (num_cores) { +case 48 : + core_model ="90" ; +break ; +case 44 : + core_model ="88" ; +break ; +case 40 : + core_model ="85" ; +break ;case 32 : core_model ="80" ;break ;
@@ -297,7 +306,7 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,if (fus_dat3.s.nozip) suffix ="SCP" ; -if (fus_dat3.s.bar2_en) +if (fus_dat3.cn56xx.bar2_en) suffix ="NSPB2" ; }if (fus3.cn56xx.crip_1024k)
@@ -369,6 +378,73 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,else suffix ="AAP" ;break ; +case 0x94 :/* CNF71XX */ + family ="F71" ; +if (fus_dat3.cnf71xx.nozip) + suffix ="SCP" ; +else + suffix ="AAP" ; +break ; +case 0x95 :/* CN78XX */ +if (num_cores ==6 )/* Other core counts match generic */ + core_model ="35" ; +if (OCTEON_IS_MODEL (OCTEON_CN76XX )) + family ="76" ; +else + family ="78" ; +if (fus_dat3.cn78xx.l2c_crip ==2 ) + family ="77" ; +if (fus_dat3.cn78xx.nozip + && fus_dat3.cn78xx.nodfa_dte + && fus_dat3.cn78xx.nohna_dte) { +if (fus_dat3.cn78xx.nozip && + !fus_dat2.cn78xx.raid_en && + fus_dat3.cn78xx.nohna_dte) { + suffix ="CP" ; + }else { + suffix ="SCP" ; + } + }else if (fus_dat2.cn78xx.raid_en ==0 ) + suffix ="HCP" ; +else + suffix ="AAP" ; +break ; +case 0x96 :/* CN70XX */ + family ="70" ; +if (cvmx_read_csr (CVMX_MIO_FUS_PDF ) & (0x1ULL <<32 )) + family ="71" ; +if (fus_dat2.cn70xx.nocrypto) + suffix ="CP" ; +else if (fus_dat3.cn70xx.nodfa_dte) + suffix ="SCP" ; +else + suffix ="AAP" ; +break ; +case 0x97 :/* CN73XX */ +if (num_cores ==6 )/* Other core counts match generic */ + core_model ="35" ; + family ="73" ; +if (fus_dat3.cn73xx.l2c_crip ==2 ) + family ="72" ; +if (fus_dat3.cn73xx.nozip + && fus_dat3.cn73xx.nodfa_dte + && fus_dat3.cn73xx.nohna_dte) { +if (!fus_dat2.cn73xx.raid_en) + suffix ="CP" ; +else + suffix ="SCP" ; + }else + suffix ="AAP" ; +break ; +case 0x98 :/* CN75XX */ + family ="F75" ; +if (fus_dat3.cn78xx.nozip + && fus_dat3.cn78xx.nodfa_dte + && fus_dat3.cn78xx.nohna_dte) + suffix ="SCP" ; +else + suffix ="AAP" ; +break ;default : family ="XX" ; core_model ="XX" ;
arch/mips/include/asm/octeon/cvmx.h +25 -2
@@ -57,6 +57,7 @@ enum cvmx_mips_space {#include <asm/octeon/cvmx-sysinfo.h> #include <asm/octeon/cvmx-ciu-defs.h> +#include <asm/octeon/cvmx-ciu3-defs.h> #include <asm/octeon/cvmx-gpio-defs.h> #include <asm/octeon/cvmx-iob-defs.h> #include <asm/octeon/cvmx-ipd-defs.h>
@@ -332,6 +333,21 @@ static inline unsigned int cvmx_get_core_num(void)return core_num; } +/* Maximum # of bits to define core in node */ +#define CVMX_NODE_NO_SHIFT 7 +#define CVMX_NODE_MASK 0x3 +static inline unsigned int cvmx_get_node_num (void ) +{ +unsigned int core_num =cvmx_get_core_num (); + +return (core_num >>CVMX_NODE_NO_SHIFT ) &CVMX_NODE_MASK ; +} + +static inline unsigned int cvmx_get_local_core_num (void ) +{ +return cvmx_get_core_num () & ((1 <<CVMX_NODE_NO_SHIFT ) -1 ); +} +/** * Returns the number of bits set in the provided value. * Simple wrapper for POP instruction.
@@ -439,8 +455,15 @@ static inline uint64_t cvmx_get_cycle_global(void)/* Return the number of cores available in the chip */ static inline uint32_t cvmx_octeon_num_cores (void ) { -uint32_t ciu_fuse = (uint32_t )cvmx_read_csr (CVMX_CIU_FUSE ) &0xffff ; -return cvmx_pop (ciu_fuse); +u64 ciu_fuse_reg; +u64 ciu_fuse; + +if (OCTEON_IS_OCTEON3 () && !OCTEON_IS_MODEL (OCTEON_CN70XX )) + ciu_fuse_reg =CVMX_CIU3_FUSE ; +else + ciu_fuse_reg =CVMX_CIU_FUSE ; + ciu_fuse =cvmx_read_csr (ciu_fuse_reg); +return cvmx_dpop (ciu_fuse); }#endif /* __CVMX_H__ */
arch/mips/include/asm/octeon/octeon-feature.h +16 -3
@@ -81,6 +81,10 @@ enum octeon_feature {OCTEON_FEATURE_HFA ,OCTEON_FEATURE_DFM ,OCTEON_FEATURE_CIU2 , +OCTEON_FEATURE_CIU3 , +/* Octeon has FPA first seen on 78XX */ +OCTEON_FEATURE_FPA3 , +OCTEON_FEATURE_FAU , OCTEON_MAX_FEATURE };
@@ -110,7 +114,7 @@ static inline int octeon_has_crypto(void)* Returns Non zero if the feature exists. Zero if the feature does not * exist. */ -static inline int octeon_has_feature (enum octeon_feature feature) +static inline bool octeon_has_feature (enum octeon_feature feature) {switch (feature) {case OCTEON_FEATURE_SAAD :
@@ -122,7 +126,7 @@ static inline int octeon_has_feature(enum octeon_feature feature) fus_2.u64 =cvmx_read_csr (CVMX_MIO_FUS_DAT2 );return !fus_2.s.nocrypto && !fus_2.s.nomul && fus_2.s.dorm_crypto; }else { -return 0 ; +return false; }case OCTEON_FEATURE_PCIE :
@@ -189,11 +193,20 @@ static inline int octeon_has_feature(enum octeon_feature feature)case OCTEON_FEATURE_CIU2 :return OCTEON_IS_MODEL (OCTEON_CN68XX ); +case OCTEON_FEATURE_CIU3 : +case OCTEON_FEATURE_FPA3 : +return OCTEON_IS_MODEL (OCTEON_CN78XX ) + ||OCTEON_IS_MODEL (OCTEON_CNF75XX ) + ||OCTEON_IS_MODEL (OCTEON_CN73XX ); +case OCTEON_FEATURE_FAU : +return !(OCTEON_IS_MODEL (OCTEON_CN78XX ) + ||OCTEON_IS_MODEL (OCTEON_CNF75XX ) + ||OCTEON_IS_MODEL (OCTEON_CN73XX ));default : break; } -return 0 ; +return false; }#endif /* __OCTEON_FEATURE_H__ */
arch/mips/include/asm/octeon/octeon-model.h +5 -0
@@ -74,7 +74,12 @@* CN7XXX models with new revision encoding */ +#define OCTEON_CNF75XX_PASS1_0 0x000d9800 +#define OCTEON_CNF75XX (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_REVISION) +#define OCTEON_CNF75XX_PASS1_X (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) +#define OCTEON_CN73XX_PASS1_0 0x000d9700 +#define OCTEON_CN73XX_PASS1_1 0x000d9701#define OCTEON_CN73XX (OCTEON_CN73XX_PASS1_0 | OM_IGNORE_REVISION)#define OCTEON_CN73XX_PASS1_X (OCTEON_CN73XX_PASS1_0 | \ OM_IGNORE_MINOR_REVISION)
Signature · 1 line
1.7.11.7
PATCH v2 5/8 MIPS: OCTEON: Don't attempt to use nonexistent registers on OCTEON III models.
In reply to David DaneyFrom: David Daney <[email protected]>
Attempts to read the nonexistent registers results in bus errors. Either use registers that exist, or don't do the access as appropriate.
--- arch/mips/cavium-octeon/csrc-octeon.c | 13 +++++++++---- arch/mips/cavium-octeon/setup.c | 34 +++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 17 deletions(-)
arch/mips/cavium-octeon/csrc-octeon.c +9 -4
@@ -19,6 +19,7 @@#include <asm/octeon/cvmx-ipd-defs.h> #include <asm/octeon/cvmx-mio-defs.h> #include <asm/octeon/cvmx-rst-defs.h> +#include <asm/octeon/cvmx-fpa-defs.h> static u64 f;static u64 rdiv;
@@ -65,9 +66,13 @@ void __init octeon_setup_delays(void)*/ void octeon_init_cvmcount (void ) { +u64 clk_reg;unsigned long flags;unsigned loops =2 ; + clk_reg =octeon_has_feature (OCTEON_FEATURE_FPA3 ) ? +CVMX_FPA_CLK_COUNT :CVMX_IPD_CLK_COUNT ; +/* Clobber loops so GCC will not unroll the following while loop. */ asm("" :"+r" (loops));
@@ -77,18 +82,18 @@ void octeon_init_cvmcount(void)* which should give more deterministic timing. */ while (loops--) { -u64 ipd_clk_count =cvmx_read_csr (CVMX_IPD_CLK_COUNT ); +u64 clk_count =cvmx_read_csr (clk_reg);if (rdiv !=0 ) { - ipd_clk_count *= rdiv; + clk_count *= rdiv;if (f !=0 ) { asm("dmultu\t%[cnt],%[f]\n\t" "mfhi\t%[cnt]" - : [cnt]"+r" (ipd_clk_count) + : [cnt]"+r" (clk_count) : [f]"r" (f) :"hi" ,"lo" ); } } -write_c0_cvmcount (ipd_clk_count); +write_c0_cvmcount (clk_count); }local_irq_restore (flags); }
arch/mips/cavium-octeon/setup.c +21 -13
@@ -492,8 +492,6 @@ const char *get_system_type(void)void octeon_user_io_init (void ) {union octeon_cvmemctl cvmmemctl; -union cvmx_iob_fau_timeout fau_timeout; -union cvmx_pow_nw_tim nm_tim;/* Get the current settings for CP0_CVMMEMCTL_REG */ cvmmemctl.u64 =read_c0_cvmmemctl ();
@@ -595,17 +593,27 @@ void octeon_user_io_init(void)CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE , CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128); -/* Set a default for the hardware timeouts */ - fau_timeout.u64 =0 ; - fau_timeout.s.tout_val =0xfff ; -/* Disable tagwait FAU timeout */ - fau_timeout.s.tout_enb =0 ; -cvmx_write_csr (CVMX_IOB_FAU_TIMEOUT , fau_timeout.u64); - - nm_tim.u64 =0 ; -/* 4096 cycles */ - nm_tim.s.nw_tim =3 ; -cvmx_write_csr (CVMX_POW_NW_TIM , nm_tim.u64); +if (octeon_has_feature (OCTEON_FEATURE_FAU )) { +union cvmx_iob_fau_timeout fau_timeout; + +/* Set a default for the hardware timeouts */ + fau_timeout.u64 =0 ; + fau_timeout.s.tout_val =0xfff ; +/* Disable tagwait FAU timeout */ + fau_timeout.s.tout_enb =0 ; +cvmx_write_csr (CVMX_IOB_FAU_TIMEOUT , fau_timeout.u64); + } + +if ((!OCTEON_IS_MODEL (OCTEON_CN68XX ) && + !OCTEON_IS_MODEL (OCTEON_CN7XXX )) || +OCTEON_IS_MODEL (OCTEON_CN70XX )) { +union cvmx_pow_nw_tim nm_tim; + + nm_tim.u64 =0 ; +/* 4096 cycles */ + nm_tim.s.nw_tim =3 ; +cvmx_write_csr (CVMX_POW_NW_TIM , nm_tim.u64); + }write_octeon_c0_icacheerr (0 );write_c0_derraddr1 (0 );
Signature · 1 line
1.7.11.7
PATCH v2 6/8 MIPS: OCTEON: Add support for OCTEON III interrupt controller.
In reply to David DaneyFrom: David Daney <david.daney-YGCgFSpz5w/[email protected]>
Add irq_chip support for both IPI and "normal" interrupts of the CIU3 controller. Document the device tree binding for the CIU3.
Some functions are non-static as they will be used by follow-on support for MSI-X.
--- .../devicetree/bindings/mips/cavium/ciu3.txt | 27 + arch/mips/cavium-octeon/octeon-irq.c | 650 ++++++++++++++++++++- arch/mips/include/asm/octeon/octeon.h | 19 + 3 files changed, 695 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/mips/cavium/ciu3.txt
Documentation/devicetree/bindings/mips/cavium/ciu3.txt new file +27 -0
@@ -0,0 +1,27 @@ +* Central Interrupt Unit v3 + +Properties: +- compatible: "cavium,octeon-7890-ciu3" + + Compatibility with 78XX and 73XX SOCs. + +- interrupt-controller: This is an interrupt controller. + +- reg: The base address of the CIU's register bank. + +- #interrupt-cells: Must be <2>. The first cell is source number. + The second cell indicates the triggering semantics, and may have a + value of either 4 for level semantics, or 1 for edge semantics. + +Example: + interrupt-controller@1010000000000 { + compatible = "cavium,octeon-7890-ciu3"; + interrupt-controller; + /* Interrupts are specified by two parts: + * 1) Source number (20 significant bits) + * 2) Trigger type: (4 == level, 1 == edge) + */ + #address-cells = <0>; + #interrupt-cells = <2>; + reg = <0x10100 0x00000000 0x0 0xb0000000>; + };
arch/mips/cavium-octeon/octeon-irq.c +649 -1
696 lines not on this page · raw message
arch/mips/include/asm/octeon/octeon.h +19 -0
@@ -299,6 +299,25 @@ static inline void octeon_npi_write32(uint64_t address, uint32_t val)cvmx_read64_uint32 (address ^4 ); } +struct irq_domain ; +struct device_node ; +struct irq_data ; +struct irq_chip ; +void octeon_ciu3_mbox_send (int cpu,unsigned int mbox); +int octeon_irq_ciu3_xlat (struct irq_domain *d, +struct device_node *node, +const u32 *intspec, +unsigned int intsize, +unsigned long *out_hwirq, +unsigned int *out_type); +void octeon_irq_ciu3_enable (struct irq_data *data); +void octeon_irq_ciu3_disable (struct irq_data *data); +void octeon_irq_ciu3_ack (struct irq_data *data); +void octeon_irq_ciu3_mask (struct irq_data *data); +void octeon_irq_ciu3_mask_ack (struct irq_data *data); +int octeon_irq_ciu3_mapx (struct irq_domain *d,unsigned int virq, +irq_hw_number_t hw,struct irq_chip *chip); +/* Octeon multiplier save/restore routines from octeon_switch.S */ void octeon_mult_save (void );void octeon_mult_restore (void );
Signature · 6 lines
1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 7/8 MIPS: OCTEON: Add SMP support for OCTEON cn78xx et al.
In reply to David DaneyFrom: David Daney <[email protected]>
OCTEON chips with the CIU3 interrupt controller use a different IPI mechanism that previous models.
Add plat_smp_ops for the cn78xx and probing code to choose between the two types of ops.
--- arch/mips/cavium-octeon/setup.c | 4 +- arch/mips/cavium-octeon/smp.c | 145 +++++++++++++++++++++++++++++++--- arch/mips/include/asm/octeon/octeon.h | 6 ++ 3 files changed, 139 insertions(+), 16 deletions(-)
arch/mips/cavium-octeon/setup.c +1 -3
@@ -43,8 +43,6 @@#include <asm/octeon/cvmx-mio-defs.h> #include <asm/octeon/cvmx-rst-defs.h> -extern struct plat_smp_ops octeon_smp_ops; -#ifdef CONFIG_PCI extern void pci_console_init (const char *arg);#endif
@@ -888,7 +886,7 @@ void __init prom_init(void)#endif octeon_user_io_init (); -register_smp_ops (&octeon_smp_ops); +octeon_setup_smp (); }/* Exclude a single page from the regions obtained in plat_mem_setup. */
arch/mips/cavium-octeon/smp.c +132 -13
170 lines not on this page · raw message
arch/mips/include/asm/octeon/octeon.h +6 -0
@@ -299,6 +299,12 @@ static inline void octeon_npi_write32(uint64_t address, uint32_t val)cvmx_read64_uint32 (address ^4 ); } +#ifdef CONFIG_SMP +void octeon_setup_smp (void ); +#else +static inline void octeon_setup_smp (void ) {} +#endif +struct irq_domain ;struct device_node ;struct irq_data ;
Signature · 1 line
1.7.11.7
PATCH v2 8/8 MIPS: OCTEON: Simplify code in octeon_irq_ciu_gpio_set_type()
In reply to David DaneyFrom: David Daney <[email protected]>
Use the trigger type passed in to the function instead of reading it back out of the irq_data.
--- arch/mips/cavium-octeon/octeon-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/cavium-octeon/octeon-irq.c +1 -1
@@ -713,7 +713,7 @@ static int octeon_irq_ciu_gpio_set_type(struct irq_data *data, unsigned int t)irqd_set_trigger_type (data, t);octeon_irq_gpio_setup (data); -if (irqd_get_trigger_type (data) &IRQ_TYPE_EDGE_BOTH ) +if (t &IRQ_TYPE_EDGE_BOTH )irq_set_handler_locked (data, handle_edge_irq);else irq_set_handler_locked (data, handle_level_irq);
Signature · 1 line
1.7.11.7