* [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines
@ 2026-10-13 13:16 Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 50/53] MIPS: SGI-IP27: add L1 front-panel LED and display requests Imre Kaloz
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Imre Kaloz @ 2026-10-13 13:16 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: linux-mips, linux-kernel, Lee Jones, Greg Kroah-Hartman,
Jiri Slaby, mfd, linux-serial, Alexandre Belloni, linux-rtc,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, Damien Le Moal, Niklas Cassel, linux-ide,
Pavel Machek, linux-leds, Bjorn Helgaas, linux-pci,
Christoph Hellwig
This series adds support for the SGI machines built around the Bedrock
hub (IP35), such as Fuel and Tezro, to the IP27 platform code.
Patches 1-5 fix the config space accessors and slot setup of the
Bridge, XBridge and PIC driver: device numbers past the last slot,
slots the PROM leaves unconfigured, the type 1 IOC3 write, posted
config writes and slots whose devio window the PROM maps elsewhere.
Patches 6-22 teach the IP27 code the Bedrock hub: detection, the node
address layout and register windows, the node id, CPU slots, memory
banks, both PIs and the kernel load address.
Patches 23-32 add the crossbar, bridge and I/O parts of these machines:
PXBow, XBridge, PIC and IOC4.
Patches 33-44 add the L1 system controller and what it provides, the
Origin 300 IO8 serial interrupts, the Odyssey graphics widget, the
KLCONFIG console and a topology package id per CPU.
Patches 45-47 add a libata driver for the IOC4 ATA/ATAPI controller,
which carries the DVD-ROM of Tezro and Origin 350 I-bricks. It drives
PIO4 and multiword DMA mode 2.
Patch 48 updates ip27_defconfig to the onboard hardware of these
machines, dropping add-in card drivers and enabling USB and PS/2
input. Patch 49 enables the IOC4 ATA driver in it.
Patches 50-53 add a driver for the Fuel and Tezro front-panel LEDs,
which the L1 sets, as white:status and red:fault. The red LED blinks
on panic, and a Tezro shows the OS state on its L1 display.
The series applies on top of "[PATCH v2] MIPS: SGI-IP27: print the NMI
dump on an nbcon console", which the NMI dump needs to reach the 8250
console.
Tested on SGI Fuel and Tezro, the Fuel with an LSI 53C1030 and an NVMe
drive behind a PCI-X-to-PCIe bridge in slots the PROM leaves
unconfigured, on a 4GB Tezro with an LSI SAS1064 on a PCI-X bus, and
for patch 5 also on an Octane. Patches 50-53 were tested on a Tezro
only, and patch 48 was only built.
On IP27 (Hub) machines:
- patch 22 moves the kernel up by 144KB, and the 144KB below it stays
reserved and unused;
- with patch 26 SWIOTLB takes 64MB of node 0 on a multi-node Origin,
and ZONE_DMA32 spans the first 2GB;
- the XBridge and PIC DMA address forms (patch 26) and the w1 change
(patch 39) do nothing on a Hub with classic Bridges;
- patches 1-5 change the config space handling of its Bridges as well.
Given I have no IP27 boxes, none of this was booted on one.
ip27_defconfig builds at every patch, ip30_defconfig at every patch
that changes code it builds.
An XBridge or PIC on a Bedrock hub takes its board setup from the
first board part number the L1 reports that the setup table knows
(patch 35), so on a machine with several bricks every such bridge gets
that one board's setup.
Patch 42 registers the Odyssey graphics widget as the "sgi-odyssey"
platform device used by the Odyssey DRM driver, a separate series, and
passes it the master widget id as the "sgi,master-widget" property.
checkpatch reports "spaces required around that ':'" in patches 14 and
21 for the GAS numeric local labels 1: and 2: in assembler macros.
Changes in v2:
- New patches 1-5 (Bridge config space and slot fixes), 37 (Origin
300 IO8 serial interrupts), 45-47 and 49 (IOC4 ATA/ATAPI), 48
(ip27_defconfig update) and 50-53 (front-panel LEDs).
- Patch 15 (was 10): slot 0 takes master_nasid as its node, not 0.
- Patch 24 (was 19): also enables the SGI 1-wire master and the DS250x
slave the Bridge probe waits for.
- Patch 25 (was 20): comment and message name the IOC3 on the 32-bit
window behind an XBridge or PIC.
- Patch 26 (was 21), retitled (Christoph Hellwig): an XBridge or PIC
device with a 64-bit DMA mask uses the 64-bit direct form with bit 55
set, other devices the 32-bit window with SWIOTLB and ZONE_DMA32; a
PIC bus in PCI-X mode uses the direct form only; the IOC3 and IOC4
always use the window, with byte swapping off; an IOC3 or IOC4 MFD
cell maps through its PCI parent.
- Patch 29 (was 24): the PIC slot count goes through bridge_nslots()
from patch 1.
- Patch 30 (was 25): probe fails without a platform device id.
- Patch 31 (was 26): probe fails on a PCI id without variant data;
const mfd_cell array; MAINTAINERS covers sgi-ioc3-serial.h; the IOC4
register layout includes the ATA/ATAPI block; the IOC4 firmware
revision is printed, and the serial ports need revision 62 or later;
the PCI id is PCI_DEVICE_ID_SGI_IOC4, which patch 26 adds.
- Patch 36 (was 31): const mfd_cell array.
- Patch 38 (was 32): the random fallback address is set with
eth_hw_addr_random().
- Patch 42 (was 36): passes the "sgi,master-widget" property.
- Patch 43 (was 37): the PROM's console baud rate is printed unsigned,
so 38400 does not come out negative.
- mfd subjects capitalised; rebased onto v7.3-rc7 and the NMI v2 patch.
- v1: https://lore.kernel.org/all/cover.1790857966.git.kaloz@kernel.org/
Imre Kaloz (53):
MIPS: PCI: xtalk-bridge: refuse device numbers past the last slot
MIPS: PCI: xtalk-bridge: assign slots the PROM leaves unconfigured
MIPS: PCI: xtalk-bridge: write a type 1 IOC3 through the type 1 window
MIPS: PCI: xtalk-bridge: flush config space writes
MIPS: PCI: xtalk-bridge: reassign slots whose devio window maps
elsewhere
MIPS: Xtalk: guard the widget identification table from assembly
MIPS: SGI-IP27: dump the NMI save areas the CPU scan recorded
MIPS: SGI-IP27: add REMOTE_HUB_PI_S()/REMOTE_HUB_PI_L()
MIPS: SGI-IP27: detect Bedrock hubs at boot
MIPS: SGI-IP27: widen Kconfig for the Bedrock-based machines
MIPS: SGI-IP27: fold the dead SN1 arm out of klconfig.h
MIPS: SGI-IP27: choose the node address layout at runtime
MIPS: SGI-IP27: add the Bedrock hub register windows
MIPS: SGI-IP27: decode a Bedrock hub's node id and system size
MIPS: SGI-IP27: put a Bedrock hub's boot CPU in slot 0
MIPS: SGI-IP27: lay out node memory in 1GB banks on Bedrock hubs
MIPS: SGI-IP27: reserve the bottom 64MB of node 0 on Bedrock hubs
MIPS: SGI-IP27: route interrupt masks and slices through both PIs
MIPS: SGI-IP27: address a CPU's own PI for NMI, IPI and RT counter
MIPS: SGI-IP27: take a CPU's node from the CPU table in per_cpu_init()
MIPS: SGI-IP27: resolve the mapped-kernel node shift at runtime
MIPS: SGI-IP27: load the kernel at node offset 0x40000
MIPS: SGI-IP27: xbow_probe(): recognize KLTYPE_PBRICK_XBOW
MIPS: ip27_defconfig: enable the IOC3 MFD, its cell drivers and tg3
net: ethernet: sgi: ioc3-eth: apply the DMA attributes only to 64-bit
addresses
MIPS: SGI-IP27: pick the XBridge and PIC DMA address form by mask
MIPS: SGI-IP27: recognize the PXBow crossbar
MIPS: PCI: xtalk-bridge: recognize the PIC widget's 64-bit-only
registers
MIPS: PCI: xtalk-bridge: match PIC's register-level differences
rtc: m48t35: support the SGI IP35 timekeeper's 1968 year base
mfd: ioc3: Add support for IOC4
MIPS: SGI-IP27: dispatch the early console between IOC3 and IOC4
MIPS: SGI-IP27: add L1 system controller support
MIPS: SGI-IP27: wire the L1 into reset and the Ethernet address
MIPS: PCI: xtalk-bridge: take the board part number from the L1
mfd: ioc3: Add IP34 system-board entry to ioc3_infos[]
mfd: ioc3: Cross the serial IRQs on the Origin 300 IO8
net: ethernet: sgi: ioc3-eth: fall back to the platform MAC address
MIPS: SGI-IP27: don't register a w1 master on an XBridge or PIC
MIPS: SGI-IP27: report a Bedrock machine as SGI IP35
MIPS: SGI-IP27: identify the machine by the L1 brick type
MIPS: SGI-IP27: register the Odyssey graphics widget
MIPS: SGI-IP27: take the console from the KLCONFIG header on IP35
MIPS: SGI-IP27: give each CPU its own topology package id
ata: add pata_sgiioc4 driver for the SGI IOC4 ATA/ATAPI controller
mfd: ioc3: Add IOC4 ATA/ATAPI cell
MAINTAINERS: add an entry for the SGI IOC4 ATA driver
MIPS: ip27_defconfig: update for the onboard hardware
MIPS: ip27_defconfig: enable pata_sgiioc4 and the DVD-ROM path
MIPS: SGI-IP27: add L1 front-panel LED and display requests
leds: Add driver for the SGI Fuel and Tezro front-panel LEDs
MIPS: SGI-IP27: show the OS state on the Fuel and Tezro front panels
MIPS: ip27_defconfig: enable the Fuel and Tezro front-panel LEDs
MAINTAINERS | 7 +
arch/mips/Kconfig | 13 +-
arch/mips/configs/ip27_defconfig | 192 +---
.../include/asm/mach-ip27/kernel-entry-init.h | 33 +-
arch/mips/include/asm/pci/bridge.h | 88 +-
arch/mips/include/asm/sn/addrs.h | 39 +-
arch/mips/include/asm/sn/agent.h | 5 +-
arch/mips/include/asm/sn/arch.h | 8 +
arch/mips/include/asm/sn/intr.h | 14 +-
arch/mips/include/asm/sn/ioc4.h | 143 +++
arch/mips/include/asm/sn/klconfig.h | 19 +-
arch/mips/include/asm/sn/kldir.h | 1 +
arch/mips/include/asm/sn/l1.h | 38 +
arch/mips/include/asm/sn/mapped_kernel.h | 6 +-
arch/mips/include/asm/sn/sn0/addrs.h | 8 +-
arch/mips/include/asm/sn/sn0/hub.h | 37 +-
arch/mips/include/asm/sn/sn0/hubni.h | 3 +
arch/mips/include/asm/sn/sn1/addrs.h | 22 +
arch/mips/include/asm/sn/sn1/hub.h | 40 +
arch/mips/include/asm/sn/sn1/kldir.h | 14 +
arch/mips/include/asm/xtalk/xwidget.h | 11 +-
arch/mips/pci/pci-xtalk-bridge.c | 467 ++++++++-
arch/mips/sgi-ip27/Makefile | 4 +-
arch/mips/sgi-ip27/Platform | 11 +-
arch/mips/sgi-ip27/ip27-berr.c | 4 +-
arch/mips/sgi-ip27/ip27-console.c | 47 +-
arch/mips/sgi-ip27/ip27-init.c | 178 +++-
arch/mips/sgi-ip27/ip27-irq.c | 17 +-
arch/mips/sgi-ip27/ip27-l1.c | 884 ++++++++++++++++++
arch/mips/sgi-ip27/ip27-memory.c | 55 +-
arch/mips/sgi-ip27/ip27-nmi.c | 54 +-
arch/mips/sgi-ip27/ip27-reset.c | 47 +-
arch/mips/sgi-ip27/ip27-smp.c | 41 +-
arch/mips/sgi-ip27/ip27-timer.c | 12 +-
arch/mips/sgi-ip27/ip27-xtalk.c | 138 ++-
drivers/ata/Kconfig | 10 +
drivers/ata/Makefile | 1 +
drivers/ata/pata_sgiioc4.c | 311 ++++++
drivers/leds/Kconfig | 12 +
drivers/leds/Makefile | 1 +
drivers/leds/leds-ip35.c | 144 +++
drivers/mfd/ioc3.c | 455 ++++++++-
drivers/net/ethernet/sgi/ioc3-eth.c | 44 +-
drivers/rtc/rtc-m48t35.c | 33 +-
drivers/tty/serial/8250/8250_ioc3.c | 5 +-
include/linux/pci_ids.h | 1 +
include/linux/platform_data/sgi-ioc3-serial.h | 13 +
include/linux/platform_data/xtalk-bridge.h | 2 +
48 files changed, 3334 insertions(+), 398 deletions(-)
create mode 100644 arch/mips/include/asm/sn/ioc4.h
create mode 100644 arch/mips/include/asm/sn/l1.h
create mode 100644 arch/mips/include/asm/sn/sn1/addrs.h
create mode 100644 arch/mips/include/asm/sn/sn1/hub.h
create mode 100644 arch/mips/include/asm/sn/sn1/kldir.h
create mode 100644 arch/mips/sgi-ip27/ip27-l1.c
create mode 100644 drivers/ata/pata_sgiioc4.c
create mode 100644 drivers/leds/leds-ip35.c
create mode 100644 include/linux/platform_data/sgi-ioc3-serial.h
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
prerequisite-patch-id: 642054c4c189f29a3f589a119d2311c20e395a23
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 50/53] MIPS: SGI-IP27: add L1 front-panel LED and display requests
2026-10-13 13:16 [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
@ 2026-10-13 13:17 ` Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 51/53] leds: Add driver for the SGI Fuel and Tezro front-panel LEDs Imre Kaloz
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Imre Kaloz @ 2026-10-13 13:17 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Lee Jones, linux-leds
Add l1_set_leds(), which sets the Fuel and Tezro front-panel LEDs, and
l1_set_display(), which writes line 2 of the Tezro's L1 display. Both
can be called from a panic notifier.
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
arch/mips/include/asm/sn/l1.h | 16 +++++++++
arch/mips/sgi-ip27/ip27-l1.c | 67 +++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+)
diff --git a/arch/mips/include/asm/sn/l1.h b/arch/mips/include/asm/sn/l1.h
index f9fa8a8051e6..42611fe51a3a 100644
--- a/arch/mips/include/asm/sn/l1.h
+++ b/arch/mips/include/asm/sn/l1.h
@@ -7,6 +7,7 @@
#ifndef __ASM_SN_L1_H
#define __ASM_SN_L1_H
+#include <linux/bits.h>
#include <linux/types.h>
/*
@@ -15,8 +16,23 @@
*/
#define L1_BOARD_COMPONENT_MAX 8
+/*
+ * Front-panel LEDs of a Fuel or a deskside Tezro. ON and BLINK switch off
+ * every LED outside the mask; OFF switches off only the masked ones.
+ */
+#define L1_LED_RED BIT(0)
+#define L1_LED_WHITE BIT(1)
+
+#define L1_LED_ON 0
+#define L1_LED_OFF 1
+#define L1_LED_BLINK 2
+
+#define L1_DISPLAY_WIDTH 16
+
int l1_exec_command(const char *cmd);
int l1_read_board_partnum(unsigned int component, char *buf, size_t len);
int l1_read_brick_type(void);
+int l1_set_leds(unsigned int mask, unsigned int state);
+int l1_set_display(const char *text);
#endif /* __ASM_SN_L1_H */
diff --git a/arch/mips/sgi-ip27/ip27-l1.c b/arch/mips/sgi-ip27/ip27-l1.c
index 98c94d14bd5f..3fe0214d0f91 100644
--- a/arch/mips/sgi-ip27/ip27-l1.c
+++ b/arch/mips/sgi-ip27/ip27-l1.c
@@ -26,7 +26,9 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/etherdevice.h>
+#include <linux/export.h>
#include <linux/hex.h>
+#include <linux/panic.h>
#include <linux/serial_reg.h>
#include <linux/spinlock.h>
#include <linux/stdarg.h>
@@ -81,6 +83,8 @@
/* L1_TASK_GENERAL requests */
#define L1_REQ_BRICK_ID 0x0003 /* rack, slot and brick type */
#define L1_REQ_EEPROM 0x0006 /* access eeprom */
+#define L1_REQ_DISP2 0x1005 /* write line 2 of the display */
+#define L1_REQ_LED 0x1009 /* set the front-panel LEDs */
/* L1_REQ_EEPROM additional argument values (non C-brick component) */
#define L1_EEP_LOGIC 0x01 /* logic board */
@@ -414,6 +418,19 @@ static int l1_response_to_errno(u32 response)
*/
static DEFINE_SPINLOCK(l1_lock);
+/*
+ * Once a panic has stopped the other CPUs, one of them may hold the lock
+ * for good; the panicking CPU then goes to the wire without it.
+ */
+static bool l1_lock_irqsave(unsigned long *flags)
+{
+ if (panic_in_progress())
+ return spin_trylock_irqsave(&l1_lock, *flags);
+
+ spin_lock_irqsave(&l1_lock, *flags);
+ return true;
+}
+
/*
* Run one request/response exchange in pkt, which has to be large enough
* for both; returns the response's argument count.
@@ -493,6 +510,56 @@ int l1_exec_command(const char *cmd)
return rc == 0 ? 0 : -EIO;
}
+int l1_set_leds(unsigned int mask, unsigned int state)
+{
+ u32 address = L1_ADDRESS(L1_TYPE_L1,
+ L1_ADDRESS_LOCAL | L1_TASK_GENERAL);
+ u8 pkt[64]; /* command and response packet buffer */
+ unsigned long flags;
+ bool locked;
+ int rc;
+
+ locked = l1_lock_irqsave(&flags);
+
+ /* arguments: LED mask, then new state, both INT */
+ rc = l1_transact(get_nasid(), pkt, sizeof(pkt), address, L1_REQ_LED,
+ NULL, NULL, 2,
+ L1_ARG_INT, (u32)mask, L1_ARG_INT, (u32)state);
+
+ if (locked)
+ spin_unlock_irqrestore(&l1_lock, flags);
+
+ return rc < 0 ? rc : 0;
+}
+EXPORT_SYMBOL_GPL(l1_set_leds);
+
+/*
+ * Write line 2 of the display; line 1 belongs to the L1. Padding to the
+ * full width leaves nothing of a longer earlier line behind.
+ */
+int l1_set_display(const char *text)
+{
+ u32 address = L1_ADDRESS(L1_TYPE_L1,
+ L1_ADDRESS_LOCAL | L1_TASK_GENERAL);
+ char line[L1_DISPLAY_WIDTH + 1];
+ u8 pkt[64]; /* command and response packet buffer */
+ unsigned long flags;
+ bool locked;
+ int rc;
+
+ snprintf(line, sizeof(line), "%-*s", L1_DISPLAY_WIDTH, text);
+
+ locked = l1_lock_irqsave(&flags);
+
+ rc = l1_transact(get_nasid(), pkt, sizeof(pkt), address,
+ L1_REQ_DISP2, NULL, NULL, 1, L1_ARG_ASCII, line);
+
+ if (locked)
+ spin_unlock_irqrestore(&l1_lock, flags);
+
+ return rc < 0 ? rc : 0;
+}
+
/* Read a component's board IA record from EEPROM. */
static int l1_read_board_ia(nasid_t nasid, int type, unsigned int component,
u8 **ria, size_t *rialen)
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 51/53] leds: Add driver for the SGI Fuel and Tezro front-panel LEDs
2026-10-13 13:16 [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 50/53] MIPS: SGI-IP27: add L1 front-panel LED and display requests Imre Kaloz
@ 2026-10-13 13:17 ` Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 52/53] MIPS: SGI-IP27: show the OS state on the Fuel and Tezro front panels Imre Kaloz
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Imre Kaloz @ 2026-10-13 13:17 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: linux-mips, linux-kernel, Lee Jones, Pavel Machek, linux-leds
The SGI Fuel and Tezro front-panel LEDs are set through the L1 system
controller, whose LED request switches off every LED outside its mask,
so send the pattern of both LEDs on each change. Probe takes over the
PROM's state without writing it.
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
drivers/leds/Kconfig | 12 ++++
drivers/leds/Makefile | 1 +
drivers/leds/leds-ip35.c | 144 +++++++++++++++++++++++++++++++++++++++
3 files changed, 157 insertions(+)
create mode 100644 drivers/leds/leds-ip35.c
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index d0d3182236be..9ca75364264b 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -1035,6 +1035,18 @@ config LEDS_IP30
To compile this driver as a module, choose M here: the module
will be called leds-ip30.
+config LEDS_IP35
+ tristate "LED support for SGI Fuel and Tezro"
+ depends on LEDS_CLASS
+ depends on SGI_IP27
+ help
+ This option enables support for the red and white front-panel
+ LEDs of SGI Fuel and Tezro workstations, which the L1 system
+ controller drives.
+
+ To compile this driver as a module, choose M here: the module
+ will be called leds-ip35.
+
config LEDS_ACER_A500
tristate "Power button LED support for Acer Iconia Tab A500"
depends on LEDS_CLASS && MFD_ACER_A500_EC
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index a68244bd50fb..b45d1d70c431 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_LEDS_GPIO_REGISTER) += leds-gpio-register.o
obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o
obj-$(CONFIG_LEDS_IP30) += leds-ip30.o
+obj-$(CONFIG_LEDS_IP35) += leds-ip35.o
obj-$(CONFIG_LEDS_IPAQ_MICRO) += leds-ipaq-micro.o
obj-$(CONFIG_LEDS_IS31FL319X) += leds-is31fl319x.o
obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
diff --git a/drivers/leds/leds-ip35.c b/drivers/leds/leds-ip35.c
new file mode 100644
index 000000000000..fba918265e3d
--- /dev/null
+++ b/drivers/leds/leds-ip35.c
@@ -0,0 +1,144 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * LED driver for the SGI Fuel and Tezro front panels, which the L1
+ * system controller drives.
+ *
+ * Copyright (C) 2026 Imre Kaloz <kaloz@kernel.org>
+ */
+
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
+
+#include <dt-bindings/leds/common.h>
+
+#include <asm/sn/l1.h>
+
+struct ip35_leds;
+
+struct ip35_led {
+ struct led_classdev cdev;
+ struct ip35_leds *leds;
+ unsigned int mask;
+ unsigned int state;
+};
+
+struct ip35_leds {
+ struct mutex lock; /* protects ->state of both LEDs */
+ struct ip35_led led[2];
+};
+
+/*
+ * ON and BLINK switch off every LED outside their mask, so each change
+ * sends the pattern of both LEDs. A steady LED next to a blinking one
+ * cannot be shown; the blinking one wins.
+ */
+static int ip35_led_update(struct ip35_led *led, unsigned int state)
+{
+ struct ip35_leds *leds = led->leds;
+ unsigned int old, on = 0, blink = 0;
+ int i, ret;
+
+ mutex_lock(&leds->lock);
+
+ old = led->state;
+ led->state = state;
+
+ for (i = 0; i < ARRAY_SIZE(leds->led); i++) {
+ if (leds->led[i].state == L1_LED_ON)
+ on |= leds->led[i].mask;
+ else if (leds->led[i].state == L1_LED_BLINK)
+ blink |= leds->led[i].mask;
+ }
+
+ if (blink)
+ ret = l1_set_leds(blink, L1_LED_BLINK);
+ else if (on)
+ ret = l1_set_leds(on, L1_LED_ON);
+ else
+ ret = l1_set_leds(L1_LED_RED | L1_LED_WHITE, L1_LED_OFF);
+
+ if (ret)
+ led->state = old;
+
+ mutex_unlock(&leds->lock);
+
+ return ret;
+}
+
+static int ip35_led_set(struct led_classdev *cdev, enum led_brightness value)
+{
+ struct ip35_led *led = container_of(cdev, struct ip35_led, cdev);
+
+ return ip35_led_update(led, value ? L1_LED_ON : L1_LED_OFF);
+}
+
+/* The L1 blinks at a fixed 2 s period of its own, whatever the delays. */
+static int ip35_led_blink_set(struct led_classdev *cdev,
+ unsigned long *delay_on,
+ unsigned long *delay_off)
+{
+ struct ip35_led *led = container_of(cdev, struct ip35_led, cdev);
+
+ *delay_on = 1000;
+ *delay_off = 1000;
+
+ return ip35_led_update(led, L1_LED_BLINK);
+}
+
+/* The PROM leaves the white LED lit and the red one dark. */
+static const struct {
+ const char *name;
+ unsigned int mask;
+ unsigned int state;
+} ip35_led_info[] = {
+ { "white:" LED_FUNCTION_STATUS, L1_LED_WHITE, L1_LED_ON },
+ { "red:" LED_FUNCTION_FAULT, L1_LED_RED, L1_LED_OFF },
+};
+
+static int ip35_leds_probe(struct platform_device *pdev)
+{
+ struct ip35_leds *leds;
+ int i, ret;
+
+ leds = devm_kzalloc(&pdev->dev, sizeof(*leds), GFP_KERNEL);
+ if (!leds)
+ return -ENOMEM;
+
+ ret = devm_mutex_init(&pdev->dev, &leds->lock);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < ARRAY_SIZE(leds->led); i++) {
+ struct ip35_led *led = &leds->led[i];
+
+ led->leds = leds;
+ led->mask = ip35_led_info[i].mask;
+ led->state = ip35_led_info[i].state;
+ led->cdev.name = ip35_led_info[i].name;
+ led->cdev.max_brightness = 1;
+ led->cdev.brightness = led->state == L1_LED_ON;
+ led->cdev.brightness_set_blocking = ip35_led_set;
+ led->cdev.blink_set = ip35_led_blink_set;
+
+ ret = devm_led_classdev_register(&pdev->dev, &led->cdev);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+static struct platform_driver ip35_leds_driver = {
+ .probe = ip35_leds_probe,
+ .driver = {
+ .name = "ip35-leds",
+ },
+};
+module_platform_driver(ip35_leds_driver);
+
+MODULE_AUTHOR("Imre Kaloz <kaloz@kernel.org>");
+MODULE_DESCRIPTION("SGI Fuel and Tezro front-panel LED driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:ip35-leds");
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 52/53] MIPS: SGI-IP27: show the OS state on the Fuel and Tezro front panels
2026-10-13 13:16 [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 50/53] MIPS: SGI-IP27: add L1 front-panel LED and display requests Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 51/53] leds: Add driver for the SGI Fuel and Tezro front-panel LEDs Imre Kaloz
@ 2026-10-13 13:17 ` Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 53/53] MIPS: ip27_defconfig: enable the Fuel and Tezro front-panel LEDs Imre Kaloz
2026-10-13 13:35 ` [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Niklas Cassel
4 siblings, 0 replies; 7+ messages in thread
From: Imre Kaloz @ 2026-10-13 13:17 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Lee Jones, linux-leds
Register the front-panel LED device on a Fuel and a deskside Tezro and
blink the red LED on panic. A Tezro also shows "Linux booting", "Linux
running" or "Linux panic" on line 2 of its L1 display.
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
arch/mips/sgi-ip27/ip27-init.c | 52 ++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index e657155ef7c9..f7de09515c0c 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -13,6 +13,9 @@
#include <linux/smp.h>
#include <linux/mm.h>
#include <linux/export.h>
+#include <linux/notifier.h>
+#include <linux/panic_notifier.h>
+#include <linux/platform_device.h>
#include <linux/cpumask.h>
#include <linux/ctype.h>
#include <asm/bootinfo.h>
@@ -122,6 +125,8 @@ static const struct {
{ 'Q', "SGI Tezro Rackmount", NULL },
};
+static int ip27_brick_type;
+
static bool __init ip27_has_graphics(void)
{
nasid_t nasid;
@@ -145,6 +150,7 @@ static void __init ip27_set_machine_name(void)
brick_type = l1_read_brick_type();
if (brick_type < 0)
return;
+ ip27_brick_type = brick_type;
gfx = ip27_has_graphics();
@@ -165,6 +171,52 @@ static void __init ip27_set_machine_name(void)
gfx ? "with" : "without");
}
+/*
+ * A Fuel (brick type 'A') and a deskside Tezro ('9') have L1-driven
+ * front-panel LEDs, the Tezro also an L1 display. A blinking red LED,
+ * with the white one off, marks a panic.
+ */
+static int ip27_panel_panic(struct notifier_block *nb, unsigned long event,
+ void *ptr)
+{
+ l1_set_leds(L1_LED_RED, L1_LED_BLINK);
+ if (ip27_brick_type == '9')
+ l1_set_display("Linux panic");
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block ip27_panel_panic_nb = {
+ .notifier_call = ip27_panel_panic,
+};
+
+static int __init ip27_panel_init(void)
+{
+ struct platform_device *pdev;
+
+ if (ip27_brick_type != 'A' && ip27_brick_type != '9')
+ return 0;
+
+ atomic_notifier_chain_register(&panic_notifier_list,
+ &ip27_panel_panic_nb);
+ if (ip27_brick_type == '9')
+ l1_set_display("Linux booting");
+
+ pdev = platform_device_register_simple("ip35-leds", PLATFORM_DEVID_NONE,
+ NULL, 0);
+ return PTR_ERR_OR_ZERO(pdev);
+}
+arch_initcall(ip27_panel_init);
+
+static int __init ip27_panel_running(void)
+{
+ if (ip27_brick_type == '9')
+ l1_set_display("Linux running");
+
+ return 0;
+}
+late_initcall_sync(ip27_panel_running);
+
/*
* Prefer ttyS0 at the baud rate the IP35 PROM recorded for its console
* UART in the KLCONFIG header.
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 53/53] MIPS: ip27_defconfig: enable the Fuel and Tezro front-panel LEDs
2026-10-13 13:16 [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
` (2 preceding siblings ...)
2026-10-13 13:17 ` [PATCH v2 52/53] MIPS: SGI-IP27: show the OS state on the Fuel and Tezro front panels Imre Kaloz
@ 2026-10-13 13:17 ` Imre Kaloz
2026-10-13 13:35 ` [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Niklas Cassel
4 siblings, 0 replies; 7+ messages in thread
From: Imre Kaloz @ 2026-10-13 13:17 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Lee Jones, linux-leds
Enable the LED class with its timer, heartbeat and default-on triggers,
and build the SGI Fuel and Tezro front-panel LED driver as a module.
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
arch/mips/configs/ip27_defconfig | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 2959615d656b..74f4a88f927a 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -133,6 +133,13 @@ CONFIG_USB=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_STORAGE=m
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_IP35=m
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=m
+CONFIG_LEDS_TRIGGER_HEARTBEAT=m
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_M48T35=y
CONFIG_UIO=y
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines
2026-10-13 13:16 [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
` (3 preceding siblings ...)
2026-10-13 13:17 ` [PATCH v2 53/53] MIPS: ip27_defconfig: enable the Fuel and Tezro front-panel LEDs Imre Kaloz
@ 2026-10-13 13:35 ` Niklas Cassel
2026-10-13 14:25 ` Imre Kaloz
4 siblings, 1 reply; 7+ messages in thread
From: Niklas Cassel @ 2026-10-13 13:35 UTC (permalink / raw)
To: Imre Kaloz
Cc: Thomas Bogendoerfer, linux-mips, linux-kernel, Lee Jones,
Greg Kroah-Hartman, Jiri Slaby, mfd, linux-serial,
Alexandre Belloni, linux-rtc, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, Damien Le Moal,
linux-ide, Pavel Machek, linux-leds, Bjorn Helgaas, linux-pci,
Christoph Hellwig
Hello Imre,
This series is rather large.
I would recommend you to submit a minimal patch series
to get the basic support for your new board, such that
it can boot with a ramdisk and serial console.
Then in the next cycle, send separate series for ata,
net, leds, mfc, rtc, etc.
Kind regards,
Niklas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines
2026-10-13 13:35 ` [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Niklas Cassel
@ 2026-10-13 14:25 ` Imre Kaloz
0 siblings, 0 replies; 7+ messages in thread
From: Imre Kaloz @ 2026-10-13 14:25 UTC (permalink / raw)
To: Niklas Cassel
Cc: Thomas Bogendoerfer, linux-mips, linux-kernel, Lee Jones,
Greg Kroah-Hartman, Jiri Slaby, mfd, linux-serial,
Alexandre Belloni, linux-rtc, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, Damien Le Moal,
linux-ide, Pavel Machek, linux-leds, Bjorn Helgaas, linux-pci,
Christoph Hellwig
[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]
Hello Niklas,
On Tue, 13 Oct 2026, Niklas Cassel wrote:
> Hello Imre,
>
> This series is rather large.
>
> I would recommend you to submit a minimal patch series
> to get the basic support for your new board, such that
> it can boot with a ramdisk and serial console.
>
> Then in the next cycle, send separate series for ata,
> net, leds, mfc, rtc, etc.
Hi Niklas,
Thanks for having a look. I checked what the minimum is: 31 of the 53
patches (1, 6-24, 26-29, 31-36 and 39) boot a Tezro to a ramdisk with a
serial console. Two mfd/ioc3 patches have to be part of that, as they
provide the console UARTs (31 for IOC4 on the Tezro, 36 for the IOC3 on
the Fuel). The rest separates cleanly into follow-ups: the remaining
Bridge fixes (2-5), ioc3-eth (25, 38), rtc (30), the IO8 serial IRQs (37),
machine identification and the Odyssey widget (40-44), ata (45-47, 49),
the defconfig refresh (48) and the LEDs (50-53).
I’ll wait for Thomas to say whether he prefers it split that way for v3.
Thanks,
Imre
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-10-13 14:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 13:16 [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 50/53] MIPS: SGI-IP27: add L1 front-panel LED and display requests Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 51/53] leds: Add driver for the SGI Fuel and Tezro front-panel LEDs Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 52/53] MIPS: SGI-IP27: show the OS state on the Fuel and Tezro front panels Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 53/53] MIPS: ip27_defconfig: enable the Fuel and Tezro front-panel LEDs Imre Kaloz
2026-10-13 13:35 ` [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Niklas Cassel
2026-10-13 14:25 ` Imre Kaloz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox