Add support for transferring data between external modem and host processor using MHI protocol. This is based on the patch submitted by Sujeev Dias: https://lkml.org/lkml/2018/7/9/988
Showing the changes to include/linux (1 of 5 files). Show all
Unified · Split
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <linux/dma-direction.h> |
| 11 | 11 | #include <linux/mutex.h> |
| 12 | 12 | #include <linux/rwlock_types.h> |
| 13 | +#include <linux/skbuff.h> | |
| 13 | 14 | #include <linux/slab.h> |
| 14 | 15 | #include <linux/spinlock_types.h> |
| 15 | 16 | #include <linux/wait.h> |
| @@ -336,6 +337,8 @@ struct mhi_controller_config { · 320 unmodified lines | ||
| 336 | 337 | * @wake_toggle: CB function to assert and de-assert device wake (optional) |
| 337 | 338 | * @runtime_get: CB function to controller runtime resume (required) |
| 338 | 339 | * @runtimet_put: CB function to decrement pm usage (required) |
| 340 | + * @map_single: CB function to create TRE buffer | |
| 341 | + * @unmap_single: CB function to destroy TRE buffer | |
| 339 | 342 | * @buffer_len: Bounce buffer length |
| 340 | 343 | * @bounce_buf: Use of bounce buffer |
| 341 | 344 | * @fbc_download: MHI host needs to do complete image transfer (optional) |
| @@ -403,6 +406,10 @@ struct mhi_controller { · 61 unmodified lines | ||
| 403 | 406 | void (*wake_toggle)(struct mhi_controller *mhi_cntrl); |
| 404 | 407 | int (*runtime_get)(struct mhi_controller *mhi_cntrl); |
| 405 | 408 | void (*runtime_put)(struct mhi_controller *mhi_cntrl); |
| 409 | + int (*map_single)(struct mhi_controller *mhi_cntrl, | |
| 410 | + struct mhi_buf_info *buf); | |
| 411 | + void (*unmap_single)(struct mhi_controller *mhi_cntrl, | |
| 412 | + struct mhi_buf_info *buf); | |
| 406 | 413 | |
| 407 | 414 | size_t buffer_len; |
| 408 | 415 | bool bounce_buf; |
| @@ -583,4 +590,77 @@ int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl); · 174 unmodified lines | ||
| 583 | 590 | */ |
| 584 | 591 | enum mhi_state mhi_get_mhi_state(struct mhi_controller *mhi_cntrl); |
| 585 | 592 | |
| 593 | +/** | |
| 594 | + * mhi_device_get - Disable device low power mode | |
| 595 | + * @mhi_dev: Device associated with the channel | |
| 596 | + */ | |
| 597 | +void mhi_device_get(struct mhi_device *mhi_dev); | |
| 598 | + | |
| 599 | +/** | |
| 600 | + * mhi_device_get_sync - Disable device low power mode. Synchronously | |
| 601 | + * take the controller out of suspended state | |
| 602 | + * @mhi_dev: Device associated with the channel | |
| 603 | + */ | |
| 604 | +int mhi_device_get_sync(struct mhi_device *mhi_dev); | |
| 605 | + | |
| 606 | +/** | |
| 607 | + * mhi_device_put - Re-enable device low power mode | |
| 608 | + * @mhi_dev: Device associated with the channel | |
| 609 | + */ | |
| 610 | +void mhi_device_put(struct mhi_device *mhi_dev); | |
| 611 | + | |
| 612 | +/** | |
| 613 | + * mhi_prepare_for_transfer - Setup channel for data transfer | |
| 614 | + * @mhi_dev: Device associated with the channels | |
| 615 | + */ | |
| 616 | +int mhi_prepare_for_transfer(struct mhi_device *mhi_dev); | |
| 617 | + | |
| 618 | +/** | |
| 619 | + * mhi_unprepare_from_transfer - Unprepare the channels | |
| 620 | + * @mhi_dev: Device associated with the channels | |
| 621 | + */ | |
| 622 | +void mhi_unprepare_from_transfer(struct mhi_device *mhi_dev); | |
| 623 | + | |
| 624 | +/** | |
| 625 | + * mhi_poll - Poll for any available data in DL direction | |
| 626 | + * @mhi_dev: Device associated with the channels | |
| 627 | + * @budget: # of events to process | |
| 628 | + */ | |
| 629 | +int mhi_poll(struct mhi_device *mhi_dev, u32 budget); | |
| 630 | + | |
| 631 | +/** | |
| 632 | + * mhi_queue_dma - Send or receive DMA mapped buffers from client device | |
| 633 | + * over MHI channel | |
| 634 | + * @mhi_dev: Device associated with the channels | |
| 635 | + * @dir: DMA direction for the channel | |
| 636 | + * @mhi_buf: Buffer for holding the DMA mapped data | |
| 637 | + * @len: Buffer length | |
| 638 | + * @mflags: MHI transfer flags used for the transfer | |
| 639 | + */ | |
| 640 | +int mhi_queue_dma(struct mhi_device *mhi_dev, enum dma_data_direction dir, | |
| 641 | + struct mhi_buf *mhi_buf, size_t len, enum mhi_flags mflags); | |
| 642 | + | |
| 643 | +/** | |
| 644 | + * mhi_queue_buf - Send or receive raw buffers from client device over MHI | |
| 645 | + * channel | |
| 646 | + * @mhi_dev: Device associated with the channels | |
| 647 | + * @dir: DMA direction for the channel | |
| 648 | + * @buf: Buffer for holding the data | |
| 649 | + * @len: Buffer length | |
| 650 | + * @mflags: MHI transfer flags used for the transfer | |
| 651 | + */ | |
| 652 | +int mhi_queue_buf(struct mhi_device *mhi_dev, enum dma_data_direction dir, | |
| 653 | + void *buf, size_t len, enum mhi_flags mflags); | |
| 654 | + | |
| 655 | +/** | |
| 656 | + * mhi_queue_skb - Send or receive SKBs from client device over MHI channel | |
| 657 | + * @mhi_dev: Device associated with the channels | |
| 658 | + * @dir: DMA direction for the channel | |
| 659 | + * @skb: Buffer for holding SKBs | |
| 660 | + * @len: Buffer length | |
| 661 | + * @mflags: MHI transfer flags used for the transfer | |
| 662 | + */ | |
| 663 | +int mhi_queue_skb(struct mhi_device *mhi_dev, enum dma_data_direction dir, | |
| 664 | + struct sk_buff *skb, size_t len, enum mhi_flags mflags); | |
| 665 | + | |
| 586 | 666 | #endif /* _MHI_H_ */ |