45 #include <linux/kernel.h>
46 #include <linux/module.h>
48 #include <linux/netdevice.h>
58 #define DRV_NAME "cc770_platform"
64 #define CC770_PLATFORM_CAN_CLOCK 16000000
87 if (prop && (prop_size ==
sizeof(
u32)))
91 priv->
can.clock.freq = clkext;
94 if (priv->
can.clock.freq > 10000000) {
96 priv->
can.clock.freq /= 2;
100 if (priv->
can.clock.freq > 8000000)
120 if (prop && (prop_size ==
sizeof(
u32)) && *prop > 0) {
121 u32 cdv = clkext / *prop;
124 if (cdv > 0 && cdv < 16) {
130 if (prop && (prop_size ==
sizeof(
u32))) {
136 ((cdv * clkext - 1) / 8000000);
143 dev_dbg(&pdev->
dev,
"invalid clock-out-frequency\n");
158 priv->
can.clock.freq /= 2;
177 if (!mem || irq <= 0)
180 mem_size = resource_size(mem);
187 goto exit_release_mem;
197 priv = netdev_priv(dev);
198 priv->
read_reg = cc770_platform_read_reg;
199 priv->
write_reg = cc770_platform_write_reg;
203 if (pdev->
dev.of_node)
204 err = cc770_get_of_node_data(pdev, priv);
205 else if (pdev->
dev.platform_data)
206 err = cc770_get_platform_data(pdev, priv);
210 goto exit_free_cc770;
213 "reg_base=0x%p irq=%d clock=%d cpu_interface=0x%02x "
214 "bus_config=0x%02x clkout=0x%02x\n",
224 "couldn't register CC700 device (err=%d)\n", err);
225 goto exit_free_cc770;
257 {.compatible =
"bosch,cc770"},
258 {.compatible =
"intc,82527"},
266 .of_match_table = cc770_platform_table,
268 .probe = cc770_platform_probe,