Linux-Devicetree Archive mirror
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: "Hauke Mehrtens" <hauke@hauke-m.de>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Christian Marangi" <ansuelsmth@gmail.com>,
	"Álvaro Fernández Rojas" <noltari@gmail.com>,
	linux-mips@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Daniel González Cabanelas" <dgcbueu@gmail.com>
Subject: [PATCH v2 0/5] mips: bmips: improve handling of RAC and CBR addr
Date: Fri,  3 May 2024 23:20:56 +0200	[thread overview]
Message-ID: <20240503212139.5811-1-ansuelsmth@gmail.com> (raw)

Hi,

this simple series improve handling of RAC and CBR address and try to
upstream these simple patch we have in OpenWrt for a while.

The first patch fix a straight kernel panic where some Bootloader might
enable RAC but misconfigure the CBR address. The current logic only
check if RAC is enabled but doesn't verify if the CBR address is usable.

The DMA sync function cause a kernel panic for invalid write. (as CBR is
0 or something like 0xa)

The second is preparation for making the CBR address configurable in DT.
Since this address doesn't change, we can cache it and reference it with
a local variable instead of calling the register to access the value.

The 4th patch make it configurable with 2 DT property, one to actually
set the reg and the other to force set it.

The first property is used when CBR is set to 0. The second property is
to force it if the Bootloader sets it to something wrong.

If the CBR value is not 0 and is not forced with the second property a
WARN is printed and the DT value is ignored.

The 5th patch enable RAC on BMIPS4350 and the 5th patch is a micro
optimization to skip more call on DMA sync to save as resource as
possible on low spec devices. (since DMA sync is called many times for
the Ethernet Switch and we can reference the bool instead of checking
the CPU type everytime)

These has been tested on BCM6358 (HG556a) and BCM6368 (VH4032N) and
reported correct functionality.

Changes v2:
- Prefix brcm vendor in the added property
- Drop last patch (cpu switch from DMA sync)
- Validate CBR addr from DT to be outside DRAM
- Reduce indentation in DT CBR check
- Reduce delta and use local variable for CBR where possible
- Fix and improve typo and spelling mistake
- Use 0xf instead of 0xa for BCM6358 RAC enable

Christian Marangi (4):
  mips: bmips: BCM6358: make sure CBR is correctly set
  mips: bmips: rework and cache CBR addr handling
  dt-bindings: mips: brcm: Document brcm,bmips-cbr-reg property
  mips: bmips: setup: make CBR address configurable

Daniel González Cabanelas (1):
  mips: bmips: enable RAC on BMIPS4350

 .../devicetree/bindings/mips/brcm/soc.yaml    | 32 ++++++++++++++
 arch/mips/bmips/dma.c                         |  2 +-
 arch/mips/bmips/setup.c                       | 42 ++++++++++++++++++-
 arch/mips/include/asm/bmips.h                 |  1 +
 arch/mips/kernel/smp-bmips.c                  | 21 +++++++++-
 5 files changed, 93 insertions(+), 5 deletions(-)

-- 
2.43.0


             reply	other threads:[~2024-05-03 21:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03 21:20 Christian Marangi [this message]
2024-05-03 21:20 ` [PATCH v2 1/5] mips: bmips: BCM6358: make sure CBR is correctly set Christian Marangi
2024-05-03 21:23   ` Florian Fainelli
2024-05-03 21:20 ` [PATCH v2 2/5] mips: bmips: rework and cache CBR addr handling Christian Marangi
2024-05-03 21:23   ` Florian Fainelli
2024-05-08 23:13   ` kernel test robot
2024-05-09 11:15     ` Christian Marangi
2024-05-03 21:20 ` [PATCH v2 3/5] dt-bindings: mips: brcm: Document brcm,bmips-cbr-reg property Christian Marangi
2024-05-03 22:16   ` Rob Herring (Arm)
2024-05-07 13:07   ` Rob Herring
2024-05-08 16:44     ` Florian Fainelli
2024-05-03 21:21 ` [PATCH v2 4/5] mips: bmips: setup: make CBR address configurable Christian Marangi
2024-05-03 21:21 ` [PATCH v2 5/5] mips: bmips: enable RAC on BMIPS4350 Christian Marangi
2024-05-03 21:33   ` Florian Fainelli

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=20240503212139.5811-1-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dgcbueu@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hauke@hauke-m.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=noltari@gmail.com \
    --cc=robh@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=zajec5@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).