summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/uart.c
AgeCommit message (Collapse)Author
2015-08-10greybus: uart: Use (already defined) major/minor macrosViresh Kumar
We already have macros for these, use them instead of writing fixed values. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-14greybus: uart: fix typo in defintionBryan O'Donoghue
Fixing needless redefinition of operation types in gbsim reveals this typo GB_UART_TYPE_SET_BREAK -> GB_UART_TYPE_SEND_BREAK. This patch should be applied in lock-step to the patch to gbsim 'gbsim/uart: remove unnecessary redefinition of operation types' since gbsim does not contain the typo. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-08greybus: properly cleanup ida and idr structures when shutting downGreg Kroah-Hartman
idr and ida structures have internal memory allocated that needs to be freed when modules are removed. So call the proper idr_destroy() or ida_destroy() functions on the module exit path to free the memory. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Alex Elder <elder@linaro.org>
2015-07-01greybus: Rename gb_gpbridge_protocol_driver() as gb_builtin_protocol_driver()Viresh Kumar
This macro is also required by core protocols like control and svc, and hence the 'gpbridge' name doesn't fit anymore. Lets call this macro gb_builtin_protocol_driver(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-30greybus: uart: Update UART to reflect field size changesBryan O'Donoghue
The greybus UART protocol specification was updated to reduce the size of the control field in serial-state-request and line-state-request. This patch updates the kernel protocol driver to reflect the specification changes. Once applied gbsim changes will be also be updated automatically since gbsim depends on the header being modified directly. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-30greybus: uart: Add support for UART error signalsBryan O'Donoghue
After reviewing the UART specification for greybus break, parity, framing and over-run errors were moved to the receive-data message. This patch implements that specification change in the UART protocol driver. Matching code in gbsim has been tested with this change. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-17greybus: uart: Latch modem control signals for tciomgetBryan O'Donoghue
Latch signals coming from UART module for - GB_UART_CTRL_DCD - GB_UART_CTRL_DSR - GB_UART_CTRL_RI Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-11greybus: uart: fix the clean up while uart initiates connection unsucessfullyPhong Tran
There is lack of unregister and free the tty driver. This patch fixes it. Signed-off-by: Phong Tran <tranmanphong@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-09greybus: uart: remove the redundant unregister chrdevPhong Tran
The unregister_chrdev_region() does twice here. The chrdev region was unregistered inside tty_unregister_driver(). Signed-off-by: Phong Tran <tranmanphong@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-08greybus: uart: properly interpret receive data sizeAlex Elder
In gb_uart_request_recv(), the receive data size is in little-endian format. Do the proper byte swapping of that value before using it. Found by "make check". Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: Remove magic numbers make struct gb_tty variable names consistentBryan O'Donoghue
Use defines for the data format command. Tidy up naming of gb_tty variables. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: Add gb_uart_request_recv for receiving async UART dataBryan O'Donoghue
gb_uart_request_recv job in life is to process unsolicited greybus mesages from the UART. Hook the incoming UART data and pass to the TTY layer. Line-state changes still TBD. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: kmalloc for send_data once onlyBryan O'Donoghue
Make kmalloc for the send buffer a one time alloc based on the MTU for a given greybus link. The write_room for an gb_operation_sync then will be the size of the buffer we use for a single operation. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: send_data should return size or errorBryan O'Donoghue
gb_operation_sync returns 0 on success but the calling function expects the number of bytes written on success or a negative errno Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: Update uart.c to register tty portsBryan O'Donoghue
For each new UART connection we need to do a tty_port_init else we'll crash when trying to access the tty mutex later on. Base the TTY major/minor numbers on non-zero values. Supply an empty operations structure for the newly regitered port. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: Reduce UART count from 255 to 16Bryan O'Donoghue
Arbitrary number 255 is both not aligned and probably too big. Move the UART count down to 16 which is still large but, more realistic. 8 may be too few for future testing setups, 16 should accomodate any. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: Tidy naming convention to more closely match specBryan O'Donoghue
Update tabs and naming of structures to match the naming used in the greybus specification more closely. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: Move UART protocol structs/defines to greybus_protocols.hBryan O'Donoghue
gbsim depends on the structures and defines in greybus_protocols.h generally in order to simulate firmware. Move UART defines into this header to facilitate. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-04greybus: uart: Fix the memory leak in connection initPhong Tran
If alloc minor is error, gb_tty should free. Signed-off-by: Phong Tran <tranmanphong@gmail.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-20greybus: Use gb_gpbridge_protocol_init()Viresh Kumar
Start using gb_gpbridge_protocol_init() in gpbridge drivers. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-07greybus: eliminate extra response flag definitionsAlex Elder
All protocols use the same value to distinguish between request and response message types. This is a requirement. Use GB_MESSAGE_TYPE_RESPONSE rather than GB_OPERATION_TYPE_RESPONSE for the name of the flag used to distiguish between request and response messages. Get rid of the redundant response flag definitions that are associated with specific protocols. Describe the symbolic values as "operation types" rather than "message types" where they are defined. The message type for a request is the same as the operation type; the message type for a response is the operation type OR'd with GB_MESSAGE_TYPE_RESPONSE. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-03-17greybus: uart: remove packed-attribute from line-coding structJohan Hovold
Remove packed-attribute from line-coding struct, whose members are all naturally aligned. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-22greybus: remove unused version-response structsViresh Kumar
These aren't used anymore and so can be removed. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-22greybus: create get_version() routines with the help of a macroViresh Kumar
This gets rid of lots of duplication of code. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-22greybus: uart: s/REQ/TYPEViresh Kumar
Request type for all other protocols is defined like: GB_<protocol>_TYPE_<operation>, but for UART is like: GB_<protocol>_REQ_<operation>. Replace REQ with TYPE to make it consistent. It will also be useful in a later patch that creates get_version() routines with the help of a macro. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-22greybus: Remove "-gb" suffix from .c filesViresh Kumar
Some files are prefixed with "gb-" and some are suffixed with "-gb". The rationale behind the first one is that the modules would be named so, i.e. gb-*.ko. But there is no reason to keep the "-gb" suffix in the second case. Remove the unnecessary suffix. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>