]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
Make CAN bit-timing calculation configurable
authorwolf <wolf@030b6a49-0b11-0410-94ab-b0dab22257f2>
Sun, 1 Feb 2009 15:24:41 +0000 (15:24 +0000)
committerwolf <wolf@030b6a49-0b11-0410-94ab-b0dab22257f2>
Sun, 1 Feb 2009 15:24:41 +0000 (15:24 +0000)
This patch adds the Kconfig option CAN_CALC_BITTIMING to make the
calculation of bit-timing parameters configurable. Disabling it will
save some space and will allow user space tools to determine proper
bit-timing parameters exclusively.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@920 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/drivers/net/can/Kconfig
kernel/2.6/drivers/net/can/dev.c

index 2d4a8c5e5f1f9c6205d4876eedfef1b475059966..722ea837f36cf7baeeb0ddf9f7b395723a116231 100644 (file)
@@ -46,6 +46,20 @@ config CAN_DEV
          support. This is the standard library for CAN drivers.
          If unsure, say Y.
 
+config CAN_CALC_BITTIMING
+       tristate "CAN bit-timing calculation"
+       depends on CAN_DEV
+       default Y
+       ---help---
+         If enabled, CAN bit-timing parameters will be calculated for the
+         bit-rate specified via SYSFS file "can_bitrate" when the device
+         gets started. This works fine for the most common CAN controllers
+         with standard bit-rates but may fail for exotic bit-rates or CAN
+         source clock frequencies. Disabling saves some space, but then the
+         bit-timing parameters must be specified directly using the SYSFS
+         files "tq, prop_seg, phase_seg1, phase_seg2 and sjw".
+         If unsure, say Y.
+
 config CAN_SJA1000
        depends on CAN_DEV
                tristate "Philips SJA1000"
index b123cb6e48919c94b4af680b98dfa37ecd80907c..022fca7f7317ce67547b256bcff4326d278f2c53 100644 (file)
@@ -36,6 +36,7 @@ MODULE_DESCRIPTION(MOD_DESC);
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>");
 
+#ifdef CONFIG_CAN_CALC_BITTIMING
 #define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */
 
 /*
@@ -150,6 +151,12 @@ static int can_calc_bittiming(struct net_device *dev)
 
        return 0;
 }
+#else /* !CONFIG_CAN_CALC_BITTIMING */
+static int can_calc_bittiming(struct net_device *dev)
+{
+       return -EINVAL;
+}
+#endif /* CONFIG_CAN_CALC_BITTIMING */
 
 int can_sample_point(struct can_bittiming *bt)
 {