Changeset 18989


Ignore:
Timestamp:
2010-01-01T22:44:37+01:00 (8 years ago)
Author:
hauke
Message:

mazon: use platform_device for most drivers and fix some printk's

Location:
trunk/target/linux/amazon
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/amazon/config-2.6.30

    r18603 r18989  
    147147CONFIG_TRACING_SUPPORT=y 
    148148CONFIG_TRAD_SIGNALS=y 
     149CONFIG_USB_SUPPORT=y 
    149150CONFIG_ZONE_DMA_FLAG=0 
  • trunk/target/linux/amazon/files/arch/mips/amazon/Makefile

    r8137 r18989  
    55# Makefile for Infineon Amazon 
    66# 
    7 obj-y := dma-core.o interrupt.o prom.o setup.o 
     7obj-y := dma-core.o interrupt.o prom.o setup.o board.o 
    88obj-$(CONFIG_PCI) += pci.o 
    99 
  • trunk/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c

    r18588 r18989  
    3737#include <asm/uaccess.h> 
    3838#include <asm/system.h> 
     39#include <linux/platform_device.h> 
    3940#include <asm/amazon/amazon.h> 
    4041#include <asm/amazon/amazon_wdt.h> 
     
    207208}; 
    208209 
    209 int __init amazon_wdt_init_module(void) 
     210static int __init amazon_wdt_probe(struct platform_device *dev) 
    210211{ 
    211212        int result = result = register_chrdev(0, "watchdog", &wdt_fops); 
     
    227228} 
    228229 
    229 void amazon_wdt_cleanup_module(void) 
     230static int amazon_wdt_remove(struct platform_device *dev) 
    230231{ 
    231232        unregister_chrdev(0, "watchdog"); 
     
    235236#endif 
    236237        printk(KERN_INFO DRV_NAME "unregistered\n"); 
    237         return; 
    238 } 
     238        return 0; 
     239} 
     240 
     241static struct platform_driver amazon_wdt_driver = { 
     242        .probe = amazon_wdt_probe, 
     243        .remove = amazon_wdt_remove, 
     244        .driver = { 
     245                .name = "amazon_wdt", 
     246                .owner = THIS_MODULE, 
     247        }, 
     248}; 
     249 
     250static int __init amazon_wdt_init(void) 
     251{ 
     252        int ret = platform_driver_register(&amazon_wdt_driver); 
     253        if (ret) 
     254                printk(KERN_WARNING "amazon_wdt: error registering platfom driver!\n"); 
     255        return ret; 
     256} 
     257 
     258static void __exit amazon_wdt_exit(void) 
     259{ 
     260        platform_driver_unregister(&amazon_wdt_driver); 
     261} 
     262 
     263module_init(amazon_wdt_init); 
     264module_exit(amazon_wdt_exit); 
    239265 
    240266MODULE_LICENSE ("GPL"); 
     
    242268MODULE_DESCRIPTION("AMAZON WDT driver"); 
    243269 
    244 module_init(amazon_wdt_init_module); 
    245 module_exit(amazon_wdt_cleanup_module); 
    246  
  • trunk/target/linux/amazon/files/drivers/mtd/maps/amazon.c

    r16120 r18989  
    2121// copyright 2007 john crispin <blogic@openwrt.org> 
    2222// copyright 2007 felix fietkau <nbd@openwrt.org> 
     23// copyright 2009 hauke mehrtens <hauke@hauke-m.de> 
    2324 
    2425#include <linux/module.h> 
     
    3334#include <linux/mtd/cfi.h> 
    3435#include <linux/mutex.h> 
     36#include <linux/platform_device.h> 
    3537#include <asm/amazon/amazon.h> 
    3638 
     
    4244        .name = "AMAZON_FLASH", 
    4345        .bankwidth = 2, 
    44         .size = 0x1000000, 
    4546}; 
    4647 
     
    6364        u8 *p; 
    6465        u8 *to_8; 
    65         ssize_t l = len; 
    6666        from = (unsigned long) (from + map->virt); 
    6767        p = (u8 *) from; 
     
    103103}; 
    104104 
    105  
    106 unsigned long flash_start = 0x13000000; 
    107 unsigned long flash_size = 0x800000; 
    108105unsigned long uImage_size = 0x10000d; 
    109106 
     
    122119} 
    123120 
    124 int __init init_amazon_mtd(void) 
    125 { 
    126         int ret = 0; 
     121static int __init amazon_mtd_probe(struct platform_device *dev) 
     122{ 
    127123        unsigned long uimage_size; 
    128124        struct mtd_info *mymtd = NULL; 
     
    136132        amazon_map.copy_to = amazon_copy_to; 
    137133 
    138         amazon_map.phys = flash_start; 
    139         amazon_map.virt = ioremap_nocache(flash_start, flash_size); 
     134        amazon_map.phys = dev->resource->start; 
     135        amazon_map.size = dev->resource->end - amazon_map.phys + 1; 
     136        amazon_map.virt = ioremap_nocache(amazon_map.phys, amazon_map.size); 
    140137         
    141138        if (!amazon_map.virt) { 
    142                 printk(KERN_WARNING "Failed to ioremap!\n"); 
     139                printk(KERN_WARNING "amazon_mtd: Failed to ioremap!\n"); 
    143140                return -EIO; 
    144141        } 
     
    147144        if (!mymtd) { 
    148145                iounmap(amazon_map.virt); 
    149                 printk("probing failed\n"); 
     146                printk(KERN_WARNING "amazon_mtd: probing failed\n"); 
    150147                return -ENXIO; 
    151148        } 
     
    174171 
    175172        printk(KERN_INFO "amazon_mtd: added %s flash with %dMB\n", 
    176                 amazon_map.name, mymtd->size >> 20); 
     173                amazon_map.name, ((int)mymtd->size) >> 20); 
    177174        return 0; 
    178175} 
    179176 
    180 static void __exit cleanup_amazon_mtd(void) 
    181 { 
    182         /* FIXME! */ 
    183 } 
    184  
    185 module_init(init_amazon_mtd); 
    186 module_exit(cleanup_amazon_mtd); 
     177static struct platform_driver amazon_mtd_driver = { 
     178        .probe = amazon_mtd_probe, 
     179        .driver = { 
     180                .name = "amazon_mtd", 
     181                .owner = THIS_MODULE, 
     182        }, 
     183}; 
     184 
     185static int __init amazon_mtd_init(void) 
     186{ 
     187        int ret = platform_driver_register(&amazon_mtd_driver); 
     188        if (ret) 
     189                printk(KERN_WARNING "amazon_mtd: error registering platfom driver!\n"); 
     190        return ret; 
     191} 
     192 
     193static void __exit amazon_mtd_cleanup(void) 
     194{ 
     195        platform_driver_unregister(&amazon_mtd_driver); 
     196} 
     197 
     198module_init(amazon_mtd_init); 
     199module_exit(amazon_mtd_cleanup); 
    187200 
    188201MODULE_LICENSE("GPL"); 
    189202MODULE_AUTHOR("john crispin blogic@openwrt.org"); 
    190203MODULE_DESCRIPTION("MTD map driver for AMAZON boards"); 
     204 
  • trunk/target/linux/amazon/files/drivers/net/amazon_sw.c

    r18588 r18989  
    3939// copyright 2007 john crispin <blogic@openwrt.org> 
    4040// copyright 2007 felix fietkau <nbd@openwrt.org> 
     41// copyright 2009 hauke mehrtens <hauke@hauke-m.de> 
    4142 
    4243 
     
    8687#include <asm/checksum.h> 
    8788#include <linux/init.h> 
     89#include <linux/platform_device.h> 
    8890 
    8991#include <asm/amazon/amazon.h> 
     
    264266                        line = (*ep) ? ep + 1 : ep; 
    265267        } 
    266         printk("mac address %2x-%2x-%2x-%2x-%2x-%2x \n", my_ethaddr[0], my_ethaddr[1], my_ethaddr[2], my_ethaddr[3], my_ethaddr[4], my_ethaddr[5]); 
     268        printk(KERN_INFO "amazon_mii0: mac address %2x-%2x-%2x-%2x-%2x-%2x \n", my_ethaddr[0], my_ethaddr[1], my_ethaddr[2], my_ethaddr[3], my_ethaddr[4], my_ethaddr[5]); 
    267269        return 0; 
    268270} 
     
    312314#ifdef CONFIG_NET_HW_FLOWCONTROL 
    313315        if ((priv->fc_bit = netdev_register_fc(dev, amazon_xon)) == 0) { 
    314                 printk("Hardware Flow Control register fails\n"); 
     316                printk(KERN_WARNING "amazon_mii0: Hardware Flow Control register fails\n"); 
    315317        } 
    316318#endif 
     
    661663 
    662664        if (len >= 0x600) { 
    663                 printk("packet too large %d\n", len); 
     665                printk(KERN_WARNING "amazon_mii0: packet too large %d\n", len); 
    664666                goto switch_hw_receive_err_exit; 
    665667        } 
     
    668670        len -= 4; 
    669671        if (skb == NULL) { 
    670                 printk("cannot restore pointer\n"); 
     672                printk(KERN_WARNING "amazon_mii0: cannot restore pointer\n"); 
    671673                goto switch_hw_receive_err_exit; 
    672674        } 
    673675        if (len > (skb->end - skb->tail)) { 
    674                 printk("BUG, len:%d end:%p tail:%p\n", (len + 4), skb->end, skb->tail); 
     676                printk(KERN_WARNING "amazon_mii0: BUG, len:%d end:%p tail:%p\n", (len + 4), skb->end, skb->tail); 
    675677                goto switch_hw_receive_err_exit; 
    676678        } 
     
    785787        struct switch_priv *priv; 
    786788        ether_setup(dev);                       /* assign some of the fields */ 
    787         printk("%s up using ", dev->name); 
     789        printk(KERN_INFO "amazon_mii0: %s up using ", dev->name); 
    788790        dev->open = switch_open; 
    789791        dev->stop = switch_release; 
     
    828830} 
    829831 
    830 int switch_init_module(void) 
     832static int amazon_mii_probe(struct platform_device *dev) 
    831833{ 
    832834        int i = 0, result, device_present = 0; 
     
    840842                priv->num = i; 
    841843                if ((result = register_netdev(switch_devs[i]))) 
    842                         printk("error %i registering device \"%s\"\n", result, switch_devs[i]->name); 
     844                        printk(KERN_WARNING "amazon_mii0: error %i registering device \"%s\"\n", result, switch_devs[i]->name); 
    843845                else 
    844846                        device_present++; 
     
    848850} 
    849851 
    850 void switch_cleanup(void) 
     852static int amazon_mii_remove(struct platform_device *dev) 
    851853{ 
    852854        int i; 
     
    861863                unregister_netdev(switch_devs[i]); 
    862864        } 
    863         return; 
    864 } 
    865  
    866 module_init(switch_init_module); 
    867 module_exit(switch_cleanup); 
     865        return 0; 
     866} 
     867 
     868static struct platform_driver amazon_mii_driver = { 
     869        .probe = amazon_mii_probe, 
     870        .remove = amazon_mii_remove, 
     871        .driver = { 
     872                .name = "amazon_mii0", 
     873                .owner = THIS_MODULE, 
     874        }, 
     875}; 
     876 
     877static int __init amazon_mii_init(void) 
     878{ 
     879        int ret = platform_driver_register(&amazon_mii_driver); 
     880        if (ret) 
     881                printk(KERN_WARNING "amazon_mii0: Error registering platfom driver!\n"); 
     882        return ret; 
     883} 
     884 
     885static void __exit amazon_mii_cleanup(void) 
     886{ 
     887        platform_driver_unregister(&amazon_mii_driver); 
     888} 
     889 
     890module_init(amazon_mii_init); 
     891module_exit(amazon_mii_cleanup); 
    868892 
    869893MODULE_LICENSE("GPL"); 
    870894MODULE_AUTHOR("Wu Qi Ming"); 
     895MODULE_DESCRIPTION("ethernet driver for AMAZON boards"); 
     896 
  • trunk/target/linux/amazon/files/drivers/serial/amazon_asc.c

    r18588 r18989  
    4545#include <linux/sysrq.h> 
    4646#include <linux/irq.h> 
     47#include <linux/platform_device.h> 
    4748 
    4849#include <asm/system.h> 
     
    671672}; 
    672673 
    673 static int __init amazonasc_init(void) 
     674static int __init amazon_asc_probe(struct platform_device *dev) 
    674675{ 
    675676        unsigned char res; 
     
    679680} 
    680681 
    681 static void __exit amazonasc_exit(void) 
     682static int __exit amazon_asc_remove(struct platform_device *dev) 
    682683{ 
    683684        uart_unregister_driver(&amazonasc_reg); 
    684 } 
    685  
    686 module_init(amazonasc_init); 
    687 module_exit(amazonasc_exit); 
     685        return 0; 
     686} 
     687 
     688static struct platform_driver amazon_asc_driver = { 
     689        .probe = amazon_asc_probe, 
     690        .remove = amazon_asc_remove, 
     691        .driver = { 
     692                .name = "amazon_asc", 
     693                .owner = THIS_MODULE, 
     694        }, 
     695}; 
     696 
     697static int __init amazon_asc_init(void) 
     698{ 
     699        int ret = platform_driver_register(&amazon_asc_driver); 
     700        if (ret) 
     701                printk(KERN_WARNING "amazon_asc: error registering platfom driver!\n"); 
     702        return ret; 
     703} 
     704 
     705static void __exit amazon_asc_cleanup(void) 
     706{ 
     707        platform_driver_unregister(&amazon_asc_driver); 
     708} 
     709 
     710module_init(amazon_asc_init); 
     711module_exit(amazon_asc_cleanup); 
    688712 
    689713MODULE_AUTHOR("Gary Jennejohn, Felix Fietkau, John Crispin"); 
    690714MODULE_DESCRIPTION("MIPS AMAZONASC serial port driver"); 
    691715MODULE_LICENSE("GPL"); 
     716 
Note: See TracChangeset for help on using the changeset viewer.