Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182969
b: refs/heads/master
c: a62e903
h: refs/heads/master
i:
  182967: 4ce113d
v: v3
  • Loading branch information
wanzongshun authored and Russell King committed Jan 27, 2010
1 parent 1a7d433 commit 917c311
Show file tree
Hide file tree
Showing 33 changed files with 1,340 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e00d9d4b1796dae3adf6e39c9a766e760dd1c796
refs/heads/master: a62e90308f7b6965310cf4ec61393aef6861f50d
11 changes: 11 additions & 0 deletions trunk/arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,15 @@ config ARCH_W90X900
<http://www.nuvoton.com/hq/enu/ProductAndSales/ProductLines/
ConsumerElectronicsIC/ARMMicrocontroller/ARMMicrocontroller>

config ARCH_NUC93X
bool "Nuvoton NUC93X CPU"
select CPU_ARM926T
select HAVE_CLK
select COMMON_CLKDEV
help
Support for Nuvoton (Winbond logic dept.) NUC93X MCU,The NUC93X is a
low-power and high performance MPEG-4/JPEG multimedia controller chip.

config ARCH_PNX4008
bool "Philips Nexperia PNX4008 Mobile"
select CPU_ARM926T
Expand Down Expand Up @@ -828,6 +837,8 @@ source "arch/arm/mach-u300/Kconfig"

source "arch/arm/mach-w90x900/Kconfig"

source "arch/arm/mach-nuc93x/Kconfig"

source "arch/arm/mach-bcmring/Kconfig"

source "arch/arm/mach-ux500/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ machine-$(CONFIG_ARCH_U300) := u300
machine-$(CONFIG_ARCH_U8500) := ux500
machine-$(CONFIG_ARCH_VERSATILE) := versatile
machine-$(CONFIG_ARCH_W90X900) := w90x900
machine-$(CONFIG_ARCH_NUC93X) := nuc93x
machine-$(CONFIG_FOOTBRIDGE) := footbridge
machine-$(CONFIG_ARCH_MXC91231) := mxc91231

Expand Down
11 changes: 0 additions & 11 deletions trunk/arch/arm/mach-ixp4xx/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,6 @@ static void __init ixp4xx_clocksource_init(void)
clocksource_register(&clocksource_ixp4xx);
}

/*
* sched_clock()
*/
unsigned long long sched_clock(void)
{
cycle_t cyc = ixp4xx_get_cycles(NULL);
struct clocksource *cs = &clocksource_ixp4xx;

return clocksource_cyc2ns(cyc, cs->mult, cs->shift);
}

/*
* clockevents
*/
Expand Down
19 changes: 19 additions & 0 deletions trunk/arch/arm/mach-nuc93x/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
if ARCH_NUC93X

config CPU_NUC932
bool
help
Support for NUC932 of Nuvoton NUC93X CPUs.

menu "NUC932 Machines"

config MACH_NUC932EVB
bool "Nuvoton NUC932 Evaluation Board"
default y
select CPU_NUC932
help
Say Y here if you are using the Nuvoton NUC932EVB

endmenu

endif
14 changes: 14 additions & 0 deletions trunk/arch/arm/mach-nuc93x/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Makefile for the linux kernel.
#

# Object file lists.

obj-y := irq.o time.o dev.o cpu.o clock.o
# NUC932 CPU support files

obj-$(CONFIG_CPU_NUC932) += nuc932.o

# machine support

obj-$(CONFIG_MACH_NUC932EVB) += mach-nuc932evb.o
3 changes: 3 additions & 0 deletions trunk/arch/arm/mach-nuc93x/Makefile.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zreladdr-y := 0x00008000
params_phys-y := 0x00000100

83 changes: 83 additions & 0 deletions trunk/arch/arm/mach-nuc93x/clock.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* linux/arch/arm/mach-nuc93x/clock.c
*
* Copyright (c) 2008 Nuvoton technology corporation
*
* Wan ZongShun <mcuos.com@gmail.com>
*
* 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.
*/

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/string.h>
#include <linux/clk.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/io.h>

#include <mach/hardware.h>

#include "clock.h"

static DEFINE_SPINLOCK(clocks_lock);

int clk_enable(struct clk *clk)
{
unsigned long flags;

spin_lock_irqsave(&clocks_lock, flags);
if (clk->enabled++ == 0)
(clk->enable)(clk, 1);
spin_unlock_irqrestore(&clocks_lock, flags);

return 0;
}
EXPORT_SYMBOL(clk_enable);

void clk_disable(struct clk *clk)
{
unsigned long flags;

WARN_ON(clk->enabled == 0);

spin_lock_irqsave(&clocks_lock, flags);
if (--clk->enabled == 0)
(clk->enable)(clk, 0);
spin_unlock_irqrestore(&clocks_lock, flags);
}
EXPORT_SYMBOL(clk_disable);

unsigned long clk_get_rate(struct clk *clk)
{
return 27000000;
}
EXPORT_SYMBOL(clk_get_rate);

void nuc93x_clk_enable(struct clk *clk, int enable)
{
unsigned int clocks = clk->cken;
unsigned long clken;

clken = __raw_readl(NUC93X_VA_CLKPWR);

if (enable)
clken |= clocks;
else
clken &= ~clocks;

__raw_writel(clken, NUC93X_VA_CLKPWR);
}

void clks_register(struct clk_lookup *clks, size_t num)
{
int i;

for (i = 0; i < num; i++)
clkdev_add(&clks[i]);
}
36 changes: 36 additions & 0 deletions trunk/arch/arm/mach-nuc93x/clock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* linux/arch/arm/mach-nuc93x/clock.h
*
* Copyright (c) 2008 Nuvoton technology corporation
*
* Wan ZongShun <mcuos.com@gmail.com>
*
* 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.
*/

#include <asm/clkdev.h>

void nuc93x_clk_enable(struct clk *clk, int enable);
void clks_register(struct clk_lookup *clks, size_t num);

struct clk {
unsigned long cken;
unsigned int enabled;
void (*enable)(struct clk *, int enable);
};

#define DEFINE_CLK(_name, _ctrlbit) \
struct clk clk_##_name = { \
.enable = nuc93x_clk_enable, \
.cken = (1 << _ctrlbit), \
}

#define DEF_CLKLOOK(_clk, _devname, _conname) \
{ \
.clk = _clk, \
.dev_id = _devname, \
.con_id = _conname, \
}

135 changes: 135 additions & 0 deletions trunk/arch/arm/mach-nuc93x/cpu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
* linux/arch/arm/mach-nuc93x/cpu.c
*
* Copyright (c) 2009 Nuvoton corporation.
*
* Wan ZongShun <mcuos.com@gmail.com>
*
* NUC93x series cpu common 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;version 2 of the License.
*
*/

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/serial_8250.h>
#include <linux/delay.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/irq.h>

#include <mach/hardware.h>
#include <mach/regs-serial.h>
#include <mach/regs-clock.h>
#include <mach/regs-ebi.h>

#include "cpu.h"
#include "clock.h"

/* Initial IO mappings */

static struct map_desc nuc93x_iodesc[] __initdata = {
IODESC_ENT(IRQ),
IODESC_ENT(GCR),
IODESC_ENT(UART),
IODESC_ENT(TIMER),
IODESC_ENT(EBI),
};

/* Initial nuc932 clock declarations. */
static DEFINE_CLK(audio, 2);
static DEFINE_CLK(sd, 3);
static DEFINE_CLK(jpg, 4);
static DEFINE_CLK(video, 5);
static DEFINE_CLK(vpost, 6);
static DEFINE_CLK(2d, 7);
static DEFINE_CLK(gpu, 8);
static DEFINE_CLK(gdma, 9);
static DEFINE_CLK(adc, 10);
static DEFINE_CLK(uart, 11);
static DEFINE_CLK(spi, 12);
static DEFINE_CLK(pwm, 13);
static DEFINE_CLK(timer, 14);
static DEFINE_CLK(wdt, 15);
static DEFINE_CLK(ac97, 16);
static DEFINE_CLK(i2s, 16);
static DEFINE_CLK(usbck, 17);
static DEFINE_CLK(usb48, 18);
static DEFINE_CLK(usbh, 19);
static DEFINE_CLK(i2c, 20);
static DEFINE_CLK(ext, 0);

