diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-07-05 22:30:53 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2012-07-05 22:30:53 +0200 |
commit | bd70ecb8ad2c7ebdb1940a2088517032e849f0c3 (patch) | |
tree | f116a0ab7b9cd950a85c0ec51b846859f67c867c /samsung-ipc | |
parent | d626a32665defecb4ab4358a875bda0b0f4c1fa6 (diff) | |
download | external_libsamsung-ipc-bd70ecb8ad2c7ebdb1940a2088517032e849f0c3.zip external_libsamsung-ipc-bd70ecb8ad2c7ebdb1940a2088517032e849f0c3.tar.gz external_libsamsung-ipc-bd70ecb8ad2c7ebdb1940a2088517032e849f0c3.tar.bz2 |
Removed device loop code (the upper layer must decide whether to loop or not)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc')
-rw-r--r-- | samsung-ipc/device/aries/aries_ipc.c | 48 | ||||
-rw-r--r-- | samsung-ipc/device/crespo/crespo_ipc.c | 32 |
2 files changed, 26 insertions, 54 deletions
diff --git a/samsung-ipc/device/aries/aries_ipc.c b/samsung-ipc/device/aries/aries_ipc.c index ab16960..f49754c 100644 --- a/samsung-ipc/device/aries/aries_ipc.c +++ b/samsung-ipc/device/aries/aries_ipc.c @@ -105,7 +105,6 @@ int aries_modem_bootstrap(struct ipc_client *client) int onedram_fd = -1; /* Control variables. */ - int boot_tries_count = 0; int rc = 0; /* Boot variables */ @@ -136,13 +135,6 @@ int aries_modem_bootstrap(struct ipc_client *client) ipc_client_log(client, "aries_ipc_bootstrap: enter"); -boot_loop_start: - if(boot_tries_count > 5) - { - ipc_client_log(client, "aries_ipc_bootstrap: boot has failed too many times."); - goto error; - } - /* Read the radio.img image. */ ipc_client_log(client, "aries_ipc_bootstrap: reading radio image"); radio_img_p = ipc_mtd_read(client, "/dev/block/bml12", RADIO_IMG_READ_SIZE, RADIO_IMG_READ_SIZE); @@ -151,7 +143,7 @@ boot_loop_start: ipc_client_log(client, "aries_ipc_bootstrap: open onedram"); onedram_fd=open("/dev/onedram", O_RDWR); if(onedram_fd < 0) - goto error_loop; + goto error; /* Reset the modem before init to send the first part of modem.img. */ ipc_client_log(client, "aries_ipc_bootstrap: turning %s iface down", PHONET_IFACE); @@ -170,7 +162,7 @@ boot_loop_start: ipc_client_log(client, "aries_ipc_bootstrap: open s3c2410_serial3"); s3c2410_serial3_fd=open("/dev/s3c2410_serial3", O_RDWR); if(s3c2410_serial3_fd < 0) - goto error_loop; + goto error; /* Setup the s3c2410 serial. */ ipc_client_log(client, "aries_ipc_bootstrap: setup s3c2410_serial3"); @@ -203,7 +195,7 @@ boot_loop_start: if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } /* Get and check bootcore version. */ @@ -211,7 +203,7 @@ boot_loop_start: ipc_client_log(client, "aries_ipc_bootstrap: got bootcore version: 0x%x", bootcore_version); if(bootcore_version != BOOTCORE_VERSION) - goto error_loop; + goto error; timeout.tv_sec=5; timeout.tv_usec=0; @@ -219,7 +211,7 @@ boot_loop_start: if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } /* Get info_size. */ @@ -232,7 +224,7 @@ boot_loop_start: if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } /* Send PSI magic. */ @@ -263,7 +255,7 @@ boot_loop_start: if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } write(s3c2410_serial3_fd, data_p, 1); @@ -280,7 +272,7 @@ boot_loop_start: if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } write(s3c2410_serial3_fd, &crc_byte, sizeof(crc_byte)); @@ -296,7 +288,7 @@ boot_loop_start: if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } read(s3c2410_serial3_fd, &data, sizeof(data)); @@ -304,7 +296,7 @@ boot_loop_start: if(i > 50) { ipc_client_log(client, "aries_ipc_bootstrap: fairly too much attempts to get ACK"); - goto error_loop; + goto error; } } @@ -321,7 +313,7 @@ boot_loop_start: if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } read(onedram_fd, &onedram_data, sizeof(onedram_data)); @@ -329,7 +321,7 @@ boot_loop_start: if(onedram_data != ONEDRAM_INIT_READ) { ipc_client_log(client, "aries_ipc_bootstrap: wrong onedram init magic (got 0x%04x)", onedram_data); - goto error_loop; + goto error; } ipc_client_log(client, "aries_ipc_bootstrap: got 0x%04x", onedram_data); @@ -344,7 +336,7 @@ boot_loop_start: if(onedram_p == NULL || onedram_p < 0 || onedram_p == 0xffffffff) { ipc_client_log(client, "aries_ipc_bootstrap: could not map onedram to memory"); - goto error_loop; + goto error; } // it sometimes hangs here @@ -378,7 +370,7 @@ boot_loop_start: if(ioctl(onedram_fd, ONEDRAM_REL_SEM) < 0) { ipc_client_log(client, "aries_ipc_bootstrap: ONEDRAM_REL_SEM ioctl on onedram failed"); - goto error_loop; + goto error; } onedram_data = ONEDRAM_DEINIT_CMD; @@ -392,7 +384,7 @@ boot_loop_start: if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } read(onedram_fd, &onedram_data, sizeof(onedram_data)); @@ -400,7 +392,7 @@ boot_loop_start: if(onedram_data != ONEDRAM_DEINIT_READ) { ipc_client_log(client, "aries_ipc_bootstrap: wrong onedram deinit magic (got 0x%04x)", onedram_data); - goto error_loop; + goto error; } ipc_client_log(client, "aries_ipc_bootstrap: got 0x%04x", onedram_data); @@ -410,16 +402,10 @@ boot_loop_start: rc = 0; goto exit; -error_loop: - ipc_client_log(client, "aries_ipc_bootstrap: something went wrong"); - boot_tries_count++; - sleep(2); - - goto boot_loop_start; - error: ipc_client_log(client, "aries_ipc_bootstrap: something went wrong"); rc = -1; + exit: ipc_client_log(client, "aries_ipc_bootstrap: exit"); return rc; diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c index 202f9b8..5bf6268 100644 --- a/samsung-ipc/device/crespo/crespo_ipc.c +++ b/samsung-ipc/device/crespo/crespo_ipc.c @@ -72,7 +72,6 @@ int crespo_modem_bootstrap(struct ipc_client *client) int modem_ctl_fd = -1; /* Control variables. */ - int boot_tries_count = 0; int rc = 0; /* Boot variables */ @@ -101,13 +100,6 @@ int crespo_modem_bootstrap(struct ipc_client *client) ipc_client_log(client, "crespo_ipc_bootstrap: enter"); -boot_loop_start: - if(boot_tries_count > 5) - { - ipc_client_log(client, "crespo_ipc_bootstrap: boot has failed too many times."); - goto error; - } - /* Read the radio.img image. */ ipc_client_log(client, "crespo_ipc_bootstrap: reading radio image"); radio_img_p = ipc_mtd_read(client, "/dev/mtd/mtd5ro", RADIO_IMG_SIZE, 0x1000); @@ -121,7 +113,7 @@ boot_loop_start: ipc_client_log(client, "crespo_ipc_bootstrap: open modem_ctl"); modem_ctl_fd=open("/dev/modem_ctl", O_RDWR | O_NDELAY); if(modem_ctl_fd < 0) - goto error_loop; + goto error; /* Reset the modem before init to send the first part of modem.img. */ ioctl(modem_ctl_fd, IOCTL_MODEM_RESET); @@ -130,7 +122,7 @@ boot_loop_start: ipc_client_log(client, "crespo_ipc_bootstrap: open s3c2410_serial3"); s3c2410_serial3_fd=open("/dev/s3c2410_serial3", O_RDWR | O_NDELAY); if(s3c2410_serial3_fd < 0) - goto error_loop; + goto error; /* Setup the s3c2410 serial. */ ipc_client_log(client, "crespo_ipc_bootstrap: setup s3c2410_serial3"); @@ -158,7 +150,7 @@ boot_loop_start: ipc_client_log(client, "crespo_ipc_bootstrap: got bootcore version: 0x%x", bootcore_version); if(bootcore_version != BOOTCORE_VERSION) - goto error_loop; + goto error; /* Get info_size. */ read(s3c2410_serial3_fd, &info_size, sizeof(info_size)); @@ -196,7 +188,7 @@ boot_loop_start: if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "crespo_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } write(s3c2410_serial3_fd, data_p, 1); @@ -210,7 +202,7 @@ boot_loop_start: if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "crespo_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } write(s3c2410_serial3_fd, &crc_byte, sizeof(crc_byte)); @@ -223,7 +215,7 @@ boot_loop_start: if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "crespo_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } read(s3c2410_serial3_fd, &data, sizeof(data)); @@ -231,7 +223,7 @@ boot_loop_start: if(i > 50) { ipc_client_log(client, "crespo_ipc_bootstrap: fairly too much attempts to get ACK"); - goto error_loop; + goto error; } } @@ -255,7 +247,7 @@ boot_loop_start: if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "crespo_ipc_bootstrap: select timeout passed"); - goto error_loop; + goto error; } write(modem_ctl_fd, data_p, block_size); @@ -295,16 +287,10 @@ boot_loop_start: rc = 0; goto exit; -error_loop: - ipc_client_log(client, "%s: something went wrong", __func__); - boot_tries_count++; - sleep(2); - - goto boot_loop_start; - error: ipc_client_log(client, "%s: something went wrong", __func__); rc = -1; + exit: ipc_client_log(client, "crespo_ipc_bootstrap: exit"); return rc; |