Skip to content

Commit

Permalink
Merge branch 'davinci/cleanups' into next/cleanup
Browse files Browse the repository at this point in the history
* davinci/cleanups:
  ARM: davinci: add back dummy header files
  ARM: davinci: dm644x: don't force vpfe registeration on all boards
  ARM: davinci: dm644x: fix inconsistent variable naming
  ARM: davinci: dm644x: improve readability using macro
  ARM: davinci: streamline sysmod access
  ARM: davinci: create new common platform header for davinci
  ARM: davinci: dm646x: move private definitions to C file
  ARM: davinci: dm365: move private definitions to C file
  ARM: davinci: dm644x: move private definitions to C file

Conflicts:
	arch/arm/mach-davinci/board-dm644x-evm.c
	arch/arm/mach-davinci/board-neuros-osd2.c
	arch/arm/mach-davinci/board-sffsdr.c
  • Loading branch information
Arnd Bergmann committed Feb 27, 2012
2 parents 96a3eab + 6ea96e1 commit a3a3c46
Show file tree
Hide file tree
Showing 18 changed files with 220 additions and 255 deletions.
3 changes: 2 additions & 1 deletion arch/arm/mach-davinci/board-dm355-evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>

#include <mach/dm355.h>
#include <mach/i2c.h>
#include <mach/serial.h>
#include <mach/nand.h>
#include <mach/mmc.h>
#include <mach/usb.h>

#include "davinci.h"

/* NOTE: this is geared for the standard config, with a socketed
* 2 GByte Micron NAND (MT29F16G08FAA) using 128KB sectors. If you
* swap chips, maybe with a different block size, partitioning may
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-davinci/board-dm355-leopard.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>

#include <mach/dm355.h>
#include <mach/i2c.h>
#include <mach/serial.h>
#include <mach/nand.h>
#include <mach/mmc.h>
#include <mach/usb.h>

#include "davinci.h"

/* NOTE: this is geared for the standard config, with a socketed
* 2 GByte Micron NAND (MT29F16G08FAA) using 128KB sectors. If you
* swap chips, maybe with a different block size, partitioning may
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-davinci/board-dm365-evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <asm/mach/arch.h>

#include <mach/mux.h>
#include <mach/dm365.h>
#include <mach/common.h>
#include <mach/i2c.h>
#include <mach/serial.h>
Expand All @@ -42,6 +41,8 @@

#include <media/tvp514x.h>

#include "davinci.h"

static inline int have_imager(void)
{
/* REVISIT when it's supported, trigger via Kconfig */
Expand Down
28 changes: 14 additions & 14 deletions arch/arm/mach-davinci/board-dm644x-evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>

#include <mach/dm644x.h>
#include <mach/common.h>
#include <mach/i2c.h>
#include <mach/serial.h>
Expand All @@ -40,6 +39,8 @@
#include <mach/usb.h>
#include <mach/aemif.h>

#include "davinci.h"

#define DM644X_EVM_PHY_ID "davinci_mdio-0:01"
#define LXT971_PHY_ID (0x001378e2)
#define LXT971_PHY_MASK (0xfffffff0)
Expand Down Expand Up @@ -189,15 +190,15 @@ static struct platform_device davinci_fb_device = {
.num_resources = 0,
};

