/*
* Generic RDC321x platform devices
*
- * Copyright (C) 2007-2008 OpenWrt.org
+ * Copyright (C) 2007-2009 OpenWrt.org
* Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
- * Copyright (C) 2008 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
+ * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include <linux/platform_device.h>
#include <linux/version.h>
#include <linux/leds.h>
-#include <linux/gpio_keys.h>
+#include <linux/gpio_buttons.h>
#include <linux/input.h>
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/physmap.h>
#include <linux/root_dev.h>
-#include <asm/mach-rdc321x/gpio.h>
-
/* Flash */
#ifdef CONFIG_MTD_R8610
#define CONFIG_MTD_RDC3210 1
/* LEDS */
static struct gpio_led default_leds[] = {
- { .name = "rdc321x:dmz", .gpio = 1, },
+ { .name = "rdc321x:dmz", .gpio = 1, .active_low = 1},
+};
+
+static struct gpio_led sitecom_leds[] = {
+ { .name = "rdc321x:power", .gpio = 15, .active_low = 1},
+ { .name = "rdc321x:usb0", .gpio = 0, .active_low = 1},
+ { .name = "rdc321x:usb1", .gpio = 1, .active_low = 1},
};
static struct gpio_led_platform_data rdc321x_led_data = {
}
};
-/* Watchdog */
-static struct platform_device rdc321x_wdt = {
- .name = "rdc321x-wdt",
- .id = -1,
- .num_resources = 0,
-};
-
/* Button */
-static struct gpio_keys_button rdc321x_gpio_btn[] = {
+static struct gpio_button rdc321x_gpio_btn[] = {
{
- .gpio = 0,
+ .gpio = 6,
.code = BTN_0,
.desc = "Reset",
.active_low = 1,
}
};
-static struct gpio_keys_platform_data rdc321x_gpio_btn_data = {
+static struct gpio_buttons_platform_data rdc321x_gpio_btn_data = {
.buttons = rdc321x_gpio_btn,
.nbuttons = ARRAY_SIZE(rdc321x_gpio_btn),
};
static struct platform_device rdc321x_button = {
- .name = "gpio-keys",
+ .name = "gpio-buttons",
.id = -1,
.dev = {
.platform_data = &rdc321x_gpio_btn_data,
static struct platform_device *rdc321x_devs[] = {
&rdc_flash_device,
&rdc321x_leds,
- &rdc321x_wdt,
&rdc321x_button,
};
{
#ifndef CONFIG_MTD_RDC3210
struct map_info rdc_map_info;
- u32 the_header[4];
+ u32 the_header[8];
ROOT_DEV = 0;
rdc_map_info.name = rdc_flash_device.name;
- rdc_map_info.phys = 0xff000000;
- rdc_map_info.size = 0x1000000;
+ rdc_map_info.size = 0x800000; //8MB
+ rdc_map_info.phys = (u32) -rdc_map_info.size;
rdc_map_info.bankwidth = 2;
rdc_map_info.set_vpp = NULL;
simple_map_init(&rdc_map_info);
while (probe_flash_start(&rdc_map_info)) {
- rdc_map_info.phys++;
- if (--rdc_map_info.size)
+ if (rdc_map_info.size /= 2 < 0x100000) //1MB
panic("Could not find start of flash!");
+ rdc_map_info.phys = (u32) -rdc_map_info.size;
}
rdc_flash_resource.start = rdc_map_info.phys;
rdc_flash_data.width = rdc_map_info.bankwidth;
the_header[2] = ((u32 *)rdc_map_info.virt)[2];
the_header[3] = ((u32 *)rdc_map_info.virt)[3];
iounmap(rdc_map_info.virt);
+ rdc_map_info.virt = ioremap_nocache(rdc_map_info.phys + 0x8000, 0x10);
+ if (rdc_map_info.virt == NULL)
+ panic("Could not ioremap to read device magic!");
+ the_header[4] = ((u32 *)rdc_map_info.virt)[0];
+ the_header[5] = ((u32 *)rdc_map_info.virt)[1];
+ the_header[6] = ((u32 *)rdc_map_info.virt)[2];
+ the_header[7] = ((u32 *)rdc_map_info.virt)[3];
+ iounmap(rdc_map_info.virt);
if (!memcmp(the_header, "GMTK", 4)) { /* Gemtek */
/* TODO */
- } else if (!memcmp(the_header, "CSYS", 4)) { /* Sitecom */
- /* TODO */
+ } else if (!memcmp(the_header + 4, "CSYS", 4)) { /* Sitecom */
+ rdc_flash_parts[0].name = "system";
+ rdc_flash_parts[0].offset = 0;
+ rdc_flash_parts[0].size = rdc_map_info.size - 0x10000;
+ rdc_flash_parts[1].name = "config";
+ rdc_flash_parts[1].offset = 0;
+ rdc_flash_parts[1].size = 0x8000;
+ rdc_flash_parts[2].name = "magic";
+ rdc_flash_parts[2].offset = 0x8000;
+ rdc_flash_parts[2].size = 0x14;
+ rdc_flash_parts[3].name = "kernel";
+ rdc_flash_parts[3].offset = 0x8014;
+ rdc_flash_parts[3].size = the_header[5];
+ rdc_flash_parts[4].name = "rootfs";
+ rdc_flash_parts[4].offset = 0x8014 + the_header[5];
+ rdc_flash_parts[4].size = rdc_flash_parts[0].size - rdc_flash_parts[4].offset;
+ rdc_flash_parts[5].name = "bootloader";
+ rdc_flash_parts[5].offset = rdc_flash_parts[0].size;
+ rdc_flash_parts[5].size = 0x10000;
+ rdc_flash_data.nr_parts = 6;
+
+ rdc321x_led_data.num_leds = ARRAY_SIZE(sitecom_leds);
+ rdc321x_led_data.leds = sitecom_leds;
} else if (!memcmp(((u8 *)the_header) + 14, "Li", 2)) { /* AMIT */
rdc_flash_parts[0].name = "kernel_parthdr";
rdc_flash_parts[0].offset = 0;