@@ -454,7 +454,7 @@
dcan0: d_can@ffc00000 {
compatible = "bosch,d_can";
reg = <0xffc00000 0x1000>;
- interrupts = <0 131 4>, <0 132 4>;
+ interrupts = <0 131 4>, <0 132 4>, <0 133 4>, <0 134 4>;
clocks = <&can0_clk>;
status = "disabled";
};
@@ -462,7 +462,7 @@
dcan1: d_can@ffc01000 {
compatible = "bosch,d_can";
reg = <0xffc01000 0x1000>;
- interrupts = <0 135 4>, <0 136 4>;
+ interrupts = <0 135 4>, <0 136 4>, <0 137 4>, <0 138 4>;
clocks = <&can1_clk>;
status = "disabled";
};
@@ -80,6 +80,15 @@ static void c_can_hw_raminit_wait(const struct c_can_priv *priv, u32 mask,
udelay(1);
}
+/* socfpga has CFR at offset 0x18, bit 0x08 is "request automatic ram init". Needed?
+ CCTRL.1 bit needs to be set for this.
+
+
+ CRR at offset 0x20 should contain revision information.
+
+ HWS contains information about # of objects
+*/
+
static void c_can_hw_raminit(const struct c_can_priv *priv, bool enable)
{
u32 mask = CAN_RAMINIT_ALL_MASK(priv->instance);
@@ -88,7 +97,8 @@ static void c_can_hw_raminit(const struct c_can_priv *priv, bool enable)
spin_lock(&raminit_lock);
ctrl = readl(priv->raminit_ctrlreg);
- /* We clear the done and start bit first. The start bit is
+ /*
+ * We clear the done and start bit first. The start bit is
* looking at the 0 -> transition, but is not self clearing;
* And we clear the init done bit as well.
*/
@@ -193,6 +203,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
goto exit_iounmap;
}
+ printk("net device\n");
+
priv = netdev_priv(dev);
switch (id->driver_data) {
case BOSCH_C_CAN:
@@ -220,11 +232,26 @@ static int c_can_plat_probe(struct platform_device *pdev)
else
priv->instance = pdev->id;
+ printk("d_can: get resource\n");
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ printk("d_can: ioremap_resource\n");
priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(priv->raminit_ctrlreg) || (int)priv->instance < 0)
+ if (IS_ERR(priv->raminit_ctrlreg) || (int)priv->instance < 0) {
+ u32 version;
dev_info(&pdev->dev, "control memory is not used for raminit\n");
- else
+
+#if 0
+ version = readl(addr + 0x20); /* CRR */
+ printk("Version, should be 11161128: %lx\n", version);
+ /* CFR */
+ writel(8, addr + 0x18);
+ if (!(readl(addr + 0x18) & 8))
+ printk("Not initializing?\n");
+
+ while (readl(addr + 0x18) & 8)
+ printk("Waiting for init...\n");
+#endif
+ } else
priv->raminit = c_can_hw_raminit;
break;
default:
@@ -242,6 +269,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);
+ printk("..register\n");
+
ret = register_c_can_dev(dev);
if (ret) {
dev_err(&pdev->dev, "registering %s failed (err=%d)\n",