Changed baudrate calculation to consider DSC selection.
authorppisa <ppisa>
Fri, 21 Jan 2005 23:41:05 +0000 (23:41 +0000)
committerppisa <ppisa>
Fri, 21 Jan 2005 23:41:05 +0000 (23:41 +0000)
This affects only PIPx cards, because only these use
crystal <10MHz (8 MHz in the case) and i82527 chip.

lincan/src/i82527.c
lincan/src/pip.c

index 00dd885..66bdc55 100644 (file)
@@ -131,7 +131,8 @@ int i82527_baud_rate(struct canchip_t *chip, int rate, int clock, int sjw,
        if (i82527_enable_configuration(chip))
                return -ENODEV;
 
-       clock /=2;
+       if(chip->int_cpu_reg & iCPU_DSC)
+               clock /=2;
 
        /* tseg even = round down, odd = round up */
        for (tseg=(0+0+2)*2; tseg<=(MAX_TSEG2+MAX_TSEG1+2)*2+1; tseg++) {
index f0a04de..add0fee 100644 (file)
@@ -107,7 +107,7 @@ int pip_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        i82527_fill_chipspecops(candev->chip[chipnr]);
        candev->chip[chipnr]->chip_base_addr = candev->io_addr;
-       candev->chip[chipnr]->clock = 16000000;
+       candev->chip[chipnr]->clock = 8000000;
        candev->chip[chipnr]->int_cpu_reg = 0;
        candev->chip[chipnr]->int_clk_reg = iCLK_SL1;
        candev->chip[chipnr]->int_bus_reg = iBUS_CBY;