Lines Matching full:sl

40 	int (*read)(struct w1_slave *sl, int pageno);
46 static int w1_ds2502_read_page(struct w1_slave *sl, int pageno) in w1_ds2502_read_page() argument
48 struct w1_eprom_data *data = sl->family_data; in w1_ds2502_read_page()
57 mutex_lock(&sl->master->bus_mutex); in w1_ds2502_read_page()
59 if (w1_reset_select_slave(sl)) in w1_ds2502_read_page()
65 w1_write_block(sl->master, buf, 3); in w1_ds2502_read_page()
67 crc8 = w1_read_8(sl->master); in w1_ds2502_read_page()
71 w1_read_block(sl->master, &data->eprom[pgoff], W1_PAGE_SIZE); in w1_ds2502_read_page()
73 crc8 = w1_read_8(sl->master); in w1_ds2502_read_page()
80 mutex_unlock(&sl->master->bus_mutex); in w1_ds2502_read_page()
84 static int w1_ds2505_read_page(struct w1_slave *sl, int pageno) in w1_ds2505_read_page() argument
86 struct w1_eprom_data *data = sl->family_data; in w1_ds2505_read_page()
98 mutex_lock(&sl->master->bus_mutex); in w1_ds2505_read_page()
101 if (w1_reset_select_slave(sl)) in w1_ds2505_read_page()
107 w1_write_block(sl->master, buf, 3); in w1_ds2505_read_page()
108 w1_read_block(sl->master, buf + 3, 3); /* redir, crc16 */ in w1_ds2505_read_page()
125 w1_read_block(sl->master, &data->eprom[epoff], W1_PAGE_SIZE); in w1_ds2505_read_page()
126 w1_read_block(sl->master, buf, 2); /* crc16 */ in w1_ds2505_read_page()
136 mutex_unlock(&sl->master->bus_mutex); in w1_ds2505_read_page()
142 struct w1_slave *sl = priv; in w1_nvmem_read() local
143 struct w1_eprom_data *data = sl->family_data; in w1_nvmem_read()
156 ret = data->read(sl, i++); in w1_nvmem_read()
165 static int w1_eprom_add_slave(struct w1_slave *sl) in w1_eprom_add_slave() argument
170 .dev = &sl->dev, in w1_eprom_add_slave()
176 .priv = sl, in w1_eprom_add_slave()
180 data = devm_kzalloc(&sl->dev, sizeof(struct w1_eprom_data), GFP_KERNEL); in w1_eprom_add_slave()
184 sl->family_data = data; in w1_eprom_add_slave()
185 switch (sl->family->fid) { in w1_eprom_add_slave()
201 if (sl->master->bus_master->dev_id) in w1_eprom_add_slave()
204 sl->master->bus_master->dev_id, sl->reg_num.family, in w1_eprom_add_slave()
205 (unsigned long long)sl->reg_num.id); in w1_eprom_add_slave()
209 sl->reg_num.family, in w1_eprom_add_slave()
210 (unsigned long long)sl->reg_num.id); in w1_eprom_add_slave()
215 nvmem = devm_nvmem_register(&sl->dev, &nvmem_cfg); in w1_eprom_add_slave()