• Home
  • Raw
  • Download

Lines Matching refs:br

184 static int br_trans_tx_prepare(struct spi_avmm_bridge *br, bool is_read, u32 reg,  in br_trans_tx_prepare()  argument
205 header = (struct trans_req_header *)br->trans_buf; in br_trans_tx_prepare()
215 if (trans_len > sizeof(br->trans_buf)) in br_trans_tx_prepare()
218 data = (__le32 *)(br->trans_buf + TRANS_REQ_HD_SIZE); in br_trans_tx_prepare()
225 br->trans_len = trans_len; in br_trans_tx_prepare()
253 static int br_pkt_phy_tx_prepare(struct spi_avmm_bridge *br) in br_pkt_phy_tx_prepare() argument
259 tb = br->trans_buf; in br_pkt_phy_tx_prepare()
260 tb_end = tb + br->trans_len; in br_pkt_phy_tx_prepare()
261 pb = br->phy_buf; in br_pkt_phy_tx_prepare()
262 pb_limit = pb + ARRAY_SIZE(br->phy_buf); in br_pkt_phy_tx_prepare()
315 br->phy_len = pb - br->phy_buf; in br_pkt_phy_tx_prepare()
317 if (br->word_len == 1) in br_pkt_phy_tx_prepare()
321 aligned_phy_len = ALIGN(br->phy_len, br->word_len); in br_pkt_phy_tx_prepare()
322 if (aligned_phy_len > sizeof(br->phy_buf)) in br_pkt_phy_tx_prepare()
325 if (aligned_phy_len == br->phy_len) in br_pkt_phy_tx_prepare()
330 memmove(&br->phy_buf[aligned_phy_len - move_size], pb_eop, move_size); in br_pkt_phy_tx_prepare()
333 memset(pb_eop, PHY_IDLE, aligned_phy_len - br->phy_len); in br_pkt_phy_tx_prepare()
336 br->phy_len = aligned_phy_len; in br_pkt_phy_tx_prepare()
345 static int br_do_tx(struct spi_avmm_bridge *br) in br_do_tx() argument
348 if (br->swap_words) in br_do_tx()
349 br->swap_words(br->phy_buf, br->phy_len); in br_do_tx()
352 return spi_write(br->spi, br->phy_buf, br->phy_len); in br_do_tx()
365 static int br_do_rx_and_pkt_phy_parse(struct spi_avmm_bridge *br) in br_do_rx_and_pkt_phy_parse() argument
369 struct device *dev = &br->spi->dev; in br_do_rx_and_pkt_phy_parse()
374 tb_limit = br->trans_buf + ARRAY_SIZE(br->trans_buf); in br_do_rx_and_pkt_phy_parse()
375 pb = br->phy_buf; in br_do_rx_and_pkt_phy_parse()
378 ret = spi_read(br->spi, pb, br->word_len); in br_do_rx_and_pkt_phy_parse()
383 if (br->swap_words) in br_do_rx_and_pkt_phy_parse()
384 br->swap_words(pb, br->word_len); in br_do_rx_and_pkt_phy_parse()
387 for (i = 0; i < br->word_len; i++) { in br_do_rx_and_pkt_phy_parse()
418 tb = br->trans_buf; in br_do_rx_and_pkt_phy_parse()
464 br->trans_len = tb - br->trans_buf; in br_do_rx_and_pkt_phy_parse()
506 static int br_rd_trans_rx_parse(struct spi_avmm_bridge *br, in br_rd_trans_rx_parse() argument
509 unsigned int i, trans_len = br->trans_len; in br_rd_trans_rx_parse()
515 data = (__le32 *)br->trans_buf; in br_rd_trans_rx_parse()
526 static int br_wr_trans_rx_parse(struct spi_avmm_bridge *br, in br_wr_trans_rx_parse() argument
529 unsigned int trans_len = br->trans_len; in br_wr_trans_rx_parse()
537 resp = (struct trans_resp_header *)br->trans_buf; in br_wr_trans_rx_parse()
555 struct spi_avmm_bridge *br = context; in do_reg_access() local
559 br->trans_len = 0; in do_reg_access()
560 br->phy_len = 0; in do_reg_access()
562 ret = br_trans_tx_prepare(br, is_read, reg, value, count); in do_reg_access()
566 ret = br_pkt_phy_tx_prepare(br); in do_reg_access()
570 ret = br_do_tx(br); in do_reg_access()
574 ret = br_do_rx_and_pkt_phy_parse(br); in do_reg_access()
579 return br_rd_trans_rx_parse(br, value, count); in do_reg_access()
581 return br_wr_trans_rx_parse(br, count); in do_reg_access()
625 struct spi_avmm_bridge *br; in spi_avmm_bridge_ctx_gen() local
639 br = kzalloc(sizeof(*br), GFP_KERNEL); in spi_avmm_bridge_ctx_gen()
640 if (!br) in spi_avmm_bridge_ctx_gen()
643 br->spi = spi; in spi_avmm_bridge_ctx_gen()
644 br->word_len = spi->bits_per_word / 8; in spi_avmm_bridge_ctx_gen()
645 if (br->word_len == 4) { in spi_avmm_bridge_ctx_gen()
651 br->swap_words = br_swap_words_32; in spi_avmm_bridge_ctx_gen()
654 return br; in spi_avmm_bridge_ctx_gen()