Commit 77208e3f authored by Tony Lindgren's avatar Tony Lindgren Committed by Russell King

[ARM PATCH] 2336/1: OMAP update 1/2: Arch files, take 2

Patch from Tony Lindgren

This patch syncs the mainline kernel with the linux-omap tree.
The highlights of the patch are:
- Add OMAP board specific low-level init functions for smc91x Ethernet
- DMA audio functions by Nishant Menon
- Remove references to OMAP specific serial.h

This is an updated version of ARM patch 2331/1 with extra comments
added to the omap_get_dma_src_pos() and omap_get_dma_dst_pos() functions
as recommended by RMK.

Signed-off-by: Tony Lindgren
Signed-off-by: Russell King
parent 54b1a3dc
......@@ -32,10 +32,11 @@
#include <asm/arch/clocks.h>
#include <asm/arch/gpio.h>
#include <asm/arch/usb.h>
#include <asm/arch/serial.h>
#include "common.h"
extern int omap_gpio_init(void);
static int __initdata h2_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
static struct resource h2_smc91x_resources[] = {
......@@ -45,8 +46,8 @@ static struct resource h2_smc91x_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0, /* Really GPIO 0 */
.end = 0,
.start = OMAP_GPIO_IRQ(0),
.end = OMAP_GPIO_IRQ(0),
.flags = IORESOURCE_IRQ,
},
};
......@@ -62,9 +63,20 @@ static struct platform_device *h2_devices[] __initdata = {
&h2_smc91x_device,
};
static void __init h2_init_smc91x(void)
{
if ((omap_request_gpio(0)) < 0) {
printk("Error requesting gpio 0 for smc91x irq\n");
return;
}
omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE);
}
void h2_init_irq(void)
{
omap_init_irq();
omap_gpio_init();
h2_init_smc91x();
}
static struct omap_usb_config h2_usb_config __initdata = {
......
......@@ -28,16 +28,13 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/arch/irqs.h>
#include <asm/arch/mux.h>
#include <asm/arch/gpio.h>
#include <asm/mach-types.h>
#include <asm/arch/serial.h>
#include "common.h"
void h3_init_irq(void)
{
omap_init_irq();
}
extern int omap_gpio_init(void);
static int __initdata h3_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
......@@ -48,8 +45,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0,
.end = 0,
.start = OMAP_GPIO_IRQ(40),
.end = OMAP_GPIO_IRQ(40),
.flags = IORESOURCE_IRQ,
},
};
......@@ -70,6 +67,23 @@ static void __init h3_init(void)
(void) platform_add_devices(devices, ARRAY_SIZE(devices));
}
static void __init h3_init_smc91x(void)
{
omap_cfg_reg(W15_1710_GPIO40);
if (omap_request_gpio(40) < 0) {
printk("Error requesting gpio 40 for smc91x irq\n");
return;
}
omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE);
}
void h3_init_irq(void)
{
omap_init_irq();
omap_gpio_init();
h3_init_smc91x();
}
static void __init h3_map_io(void)
{
omap_map_io();
......
......@@ -30,13 +30,12 @@
#include <asm/arch/gpio.h>
#include <asm/arch/fpga.h>
#include <asm/arch/usb.h>
#include <asm/arch/serial.h>
#include "common.h"
#ifdef CONFIG_ARCH_OMAP1510
static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
extern int omap_gpio_init(void);
#ifdef CONFIG_ARCH_OMAP1510
/* Only FPGA needs to be mapped here. All others are done with ioremap */
static struct map_desc innovator1510_io_desc[] __initdata = {
......@@ -44,8 +43,6 @@ static struct map_desc innovator1510_io_desc[] __initdata = {
MT_DEVICE },
};
static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
static struct resource innovator1510_smc91x_resources[] = {
[0] = {
.start = OMAP1510_FPGA_ETHR_START, /* Physical */
......@@ -81,8 +78,8 @@ static struct resource innovator1610_smc91x_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0, /* Really GPIO 0 */
.end = 0,
.start = OMAP_GPIO_IRQ(0),
.end = OMAP_GPIO_IRQ(0),
.flags = IORESOURCE_IRQ,
},
};
......@@ -100,15 +97,31 @@ static struct platform_device *innovator1610_devices[] __initdata = {
#endif /* CONFIG_ARCH_OMAP16XX */
static void __init innovator_init_smc91x(void)
{
if (cpu_is_omap1510()) {
fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
OMAP1510_FPGA_RST);
udelay(750);
} else {
if ((omap_request_gpio(0)) < 0) {
printk("Error requesting gpio 0 for smc91x irq\n");
return;
}
omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
}
}
void innovator_init_irq(void)
{
omap_init_irq();
omap_gpio_init();
#ifdef CONFIG_ARCH_OMAP1510
if (cpu_is_omap1510()) {
omap_gpio_init();
omap1510_fpga_init_irq();
}
#endif
innovator_init_smc91x();
}
#ifdef CONFIG_ARCH_OMAP1510
......
......@@ -39,7 +39,6 @@
#include <asm/arch/gpio.h>
#include <asm/arch/fpga.h>
#include <asm/arch/usb.h>
#include <asm/arch/serial.h>
#include "common.h"
......@@ -57,8 +56,8 @@ static struct resource osk5912_smc91x_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0, /* Really GPIO 0 */
.end = 0,
.start = OMAP_GPIO_IRQ(0),
.end = OMAP_GPIO_IRQ(0),
.flags = IORESOURCE_IRQ,
},
};
......@@ -74,9 +73,20 @@ static struct platform_device *osk5912_devices[] __initdata = {
&osk5912_smc91x_device,
};
static void __init osk_init_smc91x(void)
{
if ((omap_request_gpio(0)) < 0) {
printk("Error requesting gpio 0 for smc91x irq\n");
return;
}
omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
}
void osk_init_irq(void)
{
omap_init_irq();
omap_gpio_init();
osk_init_smc91x();
}
static struct omap_usb_config osk_usb_config __initdata = {
......
......@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
......@@ -28,11 +29,6 @@
#include "common.h"
void omap_perseus2_init_irq(void)
{
omap_init_irq();
}
static struct resource smc91x_resources[] = {
[0] = {
.start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
......@@ -64,6 +60,22 @@ static void __init omap_perseus2_init(void)
(void) platform_add_devices(devices, ARRAY_SIZE(devices));
}
static void __init perseus2_init_smc91x(void)
{
fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
H2P2_DBG_FPGA_LAN_RESET);
mdelay(50);
}
void omap_perseus2_init_irq(void)
{
omap_init_irq();
omap_gpio_init();
perseus2_init_smc91x();
}
/* Only FPGA needs to be mapped here. All others are done with ioremap */
static struct map_desc omap_perseus2_io_desc[] __initdata = {
{H2P2_DBG_FPGA_BASE, H2P2_DBG_FPGA_START, H2P2_DBG_FPGA_SIZE,
......
......@@ -30,8 +30,6 @@
#include <asm/arch/board.h>
#include <asm/arch/mux.h>
#include <asm/arch/fpga.h>
#include <asm/arch/serial.h>
#include "clock.h"
......@@ -307,14 +305,14 @@ void omap_map_io(void)
_omap_map_io();
}
static inline unsigned int omap_serial_in(struct plat_serial8250_port *up,
static inline unsigned int omap_serial_in(struct plat_serial8250_port *up,
int offset)
{
offset <<= up->regshift;
return (unsigned int)__raw_readb(up->membase + offset);
}
static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
int value)
{
offset <<= p->regshift;
......@@ -323,12 +321,14 @@ static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
/*
* Internal UARTs need to be initialized for the 8250 autoconfig to work
* properly.
* properly. Note that the TX watermark initialization may not be needed
* once the 8250.c watermark handling code is merged.
*/
static void __init omap_serial_reset(struct plat_serial8250_port *p)
{
omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */
omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */
omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */
omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
if (!cpu_is_omap1510()) {
omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
......
......@@ -6,6 +6,7 @@
* DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
* Graphics DMA and LCD DMA graphics tranformations
* by Imre Deak <imre.deak@nokia.com>
* Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
*
* Support functions for the OMAP internal DMA channels.
*
......@@ -477,10 +478,6 @@ int omap_request_dma(int dev_id, const char *dev_name,
if (dev_id == 0)
break;
}
if (dev_id != 0 && dma_chan[ch].dev_id == dev_id) {
spin_unlock_irqrestore(&dma_chan_lock, flags);
return -EAGAIN;
}
}
if (free_ch == -1) {
spin_unlock_irqrestore(&dma_chan_lock, flags);
......@@ -931,6 +928,50 @@ void omap_stop_lcd_dma(void)
OMAP1610_DMA_LCD_CCR);
}
/*
* Clears any DMA state so the DMA engine is ready to restart with new buffers
* through omap_start_dma(). Any buffers in flight are discarded.
*/
void omap_clear_dma(int lch)
{
unsigned long flags;
int status;
local_irq_save(flags);
omap_writew(omap_readw(OMAP_DMA_CCR(lch)) & ~OMAP_DMA_CCR_EN,
OMAP_DMA_CCR(lch));
status = OMAP_DMA_CSR(lch); /* clear pending interrupts */
local_irq_restore(flags);
}
/*
* Returns current physical source address for the given DMA channel.
* If the channel is running the caller must disable interrupts prior calling
* this function and process the returned value before re-enabling interrupt to
* prevent races with the interrupt handler. Note that in continuous mode there
* is a chance for CSSA_L register overflow inbetween the two reads resulting
* in incorrect return value.
*/
dma_addr_t omap_get_dma_src_pos(int lch)
{
return (dma_addr_t) (OMAP_DMA_CSSA_L(lch) |
(OMAP_DMA_CSSA_U(lch) << 16));
}
/*
* Returns current physical destination address for the given DMA channel.
* If the channel is running the caller must disable interrupts prior calling
* this function and process the returned value before re-enabling interrupt to
* prevent races with the interrupt handler. Note that in continuous mode there
* is a chance for CDSA_L register overflow inbetween the two reads resulting
* in incorrect return value.
*/
dma_addr_t omap_get_dma_dst_pos(int lch)
{
return (dma_addr_t) (OMAP_DMA_CDSA_L(lch) |
(OMAP_DMA_CDSA_U(lch) << 16));
}
static int __init omap_init_dma(void)
{
int ch, r;
......@@ -999,9 +1040,13 @@ static int __init omap_init_dma(void)
}
return 0;
}
arch_initcall(omap_init_dma);
EXPORT_SYMBOL(omap_get_dma_src_pos);
EXPORT_SYMBOL(omap_get_dma_dst_pos);
EXPORT_SYMBOL(omap_clear_dma);
EXPORT_SYMBOL(omap_set_dma_priority);
EXPORT_SYMBOL(omap_request_dma);
EXPORT_SYMBOL(omap_free_dma);
......
......@@ -81,6 +81,12 @@ void omap_pm_idle(void)
mask32 = omap_readl(ARM_SYSST);
local_fiq_enable();
local_irq_enable();
#if defined(CONFIG_OMAP_32K_TIMER) && defined(CONFIG_NO_IDLE_HZ)
/* Override timer to use VST for the next cycle */
omap_32k_timer_next_vst_interrupt();
#endif
if ((mask32 & DSP_IDLE) == 0) {
__asm__ volatile ("mcr p15, 0, r0, c7, c0, 4");
} else {
......@@ -508,7 +514,7 @@ static void omap_pm_init_proc(void)
*/
//#include <asm/arch/hardware.h>
static int omap_pm_prepare(u32 state)
static int omap_pm_prepare(suspend_state_t state)
{
int error = 0;
......@@ -535,7 +541,7 @@ static int omap_pm_prepare(u32 state)
*
*/
static int omap_pm_enter(u32 state)
static int omap_pm_enter(suspend_state_t state)
{
switch (state)
{
......@@ -563,7 +569,7 @@ static int omap_pm_enter(u32 state)
* failed).
*/
static int omap_pm_finish(u32 state)
static int omap_pm_finish(suspend_state_t state)
{
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment