drivers/soc/fsl/qe/ucc.c
Source file repositories/reference/linux-study-clean/drivers/soc/fsl/qe/ucc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/fsl/qe/ucc.c- Extension
.c- Size
- 12318 bytes
- Lines
- 659
- Domain
- Driver Families
- Bucket
- drivers/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/errno.hlinux/stddef.hlinux/spinlock.hlinux/export.hasm/io.hsoc/fsl/qe/immap_qe.hsoc/fsl/qe/qe.hsoc/fsl/qe/ucc.h
Detected Declarations
function Copyrightfunction ucc_set_typefunction get_cmxucr_regfunction ucc_mux_set_grant_tsa_bkptfunction ucc_set_qe_mux_rxtxfunction ucc_get_tdm_common_clkfunction ucc_get_tdm_rx_clkfunction ucc_get_tdm_tx_clkfunction ucc_get_tdm_rxtx_clkfunction ucc_get_tdm_clk_shiftfunction ucc_set_tdm_rxtx_clkfunction ucc_get_tdm_sync_sourcefunction ucc_get_tdm_sync_shiftfunction ucc_set_tdm_rxtx_syncexport ucc_set_qe_mux_mii_mngexport ucc_mux_set_grant_tsa_bkpt
Annotated Snippet
switch (clock) {
case QE_BRG1: clock_bits = 1; break;
case QE_BRG2: clock_bits = 2; break;
case QE_BRG7: clock_bits = 3; break;
case QE_BRG8: clock_bits = 4; break;
case QE_CLK9: clock_bits = 5; break;
case QE_CLK10: clock_bits = 6; break;
case QE_CLK11: clock_bits = 7; break;
case QE_CLK12: clock_bits = 8; break;
case QE_CLK15: clock_bits = 9; break;
case QE_CLK16: clock_bits = 10; break;
default: break;
}
break;
case 2:
switch (clock) {
case QE_BRG5: clock_bits = 1; break;
case QE_BRG6: clock_bits = 2; break;
case QE_BRG7: clock_bits = 3; break;
case QE_BRG8: clock_bits = 4; break;
case QE_CLK13: clock_bits = 5; break;
case QE_CLK14: clock_bits = 6; break;
case QE_CLK19: clock_bits = 7; break;
case QE_CLK20: clock_bits = 8; break;
case QE_CLK15: clock_bits = 9; break;
case QE_CLK16: clock_bits = 10; break;
default: break;
}
break;
case 3:
switch (clock) {
case QE_BRG9: clock_bits = 1; break;
case QE_BRG10: clock_bits = 2; break;
case QE_BRG15: clock_bits = 3; break;
case QE_BRG16: clock_bits = 4; break;
case QE_CLK3: clock_bits = 5; break;
case QE_CLK4: clock_bits = 6; break;
case QE_CLK17: clock_bits = 7; break;
case QE_CLK18: clock_bits = 8; break;
case QE_CLK7: clock_bits = 9; break;
case QE_CLK8: clock_bits = 10; break;
case QE_CLK16: clock_bits = 11; break;
default: break;
}
break;
case 4:
switch (clock) {
case QE_BRG13: clock_bits = 1; break;
case QE_BRG14: clock_bits = 2; break;
case QE_BRG15: clock_bits = 3; break;
case QE_BRG16: clock_bits = 4; break;
case QE_CLK5: clock_bits = 5; break;
case QE_CLK6: clock_bits = 6; break;
case QE_CLK21: clock_bits = 7; break;
case QE_CLK22: clock_bits = 8; break;
case QE_CLK7: clock_bits = 9; break;
case QE_CLK8: clock_bits = 10; break;
case QE_CLK16: clock_bits = 11; break;
default: break;
}
break;
default: break;
}
/* Check for invalid combination of clock and UCC number */
if (!clock_bits)
return -ENOENT;
if (mode == COMM_DIR_RX)
shift += 4;
qe_clrsetbits_be32(cmxucr, QE_CMXUCR_TX_CLK_SRC_MASK << shift,
clock_bits << shift);
return 0;
}
static int ucc_get_tdm_common_clk(u32 tdm_num, enum qe_clock clock)
{
int clock_bits = -EINVAL;
/*
* for TDM[0, 1, 2, 3], TX and RX use common
* clock source BRG3,4 and CLK1,2
* for TDM[4, 5, 6, 7], TX and RX use common
* clock source BRG12,13 and CLK23,24
*/
switch (tdm_num) {
case 0:
case 1:
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/stddef.h`, `linux/spinlock.h`, `linux/export.h`, `asm/io.h`, `soc/fsl/qe/immap_qe.h`, `soc/fsl/qe/qe.h`.
- Detected declarations: `function Copyright`, `function ucc_set_type`, `function get_cmxucr_reg`, `function ucc_mux_set_grant_tsa_bkpt`, `function ucc_set_qe_mux_rxtx`, `function ucc_get_tdm_common_clk`, `function ucc_get_tdm_rx_clk`, `function ucc_get_tdm_tx_clk`, `function ucc_get_tdm_rxtx_clk`, `function ucc_get_tdm_clk_shift`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.