18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * linux/arch/arm/mach-footbridge/cats-hw.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * CATS machine fixup
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 1998, 1999 Russell King, Phil Blundell
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#include <linux/ioport.h>
108c2ecf20Sopenharmony_ci#include <linux/kernel.h>
118c2ecf20Sopenharmony_ci#include <linux/init.h>
128c2ecf20Sopenharmony_ci#include <linux/screen_info.h>
138c2ecf20Sopenharmony_ci#include <linux/io.h>
148c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <asm/hardware/dec21285.h>
178c2ecf20Sopenharmony_ci#include <asm/mach-types.h>
188c2ecf20Sopenharmony_ci#include <asm/setup.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include "common.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define CFG_PORT	0x370
258c2ecf20Sopenharmony_ci#define INDEX_PORT	(CFG_PORT)
268c2ecf20Sopenharmony_ci#define DATA_PORT	(CFG_PORT + 1)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistatic int __init cats_hw_init(void)
298c2ecf20Sopenharmony_ci{
308c2ecf20Sopenharmony_ci	if (machine_is_cats()) {
318c2ecf20Sopenharmony_ci		/* Set Aladdin to CONFIGURE mode */
328c2ecf20Sopenharmony_ci		outb(0x51, CFG_PORT);
338c2ecf20Sopenharmony_ci		outb(0x23, CFG_PORT);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci		/* Select logical device 3 */
368c2ecf20Sopenharmony_ci		outb(0x07, INDEX_PORT);
378c2ecf20Sopenharmony_ci		outb(0x03, DATA_PORT);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci		/* Set parallel port to DMA channel 3, ECP+EPP1.9,
408c2ecf20Sopenharmony_ci		   enable EPP timeout */
418c2ecf20Sopenharmony_ci		outb(0x74, INDEX_PORT);
428c2ecf20Sopenharmony_ci		outb(0x03, DATA_PORT);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci		outb(0xf0, INDEX_PORT);
458c2ecf20Sopenharmony_ci		outb(0x0f, DATA_PORT);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci		outb(0xf1, INDEX_PORT);
488c2ecf20Sopenharmony_ci		outb(0x07, DATA_PORT);
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci		/* Select logical device 4 */
518c2ecf20Sopenharmony_ci		outb(0x07, INDEX_PORT);
528c2ecf20Sopenharmony_ci		outb(0x04, DATA_PORT);
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci		/* UART1 high speed mode */
558c2ecf20Sopenharmony_ci		outb(0xf0, INDEX_PORT);
568c2ecf20Sopenharmony_ci		outb(0x02, DATA_PORT);
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci		/* Select logical device 5 */
598c2ecf20Sopenharmony_ci		outb(0x07, INDEX_PORT);
608c2ecf20Sopenharmony_ci		outb(0x05, DATA_PORT);
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci		/* UART2 high speed mode */
638c2ecf20Sopenharmony_ci		outb(0xf0, INDEX_PORT);
648c2ecf20Sopenharmony_ci		outb(0x02, DATA_PORT);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci		/* Set Aladdin to RUN mode */
678c2ecf20Sopenharmony_ci		outb(0xbb, CFG_PORT);
688c2ecf20Sopenharmony_ci	}
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	return 0;
718c2ecf20Sopenharmony_ci}
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci__initcall(cats_hw_init);
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/*
768c2ecf20Sopenharmony_ci * CATS uses soft-reboot by default, since
778c2ecf20Sopenharmony_ci * hard reboots fail on early boards.
788c2ecf20Sopenharmony_ci */
798c2ecf20Sopenharmony_cistatic void __init
808c2ecf20Sopenharmony_cifixup_cats(struct tag *tags, char **cmdline)
818c2ecf20Sopenharmony_ci{
828c2ecf20Sopenharmony_ci#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
838c2ecf20Sopenharmony_ci	screen_info.orig_video_lines  = 25;
848c2ecf20Sopenharmony_ci	screen_info.orig_video_points = 16;
858c2ecf20Sopenharmony_ci	screen_info.orig_y = 24;
868c2ecf20Sopenharmony_ci#endif
878c2ecf20Sopenharmony_ci}
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciMACHINE_START(CATS, "Chalice-CATS")
908c2ecf20Sopenharmony_ci	/* Maintainer: Philip Blundell */
918c2ecf20Sopenharmony_ci	.atag_offset	= 0x100,
928c2ecf20Sopenharmony_ci	.reboot_mode	= REBOOT_SOFT,
938c2ecf20Sopenharmony_ci	.fixup		= fixup_cats,
948c2ecf20Sopenharmony_ci	.map_io		= footbridge_map_io,
958c2ecf20Sopenharmony_ci	.init_irq	= footbridge_init_irq,
968c2ecf20Sopenharmony_ci	.init_time	= isa_timer_init,
978c2ecf20Sopenharmony_ci	.restart	= footbridge_restart,
988c2ecf20Sopenharmony_ciMACHINE_END
99