-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 149384 b: refs/heads/master c: bc19d89 h: refs/heads/master v: v3
- Loading branch information
dmitry pervushin
authored and
Russell King
committed
Apr 27, 2009
1 parent
9e6facf
commit 3bbffe3
Showing
6 changed files
with
335 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 45d9108011b9dfb4fccd6c258290d2185145709b | ||
refs/heads/master: bc19d892a14cbb31d838813b2225e262a6c01341 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
obj-$(CONFIG_ARCH_STMP378X) += stmp378x.o | ||
obj-$(CONFIG_MACH_STMP378X) += stmp378x_devb.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
zreladdr-y := 0x40008000 | ||
params_phys-y := 0x40000100 | ||
initrd_phys-y := 0x40800000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
/* | ||
* Freescale STMP378X platform support | ||
* | ||
* Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#include <linux/kernel.h> | ||
#include <linux/init.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/irq.h> | ||
|
||
#include <asm/dma.h> | ||
#include <asm/setup.h> | ||
#include <asm/mach-types.h> | ||
|
||
#include <asm/mach/arch.h> | ||
#include <asm/mach/irq.h> | ||
#include <asm/mach/map.h> | ||
#include <asm/mach/time.h> | ||
|
||
#include <mach/pins.h> | ||
#include <mach/pinmux.h> | ||
#include <mach/dma.h> | ||
#include <mach/hardware.h> | ||
#include <mach/system.h> | ||
#include <mach/platform.h> | ||
#include <mach/stmp3xxx.h> | ||
#include <mach/regs-icoll.h> | ||
#include <mach/regs-apbh.h> | ||
#include <mach/regs-apbx.h> | ||
|
||
#include "stmp378x.h" | ||
/* | ||
* IRQ handling | ||
*/ | ||
static void stmp378x_ack_irq(unsigned int irq) | ||
{ | ||
/* Tell ICOLL to release IRQ line */ | ||
HW_ICOLL_VECTOR_WR(0x0); | ||
|
||
/* ACK current interrupt */ | ||
HW_ICOLL_LEVELACK_WR(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0); | ||
|
||
/* Barrier */ | ||
(void) HW_ICOLL_STAT_RD(); | ||
} | ||
|
||
static void stmp378x_mask_irq(unsigned int irq) | ||
{ | ||
/* IRQ disable */ | ||
HW_ICOLL_INTERRUPTn_CLR(irq, BM_ICOLL_INTERRUPTn_ENABLE); | ||
} | ||
|
||
static void stmp378x_unmask_irq(unsigned int irq) | ||
{ | ||
/* IRQ enable */ | ||
HW_ICOLL_INTERRUPTn_SET(irq, BM_ICOLL_INTERRUPTn_ENABLE); | ||
} | ||
|
||
static struct irq_chip stmp378x_chip = { | ||
.ack = stmp378x_ack_irq, | ||
.mask = stmp378x_mask_irq, | ||
.unmask = stmp378x_unmask_irq, | ||
}; | ||
|
||
void __init stmp378x_init_irq(void) | ||
{ | ||
stmp3xxx_init_irq(&stmp378x_chip); | ||
} | ||
|
||
/* | ||
* DMA interrupt handling | ||
*/ | ||
void stmp3xxx_arch_dma_enable_interrupt(int channel) | ||
{ | ||
int dmabus = channel / 16; | ||
|
||
switch (dmabus) { | ||
case STMP3XXX_BUS_APBH: | ||
HW_APBH_CTRL1_SET(1 << (16 + (channel % 16))); | ||
HW_APBH_CTRL2_SET(1 << (16 + (channel % 16))); | ||
break; | ||
|
||
case STMP3XXX_BUS_APBX: | ||
HW_APBX_CTRL1_SET(1 << (16 + (channel % 16))); | ||
HW_APBX_CTRL2_SET(1 << (16 + (channel % 16))); | ||
break; | ||
} | ||
} | ||
EXPORT_SYMBOL(stmp3xxx_arch_dma_enable_interrupt); | ||
|
||
void stmp3xxx_arch_dma_clear_interrupt(int channel) | ||
{ | ||
int dmabus = channel / 16; | ||
|
||
switch (dmabus) { | ||
case STMP3XXX_BUS_APBH: | ||
HW_APBH_CTRL1_CLR(1 << (channel % 16)); | ||
HW_APBH_CTRL2_CLR(1 << (channel % 16)); | ||
break; | ||
|
||
case STMP3XXX_BUS_APBX: | ||
HW_APBX_CTRL1_CLR(1 << (channel % 16)); | ||
HW_APBX_CTRL2_CLR(1 << (channel % 16)); | ||
break; | ||
} | ||
} | ||
EXPORT_SYMBOL(stmp3xxx_arch_dma_clear_interrupt); | ||
|
||
int stmp3xxx_arch_dma_is_interrupt(int channel) | ||
{ | ||
int dmabus = channel / 16; | ||
int r = 0; | ||
|
||
switch (dmabus) { | ||
case STMP3XXX_BUS_APBH: | ||
r = HW_APBH_CTRL1_RD() & (1 << (channel % 16)); | ||
break; | ||
|
||
case STMP3XXX_BUS_APBX: | ||
r = HW_APBX_CTRL1_RD() & (1 << (channel % 16)); | ||
break; | ||
} | ||
return r; | ||
} | ||
EXPORT_SYMBOL(stmp3xxx_arch_dma_is_interrupt); | ||
|
||
void stmp3xxx_arch_dma_reset_channel(int channel) | ||
{ | ||
int dmabus = channel / 16; | ||
unsigned chbit = 1 << (channel % 16); | ||
|
||
switch (dmabus) { | ||
case STMP3XXX_BUS_APBH: | ||
/* Reset channel and wait for it to complete */ | ||
HW_APBH_CTRL0_SET(chbit << | ||
BP_APBH_CTRL0_RESET_CHANNEL); | ||
while (HW_APBH_CTRL0_RD() & | ||
(chbit << BP_APBH_CTRL0_RESET_CHANNEL)) | ||
continue; | ||
break; | ||
|
||
case STMP3XXX_BUS_APBX: | ||
/* Reset channel and wait for it to complete */ | ||
HW_APBX_CHANNEL_CTRL_SET( | ||
BF_APBX_CHANNEL_CTRL_RESET_CHANNEL(chbit)); | ||
while (HW_APBX_CHANNEL_CTRL_RD() & | ||
BF_APBX_CHANNEL_CTRL_RESET_CHANNEL(chbit)) | ||
continue; | ||
break; | ||
} | ||
} | ||
EXPORT_SYMBOL(stmp3xxx_arch_dma_reset_channel); | ||
|
||
void stmp3xxx_arch_dma_freeze(int channel) | ||
{ | ||
int dmabus = channel / 16; | ||
unsigned chbit = 1 << (channel % 16); | ||
|
||
switch (dmabus) { | ||
case STMP3XXX_BUS_APBH: | ||
HW_APBH_CTRL0_SET(1<<chbit); | ||
break; | ||
case STMP3XXX_BUS_APBX: | ||
HW_APBX_CHANNEL_CTRL_SET(1<<chbit); | ||
break; | ||
} | ||
} | ||
EXPORT_SYMBOL(stmp3xxx_arch_dma_freeze); | ||
|
||
void stmp3xxx_arch_dma_unfreeze(int channel) | ||
{ | ||
int dmabus = channel / 16; | ||
unsigned chbit = 1 << (channel % 16); | ||
|
||
switch (dmabus) { | ||
case STMP3XXX_BUS_APBH: | ||
HW_APBH_CTRL0_CLR(1<<chbit); | ||
break; | ||
case STMP3XXX_BUS_APBX: | ||
HW_APBX_CHANNEL_CTRL_CLR(1<<chbit); | ||
break; | ||
} | ||
} | ||
EXPORT_SYMBOL(stmp3xxx_arch_dma_unfreeze); | ||
|
||
/* | ||
* The registers are all very closely mapped, so we might as well map them all | ||
* with a single mapping | ||
* | ||
* Logical Physical | ||
* f0000000 80000000 On-chip registers | ||
* f1000000 00000000 256k on-chip SRAM | ||
*/ | ||
|
||
static struct map_desc stmp378x_io_desc[] __initdata = { | ||
{ | ||
.virtual = (u32)STMP3XXX_REGS_BASE, | ||
.pfn = __phys_to_pfn(STMP3XXX_REGS_PHBASE), | ||
.length = STMP3XXX_REGS_SIZE, | ||
.type = MT_DEVICE, | ||
}, | ||
{ | ||
.virtual = (u32)STMP3XXX_OCRAM_BASE, | ||
.pfn = __phys_to_pfn(STMP3XXX_OCRAM_PHBASE), | ||
.length = STMP3XXX_OCRAM_SIZE, | ||
.type = MT_DEVICE, | ||
}, | ||
}; | ||
|
||
void __init stmp378x_map_io(void) | ||
{ | ||
iotable_init(stmp378x_io_desc, ARRAY_SIZE(stmp378x_io_desc)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Freescale STMP37XX/STMP378X internal functions and data declarations | ||
* | ||
* Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __MACH_STMP378X_H | ||
#define __MACH_STMP378X_H | ||
|
||
void stmp378x_map_io(void); | ||
void stmp378x_init_irq(void); | ||
|
||
#endif /* __MACH_STMP378X_COMMON_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Freescale STMP378X development board support | ||
* | ||
* Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#include <linux/kernel.h> | ||
#include <linux/init.h> | ||
#include <linux/platform_device.h> | ||
|
||
#include <asm/setup.h> | ||
#include <asm/mach-types.h> | ||
#include <asm/mach/arch.h> | ||
|
||
#include <mach/pins.h> | ||
#include <mach/pinmux.h> | ||
#include <mach/stmp3xxx.h> | ||
|
||
#include "stmp378x.h" | ||
|
||
static struct platform_device *devices[] = { | ||
&stmp3xxx_dbguart, | ||
}; | ||
|
||
static struct pin_desc dbguart_pins_0[] = { | ||
{ PINID_PWM0, PIN_FUN3, }, | ||
{ PINID_PWM1, PIN_FUN3, }, | ||
}; | ||
|
||
static struct pin_group dbguart_pins[] = { | ||
[0] = { | ||
.pins = dbguart_pins_0, | ||
.nr_pins = ARRAY_SIZE(dbguart_pins_0), | ||
}, | ||
}; | ||
|
||
static int dbguart_pins_control(int id, int request) | ||
{ | ||
int r = 0; | ||
|
||
if (request) | ||
r = stmp3xxx_request_pin_group(&dbguart_pins[id], "debug uart"); | ||
else | ||
stmp3xxx_release_pin_group(&dbguart_pins[id], "debug uart"); | ||
return r; | ||
} | ||
|
||
static void __init stmp378x_devb_init(void) | ||
{ | ||
stmp3xxx_pinmux_init(NR_REAL_IRQS); | ||
|
||
/* init stmp3xxx platform */ | ||
stmp3xxx_init(); | ||
|
||
stmp3xxx_dbguart.dev.platform_data = dbguart_pins_control; | ||
|
||
/* add board's devices */ | ||
platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
} | ||
|
||
MACHINE_START(STMP378X, "STMP378X") | ||
.phys_io = 0x80000000, | ||
.io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, | ||
.boot_params = 0x40000100, | ||
.map_io = stmp378x_map_io, | ||
.init_irq = stmp378x_init_irq, | ||
.timer = &stmp3xxx_timer, | ||
.init_machine = stmp378x_devb_init, | ||
MACHINE_END |