Subject: linux-next: manual merge of the rtc tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 25 Nov 2024 13:50:19 +1100

Hi all,

Today's linux-next merge of the rtc tree got a conflict in:

  arch/m68k/mvme147/config.c

between commits:

  2a9517b6f9c4 ("m68k: mvme147: Make mvme147_sched_init() __init")
  077b33b9e283 ("m68k: mvme147: Reinstate early console")

from Linus' tree and commit:

  1ec371bab200 ("m68k: mvme147, mvme16x: Adopt rtc-m48t59 platform driver")

from the rtc tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/m68k/mvme147/config.c
index 824c42a302c6,2e8f41636efb..000000000000
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@@ -32,11 -33,9 +33,10 @@@
  #include <asm/mvme147hw.h>
  #include <asm/config.h>
  
 +#include "mvme147.h"
  
  static void mvme147_get_model(char *model);
 -extern void mvme147_sched_init(void);
 +static void __init mvme147_sched_init(void);
- extern int mvme147_hwclk (int, struct rtc_time *);
  extern void mvme147_reset (void);

@@@ -162,56 -179,3 +180,31 @@@ static u64 mvme147_read_clk(struct cloc
  	return ticks;
  }
  
- static int bcd2int (unsigned char b)
- {
- 	return ((b>>4)*10 + (b&15));
- }
- 
- int mvme147_hwclk(int op, struct rtc_time *t)
- {
- 	if (!op) {
- 		m147_rtc->ctrl = RTC_READ;
- 		t->tm_year = bcd2int (m147_rtc->bcd_year);
- 		t->tm_mon  = bcd2int(m147_rtc->bcd_mth) - 1;
- 		t->tm_mday = bcd2int (m147_rtc->bcd_dom);
- 		t->tm_hour = bcd2int (m147_rtc->bcd_hr);
- 		t->tm_min  = bcd2int (m147_rtc->bcd_min);
- 		t->tm_sec  = bcd2int (m147_rtc->bcd_sec);
- 		m147_rtc->ctrl = 0;
- 		if (t->tm_year < 70)
- 			t->tm_year += 100;
- 	} else {
- 		/* FIXME Setting the time is not yet supported */
- 		return -EOPNOTSUPP;
- 	}
- 	return 0;
- }
- 
 +static void scc_delay(void)
 +{
 +	__asm__ __volatile__ ("nop; nop;");
 +}
 +
 +static void scc_write(char ch)
 +{
 +	do {
 +		scc_delay();
 +	} while (!(in_8(M147_SCC_A_ADDR) & BIT(2)));
 +	scc_delay();
 +	out_8(M147_SCC_A_ADDR, 8);
 +	scc_delay();
 +	out_8(M147_SCC_A_ADDR, ch);
 +}
 +
 +void mvme147_scc_write(struct console *co, const char *str, unsigned int count)
 +{
 +	unsigned long flags;
 +
 +	local_irq_save(flags);
 +	while (count--)	{
 +		if (*str == '\n')
 +			scc_write('\r');
 +		scc_write(*str++);
 +	}
 +	local_irq_restore(flags);
 +}