can:starfive:modify some data field and clock frequency
authorWilliam Qiu <william.qiu@starfivetech.com>
Tue, 11 Oct 2022 02:11:18 +0000 (10:11 +0800)
committerWilliam Qiu <william.qiu@starfivetech.com>
Tue, 11 Oct 2022 02:11:18 +0000 (10:11 +0800)
modify some data field and clock frequency

Signed-off-by: William Qiu <william.qiu@starfivetech.com>
drivers/net/can/ipms_canfd.c

index cfa4992..6e0a816 100644 (file)
@@ -186,10 +186,10 @@ struct ipms_canfd_priv {
 static struct can_bittiming_const canfd_bittiming_const = {
        .name = DRIVER_NAME,
        .tseg1_min = 2,
-       .tseg1_max = 17,
+       .tseg1_max = 65,
        .tseg2_min = 1,
        .tseg2_max = 8,
-       .sjw_max = 8,
+       .sjw_max = 16,
        .brp_min = 1,
        .brp_max = 512,
        .brp_inc = 1,
@@ -199,10 +199,10 @@ static struct can_bittiming_const canfd_bittiming_const = {
 static struct can_bittiming_const canfd_data_bittiming_const = {
        .name = DRIVER_NAME,
        .tseg1_min = 2,
-       .tseg1_max = 65,
+       .tseg1_max = 17,
        .tseg2_min = 1,
        .tseg2_max = 8,
-       .sjw_max = 16,
+       .sjw_max = 8,
        .brp_min = 1,
        .brp_max = 512,
        .brp_inc = 1,
@@ -1045,6 +1045,7 @@ static int canfd_driver_probe(struct platform_device *pdev)
        struct ipms_canfd_priv *priv;
        void __iomem *addr;
        int ret;
+       u32 frq;
 
        addr = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(addr)) {
@@ -1107,6 +1108,9 @@ static int canfd_driver_probe(struct platform_device *pdev)
                goto reset_exit;
        }
 
+       device_property_read_u32(priv->dev, "frequency", &frq);
+       clk_set_rate(priv->can_clk, frq);
+
        priv->can.clock.freq = clk_get_rate(priv->can_clk);
        ndev->irq = platform_get_irq(pdev, 0);