Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 59270
b: refs/heads/master
c: eac1d8d
h: refs/heads/master
v: v3
  • Loading branch information
Ben Dooks authored and Russell King committed Jul 12, 2007
1 parent 066975d commit 09150b2
Show file tree
Hide file tree
Showing 29 changed files with 373 additions and 332 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: 46c41e62a1feb4ab2e941f33f06bbf8feab2d2cf
refs/heads/master: eac1d8dab03bde6d20679c961a6409c1b786c201
2 changes: 2 additions & 0 deletions trunk/arch/arm/common/sharpsl_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,9 @@ static void sharpsl_apm_get_power_status(struct apm_power_info *info)
}

static struct pm_ops sharpsl_pm_ops = {
.prepare = pxa_pm_prepare,
.enter = corgi_pxa_pm_enter,
.finish = pxa_pm_finish,
.valid = pm_valid_only_mem,
};

Expand Down
15 changes: 8 additions & 7 deletions trunk/arch/arm/mach-pxa/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <asm/arch/pxa-regs.h>
#include <asm/hardware.h>
#include <asm/semaphore.h>

struct clk {
struct list_head node;
Expand All @@ -24,21 +25,21 @@ struct clk {
};

static LIST_HEAD(clocks);
static DEFINE_MUTEX(clocks_mutex);
static DECLARE_MUTEX(clocks_sem);
static DEFINE_SPINLOCK(clocks_lock);

struct clk *clk_get(struct device *dev, const char *id)
{
struct clk *p, *clk = ERR_PTR(-ENOENT);

mutex_lock(&clocks_mutex);
down(&clocks_sem);
list_for_each_entry(p, &clocks, node) {
if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
clk = p;
break;
}
}
mutex_unlock(&clocks_mutex);
up(&clocks_sem);

return clk;
}
Expand Down Expand Up @@ -100,18 +101,18 @@ static struct clk clk_gpio27 = {

int clk_register(struct clk *clk)
{
mutex_lock(&clocks_mutex);
down(&clocks_sem);
list_add(&clk->node, &clocks);
mutex_unlock(&clocks_mutex);
up(&clocks_sem);
return 0;
}
EXPORT_SYMBOL(clk_register);

void clk_unregister(struct clk *clk)
{
mutex_lock(&clocks_mutex);
down(&clocks_sem);
list_del(&clk->node);
mutex_unlock(&clocks_mutex);
up(&clocks_sem);
}
EXPORT_SYMBOL(clk_unregister);

Expand Down
7 changes: 3 additions & 4 deletions trunk/arch/arm/mach-pxa/corgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <asm/hardware/scoop.h>

#include "generic.h"
#include "devices.h"
#include "sharpsl.h"


Expand Down Expand Up @@ -369,7 +368,7 @@ MACHINE_START(CORGI, "SHARP Corgi")
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
.fixup = fixup_corgi,
.map_io = pxa_map_io,
.init_irq = pxa25x_init_irq,
.init_irq = pxa_init_irq,
.init_machine = corgi_init,
.timer = &pxa_timer,
MACHINE_END
Expand All @@ -381,7 +380,7 @@ MACHINE_START(SHEPHERD, "SHARP Shepherd")
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
.fixup = fixup_corgi,
.map_io = pxa_map_io,
.init_irq = pxa25x_init_irq,
.init_irq = pxa_init_irq,
.init_machine = corgi_init,
.timer = &pxa_timer,
MACHINE_END
Expand All @@ -393,7 +392,7 @@ MACHINE_START(HUSKY, "SHARP Husky")
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
.fixup = fixup_corgi,
.map_io = pxa_map_io,
.init_irq = pxa25x_init_irq,
.init_irq = pxa_init_irq,
.init_machine = corgi_init,
.timer = &pxa_timer,
MACHINE_END
Expand Down
11 changes: 0 additions & 11 deletions trunk/arch/arm/mach-pxa/devices.h

This file was deleted.

44 changes: 13 additions & 31 deletions trunk/arch/arm/mach-pxa/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@

#include <asm/arch/pxa-regs.h>

struct dma_channel {
static struct dma_channel {
char *name;
pxa_dma_prio prio;
void (*irq_handler)(int, void *);
void *data;
};
} dma_channels[PXA_DMA_CHANNELS];

static struct dma_channel *dma_channels;
static int num_dma_channels;

int pxa_request_dma (char *name, pxa_dma_prio prio,
void (*irq_handler)(int, void *),
Expand All @@ -50,9 +47,8 @@ int pxa_request_dma (char *name, pxa_dma_prio prio,

do {
/* try grabbing a DMA channel with the requested priority */
for (i = 0; i < num_dma_channels; i++) {
if ((dma_channels[i].prio == prio) &&
!dma_channels[i].name) {
pxa_for_each_dma_prio (i, prio) {
if (!dma_channels[i].name) {
found = 1;
break;
}
Expand Down Expand Up @@ -95,7 +91,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
{
int i, dint = DINT;

for (i = 0; i < num_dma_channels; i++) {
for (i = 0; i < PXA_DMA_CHANNELS; i++) {
if (dint & (1 << i)) {
struct dma_channel *channel = &dma_channels[i];
if (channel->name && channel->irq_handler) {
Expand All @@ -113,32 +109,18 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
return IRQ_HANDLED;
}

int __init pxa_init_dma(int num_ch)
static int __init pxa_dma_init (void)
{
int i, ret;
int ret;

dma_channels = kzalloc(sizeof(struct dma_channel) * num_ch, GFP_KERNEL);
if (dma_channels == NULL)
return -ENOMEM;

ret = request_irq(IRQ_DMA, dma_irq_handler, IRQF_DISABLED, "DMA", NULL);
if (ret) {
ret = request_irq (IRQ_DMA, dma_irq_handler, 0, "DMA", NULL);
if (ret)
printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n");
kfree(dma_channels);
return ret;
}

/* dma channel priorities on pxa2xx processors:
* ch 0 - 3, 16 - 19 <--> (0) DMA_PRIO_HIGH
* ch 4 - 7, 20 - 23 <--> (1) DMA_PRIO_MEDIUM
* ch 8 - 15, 24 - 31 <--> (2) DMA_PRIO_LOW
*/
for (i = 0; i < num_ch; i++)
dma_channels[i].prio = min((i & 0xf) >> 2, DMA_PRIO_LOW);

num_dma_channels = num_ch;
return 0;
return ret;
}

arch_initcall(pxa_dma_init);

EXPORT_SYMBOL(pxa_request_dma);
EXPORT_SYMBOL(pxa_free_dma);

93 changes: 74 additions & 19 deletions trunk/arch/arm/mach-pxa/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <asm/arch/irda.h>
#include <asm/arch/i2c.h>

#include "devices.h"
#include "generic.h"

/*
Expand Down Expand Up @@ -243,7 +242,7 @@ static struct resource pxamci_resources[] = {

static u64 pxamci_dmamask = 0xffffffffUL;

struct platform_device pxamci_device = {
static struct platform_device pxamci_device = {
.name = "pxa2xx-mci",
.id = -1,
.dev = {
Expand Down Expand Up @@ -282,7 +281,7 @@ static struct resource pxa2xx_udc_resources[] = {

static u64 udc_dma_mask = ~(u32)0;

struct platform_device pxaudc_device = {
static struct platform_device udc_device = {
.name = "pxa2xx-udc",
.id = -1,
.resource = pxa2xx_udc_resources,
Expand All @@ -308,7 +307,7 @@ static struct resource pxafb_resources[] = {

static u64 fb_dma_mask = ~(u64)0;

struct platform_device pxafb_device = {
static struct platform_device pxafb_device = {
.name = "pxa2xx-fb",
.id = -1,
.dev = {
Expand All @@ -329,24 +328,24 @@ void __init set_pxa_fb_parent(struct device *parent_dev)
pxafb_device.dev.parent = parent_dev;
}

struct platform_device ffuart_device = {
static struct platform_device ffuart_device = {
.name = "pxa2xx-uart",
.id = 0,
};
struct platform_device btuart_device = {
static struct platform_device btuart_device = {
.name = "pxa2xx-uart",
.id = 1,
};
struct platform_device stuart_device = {
static struct platform_device stuart_device = {
.name = "pxa2xx-uart",
.id = 2,
};
struct platform_device hwuart_device = {
static struct platform_device hwuart_device = {
.name = "pxa2xx-uart",
.id = 3,
};

static struct resource pxai2c_resources[] = {
static struct resource i2c_resources[] = {
{
.start = 0x40301680,
.end = 0x403016a3,
Expand All @@ -358,19 +357,40 @@ static struct resource pxai2c_resources[] = {
},
};

struct platform_device pxai2c_device = {
static struct platform_device i2c_device = {
.name = "pxa2xx-i2c",
.id = 0,
.resource = pxai2c_resources,
.num_resources = ARRAY_SIZE(pxai2c_resources),
.resource = i2c_resources,
.num_resources = ARRAY_SIZE(i2c_resources),
};

#ifdef CONFIG_PXA27x
static struct resource i2c_power_resources[] = {
{
.start = 0x40f00180,
.end = 0x40f001a3,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_PWRI2C,
.end = IRQ_PWRI2C,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device i2c_power_device = {
.name = "pxa2xx-i2c",
.id = 1,
.resource = i2c_power_resources,
.num_resources = ARRAY_SIZE(i2c_resources),
};
#endif

void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
{
pxai2c_device.dev.platform_data = info;
i2c_device.dev.platform_data = info;
}

static struct resource pxai2s_resources[] = {
static struct resource i2s_resources[] = {
{
.start = 0x40400000,
.end = 0x40400083,
Expand All @@ -382,16 +402,16 @@ static struct resource pxai2s_resources[] = {
},
};

struct platform_device pxai2s_device = {
static struct platform_device i2s_device = {
.name = "pxa2xx-i2s",
.id = -1,
.resource = pxai2s_resources,
.num_resources = ARRAY_SIZE(pxai2s_resources),
.resource = i2s_resources,
.num_resources = ARRAY_SIZE(i2s_resources),
};

static u64 pxaficp_dmamask = ~(u32)0;

struct platform_device pxaficp_device = {
static struct platform_device pxaficp_device = {
.name = "pxa2xx-ir",
.id = -1,
.dev = {
Expand All @@ -405,7 +425,42 @@ void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
pxaficp_device.dev.platform_data = info;
}

struct platform_device pxartc_device = {
static struct platform_device pxartc_device = {
.name = "sa1100-rtc",
.id = -1,
};

static struct platform_device *devices[] __initdata = {
&pxamci_device,
&udc_device,
&pxafb_device,
&ffuart_device,
&btuart_device,
&stuart_device,
&pxaficp_device,
&i2c_device,
#ifdef CONFIG_PXA27x
&i2c_power_device,
#endif
&i2s_device,
&pxartc_device,
};

static int __init pxa_init(void)
{
int cpuid, ret;

ret = platform_add_devices(devices, ARRAY_SIZE(devices));
if (ret)
return ret;

/* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
cpuid = read_cpuid(CPUID_ID);
if (((cpuid >> 4) & 0xfff) == 0x2d0 ||
((cpuid >> 4) & 0xfff) == 0x290)
ret = platform_device_register(&hwuart_device);

return ret;
}

subsys_initcall(pxa_init);
6 changes: 1 addition & 5 deletions trunk/arch/arm/mach-pxa/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@
struct sys_timer;

extern struct sys_timer pxa_timer;
extern void __init pxa_init_irq_low(void);
extern void __init pxa_init_irq_high(void);
extern void __init pxa_init_irq_gpio(int gpio_nr);
extern void __init pxa25x_init_irq(void);
extern void __init pxa27x_init_irq(void);
extern void __init pxa_map_io(void);
extern void __init pxa_init_irq(void);

extern unsigned int get_clk_frequency_khz(int info);

Expand Down
Loading

0 comments on commit 09150b2

Please sign in to comment.