History

Merge tag 'linux-can-fixes-for-4.2-20150825' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says: ==================== this is the updated pull request of one patch by me for the peak_usb driver. It fixes the driver, so that non FD adapters don't provide CAN FD bittimings. ====================

David S. Miller committed 11 years ago

Commit e732cdd2 parents 83bc805 06b23f75 files · +82 −70Browse files

Unified · Split

5 files
  1. drivers/net/can/usb/peak_usb/pcan_usb.c +13 −11
  2. drivers/net/can/usb/peak_usb/pcan_usb_core.c +2 −2
  3. drivers/net/can/usb/peak_usb/pcan_usb_core.h +2 −2
  4. drivers/net/can/usb/peak_usb/pcan_usb_fd.c +52 −44
  5. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +13 −11
drivers/net/can/usb/peak_usb/pcan_usb.c+13−11
@@ -854,6 +854,18 @@ static int pcan_usb_probe(struct usb_interface *intf) · 853 unmodified lines
854/*854/*
855 * describe the PCAN-USB adapter855 * describe the PCAN-USB adapter
856 */856 */
857static const struct can_bittiming_const pcan_usb_const = {
858 .name = "pcan_usb",
859 .tseg1_min = 1,
860 .tseg1_max = 16,
861 .tseg2_min = 1,
862 .tseg2_max = 8,
863 .sjw_max = 4,
864 .brp_min = 1,
865 .brp_max = 64,
866 .brp_inc = 1,
867};
868
857const struct peak_usb_adapter pcan_usb = {869const struct peak_usb_adapter pcan_usb = {
858 .name = "PCAN-USB",870 .name = "PCAN-USB",
859 .device_id = PCAN_USB_PRODUCT_ID,871 .device_id = PCAN_USB_PRODUCT_ID,
@@ -862,17 +874,7 @@ const struct peak_usb_adapter pcan_usb = { · 2 unmodified lines
862 .clock = {874 .clock = {
863 .freq = PCAN_USB_CRYSTAL_HZ / 2 ,875 .freq = PCAN_USB_CRYSTAL_HZ / 2 ,
864 },876 },
865 .bittiming_const = {877 .bittiming_const = &pcan_usb_const,
866 .name = "pcan_usb",
867 .tseg1_min = 1,
868 .tseg1_max = 16,
869 .tseg2_min = 1,
870 .tseg2_max = 8,
871 .sjw_max = 4,
872 .brp_min = 1,
873 .brp_max = 64,
874 .brp_inc = 1,
875 },
876 878
877 /* size of device private data */879 /* size of device private data */
878 .sizeof_dev_private = sizeof(struct pcan_usb),880 .sizeof_dev_private = sizeof(struct pcan_usb),
drivers/net/can/usb/peak_usb/pcan_usb_core.c+2−2
@@ -792,9 +792,9 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, · 791 unmodified lines
792 dev->ep_msg_out = peak_usb_adapter->ep_msg_out[ctrl_idx];792 dev->ep_msg_out = peak_usb_adapter->ep_msg_out[ctrl_idx];
793 793
794 dev->can.clock = peak_usb_adapter->clock;794 dev->can.clock = peak_usb_adapter->clock;
795 dev->can.bittiming_const = &peak_usb_adapter->bittiming_const;795 dev->can.bittiming_const = peak_usb_adapter->bittiming_const;
796 dev->can.do_set_bittiming = peak_usb_set_bittiming;796 dev->can.do_set_bittiming = peak_usb_set_bittiming;
797 dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const;797 dev->can.data_bittiming_const = peak_usb_adapter->data_bittiming_const;
798 dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming;798 dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming;
799 dev->can.do_set_mode = peak_usb_set_mode;799 dev->can.do_set_mode = peak_usb_set_mode;
800 dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter;800 dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter;
drivers/net/can/usb/peak_usb/pcan_usb_core.h+2−2
@@ -48,8 +48,8 @@ struct peak_usb_adapter { · 47 unmodified lines
48 u32 device_id;48 u32 device_id;
49 u32 ctrlmode_supported;49 u32 ctrlmode_supported;
50 struct can_clock clock;50 struct can_clock clock;
51 const struct can_bittiming_const bittiming_const;51 const struct can_bittiming_const * const bittiming_const;
52 const struct can_bittiming_const data_bittiming_const;52 const struct can_bittiming_const * const data_bittiming_const;
53 unsigned int ctrl_count;53 unsigned int ctrl_count;
54 54
55 int (*intf_probe)(struct usb_interface *intf);55 int (*intf_probe)(struct usb_interface *intf);
drivers/net/can/usb/peak_usb/pcan_usb_fd.c+52−44
@@ -990,6 +990,30 @@ static void pcan_usb_fd_free(struct peak_usb_device *dev) · 989 unmodified lines
990}990}
991 991
992/* describes the PCAN-USB FD adapter */992/* describes the PCAN-USB FD adapter */
993static const struct can_bittiming_const pcan_usb_fd_const = {
994 .name = "pcan_usb_fd",
995 .tseg1_min = 1,
996 .tseg1_max = 64,
997 .tseg2_min = 1,
998 .tseg2_max = 16,
999 .sjw_max = 16,
1000 .brp_min = 1,
1001 .brp_max = 1024,
1002 .brp_inc = 1,
1003};
1004
1005static const struct can_bittiming_const pcan_usb_fd_data_const = {
1006 .name = "pcan_usb_fd",
1007 .tseg1_min = 1,
1008 .tseg1_max = 16,
1009 .tseg2_min = 1,
1010 .tseg2_max = 8,
1011 .sjw_max = 4,
1012 .brp_min = 1,
1013 .brp_max = 1024,
1014 .brp_inc = 1,
1015};
1016
993const struct peak_usb_adapter pcan_usb_fd = {1017const struct peak_usb_adapter pcan_usb_fd = {
994 .name = "PCAN-USB FD",1018 .name = "PCAN-USB FD",
995 .device_id = PCAN_USBFD_PRODUCT_ID,1019 .device_id = PCAN_USBFD_PRODUCT_ID,
@@ -999,28 +1023,8 @@ const struct peak_usb_adapter pcan_usb_fd = { · 3 unmodified lines
999 .clock = {1023 .clock = {
1000 .freq = PCAN_UFD_CRYSTAL_HZ,1024 .freq = PCAN_UFD_CRYSTAL_HZ,
1001 },1025 },
1002 .bittiming_const = {1026 .bittiming_const = &pcan_usb_fd_const,
1003 .name = "pcan_usb_fd",1027 .data_bittiming_const = &pcan_usb_fd_data_const,
1004 .tseg1_min = 1,
1005 .tseg1_max = 64,
1006 .tseg2_min = 1,
1007 .tseg2_max = 16,
1008 .sjw_max = 16,
1009 .brp_min = 1,
1010 .brp_max = 1024,
1011 .brp_inc = 1,
1012 },
1013 .data_bittiming_const = {
1014 .name = "pcan_usb_fd",
1015 .tseg1_min = 1,
1016 .tseg1_max = 16,
1017 .tseg2_min = 1,
1018 .tseg2_max = 8,
1019 .sjw_max = 4,
1020 .brp_min = 1,
1021 .brp_max = 1024,
1022 .brp_inc = 1,
1023 },
1024 1028
1025 /* size of device private data */1029 /* size of device private data */
1026 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),1030 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
@@ -1058,6 +1062,30 @@ const struct peak_usb_adapter pcan_usb_fd = { · 31 unmodified lines
1058};1062};
1059 1063
1060/* describes the PCAN-USB Pro FD adapter */1064/* describes the PCAN-USB Pro FD adapter */
1065static const struct can_bittiming_const pcan_usb_pro_fd_const = {
1066 .name = "pcan_usb_pro_fd",
1067 .tseg1_min = 1,
1068 .tseg1_max = 64,
1069 .tseg2_min = 1,
1070 .tseg2_max = 16,
1071 .sjw_max = 16,
1072 .brp_min = 1,
1073 .brp_max = 1024,
1074 .brp_inc = 1,
1075};
1076
1077static const struct can_bittiming_const pcan_usb_pro_fd_data_const = {
1078 .name = "pcan_usb_pro_fd",
1079 .tseg1_min = 1,
1080 .tseg1_max = 16,
1081 .tseg2_min = 1,
1082 .tseg2_max = 8,
1083 .sjw_max = 4,
1084 .brp_min = 1,
1085 .brp_max = 1024,
1086 .brp_inc = 1,
1087};
1088
1061const struct peak_usb_adapter pcan_usb_pro_fd = {1089const struct peak_usb_adapter pcan_usb_pro_fd = {
1062 .name = "PCAN-USB Pro FD",1090 .name = "PCAN-USB Pro FD",
1063 .device_id = PCAN_USBPROFD_PRODUCT_ID,1091 .device_id = PCAN_USBPROFD_PRODUCT_ID,
@@ -1067,28 +1095,8 @@ const struct peak_usb_adapter pcan_usb_pro_fd = { · 3 unmodified lines
1067 .clock = {1095 .clock = {
1068 .freq = PCAN_UFD_CRYSTAL_HZ,1096 .freq = PCAN_UFD_CRYSTAL_HZ,
1069 },1097 },
1070 .bittiming_const = {1098 .bittiming_const = &pcan_usb_pro_fd_const,
1071 .name = "pcan_usb_pro_fd",1099 .data_bittiming_const = &pcan_usb_pro_fd_data_const,
1072 .tseg1_min = 1,
1073 .tseg1_max = 64,
1074 .tseg2_min = 1,
1075 .tseg2_max = 16,
1076 .sjw_max = 16,
1077 .brp_min = 1,
1078 .brp_max = 1024,
1079 .brp_inc = 1,
1080 },
1081 .data_bittiming_const = {
1082 .name = "pcan_usb_pro_fd",
1083 .tseg1_min = 1,
1084 .tseg1_max = 16,
1085 .tseg2_min = 1,
1086 .tseg2_max = 8,
1087 .sjw_max = 4,
1088 .brp_min = 1,
1089 .brp_max = 1024,
1090 .brp_inc = 1,
1091 },
1092 1100
1093 /* size of device private data */1101 /* size of device private data */
1094 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),1102 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+13−11
@@ -1004,6 +1004,18 @@ int pcan_usb_pro_probe(struct usb_interface *intf) · 1003 unmodified lines
1004/*1004/*
1005 * describe the PCAN-USB Pro adapter1005 * describe the PCAN-USB Pro adapter
1006 */1006 */
1007static const struct can_bittiming_const pcan_usb_pro_const = {
1008 .name = "pcan_usb_pro",
1009 .tseg1_min = 1,
1010 .tseg1_max = 16,
1011 .tseg2_min = 1,
1012 .tseg2_max = 8,
1013 .sjw_max = 4,
1014 .brp_min = 1,
1015 .brp_max = 1024,
1016 .brp_inc = 1,
1017};
1018
1007const struct peak_usb_adapter pcan_usb_pro = {1019const struct peak_usb_adapter pcan_usb_pro = {
1008 .name = "PCAN-USB Pro",1020 .name = "PCAN-USB Pro",
1009 .device_id = PCAN_USBPRO_PRODUCT_ID,1021 .device_id = PCAN_USBPRO_PRODUCT_ID,
@@ -1012,17 +1024,7 @@ const struct peak_usb_adapter pcan_usb_pro = { · 2 unmodified lines
1012 .clock = {1024 .clock = {
1013 .freq = PCAN_USBPRO_CRYSTAL_HZ,1025 .freq = PCAN_USBPRO_CRYSTAL_HZ,
1014 },1026 },
1015 .bittiming_const = {1027 .bittiming_const = &pcan_usb_pro_const,
1016 .name = "pcan_usb_pro",
1017 .tseg1_min = 1,
1018 .tseg1_max = 16,
1019 .tseg2_min = 1,
1020 .tseg2_max = 8,
1021 .sjw_max = 4,
1022 .brp_min = 1,
1023 .brp_max = 1024,
1024 .brp_inc = 1,
1025 },
1026 1028
1027 /* size of device private data */1029 /* size of device private data */
1028 .sizeof_dev_private = sizeof(struct pcan_usb_pro_device),1030 .sizeof_dev_private = sizeof(struct pcan_usb_pro_device),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t