Commit 933aae54bea7d032023a59e0b3261b612f8065e0
Committed by
Greg Kroah-Hartman
1 parent
18ccecf99a
Exists in
master
and in
6 other branches
drivers:misc: ti-st: DEBUG uart, baud rate mods
To debug different UARTs at different baud-rates connected to the WiLink connectivity combo-chipset, this patch enables the debugging code so that upon boot different UARTs at different baud-rates can be tried out to verify the interface with WiLink. Signed-off-by: Pavan Savoy <pavan_savoy@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 1 changed file with 30 additions and 0 deletions Side-by-side Diff
drivers/misc/ti-st/st_kim.c
... | ... | @@ -573,6 +573,28 @@ |
573 | 573 | return sprintf(buf, "%d\n", kim_data->ldisc_install); |
574 | 574 | } |
575 | 575 | |
576 | +#ifdef DEBUG | |
577 | +static ssize_t store_dev_name(struct device *dev, | |
578 | + struct device_attribute *attr, const char *buf, size_t count) | |
579 | +{ | |
580 | + struct kim_data_s *kim_data = dev_get_drvdata(dev); | |
581 | + pr_debug("storing dev name >%s<", buf); | |
582 | + strncpy(kim_data->dev_name, buf, count); | |
583 | + pr_debug("stored dev name >%s<", kim_data->dev_name); | |
584 | + return count; | |
585 | +} | |
586 | + | |
587 | +static ssize_t store_baud_rate(struct device *dev, | |
588 | + struct device_attribute *attr, const char *buf, size_t count) | |
589 | +{ | |
590 | + struct kim_data_s *kim_data = dev_get_drvdata(dev); | |
591 | + pr_debug("storing baud rate >%s<", buf); | |
592 | + sscanf(buf, "%ld", &kim_data->baud_rate); | |
593 | + pr_debug("stored baud rate >%ld<", kim_data->baud_rate); | |
594 | + return count; | |
595 | +} | |
596 | +#endif /* if DEBUG */ | |
597 | + | |
576 | 598 | static ssize_t show_dev_name(struct device *dev, |
577 | 599 | struct device_attribute *attr, char *buf) |
578 | 600 | { |
579 | 601 | |
580 | 602 | |
581 | 603 | |
... | ... | @@ -599,10 +621,18 @@ |
599 | 621 | __ATTR(install, 0444, (void *)show_install, NULL); |
600 | 622 | |
601 | 623 | static struct kobj_attribute uart_dev_name = |
624 | +#ifdef DEBUG /* TODO: move this to debug-fs if possible */ | |
625 | +__ATTR(dev_name, 0644, (void *)show_dev_name, (void *)store_dev_name); | |
626 | +#else | |
602 | 627 | __ATTR(dev_name, 0444, (void *)show_dev_name, NULL); |
628 | +#endif | |
603 | 629 | |
604 | 630 | static struct kobj_attribute uart_baud_rate = |
631 | +#ifdef DEBUG /* TODO: move to debugfs */ | |
632 | +__ATTR(baud_rate, 0644, (void *)show_baud_rate, (void *)store_baud_rate); | |
633 | +#else | |
605 | 634 | __ATTR(baud_rate, 0444, (void *)show_baud_rate, NULL); |
635 | +#endif | |
606 | 636 | |
607 | 637 | static struct kobj_attribute uart_flow_cntrl = |
608 | 638 | __ATTR(flow_cntrl, 0444, (void *)show_flow_cntrl, NULL); |