drivers/net/dsa/mv88e6xxx/global1.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/mv88e6xxx/global1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/mv88e6xxx/global1.c- Extension
.c- Size
- 16471 bytes
- Lines
- 680
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hchip.hglobal1.h
Detected Declarations
function Globalfunction mv88e6xxx_g1_writefunction mv88e6xxx_g1_wait_bitfunction mv88e6xxx_g1_wait_maskfunction mv88e6185_g1_wait_ppu_disabledfunction mv88e6185_g1_wait_ppu_pollingfunction mv88e6352_g1_wait_ppu_pollingfunction mv88e6xxx_g1_wait_init_readyfunction mv88e6250_g1_eeprom_reloadfunction mv88e6xxx_g1_is_eeprom_donefunction mv88e6xxx_g1_wait_eeprom_donefunction mv88e6250_g1_wait_eeprom_done_preresetfunction mv88e6xxx_g1_set_switch_macfunction mv88e6185_g1_resetfunction mv88e6250_g1_resetfunction mv88e6352_g1_resetfunction mv88e6185_g1_ppu_enablefunction mv88e6185_g1_ppu_disablefunction mv88e6185_g1_set_max_frame_sizefunction mv88e6085_g1_ip_pri_mapfunction mv88e6085_g1_ieee_pri_mapfunction mv88e6250_g1_ieee_pri_mapfunction mv88e6095_g1_set_egress_portfunction mv88e6095_g1_set_cpu_portfunction mv88e6390_g1_monitor_writefunction mv88e6390_g1_set_egress_portfunction mv88e6390_g1_set_cpu_portfunction mv88e6390_g1_set_ptp_cpu_portfunction mv88e6390_g1_mgmt_rsvd2cpufunction mv88e6xxx_g1_ctl2_maskfunction mv88e6185_g1_set_cascade_portfunction mv88e6085_g1_rmu_disablefunction mv88e6352_g1_rmu_disablefunction mv88e6390_g1_rmu_disablefunction mv88e6390_g1_stats_set_histogramfunction mv88e6xxx_g1_set_device_numberfunction mv88e6xxx_g1_stats_waitfunction mv88e6095_g1_stats_set_histogramfunction mv88e6xxx_g1_stats_snapshotfunction mv88e6320_g1_stats_snapshotfunction mv88e6390_g1_stats_snapshotfunction mv88e6xxx_g1_stats_readfunction mv88e6xxx_g1_stats_clear
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Marvell 88E6xxx Switch Global (1) Registers support
*
* Copyright (c) 2008 Marvell Semiconductor
*
* Copyright (c) 2016-2017 Savoir-faire Linux Inc.
* Vivien Didelot <vivien.didelot@savoirfairelinux.com>
*/
#include <linux/bitfield.h>
#include "chip.h"
#include "global1.h"
int mv88e6xxx_g1_read(struct mv88e6xxx_chip *chip, int reg, u16 *val)
{
int addr = chip->info->global1_addr;
return mv88e6xxx_read(chip, addr, reg, val);
}
int mv88e6xxx_g1_write(struct mv88e6xxx_chip *chip, int reg, u16 val)
{
int addr = chip->info->global1_addr;
return mv88e6xxx_write(chip, addr, reg, val);
}
int mv88e6xxx_g1_wait_bit(struct mv88e6xxx_chip *chip, int reg, int
bit, int val)
{
return mv88e6xxx_wait_bit(chip, chip->info->global1_addr, reg,
bit, val);
}
int mv88e6xxx_g1_wait_mask(struct mv88e6xxx_chip *chip, int reg,
u16 mask, u16 val)
{
return mv88e6xxx_wait_mask(chip, chip->info->global1_addr, reg,
mask, val);
}
/* Offset 0x00: Switch Global Status Register */
static int mv88e6185_g1_wait_ppu_disabled(struct mv88e6xxx_chip *chip)
{
return mv88e6xxx_g1_wait_mask(chip, MV88E6XXX_G1_STS,
MV88E6185_G1_STS_PPU_STATE_MASK,
MV88E6185_G1_STS_PPU_STATE_DISABLED);
}
static int mv88e6185_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip)
{
return mv88e6xxx_g1_wait_mask(chip, MV88E6XXX_G1_STS,
MV88E6185_G1_STS_PPU_STATE_MASK,
MV88E6185_G1_STS_PPU_STATE_POLLING);
}
static int mv88e6352_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip)
{
int bit = __bf_shf(MV88E6352_G1_STS_PPU_STATE);
return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_STS, bit, 1);
}
static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip)
{
int bit = __bf_shf(MV88E6XXX_G1_STS_INIT_READY);
/* Wait up to 1 second for the switch to be ready. The InitReady bit 11
* is set to a one when all units inside the device (ATU, VTU, etc.)
* have finished their initialization and are ready to accept frames.
*/
return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_STS, bit, 1);
}
static int mv88e6250_g1_eeprom_reload(struct mv88e6xxx_chip *chip)
{
/* MV88E6185_G1_CTL1_RELOAD_EEPROM is also valid for 88E6250 */
int bit = __bf_shf(MV88E6185_G1_CTL1_RELOAD_EEPROM);
u16 val;
int err;
err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val);
if (err)
return err;
val |= MV88E6185_G1_CTL1_RELOAD_EEPROM;
Annotation
- Immediate include surface: `linux/bitfield.h`, `chip.h`, `global1.h`.
- Detected declarations: `function Global`, `function mv88e6xxx_g1_write`, `function mv88e6xxx_g1_wait_bit`, `function mv88e6xxx_g1_wait_mask`, `function mv88e6185_g1_wait_ppu_disabled`, `function mv88e6185_g1_wait_ppu_polling`, `function mv88e6352_g1_wait_ppu_polling`, `function mv88e6xxx_g1_wait_init_ready`, `function mv88e6250_g1_eeprom_reload`, `function mv88e6xxx_g1_is_eeprom_done`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.