Lines Matching +full:dout +full:- +full:default +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Register map access API - ENCX24J600 support
26 ret = spi_write(ctx->spi, &bank_opcode, 1); in encx24j600_switch_bank()
28 ctx->bank = bank; in encx24j600_switch_bank()
37 struct spi_transfer t[2] = { { .tx_buf = &opcode, .len = 1, }, in encx24j600_cmdn()
43 return spi_sync(ctx->spi, &m); in encx24j600_cmdn()
50 mutex_lock(&ctx->mutex); in regmap_lock_mutex()
57 mutex_unlock(&ctx->mutex); in regmap_unlock_mutex()
69 u8 tx_buf[2]; in regmap_encx24j600_sfr_read()
73 if ((banked_reg < 0x16) && (ctx->bank != bank)) in regmap_encx24j600_sfr_read()
79 * 3-byte SPI commands in regmap_encx24j600_sfr_read()
97 default: in regmap_encx24j600_sfr_read()
98 return -EINVAL; in regmap_encx24j600_sfr_read()
106 ret = spi_write_then_read(ctx->spi, tx_buf, i, val, len); in regmap_encx24j600_sfr_read()
127 if ((banked_reg < 0x16) && (ctx->bank != bank)) in regmap_encx24j600_sfr_update()
133 * 3-byte SPI commands in regmap_encx24j600_sfr_update()
151 default: in regmap_encx24j600_sfr_update()
152 return -EINVAL; in regmap_encx24j600_sfr_update()
164 spi_message_add_tail(&t[2], &m); in regmap_encx24j600_sfr_update()
165 return spi_sync(ctx->spi, &m); in regmap_encx24j600_sfr_update()
199 return -EINVAL; in regmap_encx24j600_reg_update_bits()
228 /* SPI 1-byte command. Ignore data */ in regmap_encx24j600_spi_write()
229 return spi_write(ctx->spi, &reg, 1); in regmap_encx24j600_spi_write()
240 return spi_write_then_read(ctx->spi, &reg, sizeof(reg), data, count); in regmap_encx24j600_spi_read()
247 u8 *dout = (u8 *)data; in regmap_encx24j600_write() local
248 u8 reg = dout[0]; in regmap_encx24j600_write()
249 ++dout; in regmap_encx24j600_write()
250 --len; in regmap_encx24j600_write()
253 return regmap_encx24j600_spi_write(context, reg, dout, len); in regmap_encx24j600_write()
255 if (len > 2) in regmap_encx24j600_write()
256 return -EINVAL; in regmap_encx24j600_write()
258 return regmap_encx24j600_sfr_write(context, reg, dout, len); in regmap_encx24j600_write()
269 return -EINVAL; in regmap_encx24j600_read()
275 if (val_size > 2) { in regmap_encx24j600_read()
277 return -EINVAL; in regmap_encx24j600_read()
328 default: in encx24j600_regmap_volatile()
353 ret = regmap_write(ctx->regmap, MIREGADR, reg); in regmap_encx24j600_phy_reg_read()
357 ret = regmap_write(ctx->regmap, MICMD, MIIRD); in regmap_encx24j600_phy_reg_read()
362 while (((ret = regmap_read(ctx->regmap, MISTAT, &mistat)) == 0) && in regmap_encx24j600_phy_reg_read()
369 ret = regmap_write(ctx->regmap, MICMD, 0); in regmap_encx24j600_phy_reg_read()
373 ret = regmap_read(ctx->regmap, MIRD, val); in regmap_encx24j600_phy_reg_read()
391 ret = regmap_write(ctx->regmap, MIREGADR, reg); in regmap_encx24j600_phy_reg_write()
395 ret = regmap_write(ctx->regmap, MIWR, val); in regmap_encx24j600_phy_reg_write()
400 while (((ret = regmap_read(ctx->regmap, MISTAT, &mistat)) == 0) && in regmap_encx24j600_phy_reg_write()
424 default: in encx24j600_phymap_readable()
441 default: in encx24j600_phymap_writeable()
456 default: in encx24j600_phymap_volatile()
466 .reg_stride = 2,
503 mutex_init(&ctx->mutex); in devm_regmap_init_encx24j600()
505 ctx->regmap = devm_regmap_init(dev, &regmap_encx24j600, ctx, &regcfg); in devm_regmap_init_encx24j600()
506 if (IS_ERR(ctx->regmap)) in devm_regmap_init_encx24j600()
507 return PTR_ERR(ctx->regmap); in devm_regmap_init_encx24j600()
508 ctx->phymap = devm_regmap_init(dev, &phymap_encx24j600, ctx, &phycfg); in devm_regmap_init_encx24j600()
509 if (IS_ERR(ctx->phymap)) in devm_regmap_init_encx24j600()
510 return PTR_ERR(ctx->phymap); in devm_regmap_init_encx24j600()