Commit 01b2d84d authored by Kevin Hilman's avatar Kevin Hilman

davinci: cleanup: remove platform-specific tags

Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent f9719b2d
......@@ -143,10 +143,6 @@ struct tag_omap {
u8 data[0];
};
struct tag_davinci {
u8 data[0];
};
/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
#define ATAG_MEMCLK 0x41000402
......@@ -177,11 +173,6 @@ struct tag {
*/
struct tag_omap omap;
/*
* DaVinci specific
*/
struct tag_davinci davinci;
/*
* DC21285 specific
*/
......
......@@ -87,23 +87,6 @@ config DAVINCI_RESET_CLOCKS
probably do not want this option enabled until your
device drivers work properly.
config DAVINCI_BOOT_TAG
bool "DaVinci bootloader information passing"
depends on ARCH_DAVINCI_DM644x
default n
help
Say Y, if you have a bootloader which passes information
about your board and its peripheral configuration.
comment "DaVinci Options"
config DAVINCI_BLK_DEV_CF
bool "TI DaVinci CF Card Support"
default Y
depends on BLK_DEV_DAVINCI
help
Configure this option to enable CF Card support.
endmenu
endif
......@@ -5,7 +5,7 @@
# Common objects
obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \
gpio.o devices.o usb.o dma.o common.o iram.o
gpio.o devices.o usb.o dma.o iram.o
obj-$(CONFIG_DAVINCI_MUX) += mux.o mux_cfg.o
......
......@@ -166,14 +166,10 @@ static struct platform_device *davinci_evm_devices[] __initdata = {
&davinci_nand_device,
};
static struct davinci_uart_config davinci_evm_uart_config __initdata = {
static struct davinci_uart_config uart_config __initdata = {
.enabled_uarts = (1 << 0),
};
static struct davinci_board_config_kernel davinci_evm_config[] __initdata = {
{ DAVINCI_TAG_UART, &davinci_evm_uart_config },
};
static void __init dm355_evm_map_io(void)
{
davinci_map_common_io();
......@@ -223,9 +219,7 @@ static __init void dm355_evm_init(void)
platform_add_devices(davinci_evm_devices,
ARRAY_SIZE(davinci_evm_devices));
evm_init_i2c();
davinci_board_config = davinci_evm_config;
davinci_board_config_size = ARRAY_SIZE(davinci_evm_config);
davinci_serial_init();
davinci_serial_init(&uart_config);
gpio_request(2, "usb_id_toggle");
gpio_direction_output(2, USB_ID_VALUE);
......
......@@ -582,14 +582,10 @@ static struct platform_device *davinci_evm_devices[] __initdata = {
&ide_dev,
};
static struct davinci_uart_config davinci_evm_uart_config __initdata = {
static struct davinci_uart_config uart_config __initdata = {
.enabled_uarts = (1 << 0),
};
static struct davinci_board_config_kernel davinci_evm_config[] __initdata = {
{ DAVINCI_TAG_UART, &davinci_evm_uart_config },
};
static void __init
davinci_evm_map_io(void)
{
......@@ -628,9 +624,7 @@ static __init void davinci_evm_init(void)
davinci_setup_mmc(0, &dm6446evm_mmc_config);
davinci_board_config = davinci_evm_config;
davinci_board_config_size = ARRAY_SIZE(davinci_evm_config);
davinci_serial_init();
davinci_serial_init(&uart_config);
/* Register the fixup for PHY on DaVinci */
phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
......
......@@ -46,14 +46,10 @@
#include <linux/etherdevice.h>
#include <mach/emac.h>
static struct davinci_uart_config davinci_evm_uart_config __initdata = {
static struct davinci_uart_config uart_config __initdata = {
.enabled_uarts = (1 << 0),
};
static struct davinci_board_config_kernel davinci_evm_config[] __initdata = {
{ DAVINCI_TAG_UART, &davinci_evm_uart_config },
};
/* Most of this EEPROM is unused, but U-Boot uses some data:
* - 0x7f00, 6 bytes Ethernet Address
* - ... newer boards may have more
......@@ -126,9 +122,7 @@ static __init void evm_init(void)
{
davinci_psc_init();
evm_init_i2c();
davinci_board_config = davinci_evm_config;
davinci_board_config_size = ARRAY_SIZE(davinci_evm_config);
davinci_serial_init();
davinci_serial_init(&uart_config);
}
static __init void davinci_dm646x_evm_irq_init(void)
......
......@@ -141,14 +141,10 @@ static struct platform_device *davinci_sffsdr_devices[] __initdata = {
&davinci_sffsdr_nandflash_device,
};
static struct davinci_uart_config davinci_sffsdr_uart_config __initdata = {
static struct davinci_uart_config uart_config __initdata = {
.enabled_uarts = (1 << 0),
};
static struct davinci_board_config_kernel davinci_sffsdr_config[] __initdata = {
{ DAVINCI_TAG_UART, &davinci_sffsdr_uart_config },
};
static void __init davinci_sffsdr_map_io(void)
{
davinci_map_common_io();
......@@ -160,9 +156,7 @@ static __init void davinci_sffsdr_init(void)
platform_add_devices(davinci_sffsdr_devices,
ARRAY_SIZE(davinci_sffsdr_devices));
sffsdr_init_i2c();
davinci_board_config = davinci_sffsdr_config;
davinci_board_config_size = ARRAY_SIZE(davinci_sffsdr_config);
davinci_serial_init();
davinci_serial_init(&uart_config);
davinci_init_emac(davinci_sffsdr_mac_addr);
setup_usb(0, 0); /* We support only peripheral mode. */
}
......
/*
* linux/arch/arm/mach-davinci/common.c
*
* Code common to all DaVinci machines.
*
* 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/delay.h>
#include <linux/pm.h>
#include <linux/console.h>
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/serial_8250.h>
#include <linux/serial_reg.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/mach/map.h>
#include <asm/setup.h>
#include <mach/hardware.h>
#include <mach/board.h>
#include <mach/serial.h>
#include <mach/mux.h>
#include <mach/clock.h>
#define NO_LENGTH_CHECK 0xffffffff
unsigned char davinci_bootloader_tag[1024];
int davinci_bootloader_tag_len;
struct davinci_board_config_kernel *davinci_board_config;
int davinci_board_config_size;
#ifdef CONFIG_DAVINCI_BOOT_TAG
static int __init parse_tag_davinci(const struct tag *tag)
{
u32 size = tag->hdr.size - (sizeof(tag->hdr) >> 2);
size <<= 2;
if (size > sizeof(davinci_bootloader_tag))
return -1;
memcpy(davinci_bootloader_tag, tag->u.davinci.data, size);
davinci_bootloader_tag_len = size;
return 0;
}
__tagtable(ATAG_BOARD, parse_tag_davinci);
#endif
static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
{
struct davinci_board_config_kernel *kinfo = NULL;
int i;
#ifdef CONFIG_DAVINCI_BOOT_TAG
struct davinci_board_config_entry *info = NULL;
if (davinci_bootloader_tag_len > 4)
info = (struct davinci_board_config_entry *)
davinci_bootloader_tag;
while (info != NULL) {
u8 *next;
if (info->tag == tag) {
if (skip == 0)
break;
skip--;
}
if ((info->len & 0x03) != 0) {
/* We bail out to avoid an alignment fault */
printk(KERN_ERR "DAVINCI peripheral config: Length (%d)"
"not word-aligned (tag %04x)\n", info->len,
info->tag);
return NULL;
}
next = (u8 *) info + sizeof(*info) + info->len;
if (next >= davinci_bootloader_tag + davinci_bootloader_tag_len)
info = NULL;
else
info = (struct davinci_board_config_entry *) next;
}
if (info != NULL) {
/* Check the length as a lame attempt to check for
* binary inconsistency. */
if (len != NO_LENGTH_CHECK) {
/* Word-align len */
if (len & 0x03)
len = (len + 3) & ~0x03;
if (info->len != len) {
printk(KERN_ERR "DaVinci peripheral config: "
"Length mismatch with tag %x"
" (want %d, got %d)\n", tag, len,
info->len);
return NULL;
}
}
if (len_out != NULL)
*len_out = info->len;
return info->data;
}
#endif
/* Try to find the config from the board-specific structures
* in the kernel. */
for (i = 0; i < davinci_board_config_size; i++) {
if (davinci_board_config[i].tag == tag) {
if (skip == 0) {
kinfo = &davinci_board_config[i];
break;
} else {
skip--;
}
}
}
if (kinfo == NULL)
return NULL;
return kinfo->data;
}
const void *__davinci_get_config(u16 tag, size_t len, int nr)
{
return get_config(tag, len, nr, NULL);
}
EXPORT_SYMBOL(__davinci_get_config);
const void *davinci_get_var_config(u16 tag, size_t *len)
{
return get_config(tag, NO_LENGTH_CHECK, 0, len);
}
EXPORT_SYMBOL(davinci_get_var_config);
static int __init davinci_add_serial_console(void)
{
const struct davinci_serial_console_config *con_info;
const struct davinci_uart_config *uart_info;
static char speed[11], *opt;
int line, i, uart_idx;
uart_info = davinci_get_config(DAVINCI_TAG_UART,
struct davinci_uart_config);
con_info = davinci_get_config(DAVINCI_TAG_SERIAL_CONSOLE,
struct davinci_serial_console_config);
if (uart_info == NULL || con_info == NULL)
return 0;
if (con_info->console_uart == 0)
return 0;
if (con_info->console_speed) {
snprintf(speed, sizeof(speed), "%u", con_info->console_speed);
opt = speed;
}
uart_idx = con_info->console_uart - 1;
if (uart_idx >= DAVINCI_MAX_NR_UARTS) {
printk(KERN_INFO "Console: external UART#%d. "
"Not adding it as console this time.\n",
uart_idx + 1);
return 0;
}
if (!(uart_info->enabled_uarts & (1 << uart_idx))) {
printk(KERN_ERR "Console: Selected UART#%d is "
"not enabled for this platform\n",
uart_idx + 1);
return -1;
}
line = 0;
for (i = 0; i < uart_idx; i++) {
if (uart_info->enabled_uarts & (1 << i))
line++;
}
return add_preferred_console("ttyS", line, opt);
}
console_initcall(davinci_add_serial_console);
......@@ -11,20 +11,6 @@
#include <linux/types.h>
/* Different peripheral ids */
#define DAVINCI_TAG_UART 0x4f01
#define DAVINCI_TAG_SERIAL_CONSOLE 0x4f02
struct davinci_serial_console_config {
u8 console_uart;
u32 console_speed;
};
struct davinci_uart_config {
/* Bit field of UARTs present; bit 0 --> UART1 */
unsigned int enabled_uarts;
};
struct davinci_mmc_config {
/* get_cd()/get_wp() may sleep */
int (*get_cd)(int module);
......@@ -34,27 +20,4 @@ struct davinci_mmc_config {
};
void davinci_setup_mmc(int module, struct davinci_mmc_config *config);
struct davinci_board_config_entry {
u16 tag;
u16 len;
u8 data[0];
};
struct davinci_board_config_kernel {
u16 tag;
const void *data;
};
extern const void *__davinci_get_config(u16 tag, size_t len, int nr);
#define davinci_get_config(tag, type) \
((const type *) __davinci_get_config((tag), sizeof(type), 0))
#define davinci_get_nr_config(tag, type, nr) \
((const type *) __davinci_get_config((tag), sizeof(type), (nr)))
extern const void *davinci_get_var_config(u16 tag, size_t *len);
extern struct davinci_board_config_kernel *davinci_board_config;
extern int davinci_board_config_size;
#endif
......@@ -25,6 +25,11 @@
#define UART_DM646X_SCR 0x10
#define UART_DM646X_SCR_TX_WATERMARK 0x08
extern void davinci_serial_init(void);
struct davinci_uart_config {
/* Bit field of UARTs present; bit 0 --> UART1 */
unsigned int enabled_uarts;
};
extern void davinci_serial_init(struct davinci_uart_config *);
#endif /* __ASM_ARCH_SERIAL_H */
......@@ -110,10 +110,9 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p)
UART_DM646X_SCR_TX_WATERMARK);
}
void __init davinci_serial_init(void)
void __init davinci_serial_init(struct davinci_uart_config *info)
{
int i;
const struct davinci_uart_config *info;
char name[16];
struct clk *uart_clk;
struct device *dev = &serial_device.dev;
......@@ -123,12 +122,6 @@ void __init davinci_serial_init(void)
* You have to mux them off in device drivers later on
* if not needed.
*/
info = davinci_get_config(DAVINCI_TAG_UART, struct davinci_uart_config);
if (info == NULL)
return;
for (i = 0; i < DAVINCI_MAX_NR_UARTS; i++) {
struct plat_serial8250_port *p = serial_platform_data + i;
......@@ -148,8 +141,7 @@ void __init davinci_serial_init(void)
}
if (!(info->enabled_uarts & (1 << i))) {
p->membase = 0;
p->mapbase = 0;
p->flags = 0;
continue;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment