* [PATCH 3/3] m68k/mac: Remove bogus "FIXME" comment
2018-03-12 3:38 [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Finn Thain
2018-03-12 3:38 ` [PATCH 1/3] m68k/mac: Clean up whitespace and remove redundant parentheses Finn Thain
2018-03-12 3:38 ` [PATCH 2/3] m68k/mac: Enable RTC for 100-series PowerBooks Finn Thain
@ 2018-03-12 3:38 ` Finn Thain
2018-03-26 12:12 ` [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Geert Uytterhoeven
3 siblings, 0 replies; 5+ messages in thread
From: Finn Thain @ 2018-03-12 3:38 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel
This code works fine. The comment is misleading so remove it.
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
arch/m68k/mac/misc.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index e0a5e2dfeb46..6aa77d1af47a 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -329,10 +329,6 @@ static void via_shutdown(void)
}
}
-/*
- * FIXME: not sure how this is supposed to work exactly...
- */
-
static void oss_shutdown(void)
{
oss->rom_ctrl = OSS_POWEROFF;
--
2.16.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes
@ 2018-03-12 3:38 Finn Thain
2018-03-12 3:38 ` [PATCH 1/3] m68k/mac: Clean up whitespace and remove redundant parentheses Finn Thain
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Finn Thain @ 2018-03-12 3:38 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel
Finn Thain (3):
m68k/mac: Clean up whitespace and remove redundant parentheses
m68k/mac: Enable RTC for 100-series PowerBooks
m68k/mac: Remove bogus "FIXME" comment
arch/m68k/mac/misc.c | 138 +++++++++++++++++++++++++++++----------------------
1 file changed, 78 insertions(+), 60 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] m68k/mac: Enable RTC for 100-series PowerBooks
2018-03-12 3:38 [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Finn Thain
2018-03-12 3:38 ` [PATCH 1/3] m68k/mac: Clean up whitespace and remove redundant parentheses Finn Thain
@ 2018-03-12 3:38 ` Finn Thain
2018-03-12 3:38 ` [PATCH 3/3] m68k/mac: Remove bogus "FIXME" comment Finn Thain
2018-03-26 12:12 ` [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Geert Uytterhoeven
3 siblings, 0 replies; 5+ messages in thread
From: Finn Thain @ 2018-03-12 3:38 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel
According to Apple's Developer Notes, all of the early PowerBook models
have their RTC connected to VIA1. Use the VIA clock ops as appropriate.
This was tested on a PowerBook 170.
Don't use the VIA ops when not appropriate. Calling unimplemented clock
or PRAM getter or setter ops can now result in an error instead of
failing silently.
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
arch/m68k/mac/misc.c | 70 ++++++++++++++++++++++++++++++----------------------
1 file changed, 41 insertions(+), 29 deletions(-)
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 1cae14e140d3..e0a5e2dfeb46 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -83,12 +83,7 @@ static void cuda_write_pram(int offset, __u8 data)
while (!req.complete)
cuda_poll();
}
-#else
-#define cuda_read_time() 0
-#define cuda_write_time(n)
-#define cuda_read_pram NULL
-#define cuda_write_pram NULL
-#endif
+#endif /* CONFIG_ADB_CUDA */
#ifdef CONFIG_ADB_PMU68K
static long pmu_read_time(void)
@@ -141,12 +136,7 @@ static void pmu_write_pram(int offset, __u8 data)
while (!req.complete)
pmu_poll();
}
-#else
-#define pmu_read_time() 0
-#define pmu_write_time(n)
-#define pmu_read_pram NULL
-#define pmu_write_pram NULL
-#endif
+#endif /* CONFIG_ADB_PMU68K */
/*
* VIA PRAM/RTC access routines
@@ -426,19 +416,25 @@ void mac_pram_read(int offset, __u8 *buffer, int len)
int i;
switch (macintosh_config->adb_type) {
+ case MAC_ADB_IOP:
+ case MAC_ADB_II:
case MAC_ADB_PB1:
- case MAC_ADB_PB2:
- func = pmu_read_pram;
+ func = via_read_pram;
break;
+#ifdef CONFIG_ADB_CUDA
case MAC_ADB_EGRET:
case MAC_ADB_CUDA:
func = cuda_read_pram;
break;
+#endif
+#ifdef CONFIG_ADB_PMU68K
+ case MAC_ADB_PB2:
+ func = pmu_read_pram;
+ break;
+#endif
default:
- func = via_read_pram;
- }
- if (!func)
return;
+ }
for (i = 0 ; i < len ; i++) {
buffer[i] = (*func)(offset++);
}
@@ -450,19 +446,25 @@ void mac_pram_write(int offset, __u8 *buffer, int len)
int i;
switch (macintosh_config->adb_type) {
+ case MAC_ADB_IOP:
+ case MAC_ADB_II:
case MAC_ADB_PB1:
- case MAC_ADB_PB2:
- func = pmu_write_pram;
+ func = via_write_pram;
break;
+#ifdef CONFIG_ADB_CUDA
case MAC_ADB_EGRET:
case MAC_ADB_CUDA:
func = cuda_write_pram;
break;
+#endif
+#ifdef CONFIG_ADB_PMU68K
+ case MAC_ADB_PB2:
+ func = pmu_write_pram;
+ break;
+#endif
default:
- func = via_write_pram;
- }
- if (!func)
return;
+ }
for (i = 0 ; i < len ; i++) {
(*func)(offset++, buffer[i]);
}
@@ -663,18 +665,22 @@ int mac_hwclk(int op, struct rtc_time *t)
if (!op) { /* read */
switch (macintosh_config->adb_type) {
- case MAC_ADB_II:
case MAC_ADB_IOP:
- now = via_read_time();
- break;
+ case MAC_ADB_II:
case MAC_ADB_PB1:
- case MAC_ADB_PB2:
- now = pmu_read_time();
+ now = via_read_time();
break;
+#ifdef CONFIG_ADB_CUDA
case MAC_ADB_EGRET:
case MAC_ADB_CUDA:
now = cuda_read_time();
break;
+#endif
+#ifdef CONFIG_ADB_PMU68K
+ case MAC_ADB_PB2:
+ now = pmu_read_time();
+ break;
+#endif
default:
now = 0;
}
@@ -695,18 +701,24 @@ int mac_hwclk(int op, struct rtc_time *t)
t->tm_hour, t->tm_min, t->tm_sec);
switch (macintosh_config->adb_type) {
- case MAC_ADB_II:
case MAC_ADB_IOP:
+ case MAC_ADB_II:
+ case MAC_ADB_PB1:
via_write_time(now);
break;
+#ifdef CONFIG_ADB_CUDA
case MAC_ADB_EGRET:
case MAC_ADB_CUDA:
cuda_write_time(now);
break;
- case MAC_ADB_PB1:
+#endif
+#ifdef CONFIG_ADB_PMU68K
case MAC_ADB_PB2:
pmu_write_time(now);
break;
+#endif
+ default:
+ return -ENODEV;
}
}
return 0;
--
2.16.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/3] m68k/mac: Clean up whitespace and remove redundant parentheses
2018-03-12 3:38 [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Finn Thain
@ 2018-03-12 3:38 ` Finn Thain
2018-03-12 3:38 ` [PATCH 2/3] m68k/mac: Enable RTC for 100-series PowerBooks Finn Thain
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Finn Thain @ 2018-03-12 3:38 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
This uses the same spaces-after-tabs style that I've used elsewhere
in this file. Please let me know if you'd prefer a variation that
keeps checkpatch quiet.
---
arch/m68k/mac/misc.c | 68 ++++++++++++++++++++++++++++++----------------------
1 file changed, 39 insertions(+), 29 deletions(-)
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 4956edaac926..1cae14e140d3 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -43,18 +43,19 @@ static long cuda_read_time(void)
while (!req.complete)
cuda_poll();
- time = (req.reply[3] << 24) | (req.reply[4] << 16)
- | (req.reply[5] << 8) | req.reply[6];
+ time = (req.reply[3] << 24) | (req.reply[4] << 16) |
+ (req.reply[5] << 8) | req.reply[6];
return time - RTC_OFFSET;
}
static void cuda_write_time(long data)
{
struct adb_request req;
+
data += RTC_OFFSET;
if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
- (data >> 24) & 0xFF, (data >> 16) & 0xFF,
- (data >> 8) & 0xFF, data & 0xFF) < 0)
+ (data >> 24) & 0xFF, (data >> 16) & 0xFF,
+ (data >> 8) & 0xFF, data & 0xFF) < 0)
return;
while (!req.complete)
cuda_poll();
@@ -63,8 +64,9 @@ static void cuda_write_time(long data)
static __u8 cuda_read_pram(int offset)
{
struct adb_request req;
+
if (cuda_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
- (offset >> 8) & 0xFF, offset & 0xFF) < 0)
+ (offset >> 8) & 0xFF, offset & 0xFF) < 0)
return 0;
while (!req.complete)
cuda_poll();
@@ -74,8 +76,9 @@ static __u8 cuda_read_pram(int offset)
static void cuda_write_pram(int offset, __u8 data)
{
struct adb_request req;
+
if (cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
- (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
+ (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
return;
while (!req.complete)
cuda_poll();
@@ -98,18 +101,19 @@ static long pmu_read_time(void)
while (!req.complete)
pmu_poll();
- time = (req.reply[1] << 24) | (req.reply[2] << 16)
- | (req.reply[3] << 8) | req.reply[4];
+ time = (req.reply[1] << 24) | (req.reply[2] << 16) |
+ (req.reply[3] << 8) | req.reply[4];
return time - RTC_OFFSET;
}
static void pmu_write_time(long data)
{
struct adb_request req;
+
data += RTC_OFFSET;
if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
- (data >> 24) & 0xFF, (data >> 16) & 0xFF,
- (data >> 8) & 0xFF, data & 0xFF) < 0)
+ (data >> 24) & 0xFF, (data >> 16) & 0xFF,
+ (data >> 8) & 0xFF, data & 0xFF) < 0)
return;
while (!req.complete)
pmu_poll();
@@ -118,6 +122,7 @@ static void pmu_write_time(long data)
static __u8 pmu_read_pram(int offset)
{
struct adb_request req;
+
if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM,
(offset >> 8) & 0xFF, offset & 0xFF) < 0)
return 0;
@@ -129,6 +134,7 @@ static __u8 pmu_read_pram(int offset)
static void pmu_write_pram(int offset, __u8 data)
{
struct adb_request req;
+
if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM,
(offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
return;
@@ -151,8 +157,8 @@ static void pmu_write_pram(int offset, __u8 data)
static __u8 via_pram_readbyte(void)
{
- int i,reg;
- __u8 data;
+ int i, reg;
+ __u8 data;
reg = via1[vBufB] & ~VIA1B_vRTCClk;
@@ -178,7 +184,7 @@ static __u8 via_pram_readbyte(void)
static void via_pram_writebyte(__u8 data)
{
- int i,reg,bit;
+ int i, reg, bit;
reg = via1[vBufB] & ~(VIA1B_vRTCClk | VIA1B_vRTCData);
@@ -204,7 +210,7 @@ static void via_pram_writebyte(__u8 data)
static void via_pram_command(int command, __u8 *data)
{
unsigned long flags;
- int is_read;
+ int is_read;
local_irq_save(flags);
@@ -298,10 +304,10 @@ static long via_read_time(void)
static void via_write_time(long time)
{
union {
- __u8 cdata[4];
- long idata;
+ __u8 cdata[4];
+ long idata;
} data;
- __u8 temp;
+ __u8 temp;
/* Clear the write protect bit */
@@ -343,10 +349,10 @@ static void oss_shutdown(void)
}
#ifdef CONFIG_ADB_CUDA
-
static void cuda_restart(void)
{
struct adb_request req;
+
if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM) < 0)
return;
while (!req.complete)
@@ -356,6 +362,7 @@ static void cuda_restart(void)
static void cuda_shutdown(void)
{
struct adb_request req;
+
if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN) < 0)
return;
@@ -372,7 +379,6 @@ static void cuda_shutdown(void)
while (!req.complete)
cuda_poll();
}
-
#endif /* CONFIG_ADB_CUDA */
#ifdef CONFIG_ADB_PMU68K
@@ -419,13 +425,15 @@ void mac_pram_read(int offset, __u8 *buffer, int len)
__u8 (*func)(int);
int i;
- switch(macintosh_config->adb_type) {
+ switch (macintosh_config->adb_type) {
case MAC_ADB_PB1:
case MAC_ADB_PB2:
- func = pmu_read_pram; break;
+ func = pmu_read_pram;
+ break;
case MAC_ADB_EGRET:
case MAC_ADB_CUDA:
- func = cuda_read_pram; break;
+ func = cuda_read_pram;
+ break;
default:
func = via_read_pram;
}
@@ -441,13 +449,15 @@ void mac_pram_write(int offset, __u8 *buffer, int len)
void (*func)(int, __u8);
int i;
- switch(macintosh_config->adb_type) {
+ switch (macintosh_config->adb_type) {
case MAC_ADB_PB1:
case MAC_ADB_PB2:
- func = pmu_write_pram; break;
+ func = pmu_write_pram;
+ break;
case MAC_ADB_EGRET:
case MAC_ADB_CUDA:
- func = cuda_write_pram; break;
+ func = cuda_write_pram;
+ break;
default:
func = via_write_pram;
}
@@ -531,6 +541,7 @@ void mac_reset(void)
unsigned long phys = virt_to_phys(mac_reset);
unsigned long addr = (phys&0xFF000000)|0x8777;
unsigned long offset = phys-virt;
+
local_irq_disable(); /* lets not screw this up, ok? */
__asm__ __volatile__(".chip 68030\n\t"
"pmove %0,%/tt0\n\t"
@@ -538,7 +549,7 @@ void mac_reset(void)
: : "m" (addr));
/* Now jump to physical address so we can disable MMU */
__asm__ __volatile__(
- ".chip 68030\n\t"
+ ".chip 68030\n\t"
"lea %/pc@(1f),%/a0\n\t"
"addl %0,%/a0\n\t"/* fixup target address and stack ptr */
"addl %0,%/sp\n\t"
@@ -627,9 +638,8 @@ static void unmktime(unsigned long time, long offset,
long int yg = y + days / 365 - (days % 365 < 0);
/* Adjust DAYS and Y to match the guessed year. */
- days -= ((yg - y) * 365
- + LEAPS_THRU_END_OF (yg - 1)
- - LEAPS_THRU_END_OF (y - 1));
+ days -= (yg - y) * 365 +
+ LEAPS_THRU_END_OF(yg - 1) - LEAPS_THRU_END_OF(y - 1);
y = yg;
}
*yearp = y - 1900;
--
2.16.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes
2018-03-12 3:38 [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Finn Thain
` (2 preceding siblings ...)
2018-03-12 3:38 ` [PATCH 3/3] m68k/mac: Remove bogus "FIXME" comment Finn Thain
@ 2018-03-26 12:12 ` Geert Uytterhoeven
3 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2018-03-26 12:12 UTC (permalink / raw)
To: Finn Thain; +Cc: linux-m68k, Linux Kernel Mailing List
Hi Finn,
On Mon, Mar 12, 2018 at 4:38 AM, Finn Thain <fthain@telegraphics.com.au> wrote:
> Finn Thain (3):
> m68k/mac: Clean up whitespace and remove redundant parentheses
> m68k/mac: Enable RTC for 100-series PowerBooks
> m68k/mac: Remove bogus "FIXME" comment
Thanks, applied and queued for v4.17 (with whitespace of 1/3 fixed).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-26 12:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-12 3:38 [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Finn Thain
2018-03-12 3:38 ` [PATCH 1/3] m68k/mac: Clean up whitespace and remove redundant parentheses Finn Thain
2018-03-12 3:38 ` [PATCH 2/3] m68k/mac: Enable RTC for 100-series PowerBooks Finn Thain
2018-03-12 3:38 ` [PATCH 3/3] m68k/mac: Remove bogus "FIXME" comment Finn Thain
2018-03-26 12:12 ` [PATCH 0/3] m68k/mac: Miscellaneous clean-ups and fixes Geert Uytterhoeven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.