greybus: uart: Add credits based tracking for transmit path
commita8bc00fb88037e0107a0682478f47396a073be5c
authorAxel Haslam <ahaslam@baylibre.com>
Tue, 31 May 2016 12:36:11 +0000 (31 14:36 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 1 Jun 2016 00:18:18 +0000 (31 17:18 -0700)
tree13f4d67f6f6618e6ca02f8a45e310538158ca8eb
parent8d6fbe9bf9947ee875c222a2e33d5977e2d052f2
greybus: uart: Add credits based tracking for transmit path

To avoid polling the firmware for space, a credit based system
is implemented.

The host will keep track of how many credits (bytes) it has
sent to the firmware, and stop sending data when the quota
is filled.

The host will be informed that the firmware has more
room for data when it handles the receive_credits request
message from the firmware, and will continue to write data
as credits become available.

The firmware and the host may implement an algorithm to aggregate
credits, and avoid extra greybus traffic.

Suggested-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/uart.c