diff options
Diffstat (limited to 'arch/m68k/atari')
| -rw-r--r-- | arch/m68k/atari/ataints.c | 4 | ||||
| -rw-r--r-- | arch/m68k/atari/config.c | 10 | ||||
| -rw-r--r-- | arch/m68k/atari/debug.c | 5 | ||||
| -rw-r--r-- | arch/m68k/atari/stram.c | 71 | 
4 files changed, 68 insertions, 22 deletions
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c index 20cde4e9fc7..3d2b63bedf0 100644 --- a/arch/m68k/atari/ataints.c +++ b/arch/m68k/atari/ataints.c @@ -41,6 +41,7 @@  #include <linux/init.h>  #include <linux/seq_file.h>  #include <linux/module.h> +#include <linux/irq.h>  #include <asm/traps.h> @@ -333,6 +334,9 @@ void __init atari_init_IRQ(void)  	m68k_setup_irq_controller(&atari_mfptimer_chip, handle_simple_irq,  				  IRQ_MFP_TIMER1, 8); +	irq_set_status_flags(IRQ_MFP_TIMER1, IRQ_IS_POLLED); +	irq_set_status_flags(IRQ_MFP_TIMER2, IRQ_IS_POLLED); +  	/* prepare timer D data for use as poll interrupt */  	/* set Timer D data Register - needs to be > 0 */  	st_mfp.tim_dt_d = 254;	/* < 100 Hz */ diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index fb2d0bd9b3a..01a62161b08 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c @@ -37,6 +37,8 @@  #include <linux/module.h>  #include <asm/bootinfo.h> +#include <asm/bootinfo-atari.h> +#include <asm/byteorder.h>  #include <asm/setup.h>  #include <asm/atarihw.h>  #include <asm/atariints.h> @@ -129,14 +131,14 @@ static int __init scc_test(volatile char *ctla)  int __init atari_parse_bootinfo(const struct bi_record *record)  {  	int unknown = 0; -	const u_long *data = record->data; +	const void *data = record->data; -	switch (record->tag) { +	switch (be16_to_cpu(record->tag)) {  	case BI_ATARI_MCH_COOKIE: -		atari_mch_cookie = *data; +		atari_mch_cookie = be32_to_cpup(data);  		break;  	case BI_ATARI_MCH_TYPE: -		atari_mch_type = *data; +		atari_mch_type = be32_to_cpup(data);  		break;  	default:  		unknown = 1; diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c index a547ba9683d..03cb5e08d7c 100644 --- a/arch/m68k/atari/debug.c +++ b/arch/m68k/atari/debug.c @@ -287,6 +287,8 @@ static void __init atari_init_midi_port(int cflag)  static int __init atari_debug_setup(char *arg)  { +	bool registered; +  	if (!MACH_IS_ATARI)  		return 0; @@ -294,6 +296,7 @@ static int __init atari_debug_setup(char *arg)  		/* defaults to ser2 for a Falcon and ser1 otherwise */  		arg = MACH_IS_FALCON ? "ser2" : "ser1"; +	registered = !!atari_console_driver.write;  	if (!strcmp(arg, "ser1")) {  		/* ST-MFP Modem1 serial port */  		atari_init_mfp_port(B9600|CS8); @@ -317,7 +320,7 @@ static int __init atari_debug_setup(char *arg)  		sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */  		atari_console_driver.write = atari_par_console_write;  	} -	if (atari_console_driver.write) +	if (atari_console_driver.write && !registered)  		register_console(&atari_console_driver);  	return 0; diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index 0810c8d56e5..5f8cb5a234d 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c @@ -47,6 +47,7 @@ static struct resource stram_pool = {  static unsigned long pool_size = 1024*1024; +static unsigned long stram_virt_offset;  static int __init atari_stram_setup(char *arg)  { @@ -67,14 +68,12 @@ early_param("stram_pool", atari_stram_setup);  void __init atari_stram_init(void)  {  	int i; -	void *stram_start;  	/*  	 * determine whether kernel code resides in ST-RAM  	 * (then ST-RAM is the first memory block at virtual 0x0)  	 */ -	stram_start = phys_to_virt(0); -	kernel_in_stram = (stram_start == 0); +	kernel_in_stram = (m68k_memory[0].addr == 0);  	for (i = 0; i < m68k_num_memory; ++i) {  		if (m68k_memory[i].addr == 0) { @@ -89,24 +88,62 @@ void __init atari_stram_init(void)  /*   * This function is called from setup_arch() to reserve the pages needed for - * ST-RAM management. + * ST-RAM management, if the kernel resides in ST-RAM.   */  void __init atari_stram_reserve_pages(void *start_mem)  { -	/* -	 * always reserve first page of ST-RAM, the first 2 KiB are -	 * supervisor-only! -	 */ -	if (!kernel_in_stram) -		reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); +	if (kernel_in_stram) { +		pr_debug("atari_stram pool: kernel in ST-RAM, using alloc_bootmem!\n"); +		stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size); +		stram_pool.end = stram_pool.start + pool_size - 1; +		request_resource(&iomem_resource, &stram_pool); +		stram_virt_offset = 0; +		pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n", +			pool_size, &stram_pool); +		pr_debug("atari_stram pool: stram_virt_offset = %lx\n", +			stram_virt_offset); +	} +} -	stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size); -	stram_pool.end = stram_pool.start + pool_size - 1; -	request_resource(&iomem_resource, &stram_pool); -	pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n", -		 pool_size, &stram_pool); +/* + * This function is called as arch initcall to reserve the pages needed for + * ST-RAM management, if the kernel does not reside in ST-RAM. + */ +int __init atari_stram_map_pages(void) +{ +	if (!kernel_in_stram) { +		/* +		 * Skip page 0, as the fhe first 2 KiB are supervisor-only! +		 */ +		pr_debug("atari_stram pool: kernel not in ST-RAM, using ioremap!\n"); +		stram_pool.start = PAGE_SIZE; +		stram_pool.end = stram_pool.start + pool_size - 1; +		request_resource(&iomem_resource, &stram_pool); +		stram_virt_offset = (unsigned long) ioremap(stram_pool.start, +				resource_size(&stram_pool)) - stram_pool.start; +		pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n", +			pool_size, &stram_pool); +		pr_debug("atari_stram pool: stram_virt_offset = %lx\n", +			stram_virt_offset); +	} +	return 0; +} +arch_initcall(atari_stram_map_pages); + + +void *atari_stram_to_virt(unsigned long phys) +{ +	return (void *)(phys + stram_virt_offset); +} +EXPORT_SYMBOL(atari_stram_to_virt); + + +unsigned long atari_stram_to_phys(void *virt) +{ +	return (unsigned long)(virt - stram_virt_offset);  } +EXPORT_SYMBOL(atari_stram_to_phys);  void *atari_stram_alloc(unsigned long size, const char *owner) @@ -134,14 +171,14 @@ void *atari_stram_alloc(unsigned long size, const char *owner)  	}  	pr_debug("atari_stram_alloc: returning %pR\n", res); -	return (void *)res->start; +	return atari_stram_to_virt(res->start);  }  EXPORT_SYMBOL(atari_stram_alloc);  void atari_stram_free(void *addr)  { -	unsigned long start = (unsigned long)addr; +	unsigned long start = atari_stram_to_phys(addr);  	struct resource *res;  	unsigned long size;  | 
