aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/device
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-02-08 14:29:15 +0100
committerPaul Kocialkowski <contact@paulk.fr>2014-02-08 14:29:15 +0100
commitffc71f0da11b322e5c28425200cbb8666cf441f9 (patch)
tree4287b6798313811b51faf200186624e6f85623e9 /samsung-ipc/device
parent190984f13910b589b8909b1088bac863316cdc96 (diff)
downloadexternal_libsamsung-ipc-ffc71f0da11b322e5c28425200cbb8666cf441f9.zip
external_libsamsung-ipc-ffc71f0da11b322e5c28425200cbb8666cf441f9.tar.gz
external_libsamsung-ipc-ffc71f0da11b322e5c28425200cbb8666cf441f9.tar.bz2
devices folder instead of device, for better consistency
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc/device')
-rw-r--r--samsung-ipc/device/aries/aries_ipc.c806
-rw-r--r--samsung-ipc/device/aries/aries_ipc.h64
-rw-r--r--samsung-ipc/device/aries/onedram.h30
-rw-r--r--samsung-ipc/device/aries/phonet.h63
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.c559
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.h49
-rw-r--r--samsung-ipc/device/crespo/crespo_modem_ctl.h44
-rw-r--r--samsung-ipc/device/galaxys2/galaxys2_ipc.c417
-rw-r--r--samsung-ipc/device/galaxys2/galaxys2_ipc.h48
-rw-r--r--samsung-ipc/device/i9300/i9300_ipc.c411
-rw-r--r--samsung-ipc/device/i9300/i9300_ipc.h48
-rw-r--r--samsung-ipc/device/maguro/maguro_ipc.c401
-rw-r--r--samsung-ipc/device/maguro/maguro_ipc.h57
-rw-r--r--samsung-ipc/device/n7100/n7100_ipc.c411
-rw-r--r--samsung-ipc/device/n7100/n7100_ipc.h48
-rw-r--r--samsung-ipc/device/piranha/piranha_ipc.c358
-rw-r--r--samsung-ipc/device/piranha/piranha_ipc.h49
-rw-r--r--samsung-ipc/device/xmm6160/xmm6160.c294
-rw-r--r--samsung-ipc/device/xmm6160/xmm6160.h40
-rw-r--r--samsung-ipc/device/xmm6260/modem.h74
-rwxr-xr-xsamsung-ipc/device/xmm6260/modem_link_device_hsic.h63
-rw-r--r--samsung-ipc/device/xmm6260/modem_prj.h230
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260.c43
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260.h45
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_hsic.c609
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_hsic.h69
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_mipi.c674
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_mipi.h73
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_sec_modem.c494
-rw-r--r--samsung-ipc/device/xmm6260/xmm6260_sec_modem.h59
30 files changed, 0 insertions, 6630 deletions
diff --git a/samsung-ipc/device/aries/aries_ipc.c b/samsung-ipc/device/aries/aries_ipc.c
deleted file mode 100644
index 97df116..0000000
--- a/samsung-ipc/device/aries/aries_ipc.c
+++ /dev/null
@@ -1,806 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2011 Joerie de Gram <j.de.gram@gmail.com>
- * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
- * Copyright (C) 2011 Igor Almeida <igor.contato@gmail.com>
- * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <net/if.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-#include <util.h>
-
-#include "onedram.h"
-#include "phonet.h"
-
-#include "xmm6160.h"
-#include "aries_ipc.h"
-
-int aries_ipc_bootstrap(struct ipc_client *client)
-{
- void *modem_image_data = NULL;
- void *onedram_address = NULL;
- unsigned int onedram_init;
- unsigned int onedram_magic;
- unsigned int onedram_deinit;
-
- int onedram_fd = -1;
- int serial_fd = -1;
-
- struct timeval timeout;
- fd_set fds;
-
- unsigned char *p;
- unsigned char *pp;
- int rc;
- int i;
-
- if (client == NULL || client->handlers == NULL || client->handlers->power_on == NULL || client->handlers->power_off == NULL)
- return -1;
-
- ipc_client_log(client, "Starting aries modem bootstrap");
-
- modem_image_data = file_data_read(ARIES_MODEM_IMAGE_DEVICE, ARIES_MODEM_IMAGE_SIZE, 0x1000);
- if (modem_image_data == NULL) {
- ipc_client_log(client, "Reading modem image data failed");
- goto error;
- }
- ipc_client_log(client, "Read modem image data");
-
- onedram_fd = open(ARIES_ONEDRAM_DEVICE, O_RDWR);
- if (onedram_fd < 0) {
- ipc_client_log(client, "Opening onedram failed");
- goto error;
- }
- ipc_client_log(client, "Opened onedram");
-
- rc = network_iface_down(ARIES_MODEM_IFACE, AF_PHONET, SOCK_DGRAM);
- if (rc < 0) {
- ipc_client_log(client, "Turning modem network iface down failed");
- goto error;
- }
- ipc_client_log(client, "Turned modem network iface down");
-
- rc = client->handlers->power_on(client->handlers->power_data);
- if (rc < 0) {
- ipc_client_log(client, "Powering the modem off failed");
- goto error;
- }
- ipc_client_log(client, "Powered the modem off");
-
- usleep(1000);
-
- rc = client->handlers->power_off(client->handlers->power_data);
- if (rc < 0) {
- ipc_client_log(client, "Powering the modem on failed");
- goto error;
- }
- ipc_client_log(client, "Powered the modem on");
-
- serial_fd = open(ARIES_MODEM_SERIAL_DEVICE, O_RDWR | O_NDELAY);
- if (serial_fd < 0) {
- ipc_client_log(client, "Opening serial failed");
- goto error;
- }
- ipc_client_log(client, "Opened serial");
-
- usleep(100000);
-
- p = (unsigned char *) modem_image_data;
-
- rc = xmm6160_psi_send(client, serial_fd, (void *) p, ARIES_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6160 PSI failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6160 PSI");
-
- p += ARIES_PSI_SIZE;
-
- onedram_init = 0;
-
- FD_ZERO(&fds);
- FD_SET(onedram_fd, &fds);
-
- timeout.tv_sec = 4;
- timeout.tv_usec = 0;
-
- i = 0;
- do {
- rc = select(onedram_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Reading onedram init failed");
- goto error;
- }
-
- rc = read(onedram_fd, &onedram_init, sizeof(onedram_init));
- if (rc < (int) sizeof(onedram_init)) {
- ipc_client_log(client, "Reading onedram init failed");
- goto error;
- }
-
- if (i++ > 50) {
- ipc_client_log(client, "Reading onedram init failed");
- goto error;
- }
- } while (onedram_init != ARIES_ONEDRAM_INIT);
- ipc_client_log(client, "Read onedram init (0x%x)", onedram_init);
-
- onedram_address = mmap(NULL, ARIES_ONEDRAM_MEMORY_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, onedram_fd, 0);
- if (onedram_address == NULL || onedram_address == (void *) 0xffffffff) {
- ipc_client_log(client, "Mapping onedram to memory failed");
- goto error;
- }
- ipc_client_log(client, "Mapped onedram to memory");
-
- pp = (unsigned char *) onedram_address;
-
- rc = xmm6160_firmware_send(client, -1, (void *) pp, (void *) p, ARIES_MODEM_IMAGE_SIZE - ARIES_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6160 firmware failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6160 firmware");
-
- pp = (unsigned char *) onedram_address + ARIES_ONEDRAM_NV_DATA_OFFSET;
-
- rc = xmm6160_nv_data_send(client, -1, pp);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6160 nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6160 nv_data");
-
- munmap(onedram_address, ARIES_ONEDRAM_MEMORY_SIZE);
- onedram_address = NULL;
-
- rc = ioctl(onedram_fd, ONEDRAM_REL_SEM);
- if (rc < 0)
- goto error;
-
- onedram_magic = ARIES_ONEDRAM_MAGIC;
- rc = write(onedram_fd, &onedram_magic, sizeof(onedram_magic));
- if (rc < (int) sizeof(onedram_magic)) {
- ipc_client_log(client, "Writing onedram magic failed");
- goto error;
- }
- ipc_client_log(client, "Wrote onedram magic");
-
- FD_ZERO(&fds);
- FD_SET(onedram_fd, &fds);
-
- timeout.tv_sec = 4;
- timeout.tv_usec = 0;
-
- i = 0;
- do {
- rc = select(onedram_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Reading onedram deinit failed");
- goto error;
- }
-
- rc = read(onedram_fd, &onedram_deinit, sizeof(onedram_deinit));
- if (rc < (int) sizeof(onedram_deinit)) {
- ipc_client_log(client, "Reading onedram deinit failed");
- goto error;
- }
-
- if (i++ > 50) {
- ipc_client_log(client, "Reading onedram deinit failed");
- goto error;
- }
- } while (onedram_deinit != ARIES_ONEDRAM_DEINIT);
- ipc_client_log(client, "Read onedram deinit (0x%x)", onedram_deinit);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (modem_image_data != NULL)
- free(modem_image_data);
-
- if (serial_fd >= 0)
- close(serial_fd);
-
- if (onedram_address != NULL)
- munmap(onedram_address, ARIES_ONEDRAM_MEMORY_SIZE);
-
- if (onedram_fd >= 0)
- close(onedram_fd);
-
- return rc;
-}
-
-int aries_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- struct ipc_fmt_header header;
- void *buffer = NULL;
- unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
- return -1;
-
- ipc_fmt_header_fill(&header, request);
-
- length = header.length;
- buffer = malloc(header.length);
-
- memcpy(buffer, &header, sizeof(struct ipc_fmt_header));
- if (request->data != NULL && request->length > 0) {
- p = (unsigned char *) buffer + sizeof(header);
- memcpy(p, request->data, request->length);
- }
-
- ipc_client_log_send(client, request, __func__);
-
- p = (unsigned char *) buffer;
-
- while (count < length) {
- chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
-
- rc = client->handlers->write(client->handlers->transport_data, p, chunk);
- if (rc < 0) {
- ipc_client_log(client, "Writing FMT data to the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int aries_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- struct ipc_fmt_header *header;
- void *buffer = NULL;
- unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
- return -1;
-
- length = ARIES_BUFFER_LENGTH;
- buffer = malloc(length);
-
- rc = client->handlers->read(client->handlers->transport_data, buffer, length);
- if (rc < (int) sizeof(struct ipc_fmt_header)) {
- ipc_client_log(client, "Reading FMT header from the modem failed");
- goto error;
- }
-
- header = (struct ipc_fmt_header *) buffer;
-
- ipc_fmt_message_fill(header, response);
-
- length = header->length - sizeof(struct ipc_fmt_header);
- if (length > 0) {
- response->length = length;
- response->data = malloc(length);
-
- count = rc - sizeof(struct ipc_fmt_header);
- if (count > 0) {
- p = (unsigned char *) buffer + sizeof(struct ipc_fmt_header);
- memcpy(response->data, p, count);
- }
- }
-
- p = (unsigned char *) response->data + count;
-
- while (count < length) {
- chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
-
- rc = client->handlers->read(client->handlers->transport_data, p, chunk);
- if (rc < 0) {
- ipc_client_log(client, "Reading FMT data from the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
-
- ipc_client_log_recv(client, response, __func__);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int aries_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- struct ipc_rfs_header header;
- void *buffer = NULL;
- unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
- return -1;
-
- ipc_rfs_header_fill(&header, request);
-
- length = header.length;
- buffer = malloc(length);
-
- memcpy(buffer, &header, sizeof(header));
- if (request->data != NULL && request->length > 0) {
- p = (unsigned char *) buffer + sizeof(header);
- memcpy(p, request->data, request->length);
- }
-
- ipc_client_log_send(client, request, __func__);
-
- p = (unsigned char *) buffer;
-
- while (count < length) {
- chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
-
- rc = client->handlers->write(client->handlers->transport_data, p, chunk);
- if (rc < 0) {
- ipc_client_log(client, "Writing RFS data to the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int aries_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- struct ipc_rfs_header *header;
- void *buffer = NULL;
- unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
- return -1;
-
- length = ARIES_BUFFER_LENGTH;
- buffer = malloc(length);
-
- rc = client->handlers->read(client->handlers->transport_data, buffer, length);
- if (rc < (int) sizeof(struct ipc_rfs_header)) {
- ipc_client_log(client, "Reading RFS header from the modem failed");
- goto error;
- }
-
- header = (struct ipc_rfs_header *) buffer;
-
- ipc_rfs_message_fill(header, response);
-
- length = header->length - sizeof(struct ipc_rfs_header);
- if (length > 0) {
- response->length = length;
- response->data = malloc(length);
-
- count = rc - sizeof(struct ipc_rfs_header);
- if (count > 0) {
- p = (unsigned char *) buffer + sizeof(struct ipc_rfs_header);
- memcpy(response->data, p, count);
- }
- }
-
- p = (unsigned char *) response->data + count;
-
- while (count < length) {
- chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
-
- rc = client->handlers->read(client->handlers->transport_data, p, chunk);
- if (rc < 0) {
- ipc_client_log(client, "Reading RFS data from the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
-
- ipc_client_log_recv(client, response, __func__);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int aries_ipc_open(void *data, int type)
-{
- struct aries_ipc_transport_data *transport_data;
- struct sockaddr_pn *spn;
- struct ifreq ifr;
-
- int reuse;
- int socket_rfs_magic;
-
- int fd;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct aries_ipc_transport_data *) data;
- memset(data, 0, sizeof(struct aries_ipc_transport_data));
-
- spn = &transport_data->spn;
-
- memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, ARIES_MODEM_IFACE, IFNAMSIZ);
-
- spn->spn_family = AF_PHONET;
- spn->spn_dev = 0;
-
- switch (type) {
- case IPC_CLIENT_TYPE_FMT:
- spn->spn_resource = ARIES_MODEM_FMT_SPN;
- break;
- case IPC_CLIENT_TYPE_RFS:
- spn->spn_resource = ARIES_MODEM_RFS_SPN;
- break;
- default:
- break;
- }
-
- fd = socket(AF_PHONET, SOCK_DGRAM, 0);
- if (fd < 0)
- return -1;
-
- rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, ifr.ifr_name, IFNAMSIZ);
- if (rc < 0)
- return -1;
-
- rc = ioctl(fd, SIOCGIFINDEX, &ifr);
- if (rc < 0)
- return -1;
-
- reuse = 1;
- rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
- if (rc < 0)
- return -1;
-
- rc = bind(fd, (const struct sockaddr *) spn, sizeof(struct sockaddr_pn));
- if (rc < 0)
- return -1;
-
- transport_data->fd = fd;
-
- if (type == IPC_CLIENT_TYPE_RFS)
- {
- socket_rfs_magic = ARIES_SOCKET_RFS_MAGIC;
- rc = setsockopt(fd, SOL_SOCKET, SO_IPC_RFS, &socket_rfs_magic, sizeof(socket_rfs_magic));
- if (rc < 0)
- return -1;
- }
-
- rc = network_iface_up(ARIES_MODEM_IFACE, AF_PHONET, SOCK_DGRAM);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int aries_ipc_close(void *data)
-{
- struct aries_ipc_transport_data *transport_data;
- int fd;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct aries_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- transport_data->fd = -1;
- close(fd);
-
- return 0;
-}
-
-int aries_ipc_read(void *data, void *buffer, unsigned int length)
-{
- struct aries_ipc_transport_data *transport_data;
- int spn_size;
- int fd;
- int rc;
-
- if (data == NULL || buffer == NULL || length == 0)
- return -1;
-
- transport_data = (struct aries_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- spn_size = sizeof(struct sockaddr_pn);
-
- rc = recvfrom(fd, buffer, length, 0, (const struct sockaddr *) &transport_data->spn, &spn_size);
- return rc;
-}
-
-int aries_ipc_write(void *data, void *buffer, unsigned int length)
-{
- struct aries_ipc_transport_data *transport_data;
- int spn_size;
- int fd;
- int rc;
-
- if (data == NULL || buffer == NULL || length == 0)
- return -1;
-
- transport_data = (struct aries_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- spn_size = sizeof(struct sockaddr_pn);
-
- rc = sendto(fd, buffer, length, 0, (const struct sockaddr *) &transport_data->spn, spn_size);
- return rc;
-}
-
-int aries_ipc_poll(void *data, struct timeval *timeout)
-{
- struct aries_ipc_transport_data *transport_data;
- fd_set fds;
- int fd;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct aries_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
-
- rc = select(fd + 1, &fds, NULL, NULL, timeout);
- return rc;
-}
-
-int aries_ipc_power_on(void *data)
-{
- char buffer[] = "on\n";
- int value;
- int rc;
-
- value = sysfs_value_read(ARIES_MODEMCTL_STATUS_SYSFS);
- if (value < 0)
- return -1;
-
- // The modem is already on
- if (value == 1)
- return 0;
-
- rc = sysfs_string_write(ARIES_MODEMCTL_CONTROL_SYSFS, (char *) &buffer, strlen(buffer));
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int aries_ipc_power_off(void *data)
-{
- char buffer[] = "off\n";
- int value;
- int rc;
-
- value = sysfs_value_read(ARIES_MODEMCTL_STATUS_SYSFS);
- if (value < 0)
- return -1;
-
- // The modem is already off
- if (value == 0)
- return 0;
-
- rc = sysfs_string_write(ARIES_MODEMCTL_CONTROL_SYSFS, (char *) &buffer, strlen(buffer));
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int aries_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- *transport_data = (void *) malloc(sizeof(struct aries_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct aries_ipc_transport_data));
-
- return 0;
-}
-
-int aries_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- free(transport_data);
-
- return 0;
-}
-
-int aries_ipc_gprs_activate(void *data, int cid)
-{
- int rc;
-
- rc = sysfs_value_write(ARIES_MODEM_PDP_ACTIVATE_SYSFS, cid);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int aries_ipc_gprs_deactivate(void *data, int cid)
-{
- int rc;
-
- rc = sysfs_value_write(ARIES_MODEM_PDP_DEACTIVATE_SYSFS, cid);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-char *aries_ipc_gprs_get_iface(int cid)
-{
- struct ifreq ifr;
- char *iface = NULL;
- int fd;
- int rc;
- int i;
-
- memset(&ifr, 0, sizeof(ifr));
-
- fd = socket(AF_PHONET, SOCK_DGRAM, 0);
- if (fd < 0)
- return NULL;
-
- for (i = (ARIES_GPRS_IFACE_COUNT - 1); i >= 0; i--) {
- sprintf(ifr.ifr_name, "%s%d", ARIES_GPRS_IFACE_PREFIX, i);
- rc = ioctl(fd, SIOCGIFFLAGS, &ifr);
- if (rc < 0 || ifr.ifr_flags & IFF_UP) {
- continue;
- } else {
- asprintf(&iface, "%s%d", ARIES_GPRS_IFACE_PREFIX, i);
- return iface;
- }
- }
-
- return NULL;
-}
-
-int aries_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- if (capabilities == NULL)
- return -1;
-
- capabilities->port_list = 1;
- capabilities->cid_max = ARIES_GPRS_IFACE_COUNT;
-
- return 0;
-}
-
-struct ipc_ops aries_ipc_fmt_ops = {
- .bootstrap = aries_ipc_bootstrap,
- .send = aries_ipc_fmt_send,
- .recv = aries_ipc_fmt_recv,
-};
-
-struct ipc_ops aries_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = aries_ipc_rfs_send,
- .recv = aries_ipc_rfs_recv,
-};
-
-struct ipc_handlers aries_ipc_handlers = {
- .open = aries_ipc_open,
- .close = aries_ipc_close,
- .read = aries_ipc_read,
- .write = aries_ipc_write,
- .poll = aries_ipc_poll,
- .transport_data = NULL,
- .power_on = aries_ipc_power_on,
- .power_off = aries_ipc_power_off,
- .power_data = NULL,
- .gprs_activate = aries_ipc_gprs_activate,
- .gprs_deactivate = aries_ipc_gprs_deactivate,
- .gprs_data = NULL,
- .data_create = aries_ipc_data_create,
- .data_destroy = aries_ipc_data_destroy,
-};
-
-struct ipc_gprs_specs aries_ipc_gprs_specs = {
- .gprs_get_iface = aries_ipc_gprs_get_iface,
- .gprs_get_capabilities = aries_ipc_gprs_get_capabilities,
-};
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/aries/aries_ipc.h b/samsung-ipc/device/aries/aries_ipc.h
deleted file mode 100644
index e410dd2..0000000
--- a/samsung-ipc/device/aries/aries_ipc.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2011 Igor Almeida <igor.contato@gmail.com>
- * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "phonet.h"
-
-#ifndef __ARIES_IPC_H__
-#define __ARIES_IPC_H__
-
-#define ARIES_MODEM_IMAGE_SIZE 0xA00000
-#define ARIES_PSI_SIZE 0x5000
-#define ARIES_ONEDRAM_NV_DATA_OFFSET 0xD80000
-#define ARIES_ONEDRAM_MEMORY_SIZE 0xFFF000
-#define ARIES_ONEDRAM_INIT 0x12341234
-#define ARIES_ONEDRAM_MAGIC 0x45674567
-#define ARIES_ONEDRAM_DEINIT 0xABCDABCD
-#define ARIES_SOCKET_RFS_MAGIC 0x80000
-#define ARIES_BUFFER_LENGTH 4032
-
-#define SO_IPC_RFS 0x21
-#define ARIES_MODEM_FMT_SPN 0x01
-#define ARIES_MODEM_RFS_SPN 0x41
-
-#define ARIES_MODEM_IMAGE_DEVICE "/dev/block/bml12"
-#define ARIES_MODEM_SERIAL_DEVICE "/dev/s3c2410_serial3"
-#define ARIES_ONEDRAM_DEVICE "/dev/onedram"
-#define ARIES_MODEMCTL_STATUS_SYSFS "/sys/class/modemctl/xmm/status"
-#define ARIES_MODEMCTL_CONTROL_SYSFS "/sys/class/modemctl/xmm/control"
-#define ARIES_MODEM_IFACE "svnet0"
-#define ARIES_MODEM_PDP_ACTIVATE_SYSFS "/sys/class/net/svnet0/pdp/activate"
-#define ARIES_MODEM_PDP_DEACTIVATE_SYSFS "/sys/class/net/svnet0/pdp/deactivate"
-
-#define ARIES_GPRS_IFACE_PREFIX "pdp"
-#define ARIES_GPRS_IFACE_COUNT 3
-
-struct aries_ipc_transport_data {
- struct sockaddr_pn spn;
- int fd;
-};
-
-extern struct ipc_ops aries_ipc_fmt_ops;
-extern struct ipc_ops aries_ipc_rfs_ops;
-extern struct ipc_handlers aries_ipc_handlers;
-extern struct ipc_gprs_specs aries_ipc_gprs_specs;
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/aries/onedram.h b/samsung-ipc/device/aries/onedram.h
deleted file mode 100644
index 9c69c76..0000000
--- a/samsung-ipc/device/aries/onedram.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * header for onedram driver
- *
- * Copyright (C) 2010 Samsung Electronics. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#ifndef __ONEDRAM_H__
-#define __ONEDRAM_H__
-
-#include <linux/ioctl.h>
-
-#define ONEDRAM_GET_AUTH _IOW('o', 0x20, u32)
-#define ONEDRAM_PUT_AUTH _IO('o', 0x21)
-#define ONEDRAM_REL_SEM _IO('o', 0x22)
-
-#endif /* __ONEDRAM_H__ */
diff --git a/samsung-ipc/device/aries/phonet.h b/samsung-ipc/device/aries/phonet.h
deleted file mode 100644
index cda62c8..0000000
--- a/samsung-ipc/device/aries/phonet.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef NETPHONET_PHONET_H
-#define NETPHONET_PHONET_H
-
-#include <sys/types.h>
-#include <stdint.h>
-
-#include <sys/socket.h>
-#ifndef AF_PHONET
-#define AF_PHONET 35
-#define PF_PHONET AF_PHONET
-#endif
-
-#define PN_PROTO_TRANSPORT 0
-#define PN_PROTO_PHONET 1
-#define PN_PROTO_PIPE 2
-
-#define SOL_PNPIPE 275
-
-#define PNPIPE_ENCAP 1
-#define PNPIPE_IFINDEX 2
-
-#define PNPIPE_ENCAP_NONE 0
-#define PNPIPE_ENCAP_IP 1
-
-#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
-#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14)
-#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15)
-
-struct sockaddr_pn {
- sa_family_t spn_family;
- uint8_t spn_obj;
- uint8_t spn_dev;
- uint8_t spn_resource;
- uint8_t __pad[sizeof(struct sockaddr) - (sizeof(sa_family_t) + 3)];
-} __attribute__ ((packed));
-
-#include <linux/rtnetlink.h>
-#ifndef RTNLGRP_PHONET_IFADDR
-#define RTNLGRP_PHONET_IFADDR 21
-#endif
-
-#endif
diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c
deleted file mode 100644
index 457cd48..0000000
--- a/samsung-ipc/device/crespo/crespo_ipc.c
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2011 Joerie de Gram <j.de.gram@gmail.com>
- * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-#include <util.h>
-
-#include "crespo_modem_ctl.h"
-
-#include "xmm6160.h"
-#include "crespo_ipc.h"
-
-int crespo_ipc_bootstrap(struct ipc_client *client)
-{
- void *modem_image_data = NULL;
-
- int modem_ctl_fd = -1;
- int serial_fd = -1;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL)
- return -1;
-
- ipc_client_log(client, "Starting crespo modem bootstrap");
-
- modem_image_data = file_data_read(CRESPO_MODEM_IMAGE_DEVICE, CRESPO_MODEM_IMAGE_SIZE, 0x1000);
- if (modem_image_data == NULL) {
- ipc_client_log(client, "Reading modem image data failed");
- goto error;
- }
- ipc_client_log(client, "Read modem image data");
-
- modem_ctl_fd = open(CRESPO_MODEM_CTL_DEVICE, O_RDWR | O_NDELAY);
- if (modem_ctl_fd < 0) {
- ipc_client_log(client, "Opening modem ctl failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem ctl");
-
- rc = ioctl(modem_ctl_fd, IOCTL_MODEM_RESET);
- if (rc < 0) {
- ipc_client_log(client, "Resetting modem failed");
- goto error;
- }
- ipc_client_log(client, "Reset modem");
-
- serial_fd = open(CRESPO_MODEM_SERIAL_DEVICE, O_RDWR | O_NDELAY);
- if (serial_fd < 0) {
- ipc_client_log(client, "Opening serial failed");
- goto error;
- }
- ipc_client_log(client, "Opened serial");
-
- usleep(100000);
-
- p = (unsigned char *) modem_image_data;
-
- rc = xmm6160_psi_send(client, serial_fd, (void *) p, CRESPO_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6160 PSI failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6160 PSI");
-
- p += CRESPO_PSI_SIZE;
-
- lseek(modem_ctl_fd, 0, SEEK_SET);
-
- rc = xmm6160_firmware_send(client, modem_ctl_fd, NULL, (void *) p, CRESPO_MODEM_IMAGE_SIZE - CRESPO_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6160 firmware failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6160 firmware");
-
- lseek(modem_ctl_fd, CRESPO_MODEM_CTL_NV_DATA_OFFSET, SEEK_SET);
-
- rc = xmm6160_nv_data_send(client, modem_ctl_fd, NULL);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6160 nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6160 nv_data");
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (modem_image_data != NULL)
- free(modem_image_data);
-
- if (serial_fd >= 0)
- close(serial_fd);
-
- if (modem_ctl_fd >= 0)
- close(modem_ctl_fd);
-
- return rc;
-}
-
-int crespo_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- struct ipc_fmt_header header;
- struct modem_io mio;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
- return -1;
-
- ipc_fmt_header_fill(&header, request);
-
- memset(&mio, 0, sizeof(struct modem_io));
- mio.size = request->length + sizeof(struct ipc_fmt_header);
- mio.data = malloc(mio.size);
-
- memcpy(mio.data, &header, sizeof(struct ipc_fmt_header));
- if (request->data != NULL && request->length > 0)
- memcpy((void *) ((unsigned char *) mio.data + sizeof(struct ipc_fmt_header)), request->data, request->length);
-
- ipc_client_log_send(client, request, __func__);
-
- rc = client->handlers->write(client->handlers->transport_data, (void *) &mio, sizeof(struct modem_io));
- if (rc < 0) {
- ipc_client_log(client, "Writing FMT data to the modem failed");
- goto error;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (mio.data != NULL)
- free(mio.data);
-
- return rc;
-}
-
-int crespo_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- struct ipc_fmt_header *header;
- struct modem_io mio;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
- return -1;
-
- memset(&mio, 0, sizeof(struct modem_io));
- mio.size = CRESPO_BUFFER_LENGTH;
- mio.data = malloc(mio.size);
-
- rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
- if (rc < 0 || mio.data == NULL || mio.size < sizeof(struct ipc_fmt_header)) {
- ipc_client_log(client, "Reading FMT data from the modem failed");
- goto error;
- }
-
- header = (struct ipc_fmt_header *) mio.data;
-
- ipc_fmt_message_fill(header, response);
-
- if (mio.size > sizeof(struct ipc_fmt_header)) {
- response->length = mio.size - sizeof(struct ipc_fmt_header);
- response->data = malloc(response->length);
-
- memcpy(response->data, (void *) ((unsigned char *) mio.data + sizeof(struct ipc_fmt_header)), response->length);
- }
-
- ipc_client_log_recv(client, response, __func__);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (mio.data != NULL)
- free(mio.data);
-
- return rc;
-}
-
-int crespo_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- struct modem_io mio;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
- return -1;
-
- memset(&mio, 0, sizeof(struct modem_io));
- mio.id = request->mseq;
- mio.cmd = request->index;
- mio.size = request->length;
-
- if (request->data != NULL && request->length > 0) {
- mio.data = malloc(mio.size);
-
- memcpy(mio.data, request->data, request->length);
- }
-
- ipc_client_log_send(client, request, __func__);
-
- rc = client->handlers->write(client->handlers->transport_data, (void *) &mio, sizeof(struct modem_io));
- if (rc < 0) {
- ipc_client_log(client, "Writing RFS data to the modem failed");
- goto error;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (mio.data != NULL)
- free(mio.data);
-
- return rc;
-}
-
-int crespo_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- struct modem_io mio;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
- return -1;
-
- memset(&mio, 0, sizeof(struct modem_io));
- mio.size = CRESPO_BUFFER_LENGTH;
- mio.data = malloc(mio.size);
-
- rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
- if (rc < 0 || mio.data == NULL || mio.size <= 0) {
- ipc_client_log(client, "Reading RFS data from the modem failed");
- goto error;
- }
-
- memset(response, 0, sizeof(struct ipc_message_info));
- response->aseq = mio.id;
- response->group = IPC_GROUP_RFS;
- response->index = mio.cmd;
-
- if (mio.size > 0) {
- response->length = mio.size;
- response->data = malloc(response->length);
-
- memcpy(response->data, mio.data, response->length);
- }
-
- ipc_client_log_recv(client, response, __func__);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (mio.data != NULL)
- free(mio.data);
-
- return rc;
-}
-
-int crespo_ipc_open(void *data, int type)
-{
- struct crespo_ipc_transport_data *transport_data;
- int fd;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct crespo_ipc_transport_data *) data;
-
- switch (type) {
- case IPC_CLIENT_TYPE_FMT:
- fd = open(CRESPO_MODEM_FMT_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- break;
- case IPC_CLIENT_TYPE_RFS:
- fd = open(CRESPO_MODEM_RFS_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- break;
- default:
- return -1;
- }
-
- if (fd < 0)
- return -1;
-
- transport_data->fd = fd;
-
- return 0;
-}
-
-int crespo_ipc_close(void *data)
-{
- struct crespo_ipc_transport_data *transport_data;
- int fd;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct crespo_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- transport_data->fd = -1;
- close(fd);
-
- return 0;
-}
-
-int crespo_ipc_read(void *data, void *buffer, unsigned int length)
-{
- struct crespo_ipc_transport_data *transport_data;
- int fd;
- int rc;
-
- if (data == NULL || buffer == NULL || length == 0)
- return -1;
-
- transport_data = (struct crespo_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- rc = ioctl(fd, IOCTL_MODEM_RECV, buffer);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int crespo_ipc_write(void *data, void *buffer, unsigned int length)
-{
- struct crespo_ipc_transport_data *transport_data;
- int fd;
- int rc;
-
- if (data == NULL || buffer == NULL || length == 0)
- return -1;
-
- transport_data = (struct crespo_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- rc = ioctl(fd, IOCTL_MODEM_SEND, buffer);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int crespo_ipc_poll(void *data, struct timeval *timeout)
-{
- struct crespo_ipc_transport_data *transport_data;
- fd_set fds;
- int fd;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct crespo_ipc_transport_data *) data;
-
- fd = transport_data->fd;
- if (fd < 0)
- return -1;
-
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
-
- rc = select(fd + 1, &fds, NULL, NULL, timeout);
- return rc;
-}
-
-int crespo_ipc_power_on(void *data)
-{
- int fd;
- int rc;
-
- fd = open(CRESPO_MODEM_CTL_DEVICE, O_RDWR);
- if (fd < 0)
- return -1;
-
- rc = ioctl(fd, IOCTL_MODEM_START);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int crespo_ipc_power_off(void *data)
-{
- int fd;
- int rc;
-
- fd = open(CRESPO_MODEM_CTL_DEVICE, O_RDWR);
- if (fd < 0)
- return -1;
-
- rc = ioctl(fd, IOCTL_MODEM_OFF);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int crespo_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- *transport_data = (void *) malloc(sizeof(struct crespo_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct crespo_ipc_transport_data));
-
- return 0;
-}
-
-int crespo_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- free(transport_data);
-
- return 0;
-}
-
-char *crespo_ipc_gprs_get_iface_single(int cid)
-{
- char *iface = NULL;
-
- asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0);
-
- return iface;
-}
-
-int crespo_ipc_gprs_get_capabilities_single(struct ipc_client_gprs_capabilities *capabilities)
-{
- if (capabilities == NULL)
- return -1;
-
- capabilities->port_list = 0;
- capabilities->cid_max = 1;
-
- return 0;
-}
-
-char *crespo_ipc_gprs_get_iface(int cid)
-{
- char *iface = NULL;
-
- if (cid > CRESPO_GPRS_IFACE_COUNT)
- return NULL;
-
- asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, cid - 1);
-
- return iface;
-}
-
-int crespo_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- if (capabilities == NULL)
- return -1;
-
- capabilities->port_list = 0;
- capabilities->cid_max = CRESPO_GPRS_IFACE_COUNT;
-
- return 0;
-}
-
-struct ipc_ops crespo_ipc_fmt_ops = {
- .bootstrap = crespo_ipc_bootstrap,
- .send = crespo_ipc_fmt_send,
- .recv = crespo_ipc_fmt_recv,
-};
-
-struct ipc_ops crespo_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = crespo_ipc_rfs_send,
- .recv = crespo_ipc_rfs_recv,
-};
-
-struct ipc_handlers crespo_ipc_handlers = {
- .open = crespo_ipc_open,
- .close = crespo_ipc_close,
- .read = crespo_ipc_read,
- .write = crespo_ipc_write,
- .poll = crespo_ipc_poll,
- .transport_data = NULL,
- .power_on = crespo_ipc_power_on,
- .power_off = crespo_ipc_power_off,
- .power_data = NULL,
- .gprs_activate = NULL,
- .gprs_deactivate = NULL,
- .gprs_data = NULL,
- .data_create = crespo_ipc_data_create,
- .data_destroy = crespo_ipc_data_destroy,
-};
-
-struct ipc_gprs_specs crespo_ipc_gprs_specs_single = {
- .gprs_get_iface = crespo_ipc_gprs_get_iface_single,
- .gprs_get_capabilities = crespo_ipc_gprs_get_capabilities_single,
-};
-
-struct ipc_gprs_specs crespo_ipc_gprs_specs = {
- .gprs_get_iface = crespo_ipc_gprs_get_iface,
- .gprs_get_capabilities = crespo_ipc_gprs_get_capabilities,
-};
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/crespo/crespo_ipc.h b/samsung-ipc/device/crespo/crespo_ipc.h
deleted file mode 100644
index 85bf21d..0000000
--- a/samsung-ipc/device/crespo/crespo_ipc.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CRESPO_IPC_H__
-#define __CRESPO_IPC_H__
-
-#define CRESPO_MODEM_IMAGE_SIZE 0xD80000
-#define CRESPO_PSI_SIZE 0x5000
-#define CRESPO_MODEM_CTL_NV_DATA_OFFSET 0xD80000
-#define CRESPO_BUFFER_LENGTH 0x50000
-
-#define CRESPO_MODEM_IMAGE_DEVICE "/dev/mtd/mtd5ro"
-#define CRESPO_MODEM_SERIAL_DEVICE "/dev/s3c2410_serial3"
-#define CRESPO_MODEM_CTL_DEVICE "/dev/modem_ctl"
-#define CRESPO_MODEM_FMT_DEVICE "/dev/modem_fmt"
-#define CRESPO_MODEM_RFS_DEVICE "/dev/modem_rfs"
-
-#define CRESPO_GPRS_IFACE_PREFIX "rmnet"
-#define CRESPO_GPRS_IFACE_COUNT 3
-
-struct crespo_ipc_transport_data {
- int fd;
-};
-
-extern struct ipc_ops crespo_ipc_fmt_ops;
-extern struct ipc_ops crespo_ipc_rfs_ops;
-extern struct ipc_handlers crespo_ipc_handlers;
-extern struct ipc_gprs_specs crespo_ipc_gprs_specs_single;
-extern struct ipc_gprs_specs crespo_ipc_gprs_specs;
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/crespo/crespo_modem_ctl.h b/samsung-ipc/device/crespo/crespo_modem_ctl.h
deleted file mode 100644
index 7c23165..0000000
--- a/samsung-ipc/device/crespo/crespo_modem_ctl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2010 Google, Inc.
- * Copyright (C) 2010 Samsung Electronics.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MODEM_CONTROL_H__
-#define __MODEM_CONTROL_H__
-
-#define IOCTL_MODEM_RAMDUMP _IO('o', 0x19)
-#define IOCTL_MODEM_RESET _IO('o', 0x20)
-#define IOCTL_MODEM_START _IO('o', 0x21)
-#define IOCTL_MODEM_OFF _IO('o', 0x22)
-
-#define IOCTL_MODEM_SEND _IO('o', 0x23)
-#define IOCTL_MODEM_RECV _IO('o', 0x24)
-
-struct modem_io {
- uint32_t size;
- uint32_t id;
- uint32_t cmd;
- void *data;
-};
-
-/* platform data */
-struct modemctl_data {
- const char *name;
- unsigned gpio_phone_active;
- unsigned gpio_pda_active;
- unsigned gpio_cp_reset;
- unsigned gpio_phone_on;
- bool is_cdma_modem; /* 1:CDMA Modem */
-};
-
-#endif
diff --git a/samsung-ipc/device/galaxys2/galaxys2_ipc.c b/samsung-ipc/device/galaxys2/galaxys2_ipc.c
deleted file mode 100644
index 5c1c9c3..0000000
--- a/samsung-ipc/device/galaxys2/galaxys2_ipc.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-
-#include "xmm6260.h"
-#include "xmm6260_hsic.h"
-#include "xmm6260_sec_modem.h"
-#include "galaxys2_ipc.h"
-
-int galaxys2_ipc_bootstrap(struct ipc_client *client)
-{
- void *modem_image_data = NULL;
- int modem_image_fd = -1;
- int modem_boot_fd = -1;
- int modem_link_fd = -1;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL)
- return -1;
-
- ipc_client_log(client, "Starting galaxys2 modem bootstrap");
-
- modem_image_fd = open(GALAXYS2_MODEM_IMAGE_DEVICE, O_RDONLY);
- if (modem_image_fd < 0) {
- ipc_client_log(client, "Opening modem image device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem image device");
-
- modem_image_data = mmap(0, GALAXYS2_MODEM_IMAGE_SIZE, PROT_READ, MAP_SHARED, modem_image_fd, 0);
- if (modem_image_data == NULL || modem_image_data == (void *) 0xffffffff) {
- ipc_client_log(client, "Mapping modem image data to memory failed");
- goto error;
- }
- ipc_client_log(client, "Mapped modem image data to memory");
-
- modem_boot_fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (modem_boot_fd < 0) {
- ipc_client_log(client, "Opening modem boot device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem boot device");
-
- modem_link_fd = open(XMM6260_SEC_MODEM_LINK_PM_DEVICE, O_RDWR);
- if (modem_link_fd < 0) {
- ipc_client_log(client, "Opening modem link device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem link device");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 0);
- rc |= xmm6260_sec_modem_link_control_enable(modem_link_fd, 0);
- rc |= xmm6260_sec_modem_hci_power(0);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 0);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem off");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 1);
- rc |= xmm6260_sec_modem_link_control_enable(modem_link_fd, 1);
- rc |= xmm6260_sec_modem_hci_power(1);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 1);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem on");
-
- rc = xmm6260_sec_modem_link_connected_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for link connected failed");
- goto error;
- }
- ipc_client_log(client, "Waited for link connected");
-
- p = (unsigned char *) modem_image_data + GALAXYS2_PSI_OFFSET;
-
- rc = xmm6260_hsic_psi_send(client, modem_boot_fd, (void *) p, GALAXYS2_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC PSI failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC PSI");
-
- p = (unsigned char *) modem_image_data + GALAXYS2_EBL_OFFSET;
-
- rc = xmm6260_hsic_ebl_send(client, modem_boot_fd, (void *) p, GALAXYS2_EBL_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC EBL failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC EBL");
-
- rc = xmm6260_hsic_port_config_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC port config failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC port config");
-
- p = (unsigned char *) modem_image_data + GALAXYS2_SEC_START_OFFSET;
-
- rc = xmm6260_hsic_sec_start_send(client, modem_boot_fd, (void *) p, GALAXYS2_SEC_START_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC SEC start failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC SEC start");
-
- p = (unsigned char *) modem_image_data + GALAXYS2_FIRMWARE_OFFSET;
-
- rc = xmm6260_hsic_firmware_send(client, modem_boot_fd, (void *) p, GALAXYS2_FIRMWARE_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC firmware failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC firmware");
-
- rc = xmm6260_hsic_nv_data_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC nv_data");
-
- rc = xmm6260_hsic_sec_end_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC SEC end failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC SEC end");
-
- rc = xmm6260_hsic_hw_reset_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC HW reset failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC HW reset");
-
- usleep(300000);
-
- rc = xmm6260_sec_modem_link_get_hostwake_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for host wake failed");
- }
-
- rc = xmm6260_sec_modem_link_control_enable(modem_link_fd, 0);
- rc |= xmm6260_sec_modem_hci_power(0);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 0);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
-
- rc = xmm6260_sec_modem_link_get_hostwake_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for host wake failed");
- goto error;
- }
- ipc_client_log(client, "Waited for host wake");
-
- rc = xmm6260_sec_modem_link_control_enable(modem_link_fd, 1);
- rc |= xmm6260_sec_modem_hci_power(1);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 1);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
-
- rc = xmm6260_sec_modem_link_connected_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for link connected failed");
- goto error;
- }
- ipc_client_log(client, "Waited for link connected");
-
- usleep(300000);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (modem_image_data != NULL)
- munmap(modem_image_data, GALAXYS2_MODEM_IMAGE_SIZE);
-
- if (modem_image_fd >= 0)
- close(modem_image_fd);
-
- if (modem_boot_fd >= 0)
- close(modem_boot_fd);
-
- if (modem_link_fd >= 0)
- close(modem_link_fd);
-
- return rc;
-}
-
-
-int galaxys2_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int galaxys2_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int galaxys2_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int galaxys2_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int galaxys2_ipc_open(void *data, int type)
-{
- struct galaxys2_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct galaxys2_ipc_transport_data *) data;
-
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
- if (transport_data->fd < 0)
- return -1;
-
- return 0;
-}
-
-int galaxys2_ipc_close(void *data)
-{
- struct galaxys2_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct galaxys2_ipc_transport_data *) data;
-
- xmm6260_sec_modem_ipc_close(transport_data->fd);
- transport_data->fd = -1;
-
- return 0;
-}
-
-int galaxys2_ipc_read(void *data, void *buffer, unsigned int length)
-{
- struct galaxys2_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct galaxys2_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
- return rc;
-}
-
-int galaxys2_ipc_write(void *data, void *buffer, unsigned int length)
-{
- struct galaxys2_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct galaxys2_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
- return rc;
-}
-
-int galaxys2_ipc_poll(void *data, struct timeval *timeout)
-{
- struct galaxys2_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct galaxys2_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
- return rc;
-}
-
-int galaxys2_ipc_power_on(void *data)
-{
- return 0;
-}
-
-int galaxys2_ipc_power_off(void *data)
-{
- int fd;
- int rc;
-
- fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (fd < 0)
- return -1;
-
- rc = xmm6260_sec_modem_power(fd, 0);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int galaxys2_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- *transport_data = (void *) malloc(sizeof(struct galaxys2_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct galaxys2_ipc_transport_data));
-
- return 0;
-}
-
-int galaxys2_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- free(transport_data);
-
- return 0;
-}
-
-char *galaxys2_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int galaxys2_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops galaxys2_ipc_fmt_ops = {
- .bootstrap = galaxys2_ipc_bootstrap,
- .send = galaxys2_ipc_fmt_send,
- .recv = galaxys2_ipc_fmt_recv,
-};
-
-struct ipc_ops galaxys2_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = galaxys2_ipc_rfs_send,
- .recv = galaxys2_ipc_rfs_recv,
-};
-
-struct ipc_handlers galaxys2_ipc_handlers = {
- .read = galaxys2_ipc_read,
- .write = galaxys2_ipc_write,
- .open = galaxys2_ipc_open,
- .close = galaxys2_ipc_close,
- .poll = galaxys2_ipc_poll,
- .transport_data = NULL,
- .power_on = galaxys2_ipc_power_on,
- .power_off = galaxys2_ipc_power_off,
- .power_data = NULL,
- .gprs_activate = NULL,
- .gprs_deactivate = NULL,
- .gprs_data = NULL,
- .data_create = galaxys2_ipc_data_create,
- .data_destroy = galaxys2_ipc_data_destroy,
-};
-
-struct ipc_gprs_specs galaxys2_ipc_gprs_specs = {
- .gprs_get_iface = galaxys2_ipc_gprs_get_iface,
- .gprs_get_capabilities = galaxys2_ipc_gprs_get_capabilities,
-};
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/galaxys2/galaxys2_ipc.h b/samsung-ipc/device/galaxys2/galaxys2_ipc.h
deleted file mode 100644
index b8b6a12..0000000
--- a/samsung-ipc/device/galaxys2/galaxys2_ipc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GALAXYS2_IPC_H__
-#define __GALAXYS2_IPC_H__
-
-#define GALAXYS2_MODEM_IMAGE_SIZE 0x1000000
-#define GALAXYS2_PSI_OFFSET 0
-#define GALAXYS2_PSI_SIZE 0xF000
-#define GALAXYS2_EBL_OFFSET 0xF000
-#define GALAXYS2_EBL_SIZE 0x19000
-#define GALAXYS2_SEC_START_OFFSET 0x9FF800
-#define GALAXYS2_SEC_START_SIZE 0x800
-#define GALAXYS2_FIRMWARE_OFFSET 0x28000
-#define GALAXYS2_FIRMWARE_SIZE 0x9D8000
-#define GALAXYS2_NV_DATA_OFFSET 0xA00000
-#define GALAXYS2_NV_DATA_SIZE 0x200000
-
-#define GALAXYS2_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p8"
-
-struct galaxys2_ipc_transport_data {
- int fd;
-};
-
-extern struct ipc_ops galaxys2_ipc_fmt_ops;
-extern struct ipc_ops galaxys2_ipc_rfs_ops;
-extern struct ipc_handlers galaxys2_ipc_handlers;
-extern struct ipc_gprs_specs galaxys2_ipc_gprs_specs;
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/i9300/i9300_ipc.c b/samsung-ipc/device/i9300/i9300_ipc.c
deleted file mode 100644
index 59c2eb5..0000000
--- a/samsung-ipc/device/i9300/i9300_ipc.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-
-#include "xmm6260.h"
-#include "xmm6260_hsic.h"
-#include "xmm6260_sec_modem.h"
-#include "i9300_ipc.h"
-
-int i9300_ipc_bootstrap(struct ipc_client *client)
-{
- void *modem_image_data = NULL;
- int modem_image_fd = -1;
- int modem_boot_fd = -1;
- int modem_link_fd = -1;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL)
- return -1;
-
- ipc_client_log(client, "Starting i9300 modem bootstrap");
-
- modem_image_fd = open(I9300_MODEM_IMAGE_DEVICE, O_RDONLY);
- if (modem_image_fd < 0) {
- ipc_client_log(client, "Opening modem image device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem image device");
-
- modem_image_data = mmap(0, I9300_MODEM_IMAGE_SIZE, PROT_READ, MAP_SHARED, modem_image_fd, 0);
- if (modem_image_data == NULL || modem_image_data == (void *) 0xffffffff) {
- ipc_client_log(client, "Mapping modem image data to memory failed");
- goto error;
- }
- ipc_client_log(client, "Mapped modem image data to memory");
-
- modem_boot_fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (modem_boot_fd < 0) {
- ipc_client_log(client, "Opening modem boot device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem boot device");
-
- modem_link_fd = open(XMM6260_SEC_MODEM_LINK_PM_DEVICE, O_RDWR);
- if (modem_link_fd < 0) {
- ipc_client_log(client, "Opening modem link device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem link device");
-
- rc = xmm6260_sec_modem_hci_power(0);
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem off");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 1);
- rc |= xmm6260_sec_modem_hci_power(1);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem on");
-
- rc = xmm6260_sec_modem_link_connected_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for link connected failed");
- goto error;
- }
- ipc_client_log(client, "Waited for link connected");
-
- p = (unsigned char *) modem_image_data + I9300_PSI_OFFSET;
-
- rc = xmm6260_hsic_psi_send(client, modem_boot_fd, (void *) p, I9300_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC PSI failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC PSI");
-
- p = (unsigned char *) modem_image_data + I9300_EBL_OFFSET;
-
- rc = xmm6260_hsic_ebl_send(client, modem_boot_fd, (void *) p, I9300_EBL_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC EBL failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC EBL");
-
- rc = xmm6260_hsic_port_config_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC port config failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC port config");
-
- p = (unsigned char *) modem_image_data + I9300_SEC_START_OFFSET;
-
- rc = xmm6260_hsic_sec_start_send(client, modem_boot_fd, (void *) p, I9300_SEC_START_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC SEC start failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC SEC start");
-
- p = (unsigned char *) modem_image_data + I9300_FIRMWARE_OFFSET;
-
- rc = xmm6260_hsic_firmware_send(client, modem_boot_fd, (void *) p, I9300_FIRMWARE_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC firmware failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC firmware");
-
- rc = xmm6260_hsic_nv_data_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC nv_data");
-
- rc = xmm6260_hsic_sec_end_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC SEC end failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC SEC end");
-
- rc = xmm6260_hsic_hw_reset_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC HW reset failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC HW reset");
-
- usleep(300000);
-
- rc = xmm6260_sec_modem_link_get_hostwake_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for host wake failed");
- }
-
- rc = xmm6260_sec_modem_link_control_enable(modem_link_fd, 0);
- rc |= xmm6260_sec_modem_hci_power(0);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 0);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
-
- rc = xmm6260_sec_modem_link_get_hostwake_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for host wake failed");
- goto error;
- }
- ipc_client_log(client, "Waited for host wake");
-
- rc = xmm6260_sec_modem_link_control_enable(modem_link_fd, 1);
- rc |= xmm6260_sec_modem_hci_power(1);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 1);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
-
- rc = xmm6260_sec_modem_link_connected_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for link connected failed");
- goto error;
- }
- ipc_client_log(client, "Waited for link connected");
-
- usleep(300000);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (modem_image_data != NULL)
- munmap(modem_image_data, I9300_MODEM_IMAGE_SIZE);
-
- if (modem_image_fd >= 0)
- close(modem_image_fd);
-
- if (modem_boot_fd >= 0)
- close(modem_boot_fd);
-
- if (modem_link_fd >= 0)
- close(modem_link_fd);
-
- return rc;
-}
-
-
-int i9300_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int i9300_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int i9300_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int i9300_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int i9300_ipc_open(void *data, int type)
-{
- struct i9300_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct i9300_ipc_transport_data *) data;
-
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
- if (transport_data->fd < 0)
- return -1;
-
- return 0;
-}
-
-int i9300_ipc_close(void *data)
-{
- struct i9300_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct i9300_ipc_transport_data *) data;
-
- xmm6260_sec_modem_ipc_close(transport_data->fd);
- transport_data->fd = -1;
-
- return 0;
-}
-
-int i9300_ipc_read(void *data, void *buffer, unsigned int length)
-{
- struct i9300_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct i9300_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
- return rc;
-}
-
-int i9300_ipc_write(void *data, void *buffer, unsigned int length)
-{
- struct i9300_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct i9300_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
- return rc;
-}
-
-int i9300_ipc_poll(void *data, struct timeval *timeout)
-{
- struct i9300_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct i9300_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
- return rc;
-}
-
-int i9300_ipc_power_on(void *data)
-{
- return 0;
-}
-
-int i9300_ipc_power_off(void *data)
-{
- int fd;
- int rc;
-
- fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (fd < 0)
- return -1;
-
- rc = xmm6260_sec_modem_power(fd, 0);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int i9300_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- *transport_data = (void *) malloc(sizeof(struct i9300_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct i9300_ipc_transport_data));
-
- return 0;
-}
-
-int i9300_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- free(transport_data);
-
- return 0;
-}
-
-char *i9300_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int i9300_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops i9300_ipc_fmt_ops = {
- .bootstrap = i9300_ipc_bootstrap,
- .send = i9300_ipc_fmt_send,
- .recv = i9300_ipc_fmt_recv,
-};
-
-struct ipc_ops i9300_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = i9300_ipc_rfs_send,
- .recv = i9300_ipc_rfs_recv,
-};
-
-struct ipc_handlers i9300_ipc_handlers = {
- .read = i9300_ipc_read,
- .write = i9300_ipc_write,
- .open = i9300_ipc_open,
- .close = i9300_ipc_close,
- .poll = i9300_ipc_poll,
- .transport_data = NULL,
- .power_on = i9300_ipc_power_on,
- .power_off = i9300_ipc_power_off,
- .power_data = NULL,
- .gprs_activate = NULL,
- .gprs_deactivate = NULL,
- .gprs_data = NULL,
- .data_create = i9300_ipc_data_create,
- .data_destroy = i9300_ipc_data_destroy,
-};
-
-struct ipc_gprs_specs i9300_ipc_gprs_specs = {
- .gprs_get_iface = i9300_ipc_gprs_get_iface,
- .gprs_get_capabilities = i9300_ipc_gprs_get_capabilities,
-};
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/i9300/i9300_ipc.h b/samsung-ipc/device/i9300/i9300_ipc.h
deleted file mode 100644
index 6eceb21..0000000
--- a/samsung-ipc/device/i9300/i9300_ipc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __I9300_IPC_H__
-#define __I9300_IPC_H__
-
-#define I9300_MODEM_IMAGE_SIZE 0x1000000
-#define I9300_PSI_OFFSET 0x1000
-#define I9300_PSI_SIZE 0xE000
-#define I9300_EBL_OFFSET 0xF000
-#define I9300_EBL_SIZE 0x19000
-#define I9300_SEC_START_OFFSET 0x9FF800
-#define I9300_SEC_START_SIZE 0x800
-#define I9300_FIRMWARE_OFFSET 0x28000
-#define I9300_FIRMWARE_SIZE 0x9D7800
-#define I9300_NV_DATA_OFFSET 0xA00000
-#define I9300_NV_DATA_SIZE 0x200000
-
-#define I9300_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p7"
-
-struct i9300_ipc_transport_data {
- int fd;
-};
-
-extern struct ipc_ops i9300_ipc_fmt_ops;
-extern struct ipc_ops i9300_ipc_rfs_ops;
-extern struct ipc_handlers i9300_ipc_handlers;
-extern struct ipc_gprs_specs i9300_ipc_gprs_specs;
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/maguro/maguro_ipc.c b/samsung-ipc/device/maguro/maguro_ipc.c
deleted file mode 100644
index 9b824a0..0000000
--- a/samsung-ipc/device/maguro/maguro_ipc.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-#include <util.h>
-
-#include "xmm6260.h"
-#include "xmm6260_mipi.h"
-#include "xmm6260_sec_modem.h"
-#include "maguro_ipc.h"
-
-int maguro_ipc_bootstrap(struct ipc_client *client)
-{
- void *modem_image_data = NULL;
- int modem_image_fd = -1;
- int modem_boot_fd = -1;
- void *mps_data = NULL;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL)
- return -1;
-
- ipc_client_log(client, "Starting maguro modem bootstrap");
-
- modem_image_fd = open(MAGURO_MODEM_IMAGE_DEVICE, O_RDONLY);
- if (modem_image_fd < 0) {
- ipc_client_log(client, "Opening modem image device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem image device");
-
- modem_image_data = mmap(0, MAGURO_MODEM_IMAGE_SIZE, PROT_READ, MAP_SHARED, modem_image_fd, 0);
- if (modem_image_data == NULL || modem_image_data == (void *) 0xffffffff) {
- ipc_client_log(client, "Mapping modem image data to memory failed");
- goto error;
- }
- ipc_client_log(client, "Mapped modem image data to memory");
-
- modem_boot_fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (modem_boot_fd < 0) {
- ipc_client_log(client, "Opening modem boot device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem boot device");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 0);
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem off");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 1);
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem on");
-
- p = (unsigned char *) modem_image_data + MAGURO_PSI_OFFSET;
-
- rc = xmm6260_mipi_psi_send(client, modem_boot_fd, (void *) p, MAGURO_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI PSI failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI PSI");
-
- close(modem_boot_fd);
-
- modem_boot_fd = open(XMM6260_SEC_MODEM_BOOT1_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (modem_boot_fd < 0) {
- ipc_client_log(client, "Opening modem boot device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem boot device");
-
- p = (unsigned char *) modem_image_data + MAGURO_EBL_OFFSET;
-
- rc = xmm6260_mipi_ebl_send(client, modem_boot_fd, (void *) p, MAGURO_EBL_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI EBL failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI EBL");
-
- rc = xmm6260_mipi_port_config_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI port config failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI port config");
-
- p = (unsigned char *) modem_image_data + MAGURO_SEC_START_OFFSET;
-
- rc = xmm6260_mipi_sec_start_send(client, modem_boot_fd, (void *) p, MAGURO_SEC_START_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI SEC start failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI SEC start");
-
- p = (unsigned char *) modem_image_data + MAGURO_FIRMWARE_OFFSET;
-
- rc = xmm6260_mipi_firmware_send(client, modem_boot_fd, (void *) p, MAGURO_FIRMWARE_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI firmware failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI firmware");
-
- rc = xmm6260_mipi_nv_data_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI nv_data");
-
- mps_data = file_data_read(MAGURO_MPS_DATA_DEVICE, MAGURO_MPS_DATA_SIZE, MAGURO_MPS_DATA_SIZE);
- if (mps_data == NULL) {
- ipc_client_log(client, "Reading MPS data failed");
- goto error;
- }
- ipc_client_log(client, "Read MPS data");
-
- rc = xmm6260_mipi_mps_data_send(client, modem_boot_fd, mps_data, MAGURO_MPS_DATA_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI MPS data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI MPS data");
-
- rc = xmm6260_mipi_sec_end_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI SEC end failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI SEC end");
-
- rc = xmm6260_mipi_hw_reset_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI HW reset failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI HW reset");
-
- rc = xmm6260_sec_modem_status_online_wait(modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for online status failed");
- goto error;
- }
- ipc_client_log(client, "Waited for online status");
-
- rc = xmm6260_sec_modem_boot_power(modem_boot_fd, 0);
- if (rc < 0) {
- ipc_client_log(client, "Turning modem boot off failed");
- goto error;
- }
- ipc_client_log(client, "Turned modem boot off");
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (mps_data != NULL)
- free(mps_data);
-
- if (modem_image_data != NULL)
- munmap(modem_image_data, MAGURO_MODEM_IMAGE_SIZE);
-
- if (modem_image_fd >= 0)
- close(modem_image_fd);
-
- if (modem_boot_fd >= 0)
- close(modem_boot_fd);
-
- return rc;
-}
-
-
-int maguro_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int maguro_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int maguro_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int maguro_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int maguro_ipc_open(void *data, int type)
-{
- struct maguro_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct maguro_ipc_transport_data *) data;
-
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
- if (transport_data->fd < 0)
- return -1;
-
- return 0;
-}
-
-int maguro_ipc_close(void *data)
-{
- struct maguro_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct maguro_ipc_transport_data *) data;
-
- xmm6260_sec_modem_ipc_close(transport_data->fd);
- transport_data->fd = -1;
-
- return 0;
-}
-
-int maguro_ipc_read(void *data, void *buffer, unsigned int length)
-{
- struct maguro_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct maguro_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
- return rc;
-}
-
-int maguro_ipc_write(void *data, void *buffer, unsigned int length)
-{
- struct maguro_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct maguro_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
- return rc;
-}
-
-int maguro_ipc_poll(void *data, struct timeval *timeout)
-{
- struct maguro_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct maguro_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
- return rc;
-}
-
-int maguro_ipc_power_on(void *data)
-{
- return 0;
-}
-
-int maguro_ipc_power_off(void *data)
-{
- int fd;
- int rc;
-
- fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (fd < 0)
- return -1;
-
- rc = xmm6260_sec_modem_power(fd, 0);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int maguro_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- *transport_data = (void *) malloc(sizeof(struct maguro_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct maguro_ipc_transport_data));
-
- return 0;
-}
-
-int maguro_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- free(transport_data);
-
- return 0;
-}
-
-char *maguro_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int maguro_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops maguro_ipc_fmt_ops = {
- .bootstrap = maguro_ipc_bootstrap,
- .send = maguro_ipc_fmt_send,
- .recv = maguro_ipc_fmt_recv,
-};
-
-struct ipc_ops maguro_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = maguro_ipc_rfs_send,
- .recv = maguro_ipc_rfs_recv,
-};
-
-struct ipc_handlers maguro_ipc_handlers = {
- .read = maguro_ipc_read,
- .write = maguro_ipc_write,
- .open = maguro_ipc_open,
- .close = maguro_ipc_close,
- .poll = maguro_ipc_poll,
- .transport_data = NULL,
- .power_on = maguro_ipc_power_on,
- .power_off = maguro_ipc_power_off,
- .power_data = NULL,
- .gprs_activate = NULL,
- .gprs_deactivate = NULL,
- .gprs_data = NULL,
- .data_create = maguro_ipc_data_create,
- .data_destroy = maguro_ipc_data_destroy,
-};
-
-struct ipc_gprs_specs maguro_ipc_gprs_specs = {
- .gprs_get_iface = maguro_ipc_gprs_get_iface,
- .gprs_get_capabilities = maguro_ipc_gprs_get_capabilities,
-};
-
-struct ipc_nv_data_specs maguro_ipc_nv_data_specs = {
- .nv_data_path = MAGURO_NV_DATA_PATH,
- .nv_data_md5_path = MAGURO_NV_DATA_MD5_PATH,
- .nv_state_path = MAGURO_NV_STATE_PATH,
- .nv_data_bak_path = MAGURO_NV_DATA_BAK_PATH,
- .nv_data_md5_bak_path = MAGURO_NV_DATA_MD5_BAK_PATH,
-};
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/maguro/maguro_ipc.h b/samsung-ipc/device/maguro/maguro_ipc.h
deleted file mode 100644
index 67836ba..0000000
--- a/samsung-ipc/device/maguro/maguro_ipc.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __MAGURO_IPC_H__
-#define __MAGURO_IPC_H__
-
-#define MAGURO_MODEM_IMAGE_SIZE 0x1000000
-#define MAGURO_PSI_OFFSET 0
-#define MAGURO_PSI_SIZE 0xF000
-#define MAGURO_EBL_OFFSET 0xF000
-#define MAGURO_EBL_SIZE 0x19000
-#define MAGURO_SEC_START_OFFSET 0x9FF800
-#define MAGURO_SEC_START_SIZE 0x800
-#define MAGURO_FIRMWARE_OFFSET 0x28000
-#define MAGURO_FIRMWARE_SIZE 0x9D8000
-#define MAGURO_NV_DATA_OFFSET 0xA00000
-#define MAGURO_NV_DATA_SIZE 0x200000
-#define MAGURO_MPS_DATA_SIZE 3
-
-#define MAGURO_MODEM_IMAGE_DEVICE "/dev/block/platform/omap/omap_hsmmc.0/by-name/radio"
-#define MAGURO_MPS_DATA_DEVICE "/factory/imei/mps_code.dat"
-
-#define MAGURO_NV_DATA_PATH "/factory/nv_data.bin"
-#define MAGURO_NV_DATA_MD5_PATH "/factory/nv_data.bin.md5"
-#define MAGURO_NV_STATE_PATH "/factory/.nv_state"
-#define MAGURO_NV_DATA_BAK_PATH "/factory/.nv_data.bak"
-#define MAGURO_NV_DATA_MD5_BAK_PATH "/factory/.nv_data.bak.md5"
-
-struct maguro_ipc_transport_data {
- int fd;
-};
-
-extern struct ipc_ops maguro_ipc_fmt_ops;
-extern struct ipc_ops maguro_ipc_rfs_ops;
-extern struct ipc_handlers maguro_ipc_handlers;
-extern struct ipc_gprs_specs maguro_ipc_gprs_specs;
-extern struct ipc_nv_data_specs maguro_ipc_nv_data_specs;
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/n7100/n7100_ipc.c b/samsung-ipc/device/n7100/n7100_ipc.c
deleted file mode 100644
index 03c30dc..0000000
--- a/samsung-ipc/device/n7100/n7100_ipc.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-
-#include "xmm6260.h"
-#include "xmm6260_hsic.h"
-#include "xmm6260_sec_modem.h"
-#include "n7100_ipc.h"
-
-int n7100_ipc_bootstrap(struct ipc_client *client)
-{
- void *modem_image_data = NULL;
- int modem_image_fd = -1;
- int modem_boot_fd = -1;
- int modem_link_fd = -1;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL)
- return -1;
-
- ipc_client_log(client, "Starting n7100 modem bootstrap");
-
- modem_image_fd = open(N7100_MODEM_IMAGE_DEVICE, O_RDONLY);
- if (modem_image_fd < 0) {
- ipc_client_log(client, "Opening modem image device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem image device");
-
- modem_image_data = mmap(0, N7100_MODEM_IMAGE_SIZE, PROT_READ, MAP_SHARED, modem_image_fd, 0);
- if (modem_image_data == NULL || modem_image_data == (void *) 0xffffffff) {
- ipc_client_log(client, "Mapping modem image data to memory failed");
- goto error;
- }
- ipc_client_log(client, "Mapped modem image data to memory");
-
- modem_boot_fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (modem_boot_fd < 0) {
- ipc_client_log(client, "Opening modem boot device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem boot device");
-
- modem_link_fd = open(XMM6260_SEC_MODEM_LINK_PM_DEVICE, O_RDWR);
- if (modem_link_fd < 0) {
- ipc_client_log(client, "Opening modem link device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem link device");
-
- rc = xmm6260_sec_modem_hci_power(0);
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem off");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 1);
- rc |= xmm6260_sec_modem_hci_power(1);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem on");
-
- rc = xmm6260_sec_modem_link_connected_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for link connected failed");
- goto error;
- }
- ipc_client_log(client, "Waited for link connected");
-
- p = (unsigned char *) modem_image_data + N7100_PSI_OFFSET;
-
- rc = xmm6260_hsic_psi_send(client, modem_boot_fd, (void *) p, N7100_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC PSI failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC PSI");
-
- p = (unsigned char *) modem_image_data + N7100_EBL_OFFSET;
-
- rc = xmm6260_hsic_ebl_send(client, modem_boot_fd, (void *) p, N7100_EBL_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC EBL failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC EBL");
-
- rc = xmm6260_hsic_port_config_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC port config failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC port config");
-
- p = (unsigned char *) modem_image_data + N7100_SEC_START_OFFSET;
-
- rc = xmm6260_hsic_sec_start_send(client, modem_boot_fd, (void *) p, N7100_SEC_START_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC SEC start failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC SEC start");
-
- p = (unsigned char *) modem_image_data + N7100_FIRMWARE_OFFSET;
-
- rc = xmm6260_hsic_firmware_send(client, modem_boot_fd, (void *) p, N7100_FIRMWARE_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC firmware failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC firmware");
-
- rc = xmm6260_hsic_nv_data_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC nv_data");
-
- rc = xmm6260_hsic_sec_end_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC SEC end failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC SEC end");
-
- rc = xmm6260_hsic_hw_reset_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 HSIC HW reset failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 HSIC HW reset");
-
- usleep(300000);
-
- rc = xmm6260_sec_modem_link_get_hostwake_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for host wake failed");
- }
-
- rc = xmm6260_sec_modem_link_control_enable(modem_link_fd, 0);
- rc |= xmm6260_sec_modem_hci_power(0);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 0);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
-
- rc = xmm6260_sec_modem_link_get_hostwake_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for host wake failed");
- goto error;
- }
- ipc_client_log(client, "Waited for host wake");
-
- rc = xmm6260_sec_modem_link_control_enable(modem_link_fd, 1);
- rc |= xmm6260_sec_modem_hci_power(1);
- rc |= xmm6260_sec_modem_link_control_active(modem_link_fd, 1);
-
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
-
- rc = xmm6260_sec_modem_link_connected_wait(modem_link_fd);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for link connected failed");
- goto error;
- }
- ipc_client_log(client, "Waited for link connected");
-
- usleep(300000);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (modem_image_data != NULL)
- munmap(modem_image_data, N7100_MODEM_IMAGE_SIZE);
-
- if (modem_image_fd >= 0)
- close(modem_image_fd);
-
- if (modem_boot_fd >= 0)
- close(modem_boot_fd);
-
- if (modem_link_fd >= 0)
- close(modem_link_fd);
-
- return rc;
-}
-
-
-int n7100_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int n7100_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int n7100_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int n7100_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int n7100_ipc_open(void *data, int type)
-{
- struct n7100_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct n7100_ipc_transport_data *) data;
-
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
- if (transport_data->fd < 0)
- return -1;
-
- return 0;
-}
-
-int n7100_ipc_close(void *data)
-{
- struct n7100_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct n7100_ipc_transport_data *) data;
-
- xmm6260_sec_modem_ipc_close(transport_data->fd);
- transport_data->fd = -1;
-
- return 0;
-}
-
-int n7100_ipc_read(void *data, void *buffer, unsigned int length)
-{
- struct n7100_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct n7100_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
- return rc;
-}
-
-int n7100_ipc_write(void *data, void *buffer, unsigned int length)
-{
- struct n7100_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct n7100_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
- return rc;
-}
-
-int n7100_ipc_poll(void *data, struct timeval *timeout)
-{
- struct n7100_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct n7100_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
- return rc;
-}
-
-int n7100_ipc_power_on(void *data)
-{
- return 0;
-}
-
-int n7100_ipc_power_off(void *data)
-{
- int fd;
- int rc;
-
- fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (fd < 0)
- return -1;
-
- rc = xmm6260_sec_modem_power(fd, 0);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int n7100_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- *transport_data = (void *) malloc(sizeof(struct n7100_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct n7100_ipc_transport_data));
-
- return 0;
-}
-
-int n7100_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- free(transport_data);
-
- return 0;
-}
-
-char *n7100_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int n7100_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops n7100_ipc_fmt_ops = {
- .bootstrap = n7100_ipc_bootstrap,
- .send = n7100_ipc_fmt_send,
- .recv = n7100_ipc_fmt_recv,
-};
-
-struct ipc_ops n7100_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = n7100_ipc_rfs_send,
- .recv = n7100_ipc_rfs_recv,
-};
-
-struct ipc_handlers n7100_ipc_handlers = {
- .read = n7100_ipc_read,
- .write = n7100_ipc_write,
- .open = n7100_ipc_open,
- .close = n7100_ipc_close,
- .poll = n7100_ipc_poll,
- .transport_data = NULL,
- .power_on = n7100_ipc_power_on,
- .power_off = n7100_ipc_power_off,
- .power_data = NULL,
- .gprs_activate = NULL,
- .gprs_deactivate = NULL,
- .gprs_data = NULL,
- .data_create = n7100_ipc_data_create,
- .data_destroy = n7100_ipc_data_destroy,
-};
-
-struct ipc_gprs_specs n7100_ipc_gprs_specs = {
- .gprs_get_iface = n7100_ipc_gprs_get_iface,
- .gprs_get_capabilities = n7100_ipc_gprs_get_capabilities,
-};
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/n7100/n7100_ipc.h b/samsung-ipc/device/n7100/n7100_ipc.h
deleted file mode 100644
index a081315..0000000
--- a/samsung-ipc/device/n7100/n7100_ipc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __N7100_IPC_H__
-#define __N7100_IPC_H__
-
-#define N7100_MODEM_IMAGE_SIZE 0x1000000
-#define N7100_PSI_OFFSET 0x1000
-#define N7100_PSI_SIZE 0xE000
-#define N7100_EBL_OFFSET 0xF000
-#define N7100_EBL_SIZE 0x19000
-#define N7100_SEC_START_OFFSET 0x9FF800
-#define N7100_SEC_START_SIZE 0x800
-#define N7100_FIRMWARE_OFFSET 0x28000
-#define N7100_FIRMWARE_SIZE 0x9D7800
-#define N7100_NV_DATA_OFFSET 0xA00000
-#define N7100_NV_DATA_SIZE 0x200000
-
-#define N7100_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p10"
-
-struct n7100_ipc_transport_data {
- int fd;
-};
-
-extern struct ipc_ops n7100_ipc_fmt_ops;
-extern struct ipc_ops n7100_ipc_rfs_ops;
-extern struct ipc_handlers n7100_ipc_handlers;
-extern struct ipc_gprs_specs n7100_ipc_gprs_specs;
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/piranha/piranha_ipc.c b/samsung-ipc/device/piranha/piranha_ipc.c
deleted file mode 100644
index 5bdd0cd..0000000
--- a/samsung-ipc/device/piranha/piranha_ipc.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-
-#include "xmm6260.h"
-#include "xmm6260_mipi.h"
-#include "xmm6260_sec_modem.h"
-#include "piranha_ipc.h"
-
-int piranha_ipc_bootstrap(struct ipc_client *client)
-{
- void *modem_image_data = NULL;
- int modem_image_fd = -1;
- int modem_boot_fd = -1;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL)
- return -1;
-
- ipc_client_log(client, "Starting piranha modem bootstrap");
-
- modem_image_fd = open(PIRANHA_MODEM_IMAGE_DEVICE, O_RDONLY);
- if (modem_image_fd < 0) {
- ipc_client_log(client, "Opening modem image device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem image device");
-
- modem_image_data = mmap(0, PIRANHA_MODEM_IMAGE_SIZE, PROT_READ, MAP_SHARED, modem_image_fd, 0);
- if (modem_image_data == NULL || modem_image_data == (void *) 0xffffffff) {
- ipc_client_log(client, "Mapping modem image data to memory failed");
- goto error;
- }
- ipc_client_log(client, "Mapped modem image data to memory");
-
- modem_boot_fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (modem_boot_fd < 0) {
- ipc_client_log(client, "Opening modem boot device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem boot device");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 0);
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem off failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem off");
-
- rc = xmm6260_sec_modem_power(modem_boot_fd, 1);
- if (rc < 0) {
- ipc_client_log(client, "Turning the modem on failed");
- goto error;
- }
- ipc_client_log(client, "Turned the modem on");
-
- p = (unsigned char *) modem_image_data + PIRANHA_PSI_OFFSET;
-
- rc = xmm6260_mipi_psi_send(client, modem_boot_fd, (void *) p, PIRANHA_PSI_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI PSI failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI PSI");
-
- close(modem_boot_fd);
-
- modem_boot_fd = open(XMM6260_SEC_MODEM_BOOT1_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (modem_boot_fd < 0) {
- ipc_client_log(client, "Opening modem boot device failed");
- goto error;
- }
- ipc_client_log(client, "Opened modem boot device");
-
- p = (unsigned char *) modem_image_data + PIRANHA_EBL_OFFSET;
-
- rc = xmm6260_mipi_ebl_send(client, modem_boot_fd, (void *) p, PIRANHA_EBL_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI EBL failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI EBL");
-
- rc = xmm6260_mipi_port_config_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI port config failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI port config");
-
- p = (unsigned char *) modem_image_data + PIRANHA_SEC_START_OFFSET;
-
- rc = xmm6260_mipi_sec_start_send(client, modem_boot_fd, (void *) p, PIRANHA_SEC_START_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI SEC start failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI SEC start");
-
- p = (unsigned char *) modem_image_data + PIRANHA_FIRMWARE_OFFSET;
-
- rc = xmm6260_mipi_firmware_send(client, modem_boot_fd, (void *) p, PIRANHA_FIRMWARE_SIZE);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI firmware failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI firmware");
-
- rc = xmm6260_mipi_nv_data_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI nv_data");
-
- rc = xmm6260_mipi_sec_end_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI SEC end failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI SEC end");
-
- rc = xmm6260_mipi_hw_reset_send(client, modem_boot_fd);
- if (rc < 0) {
- ipc_client_log(client, "Sending XMM6260 MIPI HW reset failed");
- goto error;
- }
- ipc_client_log(client, "Sent XMM6260 MIPI HW reset");
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (modem_image_data != NULL)
- munmap(modem_image_data, PIRANHA_MODEM_IMAGE_SIZE);
-
- if (modem_image_fd >= 0)
- close(modem_image_fd);
-
- if (modem_boot_fd >= 0)
- close(modem_boot_fd);
-
- return rc;
-}
-
-int piranha_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int piranha_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int piranha_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int piranha_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int piranha_ipc_open(void *data, int type)
-{
- struct piranha_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct piranha_ipc_transport_data *) data;
-
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
- if (transport_data->fd < 0)
- return -1;
-
- return 0;
-}
-
-int piranha_ipc_close(void *data)
-{
- struct piranha_ipc_transport_data *transport_data;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct piranha_ipc_transport_data *) data;
-
- xmm6260_sec_modem_ipc_close(transport_data->fd);
- transport_data->fd = -1;
-
- return 0;
-}
-
-int piranha_ipc_read(void *data, void *buffer, unsigned int length)
-{
- struct piranha_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct piranha_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
- return rc;
-}
-
-int piranha_ipc_write(void *data, void *buffer, unsigned int length)
-{
- struct piranha_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct piranha_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
- return rc;
-}
-
-int piranha_ipc_poll(void *data, struct timeval *timeout)
-{
- struct piranha_ipc_transport_data *transport_data;
- int rc;
-
- if (data == NULL)
- return -1;
-
- transport_data = (struct piranha_ipc_transport_data *) data;
-
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
- return rc;
-}
-
-int piranha_ipc_power_on(void *data)
-{
- return 0;
-}
-
-int piranha_ipc_power_off(void *data)
-{
- int fd;
- int rc;
-
- fd = open(XMM6260_SEC_MODEM_BOOT0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (fd < 0)
- return -1;
-
- rc = xmm6260_sec_modem_power(fd, 0);
-
- close(fd);
-
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int piranha_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- *transport_data = (void *) malloc(sizeof(struct piranha_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct piranha_ipc_transport_data));
-
- return 0;
-}
-
-int piranha_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
-{
- if (transport_data == NULL)
- return -1;
-
- free(transport_data);
-
- return 0;
-}
-
-char *piranha_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int piranha_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops piranha_ipc_fmt_ops = {
- .bootstrap = piranha_ipc_bootstrap,
- .send = piranha_ipc_fmt_send,
- .recv = piranha_ipc_fmt_recv,
-};
-
-struct ipc_ops piranha_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = piranha_ipc_rfs_send,
- .recv = piranha_ipc_rfs_recv,
-};
-
-struct ipc_handlers piranha_ipc_handlers = {
- .read = piranha_ipc_read,
- .write = piranha_ipc_write,
- .open = piranha_ipc_open,
- .close = piranha_ipc_close,
- .poll = piranha_ipc_poll,
- .transport_data = NULL,
- .power_on = piranha_ipc_power_on,
- .power_off = piranha_ipc_power_off,
- .power_data = NULL,
- .gprs_activate = NULL,
- .gprs_deactivate = NULL,
- .gprs_data = NULL,
- .data_create = piranha_ipc_data_create,
- .data_destroy = piranha_ipc_data_destroy,
-};
-
-struct ipc_gprs_specs piranha_ipc_gprs_specs = {
- .gprs_get_iface = piranha_ipc_gprs_get_iface,
- .gprs_get_capabilities = piranha_ipc_gprs_get_capabilities,
-};
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/piranha/piranha_ipc.h b/samsung-ipc/device/piranha/piranha_ipc.h
deleted file mode 100644
index 5c857fc..0000000
--- a/samsung-ipc/device/piranha/piranha_ipc.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __PIRANHA_IPC_H__
-#define __PIRANHA_IPC_H__
-
-#define PIRANHA_MODEM_IMAGE_SIZE 0x1400000
-#define PIRANHA_PSI_OFFSET 0x1000
-#define PIRANHA_PSI_SIZE 0xE000
-#define PIRANHA_EBL_OFFSET 0xF000
-#define PIRANHA_EBL_SIZE 0x19000
-#define PIRANHA_SEC_START_OFFSET 0x9FF800
-#define PIRANHA_SEC_START_SIZE 0x800
-#define PIRANHA_FIRMWARE_OFFSET 0x28000
-#define PIRANHA_FIRMWARE_SIZE 0x9D7800
-#define PIRANHA_NV_DATA_OFFSET 0xA00000
-#define PIRANHA_NV_DATA_SIZE 0x200000
-
-#define PIRANHA_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p8"
-
-struct piranha_ipc_transport_data {
- int fd;
-};
-
-extern struct ipc_ops piranha_ipc_fmt_ops;
-extern struct ipc_ops piranha_ipc_rfs_ops;
-extern struct ipc_handlers piranha_ipc_handlers;
-extern struct ipc_gprs_specs piranha_ipc_gprs_specs;
-extern struct ipc_nv_data_specs piranha_ipc_nv_data_specs;
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6160/xmm6160.c b/samsung-ipc/device/xmm6160/xmm6160.c
deleted file mode 100644
index 8374541..0000000
--- a/samsung-ipc/device/xmm6160/xmm6160.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <string.h>
-#include <termios.h>
-#include <sys/select.h>
-
-#include <samsung-ipc.h>
-#include <util.h>
-
-#include "xmm6160.h"
-
-int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
- void *psi_data, unsigned short psi_size)
-{
- char at[] = XMM6160_AT;
- unsigned char version;
- unsigned char info;
- unsigned char psi_magic;
- unsigned char psi_crc;
- unsigned char psi_ack;
-
- struct termios termios;
- struct timeval timeout;
- fd_set fds;
-
- unsigned char *p;
- int length;
- int rc;
- int i;
-
- if (client == NULL || serial_fd < 0 || psi_data == NULL || psi_size <= 0)
- return -1;
-
- tcgetattr(serial_fd, &termios);
-
- cfmakeraw(&termios);
- cfsetispeed(&termios, B115200);
- cfsetospeed(&termios, B115200);
-
- tcsetattr(serial_fd, TCSANOW, &termios);
-
- length = strlen(at);
- for (i = 0; i < XMM6160_AT_COUNT; i++) {
- rc = write(serial_fd, at, length);
- if (rc < length) {
- ipc_client_log(client, "Writing AT in ASCII failed");
- goto error;
- }
-
- usleep(50000);
- }
- ipc_client_log(client, "Wrote AT in ASCII");
-
- usleep(50000);
-
- version = 0;
-
- rc = read(serial_fd, &version, sizeof(version));
- if (rc < (int) sizeof(version)) {
- ipc_client_log(client, "Reading bootcore version failed");
- goto error;
- }
-
- if (version != XMM6160_BOOTCORE_VERSION) {
- ipc_client_log(client, "Read wrong bootcore version (0x%x)", version);
- goto error;
- }
-
- ipc_client_log(client, "Read bootcore version (0x%x)", version);
-
- rc = read(serial_fd, &info, sizeof(info));
- if (rc < (int) sizeof(info)) {
- ipc_client_log(client, "Reading info size failed");
- goto error;
- }
- ipc_client_log(client, "Read info size (0x%x)", info);
-
- psi_magic = XMM6160_PSI_MAGIC;
-
- rc = write(serial_fd, &psi_magic, sizeof(psi_magic));
- if (rc < (int) sizeof(psi_magic)) {
- ipc_client_log(client, "Writing PSI magic failed");
- goto error;
- }
- ipc_client_log(client, "Wrote PSI magic (0x%x)", psi_magic);
-
- rc = write(serial_fd, &psi_size, sizeof(psi_size));
- if (rc < (int) sizeof(psi_size)) {
- ipc_client_log(client, "Writing PSI size failed");
- goto error;
- }
- ipc_client_log(client, "Wrote PSI size (0x%x)", psi_size);
-
- FD_ZERO(&fds);
- FD_SET(serial_fd, &fds);
-
- timeout.tv_sec = 4;
- timeout.tv_usec = 0;
-
- p = (unsigned char *) psi_data;
- psi_crc = 0;
-
- for (i = 0; i < psi_size; i++) {
- rc = select(serial_fd + 1, NULL, &fds, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Writing PSI failed");
- goto error;
- }
-
- rc = write(serial_fd, p, 1);
- if (rc < 1) {
- ipc_client_log(client, "Writing PSI failed");
- goto error;
- }
-
- psi_crc ^= *p++;
- }
- ipc_client_log(client, "Wrote PSI, CRC is 0x%x", psi_crc);
-
- rc = select(serial_fd + 1, NULL, &fds, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Writing PSI crc failed");
- goto error;
- }
-
- rc = write(serial_fd, &psi_crc, sizeof(psi_crc));
- if (rc < (int) sizeof(psi_crc)) {
- ipc_client_log(client, "Writing PSI crc failed");
- goto error;
- }
- ipc_client_log(client, "Wrote PSI CRC (0x%x)", psi_crc);
-
- timeout.tv_sec = 4;
- timeout.tv_usec = 0;
-
- i = 0;
- do {
- rc = select(serial_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Reading PSI ACK failed");
- goto error;
- }
-
- rc = read(serial_fd, &psi_ack, sizeof(psi_ack));
- if (rc < (int) sizeof(psi_ack)) {
- ipc_client_log(client, "Reading PSI ACK failed");
- goto error;
- }
-
- if (i++ > 50) {
- ipc_client_log(client, "Reading PSI ACK failed");
- goto error;
- }
- } while (psi_ack != XMM6160_PSI_ACK);
- ipc_client_log(client, "Read PSI ACK (0x%x)", psi_ack);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6160_firmware_send(struct ipc_client *client, int device_fd,
- void *device_address, void *firmware_data, int firmware_size)
-{
- int wc;
-
- unsigned char *p;
- int rc;
- int i;
-
- if (client == NULL || (device_fd < 0 && device_address == NULL) || firmware_data == NULL || firmware_size <= 0)
- return -1;
-
- p = (unsigned char *) firmware_data;
-
- if (device_address != NULL) {
- memcpy(device_address, (void *) p, firmware_size);
- } else {
- wc = 0;
- while (wc < firmware_size) {
- rc = write(device_fd, (void *) p, firmware_size - wc);
- if (rc < 0) {
- ipc_client_log(client, "Writing firmware failed");
- goto error;
- }
-
- p += rc;
- wc += rc;
- }
- }
- ipc_client_log(client, "Wrote firmware");
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6160_nv_data_send(struct ipc_client *client, int device_fd,
- void *device_address)
-{
- void *nv_data = NULL;
- int nv_size;
- int wc;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL || (device_fd < 0 && device_address == NULL))
- return -1;
-
- rc = nv_data_check(client);
- if (rc < 0) {
- ipc_client_log(client, "Checking nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Checked nv_data");
-
- rc = nv_data_md5_check(client);
- if (rc < 0) {
- ipc_client_log(client, "Checking nv_data md5 failed");
- goto error;
- }
- ipc_client_log(client, "Checked nv_data md5");
-
- nv_data = file_data_read(nv_data_path(client), nv_data_size(client), nv_data_chunk_size(client));
- if (nv_data == NULL) {
- ipc_client_log(client, "Reading nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Read nv_data");
-
- p = (unsigned char *) nv_data;
- nv_size = nv_data_size(client);
-
- if (device_address != NULL) {
- memcpy(device_address, p, nv_size);
- } else {
- wc = 0;
- while (wc < nv_size) {
- rc = write(device_fd, p, nv_size - wc);
- if (rc < 0) {
- ipc_client_log(client, "Writing modem image failed");
- goto error;
- }
-
- p += rc;
- wc += rc;
- }
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (nv_data != NULL)
- free(nv_data);
-
- return rc;
-}
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6160/xmm6160.h b/samsung-ipc/device/xmm6160/xmm6160.h
deleted file mode 100644
index 2d2bdf9..0000000
--- a/samsung-ipc/device/xmm6160/xmm6160.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <samsung-ipc.h>
-
-#ifndef __XMM6160_H__
-#define __XMM6160_H__
-
-#define XMM6160_AT "AT"
-#define XMM6160_AT_COUNT 20
-#define XMM6160_PSI_MAGIC 0x30
-#define XMM6160_PSI_ACK 0x01
-#define XMM6160_BOOTCORE_VERSION 0xF0
-
-int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
- void *psi_data, unsigned short psi_size);
-int xmm6160_firmware_send(struct ipc_client *client, int device_fd,
- void *device_address, void *firmware_data, int firmware_size);
-int xmm6160_nv_data_send(struct ipc_client *client, int device_fd,
- void *device_address);
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/modem.h b/samsung-ipc/device/xmm6260/modem.h
deleted file mode 100644
index 5a456f5..0000000
--- a/samsung-ipc/device/xmm6260/modem.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2010 Google, Inc.
- * Copyright (C) 2010 Samsung Electronics.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MODEM_IF_H__
-#define __MODEM_IF_H__
-
-enum modem_t {
- IMC_XMM6260,
- IMC_XMM6262,
- VIA_CBP71,
- VIA_CBP72,
- SEC_CMC221,
- QC_MDM6600,
- DUMMY,
-};
-
-enum dev_format {
- IPC_FMT,
- IPC_RAW,
- IPC_RFS,
- IPC_CMD,
- IPC_BOOT,
- IPC_MULTI_RAW,
- IPC_RAMDUMP,
- MAX_DEV_FORMAT,
-};
-#define MAX_IPC_DEV (IPC_RFS + 1)
-
-enum modem_io {
- IODEV_MISC,
- IODEV_NET,
- IODEV_DUMMY,
-};
-
-enum modem_link {
- LINKDEV_UNDEFINED,
- LINKDEV_MIPI,
- LINKDEV_DPRAM,
- LINKDEV_SPI,
- LINKDEV_USB,
- LINKDEV_HSIC,
- LINKDEV_C2C,
- LINKDEV_MAX,
-};
-#define LINKTYPE(modem_link) (1u << (modem_link))
-
-enum modem_network {
- UMTS_NETWORK,
- CDMA_NETWORK,
- LTE_NETWORK,
-};
-
-enum sipc_ver {
- NO_SIPC_VER = 0,
- SIPC_VER_40 = 40,
- SIPC_VER_41 = 41,
- SIPC_VER_42 = 42,
- SIPC_VER_50 = 50,
- MAX_SIPC_VER,
-};
-
-#endif
diff --git a/samsung-ipc/device/xmm6260/modem_link_device_hsic.h b/samsung-ipc/device/xmm6260/modem_link_device_hsic.h
deleted file mode 100755
index 99e15cf..0000000
--- a/samsung-ipc/device/xmm6260/modem_link_device_hsic.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2010 Google, Inc.
- * Copyright (C) 2010 Samsung Electronics.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MODEM_LINK_DEVICE_USB_H__
-#define __MODEM_LINK_DEVICE_USB_H__
-
-
-enum {
- IF_USB_BOOT_EP = 0,
- IF_USB_FMT_EP = 0,
- IF_USB_RAW_EP,
- IF_USB_RFS_EP,
- IF_USB_CMD_EP,
- IF_USB_DEVNUM_MAX,
-};
-
-/* each pipe has 2 ep for in/out */
-#define LINKPM_DEV_NUM (IF_USB_DEVNUM_MAX * 2)
-/******************/
-/* xmm6260 specific */
-
-#define IOCTL_LINK_CONTROL_ENABLE _IO('o', 0x30)
-#define IOCTL_LINK_CONTROL_ACTIVE _IO('o', 0x31)
-#define IOCTL_LINK_GET_HOSTWAKE _IO('o', 0x32)
-#define IOCTL_LINK_CONNECTED _IO('o', 0x33)
-#define IOCTL_LINK_SET_BIAS_CLEAR _IO('o', 0x34)
-
-/* VID,PID for IMC - XMM6260, XMM6262*/
-#define IMC_BOOT_VID 0x058b
-#define IMC_BOOT_PID 0x0041
-#define IMC_MAIN_VID 0x1519
-#define IMC_MAIN_PID 0x0020
-/* VID,PID for STE - M7400 */
-#define STE_BOOT_VID 0x04cc
-#define STE_BOOT_PID 0x7400
-#define STE_MAIN_VID 0x04cc
-#define STE_MAIN_PID 0x2333
-
-enum {
- BOOT_DOWN = 0,
- IPC_CHANNEL
-};
-
-enum ch_state {
- STATE_SUSPENDED,
- STATE_RESUMED,
-};
-
-#define HOSTWAKE_TRIGLEVEL 0
-
-#endif
diff --git a/samsung-ipc/device/xmm6260/modem_prj.h b/samsung-ipc/device/xmm6260/modem_prj.h
deleted file mode 100644
index 99f6087..0000000
--- a/samsung-ipc/device/xmm6260/modem_prj.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2010 Google, Inc.
- * Copyright (C) 2010 Samsung Electronics.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <linux/types.h>
-
-#define u8 uint8_t
-#define u16 uint16_t
-#define u32 uint32_t
-#define u64 uint64_t
-
-#ifndef __MODEM_PRJ_H__
-#define __MODEM_PRJ_H__
-
-#define MAX_CPINFO_SIZE 512
-
-#define MAX_LINK_DEVTYPE 3
-
-#define MAX_FMT_DEVS 10
-#define MAX_RAW_DEVS 32
-#define MAX_RFS_DEVS 10
-#define MAX_NUM_IO_DEV (MAX_FMT_DEVS + MAX_RAW_DEVS + MAX_RFS_DEVS)
-
-#define IOCTL_MODEM_ON _IO('o', 0x19)
-#define IOCTL_MODEM_OFF _IO('o', 0x20)
-#define IOCTL_MODEM_RESET _IO('o', 0x21)
-#define IOCTL_MODEM_BOOT_ON _IO('o', 0x22)
-#define IOCTL_MODEM_BOOT_OFF _IO('o', 0x23)
-#define IOCTL_MODEM_START _IO('o', 0x24)
-
-#define IOCTL_MODEM_PROTOCOL_SUSPEND _IO('o', 0x25)
-#define IOCTL_MODEM_PROTOCOL_RESUME _IO('o', 0x26)
-
-#define IOCTL_MODEM_STATUS _IO('o', 0x27)
-#define IOCTL_MODEM_DL_START _IO('o', 0x28)
-#define IOCTL_MODEM_FW_UPDATE _IO('o', 0x29)
-
-#define IOCTL_MODEM_NET_SUSPEND _IO('o', 0x30)
-#define IOCTL_MODEM_NET_RESUME _IO('o', 0x31)
-
-#define IOCTL_MODEM_DUMP_START _IO('o', 0x32)
-#define IOCTL_MODEM_DUMP_UPDATE _IO('o', 0x33)
-#define IOCTL_MODEM_FORCE_CRASH_EXIT _IO('o', 0x34)
-#define IOCTL_MODEM_CP_UPLOAD _IO('o', 0x35)
-#define IOCTL_MODEM_DUMP_RESET _IO('o', 0x36)
-
-#define IOCTL_DPRAM_SEND_BOOT _IO('o', 0x40)
-#define IOCTL_DPRAM_INIT_STATUS _IO('o', 0x43)
-
-/* ioctl command definitions. */
-#define IOCTL_DPRAM_PHONE_POWON _IO('o', 0xd0)
-#define IOCTL_DPRAM_PHONEIMG_LOAD _IO('o', 0xd1)
-#define IOCTL_DPRAM_NVDATA_LOAD _IO('o', 0xd2)
-#define IOCTL_DPRAM_PHONE_BOOTSTART _IO('o', 0xd3)
-
-#define IOCTL_DPRAM_PHONE_UPLOAD_STEP1 _IO('o', 0xde)
-#define IOCTL_DPRAM_PHONE_UPLOAD_STEP2 _IO('o', 0xdf)
-
-/* modem status */
-#define MODEM_OFF 0
-#define MODEM_CRASHED 1
-#define MODEM_RAMDUMP 2
-#define MODEM_POWER_ON 3
-#define MODEM_BOOTING_NORMAL 4
-#define MODEM_BOOTING_RAMDUMP 5
-#define MODEM_DUMPING 6
-#define MODEM_RUNNING 7
-
-#define HDLC_HEADER_MAX_SIZE 6 /* fmt 3, raw 6, rfs 6 */
-
-#define PSD_DATA_CHID_BEGIN 0x2A
-#define PSD_DATA_CHID_END 0x38
-
-#define PS_DATA_CH_0 10
-#define PS_DATA_CH_LAST 24
-
-#define IP6VERSION 6
-
-#define SOURCE_MAC_ADDR {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC}
-
-/* Debugging features */
-#define MAX_MIF_LOG_PATH_LEN 128
-#define MAX_MIF_LOG_FILE_SIZE 0x800000 /* 8 MB */
-
-#define MAX_MIF_EVT_BUFF_SIZE 256
-#define MAX_MIF_TIME_LEN 32
-#define MAX_MIF_NAME_LEN 16
-#define MAX_MIF_STR_LEN 127
-#define MAX_MIF_LOG_LEN 128
-
-enum mif_event_id {
- MIF_IRQ_EVT = 0,
- MIF_LNK_RX_EVT,
- MIF_MUX_RX_EVT,
- MIF_IOD_RX_EVT,
- MIF_IOD_TX_EVT,
- MIF_MUX_TX_EVT,
- MIF_LNK_TX_EVT,
- MAX_MIF_EVT
-};
-
-struct dpram_queue_status {
- unsigned in;
- unsigned out;
-};
-
-struct dpram_queue_status_pair {
- struct dpram_queue_status txq;
- struct dpram_queue_status rxq;
-};
-
-struct dpram_irq_buff {
- unsigned magic;
- unsigned access;
- struct dpram_queue_status_pair qsp[MAX_IPC_DEV];
- unsigned int2ap;
- unsigned int2cp;
-};
-
-struct mif_event_buff {
- char time[MAX_MIF_TIME_LEN];
-
- struct timeval tv;
- enum mif_event_id evt;
-
- char mc[MAX_MIF_NAME_LEN];
-
- char iod[MAX_MIF_NAME_LEN];
-
- char ld[MAX_MIF_NAME_LEN];
- enum modem_link link_type;
-
- unsigned rcvd;
- unsigned len;
- union {
- u8 data[MAX_MIF_LOG_LEN];
- struct dpram_irq_buff dpram_irqb;
- };
-};
-
-#define MIF_LOG_DIR "/sdcard"
-#define MIF_LOG_LV_FILE "/data/.mif_log_level"
-
-/* Does modem ctl structure will use state ? or status defined below ?*/
-enum modem_state {
- STATE_OFFLINE,
- STATE_CRASH_RESET, /* silent reset */
- STATE_CRASH_EXIT, /* cp ramdump */
- STATE_BOOTING,
- STATE_ONLINE,
- STATE_NV_REBUILDING, /* <= rebuilding start */
- STATE_LOADER_DONE,
- STATE_SIM_ATTACH,
- STATE_SIM_DETACH,
-};
-
-enum com_state {
- COM_NONE,
- COM_ONLINE,
- COM_HANDSHAKE,
- COM_BOOT,
- COM_CRASH,
-};
-
-enum link_mode {
- LINK_MODE_INVALID = 0,
- LINK_MODE_IPC,
- LINK_MODE_BOOT,
- LINK_MODE_DLOAD,
- LINK_MODE_ULOAD,
-};
-
-struct sim_state {
- bool online; /* SIM is online? */
- bool changed; /* online is changed? */
-};
-
-#define HDLC_START 0x7F
-#define HDLC_END 0x7E
-#define SIZE_OF_HDLC_START 1
-#define SIZE_OF_HDLC_END 1
-#define MAX_LINK_PADDING_SIZE 3
-
-struct header_data {
- char hdr[HDLC_HEADER_MAX_SIZE];
- unsigned len;
- unsigned frag_len;
- char start; /*hdlc start header 0x7F*/
-};
-
-struct fmt_hdr {
- u16 len;
- u8 control;
-} __attribute__((packed));
-
-struct raw_hdr {
- u32 len;
- u8 channel;
- u8 control;
-} __attribute__((packed));
-
-struct rfs_hdr {
- u32 len;
- u8 cmd;
- u8 id;
-} __attribute__((packed));
-
-struct sipc_fmt_hdr {
- u16 len;
- u8 msg_seq;
- u8 ack_seq;
- u8 main_cmd;
- u8 sub_cmd;
- u8 cmd_type;
-} __attribute__((packed));
-
-#endif
diff --git a/samsung-ipc/device/xmm6260/xmm6260.c b/samsung-ipc/device/xmm6260/xmm6260.c
deleted file mode 100644
index 416f6c2..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <sys/ioctl.h>
-
-#include "xmm6260.h"
-
-unsigned char xmm6260_crc_calculate(void *buffer, int length)
-{
- unsigned char crc;
- unsigned char *p;
-
- if (buffer == NULL || length <= 0)
- return 0;
-
- p = (unsigned char *) buffer;
-
- crc = 0;
- while (length--)
- crc ^= *p++;
-
- return crc;
-}
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/xmm6260.h b/samsung-ipc/device/xmm6260/xmm6260.h
deleted file mode 100644
index 64f7938..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __XMM6260_H__
-#define __XMM6260_H__
-
-#define XMM6260_AT "ATAT"
-#define XMM6260_PSI_PADDING 0xFF
-#define XMM6260_PSI_MAGIC 0x30
-#define XMM6260_SEC_END_MAGIC 0x0000
-#define XMM6260_HW_RESET_MAGIC 0x111001
-#define XMM6260_DATA_SIZE 0x1000
-
-#define XMM6260_COMMAND_SET_PORT_CONFIG 0x86
-#define XMM6260_COMMAND_SEC_START 0x204
-#define XMM6260_COMMAND_SEC_END 0x205
-#define XMM6260_COMMAND_HW_RESET 0x208
-#define XMM6260_COMMAND_FLASH_SET_ADDRESS 0x802
-#define XMM6260_COMMAND_FLASH_WRITE_BLOCK 0x804
-
-#define XMM6260_FIRMWARE_ADDRESS 0x60300000
-#define XMM6260_NV_DATA_ADDRESS 0x60E80000
-#define XMM6260_MPS_DATA_ADDRESS 0x61080000
-
-unsigned char xmm6260_crc_calculate(void *buffer, int length);
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/xmm6260_hsic.c b/samsung-ipc/device/xmm6260/xmm6260_hsic.c
deleted file mode 100644
index e4162ae..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260_hsic.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * Based on the incomplete C++ implementation which is:
- * Copyright (C) 2012 Sergey Gridasov <grindars@gmail.com>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/select.h>
-
-#include <samsung-ipc.h>
-#include <util.h>
-
-#include "xmm6260.h"
-#include "xmm6260_hsic.h"
-
-int xmm6260_hsic_ack_read(int device_fd, unsigned short ack)
-{
- struct timeval timeout;
- fd_set fds;
-
- unsigned short value;
- int rc;
- int i;
-
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
-
- FD_ZERO(&fds);
- FD_SET(device_fd, &fds);
-
- for (i = 0; i < 50; i++) {
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- return -1;
-
- value = 0;
- rc = read(device_fd, &value, sizeof(value));
- if (rc < (int) sizeof(value))
- continue;
-
- if (value == ack)
- return 0;
- }
-
- return -1;
-}
-
-int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size)
-{
- struct xmm6260_hsic_psi_header psi_header;
- char at[] = XMM6260_AT;
- unsigned char psi_ack;
- unsigned char chip_id;
- unsigned char psi_crc;
-
- struct timeval timeout;
- fd_set fds;
- int wc;
-
- unsigned char *p;
- int length;
- int rc;
- int i;
-
- if (client == NULL || device_fd < 0 || psi_data == NULL || psi_size == 0)
- return -1;
-
- FD_ZERO(&fds);
-
- i = 0;
- length = strlen(at);
-
- do {
- FD_SET(device_fd, &fds);
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
-
- rc = write(device_fd, at, length);
- if (rc < length) {
- ipc_client_log(client, "Writing ATAT in ASCII failed");
- goto error;
- }
- ipc_client_log(client, "Wrote ATAT in ASCII");
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for bootup failed");
- goto error;
- }
-
- if (i++ > 50) {
- ipc_client_log(client, "Waiting for bootup failed");
- goto error;
- }
- } while(rc == 0);
-
- FD_SET(device_fd, &fds);
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Reading chip id failed");
- goto error;
- }
-
- psi_ack = 0;
- rc = read(device_fd, &psi_ack, sizeof(psi_ack));
- if (rc < 0 || psi_ack != XMM6260_HSIC_BOOT0_ACK) {
- ipc_client_log(client, "Reading boot ACK failed");
- goto error;
- }
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Reading chip id failed");
- goto error;
- }
-
- chip_id = 0;
- rc = read(device_fd, &chip_id, sizeof(chip_id));
- if (rc < 0) {
- ipc_client_log(client, "Reading chip id failed");
- goto error;
- }
- ipc_client_log(client, "Read chip id (0x%x)", chip_id);
-
- psi_header.magic = XMM6260_PSI_MAGIC;
- psi_header.length = psi_size;
- psi_header.padding = XMM6260_PSI_PADDING;
-
- rc = write(device_fd, &psi_header, sizeof(psi_header));
- if (rc < (int) sizeof(psi_header)) {
- ipc_client_log(client, "Writing PSI header failed");
- goto error;
- }
- ipc_client_log(client, "Wrote PSI header");
-
- p = (unsigned char *) psi_data;
-
- wc = 0;
- while (wc < psi_size) {
- rc = write(device_fd, (void *) p, psi_size - wc);
- if (rc < 0) {
- ipc_client_log(client, "Writing PSI failed");
- goto error;
- }
-
- p += rc;
- wc += rc;
- }
-
- psi_crc = xmm6260_crc_calculate(psi_data, psi_size);
-
- ipc_client_log(client, "Wrote PSI, CRC is 0x%x", psi_crc);
-
- rc = write(device_fd, &psi_crc, sizeof(psi_crc));
- if (rc < (int) sizeof(psi_crc)) {
- ipc_client_log(client, "Writing PSI CRC failed");
- goto error;
- }
- ipc_client_log(client, "Wrote PSI CRC (0x%x)", psi_crc);
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
-
- for (i = 0; i < XMM6260_HSIC_PSI_UNKNOWN_COUNT; i++) {
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Reading PSI unknown failed");
- goto error;
- }
-
- rc = read(device_fd, &psi_ack, sizeof(psi_ack));
- if (rc < (int) sizeof(psi_ack)) {
- ipc_client_log(client, "Reading PSI unknown failed");
- goto error;
- }
- }
-
- for (i = 0; i < XMM6260_HSIC_PSI_CRC_ACK_COUNT ; i++) {
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0) {
- ipc_client_log(client, "Reading PSI CRC ACK failed");
- goto error;
- }
-
- rc = read(device_fd, &psi_ack, sizeof(psi_ack));
- if (rc < (int) sizeof(psi_ack) || psi_ack != XMM6260_HSIC_PSI_CRC_ACK) {
- ipc_client_log(client, "Reading PSI CRC ACK failed");
- goto error;
- }
- }
- ipc_client_log(client, "Read PSI CRC ACK");
-
- rc = xmm6260_hsic_ack_read(device_fd, XMM6260_HSIC_PSI_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading PSI ACK failed");
- goto error;
- }
- ipc_client_log(client, "Read PSI ACK");
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6260_hsic_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size)
-{
- unsigned char ebl_crc;
-
- int chunk;
- int count;
- int wc;
-
- unsigned char *p;
- int length;
- int rc;
-
- if (client == NULL || device_fd < 0 || ebl_data == NULL || ebl_size <= 0)
- return -1;
-
- length = sizeof(ebl_size);
-
- rc = write(device_fd, &ebl_size, length);
- if (rc < length) {
- ipc_client_log(client, "Writing EBL size failed");
- goto error;
- }
- ipc_client_log(client, "Wrote EBL size");
-
- rc = xmm6260_hsic_ack_read(device_fd, XMM6260_HSIC_EBL_SIZE_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading EBL size ACK failed");
- goto error;
- }
-
- p = (unsigned char *) ebl_data;
-
- chunk = XMM6260_HSIC_EBL_CHUNK;
- wc = 0;
- while (wc < ebl_size) {
- count = chunk < ebl_size - wc ? chunk : ebl_size - wc;
-
- rc = write(device_fd, (void *) p, count);
- if (rc < 0) {
- ipc_client_log(client, "Writing EBL failed");
- goto error;
- }
-
- p += rc;
- wc += rc;
- }
-
- ebl_crc = xmm6260_crc_calculate(ebl_data, ebl_size);
-
- ipc_client_log(client, "Wrote EBL, CRC is 0x%x", ebl_crc);
-
- rc = write(device_fd, &ebl_crc, sizeof(ebl_crc));
- if (rc < (int) sizeof(ebl_crc)) {
- ipc_client_log(client, "Writing EBL CRC failed");
- goto error;
- }
- ipc_client_log(client, "Wrote EBL CRC (0x%x)", ebl_crc);
-
- rc = xmm6260_hsic_ack_read(device_fd, XMM6260_HSIC_EBL_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading EBL ACK failed");
- goto error;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6260_hsic_command_send(int device_fd, unsigned short code,
- void *data, int size, int command_data_size, int ack)
-{
- struct xmm6260_hsic_command_header header;
- void *buffer = NULL;
- int length;
-
- struct timeval timeout;
- fd_set fds;
-
- unsigned char *p;
- int rc;
- int i;
-
- if (device_fd < 0 || data == NULL || size <= 0 || command_data_size < size)
- return -1;
-
- header.checksum = (size & 0xffff) + code;
- header.code = code;
- header.data_size = size;
-
- p = (unsigned char *) data;
-
- for (i = 0; i < size; i++)
- header.checksum += *p++;
-
- length = command_data_size + sizeof(header);
- buffer = malloc(length);
-
- memset(buffer, 0, length);
- p = (unsigned char *) buffer;
- memcpy(p, &header, sizeof(header));
- p += sizeof(header);
- memcpy(p, data, size);
-
- rc = write(device_fd, buffer, length);
- if (rc < length)
- goto error;
-
- if (!ack) {
- rc = 0;
- goto complete;
- }
-
- memset(buffer, 0, length);
-
- FD_ZERO(&fds);
- FD_SET(device_fd, &fds);
-
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- rc = read(device_fd, &header, sizeof(header));
- if (rc < (int) sizeof(header))
- goto error;
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- rc = read(device_fd, buffer, command_data_size);
- if (rc < command_data_size)
- goto error;
-
- if (header.code != code)
- goto error;
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_hsic_modem_data_send(int device_fd, void *data, int size, int address)
-{
- int chunk;
- int count;
- int c;
-
- unsigned char *p;
- int rc;
-
- if (device_fd < 0 || data == NULL || size <= 0)
- return -1;
-
- rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_FLASH_SET_ADDRESS, &address, sizeof(address), XMM6260_HSIC_FLASH_SET_ADDRESS_SIZE, 1);
- if (rc < 0)
- goto error;
-
- p = (unsigned char *) data;
-
- chunk = XMM6260_HSIC_MODEM_DATA_CHUNK;
- c = 0;
- while (c < size) {
- count = chunk < size - c ? chunk : size - c;
-
- rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_FLASH_WRITE_BLOCK, p, count, XMM6260_HSIC_FLASH_WRITE_BLOCK_SIZE, 0);
- if (rc < 0)
- goto error;
-
- p += count;
- c += count;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6260_hsic_port_config_send(struct ipc_client *client, int device_fd)
-{
- void *buffer = NULL;
- int length;
-
- struct timeval timeout;
- fd_set fds;
-
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- FD_ZERO(&fds);
- FD_SET(device_fd, &fds);
-
- timeout.tv_sec = 2;
- timeout.tv_usec = 0;
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- length = XMM6260_HSIC_PORT_CONFIG_SIZE;
- buffer = malloc(length);
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- rc = read(device_fd, buffer, length);
- if (rc < length) {
- ipc_client_log(client, "Reading port config failed");
- goto error;
- }
- ipc_client_log(client, "Read port config");
-
- rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_SET_PORT_CONFIG, buffer, length, XMM6260_HSIC_SET_PORT_CONFIG_SIZE, 1);
- if (rc < 0) {
- ipc_client_log(client, "Sending port config command failed");
- goto error;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_hsic_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size)
-{
- int rc;
-
- if (client == NULL || device_fd < 0 || sec_data == NULL || sec_size <= 0)
- return -1;
-
- rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_SEC_START, sec_data, sec_size, XMM6260_HSIC_SEC_START_SIZE, 1);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_hsic_sec_end_send(struct ipc_client *client, int device_fd)
-{
- unsigned short sec_data;
- int sec_size;
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- sec_data = XMM6260_SEC_END_MAGIC;
- sec_size = sizeof(sec_data);
-
- rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_SEC_END, &sec_data, sec_size, XMM6260_HSIC_SEC_END_SIZE, 1);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_hsic_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size)
-{
- int rc;
-
- if (client == NULL || device_fd < 0 || firmware_data == NULL || firmware_size <= 0)
- return -1;
-
- rc = xmm6260_hsic_modem_data_send(device_fd, firmware_data, firmware_size, XMM6260_FIRMWARE_ADDRESS);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_hsic_nv_data_send(struct ipc_client *client, int device_fd)
-{
- void *nv_data = NULL;
- int nv_size;
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- rc = nv_data_check(client);
- if (rc < 0) {
- ipc_client_log(client, "Checking nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Checked nv_data");
-
- rc = nv_data_md5_check(client);
- if (rc < 0) {
- ipc_client_log(client, "Checking nv_data md5 failed");
- goto error;
- }
- ipc_client_log(client, "Checked nv_data md5");
-
- nv_data = file_data_read(nv_data_path(client), nv_data_size(client), nv_data_chunk_size(client));
- if (nv_data == NULL) {
- ipc_client_log(client, "Reading nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Read nv_data");
-
- nv_size = nv_data_size(client);
-
- rc = xmm6260_hsic_modem_data_send(device_fd, nv_data, nv_size, XMM6260_NV_DATA_ADDRESS);
- if (rc < 0)
- goto error;
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (nv_data != NULL)
- free(nv_data);
-
- return rc;
-}
-
-int xmm6260_hsic_hw_reset_send(struct ipc_client *client, int device_fd)
-{
- unsigned int hw_reset_data;
- int hw_reset_size;
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- hw_reset_data = XMM6260_HW_RESET_MAGIC;
- hw_reset_size = sizeof(hw_reset_data);
-
- rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_HW_RESET, &hw_reset_data, hw_reset_size, XMM6260_HSIC_HW_RESET_SIZE, 0);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/xmm6260_hsic.h b/samsung-ipc/device/xmm6260/xmm6260_hsic.h
deleted file mode 100644
index 4e25bce..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260_hsic.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __XMM6260_HSIC_H__
-#define __XMM6260_HSIC_H__
-
-#define XMM6260_HSIC_BOOT0_ACK 0xF0
-#define XMM6260_HSIC_PSI_UNKNOWN_COUNT 22
-#define XMM6260_HSIC_PSI_CRC_ACK 0x01
-#define XMM6260_HSIC_PSI_CRC_ACK_COUNT 2
-#define XMM6260_HSIC_PSI_ACK 0xAA00
-#define XMM6260_HSIC_EBL_SIZE_ACK 0xCCCC
-#define XMM6260_HSIC_EBL_ACK 0xA551
-#define XMM6260_HSIC_EBL_CHUNK 0x4000
-#define XMM6260_HSIC_PORT_CONFIG_SIZE 0x4C
-#define XMM6260_HSIC_SET_PORT_CONFIG_SIZE 0x800
-#define XMM6260_HSIC_SEC_START_SIZE 0x4000
-#define XMM6260_HSIC_SEC_END_SIZE 0x4000
-#define XMM6260_HSIC_HW_RESET_SIZE 0x4000
-#define XMM6260_HSIC_FLASH_SET_ADDRESS_SIZE 0x4000
-#define XMM6260_HSIC_FLASH_WRITE_BLOCK_SIZE 0x4000
-#define XMM6260_HSIC_MODEM_DATA_CHUNK 0x4000
-
-struct xmm6260_hsic_psi_header {
- unsigned char magic;
- unsigned short length;
- unsigned char padding;
-} __attribute__((packed));
-
-struct xmm6260_hsic_command_header {
- unsigned short checksum;
- unsigned short code;
- unsigned int data_size;
-} __attribute__((packed));
-
-int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size);
-int xmm6260_hsic_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size);
-
-int xmm6260_hsic_port_config_send(struct ipc_client *client, int device_fd);
-int xmm6260_hsic_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size);
-int xmm6260_hsic_sec_end_send(struct ipc_client *client, int device_fd);
-int xmm6260_hsic_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size);
-int xmm6260_hsic_nv_data_send(struct ipc_client *client, int device_fd);
-int xmm6260_hsic_hw_reset_send(struct ipc_client *client, int device_fd);
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/xmm6260_mipi.c b/samsung-ipc/device/xmm6260/xmm6260_mipi.c
deleted file mode 100644
index df31755..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260_mipi.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * Based on the incomplete C++ implementation which is:
- * Copyright (C) 2012 Sergey Gridasov <grindars@gmail.com>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/select.h>
-
-#include <samsung-ipc.h>
-#include <util.h>
-
-#include "xmm6260.h"
-#include "xmm6260_mipi.h"
-
-int xmm6260_mipi_crc_calculate(void *buffer, int length)
-{
- unsigned char crc;
- int mipi_crc;
-
- crc = xmm6260_crc_calculate(buffer, length);
- mipi_crc = (crc << 24) | 0xffffff;
-
- return mipi_crc;
-}
-
-int xmm6260_mipi_ack_read(int device_fd, unsigned short ack)
-{
- struct timeval timeout;
- fd_set fds;
-
- unsigned int value;
- int rc;
- int i;
-
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
-
- FD_ZERO(&fds);
- FD_SET(device_fd, &fds);
-
- for (i = 0; i < 50; i++) {
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- return -1;
-
- value = 0;
- rc = read(device_fd, &value, sizeof(value));
- if (rc < (int) sizeof(value))
- continue;
-
- if ((value & 0xffff) == ack)
- return 0;
- }
-
- return -1;
-}
-
-int xmm6260_mipi_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size)
-{
- struct xmm6260_mipi_psi_header psi_header;
- char at[] = XMM6260_AT;
- int psi_crc;
-
- struct timeval timeout;
- fd_set fds;
- int wc;
-
- unsigned char *p;
- int length;
- int rc;
- int i;
-
- if (client == NULL || device_fd < 0 || psi_data == NULL || psi_size == 0)
- return -1;
-
- FD_ZERO(&fds);
-
- i = 0;
- length = strlen(at);
-
- do {
- FD_SET(device_fd, &fds);
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
-
- rc = write(device_fd, at, length);
- if (rc < length) {
- ipc_client_log(client, "Writing ATAT in ASCII failed");
- goto error;
- }
- ipc_client_log(client, "Wrote ATAT in ASCII");
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc < 0) {
- ipc_client_log(client, "Waiting for bootup failed");
- goto error;
- }
-
- if (i++ > 50) {
- ipc_client_log(client, "Waiting for bootup failed");
- goto error;
- }
- } while(rc == 0);
-
- rc = xmm6260_mipi_ack_read(device_fd, XMM6260_MIPI_BOOT0_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading boot ACK failed");
- goto error;
- }
-
- psi_header.padding = XMM6260_PSI_PADDING;
- psi_header.length = ((psi_size >> 8) & 0xff) | ((psi_size & 0xff) << 8);
- psi_header.magic = XMM6260_PSI_MAGIC;
-
- rc = write(device_fd, &psi_header, sizeof(psi_header));
- if (rc < (int) sizeof(psi_header)) {
- ipc_client_log(client, "Writing PSI header failed");
- goto error;
- }
- ipc_client_log(client, "Wrote PSI header");
-
- p = (unsigned char *) psi_data;
-
- wc = 0;
- while (wc < psi_size) {
- rc = write(device_fd, (void *) p, psi_size - wc);
- if (rc < 0) {
- ipc_client_log(client, "Writing PSI failed");
- goto error;
- }
-
- p += rc;
- wc += rc;
- }
-
- psi_crc = xmm6260_mipi_crc_calculate(psi_data, psi_size);
-
- ipc_client_log(client, "Wrote PSI, CRC is 0x%x", psi_crc);
-
- rc = write(device_fd, &psi_crc, sizeof(psi_crc));
- if (rc < (int) sizeof(psi_crc)) {
- ipc_client_log(client, "Writing PSI CRC failed");
- goto error;
- }
- ipc_client_log(client, "Wrote PSI CRC (0x%x)", psi_crc);
-
- rc = xmm6260_mipi_ack_read(device_fd, XMM6260_MIPI_PSI_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading PSI ACK failed");
- goto error;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size)
-{
- unsigned short boot_magic[4];
- unsigned char ebl_crc;
-
- int chunk;
- int count;
- int wc;
-
- unsigned char *p;
- int length;
- int rc;
-
- if (client == NULL || device_fd < 0 || ebl_data == NULL || ebl_size <= 0)
- return -1;
-
- boot_magic[0] = 0;
- boot_magic[1] = 0;
- boot_magic[2] = XMM6260_MIPI_BOOT1_MAGIC;
- boot_magic[3] = XMM6260_MIPI_BOOT1_MAGIC;
-
- length = sizeof(boot_magic);
-
- rc = write(device_fd, &length, sizeof(length));
- if (rc < (int) sizeof(length)) {
- ipc_client_log(client, "Writing boot magic length failed");
- goto error;
- }
-
- rc = write(device_fd, &boot_magic, length);
- if (rc < length) {
- ipc_client_log(client, "Writing boot magic failed");
- goto error;
- }
- ipc_client_log(client, "Wrote boot magic");
-
- rc = xmm6260_mipi_ack_read(device_fd, XMM6260_MIPI_BOOT1_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading boot magic ACK failed");
- goto error;
- }
-
- length = sizeof(ebl_size);
-
- rc = write(device_fd, &length, sizeof(length));
- if (rc < (int) sizeof(length)) {
- ipc_client_log(client, "Writing EBL size length failed");
- goto error;
- }
-
- rc = write(device_fd, &ebl_size, length);
- if (rc < length) {
- ipc_client_log(client, "Writing EBL size failed");
- goto error;
- }
- ipc_client_log(client, "Wrote EBL size");
-
- rc = xmm6260_mipi_ack_read(device_fd, XMM6260_MIPI_EBL_SIZE_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading EBL size ACK failed");
- goto error;
- }
-
- ebl_size++;
-
- rc = write(device_fd, &ebl_size, length);
- if (rc < length) {
- ipc_client_log(client, "Writing EBL size failed");
- goto error;
- }
-
- ebl_size--;
-
- p = (unsigned char *) ebl_data;
-
- chunk = XMM6260_MIPI_EBL_CHUNK;
- wc = 0;
- while (wc < ebl_size) {
- count = chunk < ebl_size - wc ? chunk : ebl_size - wc;
-
- rc = write(device_fd, (void *) p, count);
- if (rc < 0) {
- ipc_client_log(client, "Writing EBL failed");
- goto error;
- }
-
- p += rc;
- wc += rc;
- }
-
- ebl_crc = xmm6260_crc_calculate(ebl_data, ebl_size);
-
- ipc_client_log(client, "Wrote EBL, CRC is 0x%x", ebl_crc);
-
- rc = write(device_fd, &ebl_crc, sizeof(ebl_crc));
- if (rc < (int) sizeof(ebl_crc)) {
- ipc_client_log(client, "Writing EBL CRC failed");
- goto error;
- }
- ipc_client_log(client, "Wrote EBL CRC (0x%x)", ebl_crc);
-
- rc = xmm6260_mipi_ack_read(device_fd, XMM6260_MIPI_EBL_ACK);
- if (rc < 0) {
- ipc_client_log(client, "Reading EBL ACK failed");
- goto error;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6260_mipi_command_send(int device_fd, unsigned short code,
- void *data, int size, int ack, int short_footer)
-{
- struct xmm6260_mipi_command_header header;
- struct xmm6260_mipi_command_footer footer;
- int footer_size;
- void *buffer = NULL;
- int length;
-
- struct timeval timeout;
- fd_set fds;
- int chunk;
- int c;
-
- unsigned char *p;
- int rc;
- int i;
-
- if (device_fd < 0 || data == NULL || size <= 0)
- return -1;
-
- header.size = size + sizeof(header);
- header.magic = XMM6260_MIPI_COMMAND_HEADER_MAGIC;
- header.code = code;
- header.data_size = size;
-
- footer.checksum = (size & 0xffff) + code;
- footer.magic = XMM6260_MIPI_COMMAND_FOOTER_MAGIC;
- footer.unknown = XMM6260_MIPI_COMMAND_FOOTER_UNKNOWN;
-
- p = (unsigned char *) data;
-
- for (i = 0; i < size; i++)
- footer.checksum += *p++;
-
- footer_size = sizeof(footer);
- if (short_footer)
- footer_size -= sizeof(short);
-
- length = sizeof(header) + size + footer_size;
- buffer = malloc(length);
-
- p = (unsigned char *) buffer;
- memcpy(p, &header, sizeof(header));
- p += sizeof(header);
- memcpy(p, data, size);
- p += size;
- memcpy(p, &footer, footer_size);
-
- rc = write(device_fd, buffer, length);
- if (rc < length)
- goto error;
-
- free(buffer);
- buffer = NULL;
-
- if (!ack) {
- rc = 0;
- goto complete;
- }
-
- FD_ZERO(&fds);
- FD_SET(device_fd, &fds);
-
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- rc = read(device_fd, &length, sizeof(length));
- if (rc < (int) sizeof(length) || length <= 0)
- goto error;
-
- length += sizeof(unsigned int);
- if (length % 4 != 0)
- length += length % 4;
-
- if (length < (int) sizeof(buffer))
- goto error;
-
- buffer = malloc(length);
-
- p = (unsigned char *) buffer;
- memcpy(p, &length, sizeof(length));
- p += sizeof(length);
-
- chunk = 4;
- c = sizeof(length);
- while (c < length) {
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- rc = read(device_fd, (void *) p, chunk);
- if (rc < chunk)
- goto error;
-
- p += rc;
- c += rc;
- }
-
- memcpy(&header, buffer, sizeof(header));
- if (header.code != code)
- goto error;
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_mipi_modem_data_send(int device_fd, void *data, int size, int address)
-{
- int chunk;
- int count;
- int c;
-
- unsigned char *p;
- int rc;
-
- if (device_fd < 0 || data == NULL || size <= 0)
- return -1;
-
- rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_FLASH_SET_ADDRESS, &address, sizeof(address), 1, 0);
- if (rc < 0)
- goto error;
-
- p = (unsigned char *) data;
-
- chunk = XMM6260_MIPI_MODEM_DATA_CHUNK;
- c = 0;
- while (c < size) {
- count = chunk < size - c ? chunk : size - c;
-
- rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_FLASH_WRITE_BLOCK, p, count, 1, 1);
- if (rc < 0)
- goto error;
-
- p += count;
- c += count;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- return rc;
-}
-
-int xmm6260_mipi_port_config_send(struct ipc_client *client, int device_fd)
-{
- void *buffer = NULL;
- int length;
-
- struct timeval timeout;
- fd_set fds;
- int chunk;
- int count;
- int c;
-
- unsigned char *p;
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- FD_ZERO(&fds);
- FD_SET(device_fd, &fds);
-
- timeout.tv_sec = 2;
- timeout.tv_usec = 0;
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- rc = read(device_fd, &length, sizeof(length));
- if (rc < (int) sizeof(length) || length <= 0) {
- ipc_client_log(client, "Reading port config length failed");
- goto error;
- }
- ipc_client_log(client, "Read port config length (0x%x)", length);
-
- buffer = malloc(length);
-
- p = (unsigned char *) buffer;
-
- chunk = 4;
- c = 0;
- while (c < length) {
- count = chunk < length - c ? chunk : length - c;
-
- rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
- if (rc <= 0)
- goto error;
-
- rc = read(device_fd, p, count);
- if (rc < count) {
- ipc_client_log(client, "Reading port config failed");
- goto error;
- }
-
- p += count;
- c += count;
- }
- ipc_client_log(client, "Read port config");
-
- rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_SET_PORT_CONFIG, buffer, length, 1, 0);
- if (rc < 0) {
- ipc_client_log(client, "Sending port config command failed");
- goto error;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_mipi_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size)
-{
- int rc;
-
- if (client == NULL || device_fd < 0 || sec_data == NULL || sec_size <= 0)
- return -1;
-
- rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_SEC_START, sec_data, sec_size, 1, 0);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_mipi_sec_end_send(struct ipc_client *client, int device_fd)
-{
- unsigned short sec_data;
- int sec_size;
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- sec_data = XMM6260_SEC_END_MAGIC;
- sec_size = sizeof(sec_data);
-
- rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_SEC_END, &sec_data, sec_size, 1, 1);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_mipi_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size)
-{
- int rc;
-
- if (client == NULL || device_fd < 0 || firmware_data == NULL || firmware_size <= 0)
- return -1;
-
- rc = xmm6260_mipi_modem_data_send(device_fd, firmware_data, firmware_size, XMM6260_FIRMWARE_ADDRESS);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_mipi_nv_data_send(struct ipc_client *client, int device_fd)
-{
- void *nv_data = NULL;
- int nv_size;
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- rc = nv_data_check(client);
- if (rc < 0) {
- ipc_client_log(client, "Checking nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Checked nv_data");
-
- rc = nv_data_md5_check(client);
- if (rc < 0) {
- ipc_client_log(client, "Checking nv_data md5 failed");
- goto error;
- }
- ipc_client_log(client, "Checked nv_data md5");
-
- nv_data = file_data_read(nv_data_path(client), nv_data_size(client), nv_data_chunk_size(client));
- if (nv_data == NULL) {
- ipc_client_log(client, "Reading nv_data failed");
- goto error;
- }
- ipc_client_log(client, "Read nv_data");
-
- nv_size = nv_data_size(client);
-
- rc = xmm6260_mipi_modem_data_send(device_fd, nv_data, nv_size, XMM6260_NV_DATA_ADDRESS);
- if (rc < 0)
- goto error;
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (nv_data != NULL)
- free(nv_data);
-
- return rc;
-}
-
-int xmm6260_mipi_mps_data_send(struct ipc_client *client, int device_fd,
- void *mps_data, int mps_size)
-{
- int rc;
-
- if (client == NULL || device_fd < 0 || mps_data == NULL || mps_size <= 0)
- return -1;
-
- rc = xmm6260_mipi_modem_data_send(device_fd, mps_data, mps_size, XMM6260_MPS_DATA_ADDRESS);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_mipi_hw_reset_send(struct ipc_client *client, int device_fd)
-{
- unsigned int hw_reset_data;
- int hw_reset_size;
- int rc;
-
- if (client == NULL || device_fd < 0)
- return -1;
-
- hw_reset_data = XMM6260_HW_RESET_MAGIC;
- hw_reset_size = sizeof(hw_reset_data);
-
- rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_HW_RESET, &hw_reset_data, hw_reset_size, 0, 1);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/xmm6260_mipi.h b/samsung-ipc/device/xmm6260/xmm6260_mipi.h
deleted file mode 100644
index 4c9d7d2..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260_mipi.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __XMM6260_MIPI_H__
-#define __XMM6260_MIPI_H__
-
-#define XMM6260_MIPI_BOOT0_ACK 0xFFFF
-#define XMM6260_MIPI_BOOT1_MAGIC 0x02
-#define XMM6260_MIPI_BOOT1_ACK 0xAA00
-#define XMM6260_MIPI_PSI_ACK 0xDD01
-#define XMM6260_MIPI_EBL_SIZE_ACK 0xCCCC
-#define XMM6260_MIPI_EBL_ACK 0xA551
-#define XMM6260_MIPI_EBL_CHUNK 0xDFC
-#define XMM6260_MIPI_MODEM_DATA_CHUNK 0xDF2
-#define XMM6260_MIPI_COMMAND_HEADER_MAGIC 0x02
-#define XMM6260_MIPI_COMMAND_FOOTER_MAGIC 0x03
-#define XMM6260_MIPI_COMMAND_FOOTER_UNKNOWN 0xEAEA
-
-struct xmm6260_mipi_psi_header {
- unsigned char padding;
- unsigned short length;
- unsigned char magic;
-} __attribute__((packed));
-
-struct xmm6260_mipi_command_header {
- unsigned int size;
- unsigned short magic;
- unsigned short code;
- unsigned short data_size;
-} __attribute__((packed));
-
-struct xmm6260_mipi_command_footer {
- unsigned short checksum;
- unsigned short magic;
- unsigned short unknown;
-} __attribute__((packed));
-
-int xmm6260_mipi_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size);
-int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size);
-
-int xmm6260_mipi_port_config_send(struct ipc_client *client, int device_fd);
-int xmm6260_mipi_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size);
-int xmm6260_mipi_sec_end_send(struct ipc_client *client, int device_fd);
-int xmm6260_mipi_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size);
-int xmm6260_mipi_nv_data_send(struct ipc_client *client, int device_fd);
-int xmm6260_mipi_mps_data_send(struct ipc_client *client, int device_fd,
- void *mps_data, int mps_size);
-int xmm6260_mipi_hw_reset_send(struct ipc_client *client, int device_fd);
-
-#endif
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/xmm6260_sec_modem.c b/samsung-ipc/device/xmm6260/xmm6260_sec_modem.c
deleted file mode 100644
index d3ddfae..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260_sec_modem.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-
-#include <samsung-ipc.h>
-#include <ipc.h>
-#include <util.h>
-
-#include "modem.h"
-#include "modem_prj.h"
-#include "modem_link_device_hsic.h"
-
-#include "xmm6260.h"
-#include "xmm6260_sec_modem.h"
-
-int xmm6260_sec_modem_power(int device_fd, int power)
-{
- int rc;
-
- if (device_fd < 0)
- return -1;
-
- rc = ioctl(device_fd, power ? IOCTL_MODEM_ON : IOCTL_MODEM_OFF, 0);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_sec_modem_boot_power(int device_fd, int power)
-{
- int rc;
-
- if (device_fd < 0)
- return -1;
-
- rc = ioctl(device_fd, power ? IOCTL_MODEM_BOOT_ON : IOCTL_MODEM_BOOT_OFF, 0);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_sec_modem_status_online_wait(int device_fd)
-{
- int status;
- int i;
-
- if (device_fd < 0)
- return -1;
-
- i = 0;
- for (i = 0; i < 100; i++) {
- status = ioctl(device_fd, IOCTL_MODEM_STATUS, 0);
- if (status == STATE_ONLINE)
- return 0;
-
- usleep(50000);
- }
-
- return -1;
-}
-
-int xmm6260_sec_modem_hci_power(int power)
-{
- int ehci_rc, ohci_rc;
-
- ehci_rc = sysfs_value_write(XMM6260_SEC_MODEM_EHCI_POWER_SYSFS, !!power);
- if (ehci_rc >= 0)
- usleep(50000);
-
- ohci_rc = sysfs_value_write(XMM6260_SEC_MODEM_OHCI_POWER_SYSFS, !!power);
- if (ohci_rc >= 0)
- usleep(50000);
-
- if (ehci_rc < 0 && ohci_rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_sec_modem_link_control_enable(int device_fd, int enable)
-{
- int rc;
-
- if (device_fd < 0)
- return -1;
-
- rc = ioctl(device_fd, IOCTL_LINK_CONTROL_ENABLE, &enable);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_sec_modem_link_control_active(int device_fd, int active)
-{
- int rc;
-
- if (device_fd < 0)
- return -1;
-
- rc = ioctl(device_fd, IOCTL_LINK_CONTROL_ACTIVE, &active);
- if (rc < 0)
- return -1;
-
- return 0;
-}
-
-int xmm6260_sec_modem_link_connected_wait(int device_fd)
-{
- int status;
- int i;
-
- if (device_fd < 0)
- return -1;
-
- i = 0;
- for (i = 0; i < 100; i++) {
- status = ioctl(device_fd, IOCTL_LINK_CONNECTED, 0);
- if (status)
- return 0;
-
- usleep(50000);
- }
-
- return -1;
-}
-
-int xmm6260_sec_modem_link_get_hostwake_wait(int device_fd)
-{
- int status;
- int i;
-
- if (device_fd < 0)
- return -1;
-
- i = 0;
- for (i = 0; i < 10; i++) {
- status = ioctl(device_fd, IOCTL_LINK_GET_HOSTWAKE, 0);
- if (status)
- return 0;
-
- usleep(50000);
- }
-
- return -1;
-}
-
-int xmm6260_sec_modem_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- struct ipc_fmt_header header;
- void *buffer;
- unsigned char *p;
- int count;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
- return -1;
-
- ipc_fmt_header_fill(&header, request);
-
- buffer = malloc(header.length);
-
- memcpy(buffer, &header, sizeof(struct ipc_fmt_header));
- if (request->data != NULL && request->length > 0)
- memcpy((void *) ((unsigned char *) buffer + sizeof(struct ipc_fmt_header)), request->data, request->length);
-
- ipc_client_log_send(client, request, __func__);
-
- p = (unsigned char *) buffer;
-
- count = 0;
- while (count < header.length) {
- rc = client->handlers->write(client->handlers->transport_data, p, header.length - count);
- if (rc <= 0) {
- ipc_client_log(client, "Writing FMT data to the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_sec_modem_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- struct ipc_fmt_header *header;
- void *buffer = NULL;
- unsigned char *p;
- int length;
- int count;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
- return -1;
-
- length = XMM6260_DATA_SIZE;
- buffer = malloc(length);
-
- rc = client->handlers->read(client->handlers->transport_data, buffer, length);
- if (rc < (int) sizeof(struct ipc_fmt_header)) {
- ipc_client_log(client, "Reading FMT header from the modem failed");
- goto error;
- }
-
- header = (struct ipc_fmt_header *) buffer;
-
- ipc_fmt_message_fill(header, response);
-
- if (header->length > sizeof(struct ipc_fmt_header)) {
- response->length = header->length - sizeof(struct ipc_fmt_header);
- response->data = malloc(response->length);
-
- p = (unsigned char *) response->data;
-
- count = rc - sizeof(struct ipc_fmt_header);
- if (count > 0) {
- memcpy(p, (void *) ((unsigned char *) buffer + sizeof(struct ipc_fmt_header)), count);
- p += count;
- }
-
- while (count < (int) response->length) {
- rc = client->handlers->read(client->handlers->transport_data, p, response->length - count);
- if (rc <= 0) {
- ipc_client_log(client, "Reading FMT data from the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
- }
-
- ipc_client_log_recv(client, response, __func__);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_sec_modem_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- struct ipc_rfs_header header;
- void *buffer;
- unsigned char *p;
- int count;
- int rc;
-
-
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
- return -1;
-
- ipc_rfs_header_fill(&header, request);
-
- buffer = malloc(header.length);
-
- memcpy(buffer, &header, sizeof(struct ipc_rfs_header));
- if (request->data != NULL && request->length > 0)
- memcpy((void *) ((unsigned char *) buffer + sizeof(struct ipc_rfs_header)), request->data, request->length);
-
- ipc_client_log_send(client, request, __func__);
-
- p = (unsigned char *) buffer;
-
- count = 0;
- while (count < (int) header.length) {
- rc = client->handlers->write(client->handlers->transport_data, p, header.length - count);
- if (rc <= 0) {
- ipc_client_log(client, "Writing RFS data to the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_sec_modem_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- struct ipc_rfs_header *header;
- void *buffer = NULL;
- unsigned char *p;
- int length;
- int count;
- int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
- return -1;
-
- length = XMM6260_DATA_SIZE;
- buffer = malloc(length);
-
- rc = client->handlers->read(client->handlers->transport_data, buffer, length);
- if (rc < (int) sizeof(struct ipc_rfs_header)) {
- ipc_client_log(client, "Reading RFS header from the modem failed");
- goto error;
- }
-
- header = (struct ipc_rfs_header *) buffer;
-
- ipc_rfs_message_fill(header, response);
-
- if (header->length > sizeof(struct ipc_rfs_header)) {
- response->length = header->length - sizeof(struct ipc_rfs_header);
- response->data = malloc(response->length);
-
- p = (unsigned char *) response->data;
-
- count = rc - sizeof(struct ipc_rfs_header);
- if (count > 0) {
- memcpy(p, (void *) ((unsigned char *) buffer + sizeof(struct ipc_rfs_header)), count);
- p += count;
- }
-
- while (count < (int) response->length) {
- rc = client->handlers->read(client->handlers->transport_data, p, response->length - count);
- if (rc <= 0) {
- ipc_client_log(client, "Reading RFS data from the modem failed");
- goto error;
- }
-
- count += rc;
- p += rc;
- }
- }
-
- ipc_client_log_recv(client, response, __func__);
-
- rc = 0;
- goto complete;
-
-error:
- rc = -1;
-
-complete:
- if (buffer != NULL)
- free(buffer);
-
- return rc;
-}
-
-int xmm6260_sec_modem_ipc_open(int type)
-{
- int fd;
-
- switch (type) {
- case IPC_CLIENT_TYPE_FMT:
- fd = open(XMM6260_SEC_MODEM_IPC0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- break;
- case IPC_CLIENT_TYPE_RFS:
- fd = open(XMM6260_SEC_MODEM_RFS0_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
- break;
- default:
- return -1;
- }
-
- return fd;
-}
-
-int xmm6260_sec_modem_ipc_close(int fd)
-{
- if (fd < 0)
- return -1;
-
- close(fd);
-
- return 0;
-}
-
-int xmm6260_sec_modem_ipc_read(int fd, void *buffer, unsigned int length)
-{
- int rc;
-
- if (fd < 0 || buffer == NULL || length <= 0)
- return -1;
-
- rc = read(fd, buffer, length);
- return rc;
-}
-
-int xmm6260_sec_modem_ipc_write(int fd, void *buffer, unsigned int length)
-{
- int rc;
-
- if (fd < 0 || buffer == NULL || length <= 0)
- return -1;
-
- rc = write(fd, buffer, length);
- return rc;
-}
-
-int xmm6260_sec_modem_ipc_poll(int fd, struct timeval *timeout)
-{
- fd_set fds;
- int rc;
- int status;
-
- if (fd < 0)
- return -1;
-
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
-
- rc = select(fd + 1, &fds, NULL, NULL, timeout);
- if (FD_ISSET(fd, &fds)) {
- status = ioctl(fd, IOCTL_MODEM_STATUS, 0);
- if (status != STATE_ONLINE && status != STATE_BOOTING)
- return 0;
- }
-
- return rc;
-}
-
-char *xmm6260_sec_modem_ipc_gprs_get_iface(int cid)
-{
- char *iface = NULL;
-
- if (cid > XMM6260_SEC_MODEM_GPRS_IFACE_COUNT)
- return NULL;
-
- asprintf(&iface, "%s%d", XMM6260_SEC_MODEM_GPRS_IFACE_PREFIX, cid - 1);
-
- return iface;
-}
-
-int xmm6260_sec_modem_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- if (capabilities == NULL)
- return -1;
-
- capabilities->port_list = 0;
- capabilities->cid_max = XMM6260_SEC_MODEM_GPRS_IFACE_COUNT;
-
- return 0;
-}
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/device/xmm6260/xmm6260_sec_modem.h b/samsung-ipc/device/xmm6260/xmm6260_sec_modem.h
deleted file mode 100644
index 8895fbb..0000000
--- a/samsung-ipc/device/xmm6260/xmm6260_sec_modem.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of libsamsung-ipc.
- *
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
- *
- * libsamsung-ipc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * libsamsung-ipc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __XMM6260_SEC_MODEM_H__
-#define __XMM6260_SEC_MODEM_H__
-
-#define XMM6260_SEC_MODEM_BOOT0_DEVICE "/dev/umts_boot0"
-#define XMM6260_SEC_MODEM_BOOT1_DEVICE "/dev/umts_boot1"
-#define XMM6260_SEC_MODEM_IPC0_DEVICE "/dev/umts_ipc0"
-#define XMM6260_SEC_MODEM_RFS0_DEVICE "/dev/umts_rfs0"
-#define XMM6260_SEC_MODEM_LINK_PM_DEVICE "/dev/link_pm"
-#define XMM6260_SEC_MODEM_EHCI_POWER_SYSFS "/sys/devices/platform/s5p-ehci/ehci_power"
-#define XMM6260_SEC_MODEM_OHCI_POWER_SYSFS "/sys/devices/platform/s5p-ohci/ohci_power"
-
-#define XMM6260_SEC_MODEM_GPRS_IFACE_PREFIX "rmnet"
-#define XMM6260_SEC_MODEM_GPRS_IFACE_COUNT 3
-
-int xmm6260_sec_modem_power(int device_fd, int power);
-int xmm6260_sec_modem_boot_power(int device_fd, int power);
-int xmm6260_sec_modem_status_online_wait(int device_fd);
-int xmm6260_sec_modem_hci_power(int power);
-int xmm6260_sec_modem_link_control_enable(int device_fd, int enable);
-int xmm6260_sec_modem_link_control_active(int device_fd, int active);
-int xmm6260_sec_modem_link_connected_wait(int device_fd);
-int xmm6260_sec_modem_link_get_hostwake_wait(int device_fd);
-
-int xmm6260_sec_modem_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request);
-int xmm6260_sec_modem_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response);
-int xmm6260_sec_modem_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request);
-int xmm6260_sec_modem_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response);
-
-int xmm6260_sec_modem_ipc_open(int type);
-int xmm6260_sec_modem_ipc_close(int fd);
-int xmm6260_sec_modem_ipc_read(int fd, void *buffer, unsigned int length);
-int xmm6260_sec_modem_ipc_write(int fd, void *buffer, unsigned int length);
-int xmm6260_sec_modem_ipc_poll(int fd, struct timeval *timeout);
-
-char *xmm6260_sec_modem_ipc_gprs_get_iface(int cid);
-int xmm6260_sec_modem_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities);
-
-#endif
-
-// vim:ts=4:sw=4:expandtab