diff options
Diffstat (limited to 'arch/sh/boards/dreamcast')
-rw-r--r-- | arch/sh/boards/dreamcast/irq.c | 15 | ||||
-rw-r--r-- | arch/sh/boards/dreamcast/rtc.c | 22 | ||||
-rw-r--r-- | arch/sh/boards/dreamcast/setup.c | 40 |
3 files changed, 30 insertions, 47 deletions
diff --git a/arch/sh/boards/dreamcast/irq.c b/arch/sh/boards/dreamcast/irq.c index b10a6b11c034..5bf01f86c20c 100644 --- a/arch/sh/boards/dreamcast/irq.c +++ b/arch/sh/boards/dreamcast/irq.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
13 | |||
14 | #include <asm/io.h> | 13 | #include <asm/io.h> |
15 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
16 | #include <asm/dreamcast/sysasic.h> | 15 | #include <asm/dreamcast/sysasic.h> |
@@ -26,10 +25,10 @@ | |||
26 | event. | 25 | event. |
27 | 26 | ||
28 | There are three 32-bit ESRs located at 0xa05f8900 - 0xa05f6908. Event | 27 | There are three 32-bit ESRs located at 0xa05f8900 - 0xa05f6908. Event |
29 | types can be found in include/asm-sh/dc_sysasic.h. There are three groups | 28 | types can be found in include/asm-sh/dreamcast/sysasic.h. There are three |
30 | of EMRs that parallel the ESRs. Each EMR group corresponds to an IRQ, so | 29 | groups of EMRs that parallel the ESRs. Each EMR group corresponds to an |
31 | 0xa05f6910 - 0xa05f6918 triggers IRQ 13, 0xa05f6920 - 0xa05f6928 triggers | 30 | IRQ, so 0xa05f6910 - 0xa05f6918 triggers IRQ 13, 0xa05f6920 - 0xa05f6928 |
32 | IRQ 11, and 0xa05f6930 - 0xa05f6938 triggers IRQ 9. | 31 | triggers IRQ 11, and 0xa05f6930 - 0xa05f6938 triggers IRQ 9. |
33 | 32 | ||
34 | In the kernel, these events are mapped to virtual IRQs so that drivers can | 33 | In the kernel, these events are mapped to virtual IRQs so that drivers can |
35 | respond to them as they would a normal interrupt. In order to keep this | 34 | respond to them as they would a normal interrupt. In order to keep this |
@@ -57,29 +56,23 @@ | |||
57 | /* Disable the hardware event by masking its bit in its EMR */ | 56 | /* Disable the hardware event by masking its bit in its EMR */ |
58 | static inline void disable_systemasic_irq(unsigned int irq) | 57 | static inline void disable_systemasic_irq(unsigned int irq) |
59 | { | 58 | { |
60 | unsigned long flags; | ||
61 | __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); | 59 | __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); |
62 | __u32 mask; | 60 | __u32 mask; |
63 | 61 | ||
64 | local_irq_save(flags); | ||
65 | mask = inl(emr); | 62 | mask = inl(emr); |
66 | mask &= ~(1 << EVENT_BIT(irq)); | 63 | mask &= ~(1 << EVENT_BIT(irq)); |
67 | outl(mask, emr); | 64 | outl(mask, emr); |
68 | local_irq_restore(flags); | ||
69 | } | 65 | } |
70 | 66 | ||
71 | /* Enable the hardware event by setting its bit in its EMR */ | 67 | /* Enable the hardware event by setting its bit in its EMR */ |
72 | static inline void enable_systemasic_irq(unsigned int irq) | 68 | static inline void enable_systemasic_irq(unsigned int irq) |
73 | { | 69 | { |
74 | unsigned long flags; | ||
75 | __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); | 70 | __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); |
76 | __u32 mask; | 71 | __u32 mask; |
77 | 72 | ||
78 | local_irq_save(flags); | ||
79 | mask = inl(emr); | 73 | mask = inl(emr); |
80 | mask |= (1 << EVENT_BIT(irq)); | 74 | mask |= (1 << EVENT_BIT(irq)); |
81 | outl(mask, emr); | 75 | outl(mask, emr); |
82 | local_irq_restore(flags); | ||
83 | } | 76 | } |
84 | 77 | ||
85 | /* Acknowledge a hardware event by writing its bit back to its ESR */ | 78 | /* Acknowledge a hardware event by writing its bit back to its ESR */ |
diff --git a/arch/sh/boards/dreamcast/rtc.c b/arch/sh/boards/dreamcast/rtc.c index 379de1629134..b3a876a3b859 100644 --- a/arch/sh/boards/dreamcast/rtc.c +++ b/arch/sh/boards/dreamcast/rtc.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* arch/sh/kernel/rtc-aica.c | 1 | /* |
2 | * arch/sh/boards/dreamcast/rtc.c | ||
2 | * | 3 | * |
3 | * Dreamcast AICA RTC routines. | 4 | * Dreamcast AICA RTC routines. |
4 | * | 5 | * |
@@ -10,15 +11,12 @@ | |||
10 | */ | 11 | */ |
11 | 12 | ||
12 | #include <linux/time.h> | 13 | #include <linux/time.h> |
13 | 14 | #include <asm/rtc.h> | |
14 | #include <asm/io.h> | 15 | #include <asm/io.h> |
15 | 16 | ||
16 | extern void (*rtc_get_time)(struct timespec *); | ||
17 | extern int (*rtc_set_time)(const time_t); | ||
18 | |||
19 | /* The AICA RTC has an Epoch of 1/1/1950, so we must subtract 20 years (in | 17 | /* The AICA RTC has an Epoch of 1/1/1950, so we must subtract 20 years (in |
20 | seconds to get the standard Unix Epoch when getting the time, and add 20 | 18 | seconds) to get the standard Unix Epoch when getting the time, and add |
21 | years when setting the time. */ | 19 | 20 years when setting the time. */ |
22 | #define TWENTY_YEARS ((20 * 365LU + 5) * 86400) | 20 | #define TWENTY_YEARS ((20 * 365LU + 5) * 86400) |
23 | 21 | ||
24 | /* The AICA RTC is represented by a 32-bit seconds counter stored in 2 16-bit | 22 | /* The AICA RTC is represented by a 32-bit seconds counter stored in 2 16-bit |
@@ -32,7 +30,8 @@ extern int (*rtc_set_time)(const time_t); | |||
32 | * | 30 | * |
33 | * Grabs the current RTC seconds counter and adjusts it to the Unix Epoch. | 31 | * Grabs the current RTC seconds counter and adjusts it to the Unix Epoch. |
34 | */ | 32 | */ |
35 | void aica_rtc_gettimeofday(struct timespec *ts) { | 33 | void aica_rtc_gettimeofday(struct timespec *ts) |
34 | { | ||
36 | unsigned long val1, val2; | 35 | unsigned long val1, val2; |
37 | 36 | ||
38 | do { | 37 | do { |
@@ -55,7 +54,8 @@ void aica_rtc_gettimeofday(struct timespec *ts) { | |||
55 | * | 54 | * |
56 | * Adjusts the given @tv to the AICA Epoch and sets the RTC seconds counter. | 55 | * Adjusts the given @tv to the AICA Epoch and sets the RTC seconds counter. |
57 | */ | 56 | */ |
58 | int aica_rtc_settimeofday(const time_t secs) { | 57 | int aica_rtc_settimeofday(const time_t secs) |
58 | { | ||
59 | unsigned long val1, val2; | 59 | unsigned long val1, val2; |
60 | unsigned long adj = secs + TWENTY_YEARS; | 60 | unsigned long adj = secs + TWENTY_YEARS; |
61 | 61 | ||
@@ -75,7 +75,7 @@ int aica_rtc_settimeofday(const time_t secs) { | |||
75 | 75 | ||
76 | void aica_time_init(void) | 76 | void aica_time_init(void) |
77 | { | 77 | { |
78 | rtc_get_time = aica_rtc_gettimeofday; | 78 | rtc_sh_get_time = aica_rtc_gettimeofday; |
79 | rtc_set_time = aica_rtc_settimeofday; | 79 | rtc_sh_set_time = aica_rtc_settimeofday; |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/arch/sh/boards/dreamcast/setup.c b/arch/sh/boards/dreamcast/setup.c index 0027b80a2343..f13017eeeb27 100644 --- a/arch/sh/boards/dreamcast/setup.c +++ b/arch/sh/boards/dreamcast/setup.c | |||
@@ -22,41 +22,21 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | |||
26 | #include <asm/io.h> | 25 | #include <asm/io.h> |
27 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | #include <asm/rtc.h> | ||
28 | #include <asm/machvec.h> | 28 | #include <asm/machvec.h> |
29 | #include <asm/machvec_init.h> | ||
30 | #include <asm/mach/sysasic.h> | 29 | #include <asm/mach/sysasic.h> |
31 | 30 | ||
32 | extern struct hw_interrupt_type systemasic_int; | 31 | extern struct hw_interrupt_type systemasic_int; |
33 | /* XXX: Move this into it's proper header. */ | ||
34 | extern void (*board_time_init)(void); | ||
35 | extern void aica_time_init(void); | 32 | extern void aica_time_init(void); |
36 | extern int gapspci_init(void); | 33 | extern int gapspci_init(void); |
37 | extern int systemasic_irq_demux(int); | 34 | extern int systemasic_irq_demux(int); |
38 | 35 | ||
39 | void *dreamcast_consistent_alloc(struct device *, size_t, dma_addr_t *, int); | 36 | void *dreamcast_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t); |
40 | int dreamcast_consistent_free(struct device *, size_t, void *, dma_addr_t); | 37 | int dreamcast_consistent_free(struct device *, size_t, void *, dma_addr_t); |
41 | 38 | ||
42 | const char *get_system_type(void) | 39 | static void __init dreamcast_setup(char **cmdline_p) |
43 | { | ||
44 | return "Sega Dreamcast"; | ||
45 | } | ||
46 | |||
47 | struct sh_machine_vector mv_dreamcast __initmv = { | ||
48 | .mv_nr_irqs = NR_IRQS, | ||
49 | |||
50 | .mv_irq_demux = systemasic_irq_demux, | ||
51 | |||
52 | #ifdef CONFIG_PCI | ||
53 | .mv_consistent_alloc = dreamcast_consistent_alloc, | ||
54 | .mv_consistent_free = dreamcast_consistent_free, | ||
55 | #endif | ||
56 | }; | ||
57 | ALIAS_MV(dreamcast) | ||
58 | |||
59 | int __init platform_setup(void) | ||
60 | { | 40 | { |
61 | int i; | 41 | int i; |
62 | 42 | ||
@@ -78,6 +58,16 @@ int __init platform_setup(void) | |||
78 | if (gapspci_init() < 0) | 58 | if (gapspci_init() < 0) |
79 | printk(KERN_WARNING "GAPSPCI was not detected.\n"); | 59 | printk(KERN_WARNING "GAPSPCI was not detected.\n"); |
80 | #endif | 60 | #endif |
81 | |||
82 | return 0; | ||
83 | } | 61 | } |
62 | |||
63 | struct sh_machine_vector mv_dreamcast __initmv = { | ||
64 | .mv_name = "Sega Dreamcast", | ||
65 | .mv_setup = dreamcast_setup, | ||
66 | .mv_irq_demux = systemasic_irq_demux, | ||
67 | |||
68 | #ifdef CONFIG_PCI | ||
69 | .mv_consistent_alloc = dreamcast_consistent_alloc, | ||
70 | .mv_consistent_free = dreamcast_consistent_free, | ||
71 | #endif | ||
72 | }; | ||
73 | ALIAS_MV(dreamcast) | ||