Commit Graph

130 Commits

Author SHA1 Message Date
Nam Cao
bafb290131 irqchip/armada-370-xp: Switch to msi_create_parent_irq_domain()
Move away from the legacy MSI domain setup, switch to use
msi_create_parent_irq_domain().

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/976892e3ce64fcf52387833abee08ddfa47d2a82.1750860131.git.namcao@linutronix.de
2025-07-03 15:49:25 +02:00
Jiri Slaby (SUSE)
31b3ad4002 irqchip/armada-370-xp: Switch to irq_find_mapping()
irq_linear_revmap() is deprecated, so remove all its uses and supersede
them by an identical call to irq_find_mapping().

[ tglx: Fix up subject prefix ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250319092951.37667-47-jirislaby@kernel.org
2025-05-16 21:06:12 +02:00
Jiri Slaby (SUSE)
affdc0d1bd irqchip: Switch to irq_domain_create_*()
irq_domain_add_*() interfaces are going away as being obsolete now.
Switch to the preferred irq_domain_create_*() ones. Those differ in the
node parameter: They take more generic struct fwnode_handle instead of
struct device_node. Therefore, of_fwnode_handle() is added around the
original parameter.

Note some of the users can likely use dev->fwnode directly instead of
indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not
guaranteed to be set for all, so this has to be investigated on case to
case basis (by people who can actually test with the HW).

[ tglx: Fix up subject prefix ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Link: https://lore.kernel.org/all/20250319092951.37667-22-jirislaby@kernel.org
2025-05-16 21:06:09 +02:00
Jiri Slaby (SUSE)
87228532e7 irqchip: Switch to of_fwnode_handle()
of_node_to_fwnode() is irqdomain's reimplementation of the "officially"
defined of_fwnode_handle(). The former is in the process of being
removed, so use the latter instead.

[ tglx: Fix up subject prefix ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Antonio Borneo <antonio.borneo@foss.st.com>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Acked-by: Herve Codina <herve.codina@bootlin.com> # irq-lan966x-oic
Link: https://lore.kernel.org/all/20250319092951.37667-7-jirislaby@kernel.org
2025-05-16 21:06:07 +02:00
Jiri Slaby (SUSE)
0a27ea384c irqdomain: Rename irq_get_default_host() to irq_get_default_domain()
Naming interrupt domains host is confusing at best and the irqdomain code
uses both domain and host inconsistently.

Therefore rename irq_get_default_host() to irq_get_default_domain().

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250319092951.37667-4-jirislaby@kernel.org
2025-04-04 16:39:10 +02:00
Jiri Slaby (SUSE)
825dfab23b irqdomain: Rename irq_set_default_host() to irq_set_default_domain()
Naming interrupt domains host is confusing at best and the irqdomain code
uses both domain and host inconsistently.

Therefore rename irq_set_default_host() to irq_set_default_domain().

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250319092951.37667-3-jirislaby@kernel.org
2025-04-04 16:39:10 +02:00
Marek Behún
b77c6a73e1 irqchip/armada-370-xp: Use mpic_is_ipi_available() in mpic_of_init()
mpic_of_init() contains the last case where the open coded IPI support
condition needs to be replaced with mpic_is_ipi_available() to keep the
code consistent.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:01 +02:00
Marek Behún
d6ca3f4402 irqchip/armada-370-xp: Allow mapping only per-CPU interrupts
On platforms where MPIC is not the top-level interrupt controller the
driver currently only supports handling of the per-CPU interrupts (the
first 29 interrupts). This is obvious from the code of
mpic_handle_cascade_irq(), which reads only one cause register.

Bound the number of available interrupts in the interrupt domain to 29 for
these platforms.

The corresponding device-trees refer only to per-CPU interrupts via MPIC,
the other interrupts are referred to via GIC.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:01 +02:00
Marek Behún
4042a965a5 irqchip/armada-370-xp: Iterate only valid bits of the per-CPU interrupt cause register
Use MPIC_PER_CPU_IRQS_NR (29) bound instead of BITS_PER_LONG (32) when
iterating the bits of the per-CPU interrupt cause register, since there
are only 29 per-CPU interrupts. The top 3 bits are always zero anyway.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:01 +02:00
Marek Behún
2793f68749 irqchip/armada-370-xp: Fix reenabling last per-CPU interrupt
The number of per-CPU interrupts is 29 (0 to 28). This is described by
the constant MPIC_MAX_PER_CPU_IRQS, set to 28 (the maximum per-CPU
interrupt).

Commit 0fa4ce746d ("irqchip/armada-370-xp: Re-enable per-CPU
interrupts at resume time") used the constant incorrectly in the
for-loop, it used the operator < instead of <=, causing it to iterate
only the first 28 interrupts (0 to 27), ignoring the last, 28th,
per-CPU interrupt.

To avoid this kind of confusions, fix this issue by renaming the constant
to MPIC_PER_CPU_IRQS_NR and set it to 29, the number of per-CPU IRQs.
Update its use in mpic_is_percpu_irq() accordingly.

Fixes: 0fa4ce746d ("irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time")
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable+noautosel@kernel.org> # The 29th interrupt is not used in any device-tree
2024-08-08 17:15:01 +02:00
Marek Behún
6abd809a54 irqchip/armada-370-xp: Dynamically allocate the driver private structure
Dynamically allocate the driver private structure. This concludes the
conversion of this driver to modern style.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:01 +02:00
Marek Behún
77eef29b64 irqchip/armada-370-xp: Pass around the driver private structure
In continuation of converting the driver to modern style, drop the
global pointer to the driver private structure and instead pass it
around the functions and callbacks, wherever possible. (There are 3
cases where it is not possible: mpic_cascaded_starting_cpu() and the
syscore operations mpic_suspend() and mpic_resume()).

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:00 +02:00
Marek Behún
ee5d09cf14 irqchip/armada-370-xp: Put MSI doorbell limits into the mpic structure
Put the MSI doorbell limits msi_doorbell_start, msi_doorbell_size and
msi_doorbell_mask into the driver private structure and get rid of the
corresponding functions.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:00 +02:00
Marek Behún
68fe2c5985 irqchip/armada-370-xp: Put static variables into driver private structure
In preparation for converting the driver to modern style put all the
interrupt controller private static variables into driver private
structure.

Access to these variables changes as:
  main_int_base		mpic->base
  per_cpu_int_base	mpic->per_cpu
  mpic_domain		mpic->domain
  parent_irq		mpic->parent_irq
  ...

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:00 +02:00
Marek Behún
a4d4d4a642 irqchip/armada-370-xp: Put __init attribute after return type in mpic_ipi_init()
For consistency with the rest of the driver, put the __init attribute
after the return type of the mpic_ipi_init() function.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:00 +02:00
Marek Behún
37e130c224 irqchip/armada-370-xp: Add the __init attribute to mpic_msi_init()
Add the __init attribute to the mpic_msi_init() function. It is only
called from the device initializer, and so can be dropped after boot is
complete.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:00 +02:00
Marek Behún
0dbf9b6025 irqchip/armada-370-xp: Drop msi_doorbell_end()
Drop the msi_doorbell_end() function and related constants, it is not
used anymore.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:00 +02:00
Marek Behún
3431392d5e irqchip/armada-370-xp: Drop IPI_DOORBELL_START and rename IPI_DOORBELL_END
Drop IPI_DOORBELL_START since it is not used and rename IPI_DOORBELL_END
to IPI_DOORBELL_NR.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2024-08-08 17:15:00 +02:00
Marek Behún
1d07c9a3e7 irqchip/armada-370-xp: Print error and return error code on initialization failure
Print error and return error code on main / IPI / MSI domain
initialization failure. Use WARN_ON() instead of BUG_ON().

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-11-kabel@kernel.org
2024-07-30 13:35:49 +02:00
Marek Behún
654caa9db6 irqchip/armada-370-xp: Refactor initial memory regions mapping
Refactor the initial memory regions mapping:
- put into its own function
- return error numbers on failure
- use WARN_ON() instead of BUG_ON()

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-10-kabel@kernel.org
2024-07-30 13:35:49 +02:00
Marek Behún
625f0582f0 irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
For consistency across the driver, use the u32 type instead of unsigned
long for holding register values and return value of cpu_logical_map().

One exception is when the variable is referenced for passing into
for_each_set_bit(), in which case it has to be unsigned long.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-9-kabel@kernel.org
2024-07-30 13:35:48 +02:00
Marek Behún
ac0ae59db6 irqchip/armada-370-xp: Rename variable for consistency
Rename the variable holding the cause register to "cause" in
mpic_handle_cascade_irq().

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-8-kabel@kernel.org
2024-07-30 13:35:48 +02:00
Marek Behún
081b64cc87 irqchip/armada-370-xp: Drop redundant continue
Drop redundant continue from mpic_handle_irq().

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-7-kabel@kernel.org
2024-07-30 13:35:48 +02:00
Marek Behún
15a50eeaad irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
Refactor the mpic_reenable_percpu() and mpic_resume() functions to make
them a little bit simpler.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-5-kabel@kernel.org
2024-07-30 13:35:48 +02:00
Marek Behún
0d4b1fcd37 irqchip/armada-370-xp: Use consistent name for struct irq_data variables
Always use variable name "d" for struct irq_data *, for consistency.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-4-kabel@kernel.org
2024-07-30 13:35:48 +02:00
Marek Behún
a5d32b7475 irqchip/armada-370-xp: Use consistent types when iterating interrupts
When iterating, use either the irq_hw_number_t type or the unsigned int
type for the iterator variable, depending on whether the variable
represents HW IRQ number or whether it is added to a IRQ number.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-3-kabel@kernel.org
2024-07-30 13:35:48 +02:00
Marek Behún
66fc31034f irqchip/armada-370-xp: Use consistent variable names for hwirqs
Use consistent variable names for hwirqs: when iterating, use "i",
otherwise use "hwirq".

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-2-kabel@kernel.org
2024-07-30 13:35:48 +02:00
Marek Behún
baf01c726b irqchip/armada-370-xp: Refactor handling IPI interrupts
Refactor the handling of IPI interrupts
- put into own function mpic_handle_ipi_irq(), similar to
  mpic_handle_msi_irq()
- rename the variable holding the doorbell cause register to "cause"
- retype and rename the variable holding the IPI HW IRQ number to
  "irq_hw_number_t i"

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-11-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
63697bc719 irqchip/armada-370-xp: Refactor mpic_handle_msi_irq() code
Refactor the mpic_handle_msi_irq() function to make it simpler:
- drop the function arguments, they are not needed
- rename the variable holding the doorbell cause register to "cause"
- rename the iterating variable to "i"
- use for_each_set_bit() (requires retyping "cause" to unsigned long)

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-10-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
92128c74e4 irqchip/armada-370-xp: Use FIELD_GET() and named register constant
Use FIELD_GET() and named register mask constant when reading the number
of supported interrupts / current interrupt.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-9-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
5ecafc9a64 irqchip/armada-370-xp: Don't read number of supported interrupts multiple times
Use mpic_domain::hwirq_max at runtime instead of reading the same value
over and over from the MPIC_INT_CONTROL register.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-8-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
f63f54a2b8 irqchip/armada-370-xp: Change symbol prefixes to mpic
Change symbol prefixes from armada_370_xp_ or others to mpic_.

The rationale is that it is shorter and more generic (this controller
is called MPIC and is also used on Armada 38x and 39x).

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-7-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
5302e767eb irqchip/armada-370-xp: Improve indentation
Add some blank lines and other indentation improvements.

Checkpatch now stops complaining.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-6-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
0381be072f irqchip/armada-370-xp: Simplify ipi_resume() code
Refactor the ipi_resume() function to drop one indentation level.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-5-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
88d49ee30c irqchip/armada-370-xp: Use !virq instead of virq == 0 in condition
Use !virq instead of virq == 0 when checking for availability of the
virq.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-4-kabel@kernel.org
2024-07-30 13:35:47 +02:00
Marek Behún
e4cd7c553a irqchip/armada-370-xp: Use unsigned int type for virqs
The return type of irq_find_mapping() and irq_linear_revmap() is
unsigned int. Use the unsigned int type for the variables storing the
return value.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-3-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
55689986d7 irqchip/armada-370-xp: Rename variable for consistency
Rename the irq variable to virq in the ipi_resume() function for
consistency with the rest of the code.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240711115748.30268-2-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
644799f920 irqchip/armada-370-xp: Declare iterators in for loop
Where possible, declare iterators in for cycle. This is possible since
kernel uses -std=gnu11.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/all/20240708151801.11592-11-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
045c4bb864 irqchip/armada-370-xp: Change to SPDX license identifier
Change the license identifier to SPDX style.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/all/20240708151801.11592-10-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
ccef3a991b irqchip/armada-370-xp: Simplify is_percpu_irq() code
Simplify the code in the is_percpu_irq() function. Instead of
  if (condition)
    return true;
  return false;
simply return condition.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240708151801.11592-9-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
0cbbf7c15d irqchip/armada-370-xp: Use correct type for cpu variable
Use unsigned int instead of int for variable storing the cpu number.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/all/20240708151801.11592-8-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
e812dd60b6 irqchip/armada-370-xp: Change register constants prefix to MPIC_
Change the long ARMADA_370_XP_ prefix in register constants (ARMADA_375_
in one case) to MPIC_. The rationale is that it is shorter and more
generic (this controller is called MPIC and is also used on Armada 38x
and 39x).

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/all/20240708151801.11592-7-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
9236717b97 irqchip/armada-370-xp: Cosmetic fix parentheses in register constant definitions
Drop parentheses where not needed and add them where it makes sense in
register constant definitions.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240708151801.11592-6-kabel@kernel.org
2024-07-30 13:35:46 +02:00
Marek Behún
2613b94d2d irqchip/armada-370-xp: Use BIT() and GENMASK() macros
Use the BIT() and GENMASK() macros where appropriate.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/all/20240708151801.11592-5-kabel@kernel.org
2024-07-30 13:35:45 +02:00
Marek Behún
f04ef167b3 irqchip/armada-370-xp: Change spaces to tabs
Change spaces to tabs in register constants definitions.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240708151801.11592-4-kabel@kernel.org
2024-07-30 13:35:45 +02:00
Marek Behún
9fa3e59a00 irqchip/armada-370-xp: Change register constant suffix from _MSK to _MASK
There is one occurrence of suffix _MSK in register constants, others
have _MASK instead. Change the one to _MASK for consistency.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240708151801.11592-3-kabel@kernel.org
2024-07-30 13:35:45 +02:00
Marek Behún
5e389e9868 irqchip/armada-370-xp: Drop _OFFS suffix from some register constants
Some register constants have the _OFFS suffix and some do not. Drop it
to be more consistent.

Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/all/20240708151801.11592-2-kabel@kernel.org
2024-07-30 13:35:45 +02:00
Pali Rohár
986b6ad0c4 irqchip/armada-370-xp: Add support for 32 MSI interrupts on non-IPI platforms
The doorbell interrupts have the following layout on IPI vs no-IPI
platforms:

                    |  0...7  |  8...15  |       16...31       |
  ------------------+---------+----------+---------------------+
       IPI platform |   IPI   |   n/a    |         MSI         |
  ------------------+---------+----------+---------------------+
   non-IPI platform |                   MSI                    |
  ------------------+------------------------------------------+

Currently the driver only allows for the upper 16...31 interrupts for
MSI domain (i.e. the MSI domain has only 16 interrupts).

On platforms where IPI is not available, we can use whole 32 MSI
interrupts.

Implement support also for the lower 16 MSI interrupts on non-IPI
platforms.

[ Marek: refactored, changed commit message ]

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
2024-06-23 17:23:08 +02:00
Pali Rohár
9d80f6bd3a irqchip/armada-370-xp: Do not touch IPI registers on platforms without IPI
On platforms where IPI is not available in the MPIC, the IPI registers
instead represent an additional set of MSI interrupt registers (currently
unused by the driver).

Do not touch these registers on platforms where IPI is not available in the
MPIC.

[ Marek: refactored, changed commit message ]

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
2024-06-23 17:23:08 +02:00
Pali Rohár
de796fc184 irqchip/armada-370-xp: Only call ipi_resume() if IPI is available
IPI is available only on systems where the mpic controller does not have a
parent interrupt defined (e.g. on Armada XP). If a parent interrupt is
defined, inter-processor interrupts are handled by an interrupt controller
higher in the hierarchy (most probably a parent GIC).

Only call ipi_resume() on systems where IPI is available in the mpic
controller.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>

[ refactored a little and changed commit message ]
2024-06-23 17:23:08 +02:00