Commit cda67df5 authored by Finn Thain's avatar Finn Thain Committed by Greg Kroah-Hartman

m68k/mac: Adopt naming and calling conventions for PRAM routines

Adopt the existing *_read_byte and *_write_byte naming convention.
Rename via_pram_readbyte and via_pram_writebyte to avoid confusion.
Adjust calling conventions of mac_pram_* functions to match the
struct nvram_ops methods.
Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Tested-by: default avatarStan Johnson <userm57@yahoo.com>
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 666047fe
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
static void (*rom_reset)(void); static void (*rom_reset)(void);
#ifdef CONFIG_ADB_CUDA #ifdef CONFIG_ADB_CUDA
static __u8 cuda_read_pram(int offset) static unsigned char cuda_pram_read_byte(int offset)
{ {
struct adb_request req; struct adb_request req;
...@@ -49,7 +49,7 @@ static __u8 cuda_read_pram(int offset) ...@@ -49,7 +49,7 @@ static __u8 cuda_read_pram(int offset)
return req.reply[3]; return req.reply[3];
} }
static void cuda_write_pram(int offset, __u8 data) static void cuda_pram_write_byte(unsigned char data, int offset)
{ {
struct adb_request req; struct adb_request req;
...@@ -62,7 +62,7 @@ static void cuda_write_pram(int offset, __u8 data) ...@@ -62,7 +62,7 @@ static void cuda_write_pram(int offset, __u8 data)
#endif /* CONFIG_ADB_CUDA */ #endif /* CONFIG_ADB_CUDA */
#ifdef CONFIG_ADB_PMU #ifdef CONFIG_ADB_PMU
static __u8 pmu_read_pram(int offset) static unsigned char pmu_pram_read_byte(int offset)
{ {
struct adb_request req; struct adb_request req;
...@@ -74,7 +74,7 @@ static __u8 pmu_read_pram(int offset) ...@@ -74,7 +74,7 @@ static __u8 pmu_read_pram(int offset)
return req.reply[3]; return req.reply[3];
} }
static void pmu_write_pram(int offset, __u8 data) static void pmu_pram_write_byte(unsigned char data, int offset)
{ {
struct adb_request req; struct adb_request req;
...@@ -93,7 +93,7 @@ static void pmu_write_pram(int offset, __u8 data) ...@@ -93,7 +93,7 @@ static void pmu_write_pram(int offset, __u8 data)
* the RTC should be enabled. * the RTC should be enabled.
*/ */
static __u8 via_pram_readbyte(void) static __u8 via_rtc_recv(void)
{ {
int i, reg; int i, reg;
__u8 data; __u8 data;
...@@ -120,7 +120,7 @@ static __u8 via_pram_readbyte(void) ...@@ -120,7 +120,7 @@ static __u8 via_pram_readbyte(void)
return data; return data;
} }
static void via_pram_writebyte(__u8 data) static void via_rtc_send(__u8 data)
{ {
int i, reg, bit; int i, reg, bit;
...@@ -157,17 +157,17 @@ static void via_pram_command(int command, __u8 *data) ...@@ -157,17 +157,17 @@ static void via_pram_command(int command, __u8 *data)
via1[vBufB] = (via1[vBufB] | VIA1B_vRTCClk) & ~VIA1B_vRTCEnb; via1[vBufB] = (via1[vBufB] | VIA1B_vRTCClk) & ~VIA1B_vRTCEnb;
if (command & 0xFF00) { /* extended (two-byte) command */ if (command & 0xFF00) { /* extended (two-byte) command */
via_pram_writebyte((command & 0xFF00) >> 8); via_rtc_send((command & 0xFF00) >> 8);
via_pram_writebyte(command & 0xFF); via_rtc_send(command & 0xFF);
is_read = command & 0x8000; is_read = command & 0x8000;
} else { /* one-byte command */ } else { /* one-byte command */
via_pram_writebyte(command); via_rtc_send(command);
is_read = command & 0x80; is_read = command & 0x80;
} }
if (is_read) { if (is_read) {
*data = via_pram_readbyte(); *data = via_rtc_recv();
} else { } else {
via_pram_writebyte(*data); via_rtc_send(*data);
} }
/* All done, disable the RTC */ /* All done, disable the RTC */
...@@ -177,12 +177,12 @@ static void via_pram_command(int command, __u8 *data) ...@@ -177,12 +177,12 @@ static void via_pram_command(int command, __u8 *data)
local_irq_restore(flags); local_irq_restore(flags);
} }
static __u8 via_read_pram(int offset) static unsigned char via_pram_read_byte(int offset)
{ {
return 0; return 0;
} }
static void via_write_pram(int offset, __u8 data) static void via_pram_write_byte(unsigned char data, int offset)
{ {
} }
...@@ -326,63 +326,48 @@ static void cuda_shutdown(void) ...@@ -326,63 +326,48 @@ static void cuda_shutdown(void)
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
void mac_pram_read(int offset, __u8 *buffer, int len) unsigned char mac_pram_read_byte(int addr)
{ {
__u8 (*func)(int);
int i;
switch (macintosh_config->adb_type) { switch (macintosh_config->adb_type) {
case MAC_ADB_IOP: case MAC_ADB_IOP:
case MAC_ADB_II: case MAC_ADB_II:
case MAC_ADB_PB1: case MAC_ADB_PB1:
func = via_read_pram; return via_pram_read_byte(addr);
break;
#ifdef CONFIG_ADB_CUDA #ifdef CONFIG_ADB_CUDA
case MAC_ADB_EGRET: case MAC_ADB_EGRET:
case MAC_ADB_CUDA: case MAC_ADB_CUDA:
func = cuda_read_pram; return cuda_pram_read_byte(addr);
break;
#endif #endif
#ifdef CONFIG_ADB_PMU #ifdef CONFIG_ADB_PMU
case MAC_ADB_PB2: case MAC_ADB_PB2:
func = pmu_read_pram; return pmu_pram_read_byte(addr);
break;
#endif #endif
default: default:
return; return 0xFF;
}
for (i = 0 ; i < len ; i++) {
buffer[i] = (*func)(offset++);
} }
} }
void mac_pram_write(int offset, __u8 *buffer, int len) void mac_pram_write_byte(unsigned char val, int addr)
{ {
void (*func)(int, __u8);
int i;
switch (macintosh_config->adb_type) { switch (macintosh_config->adb_type) {
case MAC_ADB_IOP: case MAC_ADB_IOP:
case MAC_ADB_II: case MAC_ADB_II:
case MAC_ADB_PB1: case MAC_ADB_PB1:
func = via_write_pram; via_pram_write_byte(val, addr);
break; break;
#ifdef CONFIG_ADB_CUDA #ifdef CONFIG_ADB_CUDA
case MAC_ADB_EGRET: case MAC_ADB_EGRET:
case MAC_ADB_CUDA: case MAC_ADB_CUDA:
func = cuda_write_pram; cuda_pram_write_byte(val, addr);
break; break;
#endif #endif
#ifdef CONFIG_ADB_PMU #ifdef CONFIG_ADB_PMU
case MAC_ADB_PB2: case MAC_ADB_PB2:
func = pmu_write_pram; pmu_pram_write_byte(val, addr);
break; break;
#endif #endif
default: default:
return; break;
}
for (i = 0 ; i < len ; i++) {
(*func)(offset++, buffer[i]);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment