Lines Matching full:eeprom

4  * EEPROM driver for RAVE SP
18 * enum rave_sp_eeprom_access_type - Supported types of EEPROM access
20 * @RAVE_SP_EEPROM_WRITE: EEPROM write
21 * @RAVE_SP_EEPROM_READ: EEPROM read
29 * enum rave_sp_eeprom_header_size - EEPROM command header sizes
31 * @RAVE_SP_EEPROM_HEADER_SMALL: EEPROM header size for "small" devices (< 8K)
32 * @RAVE_SP_EEPROM_HEADER_BIG: EEPROM header size for "big" devices (> 8K)
43 * struct rave_sp_eeprom_page - RAVE SP EEPROM page
59 * struct rave_sp_eeprom - RAVE SP EEPROM device
62 * @mutex: Lock protecting access to EEPROM
63 * @address: EEPROM device address
64 * @header_size: Size of EEPROM command header for this device
76 * rave_sp_eeprom_io - Low-level part of EEPROM page access
78 * @eeprom: EEPROM device to write to
79 * @type: EEPROM access type (read or write)
80 * @idx: number of the EEPROM page
84 * EEPROM access. This includes formatting correct command payload,
90 static int rave_sp_eeprom_io(struct rave_sp_eeprom *eeprom, in rave_sp_eeprom_io() argument
97 const unsigned int cmd_size = eeprom->header_size + data_size; in rave_sp_eeprom_io()
107 cmd[offset++] = eeprom->address; in rave_sp_eeprom_io()
114 * are talkin to EEPROM that uses 16-bit page numbers and we in rave_sp_eeprom_io()
117 if (offset < eeprom->header_size) in rave_sp_eeprom_io()
126 ret = rave_sp_exec(eeprom->sp, cmd, cmd_size, page, rsp_size); in rave_sp_eeprom_io()
140 * rave_sp_eeprom_page_access - Access single EEPROM page
142 * @eeprom: EEPROM device to access
144 * @offset: Offset within EEPROM to access
149 * portion thereof. Requested access MUST NOT cross the EEPROM page
156 rave_sp_eeprom_page_access(struct rave_sp_eeprom *eeprom, in rave_sp_eeprom_page_access() argument
168 * to do is crossing EEPROM page boundary. Normally this in rave_sp_eeprom_page_access()
181 ret = rave_sp_eeprom_io(eeprom, RAVE_SP_EEPROM_READ, in rave_sp_eeprom_page_access()
190 ret = rave_sp_eeprom_io(eeprom, type, page_nr, &page); in rave_sp_eeprom_page_access()
205 * rave_sp_eeprom_access - Access EEPROM data
207 * @eeprom: EEPROM device to access
209 * @offset: Offset within EEPROM to access
215 * (is not constrained by EEPROM page size).
220 static int rave_sp_eeprom_access(struct rave_sp_eeprom *eeprom, in rave_sp_eeprom_access() argument
230 mutex_lock(&eeprom->mutex); in rave_sp_eeprom_access()
259 ret = rave_sp_eeprom_page_access(eeprom, type, offset, in rave_sp_eeprom_access()
269 mutex_unlock(&eeprom->mutex); in rave_sp_eeprom_access()
273 static int rave_sp_eeprom_reg_read(void *eeprom, unsigned int offset, in rave_sp_eeprom_reg_read() argument
276 return rave_sp_eeprom_access(eeprom, RAVE_SP_EEPROM_READ, in rave_sp_eeprom_reg_read()
280 static int rave_sp_eeprom_reg_write(void *eeprom, unsigned int offset, in rave_sp_eeprom_reg_write() argument
283 return rave_sp_eeprom_access(eeprom, RAVE_SP_EEPROM_WRITE, in rave_sp_eeprom_reg_write()
293 struct rave_sp_eeprom *eeprom; in rave_sp_eeprom_probe() local
304 * Per ICD, we have no more than 2 bytes to specify EEPROM in rave_sp_eeprom_probe()
312 eeprom = devm_kzalloc(dev, sizeof(*eeprom), GFP_KERNEL); in rave_sp_eeprom_probe()
313 if (!eeprom) in rave_sp_eeprom_probe()
316 eeprom->address = reg[0]; in rave_sp_eeprom_probe()
317 eeprom->sp = sp; in rave_sp_eeprom_probe()
318 eeprom->dev = dev; in rave_sp_eeprom_probe()
321 eeprom->header_size = RAVE_SP_EEPROM_HEADER_BIG; in rave_sp_eeprom_probe()
323 eeprom->header_size = RAVE_SP_EEPROM_HEADER_SMALL; in rave_sp_eeprom_probe()
325 mutex_init(&eeprom->mutex); in rave_sp_eeprom_probe()
328 of_property_read_string(np, "zii,eeprom-name", &config.name); in rave_sp_eeprom_probe()
329 config.priv = eeprom; in rave_sp_eeprom_probe()
344 { .compatible = "zii,rave-sp-eeprom" },
362 MODULE_DESCRIPTION("RAVE SP EEPROM driver");