diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2007-05-10 18:43:57 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2007-05-10 18:43:57 +0000 |
commit | 2a133f7851dd819fe4d99adebbd8fb4c173ae579 (patch) | |
tree | d5a88891cb9be24ecff61054fee49115fd5cfa4a /src/southbridge/amd/cs5536/cs5536_early_smbus.c | |
parent | 9934b813da2556ab8159cfc13fb993ae98b04db4 (diff) |
Fix the indent and whitespace to match LinuxBIOS standards
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2651 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/southbridge/amd/cs5536/cs5536_early_smbus.c')
-rw-r--r-- | src/southbridge/amd/cs5536/cs5536_early_smbus.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/src/southbridge/amd/cs5536/cs5536_early_smbus.c b/src/southbridge/amd/cs5536/cs5536_early_smbus.c index a7617f8c43..8647445792 100644 --- a/src/southbridge/amd/cs5536/cs5536_early_smbus.c +++ b/src/southbridge/amd/cs5536/cs5536_early_smbus.c @@ -24,13 +24,12 @@ #define SMBUS_WAIT_UNTIL_DONE_TIMEOUT -3 #define SMBUS_TIMEOUT (1000) - /* initialization for SMBus Controller */ static void cs5536_enable_smbus(void) { /* Set SCL freq and enable SMB controller */ - /*outb((0x20 << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2);*/ + /*outb((0x20 << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2); */ outb((0x7F << 1) | SMB_CTRL2_ENABLE, SMBUS_IO_BASE + SMB_CTRL2); /* Setup SMBus host controller address to 0xEF */ @@ -43,8 +42,8 @@ static void smbus_delay(void) /* inb(0x80); */ } - -static int smbus_wait(unsigned smbus_io_base) { +static int smbus_wait(unsigned smbus_io_base) +{ unsigned long loops = SMBUS_TIMEOUT; unsigned char val; @@ -54,10 +53,10 @@ static int smbus_wait(unsigned smbus_io_base) { if ((val & SMB_STS_SDAST) != 0) break; if (val & (SMB_STS_BER | SMB_STS_NEGACK)) { - /*printk_debug("SMBUS WAIT ERROR %x\n", val);*/ + /*printk_debug("SMBUS WAIT ERROR %x\n", val); */ return SMBUS_ERROR; } - } while(--loops); + } while (--loops); return loops ? 0 : SMBUS_WAIT_UNTIL_READY_TIMEOUT; } @@ -91,8 +90,8 @@ static int smbus_check_stop_condition(unsigned smbus_io_base) break; } outb((0x7F << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2); - } while(--loops); - return loops?0:SMBUS_WAIT_UNTIL_READY_TIMEOUT; + } while (--loops); + return loops ? 0 : SMBUS_WAIT_UNTIL_READY_TIMEOUT; } static int smbus_stop_condition(unsigned smbus_io_base) @@ -106,14 +105,15 @@ static int smbus_ack(unsigned smbus_io_base, int state) unsigned char val = inb(smbus_io_base + SMB_CTRL1); /* if (state) */ - outb(val | SMB_CTRL1_ACK, smbus_io_base + SMB_CTRL1); + outb(val | SMB_CTRL1_ACK, smbus_io_base + SMB_CTRL1); /* else outb(val & ~SMB_CTRL1_ACK, smbus_io_base + SMB_CTRL1); */ return 0; } -static int smbus_send_slave_address(unsigned smbus_io_base, unsigned char device) +static int smbus_send_slave_address(unsigned smbus_io_base, + unsigned char device) { unsigned char val; @@ -122,9 +122,8 @@ static int smbus_send_slave_address(unsigned smbus_io_base, unsigned char device /* check for bus conflict and NACK */ val = inb(smbus_io_base + SMB_STS); - if (((val & SMB_STS_BER) != 0) || - ((val & SMB_STS_NEGACK) != 0)) { - /* printk_debug("SEND SLAVE ERROR (%x)\n", val);*/ + if (((val & SMB_STS_BER) != 0) || ((val & SMB_STS_NEGACK) != 0)) { + /* printk_debug("SEND SLAVE ERROR (%x)\n", val); */ return SMBUS_ERROR; } return smbus_wait(smbus_io_base); @@ -139,8 +138,7 @@ static int smbus_send_command(unsigned smbus_io_base, unsigned char command) /* check for bus conflict and NACK */ val = inb(smbus_io_base + SMB_STS); - if (((val & SMB_STS_BER) != 0) || - ((val & SMB_STS_NEGACK) != 0)) + if (((val & SMB_STS_BER) != 0) || ((val & SMB_STS_NEGACK) != 0)) return SMBUS_ERROR; return smbus_wait(smbus_io_base); @@ -151,7 +149,9 @@ static unsigned char smbus_get_result(unsigned smbus_io_base) return inb(smbus_io_base + SMB_SDA); } -static unsigned char do_smbus_read_byte(unsigned smbus_io_base, unsigned char device, unsigned char address) +static unsigned char do_smbus_read_byte(unsigned smbus_io_base, + unsigned char device, + unsigned char address) { unsigned char error = 0; @@ -170,7 +170,7 @@ static unsigned char do_smbus_read_byte(unsigned smbus_io_base, unsigned char de goto err; } - smbus_ack(smbus_io_base, 1 ); + smbus_ack(smbus_io_base, 1); if ((smbus_send_command(smbus_io_base, address))) { error = 4; @@ -194,13 +194,12 @@ static unsigned char do_smbus_read_byte(unsigned smbus_io_base, unsigned char de return smbus_get_result(smbus_io_base); - -err: + err: print_debug("SMBUS READ ERROR:"); - print_debug_hex8(error); - print_debug(" device:"); - print_debug_hex8(device); - print_debug("\r\n"); + print_debug_hex8(error); + print_debug(" device:"); + print_debug_hex8(device); + print_debug("\r\n"); /* stop, clean up the error, and leave */ smbus_stop_condition(smbus_io_base); outb(inb(smbus_io_base + SMB_STS), smbus_io_base + SMB_STS); @@ -210,6 +209,5 @@ err: static inline int smbus_read_byte(unsigned device, unsigned address) { - return do_smbus_read_byte(SMBUS_IO_BASE, device, address); + return do_smbus_read_byte(SMBUS_IO_BASE, device, address); } - |