Lines Matching +full:5 +full:bg

204 static void hdlc_rx_greybus_frame(struct gb_beagleplay *bg, u8 *buf, u16 len)  in hdlc_rx_greybus_frame()  argument
210 dev_dbg(&bg->sd->dev, "Greybus Operation %u type %X cport %u status %u received", in hdlc_rx_greybus_frame()
213 greybus_data_rcvd(bg->gb_hd, cport_id, (u8 *)&gb_frame->hdr, gb_msg_len); in hdlc_rx_greybus_frame()
216 static void hdlc_rx_dbg_frame(const struct gb_beagleplay *bg, const char *buf, u16 len) in hdlc_rx_dbg_frame() argument
218 dev_dbg(&bg->sd->dev, "CC1352 Log: %.*s", (int)len, buf); in hdlc_rx_dbg_frame()
223 * @bg: beagleplay greybus driver
227 static void hdlc_write(struct gb_beagleplay *bg) in hdlc_write() argument
231 int head = smp_load_acquire(&bg->tx_circ_buf.head); in hdlc_write()
232 int tail = bg->tx_circ_buf.tail; in hdlc_write()
234 const unsigned char *buf = &bg->tx_circ_buf.buf[tail]; in hdlc_write()
237 written = serdev_device_write_buf(bg->sd, buf, count); in hdlc_write()
240 smp_store_release(&bg->tx_circ_buf.tail, (tail + written) & (TX_CIRC_BUF_SIZE - 1)); in hdlc_write()
246 * @bg: beagleplay greybus driver
251 static void hdlc_append(struct gb_beagleplay *bg, u8 value) in hdlc_append() argument
253 int tail, head = bg->tx_circ_buf.head; in hdlc_append()
256 tail = READ_ONCE(bg->tx_circ_buf.tail); in hdlc_append()
259 bg->tx_circ_buf.buf[head] = value; in hdlc_append()
262 smp_store_release(&bg->tx_circ_buf.head, in hdlc_append()
266 dev_warn(&bg->sd->dev, "Tx circ buf full"); in hdlc_append()
271 static void hdlc_append_escaped(struct gb_beagleplay *bg, u8 value) in hdlc_append_escaped() argument
274 hdlc_append(bg, HDLC_ESC); in hdlc_append_escaped()
277 hdlc_append(bg, value); in hdlc_append_escaped()
280 static void hdlc_append_tx_frame(struct gb_beagleplay *bg) in hdlc_append_tx_frame() argument
282 bg->tx_crc = 0xFFFF; in hdlc_append_tx_frame()
283 hdlc_append(bg, HDLC_FRAME); in hdlc_append_tx_frame()
286 static void hdlc_append_tx_u8(struct gb_beagleplay *bg, u8 value) in hdlc_append_tx_u8() argument
288 bg->tx_crc = crc_ccitt(bg->tx_crc, &value, 1); in hdlc_append_tx_u8()
289 hdlc_append_escaped(bg, value); in hdlc_append_tx_u8()
292 static void hdlc_append_tx_buf(struct gb_beagleplay *bg, const u8 *buf, u16 len) in hdlc_append_tx_buf() argument
297 hdlc_append_tx_u8(bg, buf[i]); in hdlc_append_tx_buf()
300 static void hdlc_append_tx_crc(struct gb_beagleplay *bg) in hdlc_append_tx_crc() argument
302 bg->tx_crc ^= 0xffff; in hdlc_append_tx_crc()
303 hdlc_append_escaped(bg, bg->tx_crc & 0xff); in hdlc_append_tx_crc()
304 hdlc_append_escaped(bg, (bg->tx_crc >> 8) & 0xff); in hdlc_append_tx_crc()
309 struct gb_beagleplay *bg = container_of(work, struct gb_beagleplay, tx_work); in hdlc_transmit() local
311 spin_lock_bh(&bg->tx_consumer_lock); in hdlc_transmit()
312 hdlc_write(bg); in hdlc_transmit()
313 spin_unlock_bh(&bg->tx_consumer_lock); in hdlc_transmit()
316 static void hdlc_tx_frames(struct gb_beagleplay *bg, u8 address, u8 control, in hdlc_tx_frames() argument
321 spin_lock(&bg->tx_producer_lock); in hdlc_tx_frames()
323 hdlc_append_tx_frame(bg); in hdlc_tx_frames()
324 hdlc_append_tx_u8(bg, address); in hdlc_tx_frames()
325 hdlc_append_tx_u8(bg, control); in hdlc_tx_frames()
328 hdlc_append_tx_buf(bg, payloads[i].buf, payloads[i].len); in hdlc_tx_frames()
330 hdlc_append_tx_crc(bg); in hdlc_tx_frames()
331 hdlc_append_tx_frame(bg); in hdlc_tx_frames()
333 spin_unlock(&bg->tx_producer_lock); in hdlc_tx_frames()
335 schedule_work(&bg->tx_work); in hdlc_tx_frames()
338 static void hdlc_tx_s_frame_ack(struct gb_beagleplay *bg) in hdlc_tx_s_frame_ack() argument
340 hdlc_tx_frames(bg, bg->rx_buffer[0], (bg->rx_buffer[1] >> 1) & 0x7, NULL, 0); in hdlc_tx_s_frame_ack()
343 static void hdlc_rx_frame(struct gb_beagleplay *bg) in hdlc_rx_frame() argument
347 u8 address = bg->rx_buffer[0]; in hdlc_rx_frame()
349 crc = crc_ccitt(0xffff, bg->rx_buffer, bg->rx_buffer_len); in hdlc_rx_frame()
351 dev_warn_ratelimited(&bg->sd->dev, "CRC failed from %02x: 0x%04x", address, crc); in hdlc_rx_frame()
355 ctrl = bg->rx_buffer[1]; in hdlc_rx_frame()
356 buf = &bg->rx_buffer[2]; in hdlc_rx_frame()
357 len = bg->rx_buffer_len - 4; in hdlc_rx_frame()
361 hdlc_tx_s_frame_ack(bg); in hdlc_rx_frame()
365 hdlc_rx_dbg_frame(bg, buf, len); in hdlc_rx_frame()
368 hdlc_rx_greybus_frame(bg, buf, len); in hdlc_rx_frame()
371 dev_warn_ratelimited(&bg->sd->dev, "unknown frame %u", address); in hdlc_rx_frame()
375 static size_t hdlc_rx(struct gb_beagleplay *bg, const u8 *data, size_t count) in hdlc_rx() argument
385 if (bg->rx_buffer_len) in hdlc_rx()
386 hdlc_rx_frame(bg); in hdlc_rx()
388 bg->rx_buffer_len = 0; in hdlc_rx()
391 bg->rx_in_esc = true; in hdlc_rx()
394 if (bg->rx_in_esc) { in hdlc_rx()
396 bg->rx_in_esc = false; in hdlc_rx()
399 if (bg->rx_buffer_len < MAX_RX_HDLC) { in hdlc_rx()
400 bg->rx_buffer[bg->rx_buffer_len] = c; in hdlc_rx()
401 bg->rx_buffer_len++; in hdlc_rx()
403 dev_err_ratelimited(&bg->sd->dev, "RX Buffer Overflow"); in hdlc_rx()
404 bg->rx_buffer_len = 0; in hdlc_rx()
412 static int hdlc_init(struct gb_beagleplay *bg) in hdlc_init() argument
414 INIT_WORK(&bg->tx_work, hdlc_transmit); in hdlc_init()
415 spin_lock_init(&bg->tx_producer_lock); in hdlc_init()
416 spin_lock_init(&bg->tx_consumer_lock); in hdlc_init()
417 bg->tx_circ_buf.head = 0; in hdlc_init()
418 bg->tx_circ_buf.tail = 0; in hdlc_init()
420 bg->tx_circ_buf.buf = devm_kmalloc(&bg->sd->dev, TX_CIRC_BUF_SIZE, GFP_KERNEL); in hdlc_init()
421 if (!bg->tx_circ_buf.buf) in hdlc_init()
424 bg->rx_buffer_len = 0; in hdlc_init()
425 bg->rx_in_esc = false; in hdlc_init()
430 static void hdlc_deinit(struct gb_beagleplay *bg) in hdlc_deinit() argument
432 flush_work(&bg->tx_work); in hdlc_deinit()
453 static void cc1352_bootloader_send_ack(struct gb_beagleplay *bg) in cc1352_bootloader_send_ack() argument
457 serdev_device_write_buf(bg->sd, ack, sizeof(ack)); in cc1352_bootloader_send_ack()
460 static void cc1352_bootloader_send_nack(struct gb_beagleplay *bg) in cc1352_bootloader_send_nack() argument
464 serdev_device_write_buf(bg->sd, nack, sizeof(nack)); in cc1352_bootloader_send_nack()
470 * @bg: beagleplay greybus driver
487 * 5. Send an acknowledge byte or a not-acknowledge byte to the device to
490 static int cc1352_bootloader_pkt_rx(struct gb_beagleplay *bg, const u8 *data, in cc1352_bootloader_pkt_rx() argument
501 WRITE_ONCE(bg->fwl_ack, data[0]); in cc1352_bootloader_pkt_rx()
502 complete(&bg->fwl_ack_com); in cc1352_bootloader_pkt_rx()
508 WRITE_ONCE(bg->fwl_cmd_response, (u32)data[2]); in cc1352_bootloader_pkt_rx()
514 WRITE_ONCE(bg->fwl_cmd_response, get_unaligned_be32(&data[2])); in cc1352_bootloader_pkt_rx()
521 cc1352_bootloader_send_ack(bg); in cc1352_bootloader_pkt_rx()
522 complete(&bg->fwl_cmd_response_com); in cc1352_bootloader_pkt_rx()
524 dev_warn(&bg->sd->dev, in cc1352_bootloader_pkt_rx()
526 cc1352_bootloader_send_nack(bg); in cc1352_bootloader_pkt_rx()
532 static size_t cc1352_bootloader_rx(struct gb_beagleplay *bg, const u8 *data, in cc1352_bootloader_rx() argument
538 memcpy(bg->rx_buffer + bg->rx_buffer_len, data, count); in cc1352_bootloader_rx()
539 bg->rx_buffer_len += count; in cc1352_bootloader_rx()
542 ret = cc1352_bootloader_pkt_rx(bg, bg->rx_buffer + off, in cc1352_bootloader_rx()
543 bg->rx_buffer_len - off); in cc1352_bootloader_rx()
545 return dev_err_probe(&bg->sd->dev, ret, in cc1352_bootloader_rx()
550 bg->rx_buffer_len -= off; in cc1352_bootloader_rx()
551 memmove(bg->rx_buffer, bg->rx_buffer + off, bg->rx_buffer_len); in cc1352_bootloader_rx()
559 struct gb_beagleplay *bg = serdev_device_get_drvdata(sd); in gb_tty_receive() local
561 if (READ_ONCE(bg->flashing_mode)) in gb_tty_receive()
562 return cc1352_bootloader_rx(bg, data, count); in gb_tty_receive()
564 return hdlc_rx(bg, data, count); in gb_tty_receive()
569 struct gb_beagleplay *bg = serdev_device_get_drvdata(serdev); in gb_tty_wakeup() local
571 if (!READ_ONCE(bg->flashing_mode)) in gb_tty_wakeup()
572 schedule_work(&bg->tx_work); in gb_tty_wakeup()
595 struct gb_beagleplay *bg = dev_get_drvdata(&hd->dev); in gb_message_send() local
612 hdlc_tx_frames(bg, ADDRESS_GREYBUS, 0x03, payloads, 3); in gb_message_send()
613 greybus_message_sent(bg->gb_hd, msg, 0); in gb_message_send()
625 static void gb_beagleplay_start_svc(struct gb_beagleplay *bg) in gb_beagleplay_start_svc() argument
630 hdlc_tx_frames(bg, ADDRESS_CONTROL, 0x03, &payload, 1); in gb_beagleplay_start_svc()
633 static void gb_beagleplay_stop_svc(struct gb_beagleplay *bg) in gb_beagleplay_stop_svc() argument
638 hdlc_tx_frames(bg, ADDRESS_CONTROL, 0x03, &payload, 1); in gb_beagleplay_stop_svc()
641 static int cc1352_bootloader_wait_for_ack(struct gb_beagleplay *bg) in cc1352_bootloader_wait_for_ack() argument
646 &bg->fwl_ack_com, msecs_to_jiffies(CC1352_BOOTLOADER_TIMEOUT)); in cc1352_bootloader_wait_for_ack()
648 return dev_err_probe(&bg->sd->dev, ret, in cc1352_bootloader_wait_for_ack()
651 switch (READ_ONCE(bg->fwl_ack)) { in cc1352_bootloader_wait_for_ack()
661 static int cc1352_bootloader_sync(struct gb_beagleplay *bg) in cc1352_bootloader_sync() argument
665 serdev_device_write_buf(bg->sd, sync_bytes, sizeof(sync_bytes)); in cc1352_bootloader_sync()
666 return cc1352_bootloader_wait_for_ack(bg); in cc1352_bootloader_sync()
669 static int cc1352_bootloader_get_status(struct gb_beagleplay *bg) in cc1352_bootloader_get_status() argument
678 serdev_device_write_buf(bg->sd, (const u8 *)&pkt, sizeof(pkt)); in cc1352_bootloader_get_status()
679 ret = cc1352_bootloader_wait_for_ack(bg); in cc1352_bootloader_get_status()
684 &bg->fwl_cmd_response_com, in cc1352_bootloader_get_status()
687 return dev_err_probe(&bg->sd->dev, ret, in cc1352_bootloader_get_status()
690 switch (READ_ONCE(bg->fwl_cmd_response)) { in cc1352_bootloader_get_status()
700 static int cc1352_bootloader_erase(struct gb_beagleplay *bg) in cc1352_bootloader_erase() argument
709 serdev_device_write_buf(bg->sd, (const u8 *)&pkt, sizeof(pkt)); in cc1352_bootloader_erase()
711 ret = cc1352_bootloader_wait_for_ack(bg); in cc1352_bootloader_erase()
715 return cc1352_bootloader_get_status(bg); in cc1352_bootloader_erase()
718 static int cc1352_bootloader_reset(struct gb_beagleplay *bg) in cc1352_bootloader_reset() argument
726 serdev_device_write_buf(bg->sd, (const u8 *)&pkt, sizeof(pkt)); in cc1352_bootloader_reset()
728 return cc1352_bootloader_wait_for_ack(bg); in cc1352_bootloader_reset()
747 static int cc1352_bootloader_crc32(struct gb_beagleplay *bg, u32 *crc32) in cc1352_bootloader_crc32() argument
760 serdev_device_write_buf(bg->sd, (const u8 *)&pkt, sizeof(pkt)); in cc1352_bootloader_crc32()
761 serdev_device_write_buf(bg->sd, (const u8 *)&cmd_data, in cc1352_bootloader_crc32()
764 ret = cc1352_bootloader_wait_for_ack(bg); in cc1352_bootloader_crc32()
769 &bg->fwl_cmd_response_com, in cc1352_bootloader_crc32()
772 return dev_err_probe(&bg->sd->dev, ret, in cc1352_bootloader_crc32()
775 *crc32 = READ_ONCE(bg->fwl_cmd_response); in cc1352_bootloader_crc32()
780 static int cc1352_bootloader_download(struct gb_beagleplay *bg, u32 size, in cc1352_bootloader_download() argument
795 serdev_device_write_buf(bg->sd, (const u8 *)&pkt, sizeof(pkt)); in cc1352_bootloader_download()
796 serdev_device_write_buf(bg->sd, (const u8 *)&cmd_data, in cc1352_bootloader_download()
799 ret = cc1352_bootloader_wait_for_ack(bg); in cc1352_bootloader_download()
803 return cc1352_bootloader_get_status(bg); in cc1352_bootloader_download()
806 static int cc1352_bootloader_send_data(struct gb_beagleplay *bg, const u8 *data, in cc1352_bootloader_send_data() argument
816 serdev_device_write_buf(bg->sd, (const u8 *)&pkt, sizeof(pkt)); in cc1352_bootloader_send_data()
817 serdev_device_write_buf(bg->sd, data, rem); in cc1352_bootloader_send_data()
819 ret = cc1352_bootloader_wait_for_ack(bg); in cc1352_bootloader_send_data()
823 ret = cc1352_bootloader_get_status(bg); in cc1352_bootloader_send_data()
830 static void gb_greybus_deinit(struct gb_beagleplay *bg) in gb_greybus_deinit() argument
832 gb_hd_del(bg->gb_hd); in gb_greybus_deinit()
833 gb_hd_put(bg->gb_hd); in gb_greybus_deinit()
836 static int gb_greybus_init(struct gb_beagleplay *bg) in gb_greybus_init() argument
840 bg->gb_hd = gb_hd_create(&gb_hdlc_driver, &bg->sd->dev, TX_CIRC_BUF_SIZE, GB_MAX_CPORTS); in gb_greybus_init()
841 if (IS_ERR(bg->gb_hd)) { in gb_greybus_init()
842 dev_err(&bg->sd->dev, "Failed to create greybus host device"); in gb_greybus_init()
843 return PTR_ERR(bg->gb_hd); in gb_greybus_init()
846 ret = gb_hd_add(bg->gb_hd); in gb_greybus_init()
848 dev_err(&bg->sd->dev, "Failed to add greybus host device"); in gb_greybus_init()
851 dev_set_drvdata(&bg->gb_hd->dev, bg); in gb_greybus_init()
856 gb_greybus_deinit(bg); in gb_greybus_init()
865 struct gb_beagleplay *bg = fw_upload->dd_handle; in cc1352_prepare() local
867 dev_info(&bg->sd->dev, "CC1352 Start Flashing..."); in cc1352_prepare()
873 gb_greybus_deinit(bg); in cc1352_prepare()
874 msleep(5 * MSEC_PER_SEC); in cc1352_prepare()
876 gb_beagleplay_stop_svc(bg); in cc1352_prepare()
878 flush_work(&bg->tx_work); in cc1352_prepare()
880 serdev_device_wait_until_sent(bg->sd, CC1352_BOOTLOADER_TIMEOUT); in cc1352_prepare()
882 WRITE_ONCE(bg->flashing_mode, true); in cc1352_prepare()
884 gpiod_direction_output(bg->bootloader_backdoor_gpio, 0); in cc1352_prepare()
885 gpiod_direction_output(bg->rst_gpio, 0); in cc1352_prepare()
888 gpiod_set_value(bg->rst_gpio, 1); in cc1352_prepare()
891 gpiod_set_value(bg->bootloader_backdoor_gpio, 1); in cc1352_prepare()
894 gpiod_direction_input(bg->bootloader_backdoor_gpio); in cc1352_prepare()
895 gpiod_direction_input(bg->rst_gpio); in cc1352_prepare()
897 ret = cc1352_bootloader_sync(bg); in cc1352_prepare()
899 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_HW_ERROR, in cc1352_prepare()
902 ret = cc1352_bootloader_crc32(bg, &curr_crc32); in cc1352_prepare()
904 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_HW_ERROR, in cc1352_prepare()
907 bg->fwl_crc32 = crc32(0xffffffff, data, size) ^ 0xffffffff; in cc1352_prepare()
910 if (bg->fwl_crc32 == curr_crc32) { in cc1352_prepare()
911 dev_warn(&bg->sd->dev, "Skipping reflashing same image"); in cc1352_prepare()
912 cc1352_bootloader_reset(bg); in cc1352_prepare()
913 WRITE_ONCE(bg->flashing_mode, false); in cc1352_prepare()
915 gb_greybus_init(bg); in cc1352_prepare()
916 gb_beagleplay_start_svc(bg); in cc1352_prepare()
920 ret = cc1352_bootloader_erase(bg); in cc1352_prepare()
922 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_HW_ERROR, in cc1352_prepare()
925 bg->fwl_reset_addr = true; in cc1352_prepare()
932 struct gb_beagleplay *bg = fw_upload->dd_handle; in cc1352_cleanup() local
934 WRITE_ONCE(bg->flashing_mode, false); in cc1352_cleanup()
943 struct gb_beagleplay *bg = fw_upload->dd_handle; in cc1352_write() local
948 bg->fwl_reset_addr = true; in cc1352_write()
953 if (bg->fwl_reset_addr) { in cc1352_write()
954 ret = cc1352_bootloader_download(bg, size, offset); in cc1352_write()
956 return dev_err_probe(&bg->sd->dev, in cc1352_write()
960 bg->fwl_reset_addr = false; in cc1352_write()
963 ret = cc1352_bootloader_send_data(bg, data + offset, size); in cc1352_write()
965 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_HW_ERROR, in cc1352_write()
975 struct gb_beagleplay *bg = fw_upload->dd_handle; in cc1352_poll_complete() local
977 if (cc1352_bootloader_crc32(bg, &curr_crc32) < 0) in cc1352_poll_complete()
978 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_HW_ERROR, in cc1352_poll_complete()
981 if (bg->fwl_crc32 != curr_crc32) in cc1352_poll_complete()
982 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_FW_INVALID, in cc1352_poll_complete()
985 if (cc1352_bootloader_reset(bg) < 0) in cc1352_poll_complete()
986 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_HW_ERROR, in cc1352_poll_complete()
989 dev_info(&bg->sd->dev, "CC1352 Flashing Successful"); in cc1352_poll_complete()
990 WRITE_ONCE(bg->flashing_mode, false); in cc1352_poll_complete()
993 if (gb_greybus_init(bg) < 0) in cc1352_poll_complete()
994 return dev_err_probe(&bg->sd->dev, FW_UPLOAD_ERR_RW_ERROR, in cc1352_poll_complete()
997 gb_beagleplay_start_svc(bg); in cc1352_poll_complete()
1004 struct gb_beagleplay *bg = fw_upload->dd_handle; in cc1352_cancel() local
1006 dev_info(&bg->sd->dev, "CC1352 Bootloader Cancel"); in cc1352_cancel()
1008 cc1352_bootloader_reset(bg); in cc1352_cancel()
1011 static void gb_serdev_deinit(struct gb_beagleplay *bg) in gb_serdev_deinit() argument
1013 serdev_device_close(bg->sd); in gb_serdev_deinit()
1016 static int gb_serdev_init(struct gb_beagleplay *bg) in gb_serdev_init() argument
1020 serdev_device_set_drvdata(bg->sd, bg); in gb_serdev_init()
1021 serdev_device_set_client_ops(bg->sd, &gb_beagleplay_ops); in gb_serdev_init()
1022 ret = serdev_device_open(bg->sd); in gb_serdev_init()
1024 return dev_err_probe(&bg->sd->dev, ret, "Unable to open serial device"); in gb_serdev_init()
1026 serdev_device_set_baudrate(bg->sd, 115200); in gb_serdev_init()
1027 serdev_device_set_flow_control(bg->sd, false); in gb_serdev_init()
1040 static int gb_fw_init(struct gb_beagleplay *bg) in gb_fw_init() argument
1046 bg->fwl = NULL; in gb_fw_init()
1047 bg->bootloader_backdoor_gpio = NULL; in gb_fw_init()
1048 bg->rst_gpio = NULL; in gb_fw_init()
1049 bg->flashing_mode = false; in gb_fw_init()
1050 bg->fwl_cmd_response = 0; in gb_fw_init()
1051 bg->fwl_ack = 0; in gb_fw_init()
1052 init_completion(&bg->fwl_ack_com); in gb_fw_init()
1053 init_completion(&bg->fwl_cmd_response_com); in gb_fw_init()
1055 desc = devm_gpiod_get(&bg->sd->dev, "bootloader-backdoor", GPIOD_IN); in gb_fw_init()
1058 bg->bootloader_backdoor_gpio = desc; in gb_fw_init()
1060 desc = devm_gpiod_get(&bg->sd->dev, "reset", GPIOD_IN); in gb_fw_init()
1065 bg->rst_gpio = desc; in gb_fw_init()
1067 fwl = firmware_upload_register(THIS_MODULE, &bg->sd->dev, "cc1352p7", in gb_fw_init()
1068 &cc1352_bootloader_ops, bg); in gb_fw_init()
1073 bg->fwl = fwl; in gb_fw_init()
1078 devm_gpiod_put(&bg->sd->dev, bg->rst_gpio); in gb_fw_init()
1079 bg->rst_gpio = NULL; in gb_fw_init()
1081 devm_gpiod_put(&bg->sd->dev, bg->bootloader_backdoor_gpio); in gb_fw_init()
1082 bg->bootloader_backdoor_gpio = NULL; in gb_fw_init()
1086 static void gb_fw_deinit(struct gb_beagleplay *bg) in gb_fw_deinit() argument
1088 firmware_upload_unregister(bg->fwl); in gb_fw_deinit()
1094 struct gb_beagleplay *bg; in gb_beagleplay_probe() local
1096 bg = devm_kmalloc(&serdev->dev, sizeof(*bg), GFP_KERNEL); in gb_beagleplay_probe()
1097 if (!bg) in gb_beagleplay_probe()
1100 bg->sd = serdev; in gb_beagleplay_probe()
1101 ret = gb_serdev_init(bg); in gb_beagleplay_probe()
1105 ret = hdlc_init(bg); in gb_beagleplay_probe()
1109 ret = gb_fw_init(bg); in gb_beagleplay_probe()
1113 ret = gb_greybus_init(bg); in gb_beagleplay_probe()
1117 gb_beagleplay_start_svc(bg); in gb_beagleplay_probe()
1122 gb_fw_deinit(bg); in gb_beagleplay_probe()
1124 hdlc_deinit(bg); in gb_beagleplay_probe()
1126 gb_serdev_deinit(bg); in gb_beagleplay_probe()
1132 struct gb_beagleplay *bg = serdev_device_get_drvdata(serdev); in gb_beagleplay_remove() local
1134 gb_fw_deinit(bg); in gb_beagleplay_remove()
1135 gb_greybus_deinit(bg); in gb_beagleplay_remove()
1136 gb_beagleplay_stop_svc(bg); in gb_beagleplay_remove()
1137 hdlc_deinit(bg); in gb_beagleplay_remove()
1138 gb_serdev_deinit(bg); in gb_beagleplay_remove()