Skip to content

Commit

Permalink
staging: gdm7240: adding LTE USB driver
Browse files Browse the repository at this point in the history
GCT Semiconductor GDM7240 is 4G LTE chip.
This driver supports GCT reference platform as a USB device.

Signed-off-by: Won Kang <wonkang@gctsemi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Won Kang authored and Greg Kroah-Hartman committed Jul 24, 2013
1 parent 17dc159 commit 61e1210
Show file tree
Hide file tree
Showing 20 changed files with 3,916 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ source "drivers/staging/ozwpan/Kconfig"

source "drivers/staging/gdm72xx/Kconfig"

source "drivers/staging/gdm724x/Kconfig"

source "drivers/staging/silicom/Kconfig"

source "drivers/staging/ced1401/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ obj-$(CONFIG_MFD_NVEC) += nvec/
obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/
obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/
obj-$(CONFIG_LTE_GDM724X) += gdm724x/
obj-$(CONFIG_NET_VENDOR_SILICOM) += silicom/
obj-$(CONFIG_CED1401) += ced1401/
obj-$(CONFIG_DRM_IMX) += imx-drm/
Expand Down
15 changes: 15 additions & 0 deletions drivers/staging/gdm724x/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# GCT GDM724x LTE driver configuration
#

config LTE_GDM724X
tristate "GCT GDM724x LTE support"
depends on NET && USB
help
This driver supports GCT GDM724x LTE chip based USB modem devices.
It exposes 4 network devices to be used per PDN and 2 tty devices to be
used for AT commands and DM monitoring applications.
The modules will be called gdmulte.ko and gdmtty.ko

GCT-ATCx can be used for AT Commands
GCT-DMx can be used for LTE protocol monitoring
7 changes: 7 additions & 0 deletions drivers/staging/gdm724x/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
obj-$(CONFIG_LTE_GDM724X) := gdmulte.o
gdmulte-y += gdm_lte.o netlink_k.o
gdmulte-y += gdm_usb.o gdm_endian.o

obj-$(CONFIG_LTE_GDM724X) += gdmtty.o
gdmtty-y := gdm_tty.o gdm_mux.o

15 changes: 15 additions & 0 deletions drivers/staging/gdm724x/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
TODO:
- Clean up coding style to meet kernel standard. (80 line limit, netdev_err)
- Remove test for host endian
- Remove confusing macros (endian, hci_send, sdu_send, rcv_with_cb)
- Fixes for every instances of function returning -1
- Check for skb->len in gdm_lte_emulate_arp()
- Use ALIGN() macro for dummy_cnt in up_to_host()
- Error handling in init_usb()
- Explain reason for multiples of 512 bytes in alloc_tx_struct()
- Review use of atomic allocation for tx structs
- No error checking for alloc_tx_struct in do_tx()

Patches to:
Jonathan Kim <jonathankim@gctsemi.com>
Dean ahn <deanahn@gctsemi.com>
67 changes: 67 additions & 0 deletions drivers/staging/gdm724x/gdm_endian.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
*
* 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 <linux/slab.h>
#include "gdm_endian.h"

void set_endian(struct gdm_endian *ed, u8 dev_endian)
{
u8 a[2] = {0x12, 0x34};
u8 b[2] = {0, };
u16 c = 0x1234;

if (dev_endian == ENDIANNESS_BIG)
ed->dev_ed = ENDIANNESS_BIG;
else
ed->dev_ed = ENDIANNESS_LITTLE;

memcpy(b, &c, 2);

if (a[0] != b[0])
ed->host_ed = ENDIANNESS_LITTLE;
else
ed->host_ed = ENDIANNESS_BIG;

}

u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
{
if (ed->dev_ed == ed->host_ed)
return x;

return Endian16_Swap(x);
}

u16 gdm_dev16_to_cpu(struct gdm_endian *ed, u16 x)
{
if (ed->dev_ed == ed->host_ed)
return x;

return Endian16_Swap(x);
}

u32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x)
{
if (ed->dev_ed == ed->host_ed)
return x;

return Endian32_Swap(x);
}

u32 gdm_dev32_to_cpu(struct gdm_endian *ed, u32 x)
{
if (ed->dev_ed == ed->host_ed)
return x;

return Endian32_Swap(x);
}
49 changes: 49 additions & 0 deletions drivers/staging/gdm724x/gdm_endian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
*
* 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 __GDM_ENDIAN_H__
#define __GDM_ENDIAN_H__

#include <linux/types.h>

#define Endian16_Swap(value) \
((((u16)((value) & 0x00FF)) << 8) | \
(((u16)((value) & 0xFF00)) >> 8))

#define Endian32_Swap(value) \
((((u32)((value) & 0x000000FF)) << 24) | \
(((u32)((value) & 0x0000FF00)) << 8) | \
(((u32)((value) & 0x00FF0000)) >> 8) | \
(((u32)((value) & 0xFF000000)) >> 24))

enum {
ENDIANNESS_MIN = 0,
ENDIANNESS_UNKNOWN,
ENDIANNESS_LITTLE,
ENDIANNESS_BIG,
ENDIANNESS_MIDDLE,
ENDIANNESS_MAX
};

struct gdm_endian {
u8 dev_ed;
u8 host_ed;
};

void set_endian(struct gdm_endian *ed, u8 dev_endian);
u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x);
u16 gdm_dev16_to_cpu(struct gdm_endian *ed, u16 x);
u32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x);
u32 gdm_dev32_to_cpu(struct gdm_endian *ed, u32 x);

#endif /*__GDM_ENDIAN_H__*/
Loading

0 comments on commit 61e1210

Please sign in to comment.