Skip to content

Commit

Permalink
x86: add support for the RDC R-321x SoC
Browse files Browse the repository at this point in the history
This patch adds support for the RDC R-321x system-on-chip,
also known as R-861x-(G). It uses the generic GPIO API and
has support for the on-chip hardware watchdog.

Build-fix from: Randy Dunlap <randy.dunlap@oracle.com>

Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Florian Fainelli authored and Ingo Molnar committed Jan 30, 2008
1 parent 0acf8e3 commit 5e3a77e
Show file tree
Hide file tree
Showing 9 changed files with 521 additions and 1 deletion.
14 changes: 13 additions & 1 deletion arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,18 @@ config X86_ES7000
Only choose this option if you have such a system, otherwise you
should say N here.

config X86_RDC321X
bool "RDC R-321x SoC"
depends on X86_32
select M486
select X86_REBOOTFIXUPS
select GENERIC_GPIO
select LEDS_GPIO
help
This option is needed for RDC R-321x system-on-chip, also known
as R-8610-(G).
If you don't have one of these chips, you should say N here.

config X86_VSMP
bool "Support for ScaleMP vSMP"
depends on X86_64 && PCI
Expand Down Expand Up @@ -637,7 +649,7 @@ config X86_REBOOTFIXUPS
system.

Currently, the only fixup is for the Geode machines using
CS5530A and CS5536 chipsets.
CS5530A and CS5536 chipsets and the RDC R-321x SoC.

Say Y if you want to enable the fixup. Currently, it's safe to
enable this option even if you don't need it.
Expand Down
5 changes: 5 additions & 0 deletions arch/x86/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ mflags-$(CONFIG_X86_ES7000) := -Iinclude/asm-x86/mach-es7000
fcore-$(CONFIG_X86_ES7000) := arch/x86/mach-es7000/
mcore-$(CONFIG_X86_ES7000) := arch/x86/mach-default/

# RDC R-321x subarch support
mflags-$(CONFIG_X86_RDC321X) := -Iinclude/asm-x86/mach-rdc321x
mcore-$(CONFIG_X86_RDC321X) := arch/x86/mach-default
core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/

# default subarch .h files
mflags-y += -Iinclude/asm-x86/mach-default

Expand Down
5 changes: 5 additions & 0 deletions arch/x86/mach-rdc321x/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Makefile for the RDC321x specific parts of the kernel
#
obj-$(CONFIG_X86_RDC321X) := gpio.o platform.o wdt.o

91 changes: 91 additions & 0 deletions arch/x86/mach-rdc321x/gpio.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Copyright (C) 2007, OpenWrt.org, Florian Fainelli <florian@openwrt.org>
* RDC321x architecture specific GPIO support
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/

#include <linux/autoconf.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/delay.h>

#include <asm/mach-rdc321x/rdc321x_defs.h>

static inline int rdc_gpio_is_valid(unsigned gpio)
{
return (gpio <= RDC_MAX_GPIO);
}

static unsigned int rdc_gpio_read(unsigned gpio)
{
unsigned int val;

val = 0x80000000 | (7 << 11) | ((gpio&0x20?0x84:0x48));
outl(val, RDC3210_CFGREG_ADDR);
udelay(10);
val = inl(RDC3210_CFGREG_DATA);
val |= (0x1 << (gpio & 0x1F));
outl(val, RDC3210_CFGREG_DATA);
udelay(10);
val = 0x80000000 | (7 << 11) | ((gpio&0x20?0x88:0x4C));
outl(val, RDC3210_CFGREG_ADDR);
udelay(10);
val = inl(RDC3210_CFGREG_DATA);

return val;
}

static void rdc_gpio_write(unsigned int val)
{
if (val) {
outl(val, RDC3210_CFGREG_DATA);
udelay(10);
}
}

int rdc_gpio_get_value(unsigned gpio)
{
if (rdc_gpio_is_valid(gpio))
return (int)rdc_gpio_read(gpio);
else
return -EINVAL;
}
EXPORT_SYMBOL(rdc_gpio_get_value);

void rdc_gpio_set_value(unsigned gpio, int value)
{
unsigned int val;

if (!rdc_gpio_is_valid(gpio))
return;

val = rdc_gpio_read(gpio);

if (value)
val &= ~(0x1 << (gpio & 0x1F));
else
val |= (0x1 << (gpio & 0x1F));

rdc_gpio_write(val);
}
EXPORT_SYMBOL(rdc_gpio_set_value);

int rdc_gpio_direction_input(unsigned gpio)
{
return 0;
}
EXPORT_SYMBOL(rdc_gpio_direction_input);

int rdc_gpio_direction_output(unsigned gpio, int value)
{
return 0;
}
EXPORT_SYMBOL(rdc_gpio_direction_output);


68 changes: 68 additions & 0 deletions arch/x86/mach-rdc321x/platform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Generic RDC321x platform devices
*
* Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/version.h>
#include <linux/leds.h>

#include <asm/gpio.h>

/* LEDS */
static struct gpio_led default_leds[] = {
{ .name = "rdc:dmz", .gpio = 1, },
};

static struct gpio_led_platform_data rdc321x_led_data = {
.num_leds = ARRAY_SIZE(default_leds),
.leds = default_leds,
};

static struct platform_device rdc321x_leds = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &rdc321x_led_data,
}
};

/* Watchdog */
static struct platform_device rdc321x_wdt = {
.name = "rdc321x-wdt",
.id = -1,
.num_resources = 0,
};

static struct platform_device *rdc321x_devs[] = {
&rdc321x_leds,
&rdc321x_wdt
};

static int __init rdc_board_setup(void)
{
return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs));
}

arch_initcall(rdc_board_setup);
Loading

0 comments on commit 5e3a77e

Please sign in to comment.