Komal Shah | d395e6a | 2008-09-07 23:41:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * mach-davinci/devices.c |
| 3 | * |
| 4 | * DaVinci platform device setup/initialization |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/dma-mapping.h> |
| 17 | #include <linux/io.h> |
| 18 | |
| 19 | #include <asm/mach/map.h> |
| 20 | |
| 21 | #include <mach/hardware.h> |
| 22 | #include <mach/i2c.h> |
Russell King | 80b02c1 | 2009-01-08 10:01:47 +0000 | [diff] [blame] | 23 | #include <mach/irqs.h> |
Kevin Hilman | 5526b3f | 2009-04-14 09:50:37 -0500 | [diff] [blame] | 24 | #include <mach/cputype.h> |
| 25 | #include <mach/mux.h> |
Komal Shah | d395e6a | 2008-09-07 23:41:28 -0700 | [diff] [blame] | 26 | |
Kevin Hilman | f5c122d | 2009-04-14 07:04:16 -0500 | [diff] [blame] | 27 | #define DAVINCI_I2C_BASE 0x01C21000 |
| 28 | |
Komal Shah | d395e6a | 2008-09-07 23:41:28 -0700 | [diff] [blame] | 29 | static struct resource i2c_resources[] = { |
| 30 | { |
| 31 | .start = DAVINCI_I2C_BASE, |
| 32 | .end = DAVINCI_I2C_BASE + 0x40, |
| 33 | .flags = IORESOURCE_MEM, |
| 34 | }, |
| 35 | { |
| 36 | .start = IRQ_I2C, |
| 37 | .flags = IORESOURCE_IRQ, |
| 38 | }, |
| 39 | }; |
| 40 | |
| 41 | static struct platform_device davinci_i2c_device = { |
| 42 | .name = "i2c_davinci", |
| 43 | .id = 1, |
| 44 | .num_resources = ARRAY_SIZE(i2c_resources), |
| 45 | .resource = i2c_resources, |
| 46 | }; |
| 47 | |
| 48 | void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata) |
| 49 | { |
Kevin Hilman | 5526b3f | 2009-04-14 09:50:37 -0500 | [diff] [blame] | 50 | if (cpu_is_davinci_dm644x()) |
| 51 | davinci_cfg_reg(DM644X_I2C); |
| 52 | |
Komal Shah | d395e6a | 2008-09-07 23:41:28 -0700 | [diff] [blame] | 53 | davinci_i2c_device.dev.platform_data = pdata; |
| 54 | (void) platform_device_register(&davinci_i2c_device); |
| 55 | } |
| 56 | |
Kevin Hilman | fb63138 | 2009-04-29 16:23:59 -0700 | [diff] [blame^] | 57 | /*-------------------------------------------------------------------------*/ |
| 58 | |
| 59 | static struct resource wdt_resources[] = { |
| 60 | { |
| 61 | .start = 0x01c21c00, |
| 62 | .end = 0x01c21fff, |
| 63 | .flags = IORESOURCE_MEM, |
| 64 | }, |
| 65 | }; |
| 66 | |
| 67 | struct platform_device davinci_wdt_device = { |
| 68 | .name = "watchdog", |
| 69 | .id = -1, |
| 70 | .num_resources = ARRAY_SIZE(wdt_resources), |
| 71 | .resource = wdt_resources, |
| 72 | }; |
| 73 | |
| 74 | static void davinci_init_wdt(void) |
| 75 | { |
| 76 | platform_device_register(&davinci_wdt_device); |
| 77 | } |
| 78 | |
| 79 | /*-------------------------------------------------------------------------*/ |
| 80 | |
| 81 | static int __init davinci_init_devices(void) |
| 82 | { |
| 83 | /* please keep these calls, and their implementations above, |
| 84 | * in alphabetical order so they're easier to sort through. |
| 85 | */ |
| 86 | davinci_init_wdt(); |
| 87 | |
| 88 | return 0; |
| 89 | } |
| 90 | arch_initcall(davinci_init_devices); |
| 91 | |