2 * /arch/arm/mach-s3c24a0/smdk.c
4 * This file contains all SMDK24A0 specific tweaks.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
12 * 2005/03/24 <hyok.choi@samsung.com> update for 2.6.10
13 * 2004/06/10 <heechul.yun@samsung.com> Initial CPLD IDE support for SPJ
14 * 2004/06/13 <heechul.yun@samsung.com> CPLD IDE and USB csupport for SPJ
15 * 2004/06/23 <heechul.yun@samsung.com> Added bank1 access functions and now
16 * IDE works with cs8900.
20 #include <linux/init.h>
21 #include <linux/kernel.h>
22 #include <linux/sched.h>
23 #include <linux/tty.h>
24 #include <linux/module.h>
25 #include <linux/errno.h>
26 #include <linux/serial_core.h>
28 #include <asm/hardware.h>
29 #include <asm/setup.h>
31 #include <asm/pgtable.h>
32 #include <asm/sizes.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
36 #include <asm/mach-types.h>
42 # define PDEBUG(fmt, args...) \
43 printk(KERN_DEBUG "[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args)
45 # define PDEBUG(fmt, args...) do {} while(0)
48 /* global lock to protect bank1 register settings */
49 spinlock_t bank1_lock
= SPIN_LOCK_UNLOCKED
;
51 bank_param_t bank1_params
[] =
53 { 0x08, 0x3740 }, /* B1_IDE_PIO0 */
54 { 0x08, 0x2340 }, /* B1_IDE_PIO4 */
55 { 0x38, 0x3740 }, /* B1_CS89x0 */
56 { 0x00, 0x2200 }, /* B1_USB2 */
59 /* bank1 state of interrupt context */
60 static int b1_int_state
= B1_STATE_NONE
;
63 * real_bank1_set_param: blah blah
65 static __inline__
void real_bank1_set_param(int bw_val
, int bc1_val
)
73 * bank1_set_state - set bank1 timing
78 void bank1_set_state(int state
)
83 if ( state
== B1_STATE_NONE
)
86 if ( state
> B1_STATE_LIMIT
|| state
< B1_STATE_NONE
)
87 panic("bank1: Inavlid state");
90 spin_lock_irqsave( &bank1_lock
, flags
);
93 current
->bank1_state
= state
;
95 real_bank1_set_param( bank1_params
[state
].bw
, bank1_params
[state
].bc
);
97 spin_unlock_irqrestore( &bank1_lock
, flags
);
103 void bank1_set_int_state(int state
)
108 if ( !in_interrupt() )
109 panic("bank1_set_int_state is called fron interrupt context\n");
111 spin_lock_irqsave( &bank1_lock
, flags
);
113 b1_int_state
= state
; /* set */
115 if ( state
== B1_STATE_NONE
) /* 1st level interrupt */
116 state
= current
->bank1_state
;
118 if ( state
!= B1_STATE_NONE
)
119 real_bank1_set_param( bank1_params
[state
].bw
, bank1_params
[state
].bc
);
121 spin_unlock_irqrestore( &bank1_lock
, flags
);
126 * bank1_get_int_state - bank1 state of interrupt context
128 int bank1_get_int_state(void)
133 EXPORT_SYMBOL(bank1_set_state
);
134 EXPORT_SYMBOL(bank1_set_int_state
);
135 EXPORT_SYMBOL(bank1_get_int_state
);
137 static int __init
smdk_init(void)
139 printk("%s: initialize smdk24a0 board\n", __func__
);
141 set_gpio_ctrl(SMDK_LED4
| GPIO_PULLUP_DIS
| GPIO_MODE_OUT
);
142 set_gpio_ctrl(SMDK_LED5
| GPIO_PULLUP_DIS
| GPIO_MODE_OUT
);
143 set_gpio_ctrl(SMDK_LED6
| GPIO_PULLUP_DIS
| GPIO_MODE_OUT
);
144 set_gpio_ctrl(SMDK_LED7
| GPIO_PULLUP_DIS
| GPIO_MODE_OUT
);
147 // real_bank1_set_param(0x38, 0x3740);
148 real_bank1_set_param(0x38, 0x2340);
150 real_bank1_set_param( bank1_params
[B1_CS89x0
].bw
, bank1_params
[B1_CS89x0
].bc
);
151 printk("Set BANK1 register (0x%x, 0x%x)\n", SROM_BW
, SROM_BC1
);
156 __initcall(smdk_init
);
162 static struct map_desc smdk_io_desc
[] __initdata
= {
163 /* virtual physical length domain r w c b */
164 { SMDK_CS8900_VIO
, SMDK_CS8900_PIO
, SZ_1M
, MT_DEVICE
},
165 { SMDK_CPLD_IDE_VIO
, SMDK_CPLD_IDE_PIO
, 0x00900000, MT_DEVICE
}, // hcyun
166 { SMDK_CPLD_USB_VIO
, SMDK_CPLD_USB_PIO
, 0x00900000, MT_DEVICE
}, // hcyun
169 static void __init
smdk_map_io(void)
171 elfin_map_io(); // 0x4000.0000 -> 0xe000.0000
173 #endif /* CONFIG_MMU */
175 static void __init
fixup_smdk(struct machine_desc
*desc
,
176 struct tag
*tags
, char **cmdline
, struct meminfo
*mi
)
179 iotable_init(smdk_io_desc
, ARRAY_SIZE(smdk_io_desc
));
181 #ifdef CONFIG_SERIAL_S3C24A0
182 elfin_register_uart(0, 0);
185 register_wakeup_src(0, EINT_RISING_EDGE
, 0);
191 #include <asm/mach/time.h>
193 extern void elfin_time_init(void);
194 extern unsigned long elfin_gettimeoffset(void);
196 extern void __init
elfin_init_irq(void);
198 extern struct sys_timer elfin_timer
;
202 MACHINE_START(S3C24A0
, "Samsung-SMDK24A0")
203 /* Maintainer: Hyok S. Choi */
205 .phys_ram
= 0x10000000,
206 .phys_io
= 0x40000000,
207 .io_pg_offst
= ((io_p2v (0xe0000000))>>18) & 0xfffc,
208 .boot_params
= 0x10000100,
209 .map_io
= smdk_map_io
,
211 .phys_ram
= 0x10000000,
212 .phys_io
= 0x40000000,
215 .init_irq
= elfin_init_irq
,
216 .timer
= &elfin_timer
,