static struct tvp514x_platform_data tvp5146_pdata = {
static struct tvp514x_platform_data dm644xevm_tvp5146_pdata = {
.clk_polarity = 0,
.hs_polarity = 1,
.vs_polarity = 1
};

#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
/* Inputs available at the TVP5146 */
static struct v4l2_input tvp5146_inputs[] = {
static struct v4l2_input dm644xevm_tvp5146_inputs[] = {
{
.index = 0,
.name = "Composite",
Expand All @@ -217,7 +218,7 @@ static struct v4l2_input tvp5146_inputs[] = {
* ouput that goes to vpfe. There is a one to one correspondence
* with tvp5146_inputs
*/
static struct vpfe_route tvp5146_routes[] = {
static struct vpfe_route dm644xevm_tvp5146_routes[] = {
{
.input = INPUT_CVBS_VI2B,
.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
Expand All @@ -228,13 +229,13 @@ static struct vpfe_route tvp5146_routes[] = {
},
};

static struct vpfe_subdev_info vpfe_sub_devs[] = {
static struct vpfe_subdev_info dm644xevm_vpfe_sub_devs[] = {
{
.name = "tvp5146",
.grp_id = 0,
.num_inputs = ARRAY_SIZE(tvp5146_inputs),
.inputs = tvp5146_inputs,
.routes = tvp5146_routes,
.num_inputs = ARRAY_SIZE(dm644xevm_tvp5146_inputs),
.inputs = dm644xevm_tvp5146_inputs,
.routes = dm644xevm_tvp5146_routes,
.can_route = 1,
.ccdc_if_params = {
.if_type = VPFE_BT656,
Expand All @@ -243,15 +244,15 @@ static struct vpfe_subdev_info vpfe_sub_devs[] = {
},
.board_info = {
I2C_BOARD_INFO("tvp5146", 0x5d),
.platform_data = &tvp5146_pdata,
.platform_data = &dm644xevm_tvp5146_pdata,
},
},
};

static struct vpfe_config vpfe_cfg = {
.num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
static struct vpfe_config dm644xevm_capture_cfg = {
.num_subdevs = ARRAY_SIZE(dm644xevm_vpfe_sub_devs),
.i2c_adapter_id = 1,
.sub_devs = vpfe_sub_devs,
.sub_devs = dm644xevm_vpfe_sub_devs,
.card_name = "DM6446 EVM",
.ccdc = "DM6446 CCDC",
};
Expand Down Expand Up @@ -624,8 +625,6 @@ static struct davinci_uart_config uart_config __initdata = {
static void __init
davinci_evm_map_io(void)
{
/* setup input configuration for VPFE input devices */
dm644x_set_vpfe_config(&vpfe_cfg);
dm644x_init();
}

Expand Down Expand Up @@ -697,6 +696,7 @@ static __init void davinci_evm_init(void)
evm_init_i2c();

davinci_setup_mmc(0, &dm6446evm_mmc_config);
dm644x_init_video(&dm644xevm_capture_cfg);

davinci_serial_init(&uart_config);
dm644x_init_asp(&dm644x_evm_snd_data);
Expand Down
32 changes: 11 additions & 21 deletions arch/arm/mach-davinci/board-dm646x-evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>

#include <mach/dm646x.h>
#include <mach/common.h>
#include <mach/serial.h>
#include <mach/i2c.h>
Expand All @@ -45,6 +44,7 @@
#include <mach/cdce949.h>
#include <mach/aemif.h>

#include "davinci.h"
#include "clock.h"

#define NAND_BLOCK_SIZE SZ_128K
Expand Down Expand Up @@ -410,8 +410,6 @@ static struct davinci_i2c_platform_data i2c_pdata = {
.bus_delay = 0 /* usec */,
};

#define VIDCLKCTL_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x38)
#define VSCLKDIS_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x6c)
#define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8))
#define VCH2CLK_SYSCLK8 (BIT(9))
#define VCH2CLK_AUXCLK (BIT(9) | BIT(8))
Expand All @@ -429,8 +427,6 @@ static struct davinci_i2c_platform_data i2c_pdata = {
#define TVP5147_CH0 "tvp514x-0"
#define TVP5147_CH1 "tvp514x-1"

static void __iomem *vpif_vidclkctl_reg;
static void __iomem *vpif_vsclkdis_reg;
/* spin lock for updating above registers */
static spinlock_t vpif_reg_lock;

Expand All @@ -441,14 +437,14 @@ static int set_vpif_clock(int mux_mode, int hd)
int val = 0;
int err = 0;

if (!vpif_vidclkctl_reg || !vpif_vsclkdis_reg || !cpld_client)
if (!cpld_client)
return -ENXIO;

/* disable the clock */
spin_lock_irqsave(&vpif_reg_lock, flags);
value = __raw_readl(vpif_vsclkdis_reg);
value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
value |= (VIDCH3CLK | VIDCH2CLK);
__raw_writel(value, vpif_vsclkdis_reg);
__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
spin_unlock_irqrestore(&vpif_reg_lock, flags);

val = i2c_smbus_read_byte(cpld_client);
Expand All @@ -464,7 +460,7 @@ static int set_vpif_clock(int mux_mode, int hd)
if (err)
return err;

value = __raw_readl(vpif_vidclkctl_reg);
value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
value &= ~(VCH2CLK_MASK);
value &= ~(VCH3CLK_MASK);

Expand All @@ -473,13 +469,13 @@ static int set_vpif_clock(int mux_mode, int hd)
else
value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK);

__raw_writel(value, vpif_vidclkctl_reg);
__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));

spin_lock_irqsave(&vpif_reg_lock, flags);
value = __raw_readl(vpif_vsclkdis_reg);
value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
/* enable the clock */
value &= ~(VIDCH3CLK | VIDCH2CLK);
__raw_writel(value, vpif_vsclkdis_reg);
__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
spin_unlock_irqrestore(&vpif_reg_lock, flags);

return 0;
Expand Down Expand Up @@ -564,23 +560,23 @@ static int setup_vpif_input_channel_mode(int mux_mode)
int val;
u32 value;

if (!vpif_vidclkctl_reg || !cpld_client)
if (!cpld_client)
return -ENXIO;

val = i2c_smbus_read_byte(cpld_client);
if (val < 0)
return val;

spin_lock_irqsave(&vpif_reg_lock, flags);
value = __raw_readl(vpif_vidclkctl_reg);
value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
if (mux_mode) {
val &= VPIF_INPUT_TWO_CHANNEL;
value |= VIDCH1CLK;
} else {
val |= VPIF_INPUT_ONE_CHANNEL;
value &= ~VIDCH1CLK;
}
__raw_writel(value, vpif_vidclkctl_reg);
__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL));
spin_unlock_irqrestore(&vpif_reg_lock, flags);

err = i2c_smbus_write_byte(cpld_client, val);
Expand Down Expand Up @@ -674,12 +670,6 @@ static struct vpif_capture_config dm646x_vpif_capture_cfg = {

static void __init evm_init_video(void)
{
vpif_vidclkctl_reg = ioremap(VIDCLKCTL_OFFSET, 4);
vpif_vsclkdis_reg = ioremap(VSCLKDIS_OFFSET, 4);
if (!vpif_vidclkctl_reg || !vpif_vsclkdis_reg) {
pr_err("Can't map VPIF VIDCLKCTL or VSCLKDIS registers\n");
return;
}
spin_lock_init(&vpif_reg_lock);

dm646x_setup_vpif(&dm646x_vpif_display_config,
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-davinci/board-neuros-osd2.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>

#include <mach/dm644x.h>
#include <mach/common.h>
#include <mach/i2c.h>
#include <mach/serial.h>
Expand All @@ -39,6 +38,8 @@
#include <mach/mmc.h>
#include <mach/usb.h>

#include "davinci.h"

#define NEUROS_OSD2_PHY_ID "davinci_mdio-0:01"
#define LXT971_PHY_ID 0x001378e2
#define LXT971_PHY_MASK 0xfffffff0
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-davinci/board-sffsdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>

#include <mach/dm644x.h>
#include <mach/common.h>
#include <mach/i2c.h>
#include <mach/serial.h>
#include <mach/mux.h>
#include <mach/usb.h>

#include "davinci.h"

#define SFFSDR_PHY_ID "davinci_mdio-0:01"
static struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
/* U-Boot Environment: Block 0
Expand Down
96 changes: 96 additions & 0 deletions arch/arm/mach-davinci/davinci.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* This file contains the processor specific definitions
* of the TI DM644x, DM355, DM365, and DM646x.
*
* Copyright (C) 2011 Texas Instruments Incorporated
* Copyright (c) 2007 Deep Root Systems, LLC
*
* 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 version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __DAVINCI_H
#define __DAVINCI_H

#include <linux/clk.h>
#include <linux/videodev2.h>
#include <linux/davinci_emac.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>

#include <mach/asp.h>
#include <mach/keyscan.h>
#include <mach/hardware.h>

#include <media/davinci/vpfe_capture.h>
#include <media/davinci/vpif_types.h>

#define DAVINCI_SYSTEM_MODULE_BASE 0x01c40000
#define SYSMOD_VIDCLKCTL 0x38
#define SYSMOD_VDD3P3VPWDN 0x48
#define SYSMOD_VSCLKDIS 0x6c
#define SYSMOD_PUPDCTL1 0x7c

extern void __iomem *davinci_sysmod_base;
#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x))
void davinci_map_sysmod(void);

/* DM355 base addresses */
#define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000
#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000

#define ASP1_TX_EVT_EN 1
#define ASP1_RX_EVT_EN 2

/* DM365 base addresses */
#define DM365_ASYNC_EMIF_CONTROL_BASE 0x01d10000
#define DM365_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
#define DM365_ASYNC_EMIF_DATA_CE1_BASE 0x04000000

/* DM644x base addresses */
#define DM644X_ASYNC_EMIF_CONTROL_BASE 0x01e00000
#define DM644X_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
#define DM644X_ASYNC_EMIF_DATA_CE1_BASE 0x04000000
#define DM644X_ASYNC_EMIF_DATA_CE2_BASE 0x06000000
#define DM644X_ASYNC_EMIF_DATA_CE3_BASE 0x08000000

/* DM646x base addresses */
#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000
#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000

/* DM355 function declarations */
void __init dm355_init(void);
void dm355_init_spi0(unsigned chipselect_mask,
struct spi_board_info *info, unsigned len);
void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
void dm355_set_vpfe_config(struct vpfe_config *cfg);

/* DM365 function declarations */
void __init dm365_init(void);
void __init dm365_init_asp(struct snd_platform_data *pdata);
void __init dm365_init_vc(struct snd_platform_data *pdata);
void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
void __init dm365_init_rtc(void);
void dm365_init_spi0(unsigned chipselect_mask,
struct spi_board_info *info, unsigned len);
void dm365_set_vpfe_config(struct vpfe_config *cfg);

/* DM644x function declarations */
void __init dm644x_init(void);
void __init dm644x_init_asp(struct snd_platform_data *pdata);
int __init dm644x_init_video(struct vpfe_config *);

/* DM646x function declarations */
void __init dm646x_init(void);
void __init dm646x_init_mcasp0(struct snd_platform_data *pdata);
void __init dm646x_init_mcasp1(struct snd_platform_data *pdata);
int __init dm646x_init_edma(struct edma_rsv_info *rsv);
void dm646x_video_init(void);
void dm646x_setup_vpif(struct vpif_display_config *,
struct vpif_capture_config *);
#endif /*__DAVINCI_H */
Loading

0 comments on commit a3a3c46

Please sign in to comment.