2 * GPR board platform device registration
4 * Copyright (C) 2010 Wolfgang Grandegger <wg@denx.de>
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.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/init.h>
22 #include <linux/platform_device.h>
23 #include <linux/mtd/partitions.h>
24 #include <linux/mtd/physmap.h>
25 #include <linux/leds.h>
26 #include <linux/gpio.h>
27 #include <linux/i2c.h>
28 #include <linux/i2c-gpio.h>
30 #include <asm/mach-au1x00/au1000.h>
35 static struct resource gpr_wdt_resource
[] = {
39 .name
= "gpr-adm6320-wdt",
40 .flags
= IORESOURCE_IRQ
,
44 static struct platform_device gpr_wdt_device
= {
45 .name
= "adm6320-wdt",
47 .num_resources
= ARRAY_SIZE(gpr_wdt_resource
),
48 .resource
= gpr_wdt_resource
,
54 * 0x00000000-0x00200000 : "kernel"
55 * 0x00200000-0x00a00000 : "rootfs"
56 * 0x01d00000-0x01f00000 : "config"
57 * 0x01c00000-0x01d00000 : "yamon"
58 * 0x01d00000-0x01d40000 : "yamon env vars"
59 * 0x00000000-0x00a00000 : "kernel+rootfs"
61 static struct mtd_partition gpr_mtd_partitions
[] = {
70 .offset
= MTDPART_OFS_APPEND
,
71 .mask_flags
= MTD_WRITEABLE
,
84 .name
= "yamon env vars",
86 .offset
= MTDPART_OFS_APPEND
,
89 .name
= "kernel+rootfs",
95 static struct physmap_flash_data gpr_flash_data
= {
97 .nr_parts
= ARRAY_SIZE(gpr_mtd_partitions
),
98 .parts
= gpr_mtd_partitions
,
101 static struct resource gpr_mtd_resource
= {
104 .flags
= IORESOURCE_MEM
,
107 static struct platform_device gpr_mtd_device
= {
108 .name
= "physmap-flash",
110 .platform_data
= &gpr_flash_data
,
113 .resource
= &gpr_mtd_resource
,
119 static struct gpio_led gpr_gpio_leds
[] = {
132 static struct gpio_led_platform_data gpr_led_data
= {
133 .num_leds
= ARRAY_SIZE(gpr_gpio_leds
),
134 .leds
= gpr_gpio_leds
,
137 static struct platform_device gpr_led_devices
= {
141 .platform_data
= &gpr_led_data
,
148 static struct i2c_gpio_platform_data gpr_i2c_data
= {
150 .sda_is_open_drain
= 1,
152 .scl_is_open_drain
= 1,
153 .udelay
= 2, /* ~100 kHz */
157 static struct platform_device gpr_i2c_device
= {
160 .dev
.platform_data
= &gpr_i2c_data
,
163 static struct i2c_board_info gpr_i2c_info
[] __initdata
= {
165 I2C_BOARD_INFO("lm83", 0x18),
170 static struct platform_device
*gpr_devices
[] __initdata
= {
177 static int __init
gpr_dev_init(void)
179 i2c_register_board_info(0, gpr_i2c_info
, ARRAY_SIZE(gpr_i2c_info
));
181 return platform_add_devices(gpr_devices
, ARRAY_SIZE(gpr_devices
));
183 device_initcall(gpr_dev_init
);