mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-09-08 09:08:05 -04:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
338
arch/arm/plat-samsung/Kconfig
Normal file
338
arch/arm/plat-samsung/Kconfig
Normal file
|
@ -0,0 +1,338 @@
|
|||
# arch/arm/plat-samsung/Kconfig
|
||||
#
|
||||
# Copyright 2009 Simtec Electronics
|
||||
#
|
||||
# Licensed under GPLv2
|
||||
|
||||
config PLAT_SAMSUNG
|
||||
bool
|
||||
depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_EXYNOS || ARCH_S5PV210
|
||||
default y
|
||||
select GENERIC_IRQ_CHIP
|
||||
select NO_IOPORT_MAP
|
||||
help
|
||||
Base platform code for all Samsung SoC based systems
|
||||
|
||||
config SAMSUNG_PM
|
||||
bool
|
||||
depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX)
|
||||
default y
|
||||
help
|
||||
Base platform power management code for samsung code
|
||||
|
||||
if PLAT_SAMSUNG
|
||||
menu "Samsung Common options"
|
||||
|
||||
# boot configurations
|
||||
|
||||
comment "Boot options"
|
||||
|
||||
config S3C_LOWLEVEL_UART_PORT
|
||||
int "S3C UART to use for low-level messages"
|
||||
depends on ARCH_S3C64XX
|
||||
default 0
|
||||
help
|
||||
Choice of which UART port to use for the low-level messages,
|
||||
such as the `Uncompressing...` at start time. The value of
|
||||
this configuration should be between zero and two. The port
|
||||
must have been initialised by the boot-loader before use.
|
||||
|
||||
config SAMSUNG_ATAGS
|
||||
def_bool n
|
||||
depends on !ARCH_MULTIPLATFORM
|
||||
depends on ATAGS
|
||||
help
|
||||
This option enables ATAGS based boot support code for
|
||||
Samsung platforms, including static platform devices, legacy
|
||||
clock, timer and interrupt initialization, etc.
|
||||
|
||||
Platforms that support only DT based boot need not to select
|
||||
this option.
|
||||
|
||||
if SAMSUNG_ATAGS
|
||||
|
||||
config S3C_GPIO_SPACE
|
||||
int "Space between gpio banks"
|
||||
default 0
|
||||
help
|
||||
Add a number of spare GPIO entries between each bank for debugging
|
||||
purposes. This allows any problems where an counter overflows from
|
||||
one bank to another to be caught, at the expense of using a little
|
||||
more memory.
|
||||
|
||||
config S3C_GPIO_TRACK
|
||||
bool
|
||||
help
|
||||
Internal configuration option to enable the s3c specific gpio
|
||||
chip tracking if the platform requires it.
|
||||
|
||||
# ADC driver
|
||||
|
||||
config S3C_ADC
|
||||
bool "ADC common driver support"
|
||||
help
|
||||
Core support for the ADC block found in the Samsung SoC systems
|
||||
for drivers such as the touchscreen and hwmon to use to share
|
||||
this resource.
|
||||
|
||||
# device definitions to compile in
|
||||
|
||||
config S3C_DEV_HSMMC
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for HSMMC code
|
||||
|
||||
config S3C_DEV_HSMMC1
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for HSMMC channel 1
|
||||
|
||||
config S3C_DEV_HSMMC2
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for HSMMC channel 2
|
||||
|
||||
config S3C_DEV_HSMMC3
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for HSMMC channel 3
|
||||
|
||||
config S3C_DEV_HWMON
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for HWMON
|
||||
|
||||
config S3C_DEV_I2C1
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for I2C channel 1
|
||||
|
||||
config S3C_DEV_I2C2
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for I2C channel 2
|
||||
|
||||
config S3C_DEV_I2C3
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for I2C controller 3
|
||||
|
||||
config S3C_DEV_I2C4
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for I2C controller 4
|
||||
|
||||
config S3C_DEV_I2C5
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for I2C controller 5
|
||||
|
||||
config S3C_DEV_I2C6
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for I2C controller 6
|
||||
|
||||
config S3C_DEV_I2C7
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for I2C controller 7
|
||||
|
||||
config S3C_DEV_FB
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for framebuffer
|
||||
|
||||
config S3C_DEV_USB_HOST
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for USB host.
|
||||
|
||||
config S3C_DEV_USB_HSOTG
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for USB high-speed OtG
|
||||
|
||||
config S3C_DEV_WDT
|
||||
bool
|
||||
default y if ARCH_S3C24XX
|
||||
help
|
||||
Complie in platform device definition for Watchdog Timer
|
||||
|
||||
config S3C_DEV_NAND
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for NAND controller
|
||||
|
||||
config S3C_DEV_ONENAND
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for OneNAND controller
|
||||
|
||||
config S3C_DEV_RTC
|
||||
bool
|
||||
help
|
||||
Complie in platform device definition for RTC
|
||||
|
||||
config SAMSUNG_DEV_ADC
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for ADC controller
|
||||
|
||||
config SAMSUNG_DEV_IDE
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for IDE
|
||||
|
||||
config S3C64XX_DEV_SPI0
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for S3C64XX's type
|
||||
SPI controller 0
|
||||
|
||||
config S3C64XX_DEV_SPI1
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for S3C64XX's type
|
||||
SPI controller 1
|
||||
|
||||
config S3C64XX_DEV_SPI2
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for S3C64XX's type
|
||||
SPI controller 2
|
||||
|
||||
config SAMSUNG_DEV_TS
|
||||
bool
|
||||
help
|
||||
Common in platform device definitions for touchscreen device
|
||||
|
||||
config SAMSUNG_DEV_KEYPAD
|
||||
bool
|
||||
help
|
||||
Compile in platform device definitions for keypad
|
||||
|
||||
config SAMSUNG_DEV_PWM
|
||||
bool
|
||||
default y if ARCH_S3C24XX
|
||||
help
|
||||
Compile in platform device definition for PWM Timer
|
||||
|
||||
config SAMSUNG_DEV_BACKLIGHT
|
||||
bool
|
||||
depends on SAMSUNG_DEV_PWM
|
||||
help
|
||||
Compile in platform device definition LCD backlight with PWM Timer
|
||||
|
||||
config S3C24XX_PWM
|
||||
bool "PWM device support"
|
||||
select PWM
|
||||
select PWM_SAMSUNG
|
||||
help
|
||||
Support for exporting the PWM timer blocks via the pwm device
|
||||
system
|
||||
|
||||
config S3C_SETUP_CAMIF
|
||||
bool
|
||||
help
|
||||
Compile in common setup code for S3C CAMIF devices
|
||||
|
||||
# DMA
|
||||
|
||||
config S3C_DMA
|
||||
bool
|
||||
help
|
||||
Internal configuration for S3C DMA core
|
||||
|
||||
config SAMSUNG_PM_GPIO
|
||||
bool
|
||||
default y if GPIO_SAMSUNG && PM
|
||||
help
|
||||
Include legacy GPIO power management code for platforms not using
|
||||
pinctrl-samsung driver.
|
||||
|
||||
config SAMSUNG_DMADEV
|
||||
bool "Use legacy Samsung DMA abstraction"
|
||||
depends on CPU_S5PV210 || ARCH_S3C64XX
|
||||
select DMADEVICES
|
||||
default y
|
||||
help
|
||||
Use DMA device engine for PL330 DMAC.
|
||||
|
||||
endif
|
||||
|
||||
config S5P_DEV_MFC
|
||||
bool
|
||||
help
|
||||
Compile in setup memory (init) code for MFC
|
||||
|
||||
comment "Power management"
|
||||
|
||||
config SAMSUNG_PM_DEBUG
|
||||
bool "Samsung PM Suspend debug"
|
||||
depends on PM && DEBUG_KERNEL
|
||||
depends on DEBUG_EXYNOS_UART || DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
|
||||
help
|
||||
Say Y here if you want verbose debugging from the PM Suspend and
|
||||
Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
|
||||
for more information.
|
||||
|
||||
config S3C_PM_DEBUG_LED_SMDK
|
||||
bool "SMDK LED suspend/resume debugging"
|
||||
depends on PM && (MACH_SMDK6410)
|
||||
help
|
||||
Say Y here to enable the use of the SMDK LEDs on the baseboard
|
||||
for debugging of the state of the suspend and resume process.
|
||||
|
||||
Note, this currently only works for S3C64XX based SMDK boards.
|
||||
|
||||
config SAMSUNG_PM_CHECK
|
||||
bool "S3C2410 PM Suspend Memory CRC"
|
||||
depends on PM
|
||||
select CRC32
|
||||
help
|
||||
Enable the PM code's memory area checksum over sleep. This option
|
||||
will generate CRCs of all blocks of memory, and store them before
|
||||
going to sleep. The blocks are then checked on resume for any
|
||||
errors.
|
||||
|
||||
Note, this can take several seconds depending on memory size
|
||||
and CPU speed.
|
||||
|
||||
See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
|
||||
|
||||
config SAMSUNG_PM_CHECK_CHUNKSIZE
|
||||
int "S3C2410 PM Suspend CRC Chunksize (KiB)"
|
||||
depends on PM && SAMSUNG_PM_CHECK
|
||||
default 64
|
||||
help
|
||||
Set the chunksize in Kilobytes of the CRC for checking memory
|
||||
corruption over suspend and resume. A smaller value will mean that
|
||||
the CRC data block will take more memory, but wil identify any
|
||||
faults with better precision.
|
||||
|
||||
See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
|
||||
|
||||
config SAMSUNG_WAKEMASK
|
||||
bool
|
||||
depends on PM
|
||||
help
|
||||
Compile support for wakeup-mask controls found on the S3C6400
|
||||
and above. This code allows a set of interrupt to wakeup-mask
|
||||
mappings. See <plat/wakeup-mask.h>
|
||||
|
||||
config SAMSUNG_WDT_RESET
|
||||
bool
|
||||
help
|
||||
Compile support for system restart by triggering watchdog reset.
|
||||
Used on SoCs that do not provide dedicated reset control.
|
||||
|
||||
config DEBUG_S3C_UART
|
||||
depends on PLAT_SAMSUNG
|
||||
int
|
||||
default "0" if DEBUG_S3C_UART0
|
||||
default "1" if DEBUG_S3C_UART1
|
||||
default "2" if DEBUG_S3C_UART2
|
||||
default "3" if DEBUG_S3C_UART3
|
||||
|
||||
endmenu
|
||||
endif
|
44
arch/arm/plat-samsung/Makefile
Normal file
44
arch/arm/plat-samsung/Makefile
Normal file
|
@ -0,0 +1,44 @@
|
|||
# arch/arm/plat-samsung/Makefile
|
||||
#
|
||||
# Copyright 2009 Simtec Electronics
|
||||
#
|
||||
# Licensed under GPLv2
|
||||
|
||||
ccflags-$(CONFIG_ARCH_MULTI_V7) += -I$(srctree)/$(src)/include
|
||||
|
||||
# Objects we always build independent of SoC choice
|
||||
|
||||
obj-y += init.o cpu.o
|
||||
|
||||
# ADC
|
||||
|
||||
obj-$(CONFIG_S3C_ADC) += adc.o
|
||||
|
||||
# devices
|
||||
|
||||
obj-$(CONFIG_SAMSUNG_ATAGS) += platformdata.o
|
||||
|
||||
obj-$(CONFIG_SAMSUNG_ATAGS) += devs.o
|
||||
obj-$(CONFIG_SAMSUNG_ATAGS) += dev-uart.o
|
||||
obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o
|
||||
|
||||
obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o
|
||||
|
||||
obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o
|
||||
|
||||
# DMA support
|
||||
|
||||
obj-$(CONFIG_S3C_DMA) += dma.o s3c-dma-ops.o
|
||||
|
||||
obj-$(CONFIG_SAMSUNG_DMADEV) += dma-ops.o
|
||||
|
||||
# PM support
|
||||
|
||||
obj-$(CONFIG_PM_SLEEP) += pm-common.o
|
||||
obj-$(CONFIG_SAMSUNG_PM) += pm.o
|
||||
obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o
|
||||
obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
|
||||
obj-$(CONFIG_SAMSUNG_PM_DEBUG) += pm-debug.o
|
||||
|
||||
obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
|
||||
obj-$(CONFIG_SAMSUNG_WDT_RESET) += watchdog-reset.o
|
526
arch/arm/plat-samsung/adc.c
Normal file
526
arch/arm/plat-samsung/adc.c
Normal file
|
@ -0,0 +1,526 @@
|
|||
/* arch/arm/plat-samsung/adc.c
|
||||
*
|
||||
* Copyright (c) 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
|
||||
*
|
||||
* Samsung ADC device core
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include <plat/regs-adc.h>
|
||||
#include <plat/adc.h>
|
||||
|
||||
/* This driver is designed to control the usage of the ADC block between
|
||||
* the touchscreen and any other drivers that may need to use it, such as
|
||||
* the hwmon driver.
|
||||
*
|
||||
* Priority will be given to the touchscreen driver, but as this itself is
|
||||
* rate limited it should not starve other requests which are processed in
|
||||
* order that they are received.
|
||||
*
|
||||
* Each user registers to get a client block which uniquely identifies it
|
||||
* and stores information such as the necessary functions to callback when
|
||||
* action is required.
|
||||
*/
|
||||
|
||||
enum s3c_cpu_type {
|
||||
TYPE_ADCV1, /* S3C24XX */
|
||||
TYPE_ADCV11, /* S3C2443 */
|
||||
TYPE_ADCV12, /* S3C2416, S3C2450 */
|
||||
TYPE_ADCV2, /* S3C64XX */
|
||||
TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
|
||||
};
|
||||
|
||||
struct s3c_adc_client {
|
||||
struct platform_device *pdev;
|
||||
struct list_head pend;
|
||||
wait_queue_head_t *wait;
|
||||
|
||||
unsigned int nr_samples;
|
||||
int result;
|
||||
unsigned char is_ts;
|
||||
unsigned char channel;
|
||||
|
||||
void (*select_cb)(struct s3c_adc_client *c, unsigned selected);
|
||||
void (*convert_cb)(struct s3c_adc_client *c,
|
||||
unsigned val1, unsigned val2,
|
||||
unsigned *samples_left);
|
||||
};
|
||||
|
||||
struct adc_device {
|
||||
struct platform_device *pdev;
|
||||
struct platform_device *owner;
|
||||
struct clk *clk;
|
||||
struct s3c_adc_client *cur;
|
||||
struct s3c_adc_client *ts_pend;
|
||||
void __iomem *regs;
|
||||
spinlock_t lock;
|
||||
|
||||
unsigned int prescale;
|
||||
|
||||
int irq;
|
||||
struct regulator *vdd;
|
||||
};
|
||||
|
||||
static struct adc_device *adc_dev;
|
||||
|
||||
static LIST_HEAD(adc_pending); /* protected by adc_device.lock */
|
||||
|
||||
#define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
|
||||
|
||||
static inline void s3c_adc_convert(struct adc_device *adc)
|
||||
{
|
||||
unsigned con = readl(adc->regs + S3C2410_ADCCON);
|
||||
|
||||
con |= S3C2410_ADCCON_ENABLE_START;
|
||||
writel(con, adc->regs + S3C2410_ADCCON);
|
||||
}
|
||||
|
||||
static inline void s3c_adc_select(struct adc_device *adc,
|
||||
struct s3c_adc_client *client)
|
||||
{
|
||||
unsigned con = readl(adc->regs + S3C2410_ADCCON);
|
||||
enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
|
||||
|
||||
client->select_cb(client, 1);
|
||||
|
||||
if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
|
||||
con &= ~S3C2410_ADCCON_MUXMASK;
|
||||
con &= ~S3C2410_ADCCON_STDBM;
|
||||
con &= ~S3C2410_ADCCON_STARTMASK;
|
||||
|
||||
if (!client->is_ts) {
|
||||
if (cpu == TYPE_ADCV3)
|
||||
writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
|
||||
else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12)
|
||||
writel(client->channel & 0xf,
|
||||
adc->regs + S3C2443_ADCMUX);
|
||||
else
|
||||
con |= S3C2410_ADCCON_SELMUX(client->channel);
|
||||
}
|
||||
|
||||
writel(con, adc->regs + S3C2410_ADCCON);
|
||||
}
|
||||
|
||||
static void s3c_adc_dbgshow(struct adc_device *adc)
|
||||
{
|
||||
adc_dbg(adc, "CON=%08x, TSC=%08x, DLY=%08x\n",
|
||||
readl(adc->regs + S3C2410_ADCCON),
|
||||
readl(adc->regs + S3C2410_ADCTSC),
|
||||
readl(adc->regs + S3C2410_ADCDLY));
|
||||
}
|
||||
|
||||
static void s3c_adc_try(struct adc_device *adc)
|
||||
{
|
||||
struct s3c_adc_client *next = adc->ts_pend;
|
||||
|
||||
if (!next && !list_empty(&adc_pending)) {
|
||||
next = list_first_entry(&adc_pending,
|
||||
struct s3c_adc_client, pend);
|
||||
list_del(&next->pend);
|
||||
} else
|
||||
adc->ts_pend = NULL;
|
||||
|
||||
if (next) {
|
||||
adc_dbg(adc, "new client is %p\n", next);
|
||||
adc->cur = next;
|
||||
s3c_adc_select(adc, next);
|
||||
s3c_adc_convert(adc);
|
||||
s3c_adc_dbgshow(adc);
|
||||
}
|
||||
}
|
||||
|
||||
int s3c_adc_start(struct s3c_adc_client *client,
|
||||
unsigned int channel, unsigned int nr_samples)
|
||||
{
|
||||
struct adc_device *adc = adc_dev;
|
||||
unsigned long flags;
|
||||
|
||||
if (!adc) {
|
||||
printk(KERN_ERR "%s: failed to find adc\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&adc->lock, flags);
|
||||
|
||||
if (client->is_ts && adc->ts_pend) {
|
||||
spin_unlock_irqrestore(&adc->lock, flags);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
client->channel = channel;
|
||||
client->nr_samples = nr_samples;
|
||||
|
||||
if (client->is_ts)
|
||||
adc->ts_pend = client;
|
||||
else
|
||||
list_add_tail(&client->pend, &adc_pending);
|
||||
|
||||
if (!adc->cur)
|
||||
s3c_adc_try(adc);
|
||||
|
||||
spin_unlock_irqrestore(&adc->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(s3c_adc_start);
|
||||
|
||||
static void s3c_convert_done(struct s3c_adc_client *client,
|
||||
unsigned v, unsigned u, unsigned *left)
|
||||
{
|
||||
client->result = v;
|
||||
wake_up(client->wait);
|
||||
}
|
||||
|
||||
int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch)
|
||||
{
|
||||
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
|
||||
int ret;
|
||||
|
||||
client->convert_cb = s3c_convert_done;
|
||||
client->wait = &wake;
|
||||
client->result = -1;
|
||||
|
||||
ret = s3c_adc_start(client, ch, 1);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
ret = wait_event_timeout(wake, client->result >= 0, HZ / 2);
|
||||
if (client->result < 0) {
|
||||
ret = -ETIMEDOUT;
|
||||
goto err;
|
||||
}
|
||||
|
||||
client->convert_cb = NULL;
|
||||
return client->result;
|
||||
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(s3c_adc_read);
|
||||
|
||||
static void s3c_adc_default_select(struct s3c_adc_client *client,
|
||||
unsigned select)
|
||||
{
|
||||
}
|
||||
|
||||
struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
|
||||
void (*select)(struct s3c_adc_client *client,
|
||||
unsigned int selected),
|
||||
void (*conv)(struct s3c_adc_client *client,
|
||||
unsigned d0, unsigned d1,
|
||||
unsigned *samples_left),
|
||||
unsigned int is_ts)
|
||||
{
|
||||
struct s3c_adc_client *client;
|
||||
|
||||
WARN_ON(!pdev);
|
||||
|
||||
if (!select)
|
||||
select = s3c_adc_default_select;
|
||||
|
||||
if (!pdev)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
client = kzalloc(sizeof(struct s3c_adc_client), GFP_KERNEL);
|
||||
if (!client) {
|
||||
dev_err(&pdev->dev, "no memory for adc client\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
client->pdev = pdev;
|
||||
client->is_ts = is_ts;
|
||||
client->select_cb = select;
|
||||
client->convert_cb = conv;
|
||||
|
||||
return client;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(s3c_adc_register);
|
||||
|
||||
void s3c_adc_release(struct s3c_adc_client *client)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&adc_dev->lock, flags);
|
||||
|
||||
/* We should really check that nothing is in progress. */
|
||||
if (adc_dev->cur == client)
|
||||
adc_dev->cur = NULL;
|
||||
if (adc_dev->ts_pend == client)
|
||||
adc_dev->ts_pend = NULL;
|
||||
else {
|
||||
struct list_head *p, *n;
|
||||
struct s3c_adc_client *tmp;
|
||||
|
||||
list_for_each_safe(p, n, &adc_pending) {
|
||||
tmp = list_entry(p, struct s3c_adc_client, pend);
|
||||
if (tmp == client)
|
||||
list_del(&tmp->pend);
|
||||
}
|
||||
}
|
||||
|
||||
if (adc_dev->cur == NULL)
|
||||
s3c_adc_try(adc_dev);
|
||||
|
||||
spin_unlock_irqrestore(&adc_dev->lock, flags);
|
||||
kfree(client);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(s3c_adc_release);
|
||||
|
||||
static irqreturn_t s3c_adc_irq(int irq, void *pw)
|
||||
{
|
||||
struct adc_device *adc = pw;
|
||||
struct s3c_adc_client *client = adc->cur;
|
||||
enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
|
||||
unsigned data0, data1;
|
||||
|
||||
if (!client) {
|
||||
dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
data0 = readl(adc->regs + S3C2410_ADCDAT0);
|
||||
data1 = readl(adc->regs + S3C2410_ADCDAT1);
|
||||
adc_dbg(adc, "read %d: 0x%04x, 0x%04x\n", client->nr_samples, data0, data1);
|
||||
|
||||
client->nr_samples--;
|
||||
|
||||
if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) {
|
||||
data0 &= 0x3ff;
|
||||
data1 &= 0x3ff;
|
||||
} else {
|
||||
/* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */
|
||||
data0 &= 0xfff;
|
||||
data1 &= 0xfff;
|
||||
}
|
||||
|
||||
if (client->convert_cb)
|
||||
(client->convert_cb)(client, data0, data1, &client->nr_samples);
|
||||
|
||||
if (client->nr_samples > 0) {
|
||||
/* fire another conversion for this */
|
||||
|
||||
client->select_cb(client, 1);
|
||||
s3c_adc_convert(adc);
|
||||
} else {
|
||||
spin_lock(&adc->lock);
|
||||
(client->select_cb)(client, 0);
|
||||
adc->cur = NULL;
|
||||
|
||||
s3c_adc_try(adc);
|
||||
spin_unlock(&adc->lock);
|
||||
}
|
||||
|
||||
exit:
|
||||
if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) {
|
||||
/* Clear ADC interrupt */
|
||||
writel(0, adc->regs + S3C64XX_ADCCLRINT);
|
||||
}
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int s3c_adc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct adc_device *adc;
|
||||
struct resource *regs;
|
||||
enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
|
||||
int ret;
|
||||
unsigned tmp;
|
||||
|
||||
adc = devm_kzalloc(dev, sizeof(struct adc_device), GFP_KERNEL);
|
||||
if (adc == NULL) {
|
||||
dev_err(dev, "failed to allocate adc_device\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
spin_lock_init(&adc->lock);
|
||||
|
||||
adc->pdev = pdev;
|
||||
adc->prescale = S3C2410_ADCCON_PRSCVL(49);
|
||||
|
||||
adc->vdd = devm_regulator_get(dev, "vdd");
|
||||
if (IS_ERR(adc->vdd)) {
|
||||
dev_err(dev, "operating without regulator \"vdd\" .\n");
|
||||
return PTR_ERR(adc->vdd);
|
||||
}
|
||||
|
||||
adc->irq = platform_get_irq(pdev, 1);
|
||||
if (adc->irq <= 0) {
|
||||
dev_err(dev, "failed to get adc irq\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
ret = devm_request_irq(dev, adc->irq, s3c_adc_irq, 0, dev_name(dev),
|
||||
adc);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to attach adc irq\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
adc->clk = devm_clk_get(dev, "adc");
|
||||
if (IS_ERR(adc->clk)) {
|
||||
dev_err(dev, "failed to get adc clock\n");
|
||||
return PTR_ERR(adc->clk);
|
||||
}
|
||||
|
||||
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
adc->regs = devm_ioremap_resource(dev, regs);
|
||||
if (IS_ERR(adc->regs))
|
||||
return PTR_ERR(adc->regs);
|
||||
|
||||
ret = regulator_enable(adc->vdd);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
clk_enable(adc->clk);
|
||||
|
||||
tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
|
||||
|
||||
/* Enable 12-bit ADC resolution */
|
||||
if (cpu == TYPE_ADCV12)
|
||||
tmp |= S3C2416_ADCCON_RESSEL;
|
||||
if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
|
||||
tmp |= S3C64XX_ADCCON_RESSEL;
|
||||
|
||||
writel(tmp, adc->regs + S3C2410_ADCCON);
|
||||
|
||||
dev_info(dev, "attached adc driver\n");
|
||||
|
||||
platform_set_drvdata(pdev, adc);
|
||||
adc_dev = adc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c_adc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct adc_device *adc = platform_get_drvdata(pdev);
|
||||
|
||||
clk_disable(adc->clk);
|
||||
regulator_disable(adc->vdd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int s3c_adc_suspend(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = container_of(dev,
|
||||
struct platform_device, dev);
|
||||
struct adc_device *adc = platform_get_drvdata(pdev);
|
||||
unsigned long flags;
|
||||
u32 con;
|
||||
|
||||
spin_lock_irqsave(&adc->lock, flags);
|
||||
|
||||
con = readl(adc->regs + S3C2410_ADCCON);
|
||||
con |= S3C2410_ADCCON_STDBM;
|
||||
writel(con, adc->regs + S3C2410_ADCCON);
|
||||
|
||||
disable_irq(adc->irq);
|
||||
spin_unlock_irqrestore(&adc->lock, flags);
|
||||
clk_disable(adc->clk);
|
||||
regulator_disable(adc->vdd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c_adc_resume(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = container_of(dev,
|
||||
struct platform_device, dev);
|
||||
struct adc_device *adc = platform_get_drvdata(pdev);
|
||||
enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
|
||||
int ret;
|
||||
unsigned long tmp;
|
||||
|
||||
ret = regulator_enable(adc->vdd);
|
||||
if (ret)
|
||||
return ret;
|
||||
clk_enable(adc->clk);
|
||||
enable_irq(adc->irq);
|
||||
|
||||
tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
|
||||
|
||||
/* Enable 12-bit ADC resolution */
|
||||
if (cpu == TYPE_ADCV12)
|
||||
tmp |= S3C2416_ADCCON_RESSEL;
|
||||
if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
|
||||
tmp |= S3C64XX_ADCCON_RESSEL;
|
||||
|
||||
writel(tmp, adc->regs + S3C2410_ADCCON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#define s3c_adc_suspend NULL
|
||||
#define s3c_adc_resume NULL
|
||||
#endif
|
||||
|
||||
static struct platform_device_id s3c_adc_driver_ids[] = {
|
||||
{
|
||||
.name = "s3c24xx-adc",
|
||||
.driver_data = TYPE_ADCV1,
|
||||
}, {
|
||||
.name = "s3c2443-adc",
|
||||
.driver_data = TYPE_ADCV11,
|
||||
}, {
|
||||
.name = "s3c2416-adc",
|
||||
.driver_data = TYPE_ADCV12,
|
||||
}, {
|
||||
.name = "s3c64xx-adc",
|
||||
.driver_data = TYPE_ADCV2,
|
||||
}, {
|
||||
.name = "samsung-adc-v3",
|
||||
.driver_data = TYPE_ADCV3,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids);
|
||||
|
||||
static const struct dev_pm_ops adc_pm_ops = {
|
||||
.suspend = s3c_adc_suspend,
|
||||
.resume = s3c_adc_resume,
|
||||
};
|
||||
|
||||
static struct platform_driver s3c_adc_driver = {
|
||||
.id_table = s3c_adc_driver_ids,
|
||||
.driver = {
|
||||
.name = "s3c-adc",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &adc_pm_ops,
|
||||
},
|
||||
.probe = s3c_adc_probe,
|
||||
.remove = s3c_adc_remove,
|
||||
};
|
||||
|
||||
static int __init adc_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = platform_driver_register(&s3c_adc_driver);
|
||||
if (ret)
|
||||
printk(KERN_ERR "%s: failed to add adc driver\n", __func__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
module_init(adc_init);
|
49
arch/arm/plat-samsung/cpu.c
Normal file
49
arch/arm/plat-samsung/cpu.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* linux/arch/arm/plat-samsung/cpu.c
|
||||
*
|
||||
* Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Samsung CPU Support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/map-base.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
unsigned long samsung_cpu_id;
|
||||
static unsigned int samsung_cpu_rev;
|
||||
|
||||
unsigned int samsung_rev(void)
|
||||
{
|
||||
return samsung_cpu_rev;
|
||||
}
|
||||
EXPORT_SYMBOL(samsung_rev);
|
||||
|
||||
void __init s3c64xx_init_cpu(void)
|
||||
{
|
||||
samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0x118);
|
||||
if (!samsung_cpu_id) {
|
||||
/*
|
||||
* S3C6400 has the ID register in a different place,
|
||||
* and needs a write before it can be read.
|
||||
*/
|
||||
__raw_writel(0x0, S3C_VA_SYS + 0xA1C);
|
||||
samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0xA1C);
|
||||
}
|
||||
|
||||
samsung_cpu_rev = 0;
|
||||
}
|
||||
|
||||
void __init s5p_init_cpu(void __iomem *cpuid_addr)
|
||||
{
|
||||
samsung_cpu_id = __raw_readl(cpuid_addr);
|
||||
samsung_cpu_rev = samsung_cpu_id & 0xFF;
|
||||
}
|
152
arch/arm/plat-samsung/dev-backlight.c
Normal file
152
arch/arm/plat-samsung/dev-backlight.c
Normal file
|
@ -0,0 +1,152 @@
|
|||
/* linux/arch/arm/plat-samsung/dev-backlight.c
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Common infrastructure for PWM Backlight for Samsung boards
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/pwm_backlight.h>
|
||||
|
||||
#include <plat/devs.h>
|
||||
#include <plat/gpio-cfg.h>
|
||||
#include <plat/backlight.h>
|
||||
|
||||
struct samsung_bl_drvdata {
|
||||
struct platform_pwm_backlight_data plat_data;
|
||||
struct samsung_bl_gpio_info *gpio_info;
|
||||
};
|
||||
|
||||
static int samsung_bl_init(struct device *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
struct platform_pwm_backlight_data *pdata = dev->platform_data;
|
||||
struct samsung_bl_drvdata *drvdata = container_of(pdata,
|
||||
struct samsung_bl_drvdata, plat_data);
|
||||
struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;
|
||||
|
||||
ret = gpio_request(bl_gpio_info->no, "Backlight");
|
||||
if (ret) {
|
||||
printk(KERN_ERR "failed to request GPIO for LCD Backlight\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Configure GPIO pin with specific GPIO function for PWM timer */
|
||||
s3c_gpio_cfgpin(bl_gpio_info->no, bl_gpio_info->func);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void samsung_bl_exit(struct device *dev)
|
||||
{
|
||||
struct platform_pwm_backlight_data *pdata = dev->platform_data;
|
||||
struct samsung_bl_drvdata *drvdata = container_of(pdata,
|
||||
struct samsung_bl_drvdata, plat_data);
|
||||
struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;
|
||||
|
||||
s3c_gpio_cfgpin(bl_gpio_info->no, S3C_GPIO_OUTPUT);
|
||||
gpio_free(bl_gpio_info->no);
|
||||
}
|
||||
|
||||
/* Initialize few important fields of platform_pwm_backlight_data
|
||||
* structure with default values. These fields can be overridden by
|
||||
* board-specific values sent from machine file.
|
||||
* For ease of operation, these fields are initialized with values
|
||||
* used by most samsung boards.
|
||||
* Users has the option of sending info about other parameters
|
||||
* for their specific boards
|
||||
*/
|
||||
|
||||
static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = {
|
||||
.plat_data = {
|
||||
.max_brightness = 255,
|
||||
.dft_brightness = 255,
|
||||
.pwm_period_ns = 78770,
|
||||
.enable_gpio = -1,
|
||||
.init = samsung_bl_init,
|
||||
.exit = samsung_bl_exit,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device samsung_dfl_bl_device __initdata = {
|
||||
.name = "pwm-backlight",
|
||||
};
|
||||
|
||||
/* samsung_bl_set - Set board specific data (if any) provided by user for
|
||||
* PWM Backlight control and register specific PWM and backlight device.
|
||||
* @gpio_info: structure containing GPIO info for PWM timer
|
||||
* @bl_data: structure containing Backlight control data
|
||||
*/
|
||||
void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
|
||||
struct platform_pwm_backlight_data *bl_data)
|
||||
{
|
||||
int ret = 0;
|
||||
struct platform_device *samsung_bl_device;
|
||||
struct samsung_bl_drvdata *samsung_bl_drvdata;
|
||||
struct platform_pwm_backlight_data *samsung_bl_data;
|
||||
|
||||
samsung_bl_device = kmemdup(&samsung_dfl_bl_device,
|
||||
sizeof(struct platform_device), GFP_KERNEL);
|
||||
if (!samsung_bl_device) {
|
||||
printk(KERN_ERR "%s: no memory for platform dev\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
samsung_bl_drvdata = kmemdup(&samsung_dfl_bl_data,
|
||||
sizeof(samsung_dfl_bl_data), GFP_KERNEL);
|
||||
if (!samsung_bl_drvdata) {
|
||||
printk(KERN_ERR "%s: no memory for platform dev\n", __func__);
|
||||
goto err_data;
|
||||
}
|
||||
samsung_bl_device->dev.platform_data = &samsung_bl_drvdata->plat_data;
|
||||
samsung_bl_drvdata->gpio_info = gpio_info;
|
||||
samsung_bl_data = &samsung_bl_drvdata->plat_data;
|
||||
|
||||
/* Copy board specific data provided by user */
|
||||
samsung_bl_data->pwm_id = bl_data->pwm_id;
|
||||
samsung_bl_device->dev.parent = &samsung_device_pwm.dev;
|
||||
|
||||
if (bl_data->max_brightness)
|
||||
samsung_bl_data->max_brightness = bl_data->max_brightness;
|
||||
if (bl_data->dft_brightness)
|
||||
samsung_bl_data->dft_brightness = bl_data->dft_brightness;
|
||||
if (bl_data->lth_brightness)
|
||||
samsung_bl_data->lth_brightness = bl_data->lth_brightness;
|
||||
if (bl_data->pwm_period_ns)
|
||||
samsung_bl_data->pwm_period_ns = bl_data->pwm_period_ns;
|
||||
if (bl_data->enable_gpio >= 0)
|
||||
samsung_bl_data->enable_gpio = bl_data->enable_gpio;
|
||||
if (bl_data->init)
|
||||
samsung_bl_data->init = bl_data->init;
|
||||
if (bl_data->notify)
|
||||
samsung_bl_data->notify = bl_data->notify;
|
||||
if (bl_data->notify_after)
|
||||
samsung_bl_data->notify_after = bl_data->notify_after;
|
||||
if (bl_data->exit)
|
||||
samsung_bl_data->exit = bl_data->exit;
|
||||
if (bl_data->check_fb)
|
||||
samsung_bl_data->check_fb = bl_data->check_fb;
|
||||
|
||||
/* Register the Backlight dev */
|
||||
ret = platform_device_register(samsung_bl_device);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "failed to register backlight device: %d\n", ret);
|
||||
goto err_plat_reg2;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
err_plat_reg2:
|
||||
kfree(samsung_bl_data);
|
||||
err_data:
|
||||
kfree(samsung_bl_device);
|
||||
return;
|
||||
}
|
50
arch/arm/plat-samsung/dev-uart.c
Normal file
50
arch/arm/plat-samsung/dev-uart.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/* linux/arch/arm/plat-samsung/dev-uart.c
|
||||
* originally from arch/arm/plat-s3c24xx/devs.c
|
||||
*x
|
||||
* Copyright (c) 2004 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Base S3C24XX platform device definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
|
||||
#include <plat/devs.h>
|
||||
|
||||
/* uart devices */
|
||||
|
||||
static struct platform_device s3c24xx_uart_device0 = {
|
||||
.id = 0,
|
||||
};
|
||||
|
||||
static struct platform_device s3c24xx_uart_device1 = {
|
||||
.id = 1,
|
||||
};
|
||||
|
||||
static struct platform_device s3c24xx_uart_device2 = {
|
||||
.id = 2,
|
||||
};
|
||||
|
||||
static struct platform_device s3c24xx_uart_device3 = {
|
||||
.id = 3,
|
||||
};
|
||||
|
||||
struct platform_device *s3c24xx_uart_src[4] = {
|
||||
&s3c24xx_uart_device0,
|
||||
&s3c24xx_uart_device1,
|
||||
&s3c24xx_uart_device2,
|
||||
&s3c24xx_uart_device3,
|
||||
};
|
||||
|
||||
struct platform_device *s3c24xx_uart_devs[4] = {
|
||||
};
|
||||
|
||||
s3c_wake_peer_t s3c2410_serial_wake_peer[CONFIG_SERIAL_SAMSUNG_UARTS];
|
1229
arch/arm/plat-samsung/devs.c
Normal file
1229
arch/arm/plat-samsung/devs.c
Normal file
File diff suppressed because it is too large
Load diff
146
arch/arm/plat-samsung/dma-ops.c
Normal file
146
arch/arm/plat-samsung/dma-ops.c
Normal file
|
@ -0,0 +1,146 @@
|
|||
/* linux/arch/arm/plat-samsung/dma-ops.c
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Samsung DMA Operations
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/amba/pl330.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
#include <mach/dma.h>
|
||||
|
||||
#if defined(CONFIG_PL330_DMA)
|
||||
#define dma_filter pl330_filter
|
||||
#elif defined(CONFIG_S3C64XX_PL080)
|
||||
#define dma_filter pl08x_filter_id
|
||||
#endif
|
||||
|
||||
static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
|
||||
struct samsung_dma_req *param,
|
||||
struct device *dev, char *ch_name)
|
||||
{
|
||||
dma_cap_mask_t mask;
|
||||
|
||||
dma_cap_zero(mask);
|
||||
dma_cap_set(param->cap, mask);
|
||||
|
||||
if (dev->of_node)
|
||||
return (unsigned)dma_request_slave_channel(dev, ch_name);
|
||||
else
|
||||
return (unsigned)dma_request_channel(mask, dma_filter,
|
||||
(void *)dma_ch);
|
||||
}
|
||||
|
||||
static int samsung_dmadev_release(unsigned ch, void *param)
|
||||
{
|
||||
dma_release_channel((struct dma_chan *)ch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int samsung_dmadev_config(unsigned ch,
|
||||
struct samsung_dma_config *param)
|
||||
{
|
||||
struct dma_chan *chan = (struct dma_chan *)ch;
|
||||
struct dma_slave_config slave_config;
|
||||
|
||||
if (param->direction == DMA_DEV_TO_MEM) {
|
||||
memset(&slave_config, 0, sizeof(struct dma_slave_config));
|
||||
slave_config.direction = param->direction;
|
||||
slave_config.src_addr = param->fifo;
|
||||
slave_config.src_addr_width = param->width;
|
||||
slave_config.src_maxburst = 1;
|
||||
dmaengine_slave_config(chan, &slave_config);
|
||||
} else if (param->direction == DMA_MEM_TO_DEV) {
|
||||
memset(&slave_config, 0, sizeof(struct dma_slave_config));
|
||||
slave_config.direction = param->direction;
|
||||
slave_config.dst_addr = param->fifo;
|
||||
slave_config.dst_addr_width = param->width;
|
||||
slave_config.dst_maxburst = 1;
|
||||
dmaengine_slave_config(chan, &slave_config);
|
||||
} else {
|
||||
pr_warn("unsupported direction\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int samsung_dmadev_prepare(unsigned ch,
|
||||
struct samsung_dma_prep *param)
|
||||
{
|
||||
struct scatterlist sg;
|
||||
struct dma_chan *chan = (struct dma_chan *)ch;
|
||||
struct dma_async_tx_descriptor *desc;
|
||||
|
||||
switch (param->cap) {
|
||||
case DMA_SLAVE:
|
||||
sg_init_table(&sg, 1);
|
||||
sg_dma_len(&sg) = param->len;
|
||||
sg_set_page(&sg, pfn_to_page(PFN_DOWN(param->buf)),
|
||||
param->len, offset_in_page(param->buf));
|
||||
sg_dma_address(&sg) = param->buf;
|
||||
|
||||
desc = dmaengine_prep_slave_sg(chan,
|
||||
&sg, 1, param->direction, DMA_PREP_INTERRUPT);
|
||||
break;
|
||||
case DMA_CYCLIC:
|
||||
desc = dmaengine_prep_dma_cyclic(chan, param->buf,
|
||||
param->len, param->period, param->direction,
|
||||
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
|
||||
break;
|
||||
default:
|
||||
dev_err(&chan->dev->device, "unsupported format\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (!desc) {
|
||||
dev_err(&chan->dev->device, "cannot prepare cyclic dma\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
desc->callback = param->fp;
|
||||
desc->callback_param = param->fp_param;
|
||||
|
||||
dmaengine_submit((struct dma_async_tx_descriptor *)desc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int samsung_dmadev_trigger(unsigned ch)
|
||||
{
|
||||
dma_async_issue_pending((struct dma_chan *)ch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int samsung_dmadev_flush(unsigned ch)
|
||||
{
|
||||
return dmaengine_terminate_all((struct dma_chan *)ch);
|
||||
}
|
||||
|
||||
static struct samsung_dma_ops dmadev_ops = {
|
||||
.request = samsung_dmadev_request,
|
||||
.release = samsung_dmadev_release,
|
||||
.config = samsung_dmadev_config,
|
||||
.prepare = samsung_dmadev_prepare,
|
||||
.trigger = samsung_dmadev_trigger,
|
||||
.started = NULL,
|
||||
.flush = samsung_dmadev_flush,
|
||||
.stop = samsung_dmadev_flush,
|
||||
};
|
||||
|
||||
void *samsung_dmadev_get_ops(void)
|
||||
{
|
||||
return &dmadev_ops;
|
||||
}
|
||||
EXPORT_SYMBOL(samsung_dmadev_get_ops);
|
84
arch/arm/plat-samsung/dma.c
Normal file
84
arch/arm/plat-samsung/dma.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/* linux/arch/arm/plat-samsung/dma.c
|
||||
*
|
||||
* Copyright (c) 2003-2009 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* S3C DMA core
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
struct s3c2410_dma_buf;
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/errno.h>
|
||||
|
||||
#include <mach/dma.h>
|
||||
#include <mach/irqs.h>
|
||||
|
||||
/* dma channel state information */
|
||||
struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS];
|
||||
struct s3c2410_dma_chan *s3c_dma_chan_map[DMACH_MAX];
|
||||
|
||||
/* s3c_dma_lookup_channel
|
||||
*
|
||||
* change the dma channel number given into a real dma channel id
|
||||
*/
|
||||
|
||||
struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel)
|
||||
{
|
||||
if (channel & DMACH_LOW_LEVEL)
|
||||
return &s3c2410_chans[channel & ~DMACH_LOW_LEVEL];
|
||||
else
|
||||
return s3c_dma_chan_map[channel];
|
||||
}
|
||||
|
||||
/* do we need to protect the settings of the fields from
|
||||
* irq?
|
||||
*/
|
||||
|
||||
int s3c2410_dma_set_opfn(enum dma_ch channel, s3c2410_dma_opfn_t rtn)
|
||||
{
|
||||
struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
|
||||
|
||||
if (chan == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
pr_debug("%s: chan=%p, op rtn=%p\n", __func__, chan, rtn);
|
||||
|
||||
chan->op_fn = rtn;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(s3c2410_dma_set_opfn);
|
||||
|
||||
int s3c2410_dma_set_buffdone_fn(enum dma_ch channel, s3c2410_dma_cbfn_t rtn)
|
||||
{
|
||||
struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
|
||||
|
||||
if (chan == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
pr_debug("%s: chan=%p, callback rtn=%p\n", __func__, chan, rtn);
|
||||
|
||||
chan->callback_fn = rtn;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn);
|
||||
|
||||
int s3c2410_dma_setflags(enum dma_ch channel, unsigned int flags)
|
||||
{
|
||||
struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
|
||||
|
||||
if (chan == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
chan->flags = flags;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(s3c2410_dma_setflags);
|
28
arch/arm/plat-samsung/include/plat/adc-core.h
Normal file
28
arch/arm/plat-samsung/include/plat/adc-core.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/adc-core.h
|
||||
*
|
||||
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com/
|
||||
*
|
||||
* Samsung ADC Controller core functions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_ADC_CORE_H
|
||||
#define __ASM_PLAT_ADC_CORE_H __FILE__
|
||||
|
||||
/* These functions are only for use with the core support code, such as
|
||||
* the cpu specific initialisation code
|
||||
*/
|
||||
|
||||
/* re-define device name depending on support. */
|
||||
static inline void s3c_adc_setname(char *name)
|
||||
{
|
||||
#if defined(CONFIG_SAMSUNG_DEV_ADC) || defined(CONFIG_PLAT_S3C24XX)
|
||||
s3c_device_adc.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ASM_PLAT_ADC_CORE_H */
|
36
arch/arm/plat-samsung/include/plat/adc.h
Normal file
36
arch/arm/plat-samsung/include/plat/adc.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* arch/arm/plat-samsung/include/plat/adc.h
|
||||
*
|
||||
* Copyright (c) 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C ADC driver information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_ADC_H
|
||||
#define __ASM_PLAT_ADC_H __FILE__
|
||||
|
||||
struct s3c_adc_client;
|
||||
struct platform_device;
|
||||
|
||||
extern int s3c_adc_start(struct s3c_adc_client *client,
|
||||
unsigned int channel, unsigned int nr_samples);
|
||||
|
||||
extern int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch);
|
||||
|
||||
extern struct s3c_adc_client *
|
||||
s3c_adc_register(struct platform_device *pdev,
|
||||
void (*select)(struct s3c_adc_client *client,
|
||||
unsigned selected),
|
||||
void (*conv)(struct s3c_adc_client *client,
|
||||
unsigned d0, unsigned d1,
|
||||
unsigned *samples_left),
|
||||
unsigned int is_ts);
|
||||
|
||||
extern void s3c_adc_release(struct s3c_adc_client *client);
|
||||
|
||||
#endif /* __ASM_PLAT_ADC_H */
|
28
arch/arm/plat-samsung/include/plat/ata-core.h
Normal file
28
arch/arm/plat-samsung/include/plat/ata-core.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/ata-core.h
|
||||
*
|
||||
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Samsung CF-ATA Controller core functions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_ATA_CORE_H
|
||||
#define __ASM_PLAT_ATA_CORE_H __FILE__
|
||||
|
||||
/* These functions are only for use with the core support code, such as
|
||||
* the cpu specific initialisation code
|
||||
*/
|
||||
|
||||
/* re-define device name depending on support. */
|
||||
static inline void s3c_cfcon_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_SAMSUNG_DEV_IDE
|
||||
s3c_device_cfcon.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ASM_PLAT_ATA_CORE_H */
|
26
arch/arm/plat-samsung/include/plat/backlight.h
Normal file
26
arch/arm/plat-samsung/include/plat/backlight.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/backlight.h
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_BACKLIGHT_H
|
||||
#define __ASM_PLAT_BACKLIGHT_H __FILE__
|
||||
|
||||
/* samsung_bl_gpio_info - GPIO info for PWM Backlight control
|
||||
* @no: GPIO number for PWM timer out
|
||||
* @func: Special function of GPIO line for PWM timer
|
||||
*/
|
||||
struct samsung_bl_gpio_info {
|
||||
int no;
|
||||
int func;
|
||||
};
|
||||
|
||||
extern void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
|
||||
struct platform_pwm_backlight_data *bl_data);
|
||||
|
||||
#endif /* __ASM_PLAT_BACKLIGHT_H */
|
291
arch/arm/plat-samsung/include/plat/cpu-freq-core.h
Normal file
291
arch/arm/plat-samsung/include/plat/cpu-freq-core.h
Normal file
|
@ -0,0 +1,291 @@
|
|||
/* arch/arm/plat-samsung/include/plat/cpu-freq-core.h
|
||||
*
|
||||
* Copyright (c) 2006-2009 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C CPU frequency scaling support - core support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <plat/cpu-freq.h>
|
||||
|
||||
struct seq_file;
|
||||
|
||||
#define MAX_BANKS (8)
|
||||
#define S3C2412_MAX_IO (8)
|
||||
|
||||
/**
|
||||
* struct s3c2410_iobank_timing - IO bank timings for S3C2410 style timings
|
||||
* @bankcon: The cached version of settings in this structure.
|
||||
* @tacp:
|
||||
* @tacs: Time from address valid to nCS asserted.
|
||||
* @tcos: Time from nCS asserted to nOE or nWE asserted.
|
||||
* @tacc: Time that nOE or nWE is asserted.
|
||||
* @tcoh: Time nCS is held after nOE or nWE are released.
|
||||
* @tcah: Time address is held for after
|
||||
* @nwait_en: Whether nWAIT is enabled for this bank.
|
||||
*
|
||||
* This structure represents the IO timings for a S3C2410 style IO bank
|
||||
* used by the CPU frequency support if it needs to change the settings
|
||||
* of the IO.
|
||||
*/
|
||||
struct s3c2410_iobank_timing {
|
||||
unsigned long bankcon;
|
||||
unsigned int tacp;
|
||||
unsigned int tacs;
|
||||
unsigned int tcos;
|
||||
unsigned int tacc;
|
||||
unsigned int tcoh; /* nCS hold afrer nOE/nWE */
|
||||
unsigned int tcah; /* Address hold after nCS */
|
||||
unsigned char nwait_en; /* nWait enabled for bank. */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct s3c2412_iobank_timing - io timings for PL092 (S3C2412) style IO
|
||||
* @idcy: The idle cycle time between transactions.
|
||||
* @wstrd: nCS release to end of read cycle.
|
||||
* @wstwr: nCS release to end of write cycle.
|
||||
* @wstoen: nCS assertion to nOE assertion time.
|
||||
* @wstwen: nCS assertion to nWE assertion time.
|
||||
* @wstbrd: Burst ready delay.
|
||||
* @smbidcyr: Register cache for smbidcyr value.
|
||||
* @smbwstrd: Register cache for smbwstrd value.
|
||||
* @smbwstwr: Register cache for smbwstwr value.
|
||||
* @smbwstoen: Register cache for smbwstoen value.
|
||||
* @smbwstwen: Register cache for smbwstwen value.
|
||||
* @smbwstbrd: Register cache for smbwstbrd value.
|
||||
*
|
||||
* Timing information for a IO bank on an S3C2412 or similar system which
|
||||
* uses a PL093 block.
|
||||
*/
|
||||
struct s3c2412_iobank_timing {
|
||||
unsigned int idcy;
|
||||
unsigned int wstrd;
|
||||
unsigned int wstwr;
|
||||
unsigned int wstoen;
|
||||
unsigned int wstwen;
|
||||
unsigned int wstbrd;
|
||||
|
||||
/* register cache */
|
||||
unsigned char smbidcyr;
|
||||
unsigned char smbwstrd;
|
||||
unsigned char smbwstwr;
|
||||
unsigned char smbwstoen;
|
||||
unsigned char smbwstwen;
|
||||
unsigned char smbwstbrd;
|
||||
};
|
||||
|
||||
union s3c_iobank {
|
||||
struct s3c2410_iobank_timing *io_2410;
|
||||
struct s3c2412_iobank_timing *io_2412;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct s3c_iotimings - Chip IO timings holder
|
||||
* @bank: The timings for each IO bank.
|
||||
*/
|
||||
struct s3c_iotimings {
|
||||
union s3c_iobank bank[MAX_BANKS];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct s3c_plltab - PLL table information.
|
||||
* @vals: List of PLL values.
|
||||
* @size: Size of the PLL table @vals.
|
||||
*/
|
||||
struct s3c_plltab {
|
||||
struct s3c_pllval *vals;
|
||||
int size;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct s3c_cpufreq_config - current cpu frequency configuration
|
||||
* @freq: The current settings for the core clocks.
|
||||
* @max: Maxium settings, derived from core, board and user settings.
|
||||
* @pll: The PLL table entry for the current PLL settings.
|
||||
* @divs: The divisor settings for the core clocks.
|
||||
* @info: The current core driver information.
|
||||
* @board: The information for the board we are running on.
|
||||
* @lock_pll: Set if the PLL settings cannot be changed.
|
||||
*
|
||||
* This is for the core drivers that need to know information about
|
||||
* the current settings and values. It should not be needed by any
|
||||
* device drivers.
|
||||
*/
|
||||
struct s3c_cpufreq_config {
|
||||
struct s3c_freq freq;
|
||||
struct s3c_freq max;
|
||||
struct clk *mpll;
|
||||
struct cpufreq_frequency_table pll;
|
||||
struct s3c_clkdivs divs;
|
||||
struct s3c_cpufreq_info *info; /* for core, not drivers */
|
||||
struct s3c_cpufreq_board *board;
|
||||
|
||||
unsigned int lock_pll:1;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct s3c_cpufreq_info - Information for the CPU frequency driver.
|
||||
* @name: The name of this implementation.
|
||||
* @max: The maximum frequencies for the system.
|
||||
* @latency: Transition latency to give to cpufreq.
|
||||
* @locktime_m: The lock-time in uS for the MPLL.
|
||||
* @locktime_u: The lock-time in uS for the UPLL.
|
||||
* @locttime_bits: The number of bits each LOCKTIME field.
|
||||
* @need_pll: Set if this driver needs to change the PLL values to achieve
|
||||
* any frequency changes. This is really only need by devices like the
|
||||
* S3C2410 where there is no or limited divider between the PLL and the
|
||||
* ARMCLK.
|
||||
* @get_iotiming: Get the current IO timing data, mainly for use at start.
|
||||
* @set_iotiming: Update the IO timings from the cached copies calculated
|
||||
* from the @calc_iotiming entry when changing the frequency.
|
||||
* @calc_iotiming: Calculate and update the cached copies of the IO timings
|
||||
* from the newly calculated frequencies.
|
||||
* @calc_freqtable: Calculate (fill in) the given frequency table from the
|
||||
* current frequency configuration. If the table passed in is NULL,
|
||||
* then the return is the number of elements to be filled for allocation
|
||||
* of the table.
|
||||
* @set_refresh: Set the memory refresh configuration.
|
||||
* @set_fvco: Set the PLL frequencies.
|
||||
* @set_divs: Update the clock divisors.
|
||||
* @calc_divs: Calculate the clock divisors.
|
||||
*/
|
||||
struct s3c_cpufreq_info {
|
||||
const char *name;
|
||||
struct s3c_freq max;
|
||||
|
||||
unsigned int latency;
|
||||
|
||||
unsigned int locktime_m;
|
||||
unsigned int locktime_u;
|
||||
unsigned char locktime_bits;
|
||||
|
||||
unsigned int need_pll:1;
|
||||
|
||||
/* driver routines */
|
||||
|
||||
int (*get_iotiming)(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *timings);
|
||||
|
||||
void (*set_iotiming)(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *timings);
|
||||
|
||||
int (*calc_iotiming)(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *timings);
|
||||
|
||||
int (*calc_freqtable)(struct s3c_cpufreq_config *cfg,
|
||||
struct cpufreq_frequency_table *t,
|
||||
size_t table_size);
|
||||
|
||||
void (*debug_io_show)(struct seq_file *seq,
|
||||
struct s3c_cpufreq_config *cfg,
|
||||
union s3c_iobank *iob);
|
||||
|
||||
void (*set_refresh)(struct s3c_cpufreq_config *cfg);
|
||||
void (*set_fvco)(struct s3c_cpufreq_config *cfg);
|
||||
void (*set_divs)(struct s3c_cpufreq_config *cfg);
|
||||
int (*calc_divs)(struct s3c_cpufreq_config *cfg);
|
||||
};
|
||||
|
||||
extern int s3c_cpufreq_register(struct s3c_cpufreq_info *info);
|
||||
|
||||
extern int s3c_plltab_register(struct cpufreq_frequency_table *plls,
|
||||
unsigned int plls_no);
|
||||
|
||||
/* exports and utilities for debugfs */
|
||||
extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void);
|
||||
extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void);
|
||||
|
||||
#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS
|
||||
#define s3c_cpufreq_debugfs_call(x) x
|
||||
#else
|
||||
#define s3c_cpufreq_debugfs_call(x) NULL
|
||||
#endif
|
||||
|
||||
/* Useful utility functions. */
|
||||
|
||||
extern struct clk *s3c_cpufreq_clk_get(struct device *, const char *);
|
||||
|
||||
/* S3C2410 and compatible exported functions */
|
||||
|
||||
extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
|
||||
extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg);
|
||||
|
||||
#ifdef CONFIG_S3C2410_IOTIMING
|
||||
extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
|
||||
struct s3c_cpufreq_config *cfg,
|
||||
union s3c_iobank *iob);
|
||||
|
||||
extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *iot);
|
||||
|
||||
extern int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *timings);
|
||||
|
||||
extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *iot);
|
||||
#else
|
||||
#define s3c2410_iotiming_debugfs NULL
|
||||
#define s3c2410_iotiming_calc NULL
|
||||
#define s3c2410_iotiming_get NULL
|
||||
#define s3c2410_iotiming_set NULL
|
||||
#endif /* CONFIG_S3C2410_IOTIMING */
|
||||
|
||||
/* S3C2412 compatible routines */
|
||||
|
||||
#ifdef CONFIG_S3C2412_IOTIMING
|
||||
extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
|
||||
struct s3c_cpufreq_config *cfg,
|
||||
union s3c_iobank *iob);
|
||||
|
||||
extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *timings);
|
||||
|
||||
extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *iot);
|
||||
|
||||
extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
|
||||
struct s3c_iotimings *iot);
|
||||
#else
|
||||
#define s3c2412_iotiming_debugfs NULL
|
||||
#define s3c2412_iotiming_calc NULL
|
||||
#define s3c2412_iotiming_get NULL
|
||||
#define s3c2412_iotiming_set NULL
|
||||
#endif /* CONFIG_S3C2412_IOTIMING */
|
||||
|
||||
#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG
|
||||
#define s3c_freq_dbg(x...) printk(KERN_INFO x)
|
||||
#else
|
||||
#define s3c_freq_dbg(x...) do { if (0) printk(x); } while (0)
|
||||
#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG */
|
||||
|
||||
#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG
|
||||
#define s3c_freq_iodbg(x...) printk(KERN_INFO x)
|
||||
#else
|
||||
#define s3c_freq_iodbg(x...) do { if (0) printk(x); } while (0)
|
||||
#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG */
|
||||
|
||||
static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table,
|
||||
int index, size_t table_size,
|
||||
unsigned int freq)
|
||||
{
|
||||
if (index < 0)
|
||||
return index;
|
||||
|
||||
if (table) {
|
||||
if (index >= table_size)
|
||||
return -ENOMEM;
|
||||
|
||||
s3c_freq_dbg("%s: { %d = %u kHz }\n",
|
||||
__func__, index, freq);
|
||||
|
||||
table[index].driver_data = index;
|
||||
table[index].frequency = freq;
|
||||
}
|
||||
|
||||
return index + 1;
|
||||
}
|
145
arch/arm/plat-samsung/include/plat/cpu-freq.h
Normal file
145
arch/arm/plat-samsung/include/plat/cpu-freq.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
/* arch/arm/plat-samsung/include/plat/cpu-freq.h
|
||||
*
|
||||
* Copyright (c) 2006-2007 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C CPU frequency scaling support - driver and board
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/cpufreq.h>
|
||||
|
||||
struct s3c_cpufreq_info;
|
||||
struct s3c_cpufreq_board;
|
||||
struct s3c_iotimings;
|
||||
|
||||
/**
|
||||
* struct s3c_freq - frequency information (mainly for core drivers)
|
||||
* @fclk: The FCLK frequency in Hz.
|
||||
* @armclk: The ARMCLK frequency in Hz.
|
||||
* @hclk_tns: HCLK cycle time in 10ths of nano-seconds.
|
||||
* @hclk: The HCLK frequency in Hz.
|
||||
* @pclk: The PCLK frequency in Hz.
|
||||
*
|
||||
* This contains the frequency information about the current configuration
|
||||
* mainly for the core drivers to ensure we do not end up passing about
|
||||
* a large number of parameters.
|
||||
*
|
||||
* The @hclk_tns field is a useful cache for the parts of the drivers that
|
||||
* need to calculate IO timings and suchlike.
|
||||
*/
|
||||
struct s3c_freq {
|
||||
unsigned long fclk;
|
||||
unsigned long armclk;
|
||||
unsigned long hclk_tns; /* in 10ths of ns */
|
||||
unsigned long hclk;
|
||||
unsigned long pclk;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct s3c_cpufreq_freqs - s3c cpufreq notification information.
|
||||
* @freqs: The cpufreq setting information.
|
||||
* @old: The old clock settings.
|
||||
* @new: The new clock settings.
|
||||
* @pll_changing: Set if the PLL is changing.
|
||||
*
|
||||
* Wrapper 'struct cpufreq_freqs' so that any drivers receiving the
|
||||
* notification can use this information that is not provided by just
|
||||
* having the core frequency alone.
|
||||
*
|
||||
* The pll_changing flag is used to indicate if the PLL itself is
|
||||
* being set during this change. This is important as the clocks
|
||||
* will temporarily be set to the XTAL clock during this time, so
|
||||
* drivers may want to close down their output during this time.
|
||||
*
|
||||
* Note, this is not being used by any current drivers and therefore
|
||||
* may be removed in the future.
|
||||
*/
|
||||
struct s3c_cpufreq_freqs {
|
||||
struct cpufreq_freqs freqs;
|
||||
struct s3c_freq old;
|
||||
struct s3c_freq new;
|
||||
|
||||
unsigned int pll_changing:1;
|
||||
};
|
||||
|
||||
#define to_s3c_cpufreq(_cf) container_of(_cf, struct s3c_cpufreq_freqs, freqs)
|
||||
|
||||
/**
|
||||
* struct s3c_clkdivs - clock divisor information
|
||||
* @p_divisor: Divisor from FCLK to PCLK.
|
||||
* @h_divisor: Divisor from FCLK to HCLK.
|
||||
* @arm_divisor: Divisor from FCLK to ARMCLK (not all CPUs).
|
||||
* @dvs: Non-zero if using DVS mode for ARMCLK.
|
||||
*
|
||||
* Divisor settings for the core clocks.
|
||||
*/
|
||||
struct s3c_clkdivs {
|
||||
int p_divisor;
|
||||
int h_divisor;
|
||||
int arm_divisor;
|
||||
unsigned char dvs;
|
||||
};
|
||||
|
||||
#define PLLVAL(_m, _p, _s) (((_m) << 12) | ((_p) << 4) | (_s))
|
||||
|
||||
/**
|
||||
* struct s3c_pllval - PLL value entry.
|
||||
* @freq: The frequency for this entry in Hz.
|
||||
* @pll_reg: The PLL register setting for this PLL value.
|
||||
*/
|
||||
struct s3c_pllval {
|
||||
unsigned long freq;
|
||||
unsigned long pll_reg;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct s3c_cpufreq_board - per-board cpu frequency informatin
|
||||
* @refresh: The SDRAM refresh period in nanoseconds.
|
||||
* @auto_io: Set if the IO timing settings should be generated from the
|
||||
* initialisation time hardware registers.
|
||||
* @need_io: Set if the board has external IO on any of the chipselect
|
||||
* lines that will require the hardware timing registers to be
|
||||
* updated on a clock change.
|
||||
* @max: The maxium frequency limits for the system. Any field that
|
||||
* is left at zero will use the CPU's settings.
|
||||
*
|
||||
* This contains the board specific settings that affect how the CPU
|
||||
* drivers chose settings. These include the memory refresh and IO
|
||||
* timing information.
|
||||
*
|
||||
* Registration depends on the driver being used, the ARMCLK only
|
||||
* implementation does not currently need this but the older style
|
||||
* driver requires this to be available.
|
||||
*/
|
||||
struct s3c_cpufreq_board {
|
||||
unsigned int refresh;
|
||||
unsigned int auto_io:1; /* automatically init io timings. */
|
||||
unsigned int need_io:1; /* set if needs io timing support. */
|
||||
|
||||
/* any non-zero field in here is taken as an upper limit. */
|
||||
struct s3c_freq max; /* frequency limits */
|
||||
};
|
||||
|
||||
/* Things depending on frequency scaling. */
|
||||
#ifdef CONFIG_ARM_S3C_CPUFREQ
|
||||
#define __init_or_cpufreq
|
||||
#else
|
||||
#define __init_or_cpufreq __init
|
||||
#endif
|
||||
|
||||
/* Board functions */
|
||||
|
||||
#ifdef CONFIG_ARM_S3C_CPUFREQ
|
||||
extern int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board);
|
||||
#else
|
||||
|
||||
static inline int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_ARM_S3C_CPUFREQ */
|
143
arch/arm/plat-samsung/include/plat/cpu.h
Normal file
143
arch/arm/plat-samsung/include/plat/cpu.h
Normal file
|
@ -0,0 +1,143 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/cpu.h
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com/
|
||||
*
|
||||
* Copyright (c) 2004-2005 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Header file for Samsung CPU support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/* todo - fix when rmk changes iodescs to use `void __iomem *` */
|
||||
|
||||
#ifndef __SAMSUNG_PLAT_CPU_H
|
||||
#define __SAMSUNG_PLAT_CPU_H
|
||||
|
||||
extern unsigned long samsung_cpu_id;
|
||||
|
||||
#define S3C2410_CPU_ID 0x32410000
|
||||
#define S3C2410_CPU_MASK 0xFFFFFFFF
|
||||
|
||||
#define S3C24XX_CPU_ID 0x32400000
|
||||
#define S3C24XX_CPU_MASK 0xFFF00000
|
||||
|
||||
#define S3C2412_CPU_ID 0x32412000
|
||||
#define S3C2412_CPU_MASK 0xFFFFF000
|
||||
|
||||
#define S3C6400_CPU_ID 0x36400000
|
||||
#define S3C6410_CPU_ID 0x36410000
|
||||
#define S3C64XX_CPU_MASK 0xFFFFF000
|
||||
|
||||
#define S5PV210_CPU_ID 0x43110000
|
||||
#define S5PV210_CPU_MASK 0xFFFFF000
|
||||
|
||||
#define IS_SAMSUNG_CPU(name, id, mask) \
|
||||
static inline int is_samsung_##name(void) \
|
||||
{ \
|
||||
return ((samsung_cpu_id & mask) == (id & mask)); \
|
||||
}
|
||||
|
||||
IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
|
||||
IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
|
||||
IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
|
||||
IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
|
||||
IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
|
||||
|
||||
#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
|
||||
defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
|
||||
defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
|
||||
defined(CONFIG_CPU_S3C2443)
|
||||
# define soc_is_s3c24xx() is_samsung_s3c24xx()
|
||||
# define soc_is_s3c2410() is_samsung_s3c2410()
|
||||
#else
|
||||
# define soc_is_s3c24xx() 0
|
||||
# define soc_is_s3c2410() 0
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CPU_S3C2412)
|
||||
# define soc_is_s3c2412() is_samsung_s3c2412()
|
||||
#else
|
||||
# define soc_is_s3c2412() 0
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
|
||||
# define soc_is_s3c6400() is_samsung_s3c6400()
|
||||
# define soc_is_s3c6410() is_samsung_s3c6410()
|
||||
# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
|
||||
#else
|
||||
# define soc_is_s3c6400() 0
|
||||
# define soc_is_s3c6410() 0
|
||||
# define soc_is_s3c64xx() 0
|
||||
#endif
|
||||
|
||||
#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
|
||||
|
||||
#ifndef KHZ
|
||||
#define KHZ (1000)
|
||||
#endif
|
||||
|
||||
#ifndef MHZ
|
||||
#define MHZ (1000*1000)
|
||||
#endif
|
||||
|
||||
#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
|
||||
|
||||
/* forward declaration */
|
||||
struct s3c24xx_uart_resources;
|
||||
struct platform_device;
|
||||
struct s3c2410_uartcfg;
|
||||
struct map_desc;
|
||||
|
||||
/* per-cpu initialisation function table. */
|
||||
|
||||
struct cpu_table {
|
||||
unsigned long idcode;
|
||||
unsigned long idmask;
|
||||
void (*map_io)(void);
|
||||
void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
|
||||
void (*init_clocks)(int xtal);
|
||||
int (*init)(void);
|
||||
const char *name;
|
||||
};
|
||||
|
||||
extern void s3c_init_cpu(unsigned long idcode,
|
||||
struct cpu_table *cpus, unsigned int cputab_size);
|
||||
|
||||
/* core initialisation functions */
|
||||
|
||||
extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
|
||||
|
||||
extern void s3c64xx_init_cpu(void);
|
||||
|
||||
extern unsigned int samsung_rev(void);
|
||||
|
||||
extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
|
||||
|
||||
extern void s3c24xx_init_clocks(int xtal);
|
||||
|
||||
extern void s3c24xx_init_uartdevs(char *name,
|
||||
struct s3c24xx_uart_resources *res,
|
||||
struct s3c2410_uartcfg *cfg, int no);
|
||||
|
||||
extern struct syscore_ops s3c2410_pm_syscore_ops;
|
||||
extern struct syscore_ops s3c2412_pm_syscore_ops;
|
||||
extern struct syscore_ops s3c2416_pm_syscore_ops;
|
||||
extern struct syscore_ops s3c244x_pm_syscore_ops;
|
||||
|
||||
/* system device subsystems */
|
||||
|
||||
extern struct bus_type s3c2410_subsys;
|
||||
extern struct bus_type s3c2410a_subsys;
|
||||
extern struct bus_type s3c2412_subsys;
|
||||
extern struct bus_type s3c2416_subsys;
|
||||
extern struct bus_type s3c2440_subsys;
|
||||
extern struct bus_type s3c2442_subsys;
|
||||
extern struct bus_type s3c2443_subsys;
|
||||
extern struct bus_type s3c6410_subsys;
|
||||
|
||||
#endif
|
100
arch/arm/plat-samsung/include/plat/devs.h
Normal file
100
arch/arm/plat-samsung/include/plat/devs.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
/* arch/arm/plat-samsung/include/plat/devs.h
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Copyright (c) 2004 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Header file for s3c2410 standard platform devices
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_DEVS_H
|
||||
#define __PLAT_DEVS_H __FILE__
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
struct s3c24xx_uart_resources {
|
||||
struct resource *resources;
|
||||
unsigned long nr_resources;
|
||||
};
|
||||
|
||||
extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
|
||||
extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
|
||||
|
||||
extern struct platform_device *s3c24xx_uart_devs[];
|
||||
extern struct platform_device *s3c24xx_uart_src[];
|
||||
|
||||
extern struct platform_device s3c64xx_device_ac97;
|
||||
extern struct platform_device s3c64xx_device_iis0;
|
||||
extern struct platform_device s3c64xx_device_iis1;
|
||||
extern struct platform_device s3c64xx_device_iisv4;
|
||||
extern struct platform_device s3c64xx_device_onenand1;
|
||||
extern struct platform_device s3c64xx_device_pcm0;
|
||||
extern struct platform_device s3c64xx_device_pcm1;
|
||||
extern struct platform_device s3c64xx_device_spi0;
|
||||
extern struct platform_device s3c64xx_device_spi1;
|
||||
extern struct platform_device s3c64xx_device_spi2;
|
||||
|
||||
extern struct platform_device s3c_device_adc;
|
||||
extern struct platform_device s3c_device_cfcon;
|
||||
extern struct platform_device s3c_device_fb;
|
||||
extern struct platform_device s3c_device_hwmon;
|
||||
extern struct platform_device s3c_device_hsmmc0;
|
||||
extern struct platform_device s3c_device_hsmmc1;
|
||||
extern struct platform_device s3c_device_hsmmc2;
|
||||
extern struct platform_device s3c_device_hsmmc3;
|
||||
extern struct platform_device s3c_device_i2c0;
|
||||
extern struct platform_device s3c_device_i2c1;
|
||||
extern struct platform_device s3c_device_i2c2;
|
||||
extern struct platform_device s3c_device_i2c3;
|
||||
extern struct platform_device s3c_device_i2c4;
|
||||
extern struct platform_device s3c_device_i2c5;
|
||||
extern struct platform_device s3c_device_i2c6;
|
||||
extern struct platform_device s3c_device_i2c7;
|
||||
extern struct platform_device s3c_device_iis;
|
||||
extern struct platform_device s3c_device_lcd;
|
||||
extern struct platform_device s3c_device_nand;
|
||||
extern struct platform_device s3c_device_ohci;
|
||||
extern struct platform_device s3c_device_onenand;
|
||||
extern struct platform_device s3c_device_rtc;
|
||||
extern struct platform_device s3c_device_sdi;
|
||||
extern struct platform_device s3c_device_spi0;
|
||||
extern struct platform_device s3c_device_spi1;
|
||||
extern struct platform_device s3c_device_ts;
|
||||
extern struct platform_device s3c_device_timer[];
|
||||
extern struct platform_device s3c_device_usbgadget;
|
||||
extern struct platform_device s3c_device_usb_hsotg;
|
||||
extern struct platform_device s3c_device_usb_hsudc;
|
||||
extern struct platform_device s3c_device_wdt;
|
||||
|
||||
extern struct platform_device samsung_asoc_idma;
|
||||
extern struct platform_device samsung_device_keypad;
|
||||
extern struct platform_device samsung_device_pwm;
|
||||
|
||||
/* s3c2440 specific devices */
|
||||
|
||||
#ifdef CONFIG_CPU_S3C2440
|
||||
|
||||
extern struct platform_device s3c_device_camif;
|
||||
extern struct platform_device s3c_device_ac97;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* s3c_set_platdata() - helper for setting platform data
|
||||
* @pd: The default platform data for this device.
|
||||
* @pdsize: The size of the platform data.
|
||||
* @pdev: Pointer to the device to fill in.
|
||||
*
|
||||
* This helper replaces a number of calls that copy and then set the
|
||||
* platform data of the device.
|
||||
*/
|
||||
extern void *s3c_set_platdata(void *pd, size_t pdsize,
|
||||
struct platform_device *pdev);
|
||||
|
||||
#endif /* __PLAT_DEVS_H */
|
22
arch/arm/plat-samsung/include/plat/dma-core.h
Normal file
22
arch/arm/plat-samsung/include/plat/dma-core.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* arch/arm/plat-s3c/include/plat/dma.h
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* Samsung S3C DMA core support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
extern struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel);
|
||||
|
||||
extern struct s3c2410_dma_chan *s3c_dma_chan_map[];
|
||||
|
||||
/* the currently allocated channel information */
|
||||
extern struct s3c2410_dma_chan s3c2410_chans[];
|
||||
|
||||
|
69
arch/arm/plat-samsung/include/plat/dma-ops.h
Normal file
69
arch/arm/plat-samsung/include/plat/dma-ops.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* arch/arm/plat-samsung/include/plat/dma-ops.h
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Samsung DMA support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __SAMSUNG_DMA_OPS_H_
|
||||
#define __SAMSUNG_DMA_OPS_H_ __FILE__
|
||||
|
||||
#include <linux/dmaengine.h>
|
||||
#include <mach/dma.h>
|
||||
|
||||
struct samsung_dma_req {
|
||||
enum dma_transaction_type cap;
|
||||
struct s3c2410_dma_client *client;
|
||||
};
|
||||
|
||||
struct samsung_dma_prep {
|
||||
enum dma_transaction_type cap;
|
||||
enum dma_transfer_direction direction;
|
||||
dma_addr_t buf;
|
||||
unsigned long period;
|
||||
unsigned long len;
|
||||
void (*fp)(void *data);
|
||||
void *fp_param;
|
||||
};
|
||||
|
||||
struct samsung_dma_config {
|
||||
enum dma_transfer_direction direction;
|
||||
enum dma_slave_buswidth width;
|
||||
dma_addr_t fifo;
|
||||
};
|
||||
|
||||
struct samsung_dma_ops {
|
||||
unsigned (*request)(enum dma_ch ch, struct samsung_dma_req *param,
|
||||
struct device *dev, char *ch_name);
|
||||
int (*release)(unsigned ch, void *param);
|
||||
int (*config)(unsigned ch, struct samsung_dma_config *param);
|
||||
int (*prepare)(unsigned ch, struct samsung_dma_prep *param);
|
||||
int (*trigger)(unsigned ch);
|
||||
int (*started)(unsigned ch);
|
||||
int (*flush)(unsigned ch);
|
||||
int (*stop)(unsigned ch);
|
||||
};
|
||||
|
||||
extern void *samsung_dmadev_get_ops(void);
|
||||
extern void *s3c_dma_get_ops(void);
|
||||
|
||||
static inline void *__samsung_dma_get_ops(void)
|
||||
{
|
||||
if (samsung_dma_is_dmadev())
|
||||
return samsung_dmadev_get_ops();
|
||||
else
|
||||
return s3c_dma_get_ops();
|
||||
}
|
||||
|
||||
/*
|
||||
* samsung_dma_get_ops
|
||||
* get the set of samsung dma operations
|
||||
*/
|
||||
#define samsung_dma_get_ops() __samsung_dma_get_ops()
|
||||
|
||||
#endif /* __SAMSUNG_DMA_OPS_H_ */
|
121
arch/arm/plat-samsung/include/plat/dma-pl330.h
Normal file
121
arch/arm/plat-samsung/include/plat/dma-pl330.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Samsung Electronics Co. Ltd.
|
||||
* Jaswinder Singh <jassi.brar@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __DMA_PL330_H_
|
||||
#define __DMA_PL330_H_ __FILE__
|
||||
|
||||
/*
|
||||
* PL330 can assign any channel to communicate with
|
||||
* any of the peripherals attched to the DMAC.
|
||||
* For the sake of consistency across client drivers,
|
||||
* We keep the channel names unchanged and only add
|
||||
* missing peripherals are added.
|
||||
* Order is not important since DMA PL330 API driver
|
||||
* use these just as IDs.
|
||||
*/
|
||||
enum dma_ch {
|
||||
DMACH_UART0_RX = 0,
|
||||
DMACH_UART0_TX,
|
||||
DMACH_UART1_RX,
|
||||
DMACH_UART1_TX,
|
||||
DMACH_UART2_RX,
|
||||
DMACH_UART2_TX,
|
||||
DMACH_UART3_RX,
|
||||
DMACH_UART3_TX,
|
||||
DMACH_UART4_RX,
|
||||
DMACH_UART4_TX,
|
||||
DMACH_UART5_RX,
|
||||
DMACH_UART5_TX,
|
||||
DMACH_USI_RX,
|
||||
DMACH_USI_TX,
|
||||
DMACH_IRDA,
|
||||
DMACH_I2S0_RX,
|
||||
DMACH_I2S0_TX,
|
||||
DMACH_I2S0S_TX,
|
||||
DMACH_I2S1_RX,
|
||||
DMACH_I2S1_TX,
|
||||
DMACH_I2S2_RX,
|
||||
DMACH_I2S2_TX,
|
||||
DMACH_SPI0_RX,
|
||||
DMACH_SPI0_TX,
|
||||
DMACH_SPI1_RX,
|
||||
DMACH_SPI1_TX,
|
||||
DMACH_SPI2_RX,
|
||||
DMACH_SPI2_TX,
|
||||
DMACH_AC97_MICIN,
|
||||
DMACH_AC97_PCMIN,
|
||||
DMACH_AC97_PCMOUT,
|
||||
DMACH_EXTERNAL,
|
||||
DMACH_PWM,
|
||||
DMACH_SPDIF,
|
||||
DMACH_HSI_RX,
|
||||
DMACH_HSI_TX,
|
||||
DMACH_PCM0_TX,
|
||||
DMACH_PCM0_RX,
|
||||
DMACH_PCM1_TX,
|
||||
DMACH_PCM1_RX,
|
||||
DMACH_PCM2_TX,
|
||||
DMACH_PCM2_RX,
|
||||
DMACH_MSM_REQ3,
|
||||
DMACH_MSM_REQ2,
|
||||
DMACH_MSM_REQ1,
|
||||
DMACH_MSM_REQ0,
|
||||
DMACH_SLIMBUS0_RX,
|
||||
DMACH_SLIMBUS0_TX,
|
||||
DMACH_SLIMBUS0AUX_RX,
|
||||
DMACH_SLIMBUS0AUX_TX,
|
||||
DMACH_SLIMBUS1_RX,
|
||||
DMACH_SLIMBUS1_TX,
|
||||
DMACH_SLIMBUS2_RX,
|
||||
DMACH_SLIMBUS2_TX,
|
||||
DMACH_SLIMBUS3_RX,
|
||||
DMACH_SLIMBUS3_TX,
|
||||
DMACH_SLIMBUS4_RX,
|
||||
DMACH_SLIMBUS4_TX,
|
||||
DMACH_SLIMBUS5_RX,
|
||||
DMACH_SLIMBUS5_TX,
|
||||
DMACH_MIPI_HSI0,
|
||||
DMACH_MIPI_HSI1,
|
||||
DMACH_MIPI_HSI2,
|
||||
DMACH_MIPI_HSI3,
|
||||
DMACH_MIPI_HSI4,
|
||||
DMACH_MIPI_HSI5,
|
||||
DMACH_MIPI_HSI6,
|
||||
DMACH_MIPI_HSI7,
|
||||
DMACH_DISP1,
|
||||
DMACH_MTOM_0,
|
||||
DMACH_MTOM_1,
|
||||
DMACH_MTOM_2,
|
||||
DMACH_MTOM_3,
|
||||
DMACH_MTOM_4,
|
||||
DMACH_MTOM_5,
|
||||
DMACH_MTOM_6,
|
||||
DMACH_MTOM_7,
|
||||
/* END Marker, also used to denote a reserved channel */
|
||||
DMACH_MAX,
|
||||
};
|
||||
|
||||
struct s3c2410_dma_client {
|
||||
char *name;
|
||||
};
|
||||
|
||||
static inline bool samsung_dma_has_circular(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool samsung_dma_is_dmadev(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <plat/dma-ops.h>
|
||||
|
||||
#endif /* __DMA_PL330_H_ */
|
73
arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
Normal file
73
arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
|
||||
*
|
||||
* Copyright (C) 2006 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Samsung S3C24XX DMA support - per SoC functions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <plat/dma-core.h>
|
||||
|
||||
extern struct bus_type dma_subsys;
|
||||
extern struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS];
|
||||
|
||||
#define DMA_CH_VALID (1<<31)
|
||||
#define DMA_CH_NEVER (1<<30)
|
||||
|
||||
/* struct s3c24xx_dma_map
|
||||
*
|
||||
* this holds the mapping information for the channel selected
|
||||
* to be connected to the specified device
|
||||
*/
|
||||
|
||||
struct s3c24xx_dma_map {
|
||||
const char *name;
|
||||
|
||||
unsigned long channels[S3C_DMA_CHANNELS];
|
||||
};
|
||||
|
||||
struct s3c24xx_dma_selection {
|
||||
struct s3c24xx_dma_map *map;
|
||||
unsigned long map_size;
|
||||
unsigned long dcon_mask;
|
||||
|
||||
void (*select)(struct s3c2410_dma_chan *chan,
|
||||
struct s3c24xx_dma_map *map);
|
||||
};
|
||||
|
||||
extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel);
|
||||
|
||||
/* struct s3c24xx_dma_order_ch
|
||||
*
|
||||
* channel map for one of the `enum dma_ch` dma channels. the list
|
||||
* entry contains a set of low-level channel numbers, orred with
|
||||
* DMA_CH_VALID, which are checked in the order in the array.
|
||||
*/
|
||||
|
||||
struct s3c24xx_dma_order_ch {
|
||||
unsigned int list[S3C_DMA_CHANNELS]; /* list of channels */
|
||||
unsigned int flags; /* flags */
|
||||
};
|
||||
|
||||
/* struct s3c24xx_dma_order
|
||||
*
|
||||
* information provided by either the core or the board to give the
|
||||
* dma system a hint on how to allocate channels
|
||||
*/
|
||||
|
||||
struct s3c24xx_dma_order {
|
||||
struct s3c24xx_dma_order_ch channels[DMACH_MAX];
|
||||
};
|
||||
|
||||
extern int s3c24xx_dma_order_set(struct s3c24xx_dma_order *map);
|
||||
|
||||
/* DMA init code, called from the cpu support code */
|
||||
|
||||
extern int s3c2410_dma_init(void);
|
||||
|
||||
extern int s3c24xx_dma_init(unsigned int channels, unsigned int irq,
|
||||
unsigned int stride);
|
130
arch/arm/plat-samsung/include/plat/dma.h
Normal file
130
arch/arm/plat-samsung/include/plat/dma.h
Normal file
|
@ -0,0 +1,130 @@
|
|||
/* arch/arm/plat-samsung/include/plat/dma.h
|
||||
*
|
||||
* Copyright (C) 2003-2006 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Samsung S3C DMA support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_DMA_H
|
||||
#define __PLAT_DMA_H
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
enum s3c2410_dma_buffresult {
|
||||
S3C2410_RES_OK,
|
||||
S3C2410_RES_ERR,
|
||||
S3C2410_RES_ABORT
|
||||
};
|
||||
|
||||
/* enum s3c2410_chan_op
|
||||
*
|
||||
* operation codes passed to the DMA code by the user, and also used
|
||||
* to inform the current channel owner of any changes to the system state
|
||||
*/
|
||||
|
||||
enum s3c2410_chan_op {
|
||||
S3C2410_DMAOP_START,
|
||||
S3C2410_DMAOP_STOP,
|
||||
S3C2410_DMAOP_PAUSE,
|
||||
S3C2410_DMAOP_RESUME,
|
||||
S3C2410_DMAOP_FLUSH,
|
||||
S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */
|
||||
S3C2410_DMAOP_STARTED, /* indicate channel started */
|
||||
};
|
||||
|
||||
struct s3c2410_dma_client {
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct s3c2410_dma_chan;
|
||||
enum dma_ch;
|
||||
|
||||
/* s3c2410_dma_cbfn_t
|
||||
*
|
||||
* buffer callback routine type
|
||||
*/
|
||||
|
||||
typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,
|
||||
void *buf, int size,
|
||||
enum s3c2410_dma_buffresult result);
|
||||
|
||||
typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
|
||||
enum s3c2410_chan_op );
|
||||
|
||||
|
||||
|
||||
/* s3c2410_dma_request
|
||||
*
|
||||
* request a dma channel exclusivley
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_request(enum dma_ch channel,
|
||||
struct s3c2410_dma_client *, void *dev);
|
||||
|
||||
|
||||
/* s3c2410_dma_ctrl
|
||||
*
|
||||
* change the state of the dma channel
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op);
|
||||
|
||||
/* s3c2410_dma_setflags
|
||||
*
|
||||
* set the channel's flags to a given state
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_setflags(enum dma_ch channel,
|
||||
unsigned int flags);
|
||||
|
||||
/* s3c2410_dma_free
|
||||
*
|
||||
* free the dma channel (will also abort any outstanding operations)
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *);
|
||||
|
||||
/* s3c2410_dma_enqueue
|
||||
*
|
||||
* place the given buffer onto the queue of operations for the channel.
|
||||
* The buffer must be allocated from dma coherent memory, or the Dcache/WB
|
||||
* drained before the buffer is given to the DMA system.
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
|
||||
dma_addr_t data, int size);
|
||||
|
||||
/* s3c2410_dma_config
|
||||
*
|
||||
* configure the dma channel
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_config(enum dma_ch channel, int xferunit);
|
||||
|
||||
/* s3c2410_dma_devconfig
|
||||
*
|
||||
* configure the device we're talking to
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_devconfig(enum dma_ch channel,
|
||||
enum dma_data_direction source, unsigned long devaddr);
|
||||
|
||||
/* s3c2410_dma_getposition
|
||||
*
|
||||
* get the position that the dma transfer is currently at
|
||||
*/
|
||||
|
||||
extern int s3c2410_dma_getposition(enum dma_ch channel,
|
||||
dma_addr_t *src, dma_addr_t *dest);
|
||||
|
||||
extern int s3c2410_dma_set_opfn(enum dma_ch, s3c2410_dma_opfn_t rtn);
|
||||
extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn);
|
||||
|
||||
#include <plat/dma-ops.h>
|
||||
|
||||
#endif
|
29
arch/arm/plat-samsung/include/plat/fb-core.h
Normal file
29
arch/arm/plat-samsung/include/plat/fb-core.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* arch/arm/plat-samsung/include/plat/fb-core.h
|
||||
*
|
||||
* Copyright 2010 Samsung Electronics Co., Ltd.
|
||||
* Pawel Osciak <p.osciak@samsung.com>
|
||||
*
|
||||
* Samsung framebuffer driver core functions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __ASM_PLAT_FB_CORE_H
|
||||
#define __ASM_PLAT_FB_CORE_H __FILE__
|
||||
|
||||
/*
|
||||
* These functions are only for use with the core support code, such as
|
||||
* the CPU-specific initialization code.
|
||||
*/
|
||||
|
||||
/* Re-define device name depending on support. */
|
||||
static inline void s3c_fb_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_FB
|
||||
s3c_device_fb.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ASM_PLAT_FB_CORE_H */
|
72
arch/arm/plat-samsung/include/plat/fb-s3c2410.h
Normal file
72
arch/arm/plat-samsung/include/plat/fb-s3c2410.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* arch/arm/plat-samsung/include/plat/fb-s3c2410.h
|
||||
*
|
||||
* Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
|
||||
*
|
||||
* Inspired by pxafb.h
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_FB_S3C2410_H
|
||||
#define __ASM_PLAT_FB_S3C2410_H __FILE__
|
||||
|
||||
struct s3c2410fb_hw {
|
||||
unsigned long lcdcon1;
|
||||
unsigned long lcdcon2;
|
||||
unsigned long lcdcon3;
|
||||
unsigned long lcdcon4;
|
||||
unsigned long lcdcon5;
|
||||
};
|
||||
|
||||
/* LCD description */
|
||||
struct s3c2410fb_display {
|
||||
/* LCD type */
|
||||
unsigned type;
|
||||
|
||||
/* Screen size */
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
|
||||
/* Screen info */
|
||||
unsigned short xres;
|
||||
unsigned short yres;
|
||||
unsigned short bpp;
|
||||
|
||||
unsigned pixclock; /* pixclock in picoseconds */
|
||||
unsigned short left_margin; /* value in pixels (TFT) or HCLKs (STN) */
|
||||
unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */
|
||||
unsigned short hsync_len; /* value in pixels (TFT) or HCLKs (STN) */
|
||||
unsigned short upper_margin; /* value in lines (TFT) or 0 (STN) */
|
||||
unsigned short lower_margin; /* value in lines (TFT) or 0 (STN) */
|
||||
unsigned short vsync_len; /* value in lines (TFT) or 0 (STN) */
|
||||
|
||||
/* lcd configuration registers */
|
||||
unsigned long lcdcon5;
|
||||
};
|
||||
|
||||
struct s3c2410fb_mach_info {
|
||||
|
||||
struct s3c2410fb_display *displays; /* attached diplays info */
|
||||
unsigned num_displays; /* number of defined displays */
|
||||
unsigned default_display;
|
||||
|
||||
/* GPIOs */
|
||||
|
||||
unsigned long gpcup;
|
||||
unsigned long gpcup_mask;
|
||||
unsigned long gpccon;
|
||||
unsigned long gpccon_mask;
|
||||
unsigned long gpdup;
|
||||
unsigned long gpdup_mask;
|
||||
unsigned long gpdcon;
|
||||
unsigned long gpdcon_mask;
|
||||
|
||||
/* lpc3600 control register */
|
||||
unsigned long lpcsel;
|
||||
};
|
||||
|
||||
extern void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
|
||||
|
||||
#endif /* __ASM_PLAT_FB_S3C2410_H */
|
35
arch/arm/plat-samsung/include/plat/fb.h
Normal file
35
arch/arm/plat-samsung/include/plat/fb.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* arch/arm/plat-samsung/include/plat/fb.h
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C - FB platform data definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_S3C_FB_H
|
||||
#define __PLAT_S3C_FB_H __FILE__
|
||||
|
||||
#include <linux/platform_data/video_s3c.h>
|
||||
|
||||
/**
|
||||
* s3c_fb_set_platdata() - Setup the FB device with platform data.
|
||||
* @pd: The platform data to set. The data is copied from the passed structure
|
||||
* so the machine data can mark the data __initdata so that any unused
|
||||
* machines will end up dumping their data at runtime.
|
||||
*/
|
||||
extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
|
||||
|
||||
/**
|
||||
* s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD
|
||||
*
|
||||
* Initialise the GPIO for an 24bpp LCD display on the RGB interface.
|
||||
*/
|
||||
extern void s3c64xx_fb_gpio_setup_24bpp(void);
|
||||
|
||||
#endif /* __PLAT_S3C_FB_H */
|
163
arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
Normal file
163
arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
Normal file
|
@ -0,0 +1,163 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/gpio-cfg-helper.h
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Samsung Platform - GPIO pin configuration helper definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/* This is meant for core cpu support, machine or other driver files
|
||||
* should not be including this header.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_GPIO_CFG_HELPERS_H
|
||||
#define __PLAT_GPIO_CFG_HELPERS_H __FILE__
|
||||
|
||||
/* As a note, all gpio configuration functions are entered exclusively, either
|
||||
* with the relevant lock held or the system prevented from doing anything else
|
||||
* by disabling interrupts.
|
||||
*/
|
||||
|
||||
static inline int samsung_gpio_do_setcfg(struct samsung_gpio_chip *chip,
|
||||
unsigned int off, unsigned int config)
|
||||
{
|
||||
return (chip->config->set_config)(chip, off, config);
|
||||
}
|
||||
|
||||
static inline unsigned samsung_gpio_do_getcfg(struct samsung_gpio_chip *chip,
|
||||
unsigned int off)
|
||||
{
|
||||
return (chip->config->get_config)(chip, off);
|
||||
}
|
||||
|
||||
static inline int samsung_gpio_do_setpull(struct samsung_gpio_chip *chip,
|
||||
unsigned int off, samsung_gpio_pull_t pull)
|
||||
{
|
||||
return (chip->config->set_pull)(chip, off, pull);
|
||||
}
|
||||
|
||||
static inline samsung_gpio_pull_t samsung_gpio_do_getpull(struct samsung_gpio_chip *chip,
|
||||
unsigned int off)
|
||||
{
|
||||
return chip->config->get_pull(chip, off);
|
||||
}
|
||||
|
||||
/* Pull-{up,down} resistor controls.
|
||||
*
|
||||
* S3C2410,S3C2440 = Pull-UP,
|
||||
* S3C2412,S3C2413 = Pull-Down
|
||||
* S3C6400,S3C6410 = Pull-Both [None,Down,Up,Undef]
|
||||
* S3C2443 = Pull-Both [not same as S3C6400]
|
||||
*/
|
||||
|
||||
/**
|
||||
* s3c24xx_gpio_setpull_1up() - Pull configuration for choice of up or none.
|
||||
* @chip: The gpio chip that is being configured.
|
||||
* @off: The offset for the GPIO being configured.
|
||||
* @param: pull: The pull mode being requested.
|
||||
*
|
||||
* This is a helper function for the case where we have GPIOs with one
|
||||
* bit configuring the presence of a pull-up resistor.
|
||||
*/
|
||||
extern int s3c24xx_gpio_setpull_1up(struct samsung_gpio_chip *chip,
|
||||
unsigned int off, samsung_gpio_pull_t pull);
|
||||
|
||||
/**
|
||||
* s3c24xx_gpio_setpull_1down() - Pull configuration for choice of down or none
|
||||
* @chip: The gpio chip that is being configured
|
||||
* @off: The offset for the GPIO being configured
|
||||
* @param: pull: The pull mode being requested
|
||||
*
|
||||
* This is a helper function for the case where we have GPIOs with one
|
||||
* bit configuring the presence of a pull-down resistor.
|
||||
*/
|
||||
extern int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip,
|
||||
unsigned int off, samsung_gpio_pull_t pull);
|
||||
|
||||
/**
|
||||
* samsung_gpio_setpull_upown() - Pull configuration for choice of up,
|
||||
* down or none
|
||||
*
|
||||
* @chip: The gpio chip that is being configured.
|
||||
* @off: The offset for the GPIO being configured.
|
||||
* @param: pull: The pull mode being requested.
|
||||
*
|
||||
* This is a helper function for the case where we have GPIOs with two
|
||||
* bits configuring the presence of a pull resistor, in the following
|
||||
* order:
|
||||
* 00 = No pull resistor connected
|
||||
* 01 = Pull-up resistor connected
|
||||
* 10 = Pull-down resistor connected
|
||||
*/
|
||||
extern int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
|
||||
unsigned int off, samsung_gpio_pull_t pull);
|
||||
|
||||
/**
|
||||
* samsung_gpio_getpull_updown() - Get configuration for choice of up,
|
||||
* down or none
|
||||
*
|
||||
* @chip: The gpio chip that the GPIO pin belongs to
|
||||
* @off: The offset to the pin to get the configuration of.
|
||||
*
|
||||
* This helper function reads the state of the pull-{up,down} resistor
|
||||
* for the given GPIO in the same case as samsung_gpio_setpull_upown.
|
||||
*/
|
||||
extern samsung_gpio_pull_t samsung_gpio_getpull_updown(struct samsung_gpio_chip *chip,
|
||||
unsigned int off);
|
||||
|
||||
/**
|
||||
* s3c24xx_gpio_getpull_1up() - Get configuration for choice of up or none
|
||||
* @chip: The gpio chip that the GPIO pin belongs to
|
||||
* @off: The offset to the pin to get the configuration of.
|
||||
*
|
||||
* This helper function reads the state of the pull-up resistor for the
|
||||
* given GPIO in the same case as s3c24xx_gpio_setpull_1up.
|
||||
*/
|
||||
extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1up(struct samsung_gpio_chip *chip,
|
||||
unsigned int off);
|
||||
|
||||
/**
|
||||
* s3c24xx_gpio_getpull_1down() - Get configuration for choice of down or none
|
||||
* @chip: The gpio chip that the GPIO pin belongs to
|
||||
* @off: The offset to the pin to get the configuration of.
|
||||
*
|
||||
* This helper function reads the state of the pull-down resistor for the
|
||||
* given GPIO in the same case as s3c24xx_gpio_setpull_1down.
|
||||
*/
|
||||
extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1down(struct samsung_gpio_chip *chip,
|
||||
unsigned int off);
|
||||
|
||||
/**
|
||||
* s3c2443_gpio_setpull() - Pull configuration for s3c2443.
|
||||
* @chip: The gpio chip that is being configured.
|
||||
* @off: The offset for the GPIO being configured.
|
||||
* @param: pull: The pull mode being requested.
|
||||
*
|
||||
* This is a helper function for the case where we have GPIOs with two
|
||||
* bits configuring the presence of a pull resistor, in the following
|
||||
* order:
|
||||
* 00 = Pull-up resistor connected
|
||||
* 10 = Pull-down resistor connected
|
||||
* x1 = No pull up resistor
|
||||
*/
|
||||
extern int s3c2443_gpio_setpull(struct samsung_gpio_chip *chip,
|
||||
unsigned int off, samsung_gpio_pull_t pull);
|
||||
|
||||
/**
|
||||
* s3c2443_gpio_getpull() - Get configuration for s3c2443 pull resistors
|
||||
* @chip: The gpio chip that the GPIO pin belongs to.
|
||||
* @off: The offset to the pin to get the configuration of.
|
||||
*
|
||||
* This helper function reads the state of the pull-{up,down} resistor for the
|
||||
* given GPIO in the same case as samsung_gpio_setpull_upown.
|
||||
*/
|
||||
extern samsung_gpio_pull_t s3c2443_gpio_getpull(struct samsung_gpio_chip *chip,
|
||||
unsigned int off);
|
||||
|
||||
#endif /* __PLAT_GPIO_CFG_HELPERS_H */
|
182
arch/arm/plat-samsung/include/plat/gpio-cfg.h
Normal file
182
arch/arm/plat-samsung/include/plat/gpio-cfg.h
Normal file
|
@ -0,0 +1,182 @@
|
|||
/* linux/arch/arm/plat-s3c/include/plat/gpio-cfg.h
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C Platform - GPIO pin configuration
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/* This file contains the necessary definitions to get the basic gpio
|
||||
* pin configuration done such as setting a pin to input or output or
|
||||
* changing the pull-{up,down} configurations.
|
||||
*/
|
||||
|
||||
/* Note, this interface is being added to the s3c64xx arch first and will
|
||||
* be added to the s3c24xx systems later.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_GPIO_CFG_H
|
||||
#define __PLAT_GPIO_CFG_H __FILE__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef unsigned int __bitwise__ samsung_gpio_pull_t;
|
||||
|
||||
/* forward declaration if gpio-core.h hasn't been included */
|
||||
struct samsung_gpio_chip;
|
||||
|
||||
/**
|
||||
* struct samsung_gpio_cfg GPIO configuration
|
||||
* @cfg_eint: Configuration setting when used for external interrupt source
|
||||
* @get_pull: Read the current pull configuration for the GPIO
|
||||
* @set_pull: Set the current pull configuraiton for the GPIO
|
||||
* @set_config: Set the current configuration for the GPIO
|
||||
* @get_config: Read the current configuration for the GPIO
|
||||
*
|
||||
* Each chip can have more than one type of GPIO bank available and some
|
||||
* have different capabilites even when they have the same control register
|
||||
* layouts. Provide an point to vector control routine and provide any
|
||||
* per-bank configuration information that other systems such as the
|
||||
* external interrupt code will need.
|
||||
*
|
||||
* @sa samsung_gpio_cfgpin
|
||||
* @sa s3c_gpio_getcfg
|
||||
* @sa s3c_gpio_setpull
|
||||
* @sa s3c_gpio_getpull
|
||||
*/
|
||||
struct samsung_gpio_cfg {
|
||||
unsigned int cfg_eint;
|
||||
|
||||
samsung_gpio_pull_t (*get_pull)(struct samsung_gpio_chip *chip, unsigned offs);
|
||||
int (*set_pull)(struct samsung_gpio_chip *chip, unsigned offs,
|
||||
samsung_gpio_pull_t pull);
|
||||
|
||||
unsigned (*get_config)(struct samsung_gpio_chip *chip, unsigned offs);
|
||||
int (*set_config)(struct samsung_gpio_chip *chip, unsigned offs,
|
||||
unsigned config);
|
||||
};
|
||||
|
||||
#define S3C_GPIO_SPECIAL_MARK (0xfffffff0)
|
||||
#define S3C_GPIO_SPECIAL(x) (S3C_GPIO_SPECIAL_MARK | (x))
|
||||
|
||||
/* Defines for generic pin configurations */
|
||||
#define S3C_GPIO_INPUT (S3C_GPIO_SPECIAL(0))
|
||||
#define S3C_GPIO_OUTPUT (S3C_GPIO_SPECIAL(1))
|
||||
#define S3C_GPIO_SFN(x) (S3C_GPIO_SPECIAL(x))
|
||||
|
||||
#define samsung_gpio_is_cfg_special(_cfg) \
|
||||
(((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)
|
||||
|
||||
/**
|
||||
* s3c_gpio_cfgpin() - Change the GPIO function of a pin.
|
||||
* @pin pin The pin number to configure.
|
||||
* @to to The configuration for the pin's function.
|
||||
*
|
||||
* Configure which function is actually connected to the external
|
||||
* pin, such as an gpio input, output or some form of special function
|
||||
* connected to an internal peripheral block.
|
||||
*
|
||||
* The @to parameter can be one of the generic S3C_GPIO_INPUT, S3C_GPIO_OUTPUT
|
||||
* or S3C_GPIO_SFN() to indicate one of the possible values that the helper
|
||||
* will then generate the correct bit mask and shift for the configuration.
|
||||
*
|
||||
* If a bank of GPIOs all needs to be set to special-function 2, then
|
||||
* the following code will work:
|
||||
*
|
||||
* for (gpio = start; gpio < end; gpio++)
|
||||
* s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
|
||||
*
|
||||
* The @to parameter can also be a specific value already shifted to the
|
||||
* correct position in the control register, although these are discouraged
|
||||
* in newer kernels and are only being kept for compatibility.
|
||||
*/
|
||||
extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
|
||||
|
||||
/**
|
||||
* s3c_gpio_getcfg - Read the current function for a GPIO pin
|
||||
* @pin: The pin to read the configuration value for.
|
||||
*
|
||||
* Read the configuration state of the given @pin, returning a value that
|
||||
* could be passed back to s3c_gpio_cfgpin().
|
||||
*
|
||||
* @sa s3c_gpio_cfgpin
|
||||
*/
|
||||
extern unsigned s3c_gpio_getcfg(unsigned int pin);
|
||||
|
||||
/**
|
||||
* s3c_gpio_cfgpin_range() - Change the GPIO function for configuring pin range
|
||||
* @start: The pin number to start at
|
||||
* @nr: The number of pins to configure from @start.
|
||||
* @cfg: The configuration for the pin's function
|
||||
*
|
||||
* Call s3c_gpio_cfgpin() for the @nr pins starting at @start.
|
||||
*
|
||||
* @sa s3c_gpio_cfgpin.
|
||||
*/
|
||||
extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
|
||||
unsigned int cfg);
|
||||
|
||||
/* Define values for the pull-{up,down} available for each gpio pin.
|
||||
*
|
||||
* These values control the state of the weak pull-{up,down} resistors
|
||||
* available on most pins on the S3C series. Not all chips support both
|
||||
* up or down settings, and it may be dependent on the chip that is being
|
||||
* used to whether the particular mode is available.
|
||||
*/
|
||||
#define S3C_GPIO_PULL_NONE ((__force samsung_gpio_pull_t)0x00)
|
||||
#define S3C_GPIO_PULL_DOWN ((__force samsung_gpio_pull_t)0x01)
|
||||
#define S3C_GPIO_PULL_UP ((__force samsung_gpio_pull_t)0x02)
|
||||
|
||||
/**
|
||||
* s3c_gpio_setpull() - set the state of a gpio pin pull resistor
|
||||
* @pin: The pin number to configure the pull resistor.
|
||||
* @pull: The configuration for the pull resistor.
|
||||
*
|
||||
* This function sets the state of the pull-{up,down} resistor for the
|
||||
* specified pin. It will return 0 if successful, or a negative error
|
||||
* code if the pin cannot support the requested pull setting.
|
||||
*
|
||||
* @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP.
|
||||
*/
|
||||
extern int s3c_gpio_setpull(unsigned int pin, samsung_gpio_pull_t pull);
|
||||
|
||||
/**
|
||||
* s3c_gpio_getpull() - get the pull resistor state of a gpio pin
|
||||
* @pin: The pin number to get the settings for
|
||||
*
|
||||
* Read the pull resistor value for the specified pin.
|
||||
*/
|
||||
extern samsung_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
|
||||
|
||||
/* configure `all` aspects of an gpio */
|
||||
|
||||
/**
|
||||
* s3c_gpio_cfgall_range() - configure range of gpio functtion and pull.
|
||||
* @start: The gpio number to start at.
|
||||
* @nr: The number of gpio to configure from @start.
|
||||
* @cfg: The configuration to use
|
||||
* @pull: The pull setting to use.
|
||||
*
|
||||
* Run s3c_gpio_cfgpin() and s3c_gpio_setpull() over the gpio range starting
|
||||
* @gpio and running for @size.
|
||||
*
|
||||
* @sa s3c_gpio_cfgpin
|
||||
* @sa s3c_gpio_setpull
|
||||
* @sa s3c_gpio_cfgpin_range
|
||||
*/
|
||||
extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
|
||||
unsigned int cfg, samsung_gpio_pull_t pull);
|
||||
|
||||
static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size,
|
||||
unsigned int cfg)
|
||||
{
|
||||
return s3c_gpio_cfgall_range(pin, size, cfg, S3C_GPIO_PULL_NONE);
|
||||
}
|
||||
|
||||
#endif /* __PLAT_GPIO_CFG_H */
|
145
arch/arm/plat-samsung/include/plat/gpio-core.h
Normal file
145
arch/arm/plat-samsung/include/plat/gpio-core.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
/* linux/arch/arm/plat-s3c/include/plat/gpio-core.h
|
||||
*
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C Platform - GPIO core
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_SAMSUNG_GPIO_CORE_H
|
||||
#define __PLAT_SAMSUNG_GPIO_CORE_H
|
||||
|
||||
/* Bring in machine-local definitions, especially S3C_GPIO_END */
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
#define GPIOCON_OFF (0x00)
|
||||
#define GPIODAT_OFF (0x04)
|
||||
|
||||
#define con_4bit_shift(__off) ((__off) * 4)
|
||||
|
||||
/* Define the core gpiolib support functions that the s3c platforms may
|
||||
* need to extend or change depending on the hardware and the s3c chip
|
||||
* selected at build or found at run time.
|
||||
*
|
||||
* These definitions are not intended for driver inclusion, there is
|
||||
* nothing here that should not live outside the platform and core
|
||||
* specific code.
|
||||
*/
|
||||
|
||||
struct samsung_gpio_chip;
|
||||
|
||||
/**
|
||||
* struct samsung_gpio_pm - power management (suspend/resume) information
|
||||
* @save: Routine to save the state of the GPIO block
|
||||
* @resume: Routine to resume the GPIO block.
|
||||
*/
|
||||
struct samsung_gpio_pm {
|
||||
void (*save)(struct samsung_gpio_chip *chip);
|
||||
void (*resume)(struct samsung_gpio_chip *chip);
|
||||
};
|
||||
|
||||
struct samsung_gpio_cfg;
|
||||
|
||||
/**
|
||||
* struct samsung_gpio_chip - wrapper for specific implementation of gpio
|
||||
* @chip: The chip structure to be exported via gpiolib.
|
||||
* @base: The base pointer to the gpio configuration registers.
|
||||
* @group: The group register number for gpio interrupt support.
|
||||
* @irq_base: The base irq number.
|
||||
* @config: special function and pull-resistor control information.
|
||||
* @lock: Lock for exclusive access to this gpio bank.
|
||||
* @pm_save: Save information for suspend/resume support.
|
||||
* @bitmap_gpio_int: Bitmap for representing GPIO interrupt or not.
|
||||
*
|
||||
* This wrapper provides the necessary information for the Samsung
|
||||
* specific gpios being registered with gpiolib.
|
||||
*
|
||||
* The lock protects each gpio bank from multiple access of the shared
|
||||
* configuration registers, or from reading of data whilst another thread
|
||||
* is writing to the register set.
|
||||
*
|
||||
* Each chip has its own lock to avoid any contention between different
|
||||
* CPU cores trying to get one lock for different GPIO banks, where each
|
||||
* bank of GPIO has its own register space and configuration registers.
|
||||
*/
|
||||
struct samsung_gpio_chip {
|
||||
struct gpio_chip chip;
|
||||
struct samsung_gpio_cfg *config;
|
||||
struct samsung_gpio_pm *pm;
|
||||
void __iomem *base;
|
||||
int irq_base;
|
||||
int group;
|
||||
spinlock_t lock;
|
||||
#ifdef CONFIG_PM
|
||||
u32 pm_save[4];
|
||||
#endif
|
||||
u32 bitmap_gpio_int;
|
||||
};
|
||||
|
||||
static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc)
|
||||
{
|
||||
return container_of(gpc, struct samsung_gpio_chip, chip);
|
||||
}
|
||||
|
||||
/**
|
||||
* samsung_gpiolib_to_irq - convert gpio pin to irq number
|
||||
* @chip: The gpio chip that the pin belongs to.
|
||||
* @offset: The offset of the pin in the chip.
|
||||
*
|
||||
* This helper returns the irq number calculated from the chip->irq_base and
|
||||
* the provided offset.
|
||||
*/
|
||||
extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset);
|
||||
|
||||
/* exported for core SoC support to change */
|
||||
extern struct samsung_gpio_cfg s3c24xx_gpiocfg_default;
|
||||
|
||||
#ifdef CONFIG_S3C_GPIO_TRACK
|
||||
extern struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
|
||||
|
||||
static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int chip)
|
||||
{
|
||||
return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL;
|
||||
}
|
||||
#else
|
||||
/* machine specific code should provide samsung_gpiolib_getchip */
|
||||
|
||||
extern struct samsung_gpio_chip s3c24xx_gpios[];
|
||||
|
||||
static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int pin)
|
||||
{
|
||||
struct samsung_gpio_chip *chip;
|
||||
|
||||
if (pin > S3C_GPIO_END)
|
||||
return NULL;
|
||||
|
||||
chip = &s3c24xx_gpios[pin/32];
|
||||
return ((pin - chip->chip.base) < chip->chip.ngpio) ? chip : NULL;
|
||||
}
|
||||
|
||||
static inline void s3c_gpiolib_track(struct samsung_gpio_chip *chip) { }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
extern struct samsung_gpio_pm samsung_gpio_pm_1bit;
|
||||
extern struct samsung_gpio_pm samsung_gpio_pm_2bit;
|
||||
extern struct samsung_gpio_pm samsung_gpio_pm_4bit;
|
||||
#define __gpio_pm(x) x
|
||||
#else
|
||||
#define samsung_gpio_pm_1bit NULL
|
||||
#define samsung_gpio_pm_2bit NULL
|
||||
#define samsung_gpio_pm_4bit NULL
|
||||
#define __gpio_pm(x) NULL
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
/* locking wrappers to deal with multiple access to the same gpio bank */
|
||||
#define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl)
|
||||
#define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl)
|
||||
|
||||
#endif /* __PLAT_SAMSUNG_GPIO_CORE_H */
|
42
arch/arm/plat-samsung/include/plat/iic-core.h
Normal file
42
arch/arm/plat-samsung/include/plat/iic-core.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* arch/arm/mach-s3c2410/include/mach/iic-core.h
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C - I2C Controller core functions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_IIC_CORE_H
|
||||
#define __ASM_ARCH_IIC_CORE_H __FILE__
|
||||
|
||||
/* These functions are only for use with the core support code, such as
|
||||
* the cpu specific initialisation code
|
||||
*/
|
||||
|
||||
/* re-define device name depending on support. */
|
||||
static inline void s3c_i2c0_setname(char *name)
|
||||
{
|
||||
/* currently this device is always compiled in */
|
||||
s3c_device_i2c0.name = name;
|
||||
}
|
||||
|
||||
static inline void s3c_i2c1_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_I2C1
|
||||
s3c_device_i2c1.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void s3c_i2c2_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_I2C2
|
||||
s3c_device_i2c2.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ASM_ARCH_IIC_H */
|
20
arch/arm/plat-samsung/include/plat/irq-uart.h
Normal file
20
arch/arm/plat-samsung/include/plat/irq-uart.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* arch/arm/plat-samsung/include/plat/irq-uart.h
|
||||
*
|
||||
* Copyright (c) 2010 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Header file for Samsung SoC UART IRQ demux for S3C64XX and later
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
struct s3c_uart_irq {
|
||||
void __iomem *regs;
|
||||
unsigned int base_irq;
|
||||
unsigned int parent_irq;
|
||||
};
|
||||
|
||||
extern void s3c_init_uart_irqs(struct s3c_uart_irq *irq, unsigned int nr_irqs);
|
||||
|
31
arch/arm/plat-samsung/include/plat/keypad-core.h
Normal file
31
arch/arm/plat-samsung/include/plat/keypad-core.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* linux/arch/arm/plat-samsung/include/plat/keypad-core.h
|
||||
*
|
||||
* Copyright (C) 2010 Samsung Electronics Co.Ltd
|
||||
* Author: Joonyoung Shim <jy0922.shim@samsung.com>
|
||||
*
|
||||
* Samsung keypad controller core function
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_KEYPAD_CORE_H
|
||||
#define __ASM_ARCH_KEYPAD_CORE_H
|
||||
|
||||
/* These function are only for use with the core support code, such as
|
||||
* the cpu specific initialisation code
|
||||
*/
|
||||
|
||||
/* re-define device name depending on support. */
|
||||
static inline void samsung_keypad_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
|
||||
samsung_device_keypad.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ASM_ARCH_KEYPAD_CORE_H */
|
31
arch/arm/plat-samsung/include/plat/keypad.h
Normal file
31
arch/arm/plat-samsung/include/plat/keypad.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Samsung Platform - Keypad platform data definitions
|
||||
*
|
||||
* Copyright (C) 2010 Samsung Electronics Co.Ltd
|
||||
* Author: Joonyoung Shim <jy0922.shim@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_SAMSUNG_KEYPAD_H
|
||||
#define __PLAT_SAMSUNG_KEYPAD_H
|
||||
|
||||
#include <linux/input/samsung-keypad.h>
|
||||
|
||||
/**
|
||||
* samsung_keypad_set_platdata - Set platform data for Samsung Keypad device.
|
||||
* @pd: Platform data to register to device.
|
||||
*
|
||||
* Register the given platform data for use with Samsung Keypad device.
|
||||
* The call will copy the platform data, so the board definitions can
|
||||
* make the structure itself __initdata.
|
||||
*/
|
||||
extern void samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd);
|
||||
|
||||
/* defined by architecture to configure gpio. */
|
||||
extern void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols);
|
||||
|
||||
#endif /* __PLAT_SAMSUNG_KEYPAD_H */
|
46
arch/arm/plat-samsung/include/plat/map-base.h
Normal file
46
arch/arm/plat-samsung/include/plat/map-base.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* linux/include/asm-arm/plat-s3c/map.h
|
||||
*
|
||||
* Copyright 2003, 2007 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C - Memory map definitions (virtual addresses)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_MAP_H
|
||||
#define __ASM_PLAT_MAP_H __FILE__
|
||||
|
||||
/* Fit all our registers in at 0xF6000000 upwards, trying to use as
|
||||
* little of the VA space as possible so vmalloc and friends have a
|
||||
* better chance of getting memory.
|
||||
*
|
||||
* we try to ensure stuff like the IRQ registers are available for
|
||||
* an single MOVS instruction (ie, only 8 bits of set data)
|
||||
*/
|
||||
|
||||
#define S3C_ADDR_BASE 0xF6000000
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE + (x))
|
||||
#else
|
||||
#define S3C_ADDR(x) (S3C_ADDR_BASE + (x))
|
||||
#endif
|
||||
|
||||
#define S3C_VA_IRQ S3C_ADDR(0x00000000) /* irq controller(s) */
|
||||
#define S3C_VA_SYS S3C_ADDR(0x00100000) /* system control */
|
||||
#define S3C_VA_MEM S3C_ADDR(0x00200000) /* memory control */
|
||||
#define S3C_VA_TIMER S3C_ADDR(0x00300000) /* timer block */
|
||||
#define S3C_VA_WATCHDOG S3C_ADDR(0x00400000) /* watchdog */
|
||||
#define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */
|
||||
|
||||
/* This is used for the CPU specific mappings that may be needed, so that
|
||||
* they do not need to directly used S3C_ADDR() and thus make it easier to
|
||||
* modify the space for mapping.
|
||||
*/
|
||||
#define S3C_ADDR_CPU(x) S3C_ADDR(0x00500000 + (x))
|
||||
|
||||
#endif /* __ASM_PLAT_MAP_H */
|
84
arch/arm/plat-samsung/include/plat/map-s3c.h
Normal file
84
arch/arm/plat-samsung/include/plat/map-s3c.h
Normal file
|
@ -0,0 +1,84 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/map-s3c.h
|
||||
*
|
||||
* Copyright (c) 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C24XX - Memory map definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_MAP_S3C_H
|
||||
#define __ASM_PLAT_MAP_S3C_H __FILE__
|
||||
|
||||
#define S3C24XX_VA_IRQ S3C_VA_IRQ
|
||||
#define S3C24XX_VA_MEMCTRL S3C_VA_MEM
|
||||
#define S3C24XX_VA_UART S3C_VA_UART
|
||||
|
||||
#define S3C24XX_VA_TIMER S3C_VA_TIMER
|
||||
#define S3C24XX_VA_CLKPWR S3C_VA_SYS
|
||||
#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG
|
||||
|
||||
#define S3C2412_VA_SSMC S3C_ADDR_CPU(0x00000000)
|
||||
#define S3C2412_VA_EBI S3C_ADDR_CPU(0x00100000)
|
||||
|
||||
#define S3C2410_PA_UART (0x50000000)
|
||||
#define S3C24XX_PA_UART S3C2410_PA_UART
|
||||
|
||||
#ifndef S3C_UART_OFFSET
|
||||
#define S3C_UART_OFFSET (0x400)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GPIO ports
|
||||
*
|
||||
* the calculation for the VA of this must ensure that
|
||||
* it is the same distance apart from the UART in the
|
||||
* phsyical address space, as the initial mapping for the IO
|
||||
* is done as a 1:1 mapping. This puts it (currently) at
|
||||
* 0xFA800000, which is not in the way of any current mapping
|
||||
* by the base system.
|
||||
*/
|
||||
|
||||
#define S3C2410_PA_GPIO (0x56000000)
|
||||
#define S3C24XX_PA_GPIO S3C2410_PA_GPIO
|
||||
|
||||
#define S3C24XX_VA_GPIO ((S3C24XX_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
|
||||
#define S3C64XX_VA_GPIO S3C_ADDR_CPU(0x00000000)
|
||||
|
||||
#define S3C64XX_VA_MODEM S3C_ADDR_CPU(0x00100000)
|
||||
#define S3C64XX_VA_USB_HSPHY S3C_ADDR_CPU(0x00200000)
|
||||
|
||||
#define S3C_VA_USB_HSPHY S3C64XX_VA_USB_HSPHY
|
||||
|
||||
/*
|
||||
* ISA style IO, for each machine to sort out mappings for,
|
||||
* if it implements it. We reserve two 16M regions for ISA.
|
||||
*/
|
||||
|
||||
#define S3C2410_ADDR(x) S3C_ADDR(x)
|
||||
|
||||
#define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000)
|
||||
#define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000)
|
||||
|
||||
/* deal with the registers that move under the 2412/2413 */
|
||||
|
||||
#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
|
||||
#ifndef __ASSEMBLY__
|
||||
extern void __iomem *s3c24xx_va_gpio2;
|
||||
#endif
|
||||
#ifdef CONFIG_CPU_S3C2412_ONLY
|
||||
#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
|
||||
#else
|
||||
#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
|
||||
#endif
|
||||
#else
|
||||
#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
|
||||
#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
|
||||
#endif
|
||||
|
||||
#include <plat/map-s5p.h>
|
||||
|
||||
#endif /* __ASM_PLAT_MAP_S3C_H */
|
61
arch/arm/plat-samsung/include/plat/map-s5p.h
Normal file
61
arch/arm/plat-samsung/include/plat/map-s5p.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/map-s5p.h
|
||||
*
|
||||
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com/
|
||||
*
|
||||
* S5P - Memory map definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_MAP_S5P_H
|
||||
#define __ASM_PLAT_MAP_S5P_H __FILE__
|
||||
|
||||
#define S5P_VA_CHIPID S3C_ADDR(0x02000000)
|
||||
#define S5P_VA_CMU S3C_ADDR(0x02100000)
|
||||
#define S5P_VA_GPIO S3C_ADDR(0x02200000)
|
||||
#define S5P_VA_GPIO1 S5P_VA_GPIO
|
||||
#define S5P_VA_GPIO2 S3C_ADDR(0x02240000)
|
||||
#define S5P_VA_GPIO3 S3C_ADDR(0x02280000)
|
||||
|
||||
#define S5P_VA_SYSRAM S3C_ADDR(0x02400000)
|
||||
#define S5P_VA_SYSRAM_NS S3C_ADDR(0x02410000)
|
||||
#define S5P_VA_DMC0 S3C_ADDR(0x02440000)
|
||||
#define S5P_VA_DMC1 S3C_ADDR(0x02480000)
|
||||
#define S5P_VA_SROMC S3C_ADDR(0x024C0000)
|
||||
|
||||
#define S5P_VA_SYSTIMER S3C_ADDR(0x02500000)
|
||||
#define S5P_VA_L2CC S3C_ADDR(0x02600000)
|
||||
|
||||
#define S5P_VA_COMBINER_BASE S3C_ADDR(0x02700000)
|
||||
#define S5P_VA_COMBINER(x) (S5P_VA_COMBINER_BASE + ((x) >> 2) * 0x10)
|
||||
|
||||
#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000)
|
||||
#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x))
|
||||
#define S5P_VA_SCU S5P_VA_COREPERI(0x0)
|
||||
#define S5P_VA_TWD S5P_VA_COREPERI(0x600)
|
||||
|
||||
#define S5P_VA_GIC_CPU S3C_ADDR(0x02810000)
|
||||
#define S5P_VA_GIC_DIST S3C_ADDR(0x02820000)
|
||||
|
||||
#define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000))
|
||||
#define VA_VIC0 VA_VIC(0)
|
||||
#define VA_VIC1 VA_VIC(1)
|
||||
#define VA_VIC2 VA_VIC(2)
|
||||
#define VA_VIC3 VA_VIC(3)
|
||||
|
||||
#define S5P_VA_UART(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
|
||||
#define S5P_VA_UART0 S5P_VA_UART(0)
|
||||
#define S5P_VA_UART1 S5P_VA_UART(1)
|
||||
#define S5P_VA_UART2 S5P_VA_UART(2)
|
||||
#define S5P_VA_UART3 S5P_VA_UART(3)
|
||||
|
||||
#ifndef S3C_UART_OFFSET
|
||||
#define S3C_UART_OFFSET (0x400)
|
||||
#endif
|
||||
|
||||
#include <plat/map-s3c.h>
|
||||
|
||||
#endif /* __ASM_PLAT_MAP_S5P_H */
|
28
arch/arm/plat-samsung/include/plat/nand-core.h
Normal file
28
arch/arm/plat-samsung/include/plat/nand-core.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* arch/arm/plat-samsung/include/plat/nand-core.h
|
||||
*
|
||||
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com/
|
||||
*
|
||||
* S3C - Nand Controller core functions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_NAND_CORE_H
|
||||
#define __ASM_ARCH_NAND_CORE_H __FILE__
|
||||
|
||||
/* These functions are only for use with the core support code, such as
|
||||
* the cpu specific initialisation code
|
||||
*/
|
||||
|
||||
/* re-define device name depending on support. */
|
||||
static inline void s3c_nand_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_NAND
|
||||
s3c_device_nand.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ASM_ARCH_NAND_CORE_H */
|
37
arch/arm/plat-samsung/include/plat/onenand-core.h
Normal file
37
arch/arm/plat-samsung/include/plat/onenand-core.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* linux/arch/arm/plat-samsung/onenand-core.h
|
||||
*
|
||||
* Copyright (c) 2010 Samsung Electronics
|
||||
* Kyungmin Park <kyungmin.park@samsung.com>
|
||||
* Marek Szyprowski <m.szyprowski@samsung.com>
|
||||
*
|
||||
* Samsung OneNAD Controller core functions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_ONENAND_CORE_H
|
||||
#define __ASM_ARCH_ONENAND_CORE_H __FILE__
|
||||
|
||||
/* These functions are only for use with the core support code, such as
|
||||
* the cpu specific initialisation code
|
||||
*/
|
||||
|
||||
/* re-define device name depending on support. */
|
||||
static inline void s3c_onenand_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_ONENAND
|
||||
s3c_device_onenand.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void s3c64xx_onenand1_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_S3C64XX_DEV_ONENAND1
|
||||
s3c64xx_device_onenand1.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __ASM_ARCH_ONENAND_CORE_H */
|
110
arch/arm/plat-samsung/include/plat/pm-common.h
Normal file
110
arch/arm/plat-samsung/include/plat/pm-common.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Samsung Electronics Co., Ltd.
|
||||
* Tomasz Figa <t.figa@samsung.com>
|
||||
* Copyright (c) 2004 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Written by Ben Dooks, <ben@simtec.co.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_SAMSUNG_PM_COMMON_H
|
||||
#define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
|
||||
|
||||
#include <linux/irq.h>
|
||||
|
||||
/* sleep save info */
|
||||
|
||||
/**
|
||||
* struct sleep_save - save information for shared peripherals.
|
||||
* @reg: Pointer to the register to save.
|
||||
* @val: Holder for the value saved from reg.
|
||||
*
|
||||
* This describes a list of registers which is used by the pm core and
|
||||
* other subsystem to save and restore register values over suspend.
|
||||
*/
|
||||
struct sleep_save {
|
||||
void __iomem *reg;
|
||||
unsigned long val;
|
||||
};
|
||||
|
||||
#define SAVE_ITEM(x) \
|
||||
{ .reg = (x) }
|
||||
|
||||
/* helper functions to save/restore lists of registers. */
|
||||
|
||||
extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
|
||||
extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
|
||||
extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
|
||||
|
||||
/* PM debug functions */
|
||||
|
||||
/**
|
||||
* struct pm_uart_save - save block for core UART
|
||||
* @ulcon: Save value for S3C2410_ULCON
|
||||
* @ucon: Save value for S3C2410_UCON
|
||||
* @ufcon: Save value for S3C2410_UFCON
|
||||
* @umcon: Save value for S3C2410_UMCON
|
||||
* @ubrdiv: Save value for S3C2410_UBRDIV
|
||||
*
|
||||
* Save block for UART registers to be held over sleep and restored if they
|
||||
* are needed (say by debug).
|
||||
*/
|
||||
struct pm_uart_save {
|
||||
u32 ulcon;
|
||||
u32 ucon;
|
||||
u32 ufcon;
|
||||
u32 umcon;
|
||||
u32 ubrdiv;
|
||||
u32 udivslot;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SAMSUNG_PM_DEBUG
|
||||
/**
|
||||
* s3c_pm_dbg() - low level debug function for use in suspend/resume.
|
||||
* @msg: The message to print.
|
||||
*
|
||||
* This function is used mainly to debug the resume process before the system
|
||||
* can rely on printk/console output. It uses the low-level debugging output
|
||||
* routine printascii() to do its work.
|
||||
*/
|
||||
extern void s3c_pm_dbg(const char *msg, ...);
|
||||
|
||||
/**
|
||||
* s3c_pm_debug_init() - suspend/resume low level debug initialization.
|
||||
* @base: Virtual base of UART to use for suspend/resume debugging.
|
||||
*
|
||||
* This function needs to be called before S3C_PMDBG() can be used, to set up
|
||||
* UART port base address and configuration.
|
||||
*/
|
||||
extern void s3c_pm_debug_init(void);
|
||||
|
||||
#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
|
||||
|
||||
extern void s3c_pm_save_uarts(void);
|
||||
extern void s3c_pm_restore_uarts(void);
|
||||
#else
|
||||
#define S3C_PMDBG(fmt...) pr_debug(fmt)
|
||||
#define s3c_pm_debug_init() do { } while (0)
|
||||
|
||||
static inline void s3c_pm_save_uarts(void) { }
|
||||
static inline void s3c_pm_restore_uarts(void) { }
|
||||
#endif
|
||||
|
||||
/* suspend memory checking */
|
||||
|
||||
#ifdef CONFIG_SAMSUNG_PM_CHECK
|
||||
extern void s3c_pm_check_prepare(void);
|
||||
extern void s3c_pm_check_restore(void);
|
||||
extern void s3c_pm_check_cleanup(void);
|
||||
extern void s3c_pm_check_store(void);
|
||||
#else
|
||||
#define s3c_pm_check_prepare() do { } while (0)
|
||||
#define s3c_pm_check_restore() do { } while (0)
|
||||
#define s3c_pm_check_cleanup() do { } while (0)
|
||||
#define s3c_pm_check_store() do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif
|
113
arch/arm/plat-samsung/include/plat/pm.h
Normal file
113
arch/arm/plat-samsung/include/plat/pm.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
/* arch/arm/plat-samsung/include/plat/pm.h
|
||||
*
|
||||
* Copyright (c) 2004 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Written by Ben Dooks, <ben@simtec.co.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/* s3c_pm_init
|
||||
*
|
||||
* called from board at initialisation time to setup the power
|
||||
* management
|
||||
*/
|
||||
|
||||
#include <plat/pm-common.h>
|
||||
|
||||
struct device;
|
||||
|
||||
#ifdef CONFIG_SAMSUNG_PM
|
||||
|
||||
extern __init int s3c_pm_init(void);
|
||||
extern __init int s3c64xx_pm_init(void);
|
||||
|
||||
#else
|
||||
|
||||
static inline int s3c_pm_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int s3c64xx_pm_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* configuration for the IRQ mask over sleep */
|
||||
extern unsigned long s3c_irqwake_intmask;
|
||||
extern unsigned long s3c_irqwake_eintmask;
|
||||
|
||||
/* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
|
||||
extern unsigned long s3c_irqwake_intallow;
|
||||
extern unsigned long s3c_irqwake_eintallow;
|
||||
|
||||
/* per-cpu sleep functions */
|
||||
|
||||
extern void (*pm_cpu_prep)(void);
|
||||
extern int (*pm_cpu_sleep)(unsigned long);
|
||||
|
||||
/* Flags for PM Control */
|
||||
|
||||
extern unsigned long s3c_pm_flags;
|
||||
|
||||
/* from sleep.S */
|
||||
|
||||
extern int s3c2410_cpu_suspend(unsigned long);
|
||||
|
||||
#ifdef CONFIG_SAMSUNG_PM
|
||||
extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
|
||||
extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
|
||||
extern void s3c_cpu_resume(void);
|
||||
#else
|
||||
#define s3c_irq_wake NULL
|
||||
#define s3c_irqext_wake NULL
|
||||
#define s3c_cpu_resume NULL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
|
||||
/**
|
||||
* s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
|
||||
* @set: set bits for the state of the LEDs
|
||||
* @clear: clear bits for the state of the LEDs.
|
||||
*/
|
||||
extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
|
||||
|
||||
#else
|
||||
static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
|
||||
#endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
|
||||
|
||||
/**
|
||||
* s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
|
||||
*
|
||||
* Setup all the necessary GPIO pins for waking the system on external
|
||||
* interrupt.
|
||||
*/
|
||||
extern void s3c_pm_configure_extint(void);
|
||||
|
||||
#ifdef CONFIG_GPIO_SAMSUNG
|
||||
/**
|
||||
* samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
|
||||
*
|
||||
* Restore the state of the GPIO pins after sleep, which may involve ensuring
|
||||
* that we do not glitch the state of the pins from that the bootloader's
|
||||
* resume code has done.
|
||||
*/
|
||||
extern void samsung_pm_restore_gpios(void);
|
||||
|
||||
/**
|
||||
* samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
|
||||
*
|
||||
* Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
|
||||
*/
|
||||
extern void samsung_pm_save_gpios(void);
|
||||
#else
|
||||
static inline void samsung_pm_restore_gpios(void) {}
|
||||
static inline void samsung_pm_save_gpios(void) {}
|
||||
#endif
|
||||
|
||||
extern void s3c_pm_save_core(void);
|
||||
extern void s3c_pm_restore_core(void);
|
22
arch/arm/plat-samsung/include/plat/pwm-core.h
Normal file
22
arch/arm/plat-samsung/include/plat/pwm-core.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright 2013 Tomasz Figa <tomasz.figa@gmail.com>
|
||||
*
|
||||
* Samsung PWM controller platform data helpers.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_PWM_CORE_H
|
||||
#define __ASM_ARCH_PWM_CORE_H __FILE__
|
||||
|
||||
#include <clocksource/samsung_pwm.h>
|
||||
|
||||
#ifdef CONFIG_SAMSUNG_DEV_PWM
|
||||
extern void samsung_pwm_set_platdata(struct samsung_pwm_variant *pd);
|
||||
#else
|
||||
static inline void samsung_pwm_set_platdata(struct samsung_pwm_variant *pd) { }
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_ARCH_PWM_CORE_H */
|
68
arch/arm/plat-samsung/include/plat/regs-adc.h
Normal file
68
arch/arm/plat-samsung/include/plat/regs-adc.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
/* arch/arm/mach-s3c2410/include/mach/regs-adc.h
|
||||
*
|
||||
* Copyright (c) 2004 Shannon Holland <holland@loser.net>
|
||||
*
|
||||
* This program is free software; yosu can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* S3C2410 ADC registers
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_REGS_ADC_H
|
||||
#define __ASM_ARCH_REGS_ADC_H "regs-adc.h"
|
||||
|
||||
#define S3C2410_ADCREG(x) (x)
|
||||
|
||||
#define S3C2410_ADCCON S3C2410_ADCREG(0x00)
|
||||
#define S3C2410_ADCTSC S3C2410_ADCREG(0x04)
|
||||
#define S3C2410_ADCDLY S3C2410_ADCREG(0x08)
|
||||
#define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C)
|
||||
#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
|
||||
#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14)
|
||||
#define S3C2443_ADCMUX S3C2410_ADCREG(0x18)
|
||||
#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18)
|
||||
#define S5P_ADCMUX S3C2410_ADCREG(0x1C)
|
||||
#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20)
|
||||
|
||||
|
||||
/* ADCCON Register Bits */
|
||||
#define S3C64XX_ADCCON_RESSEL (1<<16)
|
||||
#define S3C2410_ADCCON_ECFLG (1<<15)
|
||||
#define S3C2410_ADCCON_PRSCEN (1<<14)
|
||||
#define S3C2410_ADCCON_PRSCVL(x) (((x)&0xFF)<<6)
|
||||
#define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6)
|
||||
#define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3)
|
||||
#define S3C2410_ADCCON_MUXMASK (0x7<<3)
|
||||
#define S3C2416_ADCCON_RESSEL (1 << 3)
|
||||
#define S3C2410_ADCCON_STDBM (1<<2)
|
||||
#define S3C2410_ADCCON_READ_START (1<<1)
|
||||
#define S3C2410_ADCCON_ENABLE_START (1<<0)
|
||||
#define S3C2410_ADCCON_STARTMASK (0x3<<0)
|
||||
|
||||
|
||||
/* ADCTSC Register Bits */
|
||||
#define S3C2443_ADCTSC_UD_SEN (1 << 8)
|
||||
#define S3C2410_ADCTSC_YM_SEN (1<<7)
|
||||
#define S3C2410_ADCTSC_YP_SEN (1<<6)
|
||||
#define S3C2410_ADCTSC_XM_SEN (1<<5)
|
||||
#define S3C2410_ADCTSC_XP_SEN (1<<4)
|
||||
#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
|
||||
#define S3C2410_ADCTSC_AUTO_PST (1<<2)
|
||||
#define S3C2410_ADCTSC_XY_PST(x) (((x)&0x3)<<0)
|
||||
|
||||
/* ADCDAT0 Bits */
|
||||
#define S3C2410_ADCDAT0_UPDOWN (1<<15)
|
||||
#define S3C2410_ADCDAT0_AUTO_PST (1<<14)
|
||||
#define S3C2410_ADCDAT0_XY_PST (0x3<<12)
|
||||
#define S3C2410_ADCDAT0_XPDATA_MASK (0x03FF)
|
||||
|
||||
/* ADCDAT1 Bits */
|
||||
#define S3C2410_ADCDAT1_UPDOWN (1<<15)
|
||||
#define S3C2410_ADCDAT1_AUTO_PST (1<<14)
|
||||
#define S3C2410_ADCDAT1_XY_PST (0x3<<12)
|
||||
#define S3C2410_ADCDAT1_YPDATA_MASK (0x03FF)
|
||||
|
||||
#endif /* __ASM_ARCH_REGS_ADC_H */
|
||||
|
||||
|
151
arch/arm/plat-samsung/include/plat/regs-dma.h
Normal file
151
arch/arm/plat-samsung/include/plat/regs-dma.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
/* arch/arm/plat-samsung/include/plat/regs-dma.h
|
||||
*
|
||||
* Copyright (C) 2003-2006 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Samsung S3C24XX DMA support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_REGS_DMA_H
|
||||
#define __ASM_PLAT_REGS_DMA_H __FILE__
|
||||
|
||||
#define S3C2410_DMA_DISRC (0x00)
|
||||
#define S3C2410_DMA_DISRCC (0x04)
|
||||
#define S3C2410_DMA_DIDST (0x08)
|
||||
#define S3C2410_DMA_DIDSTC (0x0C)
|
||||
#define S3C2410_DMA_DCON (0x10)
|
||||
#define S3C2410_DMA_DSTAT (0x14)
|
||||
#define S3C2410_DMA_DCSRC (0x18)
|
||||
#define S3C2410_DMA_DCDST (0x1C)
|
||||
#define S3C2410_DMA_DMASKTRIG (0x20)
|
||||
#define S3C2412_DMA_DMAREQSEL (0x24)
|
||||
#define S3C2443_DMA_DMAREQSEL (0x24)
|
||||
|
||||
#define S3C2410_DISRCC_INC (1 << 0)
|
||||
#define S3C2410_DISRCC_APB (1 << 1)
|
||||
|
||||
#define S3C2410_DMASKTRIG_STOP (1 << 2)
|
||||
#define S3C2410_DMASKTRIG_ON (1 << 1)
|
||||
#define S3C2410_DMASKTRIG_SWTRIG (1 << 0)
|
||||
|
||||
#define S3C2410_DCON_DEMAND (0 << 31)
|
||||
#define S3C2410_DCON_HANDSHAKE (1 << 31)
|
||||
#define S3C2410_DCON_SYNC_PCLK (0 << 30)
|
||||
#define S3C2410_DCON_SYNC_HCLK (1 << 30)
|
||||
|
||||
#define S3C2410_DCON_INTREQ (1 << 29)
|
||||
|
||||
#define S3C2410_DCON_CH0_XDREQ0 (0 << 24)
|
||||
#define S3C2410_DCON_CH0_UART0 (1 << 24)
|
||||
#define S3C2410_DCON_CH0_SDI (2 << 24)
|
||||
#define S3C2410_DCON_CH0_TIMER (3 << 24)
|
||||
#define S3C2410_DCON_CH0_USBEP1 (4 << 24)
|
||||
|
||||
#define S3C2410_DCON_CH1_XDREQ1 (0 << 24)
|
||||
#define S3C2410_DCON_CH1_UART1 (1 << 24)
|
||||
#define S3C2410_DCON_CH1_I2SSDI (2 << 24)
|
||||
#define S3C2410_DCON_CH1_SPI (3 << 24)
|
||||
#define S3C2410_DCON_CH1_USBEP2 (4 << 24)
|
||||
|
||||
#define S3C2410_DCON_CH2_I2SSDO (0 << 24)
|
||||
#define S3C2410_DCON_CH2_I2SSDI (1 << 24)
|
||||
#define S3C2410_DCON_CH2_SDI (2 << 24)
|
||||
#define S3C2410_DCON_CH2_TIMER (3 << 24)
|
||||
#define S3C2410_DCON_CH2_USBEP3 (4 << 24)
|
||||
|
||||
#define S3C2410_DCON_CH3_UART2 (0 << 24)
|
||||
#define S3C2410_DCON_CH3_SDI (1 << 24)
|
||||
#define S3C2410_DCON_CH3_SPI (2 << 24)
|
||||
#define S3C2410_DCON_CH3_TIMER (3 << 24)
|
||||
#define S3C2410_DCON_CH3_USBEP4 (4 << 24)
|
||||
|
||||
#define S3C2410_DCON_SRCSHIFT (24)
|
||||
#define S3C2410_DCON_SRCMASK (7 << 24)
|
||||
|
||||
#define S3C2410_DCON_BYTE (0 << 20)
|
||||
#define S3C2410_DCON_HALFWORD (1 << 20)
|
||||
#define S3C2410_DCON_WORD (2 << 20)
|
||||
|
||||
#define S3C2410_DCON_AUTORELOAD (0 << 22)
|
||||
#define S3C2410_DCON_NORELOAD (1 << 22)
|
||||
#define S3C2410_DCON_HWTRIG (1 << 23)
|
||||
|
||||
#ifdef CONFIG_CPU_S3C2440
|
||||
|
||||
#define S3C2440_DIDSTC_CHKINT (1 << 2)
|
||||
|
||||
#define S3C2440_DCON_CH0_I2SSDO (5 << 24)
|
||||
#define S3C2440_DCON_CH0_PCMIN (6 << 24)
|
||||
|
||||
#define S3C2440_DCON_CH1_PCMOUT (5 << 24)
|
||||
#define S3C2440_DCON_CH1_SDI (6 << 24)
|
||||
|
||||
#define S3C2440_DCON_CH2_PCMIN (5 << 24)
|
||||
#define S3C2440_DCON_CH2_MICIN (6 << 24)
|
||||
|
||||
#define S3C2440_DCON_CH3_MICIN (5 << 24)
|
||||
#define S3C2440_DCON_CH3_PCMOUT (6 << 24)
|
||||
#endif /* CONFIG_CPU_S3C2440 */
|
||||
|
||||
#ifdef CONFIG_CPU_S3C2412
|
||||
|
||||
#define S3C2412_DMAREQSEL_SRC(x) ((x) << 1)
|
||||
|
||||
#define S3C2412_DMAREQSEL_HW (1)
|
||||
|
||||
#define S3C2412_DMAREQSEL_SPI0TX S3C2412_DMAREQSEL_SRC(0)
|
||||
#define S3C2412_DMAREQSEL_SPI0RX S3C2412_DMAREQSEL_SRC(1)
|
||||
#define S3C2412_DMAREQSEL_SPI1TX S3C2412_DMAREQSEL_SRC(2)
|
||||
#define S3C2412_DMAREQSEL_SPI1RX S3C2412_DMAREQSEL_SRC(3)
|
||||
#define S3C2412_DMAREQSEL_I2STX S3C2412_DMAREQSEL_SRC(4)
|
||||
#define S3C2412_DMAREQSEL_I2SRX S3C2412_DMAREQSEL_SRC(5)
|
||||
#define S3C2412_DMAREQSEL_TIMER S3C2412_DMAREQSEL_SRC(9)
|
||||
#define S3C2412_DMAREQSEL_SDI S3C2412_DMAREQSEL_SRC(10)
|
||||
#define S3C2412_DMAREQSEL_USBEP1 S3C2412_DMAREQSEL_SRC(13)
|
||||
#define S3C2412_DMAREQSEL_USBEP2 S3C2412_DMAREQSEL_SRC(14)
|
||||
#define S3C2412_DMAREQSEL_USBEP3 S3C2412_DMAREQSEL_SRC(15)
|
||||
#define S3C2412_DMAREQSEL_USBEP4 S3C2412_DMAREQSEL_SRC(16)
|
||||
#define S3C2412_DMAREQSEL_XDREQ0 S3C2412_DMAREQSEL_SRC(17)
|
||||
#define S3C2412_DMAREQSEL_XDREQ1 S3C2412_DMAREQSEL_SRC(18)
|
||||
#define S3C2412_DMAREQSEL_UART0_0 S3C2412_DMAREQSEL_SRC(19)
|
||||
#define S3C2412_DMAREQSEL_UART0_1 S3C2412_DMAREQSEL_SRC(20)
|
||||
#define S3C2412_DMAREQSEL_UART1_0 S3C2412_DMAREQSEL_SRC(21)
|
||||
#define S3C2412_DMAREQSEL_UART1_1 S3C2412_DMAREQSEL_SRC(22)
|
||||
#define S3C2412_DMAREQSEL_UART2_0 S3C2412_DMAREQSEL_SRC(23)
|
||||
#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24)
|
||||
#endif /* CONFIG_CPU_S3C2412 */
|
||||
|
||||
#if defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2443)
|
||||
|
||||
#define S3C2443_DMAREQSEL_SRC(x) ((x) << 1)
|
||||
|
||||
#define S3C2443_DMAREQSEL_HW (1)
|
||||
|
||||
#define S3C2443_DMAREQSEL_SPI0TX S3C2443_DMAREQSEL_SRC(0)
|
||||
#define S3C2443_DMAREQSEL_SPI0RX S3C2443_DMAREQSEL_SRC(1)
|
||||
#define S3C2443_DMAREQSEL_SPI1TX S3C2443_DMAREQSEL_SRC(2)
|
||||
#define S3C2443_DMAREQSEL_SPI1RX S3C2443_DMAREQSEL_SRC(3)
|
||||
#define S3C2443_DMAREQSEL_I2STX S3C2443_DMAREQSEL_SRC(4)
|
||||
#define S3C2443_DMAREQSEL_I2SRX S3C2443_DMAREQSEL_SRC(5)
|
||||
#define S3C2443_DMAREQSEL_TIMER S3C2443_DMAREQSEL_SRC(9)
|
||||
#define S3C2443_DMAREQSEL_SDI S3C2443_DMAREQSEL_SRC(10)
|
||||
#define S3C2443_DMAREQSEL_XDREQ0 S3C2443_DMAREQSEL_SRC(17)
|
||||
#define S3C2443_DMAREQSEL_XDREQ1 S3C2443_DMAREQSEL_SRC(18)
|
||||
#define S3C2443_DMAREQSEL_UART0_0 S3C2443_DMAREQSEL_SRC(19)
|
||||
#define S3C2443_DMAREQSEL_UART0_1 S3C2443_DMAREQSEL_SRC(20)
|
||||
#define S3C2443_DMAREQSEL_UART1_0 S3C2443_DMAREQSEL_SRC(21)
|
||||
#define S3C2443_DMAREQSEL_UART1_1 S3C2443_DMAREQSEL_SRC(22)
|
||||
#define S3C2443_DMAREQSEL_UART2_0 S3C2443_DMAREQSEL_SRC(23)
|
||||
#define S3C2443_DMAREQSEL_UART2_1 S3C2443_DMAREQSEL_SRC(24)
|
||||
#define S3C2443_DMAREQSEL_UART3_0 S3C2443_DMAREQSEL_SRC(25)
|
||||
#define S3C2443_DMAREQSEL_UART3_1 S3C2443_DMAREQSEL_SRC(26)
|
||||
#define S3C2443_DMAREQSEL_PCMOUT S3C2443_DMAREQSEL_SRC(27)
|
||||
#define S3C2443_DMAREQSEL_PCMIN S3C2443_DMAREQSEL_SRC(28)
|
||||
#define S3C2443_DMAREQSEL_MICIN S3C2443_DMAREQSEL_SRC(29)
|
||||
#endif /* CONFIG_CPU_S3C2443 */
|
||||
|
||||
#endif /* __ASM_PLAT_REGS_DMA_H */
|
21
arch/arm/plat-samsung/include/plat/regs-irqtype.h
Normal file
21
arch/arm/plat-samsung/include/plat/regs-irqtype.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* arch/arm/plat-s3c/include/plat/regs-irqtype.h
|
||||
*
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* S3C - IRQ detection types.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/* values for S3C2410_EXTINT0/1/2 and other cpus in the series, including
|
||||
* the S3C64XX
|
||||
*/
|
||||
#define S3C2410_EXTINT_LOWLEV (0x00)
|
||||
#define S3C2410_EXTINT_HILEV (0x01)
|
||||
#define S3C2410_EXTINT_FALLEDGE (0x02)
|
||||
#define S3C2410_EXTINT_RISEEDGE (0x04)
|
||||
#define S3C2410_EXTINT_BOTHEDGE (0x06)
|
48
arch/arm/plat-samsung/include/plat/regs-spi.h
Normal file
48
arch/arm/plat-samsung/include/plat/regs-spi.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* arch/arm/plat-samsung/include/plat/regs-spi.h
|
||||
*
|
||||
* Copyright (c) 2004 Fetron GmbH
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* S3C2410 SPI register definition
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_REGS_SPI_H
|
||||
#define __ASM_ARCH_REGS_SPI_H
|
||||
|
||||
#define S3C2410_SPI1 (0x20)
|
||||
#define S3C2412_SPI1 (0x100)
|
||||
|
||||
#define S3C2410_SPCON (0x00)
|
||||
|
||||
#define S3C2410_SPCON_SMOD_DMA (2 << 5) /* DMA mode */
|
||||
#define S3C2410_SPCON_SMOD_INT (1 << 5) /* interrupt mode */
|
||||
#define S3C2410_SPCON_SMOD_POLL (0 << 5) /* polling mode */
|
||||
#define S3C2410_SPCON_ENSCK (1 << 4) /* Enable SCK */
|
||||
#define S3C2410_SPCON_MSTR (1 << 3) /* Master:1, Slave:0 select */
|
||||
#define S3C2410_SPCON_CPOL_HIGH (1 << 2) /* Clock polarity select */
|
||||
#define S3C2410_SPCON_CPOL_LOW (0 << 2) /* Clock polarity select */
|
||||
|
||||
#define S3C2410_SPCON_CPHA_FMTB (1 << 1) /* Clock Phase Select */
|
||||
#define S3C2410_SPCON_CPHA_FMTA (0 << 1) /* Clock Phase Select */
|
||||
|
||||
#define S3C2410_SPSTA (0x04)
|
||||
|
||||
#define S3C2410_SPSTA_DCOL (1 << 2) /* Data Collision Error */
|
||||
#define S3C2410_SPSTA_MULD (1 << 1) /* Multi Master Error */
|
||||
#define S3C2410_SPSTA_READY (1 << 0) /* Data Tx/Rx ready */
|
||||
#define S3C2412_SPSTA_READY_ORG (1 << 3)
|
||||
|
||||
#define S3C2410_SPPIN (0x08)
|
||||
|
||||
#define S3C2410_SPPIN_ENMUL (1 << 2) /* Multi Master Error detect */
|
||||
#define S3C2410_SPPIN_RESERVED (1 << 1)
|
||||
#define S3C2410_SPPIN_KEEP (1 << 0) /* Master Out keep */
|
||||
|
||||
#define S3C2410_SPPRE (0x0C)
|
||||
#define S3C2410_SPTDAT (0x10)
|
||||
#define S3C2410_SPRDAT (0x14)
|
||||
|
||||
#endif /* __ASM_ARCH_REGS_SPI_H */
|
54
arch/arm/plat-samsung/include/plat/regs-srom.h
Normal file
54
arch/arm/plat-samsung/include/plat/regs-srom.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/regs-srom.h
|
||||
*
|
||||
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* S5P SROMC register definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_SAMSUNG_REGS_SROM_H
|
||||
#define __PLAT_SAMSUNG_REGS_SROM_H __FILE__
|
||||
|
||||
#include <mach/map.h>
|
||||
|
||||
#define S5P_SROMREG(x) (S5P_VA_SROMC + (x))
|
||||
|
||||
#define S5P_SROM_BW S5P_SROMREG(0x0)
|
||||
#define S5P_SROM_BC0 S5P_SROMREG(0x4)
|
||||
#define S5P_SROM_BC1 S5P_SROMREG(0x8)
|
||||
#define S5P_SROM_BC2 S5P_SROMREG(0xc)
|
||||
#define S5P_SROM_BC3 S5P_SROMREG(0x10)
|
||||
#define S5P_SROM_BC4 S5P_SROMREG(0x14)
|
||||
#define S5P_SROM_BC5 S5P_SROMREG(0x18)
|
||||
|
||||
/* one register BW holds 4 x 4-bit packed settings for NCS0 - NCS3 */
|
||||
|
||||
#define S5P_SROM_BW__DATAWIDTH__SHIFT 0
|
||||
#define S5P_SROM_BW__ADDRMODE__SHIFT 1
|
||||
#define S5P_SROM_BW__WAITENABLE__SHIFT 2
|
||||
#define S5P_SROM_BW__BYTEENABLE__SHIFT 3
|
||||
|
||||
#define S5P_SROM_BW__CS_MASK 0xf
|
||||
|
||||
#define S5P_SROM_BW__NCS0__SHIFT 0
|
||||
#define S5P_SROM_BW__NCS1__SHIFT 4
|
||||
#define S5P_SROM_BW__NCS2__SHIFT 8
|
||||
#define S5P_SROM_BW__NCS3__SHIFT 12
|
||||
#define S5P_SROM_BW__NCS4__SHIFT 16
|
||||
#define S5P_SROM_BW__NCS5__SHIFT 20
|
||||
|
||||
/* applies to same to BCS0 - BCS3 */
|
||||
|
||||
#define S5P_SROM_BCX__PMC__SHIFT 0
|
||||
#define S5P_SROM_BCX__TACP__SHIFT 4
|
||||
#define S5P_SROM_BCX__TCAH__SHIFT 8
|
||||
#define S5P_SROM_BCX__TCOH__SHIFT 12
|
||||
#define S5P_SROM_BCX__TACC__SHIFT 16
|
||||
#define S5P_SROM_BCX__TCOS__SHIFT 24
|
||||
#define S5P_SROM_BCX__TACS__SHIFT 28
|
||||
|
||||
#endif /* __PLAT_SAMSUNG_REGS_SROM_H */
|
151
arch/arm/plat-samsung/include/plat/regs-udc.h
Normal file
151
arch/arm/plat-samsung/include/plat/regs-udc.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
/* arch/arm/plat-samsung/include/plat/regs-udc.h
|
||||
*
|
||||
* Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
|
||||
*
|
||||
* This include file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_REGS_UDC_H
|
||||
#define __ASM_ARCH_REGS_UDC_H
|
||||
|
||||
#define S3C2410_USBDREG(x) (x)
|
||||
|
||||
#define S3C2410_UDC_FUNC_ADDR_REG S3C2410_USBDREG(0x0140)
|
||||
#define S3C2410_UDC_PWR_REG S3C2410_USBDREG(0x0144)
|
||||
#define S3C2410_UDC_EP_INT_REG S3C2410_USBDREG(0x0148)
|
||||
|
||||
#define S3C2410_UDC_USB_INT_REG S3C2410_USBDREG(0x0158)
|
||||
#define S3C2410_UDC_EP_INT_EN_REG S3C2410_USBDREG(0x015c)
|
||||
|
||||
#define S3C2410_UDC_USB_INT_EN_REG S3C2410_USBDREG(0x016c)
|
||||
|
||||
#define S3C2410_UDC_FRAME_NUM1_REG S3C2410_USBDREG(0x0170)
|
||||
#define S3C2410_UDC_FRAME_NUM2_REG S3C2410_USBDREG(0x0174)
|
||||
|
||||
#define S3C2410_UDC_EP0_FIFO_REG S3C2410_USBDREG(0x01c0)
|
||||
#define S3C2410_UDC_EP1_FIFO_REG S3C2410_USBDREG(0x01c4)
|
||||
#define S3C2410_UDC_EP2_FIFO_REG S3C2410_USBDREG(0x01c8)
|
||||
#define S3C2410_UDC_EP3_FIFO_REG S3C2410_USBDREG(0x01cc)
|
||||
#define S3C2410_UDC_EP4_FIFO_REG S3C2410_USBDREG(0x01d0)
|
||||
|
||||
#define S3C2410_UDC_EP1_DMA_CON S3C2410_USBDREG(0x0200)
|
||||
#define S3C2410_UDC_EP1_DMA_UNIT S3C2410_USBDREG(0x0204)
|
||||
#define S3C2410_UDC_EP1_DMA_FIFO S3C2410_USBDREG(0x0208)
|
||||
#define S3C2410_UDC_EP1_DMA_TTC_L S3C2410_USBDREG(0x020c)
|
||||
#define S3C2410_UDC_EP1_DMA_TTC_M S3C2410_USBDREG(0x0210)
|
||||
#define S3C2410_UDC_EP1_DMA_TTC_H S3C2410_USBDREG(0x0214)
|
||||
|
||||
#define S3C2410_UDC_EP2_DMA_CON S3C2410_USBDREG(0x0218)
|
||||
#define S3C2410_UDC_EP2_DMA_UNIT S3C2410_USBDREG(0x021c)
|
||||
#define S3C2410_UDC_EP2_DMA_FIFO S3C2410_USBDREG(0x0220)
|
||||
#define S3C2410_UDC_EP2_DMA_TTC_L S3C2410_USBDREG(0x0224)
|
||||
#define S3C2410_UDC_EP2_DMA_TTC_M S3C2410_USBDREG(0x0228)
|
||||
#define S3C2410_UDC_EP2_DMA_TTC_H S3C2410_USBDREG(0x022c)
|
||||
|
||||
#define S3C2410_UDC_EP3_DMA_CON S3C2410_USBDREG(0x0240)
|
||||
#define S3C2410_UDC_EP3_DMA_UNIT S3C2410_USBDREG(0x0244)
|
||||
#define S3C2410_UDC_EP3_DMA_FIFO S3C2410_USBDREG(0x0248)
|
||||
#define S3C2410_UDC_EP3_DMA_TTC_L S3C2410_USBDREG(0x024c)
|
||||
#define S3C2410_UDC_EP3_DMA_TTC_M S3C2410_USBDREG(0x0250)
|
||||
#define S3C2410_UDC_EP3_DMA_TTC_H S3C2410_USBDREG(0x0254)
|
||||
|
||||
#define S3C2410_UDC_EP4_DMA_CON S3C2410_USBDREG(0x0258)
|
||||
#define S3C2410_UDC_EP4_DMA_UNIT S3C2410_USBDREG(0x025c)
|
||||
#define S3C2410_UDC_EP4_DMA_FIFO S3C2410_USBDREG(0x0260)
|
||||
#define S3C2410_UDC_EP4_DMA_TTC_L S3C2410_USBDREG(0x0264)
|
||||
#define S3C2410_UDC_EP4_DMA_TTC_M S3C2410_USBDREG(0x0268)
|
||||
#define S3C2410_UDC_EP4_DMA_TTC_H S3C2410_USBDREG(0x026c)
|
||||
|
||||
#define S3C2410_UDC_INDEX_REG S3C2410_USBDREG(0x0178)
|
||||
|
||||
/* indexed registers */
|
||||
|
||||
#define S3C2410_UDC_MAXP_REG S3C2410_USBDREG(0x0180)
|
||||
|
||||
#define S3C2410_UDC_EP0_CSR_REG S3C2410_USBDREG(0x0184)
|
||||
|
||||
#define S3C2410_UDC_IN_CSR1_REG S3C2410_USBDREG(0x0184)
|
||||
#define S3C2410_UDC_IN_CSR2_REG S3C2410_USBDREG(0x0188)
|
||||
|
||||
#define S3C2410_UDC_OUT_CSR1_REG S3C2410_USBDREG(0x0190)
|
||||
#define S3C2410_UDC_OUT_CSR2_REG S3C2410_USBDREG(0x0194)
|
||||
#define S3C2410_UDC_OUT_FIFO_CNT1_REG S3C2410_USBDREG(0x0198)
|
||||
#define S3C2410_UDC_OUT_FIFO_CNT2_REG S3C2410_USBDREG(0x019c)
|
||||
|
||||
#define S3C2410_UDC_FUNCADDR_UPDATE (1 << 7)
|
||||
|
||||
#define S3C2410_UDC_PWR_ISOUP (1 << 7) /* R/W */
|
||||
#define S3C2410_UDC_PWR_RESET (1 << 3) /* R */
|
||||
#define S3C2410_UDC_PWR_RESUME (1 << 2) /* R/W */
|
||||
#define S3C2410_UDC_PWR_SUSPEND (1 << 1) /* R */
|
||||
#define S3C2410_UDC_PWR_ENSUSPEND (1 << 0) /* R/W */
|
||||
|
||||
#define S3C2410_UDC_PWR_DEFAULT (0x00)
|
||||
|
||||
#define S3C2410_UDC_INT_EP4 (1 << 4) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_INT_EP3 (1 << 3) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_INT_EP2 (1 << 2) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_INT_EP1 (1 << 1) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_INT_EP0 (1 << 0) /* R/W (clear only) */
|
||||
|
||||
#define S3C2410_UDC_USBINT_RESET (1 << 2) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_USBINT_RESUME (1 << 1) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_USBINT_SUSPEND (1 << 0) /* R/W (clear only) */
|
||||
|
||||
#define S3C2410_UDC_INTE_EP4 (1 << 4) /* R/W */
|
||||
#define S3C2410_UDC_INTE_EP3 (1 << 3) /* R/W */
|
||||
#define S3C2410_UDC_INTE_EP2 (1 << 2) /* R/W */
|
||||
#define S3C2410_UDC_INTE_EP1 (1 << 1) /* R/W */
|
||||
#define S3C2410_UDC_INTE_EP0 (1 << 0) /* R/W */
|
||||
|
||||
#define S3C2410_UDC_USBINTE_RESET (1 << 2) /* R/W */
|
||||
#define S3C2410_UDC_USBINTE_SUSPEND (1 << 0) /* R/W */
|
||||
|
||||
#define S3C2410_UDC_INDEX_EP0 (0x00)
|
||||
#define S3C2410_UDC_INDEX_EP1 (0x01)
|
||||
#define S3C2410_UDC_INDEX_EP2 (0x02)
|
||||
#define S3C2410_UDC_INDEX_EP3 (0x03)
|
||||
#define S3C2410_UDC_INDEX_EP4 (0x04)
|
||||
|
||||
#define S3C2410_UDC_ICSR1_CLRDT (1 << 6) /* R/W */
|
||||
#define S3C2410_UDC_ICSR1_SENTSTL (1 << 5) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_ICSR1_SENDSTL (1 << 4) /* R/W */
|
||||
#define S3C2410_UDC_ICSR1_FFLUSH (1 << 3) /* W (set only) */
|
||||
#define S3C2410_UDC_ICSR1_UNDRUN (1 << 2) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_ICSR1_PKTRDY (1 << 0) /* R/W (set only) */
|
||||
|
||||
#define S3C2410_UDC_ICSR2_AUTOSET (1 << 7) /* R/W */
|
||||
#define S3C2410_UDC_ICSR2_ISO (1 << 6) /* R/W */
|
||||
#define S3C2410_UDC_ICSR2_MODEIN (1 << 5) /* R/W */
|
||||
#define S3C2410_UDC_ICSR2_DMAIEN (1 << 4) /* R/W */
|
||||
|
||||
#define S3C2410_UDC_OCSR1_CLRDT (1 << 7) /* R/W */
|
||||
#define S3C2410_UDC_OCSR1_SENTSTL (1 << 6) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_OCSR1_SENDSTL (1 << 5) /* R/W */
|
||||
#define S3C2410_UDC_OCSR1_FFLUSH (1 << 4) /* R/W */
|
||||
#define S3C2410_UDC_OCSR1_DERROR (1 << 3) /* R */
|
||||
#define S3C2410_UDC_OCSR1_OVRRUN (1 << 2) /* R/W (clear only) */
|
||||
#define S3C2410_UDC_OCSR1_PKTRDY (1 << 0) /* R/W (clear only) */
|
||||
|
||||
#define S3C2410_UDC_OCSR2_AUTOCLR (1 << 7) /* R/W */
|
||||
#define S3C2410_UDC_OCSR2_ISO (1 << 6) /* R/W */
|
||||
#define S3C2410_UDC_OCSR2_DMAIEN (1 << 5) /* R/W */
|
||||
|
||||
#define S3C2410_UDC_EP0_CSR_OPKRDY (1 << 0)
|
||||
#define S3C2410_UDC_EP0_CSR_IPKRDY (1 << 1)
|
||||
#define S3C2410_UDC_EP0_CSR_SENTSTL (1 << 2)
|
||||
#define S3C2410_UDC_EP0_CSR_DE (1 << 3)
|
||||
#define S3C2410_UDC_EP0_CSR_SE (1 << 4)
|
||||
#define S3C2410_UDC_EP0_CSR_SENDSTL (1 << 5)
|
||||
#define S3C2410_UDC_EP0_CSR_SOPKTRDY (1 << 6)
|
||||
#define S3C2410_UDC_EP0_CSR_SSE (1 << 7)
|
||||
|
||||
#define S3C2410_UDC_MAXP_8 (1 << 0)
|
||||
#define S3C2410_UDC_MAXP_16 (1 << 1)
|
||||
#define S3C2410_UDC_MAXP_32 (1 << 2)
|
||||
#define S3C2410_UDC_MAXP_64 (1 << 3)
|
||||
|
||||
#endif
|
51
arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
Normal file
51
arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C - USB2.0 Highspeed/OtG device PHY registers
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/* Note, this is a separate header file as some of the clock framework
|
||||
* needs to touch this if the clk_48m is used as the USB OHCI or other
|
||||
* peripheral source.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H
|
||||
#define __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H __FILE__
|
||||
|
||||
/* S3C64XX_PA_USB_HSPHY */
|
||||
|
||||
#define S3C_HSOTG_PHYREG(x) ((x) + S3C_VA_USB_HSPHY)
|
||||
|
||||
#define S3C_PHYPWR S3C_HSOTG_PHYREG(0x00)
|
||||
#define S3C_PHYPWR_NORMAL_MASK (0x19 << 0)
|
||||
#define S3C_PHYPWR_OTG_DISABLE (1 << 4)
|
||||
#define S3C_PHYPWR_ANALOG_POWERDOWN (1 << 3)
|
||||
#define SRC_PHYPWR_FORCE_SUSPEND (1 << 1)
|
||||
|
||||
#define S3C_PHYCLK S3C_HSOTG_PHYREG(0x04)
|
||||
#define S3C_PHYCLK_MODE_USB11 (1 << 6)
|
||||
#define S3C_PHYCLK_EXT_OSC (1 << 5)
|
||||
#define S3C_PHYCLK_CLK_FORCE (1 << 4)
|
||||
#define S3C_PHYCLK_ID_PULL (1 << 2)
|
||||
#define S3C_PHYCLK_CLKSEL_MASK (0x3 << 0)
|
||||
#define S3C_PHYCLK_CLKSEL_SHIFT (0)
|
||||
#define S3C_PHYCLK_CLKSEL_48M (0x0 << 0)
|
||||
#define S3C_PHYCLK_CLKSEL_12M (0x2 << 0)
|
||||
#define S3C_PHYCLK_CLKSEL_24M (0x3 << 0)
|
||||
|
||||
#define S3C_RSTCON S3C_HSOTG_PHYREG(0x08)
|
||||
#define S3C_RSTCON_PHYCLK (1 << 2)
|
||||
#define S3C_RSTCON_HCLK (1 << 1)
|
||||
#define S3C_RSTCON_PHY (1 << 0)
|
||||
|
||||
#define S3C_PHYTUNE S3C_HSOTG_PHYREG(0x20)
|
||||
|
||||
#endif /* __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H */
|
30
arch/arm/plat-samsung/include/plat/samsung-time.h
Normal file
30
arch/arm/plat-samsung/include/plat/samsung-time.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
|
||||
*
|
||||
* Copyright 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com/
|
||||
*
|
||||
* Header file for samsung s3c and s5p time support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_PLAT_SAMSUNG_TIME_H
|
||||
#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
|
||||
|
||||
/* SAMSUNG HR-Timer Clock mode */
|
||||
enum samsung_timer_mode {
|
||||
SAMSUNG_PWM0,
|
||||
SAMSUNG_PWM1,
|
||||
SAMSUNG_PWM2,
|
||||
SAMSUNG_PWM3,
|
||||
SAMSUNG_PWM4,
|
||||
};
|
||||
|
||||
extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
|
||||
enum samsung_timer_mode source);
|
||||
|
||||
extern void __init samsung_timer_init(void);
|
||||
|
||||
#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
|
166
arch/arm/plat-samsung/include/plat/sdhci.h
Normal file
166
arch/arm/plat-samsung/include/plat/sdhci.h
Normal file
|
@ -0,0 +1,166 @@
|
|||
/* linux/arch/arm/plat-samsung/include/plat/sdhci.h
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C Platform - SDHCI (HSMMC) platform data definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_S3C_SDHCI_H
|
||||
#define __PLAT_S3C_SDHCI_H __FILE__
|
||||
|
||||
#include <linux/platform_data/mmc-sdhci-s3c.h>
|
||||
#include <plat/devs.h>
|
||||
|
||||
/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
|
||||
* @pd: The default platform data for this device.
|
||||
* @set: Pointer to the platform data to fill in.
|
||||
*/
|
||||
extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
|
||||
struct s3c_sdhci_platdata *set);
|
||||
|
||||
/**
|
||||
* s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
|
||||
* @pd: Platform data to register to device.
|
||||
*
|
||||
* Register the given platform data for use withe S3C SDHCI device.
|
||||
* The call will copy the platform data, so the board definitions can
|
||||
* make the structure itself __initdata.
|
||||
*/
|
||||
extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
|
||||
extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
|
||||
extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
|
||||
extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
|
||||
|
||||
/* Default platform data, exported so that per-cpu initialisation can
|
||||
* set the correct one when there are more than one cpu type selected.
|
||||
*/
|
||||
|
||||
extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
|
||||
extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
|
||||
extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
|
||||
extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
|
||||
|
||||
/* Helper function availability */
|
||||
|
||||
extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
|
||||
extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
|
||||
extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
|
||||
extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
|
||||
extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
|
||||
|
||||
/* S3C2416 SDHCI setup */
|
||||
|
||||
#ifdef CONFIG_S3C2416_SETUP_SDHCI
|
||||
static inline void s3c2416_default_sdhci0(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC
|
||||
s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
|
||||
#endif /* CONFIG_S3C_DEV_HSMMC */
|
||||
}
|
||||
|
||||
static inline void s3c2416_default_sdhci1(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC1
|
||||
s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
|
||||
#endif /* CONFIG_S3C_DEV_HSMMC1 */
|
||||
}
|
||||
|
||||
#else
|
||||
static inline void s3c2416_default_sdhci0(void) { }
|
||||
static inline void s3c2416_default_sdhci1(void) { }
|
||||
|
||||
#endif /* CONFIG_S3C2416_SETUP_SDHCI */
|
||||
|
||||
/* S3C64XX SDHCI setup */
|
||||
|
||||
#ifdef CONFIG_S3C64XX_SETUP_SDHCI
|
||||
static inline void s3c6400_default_sdhci0(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC
|
||||
s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void s3c6400_default_sdhci1(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC1
|
||||
s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void s3c6400_default_sdhci2(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC2
|
||||
s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void s3c6410_default_sdhci0(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC
|
||||
s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void s3c6410_default_sdhci1(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC1
|
||||
s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void s3c6410_default_sdhci2(void)
|
||||
{
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC2
|
||||
s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
static inline void s3c6410_default_sdhci0(void) { }
|
||||
static inline void s3c6410_default_sdhci1(void) { }
|
||||
static inline void s3c6410_default_sdhci2(void) { }
|
||||
static inline void s3c6400_default_sdhci0(void) { }
|
||||
static inline void s3c6400_default_sdhci1(void) { }
|
||||
static inline void s3c6400_default_sdhci2(void) { }
|
||||
|
||||
#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
|
||||
|
||||
static inline void s3c_sdhci_setname(int id, char *name)
|
||||
{
|
||||
switch (id) {
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC
|
||||
case 0:
|
||||
s3c_device_hsmmc0.name = name;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC1
|
||||
case 1:
|
||||
s3c_device_hsmmc1.name = name;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC2
|
||||
case 2:
|
||||
s3c_device_hsmmc2.name = name;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C_DEV_HSMMC3
|
||||
case 3:
|
||||
s3c_device_hsmmc3.name = name;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* __PLAT_S3C_SDHCI_H */
|
30
arch/arm/plat-samsung/include/plat/spi-core.h
Normal file
30
arch/arm/plat-samsung/include/plat/spi-core.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_S3C_SPI_CORE_H
|
||||
#define __PLAT_S3C_SPI_CORE_H
|
||||
|
||||
/* These functions are only for use with the core support code, such as
|
||||
* the cpu specific initialisation code
|
||||
*/
|
||||
|
||||
/* re-define device name depending on support. */
|
||||
static inline void s3c64xx_spi_setname(char *name)
|
||||
{
|
||||
#ifdef CONFIG_S3C64XX_DEV_SPI0
|
||||
s3c64xx_device_spi0.name = name;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C64XX_DEV_SPI1
|
||||
s3c64xx_device_spi1.name = name;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C64XX_DEV_SPI2
|
||||
s3c64xx_device_spi2.name = name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __PLAT_S3C_SPI_CORE_H */
|
19
arch/arm/plat-samsung/include/plat/usb-phy.h
Normal file
19
arch/arm/plat-samsung/include/plat/usb-phy.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Samsung Electronics Co.Ltd
|
||||
* Author: Joonyoung Shim <jy0922.shim@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_SAMSUNG_USB_PHY_H
|
||||
#define __PLAT_SAMSUNG_USB_PHY_H __FILE__
|
||||
|
||||
#include <linux/usb/samsung_usb_phy.h>
|
||||
|
||||
extern int s5p_usb_phy_init(struct platform_device *pdev, int type);
|
||||
extern int s5p_usb_phy_exit(struct platform_device *pdev, int type);
|
||||
|
||||
#endif /* __PLAT_SAMSUNG_USB_PHY_H */
|
44
arch/arm/plat-samsung/include/plat/wakeup-mask.h
Normal file
44
arch/arm/plat-samsung/include/plat/wakeup-mask.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* arch/arm/plat-samsung/include/plat/wakeup-mask.h
|
||||
*
|
||||
* Copyright 2010 Ben Dooks <ben-linux@fluff.org>
|
||||
*
|
||||
* Support for wakeup mask interrupts on newer SoCs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_WAKEUP_MASK_H
|
||||
#define __PLAT_WAKEUP_MASK_H __file__
|
||||
|
||||
/* if no irq yet defined, but still want to mask */
|
||||
#define NO_WAKEUP_IRQ (0x90000000)
|
||||
|
||||
/**
|
||||
* struct samsung_wakeup_mask - wakeup mask information
|
||||
* @irq: The interrupt associated with this wakeup.
|
||||
* @bit: The bit, as a (1 << bitno) controlling this source.
|
||||
*/
|
||||
struct samsung_wakeup_mask {
|
||||
unsigned int irq;
|
||||
u32 bit;
|
||||
};
|
||||
|
||||
/**
|
||||
* samsung_sync_wakemask - sync wakeup mask information for pm
|
||||
* @reg: The register that is used.
|
||||
* @masks: The list of masks to use.
|
||||
* @nr_masks: The number of entries pointed to buy @masks.
|
||||
*
|
||||
* Synchronise the wakeup mask information at suspend time from the list
|
||||
* of interrupts and control bits in @masks. We do this at suspend time
|
||||
* as overriding the relevant irq chips is harder and the register is only
|
||||
* required to be correct before we enter sleep.
|
||||
*/
|
||||
extern void samsung_sync_wakemask(void __iomem *reg,
|
||||
struct samsung_wakeup_mask *masks,
|
||||
int nr_masks);
|
||||
|
||||
#endif /* __PLAT_WAKEUP_MASK_H */
|
20
arch/arm/plat-samsung/include/plat/watchdog-reset.h
Normal file
20
arch/arm/plat-samsung/include/plat/watchdog-reset.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* arch/arm/plat-s3c/include/plat/watchdog-reset.h
|
||||
*
|
||||
* Copyright (c) 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C2410 - System define for arch_reset() function
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __PLAT_SAMSUNG_WATCHDOG_RESET_H
|
||||
#define __PLAT_SAMSUNG_WATCHDOG_RESET_H
|
||||
|
||||
extern void samsung_wdt_reset(void);
|
||||
extern void samsung_wdt_reset_of_init(void);
|
||||
extern void samsung_wdt_reset_init(void __iomem *base);
|
||||
|
||||
#endif /* __PLAT_SAMSUNG_WATCHDOG_RESET_H */
|
173
arch/arm/plat-samsung/init.c
Normal file
173
arch/arm/plat-samsung/init.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/* linux/arch/arm/plat-s3c/init.c
|
||||
*
|
||||
* Copyright (c) 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* S3C series CPU initialisation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Code in this file is not used on S3C64xx when booting with
|
||||
* Device Tree support.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
|
||||
static struct cpu_table *cpu;
|
||||
|
||||
static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
|
||||
struct cpu_table *tab,
|
||||
unsigned int count)
|
||||
{
|
||||
for (; count != 0; count--, tab++) {
|
||||
if ((idcode & tab->idmask) == (tab->idcode & tab->idmask))
|
||||
return tab;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __init s3c_init_cpu(unsigned long idcode,
|
||||
struct cpu_table *cputab, unsigned int cputab_size)
|
||||
{
|
||||
cpu = s3c_lookup_cpu(idcode, cputab, cputab_size);
|
||||
|
||||
if (cpu == NULL) {
|
||||
printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
|
||||
panic("Unknown S3C24XX CPU");
|
||||
}
|
||||
|
||||
printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
|
||||
|
||||
if (cpu->init == NULL) {
|
||||
printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
|
||||
panic("Unsupported Samsung CPU");
|
||||
}
|
||||
|
||||
if (cpu->map_io)
|
||||
cpu->map_io();
|
||||
}
|
||||
|
||||
/* s3c24xx_init_clocks
|
||||
*
|
||||
* Initialise the clock subsystem and associated information from the
|
||||
* given master crystal value.
|
||||
*
|
||||
* xtal = 0 -> use default PLL crystal value (normally 12MHz)
|
||||
* != 0 -> PLL crystal value in Hz
|
||||
*/
|
||||
|
||||
void __init s3c24xx_init_clocks(int xtal)
|
||||
{
|
||||
if (xtal == 0)
|
||||
xtal = 12*1000*1000;
|
||||
|
||||
if (cpu == NULL)
|
||||
panic("s3c24xx_init_clocks: no cpu setup?\n");
|
||||
|
||||
if (cpu->init_clocks == NULL)
|
||||
panic("s3c24xx_init_clocks: cpu has no clock init\n");
|
||||
else
|
||||
(cpu->init_clocks)(xtal);
|
||||
}
|
||||
|
||||
/* uart management */
|
||||
#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
|
||||
static int nr_uarts __initdata = 0;
|
||||
|
||||
#ifdef CONFIG_SERIAL_SAMSUNG_UARTS
|
||||
static struct s3c2410_uartcfg uart_cfgs[CONFIG_SERIAL_SAMSUNG_UARTS];
|
||||
#endif
|
||||
|
||||
/* s3c24xx_init_uartdevs
|
||||
*
|
||||
* copy the specified platform data and configuration into our central
|
||||
* set of devices, before the data is thrown away after the init process.
|
||||
*
|
||||
* This also fills in the array passed to the serial driver for the
|
||||
* early initialisation of the console.
|
||||
*/
|
||||
|
||||
void __init s3c24xx_init_uartdevs(char *name,
|
||||
struct s3c24xx_uart_resources *res,
|
||||
struct s3c2410_uartcfg *cfg, int no)
|
||||
{
|
||||
#ifdef CONFIG_SERIAL_SAMSUNG_UARTS
|
||||
struct platform_device *platdev;
|
||||
struct s3c2410_uartcfg *cfgptr = uart_cfgs;
|
||||
struct s3c24xx_uart_resources *resp;
|
||||
int uart;
|
||||
|
||||
memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no);
|
||||
|
||||
for (uart = 0; uart < no; uart++, cfg++, cfgptr++) {
|
||||
platdev = s3c24xx_uart_src[cfgptr->hwport];
|
||||
|
||||
resp = res + cfgptr->hwport;
|
||||
|
||||
s3c24xx_uart_devs[uart] = platdev;
|
||||
|
||||
platdev->name = name;
|
||||
platdev->resource = resp->resources;
|
||||
platdev->num_resources = resp->nr_resources;
|
||||
|
||||
platdev->dev.platform_data = cfgptr;
|
||||
}
|
||||
|
||||
nr_uarts = no;
|
||||
#endif
|
||||
}
|
||||
|
||||
void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
|
||||
{
|
||||
if (cpu == NULL)
|
||||
return;
|
||||
|
||||
if (cpu->init_uarts == NULL && IS_ENABLED(CONFIG_SAMSUNG_ATAGS)) {
|
||||
printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n");
|
||||
} else
|
||||
(cpu->init_uarts)(cfg, no);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int __init s3c_arch_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
// do the correct init for cpu
|
||||
|
||||
if (cpu == NULL) {
|
||||
/* Not needed when booting with device tree. */
|
||||
if (of_have_populated_dt())
|
||||
return 0;
|
||||
panic("s3c_arch_init: NULL cpu\n");
|
||||
}
|
||||
|
||||
ret = (cpu->init)();
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
|
||||
ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
arch_initcall(s3c_arch_init);
|
60
arch/arm/plat-samsung/platformdata.c
Normal file
60
arch/arm/plat-samsung/platformdata.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* linux/arch/arm/plat-samsung/platformdata.c
|
||||
*
|
||||
* Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
|
||||
*
|
||||
* Helper for platform data setting
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <plat/devs.h>
|
||||
#include <plat/sdhci.h>
|
||||
|
||||
void __init *s3c_set_platdata(void *pd, size_t pdsize,
|
||||
struct platform_device *pdev)
|
||||
{
|
||||
void *npd;
|
||||
|
||||
if (!pd) {
|
||||
/* too early to use dev_name(), may not be registered */
|
||||
printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
npd = kmemdup(pd, pdsize, GFP_KERNEL);
|
||||
if (!npd) {
|
||||
printk(KERN_ERR "%s: cannot clone platform data\n", pdev->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pdev->dev.platform_data = npd;
|
||||
return npd;
|
||||
}
|
||||
|
||||
void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
|
||||
struct s3c_sdhci_platdata *set)
|
||||
{
|
||||
set->cd_type = pd->cd_type;
|
||||
set->ext_cd_init = pd->ext_cd_init;
|
||||
set->ext_cd_cleanup = pd->ext_cd_cleanup;
|
||||
set->ext_cd_gpio = pd->ext_cd_gpio;
|
||||
set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
|
||||
|
||||
if (pd->max_width)
|
||||
set->max_width = pd->max_width;
|
||||
if (pd->cfg_gpio)
|
||||
set->cfg_gpio = pd->cfg_gpio;
|
||||
if (pd->host_caps)
|
||||
set->host_caps |= pd->host_caps;
|
||||
if (pd->host_caps2)
|
||||
set->host_caps2 |= pd->host_caps2;
|
||||
if (pd->pm_caps)
|
||||
set->pm_caps |= pd->pm_caps;
|
||||
}
|
237
arch/arm/plat-samsung/pm-check.c
Normal file
237
arch/arm/plat-samsung/pm-check.c
Normal file
|
@ -0,0 +1,237 @@
|
|||
/* linux/arch/arm/plat-s3c/pm-check.c
|
||||
* originally in linux/arch/arm/plat-s3c24xx/pm.c
|
||||
*
|
||||
* Copyright (c) 2004-2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C Power Mangament - suspend/resume memory corruptiuon check.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <plat/pm-common.h>
|
||||
|
||||
#if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1
|
||||
#error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value
|
||||
#endif
|
||||
|
||||
/* suspend checking code...
|
||||
*
|
||||
* this next area does a set of crc checks over all the installed
|
||||
* memory, so the system can verify if the resume was ok.
|
||||
*
|
||||
* CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE defines the block-size for the CRC,
|
||||
* increasing it will mean that the area corrupted will be less easy to spot,
|
||||
* and reducing the size will cause the CRC save area to grow
|
||||
*/
|
||||
|
||||
#define CHECK_CHUNKSIZE (CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE * 1024)
|
||||
|
||||
static u32 crc_size; /* size needed for the crc block */
|
||||
static u32 *crcs; /* allocated over suspend/resume */
|
||||
|
||||
typedef u32 *(run_fn_t)(struct resource *ptr, u32 *arg);
|
||||
|
||||
/* s3c_pm_run_res
|
||||
*
|
||||
* go through the given resource list, and look for system ram
|
||||
*/
|
||||
|
||||
static void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
|
||||
{
|
||||
while (ptr != NULL) {
|
||||
if (ptr->child != NULL)
|
||||
s3c_pm_run_res(ptr->child, fn, arg);
|
||||
|
||||
if ((ptr->flags & IORESOURCE_MEM) &&
|
||||
strcmp(ptr->name, "System RAM") == 0) {
|
||||
S3C_PMDBG("Found system RAM at %08lx..%08lx\n",
|
||||
(unsigned long)ptr->start,
|
||||
(unsigned long)ptr->end);
|
||||
arg = (fn)(ptr, arg);
|
||||
}
|
||||
|
||||
ptr = ptr->sibling;
|
||||
}
|
||||
}
|
||||
|
||||
static void s3c_pm_run_sysram(run_fn_t fn, u32 *arg)
|
||||
{
|
||||
s3c_pm_run_res(&iomem_resource, fn, arg);
|
||||
}
|
||||
|
||||
static u32 *s3c_pm_countram(struct resource *res, u32 *val)
|
||||
{
|
||||
u32 size = (u32)resource_size(res);
|
||||
|
||||
size += CHECK_CHUNKSIZE-1;
|
||||
size /= CHECK_CHUNKSIZE;
|
||||
|
||||
S3C_PMDBG("Area %08lx..%08lx, %d blocks\n",
|
||||
(unsigned long)res->start, (unsigned long)res->end, size);
|
||||
|
||||
*val += size * sizeof(u32);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* s3c_pm_prepare_check
|
||||
*
|
||||
* prepare the necessary information for creating the CRCs. This
|
||||
* must be done before the final save, as it will require memory
|
||||
* allocating, and thus touching bits of the kernel we do not
|
||||
* know about.
|
||||
*/
|
||||
|
||||
void s3c_pm_check_prepare(void)
|
||||
{
|
||||
crc_size = 0;
|
||||
|
||||
s3c_pm_run_sysram(s3c_pm_countram, &crc_size);
|
||||
|
||||
S3C_PMDBG("s3c_pm_prepare_check: %u checks needed\n", crc_size);
|
||||
|
||||
crcs = kmalloc(crc_size+4, GFP_KERNEL);
|
||||
if (crcs == NULL)
|
||||
printk(KERN_ERR "Cannot allocated CRC save area\n");
|
||||
}
|
||||
|
||||
static u32 *s3c_pm_makecheck(struct resource *res, u32 *val)
|
||||
{
|
||||
unsigned long addr, left;
|
||||
|
||||
for (addr = res->start; addr < res->end;
|
||||
addr += CHECK_CHUNKSIZE) {
|
||||
left = res->end - addr;
|
||||
|
||||
if (left > CHECK_CHUNKSIZE)
|
||||
left = CHECK_CHUNKSIZE;
|
||||
|
||||
*val = crc32_le(~0, phys_to_virt(addr), left);
|
||||
val++;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/* s3c_pm_check_store
|
||||
*
|
||||
* compute the CRC values for the memory blocks before the final
|
||||
* sleep.
|
||||
*/
|
||||
|
||||
void s3c_pm_check_store(void)
|
||||
{
|
||||
if (crcs != NULL)
|
||||
s3c_pm_run_sysram(s3c_pm_makecheck, crcs);
|
||||
}
|
||||
|
||||
/* in_region
|
||||
*
|
||||
* return TRUE if the area defined by ptr..ptr+size contains the
|
||||
* what..what+whatsz
|
||||
*/
|
||||
|
||||
static inline int in_region(void *ptr, int size, void *what, size_t whatsz)
|
||||
{
|
||||
if ((what+whatsz) < ptr)
|
||||
return 0;
|
||||
|
||||
if (what > (ptr+size))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* s3c_pm_runcheck() - helper to check a resource on restore.
|
||||
* @res: The resource to check
|
||||
* @vak: Pointer to list of CRC32 values to check.
|
||||
*
|
||||
* Called from the s3c_pm_check_restore() via s3c_pm_run_sysram(), this
|
||||
* function runs the given memory resource checking it against the stored
|
||||
* CRC to ensure that memory is restored. The function tries to skip as
|
||||
* many of the areas used during the suspend process.
|
||||
*/
|
||||
static u32 *s3c_pm_runcheck(struct resource *res, u32 *val)
|
||||
{
|
||||
unsigned long addr;
|
||||
unsigned long left;
|
||||
void *stkpage;
|
||||
void *ptr;
|
||||
u32 calc;
|
||||
|
||||
stkpage = (void *)((u32)&calc & ~PAGE_MASK);
|
||||
|
||||
for (addr = res->start; addr < res->end;
|
||||
addr += CHECK_CHUNKSIZE) {
|
||||
left = res->end - addr;
|
||||
|
||||
if (left > CHECK_CHUNKSIZE)
|
||||
left = CHECK_CHUNKSIZE;
|
||||
|
||||
ptr = phys_to_virt(addr);
|
||||
|
||||
if (in_region(ptr, left, stkpage, 4096)) {
|
||||
S3C_PMDBG("skipping %08lx, has stack in\n", addr);
|
||||
goto skip_check;
|
||||
}
|
||||
|
||||
if (in_region(ptr, left, crcs, crc_size)) {
|
||||
S3C_PMDBG("skipping %08lx, has crc block in\n", addr);
|
||||
goto skip_check;
|
||||
}
|
||||
|
||||
/* calculate and check the checksum */
|
||||
|
||||
calc = crc32_le(~0, ptr, left);
|
||||
if (calc != *val) {
|
||||
printk(KERN_ERR "Restore CRC error at "
|
||||
"%08lx (%08x vs %08x)\n", addr, calc, *val);
|
||||
|
||||
S3C_PMDBG("Restore CRC error at %08lx (%08x vs %08x)\n",
|
||||
addr, calc, *val);
|
||||
}
|
||||
|
||||
skip_check:
|
||||
val++;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* s3c_pm_check_restore() - memory check called on resume
|
||||
*
|
||||
* check the CRCs after the restore event and free the memory used
|
||||
* to hold them
|
||||
*/
|
||||
void s3c_pm_check_restore(void)
|
||||
{
|
||||
if (crcs != NULL)
|
||||
s3c_pm_run_sysram(s3c_pm_runcheck, crcs);
|
||||
}
|
||||
|
||||
/**
|
||||
* s3c_pm_check_cleanup() - free memory resources
|
||||
*
|
||||
* Free the resources that where allocated by the suspend
|
||||
* memory check code. We do this separately from the
|
||||
* s3c_pm_check_restore() function as we cannot call any
|
||||
* functions that might sleep during that resume.
|
||||
*/
|
||||
void s3c_pm_check_cleanup(void)
|
||||
{
|
||||
kfree(crcs);
|
||||
crcs = NULL;
|
||||
}
|
||||
|
75
arch/arm/plat-samsung/pm-common.c
Normal file
75
arch/arm/plat-samsung/pm-common.c
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Samsung Electronics Co., Ltd.
|
||||
* Tomasz Figa <t.figa@samsung.com>
|
||||
* Copyright (C) 2008 Openmoko, Inc.
|
||||
* Copyright (C) 2004-2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* Samsung common power management helper functions.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <plat/pm-common.h>
|
||||
|
||||
/* helper functions to save and restore register state */
|
||||
|
||||
/**
|
||||
* s3c_pm_do_save() - save a set of registers for restoration on resume.
|
||||
* @ptr: Pointer to an array of registers.
|
||||
* @count: Size of the ptr array.
|
||||
*
|
||||
* Run through the list of registers given, saving their contents in the
|
||||
* array for later restoration when we wakeup.
|
||||
*/
|
||||
void s3c_pm_do_save(struct sleep_save *ptr, int count)
|
||||
{
|
||||
for (; count > 0; count--, ptr++) {
|
||||
ptr->val = __raw_readl(ptr->reg);
|
||||
S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* s3c_pm_do_restore() - restore register values from the save list.
|
||||
* @ptr: Pointer to an array of registers.
|
||||
* @count: Size of the ptr array.
|
||||
*
|
||||
* Restore the register values saved from s3c_pm_do_save().
|
||||
*
|
||||
* Note, we do not use S3C_PMDBG() in here, as the system may not have
|
||||
* restore the UARTs state yet
|
||||
*/
|
||||
|
||||
void s3c_pm_do_restore(const struct sleep_save *ptr, int count)
|
||||
{
|
||||
for (; count > 0; count--, ptr++) {
|
||||
pr_debug("restore %p (restore %08lx, was %08x)\n",
|
||||
ptr->reg, ptr->val, __raw_readl(ptr->reg));
|
||||
|
||||
__raw_writel(ptr->val, ptr->reg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* s3c_pm_do_restore_core() - early restore register values from save list.
|
||||
*
|
||||
* This is similar to s3c_pm_do_restore() except we try and minimise the
|
||||
* side effects of the function in case registers that hardware might need
|
||||
* to work has been restored.
|
||||
*
|
||||
* WARNING: Do not put any debug in here that may effect memory or use
|
||||
* peripherals, as things may be changing!
|
||||
*/
|
||||
|
||||
void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
|
||||
{
|
||||
for (; count > 0; count--, ptr++)
|
||||
__raw_writel(ptr->val, ptr->reg);
|
||||
}
|
98
arch/arm/plat-samsung/pm-debug.c
Normal file
98
arch/arm/plat-samsung/pm-debug.c
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Samsung Electronics Co., Ltd.
|
||||
* Tomasz Figa <t.figa@samsung.com>
|
||||
* Copyright (C) 2008 Openmoko, Inc.
|
||||
* Copyright (C) 2004-2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* Samsung common power management (suspend to RAM) debug support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/pm-common.h>
|
||||
|
||||
#ifdef CONFIG_SAMSUNG_ATAGS
|
||||
#include <mach/pm-core.h>
|
||||
#else
|
||||
static inline void s3c_pm_debug_init_uart(void) {}
|
||||
static inline void s3c_pm_arch_update_uart(void __iomem *regs,
|
||||
struct pm_uart_save *save) {}
|
||||
#endif
|
||||
|
||||
static struct pm_uart_save uart_save;
|
||||
|
||||
extern void printascii(const char *);
|
||||
|
||||
void s3c_pm_dbg(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
char buff[256];
|
||||
|
||||
va_start(va, fmt);
|
||||
vsnprintf(buff, sizeof(buff), fmt, va);
|
||||
va_end(va);
|
||||
|
||||
printascii(buff);
|
||||
}
|
||||
|
||||
void s3c_pm_debug_init(void)
|
||||
{
|
||||
/* restart uart clocks so we can use them to output */
|
||||
s3c_pm_debug_init_uart();
|
||||
}
|
||||
|
||||
static inline void __iomem *s3c_pm_uart_base(void)
|
||||
{
|
||||
unsigned long paddr;
|
||||
unsigned long vaddr;
|
||||
|
||||
debug_ll_addr(&paddr, &vaddr);
|
||||
|
||||
return (void __iomem *)vaddr;
|
||||
}
|
||||
|
||||
void s3c_pm_save_uarts(void)
|
||||
{
|
||||
void __iomem *regs = s3c_pm_uart_base();
|
||||
struct pm_uart_save *save = &uart_save;
|
||||
|
||||
save->ulcon = __raw_readl(regs + S3C2410_ULCON);
|
||||
save->ucon = __raw_readl(regs + S3C2410_UCON);
|
||||
save->ufcon = __raw_readl(regs + S3C2410_UFCON);
|
||||
save->umcon = __raw_readl(regs + S3C2410_UMCON);
|
||||
save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV);
|
||||
|
||||
if (!soc_is_s3c2410())
|
||||
save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT);
|
||||
|
||||
S3C_PMDBG("UART[%p]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",
|
||||
regs, save->ulcon, save->ucon, save->ufcon, save->ubrdiv);
|
||||
}
|
||||
|
||||
void s3c_pm_restore_uarts(void)
|
||||
{
|
||||
void __iomem *regs = s3c_pm_uart_base();
|
||||
struct pm_uart_save *save = &uart_save;
|
||||
|
||||
s3c_pm_arch_update_uart(regs, save);
|
||||
|
||||
__raw_writel(save->ulcon, regs + S3C2410_ULCON);
|
||||
__raw_writel(save->ucon, regs + S3C2410_UCON);
|
||||
__raw_writel(save->ufcon, regs + S3C2410_UFCON);
|
||||
__raw_writel(save->umcon, regs + S3C2410_UMCON);
|
||||
__raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV);
|
||||
|
||||
if (!soc_is_s3c2410())
|
||||
__raw_writel(save->udivslot, regs + S3C2443_DIVSLOT);
|
||||
}
|
386
arch/arm/plat-samsung/pm-gpio.c
Normal file
386
arch/arm/plat-samsung/pm-gpio.c
Normal file
|
@ -0,0 +1,386 @@
|
|||
|
||||
/* linux/arch/arm/plat-s3c/pm-gpio.c
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* S3C series GPIO PM code
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
#include <plat/gpio-core.h>
|
||||
#include <plat/pm.h>
|
||||
|
||||
/* PM GPIO helpers */
|
||||
|
||||
#define OFFS_CON (0x00)
|
||||
#define OFFS_DAT (0x04)
|
||||
#define OFFS_UP (0x08)
|
||||
|
||||
static void samsung_gpio_pm_1bit_save(struct samsung_gpio_chip *chip)
|
||||
{
|
||||
chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
|
||||
chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
|
||||
}
|
||||
|
||||
static void samsung_gpio_pm_1bit_resume(struct samsung_gpio_chip *chip)
|
||||
{
|
||||
void __iomem *base = chip->base;
|
||||
u32 old_gpcon = __raw_readl(base + OFFS_CON);
|
||||
u32 old_gpdat = __raw_readl(base + OFFS_DAT);
|
||||
u32 gps_gpcon = chip->pm_save[0];
|
||||
u32 gps_gpdat = chip->pm_save[1];
|
||||
u32 gpcon;
|
||||
|
||||
/* GPACON only has one bit per control / data and no PULLUPs.
|
||||
* GPACON[x] = 0 => Output, 1 => SFN */
|
||||
|
||||
/* first set all SFN bits to SFN */
|
||||
|
||||
gpcon = old_gpcon | gps_gpcon;
|
||||
__raw_writel(gpcon, base + OFFS_CON);
|
||||
|
||||
/* now set all the other bits */
|
||||
|
||||
__raw_writel(gps_gpdat, base + OFFS_DAT);
|
||||
__raw_writel(gps_gpcon, base + OFFS_CON);
|
||||
|
||||
S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
|
||||
chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
|
||||
}
|
||||
|
||||
struct samsung_gpio_pm samsung_gpio_pm_1bit = {
|
||||
.save = samsung_gpio_pm_1bit_save,
|
||||
.resume = samsung_gpio_pm_1bit_resume,
|
||||
};
|
||||
|
||||
static void samsung_gpio_pm_2bit_save(struct samsung_gpio_chip *chip)
|
||||
{
|
||||
chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
|
||||
chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
|
||||
chip->pm_save[2] = __raw_readl(chip->base + OFFS_UP);
|
||||
}
|
||||
|
||||
/* Test whether the given masked+shifted bits of an GPIO configuration
|
||||
* are one of the SFN (special function) modes. */
|
||||
|
||||
static inline int is_sfn(unsigned long con)
|
||||
{
|
||||
return con >= 2;
|
||||
}
|
||||
|
||||
/* Test if the given masked+shifted GPIO configuration is an input */
|
||||
|
||||
static inline int is_in(unsigned long con)
|
||||
{
|
||||
return con == 0;
|
||||
}
|
||||
|
||||
/* Test if the given masked+shifted GPIO configuration is an output */
|
||||
|
||||
static inline int is_out(unsigned long con)
|
||||
{
|
||||
return con == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* samsung_gpio_pm_2bit_resume() - restore the given GPIO bank
|
||||
* @chip: The chip information to resume.
|
||||
*
|
||||
* Restore one of the GPIO banks that was saved during suspend. This is
|
||||
* not as simple as once thought, due to the possibility of glitches
|
||||
* from the order that the CON and DAT registers are set in.
|
||||
*
|
||||
* The three states the pin can be are {IN,OUT,SFN} which gives us 9
|
||||
* combinations of changes to check. Three of these, if the pin stays
|
||||
* in the same configuration can be discounted. This leaves us with
|
||||
* the following:
|
||||
*
|
||||
* { IN => OUT } Change DAT first
|
||||
* { IN => SFN } Change CON first
|
||||
* { OUT => SFN } Change CON first, so new data will not glitch
|
||||
* { OUT => IN } Change CON first, so new data will not glitch
|
||||
* { SFN => IN } Change CON first
|
||||
* { SFN => OUT } Change DAT first, so new data will not glitch [1]
|
||||
*
|
||||
* We do not currently deal with the UP registers as these control
|
||||
* weak resistors, so a small delay in change should not need to bring
|
||||
* these into the calculations.
|
||||
*
|
||||
* [1] this assumes that writing to a pin DAT whilst in SFN will set the
|
||||
* state for when it is next output.
|
||||
*/
|
||||
static void samsung_gpio_pm_2bit_resume(struct samsung_gpio_chip *chip)
|
||||
{
|
||||
void __iomem *base = chip->base;
|
||||
u32 old_gpcon = __raw_readl(base + OFFS_CON);
|
||||
u32 old_gpdat = __raw_readl(base + OFFS_DAT);
|
||||
u32 gps_gpcon = chip->pm_save[0];
|
||||
u32 gps_gpdat = chip->pm_save[1];
|
||||
u32 gpcon, old, new, mask;
|
||||
u32 change_mask = 0x0;
|
||||
int nr;
|
||||
|
||||
/* restore GPIO pull-up settings */
|
||||
__raw_writel(chip->pm_save[2], base + OFFS_UP);
|
||||
|
||||
/* Create a change_mask of all the items that need to have
|
||||
* their CON value changed before their DAT value, so that
|
||||
* we minimise the work between the two settings.
|
||||
*/
|
||||
|
||||
for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {
|
||||
old = (old_gpcon & mask) >> nr;
|
||||
new = (gps_gpcon & mask) >> nr;
|
||||
|
||||
/* If there is no change, then skip */
|
||||
|
||||
if (old == new)
|
||||
continue;
|
||||
|
||||
/* If both are special function, then skip */
|
||||
|
||||
if (is_sfn(old) && is_sfn(new))
|
||||
continue;
|
||||
|
||||
/* Change is IN => OUT, do not change now */
|
||||
|
||||
if (is_in(old) && is_out(new))
|
||||
continue;
|
||||
|
||||
/* Change is SFN => OUT, do not change now */
|
||||
|
||||
if (is_sfn(old) && is_out(new))
|
||||
continue;
|
||||
|
||||
/* We should now be at the case of IN=>SFN,
|
||||
* OUT=>SFN, OUT=>IN, SFN=>IN. */
|
||||
|
||||
change_mask |= mask;
|
||||
}
|
||||
|
||||
|
||||
/* Write the new CON settings */
|
||||
|
||||
gpcon = old_gpcon & ~change_mask;
|
||||
gpcon |= gps_gpcon & change_mask;
|
||||
|
||||
__raw_writel(gpcon, base + OFFS_CON);
|
||||
|
||||
/* Now change any items that require DAT,CON */
|
||||
|
||||
__raw_writel(gps_gpdat, base + OFFS_DAT);
|
||||
__raw_writel(gps_gpcon, base + OFFS_CON);
|
||||
|
||||
S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
|
||||
chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
|
||||
}
|
||||
|
||||
struct samsung_gpio_pm samsung_gpio_pm_2bit = {
|
||||
.save = samsung_gpio_pm_2bit_save,
|
||||
.resume = samsung_gpio_pm_2bit_resume,
|
||||
};
|
||||
|
||||
#if defined(CONFIG_ARCH_S3C64XX)
|
||||
static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip)
|
||||
{
|
||||
chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
|
||||
chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT);
|
||||
chip->pm_save[3] = __raw_readl(chip->base + OFFS_UP);
|
||||
|
||||
if (chip->chip.ngpio > 8)
|
||||
chip->pm_save[0] = __raw_readl(chip->base - 4);
|
||||
}
|
||||
|
||||
static u32 samsung_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon)
|
||||
{
|
||||
u32 old, new, mask;
|
||||
u32 change_mask = 0x0;
|
||||
int nr;
|
||||
|
||||
for (nr = 0, mask = 0x0f; nr < 16; nr += 4, mask <<= 4) {
|
||||
old = (old_gpcon & mask) >> nr;
|
||||
new = (gps_gpcon & mask) >> nr;
|
||||
|
||||
/* If there is no change, then skip */
|
||||
|
||||
if (old == new)
|
||||
continue;
|
||||
|
||||
/* If both are special function, then skip */
|
||||
|
||||
if (is_sfn(old) && is_sfn(new))
|
||||
continue;
|
||||
|
||||
/* Change is IN => OUT, do not change now */
|
||||
|
||||
if (is_in(old) && is_out(new))
|
||||
continue;
|
||||
|
||||
/* Change is SFN => OUT, do not change now */
|
||||
|
||||
if (is_sfn(old) && is_out(new))
|
||||
continue;
|
||||
|
||||
/* We should now be at the case of IN=>SFN,
|
||||
* OUT=>SFN, OUT=>IN, SFN=>IN. */
|
||||
|
||||
change_mask |= mask;
|
||||
}
|
||||
|
||||
return change_mask;
|
||||
}
|
||||
|
||||
static void samsung_gpio_pm_4bit_con(struct samsung_gpio_chip *chip, int index)
|
||||
{
|
||||
void __iomem *con = chip->base + (index * 4);
|
||||
u32 old_gpcon = __raw_readl(con);
|
||||
u32 gps_gpcon = chip->pm_save[index + 1];
|
||||
u32 gpcon, mask;
|
||||
|
||||
mask = samsung_gpio_pm_4bit_mask(old_gpcon, gps_gpcon);
|
||||
|
||||
gpcon = old_gpcon & ~mask;
|
||||
gpcon |= gps_gpcon & mask;
|
||||
|
||||
__raw_writel(gpcon, con);
|
||||
}
|
||||
|
||||
static void samsung_gpio_pm_4bit_resume(struct samsung_gpio_chip *chip)
|
||||
{
|
||||
void __iomem *base = chip->base;
|
||||
u32 old_gpcon[2];
|
||||
u32 old_gpdat = __raw_readl(base + OFFS_DAT);
|
||||
u32 gps_gpdat = chip->pm_save[2];
|
||||
|
||||
/* First, modify the CON settings */
|
||||
|
||||
old_gpcon[0] = 0;
|
||||
old_gpcon[1] = __raw_readl(base + OFFS_CON);
|
||||
|
||||
samsung_gpio_pm_4bit_con(chip, 0);
|
||||
if (chip->chip.ngpio > 8) {
|
||||
old_gpcon[0] = __raw_readl(base - 4);
|
||||
samsung_gpio_pm_4bit_con(chip, -1);
|
||||
}
|
||||
|
||||
/* Now change the configurations that require DAT,CON */
|
||||
|
||||
__raw_writel(chip->pm_save[2], base + OFFS_DAT);
|
||||
__raw_writel(chip->pm_save[1], base + OFFS_CON);
|
||||
if (chip->chip.ngpio > 8)
|
||||
__raw_writel(chip->pm_save[0], base - 4);
|
||||
|
||||
__raw_writel(chip->pm_save[2], base + OFFS_DAT);
|
||||
__raw_writel(chip->pm_save[3], base + OFFS_UP);
|
||||
|
||||
if (chip->chip.ngpio > 8) {
|
||||
S3C_PMDBG("%s: CON4 %08x,%08x => %08x,%08x, DAT %08x => %08x\n",
|
||||
chip->chip.label, old_gpcon[0], old_gpcon[1],
|
||||
__raw_readl(base - 4),
|
||||
__raw_readl(base + OFFS_CON),
|
||||
old_gpdat, gps_gpdat);
|
||||
} else
|
||||
S3C_PMDBG("%s: CON4 %08x => %08x, DAT %08x => %08x\n",
|
||||
chip->chip.label, old_gpcon[1],
|
||||
__raw_readl(base + OFFS_CON),
|
||||
old_gpdat, gps_gpdat);
|
||||
}
|
||||
|
||||
struct samsung_gpio_pm samsung_gpio_pm_4bit = {
|
||||
.save = samsung_gpio_pm_4bit_save,
|
||||
.resume = samsung_gpio_pm_4bit_resume,
|
||||
};
|
||||
#endif /* CONFIG_ARCH_S3C64XX */
|
||||
|
||||
/**
|
||||
* samsung_pm_save_gpio() - save gpio chip data for suspend
|
||||
* @ourchip: The chip for suspend.
|
||||
*/
|
||||
static void samsung_pm_save_gpio(struct samsung_gpio_chip *ourchip)
|
||||
{
|
||||
struct samsung_gpio_pm *pm = ourchip->pm;
|
||||
|
||||
if (pm == NULL || pm->save == NULL)
|
||||
S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
|
||||
else
|
||||
pm->save(ourchip);
|
||||
}
|
||||
|
||||
/**
|
||||
* samsung_pm_save_gpios() - Save the state of the GPIO banks.
|
||||
*
|
||||
* For all the GPIO banks, save the state of each one ready for going
|
||||
* into a suspend mode.
|
||||
*/
|
||||
void samsung_pm_save_gpios(void)
|
||||
{
|
||||
struct samsung_gpio_chip *ourchip;
|
||||
unsigned int gpio_nr;
|
||||
|
||||
for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
|
||||
ourchip = samsung_gpiolib_getchip(gpio_nr);
|
||||
if (!ourchip) {
|
||||
gpio_nr++;
|
||||
continue;
|
||||
}
|
||||
|
||||
samsung_pm_save_gpio(ourchip);
|
||||
|
||||
S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n",
|
||||
ourchip->chip.label,
|
||||
ourchip->pm_save[0],
|
||||
ourchip->pm_save[1],
|
||||
ourchip->pm_save[2],
|
||||
ourchip->pm_save[3]);
|
||||
|
||||
gpio_nr += ourchip->chip.ngpio;
|
||||
gpio_nr += CONFIG_S3C_GPIO_SPACE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* samsung_pm_resume_gpio() - restore gpio chip data after suspend
|
||||
* @ourchip: The suspended chip.
|
||||
*/
|
||||
static void samsung_pm_resume_gpio(struct samsung_gpio_chip *ourchip)
|
||||
{
|
||||
struct samsung_gpio_pm *pm = ourchip->pm;
|
||||
|
||||
if (pm == NULL || pm->resume == NULL)
|
||||
S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
|
||||
else
|
||||
pm->resume(ourchip);
|
||||
}
|
||||
|
||||
void samsung_pm_restore_gpios(void)
|
||||
{
|
||||
struct samsung_gpio_chip *ourchip;
|
||||
unsigned int gpio_nr;
|
||||
|
||||
for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
|
||||
ourchip = samsung_gpiolib_getchip(gpio_nr);
|
||||
if (!ourchip) {
|
||||
gpio_nr++;
|
||||
continue;
|
||||
}
|
||||
|
||||
samsung_pm_resume_gpio(ourchip);
|
||||
|
||||
gpio_nr += ourchip->chip.ngpio;
|
||||
gpio_nr += CONFIG_S3C_GPIO_SPACE;
|
||||
}
|
||||
}
|
228
arch/arm/plat-samsung/pm.c
Normal file
228
arch/arm/plat-samsung/pm.c
Normal file
|
@ -0,0 +1,228 @@
|
|||
/* linux/arch/arm/plat-s3c/pm.c
|
||||
*
|
||||
* Copyright 2008 Openmoko, Inc.
|
||||
* Copyright 2004-2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* S3C common power management (suspend to ram) support.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/suspend.h>
|
||||
|
||||
#ifdef CONFIG_SAMSUNG_ATAGS
|
||||
#include <mach/map.h>
|
||||
#ifndef CONFIG_ARCH_EXYNOS
|
||||
#include <mach/regs-clock.h>
|
||||
#include <mach/regs-irq.h>
|
||||
#endif
|
||||
#include <mach/irqs.h>
|
||||
#endif
|
||||
|
||||
#include <asm/irq.h>
|
||||
|
||||
#include <plat/pm.h>
|
||||
#include <mach/pm-core.h>
|
||||
|
||||
/* for external use */
|
||||
|
||||
unsigned long s3c_pm_flags;
|
||||
|
||||
/* The IRQ ext-int code goes here, it is too small to currently bother
|
||||
* with its own file. */
|
||||
|
||||
unsigned long s3c_irqwake_intmask = 0xffffffffL;
|
||||
unsigned long s3c_irqwake_eintmask = 0xffffffffL;
|
||||
|
||||
int s3c_irqext_wake(struct irq_data *data, unsigned int state)
|
||||
{
|
||||
unsigned long bit = 1L << IRQ_EINT_BIT(data->irq);
|
||||
|
||||
if (!(s3c_irqwake_eintallow & bit))
|
||||
return -ENOENT;
|
||||
|
||||
printk(KERN_INFO "wake %s for irq %d\n",
|
||||
state ? "enabled" : "disabled", data->irq);
|
||||
|
||||
if (!state)
|
||||
s3c_irqwake_eintmask |= bit;
|
||||
else
|
||||
s3c_irqwake_eintmask &= ~bit;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* s3c2410_pm_show_resume_irqs
|
||||
*
|
||||
* print any IRQs asserted at resume time (ie, we woke from)
|
||||
*/
|
||||
static void __maybe_unused s3c_pm_show_resume_irqs(int start,
|
||||
unsigned long which,
|
||||
unsigned long mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
which &= ~mask;
|
||||
|
||||
for (i = 0; i <= 31; i++) {
|
||||
if (which & (1L<<i)) {
|
||||
S3C_PMDBG("IRQ %d asserted at resume\n", start+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void (*pm_cpu_prep)(void);
|
||||
int (*pm_cpu_sleep)(unsigned long);
|
||||
|
||||
#define any_allowed(mask, allow) (((mask) & (allow)) != (allow))
|
||||
|
||||
/* s3c_pm_enter
|
||||
*
|
||||
* central control for sleep/resume process
|
||||
*/
|
||||
|
||||
static int s3c_pm_enter(suspend_state_t state)
|
||||
{
|
||||
int ret;
|
||||
/* ensure the debug is initialised (if enabled) */
|
||||
|
||||
s3c_pm_debug_init();
|
||||
|
||||
S3C_PMDBG("%s(%d)\n", __func__, state);
|
||||
|
||||
if (pm_cpu_prep == NULL || pm_cpu_sleep == NULL) {
|
||||
printk(KERN_ERR "%s: error: no cpu sleep function\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* check if we have anything to wake-up with... bad things seem
|
||||
* to happen if you suspend with no wakeup (system will often
|
||||
* require a full power-cycle)
|
||||
*/
|
||||
|
||||
if (!of_have_populated_dt() &&
|
||||
!any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) &&
|
||||
!any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) {
|
||||
printk(KERN_ERR "%s: No wake-up sources!\n", __func__);
|
||||
printk(KERN_ERR "%s: Aborting sleep\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* save all necessary core registers not covered by the drivers */
|
||||
|
||||
if (!of_have_populated_dt()) {
|
||||
samsung_pm_save_gpios();
|
||||
samsung_pm_saved_gpios();
|
||||
}
|
||||
|
||||
s3c_pm_save_uarts();
|
||||
s3c_pm_save_core();
|
||||
|
||||
/* set the irq configuration for wake */
|
||||
|
||||
s3c_pm_configure_extint();
|
||||
|
||||
S3C_PMDBG("sleep: irq wakeup masks: %08lx,%08lx\n",
|
||||
s3c_irqwake_intmask, s3c_irqwake_eintmask);
|
||||
|
||||
s3c_pm_arch_prepare_irqs();
|
||||
|
||||
/* call cpu specific preparation */
|
||||
|
||||
pm_cpu_prep();
|
||||
|
||||
/* flush cache back to ram */
|
||||
|
||||
flush_cache_all();
|
||||
|
||||
s3c_pm_check_store();
|
||||
|
||||
/* send the cpu to sleep... */
|
||||
|
||||
s3c_pm_arch_stop_clocks();
|
||||
|
||||
/* this will also act as our return point from when
|
||||
* we resume as it saves its own register state and restores it
|
||||
* during the resume. */
|
||||
|
||||
ret = cpu_suspend(0, pm_cpu_sleep);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* restore the system state */
|
||||
|
||||
s3c_pm_restore_core();
|
||||
s3c_pm_restore_uarts();
|
||||
|
||||
if (!of_have_populated_dt()) {
|
||||
samsung_pm_restore_gpios();
|
||||
s3c_pm_restored_gpios();
|
||||
}
|
||||
|
||||
s3c_pm_debug_init();
|
||||
|
||||
/* check what irq (if any) restored the system */
|
||||
|
||||
s3c_pm_arch_show_resume_irqs();
|
||||
|
||||
S3C_PMDBG("%s: post sleep, preparing to return\n", __func__);
|
||||
|
||||
/* LEDs should now be 1110 */
|
||||
s3c_pm_debug_smdkled(1 << 1, 0);
|
||||
|
||||
s3c_pm_check_restore();
|
||||
|
||||
/* ok, let's return from sleep */
|
||||
|
||||
S3C_PMDBG("S3C PM Resume (post-restore)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c_pm_prepare(void)
|
||||
{
|
||||
/* prepare check area if configured */
|
||||
|
||||
s3c_pm_check_prepare();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void s3c_pm_finish(void)
|
||||
{
|
||||
s3c_pm_check_cleanup();
|
||||
}
|
||||
|
||||
static const struct platform_suspend_ops s3c_pm_ops = {
|
||||
.enter = s3c_pm_enter,
|
||||
.prepare = s3c_pm_prepare,
|
||||
.finish = s3c_pm_finish,
|
||||
.valid = suspend_valid_only_mem,
|
||||
};
|
||||
|
||||
/* s3c_pm_init
|
||||
*
|
||||
* Attach the power management functions. This should be called
|
||||
* from the board specific initialisation if the board supports
|
||||
* it.
|
||||
*/
|
||||
|
||||
int __init s3c_pm_init(void)
|
||||
{
|
||||
printk("S3C Power Management, Copyright 2004 Simtec Electronics\n");
|
||||
|
||||
suspend_set_ops(&s3c_pm_ops);
|
||||
return 0;
|
||||
}
|
146
arch/arm/plat-samsung/s3c-dma-ops.c
Normal file
146
arch/arm/plat-samsung/s3c-dma-ops.c
Normal file
|
@ -0,0 +1,146 @@
|
|||
/* linux/arch/arm/plat-samsung/s3c-dma-ops.c
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Samsung S3C-DMA Operations
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
#include <mach/dma.h>
|
||||
|
||||
struct cb_data {
|
||||
void (*fp) (void *);
|
||||
void *fp_param;
|
||||
unsigned ch;
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
static LIST_HEAD(dma_list);
|
||||
|
||||
static void s3c_dma_cb(struct s3c2410_dma_chan *channel, void *param,
|
||||
int size, enum s3c2410_dma_buffresult res)
|
||||
{
|
||||
struct cb_data *data = param;
|
||||
|
||||
data->fp(data->fp_param);
|
||||
}
|
||||
|
||||
static unsigned s3c_dma_request(enum dma_ch dma_ch,
|
||||
struct samsung_dma_req *param,
|
||||
struct device *dev, char *ch_name)
|
||||
{
|
||||
struct cb_data *data;
|
||||
|
||||
if (s3c2410_dma_request(dma_ch, param->client, NULL) < 0) {
|
||||
s3c2410_dma_free(dma_ch, param->client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (param->cap == DMA_CYCLIC)
|
||||
s3c2410_dma_setflags(dma_ch, S3C2410_DMAF_CIRCULAR);
|
||||
|
||||
data = kzalloc(sizeof(struct cb_data), GFP_KERNEL);
|
||||
data->ch = dma_ch;
|
||||
list_add_tail(&data->node, &dma_list);
|
||||
|
||||
return (unsigned)dma_ch;
|
||||
}
|
||||
|
||||
static int s3c_dma_release(unsigned ch, void *param)
|
||||
{
|
||||
struct cb_data *data;
|
||||
|
||||
list_for_each_entry(data, &dma_list, node)
|
||||
if (data->ch == ch)
|
||||
break;
|
||||
list_del(&data->node);
|
||||
|
||||
s3c2410_dma_free(ch, param);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c_dma_config(unsigned ch, struct samsung_dma_config *param)
|
||||
{
|
||||
s3c2410_dma_devconfig(ch, param->direction, param->fifo);
|
||||
s3c2410_dma_config(ch, param->width);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c_dma_prepare(unsigned ch, struct samsung_dma_prep *param)
|
||||
{
|
||||
struct cb_data *data;
|
||||
dma_addr_t pos = param->buf;
|
||||
dma_addr_t end = param->buf + param->len;
|
||||
|
||||
list_for_each_entry(data, &dma_list, node)
|
||||
if (data->ch == ch)
|
||||
break;
|
||||
|
||||
if (!data->fp) {
|
||||
s3c2410_dma_set_buffdone_fn(ch, s3c_dma_cb);
|
||||
data->fp = param->fp;
|
||||
data->fp_param = param->fp_param;
|
||||
}
|
||||
|
||||
if (param->cap != DMA_CYCLIC) {
|
||||
s3c2410_dma_enqueue(ch, (void *)data, param->buf, param->len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (pos < end) {
|
||||
s3c2410_dma_enqueue(ch, (void *)data, pos, param->period);
|
||||
pos += param->period;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int s3c_dma_trigger(unsigned ch)
|
||||
{
|
||||
return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_START);
|
||||
}
|
||||
|
||||
static inline int s3c_dma_started(unsigned ch)
|
||||
{
|
||||
return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_STARTED);
|
||||
}
|
||||
|
||||
static inline int s3c_dma_flush(unsigned ch)
|
||||
{
|
||||
return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_FLUSH);
|
||||
}
|
||||
|
||||
static inline int s3c_dma_stop(unsigned ch)
|
||||
{
|
||||
return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_STOP);
|
||||
}
|
||||
|
||||
static struct samsung_dma_ops s3c_dma_ops = {
|
||||
.request = s3c_dma_request,
|
||||
.release = s3c_dma_release,
|
||||
.config = s3c_dma_config,
|
||||
.prepare = s3c_dma_prepare,
|
||||
.trigger = s3c_dma_trigger,
|
||||
.started = s3c_dma_started,
|
||||
.flush = s3c_dma_flush,
|
||||
.stop = s3c_dma_stop,
|
||||
};
|
||||
|
||||
void *s3c_dma_get_ops(void)
|
||||
{
|
||||
return &s3c_dma_ops;
|
||||
}
|
||||
EXPORT_SYMBOL(s3c_dma_get_ops);
|
94
arch/arm/plat-samsung/s5p-dev-mfc.c
Normal file
94
arch/arm/plat-samsung/s5p-dev-mfc.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2011 Samsung Electronics Co.Ltd
|
||||
*
|
||||
* Base S5P MFC resource and device definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/of_fdt.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
static struct platform_device s5p_device_mfc_l;
|
||||
static struct platform_device s5p_device_mfc_r;
|
||||
|
||||
struct s5p_mfc_dt_meminfo {
|
||||
unsigned long loff;
|
||||
unsigned long lsize;
|
||||
unsigned long roff;
|
||||
unsigned long rsize;
|
||||
char *compatible;
|
||||
};
|
||||
|
||||
struct s5p_mfc_reserved_mem {
|
||||
phys_addr_t base;
|
||||
unsigned long size;
|
||||
struct device *dev;
|
||||
};
|
||||
|
||||
static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata;
|
||||
|
||||
|
||||
static void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
|
||||
phys_addr_t lbase, unsigned int lsize)
|
||||
{
|
||||
int i;
|
||||
|
||||
s5p_mfc_mem[0].dev = &s5p_device_mfc_r.dev;
|
||||
s5p_mfc_mem[0].base = rbase;
|
||||
s5p_mfc_mem[0].size = rsize;
|
||||
|
||||
s5p_mfc_mem[1].dev = &s5p_device_mfc_l.dev;
|
||||
s5p_mfc_mem[1].base = lbase;
|
||||
s5p_mfc_mem[1].size = lsize;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) {
|
||||
struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i];
|
||||
if (memblock_remove(area->base, area->size)) {
|
||||
printk(KERN_ERR "Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n",
|
||||
area->size, (unsigned long) area->base);
|
||||
area->base = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
|
||||
int depth, void *data)
|
||||
{
|
||||
const __be32 *prop;
|
||||
int len;
|
||||
struct s5p_mfc_dt_meminfo mfc_mem;
|
||||
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
if (!of_flat_dt_is_compatible(node, data))
|
||||
return 0;
|
||||
|
||||
prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
|
||||
if (!prop || (len != 2 * sizeof(unsigned long)))
|
||||
return 0;
|
||||
|
||||
mfc_mem.loff = be32_to_cpu(prop[0]);
|
||||
mfc_mem.lsize = be32_to_cpu(prop[1]);
|
||||
|
||||
prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len);
|
||||
if (!prop || (len != 2 * sizeof(unsigned long)))
|
||||
return 0;
|
||||
|
||||
mfc_mem.roff = be32_to_cpu(prop[0]);
|
||||
mfc_mem.rsize = be32_to_cpu(prop[1]);
|
||||
|
||||
s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize,
|
||||
mfc_mem.loff, mfc_mem.lsize);
|
||||
|
||||
return 1;
|
||||
}
|
71
arch/arm/plat-samsung/setup-camif.c
Normal file
71
arch/arm/plat-samsung/setup-camif.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
|
||||
*
|
||||
* Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/gpio.h>
|
||||
#include <plat/gpio-cfg.h>
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
/* Number of camera port pins, without FIELD */
|
||||
#define S3C_CAMIF_NUM_GPIOS 13
|
||||
|
||||
/* Default camera port configuration helpers. */
|
||||
|
||||
static void camif_get_gpios(int *gpio_start, int *gpio_reset)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_S3C24XX
|
||||
*gpio_start = S3C2410_GPJ(0);
|
||||
*gpio_reset = S3C2410_GPJ(12);
|
||||
#else
|
||||
/* s3c64xx */
|
||||
*gpio_start = S3C64XX_GPF(0);
|
||||
*gpio_reset = S3C64XX_GPF(3);
|
||||
#endif
|
||||
}
|
||||
|
||||
int s3c_camif_gpio_get(void)
|
||||
{
|
||||
int gpio_start, gpio_reset;
|
||||
int ret, i;
|
||||
|
||||
camif_get_gpios(&gpio_start, &gpio_reset);
|
||||
|
||||
for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
|
||||
int gpio = gpio_start + i;
|
||||
|
||||
if (gpio == gpio_reset)
|
||||
continue;
|
||||
|
||||
ret = gpio_request(gpio, "camif");
|
||||
if (!ret)
|
||||
ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
|
||||
if (ret) {
|
||||
pr_err("failed to configure GPIO %d\n", gpio);
|
||||
for (--i; i >= 0; i--)
|
||||
gpio_free(gpio--);
|
||||
return ret;
|
||||
}
|
||||
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void s3c_camif_gpio_put(void)
|
||||
{
|
||||
int i, gpio_start, gpio_reset;
|
||||
|
||||
camif_get_gpios(&gpio_start, &gpio_reset);
|
||||
|
||||
for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
|
||||
int gpio = gpio_start + i;
|
||||
if (gpio != gpio_reset)
|
||||
gpio_free(gpio);
|
||||
}
|
||||
}
|
47
arch/arm/plat-samsung/wakeup-mask.c
Normal file
47
arch/arm/plat-samsung/wakeup-mask.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* arch/arm/plat-samsung/wakeup-mask.c
|
||||
*
|
||||
* Copyright 2010 Ben Dooks <ben-linux@fluff.org>
|
||||
*
|
||||
* Support for wakeup mask interrupts on newer SoCs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/wakeup-mask.h>
|
||||
#include <plat/pm.h>
|
||||
|
||||
void samsung_sync_wakemask(void __iomem *reg,
|
||||
struct samsung_wakeup_mask *mask, int nr_mask)
|
||||
{
|
||||
struct irq_data *data;
|
||||
u32 val;
|
||||
|
||||
val = __raw_readl(reg);
|
||||
|
||||
for (; nr_mask > 0; nr_mask--, mask++) {
|
||||
if (mask->irq == NO_WAKEUP_IRQ) {
|
||||
val |= mask->bit;
|
||||
continue;
|
||||
}
|
||||
|
||||
data = irq_get_irq_data(mask->irq);
|
||||
|
||||
/* bit of a liberty to read this directly from irq_data. */
|
||||
if (irqd_is_wakeup_set(data))
|
||||
val &= ~mask->bit;
|
||||
else
|
||||
val |= mask->bit;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
|
||||
__raw_writel(val, reg);
|
||||
}
|
97
arch/arm/plat-samsung/watchdog-reset.c
Normal file
97
arch/arm/plat-samsung/watchdog-reset.c
Normal file
|
@ -0,0 +1,97 @@
|
|||
/* arch/arm/plat-samsung/watchdog-reset.c
|
||||
*
|
||||
* Copyright (c) 2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* Coyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
|
||||
*
|
||||
* Watchdog reset support for Samsung SoCs.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
|
||||
#define S3C2410_WTCON 0x00
|
||||
#define S3C2410_WTDAT 0x04
|
||||
#define S3C2410_WTCNT 0x08
|
||||
|
||||
#define S3C2410_WTCON_ENABLE (1 << 5)
|
||||
#define S3C2410_WTCON_DIV16 (0 << 3)
|
||||
#define S3C2410_WTCON_RSTEN (1 << 0)
|
||||
#define S3C2410_WTCON_PRESCALE(x) ((x) << 8)
|
||||
|
||||
static void __iomem *wdt_base;
|
||||
static struct clk *wdt_clock;
|
||||
|
||||
void samsung_wdt_reset(void)
|
||||
{
|
||||
if (!wdt_base) {
|
||||
pr_err("%s: wdt reset not initialized\n", __func__);
|
||||
/* delay to allow the serial port to show the message */
|
||||
mdelay(50);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IS_ERR(wdt_clock))
|
||||
clk_prepare_enable(wdt_clock);
|
||||
|
||||
/* disable watchdog, to be safe */
|
||||
__raw_writel(0, wdt_base + S3C2410_WTCON);
|
||||
|
||||
/* put initial values into count and data */
|
||||
__raw_writel(0x80, wdt_base + S3C2410_WTCNT);
|
||||
__raw_writel(0x80, wdt_base + S3C2410_WTDAT);
|
||||
|
||||
/* set the watchdog to go and reset... */
|
||||
__raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV16 |
|
||||
S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x20),
|
||||
wdt_base + S3C2410_WTCON);
|
||||
|
||||
/* wait for reset to assert... */
|
||||
mdelay(500);
|
||||
|
||||
pr_err("Watchdog reset failed to assert reset\n");
|
||||
|
||||
/* delay to allow the serial port to show the message */
|
||||
mdelay(50);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id s3c2410_wdt_match[] = {
|
||||
{ .compatible = "samsung,s3c2410-wdt" },
|
||||
{},
|
||||
};
|
||||
|
||||
void __init samsung_wdt_reset_of_init(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
|
||||
np = of_find_matching_node(NULL, s3c2410_wdt_match);
|
||||
if (!np) {
|
||||
pr_err("%s: failed to find watchdog node\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
wdt_base = of_iomap(np, 0);
|
||||
if (!wdt_base) {
|
||||
pr_err("%s: failed to map watchdog registers\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
wdt_clock = of_clk_get(np, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void __init samsung_wdt_reset_init(void __iomem *base)
|
||||
{
|
||||
wdt_base = base;
|
||||
wdt_clock = clk_get(NULL, "watchdog");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue