diff options
Diffstat (limited to 'arch/mn10300/unit-asb2303')
-rw-r--r-- | arch/mn10300/unit-asb2303/Makefile | 6 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2303/leds.c | 52 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2303/smc91111.c | 52 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2303/unit-init.c | 60 |
4 files changed, 170 insertions, 0 deletions
diff --git a/arch/mn10300/unit-asb2303/Makefile b/arch/mn10300/unit-asb2303/Makefile new file mode 100644 index 000000000000..03e579fa99d0 --- /dev/null +++ b/arch/mn10300/unit-asb2303/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | ############################################################################### | ||
2 | # | ||
3 | # Makefile for the ASB2303 board | ||
4 | # | ||
5 | ############################################################################### | ||
6 | obj-y := unit-init.o smc91111.o leds.o | ||
diff --git a/arch/mn10300/unit-asb2303/leds.c b/arch/mn10300/unit-asb2303/leds.c new file mode 100644 index 000000000000..cd4bc78ccfc8 --- /dev/null +++ b/arch/mn10300/unit-asb2303/leds.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* ASB2303 peripheral 7-segment LEDs x1 support | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/param.h> | ||
13 | #include <linux/init.h> | ||
14 | |||
15 | #include <asm/io.h> | ||
16 | #include <asm/processor.h> | ||
17 | #include <asm/intctl-regs.h> | ||
18 | #include <asm/rtc-regs.h> | ||
19 | #include <asm/unit/leds.h> | ||
20 | |||
21 | #if 0 | ||
22 | static const u8 asb2303_led_hex_tbl[16] = { | ||
23 | 0x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0, | ||
24 | 0x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c | ||
25 | }; | ||
26 | #endif | ||
27 | |||
28 | static const u8 asb2303_led_chase_tbl[6] = { | ||
29 | ~0x02, /* top - segA */ | ||
30 | ~0x04, /* right top - segB */ | ||
31 | ~0x08, /* right bottom - segC */ | ||
32 | ~0x10, /* bottom - segD */ | ||
33 | ~0x20, /* left bottom - segE */ | ||
34 | ~0x40, /* left top - segF */ | ||
35 | }; | ||
36 | |||
37 | static unsigned asb2303_led_chase; | ||
38 | |||
39 | void peripheral_leds_display_exception(enum exception_code code) | ||
40 | { | ||
41 | ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */ | ||
42 | ASB2303_7SEGLEDS = 0x6d; /* triple horizontal bar */ | ||
43 | } | ||
44 | |||
45 | void peripheral_leds_led_chase(void) | ||
46 | { | ||
47 | ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */ | ||
48 | ASB2303_7SEGLEDS = asb2303_led_chase_tbl[asb2303_led_chase]; | ||
49 | asb2303_led_chase++; | ||
50 | if (asb2303_led_chase >= 6) | ||
51 | asb2303_led_chase = 0; | ||
52 | } | ||
diff --git a/arch/mn10300/unit-asb2303/smc91111.c b/arch/mn10300/unit-asb2303/smc91111.c new file mode 100644 index 000000000000..30875dd65631 --- /dev/null +++ b/arch/mn10300/unit-asb2303/smc91111.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* ASB2303 initialisation | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/param.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #include <asm/io.h> | ||
18 | #include <asm/timex.h> | ||
19 | #include <asm/processor.h> | ||
20 | #include <asm/intctl-regs.h> | ||
21 | #include <asm/unit/smc91111.h> | ||
22 | |||
23 | static struct resource smc91c111_resources[] = { | ||
24 | [0] = { | ||
25 | .start = SMC91111_BASE, | ||
26 | .end = SMC91111_BASE_END, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | [1] = { | ||
30 | .start = SMC91111_IRQ, | ||
31 | .end = SMC91111_IRQ, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | }; | ||
35 | |||
36 | static struct platform_device smc91c111_device = { | ||
37 | .name = "smc91x", | ||
38 | .id = 0, | ||
39 | .num_resources = ARRAY_SIZE(smc91c111_resources), | ||
40 | .resource = smc91c111_resources, | ||
41 | }; | ||
42 | |||
43 | /* | ||
44 | * add platform devices | ||
45 | */ | ||
46 | static int __init unit_device_init(void) | ||
47 | { | ||
48 | platform_device_register(&smc91c111_device); | ||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | device_initcall(unit_device_init); | ||
diff --git a/arch/mn10300/unit-asb2303/unit-init.c b/arch/mn10300/unit-asb2303/unit-init.c new file mode 100644 index 000000000000..14b2c817cff8 --- /dev/null +++ b/arch/mn10300/unit-asb2303/unit-init.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* ASB2303 initialisation | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/param.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/device.h> | ||
16 | |||
17 | #include <asm/io.h> | ||
18 | #include <asm/setup.h> | ||
19 | #include <asm/processor.h> | ||
20 | #include <asm/irq.h> | ||
21 | #include <asm/intctl-regs.h> | ||
22 | |||
23 | /* | ||
24 | * initialise some of the unit hardware before gdbstub is set up | ||
25 | */ | ||
26 | asmlinkage void __init unit_init(void) | ||
27 | { | ||
28 | /* set up the external interrupts */ | ||
29 | SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_HILEVEL); | ||
30 | SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); | ||
31 | SET_XIRQ_TRIGGER(3, XIRQ_TRIGGER_HILEVEL); | ||
32 | SET_XIRQ_TRIGGER(4, XIRQ_TRIGGER_LOWLEVEL); | ||
33 | SET_XIRQ_TRIGGER(5, XIRQ_TRIGGER_LOWLEVEL); | ||
34 | } | ||
35 | |||
36 | /* | ||
37 | * initialise the rest of the unit hardware after gdbstub is ready | ||
38 | */ | ||
39 | void __init unit_setup(void) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * initialise the external interrupts used by a unit of this type | ||
45 | */ | ||
46 | void __init unit_init_IRQ(void) | ||
47 | { | ||
48 | unsigned int extnum; | ||
49 | |||
50 | for (extnum = 0; extnum < NR_XIRQS; extnum++) { | ||
51 | switch (GET_XIRQ_TRIGGER(extnum)) { | ||
52 | case XIRQ_TRIGGER_HILEVEL: | ||
53 | case XIRQ_TRIGGER_LOWLEVEL: | ||
54 | set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq); | ||
55 | break; | ||
56 | default: | ||
57 | break; | ||
58 | } | ||
59 | } | ||
60 | } | ||