Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192169
b: refs/heads/master
c: bf83de4
h: refs/heads/master
i:
  192167: 616313c
v: v3
  • Loading branch information
Daniel Walker authored and Daniel Walker committed May 12, 2010
1 parent 243d380 commit bdbee6f
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79848a2a7333eee6424b38c05b4ea4a0ce56eb47
refs/heads/master: bf83de4037780b11b27f1e32e33c1e8e7e42602e
24 changes: 21 additions & 3 deletions trunk/arch/arm/mach-msm/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
if ARCH_MSM

choice
prompt "Qualcomm MSM SoC Type"
default ARCH_MSM7X00A

config ARCH_MSM7X00A
bool "MSM7x00A / MSM7x01A"
select ARCH_MSM_ARM11
select MSM_SMD_PKG3
select CPU_V6

endchoice

config ARCH_MSM_ARM11
bool


comment "MSM Board Type"
depends on ARCH_MSM

Expand Down Expand Up @@ -28,20 +44,22 @@ choice
endchoice

config MACH_HALIBUT
depends on ARCH_MSM
select CPU_V6
depends on ARCH_MSM7X00A
default y
bool "Halibut Board (QCT SURF7201A)"
help
Support for the Qualcomm SURF7201A eval board.

config MACH_TROUT
select CPU_V6
depends on ARCH_MSM7X00A
default y
bool "HTC Dream (aka trout)"
help
Support for the HTC Dream, T-Mobile G1, Android ADP1 devices.

config MSM_SMD_PKG3
bool

config MSM_SMD
default y
bool "MSM Shared Memory Driver (SMD)"
Expand Down
44 changes: 1 addition & 43 deletions trunk/arch/arm/mach-msm/smd.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,48 +605,6 @@ static int smd_packet_read(smd_channel_t *ch, void *data, int len)
return r;
}

static int smd_alloc_v2(struct smd_channel *ch)
{
struct smd_shared_v2 *shared2;
void *buffer;
unsigned buffer_sz;

shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2));
buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz);

if (!buffer)
return -1;

/* buffer must be a power-of-two size */
if (buffer_sz & (buffer_sz - 1))
return -1;

buffer_sz /= 2;
ch->send = &shared2->ch0;
ch->recv = &shared2->ch1;
ch->send_data = buffer;
ch->recv_data = buffer + buffer_sz;
ch->fifo_size = buffer_sz;
return 0;
}

static int smd_alloc_v1(struct smd_channel *ch)
{
struct smd_shared_v1 *shared1;
shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1));
if (!shared1) {
pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n);
return -1;
}
ch->send = &shared1->ch0;
ch->recv = &shared1->ch1;
ch->send_data = shared1->data0;
ch->recv_data = shared1->data1;
ch->fifo_size = SMD_BUF_SIZE;
return 0;
}


static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
{
struct smd_channel *ch;
Expand All @@ -658,7 +616,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
}
ch->n = cid;

if (smd_alloc_v2(ch) && smd_alloc_v1(ch)) {
if (_smd_alloc_channel(ch)) {
kfree(ch);
return -1;
}
Expand Down
58 changes: 56 additions & 2 deletions trunk/arch/arm/mach-msm/smd_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct smem_shared {
#define SMSM_V1_SIZE (sizeof(unsigned) * 8)
#define SMSM_V2_SIZE (sizeof(unsigned) * 4)

#ifndef CONFIG_ARCH_MSM_SCORPION
#ifdef CONFIG_MSM_SMD_PKG3
struct smsm_interrupt_info {
uint32_t interrupt_mask;
uint32_t pending_interrupts;
Expand Down Expand Up @@ -123,7 +123,7 @@ struct msm_dem_slave_data {
#define SMSM_WKUP_REASON_ALARM 0x00000010
#define SMSM_WKUP_REASON_RESET 0x00000020

#ifndef CONFIG_ARCH_MSM_SCORPION
#ifdef CONFIG_ARCH_MSM7X00A
enum smsm_state_item {
SMSM_STATE_APPS = 1,
SMSM_STATE_MODEM = 3,
Expand Down Expand Up @@ -265,13 +265,15 @@ struct smd_half_channel {
unsigned head;
} __attribute__(( aligned(4), packed ));

/* Only used on SMD package v3 on msm7201a */
struct smd_shared_v1 {
struct smd_half_channel ch0;
unsigned char data0[SMD_BUF_SIZE];
struct smd_half_channel ch1;
unsigned char data1[SMD_BUF_SIZE];
};

/* Used on SMD package v4 */
struct smd_shared_v2 {
struct smd_half_channel ch0;
struct smd_half_channel ch1;
Expand Down Expand Up @@ -330,4 +332,56 @@ uint32_t raw_smsm_get_state(enum smsm_state_item item);

extern void msm_init_last_radio_log(struct module *);

#ifdef CONFIG_MSM_SMD_PKG3
/*
* This allocator assumes an SMD Package v3 which only exists on
* MSM7x00 SoC's.
*/
static inline int _smd_alloc_channel(struct smd_channel *ch)
{
struct smd_shared_v1 *shared1;

shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1));
if (!shared1) {
pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n);
return -1;
}
ch->send = &shared1->ch0;
ch->recv = &shared1->ch1;
ch->send_data = shared1->data0;
ch->recv_data = shared1->data1;
ch->fifo_size = SMD_BUF_SIZE;
return 0;
}
#else
/*
* This allocator assumes an SMD Package v4, the most common
* and the default.
*/
static inline int _smd_alloc_channel(struct smd_channel *ch)
{
struct smd_shared_v2 *shared2;
void *buffer;
unsigned buffer_sz;

shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2));
buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz);

if (!buffer)
return -1;

/* buffer must be a power-of-two size */
if (buffer_sz & (buffer_sz - 1))
return -1;

buffer_sz /= 2;
ch->send = &shared2->ch0;
ch->recv = &shared2->ch1;
ch->send_data = buffer;
ch->recv_data = buffer + buffer_sz;
ch->fifo_size = buffer_sz;
return 0;
}
#endif /* CONFIG_MSM_SMD_PKG3 */

#endif

0 comments on commit bdbee6f

Please sign in to comment.