drivers/usb/c67x00/c67x00-ll-hpi.c
Source file repositories/reference/linux-study-clean/drivers/usb/c67x00/c67x00-ll-hpi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/c67x00/c67x00-ll-hpi.c- Extension
.c- Size
- 11801 bytes
- Lines
- 478
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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.
- 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
asm/byteorder.hlinux/delay.hlinux/io.hlinux/jiffies.hlinux/usb/c67x00.hc67x00.h
Detected Declarations
struct c67x00_lcp_int_datafunction specificationfunction hpi_write_regfunction hpi_read_word_nolockfunction hpi_read_wordfunction hpi_write_word_nolockfunction hpi_write_wordfunction hpi_write_words_le16function hpi_read_words_le16function hpi_set_bitsfunction hpi_clear_bitsfunction hpi_recv_mboxfunction hpi_send_mboxfunction c67x00_ll_hpi_statusfunction c67x00_ll_hpi_reg_initfunction c67x00_ll_hpi_enable_sofeopfunction c67x00_ll_hpi_disable_sofeopfunction ll_recv_msgfunction c67x00_ll_fetch_siemsgfunction c67x00_ll_get_usb_ctlfunction c67x00_ll_usb_clear_statusfunction c67x00_ll_usb_get_statusfunction c67x00_comm_exec_intfunction c67x00_ll_set_husb_eotfunction c67x00_ll_husb_sie_initfunction c67x00_ll_husb_resetfunction c67x00_ll_husb_set_current_tdfunction c67x00_ll_husb_get_current_tdfunction c67x00_ll_husb_get_framefunction c67x00_ll_husb_init_host_portfunction c67x00_ll_husb_reset_portfunction c67x00_ll_irqfunction c67x00_ll_resetfunction c67x00_ll_write_mem_le16function c67x00_ll_read_mem_le16function c67x00_ll_initfunction c67x00_ll_release
Annotated Snippet
struct c67x00_lcp_int_data {
u16 regs[COMM_REGS];
};
/* -------------------------------------------------------------------------- */
/* Interface definitions */
#define COMM_ACK 0x0FED
#define COMM_NAK 0xDEAD
#define COMM_RESET 0xFA50
#define COMM_EXEC_INT 0xCE01
#define COMM_INT_NUM 0x01C2
/* Registers 0 to COMM_REGS-1 */
#define COMM_R(x) (0x01C4 + 2 * (x))
#define HUSB_SIE_pCurrentTDPtr(x) ((x) ? 0x01B2 : 0x01B0)
#define HUSB_SIE_pTDListDone_Sem(x) ((x) ? 0x01B8 : 0x01B6)
#define HUSB_pEOT 0x01B4
/* Software interrupts */
/* 114, 115: */
#define HUSB_SIE_INIT_INT(x) ((x) ? 0x0073 : 0x0072)
#define HUSB_RESET_INT 0x0074
#define SUSB_INIT_INT 0x0071
#define SUSB_INIT_INT_LOC (SUSB_INIT_INT * 2)
/* -----------------------------------------------------------------------
* HPI implementation
*
* The c67x00 chip also support control via SPI or HSS serial
* interfaces. However, this driver assumes that register access can
* be performed from IRQ context. While this is a safe assumption with
* the HPI interface, it is not true for the serial interfaces.
*/
/* HPI registers */
#define HPI_DATA 0
#define HPI_MAILBOX 1
#define HPI_ADDR 2
#define HPI_STATUS 3
/*
* According to CY7C67300 specification (tables 140 and 141) HPI read and
* write cycle duration Tcyc must be at least 6T long, where T is 1/48MHz,
* which is 125ns.
*/
#define HPI_T_CYC_NS 125
static inline u16 hpi_read_reg(struct c67x00_device *dev, int reg)
{
ndelay(HPI_T_CYC_NS);
return __raw_readw(dev->hpi.base + reg * dev->hpi.regstep);
}
static inline void hpi_write_reg(struct c67x00_device *dev, int reg, u16 value)
{
ndelay(HPI_T_CYC_NS);
__raw_writew(value, dev->hpi.base + reg * dev->hpi.regstep);
}
static inline u16 hpi_read_word_nolock(struct c67x00_device *dev, u16 reg)
{
hpi_write_reg(dev, HPI_ADDR, reg);
return hpi_read_reg(dev, HPI_DATA);
}
static u16 hpi_read_word(struct c67x00_device *dev, u16 reg)
{
u16 value;
unsigned long flags;
spin_lock_irqsave(&dev->hpi.lock, flags);
value = hpi_read_word_nolock(dev, reg);
spin_unlock_irqrestore(&dev->hpi.lock, flags);
return value;
}
static void hpi_write_word_nolock(struct c67x00_device *dev, u16 reg, u16 value)
{
hpi_write_reg(dev, HPI_ADDR, reg);
hpi_write_reg(dev, HPI_DATA, value);
}
static void hpi_write_word(struct c67x00_device *dev, u16 reg, u16 value)
{
unsigned long flags;
Annotation
- Immediate include surface: `asm/byteorder.h`, `linux/delay.h`, `linux/io.h`, `linux/jiffies.h`, `linux/usb/c67x00.h`, `c67x00.h`.
- Detected declarations: `struct c67x00_lcp_int_data`, `function specification`, `function hpi_write_reg`, `function hpi_read_word_nolock`, `function hpi_read_word`, `function hpi_write_word_nolock`, `function hpi_write_word`, `function hpi_write_words_le16`, `function hpi_read_words_le16`, `function hpi_set_bits`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source 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.