All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@csgraf.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 04/22] thunderx: add thunderx register definitions and misc functions
Date: Sun, 24 Feb 2019 08:42:30 -0800	[thread overview]
Message-ID: <74c414cb-2a16-12c4-693d-b09b99128f1f@csgraf.de> (raw)
In-Reply-To: <20190222180319.32221-5-tharvey@gateworks.com>



On 22.02.19 19:03, Tim Harvey wrote:
> Add Cavium Thunderx common registers, structures, and helper functions
> 
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  arch/arm/include/asm/arch-thunderx/thunderx.h | 300 ++++++++++++++++++
>  arch/arm/mach-thunderx/Makefile               |   2 +-
>  arch/arm/mach-thunderx/misc.c                 |  33 ++
>  3 files changed, 334 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/include/asm/arch-thunderx/thunderx.h
>  create mode 100644 arch/arm/mach-thunderx/misc.c
> 
> diff --git a/arch/arm/include/asm/arch-thunderx/thunderx.h b/arch/arm/include/asm/arch-thunderx/thunderx.h
> new file mode 100644
> index 0000000000..58f36c6cdc
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-thunderx/thunderx.h
> @@ -0,0 +1,300 @@
> +// SPDX-License-Identifier:	GPL-2.0+
> +/*
> + * Copyright (C) 2018, Cavium Inc.
> + */
> +#ifndef __THUNDERX_H__
> +#define __THUNDERX_H__
> +
> +/* Registers */
> +#define CAVM_RST_BOOT		0x87e006001600ll
> +#define CAVM_MIO_FUS_DAT2	0x87e003001410ll
> +#define CAVM_XCVX_RESET		0x87e0db000000ll
> +
> +/*
> + * Flag bits in top byte. The top byte of MIDR_EL1 is defined
> + * as ox43, the Cavium implementer code. In this number, bits
> + * 7,5,4 are defiend as zero. We use these bits to signal
> + * that revision numbers should be ignored. It isn't ideal
> + * that these are in the middle of an already defined field,
> + * but this keeps the model numbers as 32 bits
> + */
> +#define __OM_IGNORE_REVISION		0x80000000
> +#define __OM_IGNORE_MINOR_REVISION	0x20000000
> +#define __OM_IGNORE_MODEL		0x10000000
> +
> +#define CAVIUM_CN88XX_PASS1_0	0x430f0a10
> +#define CAVIUM_CN88XX_PASS1_1	0x430f0a11
> +#define CAVIUM_CN88XX_PASS2_0	0x431f0a10
> +#define CAVIUM_CN88XX_PASS2_1	0x431f0a11
> +#define CAVIUM_CN88XX_PASS2_2	0x431f0a12
> +#define CAVIUM_CN88XX		(CAVIUM_CN88XX_PASS1_0 | __OM_IGNORE_REVISION)
> +#define CAVIUM_CN88XX_PASS1_X	(CAVIUM_CN88XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
> +#define CAVIUM_CN88XX_PASS2_X	(CAVIUM_CN88XX_PASS2_0 | __OM_IGNORE_MINOR_REVISION)
> +
> +#define CAVIUM_CN83XX_PASS1_0	0x430f0a30
> +#define CAVIUM_CN83XX		(CAVIUM_CN83XX_PASS1_0 | __OM_IGNORE_REVISION)
> +#define CAVIUM_CN83XX_PASS1_X	(CAVIUM_CN83XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
> +
> +#define CAVIUM_CN81XX_PASS1_0	0x430f0a20
> +#define CAVIUM_CN81XX		(CAVIUM_CN81XX_PASS1_0 | __OM_IGNORE_REVISION)
> +#define CAVIUM_CN81XX_PASS1_X	(CAVIUM_CN81XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
> +
> +#define CAVIUM_CN98XX_PASS1_0	0x430f0b10
> +#define CAVIUM_CN98XX		(CAVIUM_CN98XX_PASS1_0 | __OM_IGNORE_REVISION)
> +#define CAVIUM_CN98XX_PASS1_X	(CAVIUM_CN98XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
> +
> +/* These match entire families of chips */
> +#define CAVIUM_CN8XXX		(CAVIUM_CN88XX_PASS1_0 | __OM_IGNORE_MODEL)
> +#define CAVIUM_CN9XXX		(CAVIUM_CN98XX_PASS1_0 | __OM_IGNORE_MODEL)
> +
> +static inline uint64_t cavium_get_model(void)
> +{
> +	uint64_t result;
> +
> +	__asm ("mrs %[rd],MIDR_EL1" : [rd] "=r" (result));
> +
> +	return result;
> +}
> +
> +/**
> + * Return non-zero if the chip matched the passed model.
> + *
> + * @param arg_model One of the CAVIUM_* constants for chip models and passes
> + * @return Non-zero if match
> + */
> +static inline int CAVIUM_IS_MODEL(uint32_t arg_model)

Usually upper case function names are reserved for #define'd ones. Could
this be lower case?


Alex

  reply	other threads:[~2019-02-24 16:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 18:02 [U-Boot] [RFC 00/22] Add support for Cavium Octeon-TX CN80XX/CN81XX Tim Harvey
2019-02-22 18:02 ` [U-Boot] [RFC 01/22] arm: introduce ARCH_THUNDERX Tim Harvey
2019-02-24 16:08   ` Alexander Graf
2019-02-24 16:13   ` Alexander Graf
2019-02-22 18:02 ` [U-Boot] [RFC 02/22] arm: add thunderx_81xx Tim Harvey
2019-02-24 16:35   ` Alexander Graf
2019-02-22 18:03 ` [U-Boot] [RFC 03/22] thunderx: add FDT support Tim Harvey
2019-02-24 16:39   ` Alexander Graf
2019-02-22 18:03 ` [U-Boot] [RFC 04/22] thunderx: add thunderx register definitions and misc functions Tim Harvey
2019-02-24 16:42   ` Alexander Graf [this message]
2019-02-22 18:03 ` [U-Boot] [RFC 05/22] thunderx: move DRAM prints to debug Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 06/22] dm: pci: add PCI SR-IOV EA support Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 07/22] fdt: add fdtdec_get_pci_bus_range Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 08/22] pci: add thunderx pci/ecam driver Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 09/22] pci: fix pce enumeration on thunderx Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 10/22] arm: include 64bit io accessors Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 11/22] gpio: add thunderx gpio driver Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 12/22] i2c: add thunderx I2C driver Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 13/22] spi: add thunderx SPI driver Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 14/22] xhci: add support for cavium thunderx XHCI Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 15/22] thunderx_81xx: add support for XHCI Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 16/22] thunderx_81xx: enable usb mass storage and usb ethernet Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 17/22] ahci: support 64bit systems Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 18/22] ahci: set n_ports from host caps Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 19/22] ahci: add support for ThunderX AHCI Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 20/22] thunderx_81xx: add AHCI support Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 21/22] net: add thunderx vnic drivers Tim Harvey
2019-02-22 18:03 ` [U-Boot] [RFC 22/22] pci: auto probe thunderx NIC devices Tim Harvey

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=74c414cb-2a16-12c4-693d-b09b99128f1f@csgraf.de \
    --to=agraf@csgraf.de \
    --cc=u-boot@lists.denx.de \
    /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.