]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/mpc5200.c
LinCAN sources go through big white-space cleanup.
[lincan.git] / lincan / src / mpc5200.c
index 2e159cc1ae89f6ddc87758f5dce987a61ad32fe2..ae0a4650ffe56f11801712eb0e861609e238d120 100644 (file)
@@ -61,7 +61,7 @@ int mpc5200_request_io(struct candevice_t *candev)
        /* Select device by chipnr:
         *  first dev is @ 900
         *  second dev is @ 980
-        * 
+        *
         * There are only two devices on MPC5200 */
 
        /* initialize internal address storage */
@@ -80,7 +80,7 @@ int mpc5200_request_io(struct candevice_t *candev)
                        continue;
                }
 
-               
+
                if (mpc5200_init_device_node(candev->chip[chipnr], dn))
                        return -ENODEV;
 
@@ -106,13 +106,15 @@ int mpc5200_release_io(struct candevice_t *candev)
        /* free all chips memorey space - using internal address storage */
        for (i = 0; i < candev->nr_all_chips; i++)
                iounmap((void*)chips_addr[i]);
-       
+
+       kfree(chips_addr);
+
        return 0;
 }
 
 int mpc5200_reset(struct candevice_t *candev)
 {
-       int i; 
+       int i;
        DEBUGMSG("Resetting MSCAN chips ...\n");
 
        for (i = 0; i < candev->nr_all_chips; i++)
@@ -125,7 +127,7 @@ int mpc5200_reset(struct candevice_t *candev)
        return 0;
 }
 
-int mpc5200_init_hw_data(struct candevice_t *candev) 
+int mpc5200_init_hw_data(struct candevice_t *candev)
 {
        /* candev->res_addr = RESET_ADDR; */
        candev->nr_82527_chips = NR_82527;
@@ -135,6 +137,19 @@ int mpc5200_init_hw_data(struct candevice_t *candev)
 
        return 0;
 }
+
+/* special function for midam board */
+int mpc5200_midam_init_hw_data(struct candevice_t *candev)
+{
+       /* use same init routine */
+       mpc5200_init_hw_data(candev);
+
+       /* modify chip count */
+       candev->nr_all_chips = NR_ALL_MIDAM;
+
+       return 0;
+}
+
 int mpc5200_init_chip_data(struct candevice_t *candev, int chipnr)
 {
        mscan_fill_chipspecops(candev->chip[chipnr]);
@@ -161,7 +176,7 @@ int mpc5200_init_obj_data(struct canchip_t *chip, int objnr)
 
 int mpc5200_program_irq(struct candevice_t *candev)
 {
-       /* we  don't use programmable interrupt on MPC5200 */ 
+       /* we  don't use programmable interrupt on MPC5200 */
        return 0;
 }
 
@@ -194,6 +209,16 @@ int mpc5200_register(struct hwspecops_t *hwspecops)
        return 0;
 }
 
+int mpc5200_midam_register(struct hwspecops_t *hwspecops)
+{
+       /* use same register routine for MIDAM board */
+       mpc5200_register(hwspecops);
+
+       /* use specific init_hw_data */
+       hwspecops->init_hw_data = mpc5200_midam_init_hw_data;
+
+       return 0;
+}
 
 int mpc5200_init_device_node(struct canchip_t * chip, struct device_node * devnode)
 {
@@ -213,6 +238,6 @@ int mpc5200_init_device_node(struct canchip_t * chip, struct device_node * devno
        }
 
        DEBUGMSG("Bound to io-addr: 0x%08x IRQ: %d\n", (unsigned int)chip->chip_base_addr, chip->chip_irq);
-       
+
        return 0;
 }