Commit 266994e3 authored by Finn Thain's avatar Finn Thain Committed by Geert Uytterhoeven
Browse files

m68k: mac: Refactor iop_preinit() and iop_init()



The idea behind iop_preinit() was to put the SCC IOP into bypass mode.
However, that remains unimplemented and implementing it would be
difficult. Let the comments and code reflect this. Even if iop_preinit()
worked as described in the comments, it gets called immediately before
iop_init() so it might as well part of iop_init().

Cc: Joshua Thompson <funaho@jurai.org>
Tested-by: default avatarStan Johnson <userm57@yahoo.com>
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Link: https://lore.kernel.org/r/0a7b09f5e5f48e270b82041c19e8f20f54c69216.1605847196.git.fthain@telegraphics.com.au


Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 8ae0b65a
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ struct mac_booter_data mac_bi_data;
static unsigned long mac_orig_videoaddr;

extern int mac_hwclk(int, struct rtc_time *);
extern void iop_preinit(void);
extern void iop_init(void);
extern void via_init(void);
extern void via_init_clock(irq_handler_t func);
@@ -834,13 +833,6 @@ static void __init mac_identify(void)
		break;
	}

	/*
	 * We need to pre-init the IOPs, if any. Otherwise
	 * the serial console won't work if the user had
	 * the serial ports set to "Faster" mode in MacOS.
	 */
	iop_preinit();

	pr_info("Detected Macintosh model: %d\n", model);

	/*
+18 −36
Original line number Diff line number Diff line
@@ -47,6 +47,10 @@
 *
 * TODO:
 *
 * o The SCC IOP has to be placed in bypass mode before the serial console
 *   gets initialized. iop_init() would be one place to do that. Or the
 *   bootloader could do that. For now, the Serial Switch control panel
 *   is needed for that -- contrary to the changelog above.
 * o Something should be periodically checking iop_alive() to make sure the
 *   IOP hasn't died.
 * o Some of the IOP manager routines need better error checking and
@@ -225,52 +229,30 @@ static struct iop_msg *iop_get_unused_msg(void)
}

/*
 * This is called by the startup code before anything else. Its purpose
 * is to find and initialize the IOPs early in the boot sequence, so that
 * the serial IOP can be placed into bypass mode _before_ we try to
 * initialize the serial console.
 * Initialize the IOPs, if present.
 */

void __init iop_preinit(void)
void __init iop_init(void)
{
	int i;

	if (macintosh_config->scc_type == MAC_SCC_IOP) {
		if (macintosh_config->ident == MAC_MODEL_IIFX) {
		if (macintosh_config->ident == MAC_MODEL_IIFX)
			iop_base[IOP_NUM_SCC] = (struct mac_iop *)SCC_IOP_BASE_IIFX;
		} else {
		else
			iop_base[IOP_NUM_SCC] = (struct mac_iop *)SCC_IOP_BASE_QUADRA;
		}
		iop_scc_present = 1;
	} else {
		iop_base[IOP_NUM_SCC] = NULL;
		iop_scc_present = 0;
		pr_debug("SCC IOP detected at %p\n", iop_base[IOP_NUM_SCC]);
	}
	if (macintosh_config->adb_type == MAC_ADB_IOP) {
		if (macintosh_config->ident == MAC_MODEL_IIFX) {
		if (macintosh_config->ident == MAC_MODEL_IIFX)
			iop_base[IOP_NUM_ISM] = (struct mac_iop *)ISM_IOP_BASE_IIFX;
		} else {
		else
			iop_base[IOP_NUM_ISM] = (struct mac_iop *)ISM_IOP_BASE_QUADRA;
		}
		iop_stop(iop_base[IOP_NUM_ISM]);
		iop_ism_present = 1;
	} else {
		iop_base[IOP_NUM_ISM] = NULL;
		iop_ism_present = 0;
	}
}

/*
 * Initialize the IOPs, if present.
 */

void __init iop_init(void)
{
	int i;

	if (iop_scc_present) {
		pr_debug("SCC IOP detected at %p\n", iop_base[IOP_NUM_SCC]);
	}
	if (iop_ism_present) {
		pr_debug("ISM IOP detected at %p\n", iop_base[IOP_NUM_ISM]);

		iop_stop(iop_base[IOP_NUM_ISM]);
		iop_start(iop_base[IOP_NUM_ISM]);
		iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */
	}