static struct clk_lookup nuc932_clkregs[] = {
DEF_CLKLOOK(&clk_audio, "nuc932-audio", NULL),
DEF_CLKLOOK(&clk_sd, "nuc932-sd", NULL),
DEF_CLKLOOK(&clk_jpg, "nuc932-jpg", "NULL"),
DEF_CLKLOOK(&clk_video, "nuc932-video", "NULL"),
DEF_CLKLOOK(&clk_vpost, "nuc932-vpost", NULL),
DEF_CLKLOOK(&clk_2d, "nuc932-2d", NULL),
DEF_CLKLOOK(&clk_gpu, "nuc932-gpu", NULL),
DEF_CLKLOOK(&clk_gdma, "nuc932-gdma", "NULL"),
DEF_CLKLOOK(&clk_adc, "nuc932-adc", NULL),
DEF_CLKLOOK(&clk_uart, NULL, "uart"),
DEF_CLKLOOK(&clk_spi, "nuc932-spi", NULL),
DEF_CLKLOOK(&clk_pwm, "nuc932-pwm", NULL),
DEF_CLKLOOK(&clk_timer, NULL, "timer"),
DEF_CLKLOOK(&clk_wdt, "nuc932-wdt", NULL),
DEF_CLKLOOK(&clk_ac97, "nuc932-ac97", NULL),
DEF_CLKLOOK(&clk_i2s, "nuc932-i2s", NULL),
DEF_CLKLOOK(&clk_usbck, "nuc932-usbck", NULL),
DEF_CLKLOOK(&clk_usb48, "nuc932-usb48", NULL),
DEF_CLKLOOK(&clk_usbh, "nuc932-usbh", NULL),
DEF_CLKLOOK(&clk_i2c, "nuc932-i2c", NULL),
DEF_CLKLOOK(&clk_ext, NULL, "ext"),
};

/* Initial serial platform data */

struct plat_serial8250_port nuc93x_uart_data[] = {
NUC93X_8250PORT(UART0),
{},
};

struct platform_device nuc93x_serial_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = nuc93x_uart_data,
},
};

/*Init NUC93x evb io*/

void __init nuc93x_map_io(struct map_desc *mach_desc, int mach_size)
{
unsigned long idcode = 0x0;

iotable_init(mach_desc, mach_size);
iotable_init(nuc93x_iodesc, ARRAY_SIZE(nuc93x_iodesc));

idcode = __raw_readl(NUC93XPDID);
if (idcode == NUC932_CPUID)
printk(KERN_INFO "CPU type 0x%08lx is NUC910\n", idcode);
else
printk(KERN_ERR "CPU type detect error!\n");

}

/*Init NUC93x clock*/

void __init nuc93x_init_clocks(void)
{
clks_register(nuc932_clkregs, ARRAY_SIZE(nuc932_clkregs));
}

48 changes: 48 additions & 0 deletions trunk/arch/arm/mach-nuc93x/cpu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* arch/arm/mach-nuc93x/cpu.h
*
* Copyright (c) 2008 Nuvoton technology corporation
* All rights reserved.
*
* Header file for NUC93X CPU support
*
* Wan ZongShun <mcuos.com@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/

#define IODESC_ENT(y) \
{ \
.virtual = (unsigned long)NUC93X_VA_##y, \
.pfn = __phys_to_pfn(NUC93X_PA_##y), \
.length = NUC93X_SZ_##y, \
.type = MT_DEVICE, \
}

#define NUC93X_8250PORT(name) \
{ \
.membase = name##_BA, \
.mapbase = name##_PA, \
.irq = IRQ_##name, \
.uartclk = 57139200, \
.regshift = 2, \
.iotype = UPIO_MEM, \
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
}

/*Cpu identifier register*/

#define NUC93XPDID NUC93X_VA_GCR
#define NUC932_CPUID 0x29550091

/* extern file from cpu.c */

extern void nuc93x_clock_source(struct device *dev, unsigned char *src);
extern void nuc93x_init_clocks(void);
extern void nuc93x_map_io(struct map_desc *mach_desc, int mach_size);
extern void nuc93x_board_init(struct platform_device **device, int size);
extern struct platform_device nuc93x_serial_device;

Loading

0 comments on commit 917c311

Please sign in to comment.