2009-08-19 12:08:33 +00:00
/*
* Copyright ( C ) 2009 Renesas Solutions Corp .
*
* Kuninori Morimoto < morimoto . kuninori @ renesas . com >
*
* This file is subject to the terms and conditions of the GNU General Public
* License . See the file " COPYING " in the main directory of this archive
* for more details .
*/
2018-03-12 09:43:04 -04:00
# include <asm/clock.h>
# include <asm/heartbeat.h>
# include <asm/suspend.h>
# include <cpu/sh7724.h>
# include <linux/delay.h>
2009-08-19 12:08:33 +00:00
# include <linux/device.h>
2018-03-12 09:43:04 -04:00
# include <linux/i2c.h>
# include <linux/io.h>
# include <linux/init.h>
# include <linux/input.h>
# include <linux/input/sh_keysc.h>
# include <linux/interrupt.h>
# include <linux/memblock.h>
# include <linux/mfd/tmio.h>
2010-04-27 10:15:32 +00:00
# include <linux/mmc/host.h>
# include <linux/mmc/sh_mmcif.h>
2009-08-19 12:08:33 +00:00
# include <linux/mtd/physmap.h>
# include <linux/gpio.h>
2018-03-12 09:43:04 -04:00
# include <linux/gpio/machine.h>
# include <linux/platform_data/gpio_backlight.h>
# include <linux/platform_data/tsc2007.h>
# include <linux/platform_device.h>
2012-06-28 12:29:46 +02:00
# include <linux/regulator/fixed.h>
# include <linux/regulator/machine.h>
2011-09-28 16:49:14 +09:00
# include <linux/sh_eth.h>
2012-05-18 15:49:38 +09:00
# include <linux/sh_intc.h>
2018-03-12 09:43:04 -04:00
# include <linux/spi/mmc_spi.h>
# include <linux/spi/sh_msiof.h>
# include <linux/spi/spi.h>
# include <linux/usb/r8a66597.h>
# include <linux/usb/renesas_usbhs.h>
2012-01-25 22:07:05 +01:00
# include <linux/videodev2.h>
2018-03-12 09:43:04 -04:00
# include <media/drv-intf/renesas-ceu.h>
# include <media/i2c/mt9t112.h>
# include <media/i2c/tw9910.h>
2009-12-15 05:37:39 +00:00
# include <sound/sh_fsi.h>
2012-04-08 21:19:25 -07:00
# include <sound/simple_card.h>
2018-03-12 09:43:04 -04:00
# include <video/sh_mobile_lcdc.h>
2009-08-19 12:08:33 +00:00
/*
2009-08-26 11:04:22 +00:00
* Address Interface BusWidth
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* 0x0000 _0000 uboot 16 bit
* 0x0004 _0000 Linux romImage 16 bit
* 0x0014 _0000 MTD for Linux 16 bit
* 0x0400 _0000 Internal I / O 16 / 32 bit
* 0x0800 _0000 DRAM 32 bit
* 0x1800 _0000 MFI 16 bit
2009-08-19 12:08:33 +00:00
*/
2009-10-02 07:52:20 +00:00
/* SWITCH
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* DS2 [ 1 ] = FlashROM write protect ON : write protect
* OFF : No write protect
* DS2 [ 2 ] = RMII / TS , SCIF ON : RMII
* OFF : TS , SCIF3
* DS2 [ 3 ] = Camera / Video ON : Camera
* OFF : NTSC / PAL ( IN )
* DS2 [ 5 ] = NTSC_OUT Clock ON : On board OSC
* OFF : SH7724 DV_CLK
* DS2 [ 6 - 7 ] = MMC / SD ON - OFF : SD
* OFF - ON : MMC
*/
2012-12-24 20:04:20 -08:00
/*
* FSI - DA7210
*
* it needs amixer settings for playing
*
* amixer set ' HeadPhone ' 80
* amixer set ' Out Mixer Left DAC Left ' on
* amixer set ' Out Mixer Right DAC Right ' on
*/
2018-03-12 09:43:04 -04:00
# define CEU_BUFFER_MEMORY_SIZE (4 << 20)
static phys_addr_t ceu0_dma_membase ;
static phys_addr_t ceu1_dma_membase ;
2009-08-19 12:08:33 +00:00
/* Heartbeat */
static unsigned char led_pos [ ] = { 0 , 1 , 2 , 3 } ;
2010-01-15 12:24:34 +09:00
2009-08-19 12:08:33 +00:00
static struct heartbeat_data heartbeat_data = {
. nr_bits = 4 ,
. bit_pos = led_pos ,
} ;
2010-01-15 12:24:34 +09:00
static struct resource heartbeat_resource = {
. start = 0xA405012C , /* PTG */
. end = 0xA405012E - 1 ,
. flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT ,
2009-08-19 12:08:33 +00:00
} ;
static struct platform_device heartbeat_device = {
. name = " heartbeat " ,
. id = - 1 ,
. dev = {
. platform_data = & heartbeat_data ,
} ,
2010-01-15 12:24:34 +09:00
. num_resources = 1 ,
. resource = & heartbeat_resource ,
2009-08-19 12:08:33 +00:00
} ;
/* MTD */
static struct mtd_partition nor_flash_partitions [ ] = {
{
2009-08-26 11:04:22 +00:00
. name = " boot loader " ,
2009-08-19 12:08:33 +00:00
. offset = 0 ,
2009-08-26 11:04:22 +00:00
. size = ( 5 * 1024 * 1024 ) ,
2009-09-30 00:50:30 +00:00
. mask_flags = MTD_WRITEABLE , /* force read-only */
2009-08-19 12:08:33 +00:00
} , {
. name = " free-area " ,
. offset = MTDPART_OFS_APPEND ,
. size = MTDPART_SIZ_FULL ,
} ,
} ;
static struct physmap_flash_data nor_flash_data = {
. width = 2 ,
. parts = nor_flash_partitions ,
. nr_parts = ARRAY_SIZE ( nor_flash_partitions ) ,
} ;
static struct resource nor_flash_resources [ ] = {
[ 0 ] = {
. name = " NOR Flash " ,
. start = 0x00000000 ,
. end = 0x03ffffff ,
. flags = IORESOURCE_MEM ,
}
} ;
static struct platform_device nor_flash_device = {
. name = " physmap-flash " ,
. resource = nor_flash_resources ,
. num_resources = ARRAY_SIZE ( nor_flash_resources ) ,
. dev = {
. platform_data = & nor_flash_data ,
} ,
} ;
2009-08-26 11:04:26 +00:00
/* SH Eth */
# define SH_ETH_ADDR (0xA4600000)
static struct resource sh_eth_resources [ ] = {
[ 0 ] = {
. start = SH_ETH_ADDR ,
. end = SH_ETH_ADDR + 0x1FC ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xd60 ) ,
2009-08-26 11:04:26 +00:00
. flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL ,
} ,
} ;
2010-06-02 00:27:31 +00:00
static struct sh_eth_plat_data sh_eth_plat = {
2009-08-26 11:04:26 +00:00
. phy = 0x1f , /* SMSC LAN8700 */
2011-03-08 08:00:04 +00:00
. phy_interface = PHY_INTERFACE_MODE_MII ,
2009-09-24 06:28:27 +00:00
. ether_link_active_low = 1
2009-08-26 11:04:26 +00:00
} ;
static struct platform_device sh_eth_device = {
2013-06-07 14:03:37 +00:00
. name = " sh7724-ether " ,
. id = 0 ,
2009-08-26 11:04:26 +00:00
. dev = {
. platform_data = & sh_eth_plat ,
} ,
. num_resources = ARRAY_SIZE ( sh_eth_resources ) ,
. resource = sh_eth_resources ,
} ;
2009-08-26 11:04:31 +00:00
/* USB0 host */
2010-06-02 00:27:31 +00:00
static void usb0_port_power ( int port , int power )
2009-08-26 11:04:31 +00:00
{
gpio_set_value ( GPIO_PTB4 , power ) ;
}
static struct r8a66597_platdata usb0_host_data = {
. on_chip = 1 ,
. port_power = usb0_port_power ,
} ;
static struct resource usb0_host_resources [ ] = {
[ 0 ] = {
. start = 0xa4d80000 ,
. end = 0xa4d80124 - 1 ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xa20 ) ,
. end = evt2irq ( 0xa20 ) ,
2009-08-26 11:04:31 +00:00
. flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW ,
} ,
} ;
static struct platform_device usb0_host_device = {
. name = " r8a66597_hcd " ,
. id = 0 ,
. dev = {
. dma_mask = NULL , /* not use dma */
. coherent_dma_mask = 0xffffffff ,
. platform_data = & usb0_host_data ,
} ,
. num_resources = ARRAY_SIZE ( usb0_host_resources ) ,
. resource = usb0_host_resources ,
} ;
2009-10-28 06:31:57 +00:00
/* USB1 host/function */
2010-06-02 00:27:31 +00:00
static void usb1_port_power ( int port , int power )
2009-08-26 11:04:31 +00:00
{
gpio_set_value ( GPIO_PTB5 , power ) ;
}
2009-10-28 06:31:57 +00:00
static struct r8a66597_platdata usb1_common_data = {
2009-08-26 11:04:31 +00:00
. on_chip = 1 ,
. port_power = usb1_port_power ,
} ;
2009-10-28 06:31:57 +00:00
static struct resource usb1_common_resources [ ] = {
2009-08-26 11:04:31 +00:00
[ 0 ] = {
. start = 0xa4d90000 ,
. end = 0xa4d90124 - 1 ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xa40 ) ,
. end = evt2irq ( 0xa40 ) ,
2009-08-26 11:04:31 +00:00
. flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW ,
} ,
} ;
2009-10-28 06:31:57 +00:00
static struct platform_device usb1_common_device = {
/* .name will be added in arch_setup */
2009-08-26 11:04:31 +00:00
. id = 1 ,
. dev = {
. dma_mask = NULL , /* not use dma */
. coherent_dma_mask = 0xffffffff ,
2009-10-28 06:31:57 +00:00
. platform_data = & usb1_common_data ,
2009-08-26 11:04:31 +00:00
} ,
2009-10-28 06:31:57 +00:00
. num_resources = ARRAY_SIZE ( usb1_common_resources ) ,
. resource = usb1_common_resources ,
2009-08-26 11:04:31 +00:00
} ;
2011-06-15 06:08:18 +00:00
/*
* USBHS
*/
static int usbhs_get_id ( struct platform_device * pdev )
{
return gpio_get_value ( GPIO_PTB3 ) ;
}
2013-03-31 18:34:43 -07:00
static int usbhs_phy_reset ( struct platform_device * pdev )
2012-08-01 00:54:58 -07:00
{
/* enable vbus if HOST */
if ( ! gpio_get_value ( GPIO_PTB3 ) )
gpio_set_value ( GPIO_PTB5 , 1 ) ;
2013-03-31 18:34:43 -07:00
return 0 ;
2012-08-01 00:54:58 -07:00
}
2011-06-15 06:08:18 +00:00
static struct renesas_usbhs_platform_info usbhs_info = {
. platform_callback = {
. get_id = usbhs_get_id ,
2012-08-01 00:54:58 -07:00
. phy_reset = usbhs_phy_reset ,
2011-06-15 06:08:18 +00:00
} ,
. driver_param = {
. buswait_bwait = 4 ,
. detection_delay = 5 ,
2011-06-15 06:08:32 +00:00
. d0_tx_id = SHDMA_SLAVE_USB1D0_TX ,
. d0_rx_id = SHDMA_SLAVE_USB1D0_RX ,
. d1_tx_id = SHDMA_SLAVE_USB1D1_TX ,
. d1_rx_id = SHDMA_SLAVE_USB1D1_RX ,
2011-06-15 06:08:18 +00:00
} ,
} ;
static struct resource usbhs_resources [ ] = {
[ 0 ] = {
. start = 0xa4d90000 ,
. end = 0xa4d90124 - 1 ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xa40 ) ,
. end = evt2irq ( 0xa40 ) ,
2011-06-15 06:08:18 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device usbhs_device = {
. name = " renesas_usbhs " ,
. id = 1 ,
. dev = {
. dma_mask = NULL , /* not use dma */
. coherent_dma_mask = 0xffffffff ,
. platform_data = & usbhs_info ,
} ,
. num_resources = ARRAY_SIZE ( usbhs_resources ) ,
. resource = usbhs_resources ,
} ;
2013-07-04 21:13:28 +02:00
/* LCDC and backlight */
2011-07-09 23:16:22 +02:00
static const struct fb_videomode ecovec_lcd_modes [ ] = {
2010-09-03 07:20:04 +00:00
{
. name = " Panel " ,
. xres = 800 ,
. yres = 480 ,
. left_margin = 220 ,
. right_margin = 110 ,
. hsync_len = 70 ,
. upper_margin = 20 ,
. lower_margin = 5 ,
. vsync_len = 5 ,
. sync = 0 , /* hsync and vsync are active low */
} ,
} ;
2011-07-09 23:16:22 +02:00
static const struct fb_videomode ecovec_dvi_modes [ ] = {
2010-09-03 07:20:04 +00:00
{
. name = " DVI " ,
. xres = 1280 ,
. yres = 720 ,
. left_margin = 220 ,
. right_margin = 110 ,
. hsync_len = 40 ,
. upper_margin = 20 ,
. lower_margin = 5 ,
. vsync_len = 5 ,
. sync = 0 , /* hsync and vsync are active low */
} ,
} ;
2009-08-26 11:04:34 +00:00
static struct sh_mobile_lcdc_info lcdc_info = {
. ch [ 0 ] = {
. interface_type = RGB18 ,
. chan = LCDC_CHAN_MAINLCD ,
2011-12-13 14:02:28 +01:00
. fourcc = V4L2_PIX_FMT_RGB565 ,
2011-09-11 22:59:04 +02:00
. panel_cfg = { /* 7.0 inch */
2009-08-26 11:04:34 +00:00
. width = 152 ,
. height = 91 ,
} ,
}
} ;
static struct resource lcdc_resources [ ] = {
[ 0 ] = {
. name = " LCDC " ,
. start = 0xfe940000 ,
2009-09-15 12:00:30 +00:00
. end = 0xfe942fff ,
2009-08-26 11:04:34 +00:00
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xf40 ) ,
2009-08-26 11:04:34 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device lcdc_device = {
. name = " sh_mobile_lcdc_fb " ,
. num_resources = ARRAY_SIZE ( lcdc_resources ) ,
. resource = lcdc_resources ,
. dev = {
. platform_data = & lcdc_info ,
} ,
} ;
2013-07-04 21:13:28 +02:00
static struct gpio_backlight_platform_data gpio_backlight_data = {
. fbdev = & lcdc_device . dev ,
. gpio = GPIO_PTR1 ,
. def_value = 1 ,
. name = " backlight " ,
} ;
static struct platform_device gpio_backlight_device = {
. name = " gpio-backlight " ,
. dev = {
. platform_data = & gpio_backlight_data ,
} ,
} ;
2009-08-26 11:04:36 +00:00
/* CEU0 */
2018-03-12 09:43:04 -04:00
static struct ceu_platform_data ceu0_pdata = {
. num_subdevs = 2 ,
. subdevs = {
{ /* [0] = mt9t112 */
. flags = 0 ,
. bus_width = 8 ,
. bus_shift = 0 ,
. i2c_adapter_id = 0 ,
. i2c_address = 0x3c ,
} ,
{ /* [1] = tw9910 */
. flags = 0 ,
. bus_width = 8 ,
. bus_shift = 0 ,
. i2c_adapter_id = 0 ,
. i2c_address = 0x45 ,
} ,
} ,
2009-08-26 11:04:36 +00:00
} ;
static struct resource ceu0_resources [ ] = {
[ 0 ] = {
. name = " CEU0 " ,
. start = 0xfe910000 ,
. end = 0xfe91009f ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0x880 ) ,
2009-08-26 11:04:36 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device ceu0_device = {
2018-03-12 09:43:04 -04:00
. name = " renesas-ceu " ,
. id = 0 , /* ceu.0 */
2009-08-26 11:04:36 +00:00
. num_resources = ARRAY_SIZE ( ceu0_resources ) ,
. resource = ceu0_resources ,
. dev = {
2018-03-12 09:43:04 -04:00
. platform_data = & ceu0_pdata ,
2009-08-26 11:04:36 +00:00
} ,
} ;
/* CEU1 */
2018-03-12 09:43:04 -04:00
static struct ceu_platform_data ceu1_pdata = {
. num_subdevs = 1 ,
. subdevs = {
{ /* [0] = mt9t112 */
. flags = 0 ,
. bus_width = 8 ,
. bus_shift = 0 ,
. i2c_adapter_id = 1 ,
. i2c_address = 0x3c ,
} ,
} ,
2009-08-26 11:04:36 +00:00
} ;
static struct resource ceu1_resources [ ] = {
[ 0 ] = {
. name = " CEU1 " ,
. start = 0xfe914000 ,
. end = 0xfe91409f ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0x9e0 ) ,
2009-08-26 11:04:36 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device ceu1_device = {
2018-03-12 09:43:04 -04:00
. name = " renesas-ceu " ,
. id = 1 , /* ceu.1 */
2009-08-26 11:04:36 +00:00
. num_resources = ARRAY_SIZE ( ceu1_resources ) ,
. resource = ceu1_resources ,
. dev = {
2018-03-12 09:43:04 -04:00
. platform_data = & ceu1_pdata ,
} ,
} ;
/* Power up/down GPIOs for camera devices and video decoder */
static struct gpiod_lookup_table tw9910_gpios = {
. dev_id = " 0-0045 " ,
. table = {
GPIO_LOOKUP ( " sh7724_pfc " , GPIO_PTU2 , " pdn " , GPIO_ACTIVE_HIGH ) ,
} ,
} ;
static struct gpiod_lookup_table mt9t112_0_gpios = {
. dev_id = " 0-003c " ,
. table = {
GPIO_LOOKUP ( " sh7724_pfc " , GPIO_PTA3 , " standby " ,
GPIO_ACTIVE_HIGH ) ,
} ,
} ;
static struct gpiod_lookup_table mt9t112_1_gpios = {
. dev_id = " 1-003c " ,
. table = {
GPIO_LOOKUP ( " sh7724_pfc " , GPIO_PTA4 , " standby " ,
GPIO_ACTIVE_HIGH ) ,
2009-08-26 11:04:36 +00:00
} ,
} ;
2009-09-10 01:39:37 +00:00
/* I2C device */
2018-03-12 09:43:04 -04:00
static struct tw9910_video_info tw9910_info = {
. buswidth = 8 ,
. mpout = TW9910_MPO_FIELD ,
} ;
static struct mt9t112_platform_data mt9t112_0_pdata = {
. flags = MT9T112_FLAG_PCLK_RISING_EDGE ,
. divider = { 0x49 , 0x6 , 0 , 6 , 0 , 9 , 9 , 6 , 0 } , /* for 24MHz */
} ;
static struct mt9t112_platform_data mt9t112_1_pdata = {
. flags = MT9T112_FLAG_PCLK_RISING_EDGE ,
. divider = { 0x49 , 0x6 , 0 , 6 , 0 , 9 , 9 , 6 , 0 } , /* for 24MHz */
} ;
2009-12-15 05:37:39 +00:00
static struct i2c_board_info i2c0_devices [ ] = {
{
I2C_BOARD_INFO ( " da7210 " , 0x1a ) ,
} ,
2018-03-12 09:43:04 -04:00
{
I2C_BOARD_INFO ( " tw9910 " , 0x45 ) ,
. platform_data = & tw9910_info ,
} ,
{
/* 1st camera */
I2C_BOARD_INFO ( " mt9t112 " , 0x3c ) ,
. platform_data = & mt9t112_0_pdata ,
} ,
2009-12-15 05:37:39 +00:00
} ;
2009-09-10 01:39:37 +00:00
static struct i2c_board_info i2c1_devices [ ] = {
{
I2C_BOARD_INFO ( " r2025sd " , 0x32 ) ,
} ,
2010-01-15 08:25:00 +09:00
{
I2C_BOARD_INFO ( " lis3lv02d " , 0x1c ) ,
2012-05-18 15:49:38 +09:00
. irq = evt2irq ( 0x620 ) ,
2018-03-12 09:43:04 -04:00
} ,
{
/* 2nd camera */
I2C_BOARD_INFO ( " mt9t112 " , 0x3c ) ,
. platform_data = & mt9t112_1_pdata ,
} ,
2009-09-10 01:39:37 +00:00
} ;
2009-09-14 11:23:00 +00:00
/* KEYSC */
static struct sh_keysc_info keysc_info = {
. mode = SH_KEYSC_MODE_1 ,
. scan_timing = 3 ,
. delay = 50 ,
. kycr2_delay = 100 ,
. keycodes = { KEY_1 , 0 , 0 , 0 , 0 ,
KEY_2 , 0 , 0 , 0 , 0 ,
KEY_3 , 0 , 0 , 0 , 0 ,
KEY_4 , 0 , 0 , 0 , 0 ,
KEY_5 , 0 , 0 , 0 , 0 ,
KEY_6 , 0 , 0 , 0 , 0 , } ,
} ;
static struct resource keysc_resources [ ] = {
[ 0 ] = {
. name = " KEYSC " ,
. start = 0x044b0000 ,
. end = 0x044b000f ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xbe0 ) ,
2009-09-14 11:23:00 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device keysc_device = {
. name = " sh_keysc " ,
. id = 0 , /* keysc0 clock */
. num_resources = ARRAY_SIZE ( keysc_resources ) ,
. resource = keysc_resources ,
. dev = {
. platform_data = & keysc_info ,
} ,
} ;
2009-09-28 08:21:41 +00:00
/* TouchScreen */
2012-05-18 15:49:38 +09:00
# define IRQ0 evt2irq(0x600)
2013-11-19 11:56:04 -08:00
static int ts_get_pendown_state ( struct device * dev )
2010-09-14 18:26:38 +09:00
{
int val = 0 ;
gpio_free ( GPIO_FN_INTC_IRQ0 ) ;
gpio_request ( GPIO_PTZ0 , NULL ) ;
gpio_direction_input ( GPIO_PTZ0 ) ;
val = gpio_get_value ( GPIO_PTZ0 ) ;
gpio_free ( GPIO_PTZ0 ) ;
gpio_request ( GPIO_FN_INTC_IRQ0 , NULL ) ;
return val ? 0 : 1 ;
}
static int ts_init ( void )
{
gpio_request ( GPIO_FN_INTC_IRQ0 , NULL ) ;
return 0 ;
}
2010-06-02 00:27:31 +00:00
static struct tsc2007_platform_data tsc2007_info = {
2009-09-28 08:21:41 +00:00
. model = 2007 ,
2010-09-14 18:26:38 +09:00
. x_plate_ohms = 180 ,
. get_pendown_state = ts_get_pendown_state ,
. init_platform_hw = ts_init ,
2009-09-28 08:21:41 +00:00
} ;
static struct i2c_board_info ts_i2c_clients = {
I2C_BOARD_INFO ( " tsc2007 " , 0x48 ) ,
. type = " tsc2007 " ,
. platform_data = & tsc2007_info ,
. irq = IRQ0 ,
} ;
2012-06-28 12:29:46 +02:00
static struct regulator_consumer_supply cn12_power_consumers [ ] =
{
REGULATOR_SUPPLY ( " vmmc " , " sh_mmcif.0 " ) ,
REGULATOR_SUPPLY ( " vqmmc " , " sh_mmcif.0 " ) ,
REGULATOR_SUPPLY ( " vmmc " , " sh_mobile_sdhi.1 " ) ,
REGULATOR_SUPPLY ( " vqmmc " , " sh_mobile_sdhi.1 " ) ,
} ;
static struct regulator_init_data cn12_power_init_data = {
. constraints = {
. valid_ops_mask = REGULATOR_CHANGE_STATUS ,
} ,
. num_consumer_supplies = ARRAY_SIZE ( cn12_power_consumers ) ,
. consumer_supplies = cn12_power_consumers ,
} ;
static struct fixed_voltage_config cn12_power_info = {
. supply_name = " CN12 SD/MMC Vdd " ,
. microvolts = 3300000 ,
. enable_high = 1 ,
. init_data = & cn12_power_init_data ,
} ;
static struct platform_device cn12_power = {
. name = " reg-fixed-voltage " ,
. id = 0 ,
. dev = {
. platform_data = & cn12_power_info ,
} ,
} ;
2018-09-06 14:24:36 +02:00
static struct gpiod_lookup_table cn12_power_gpiod_table = {
. dev_id = " reg-fixed-voltage.0 " ,
. table = {
/* Offset 7 on port B */
GPIO_LOOKUP ( " sh7724_pfc " , GPIO_PTB7 ,
NULL , GPIO_ACTIVE_HIGH ) ,
{ } ,
} ,
} ;
2011-04-15 20:03:17 +02:00
# if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
2010-04-27 10:15:32 +00:00
/* SDHI0 */
2012-06-28 12:29:46 +02:00
static struct regulator_consumer_supply sdhi0_power_consumers [ ] =
{
REGULATOR_SUPPLY ( " vmmc " , " sh_mobile_sdhi.0 " ) ,
REGULATOR_SUPPLY ( " vqmmc " , " sh_mobile_sdhi.0 " ) ,
} ;
static struct regulator_init_data sdhi0_power_init_data = {
. constraints = {
. valid_ops_mask = REGULATOR_CHANGE_STATUS ,
} ,
. num_consumer_supplies = ARRAY_SIZE ( sdhi0_power_consumers ) ,
. consumer_supplies = sdhi0_power_consumers ,
} ;
static struct fixed_voltage_config sdhi0_power_info = {
. supply_name = " CN11 SD/MMC Vdd " ,
. microvolts = 3300000 ,
. enable_high = 1 ,
. init_data = & sdhi0_power_init_data ,
} ;
static struct platform_device sdhi0_power = {
. name = " reg-fixed-voltage " ,
. id = 1 ,
. dev = {
. platform_data = & sdhi0_power_info ,
} ,
} ;
2018-09-06 14:24:36 +02:00
static struct gpiod_lookup_table sdhi0_power_gpiod_table = {
. dev_id = " reg-fixed-voltage.1 " ,
. table = {
/* Offset 6 on port B */
GPIO_LOOKUP ( " sh7724_pfc " , GPIO_PTB6 ,
NULL , GPIO_ACTIVE_HIGH ) ,
{ } ,
} ,
} ;
2015-02-24 02:07:07 +00:00
static struct tmio_mmc_data sdhi0_info = {
. chan_priv_tx = ( void * ) SHDMA_SLAVE_SDHI0_TX ,
. chan_priv_rx = ( void * ) SHDMA_SLAVE_SDHI0_RX ,
. capabilities = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
2012-01-28 19:36:24 +01:00
MMC_CAP_NEEDS_POLL ,
2015-02-24 02:07:07 +00:00
. flags = TMIO_MMC_USE_GPIO_CD ,
2013-08-08 12:38:34 +02:00
. cd_gpio = GPIO_PTY7 ,
2009-11-27 04:36:58 +00:00
} ;
2009-10-02 07:54:42 +00:00
static struct resource sdhi0_resources [ ] = {
[ 0 ] = {
. name = " SDHI0 " ,
. start = 0x04ce0000 ,
2011-03-09 13:42:42 +01:00
. end = 0x04ce00ff ,
2009-10-02 07:54:42 +00:00
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xe80 ) ,
2009-10-02 07:54:42 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device sdhi0_device = {
. name = " sh_mobile_sdhi " ,
. num_resources = ARRAY_SIZE ( sdhi0_resources ) ,
. resource = sdhi0_resources ,
. id = 0 ,
2009-11-27 04:36:58 +00:00
. dev = {
. platform_data = & sdhi0_info ,
} ,
2009-10-02 07:54:42 +00:00
} ;
2012-06-28 12:29:46 +02:00
# if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
/* SDHI1 */
2015-02-24 02:07:07 +00:00
static struct tmio_mmc_data sdhi1_info = {
. chan_priv_tx = ( void * ) SHDMA_SLAVE_SDHI1_TX ,
. chan_priv_rx = ( void * ) SHDMA_SLAVE_SDHI1_RX ,
. capabilities = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
2012-01-28 19:36:24 +01:00
MMC_CAP_NEEDS_POLL ,
2015-02-24 02:07:07 +00:00
. flags = TMIO_MMC_USE_GPIO_CD ,
2013-08-08 12:38:34 +02:00
. cd_gpio = GPIO_PTW7 ,
2009-11-27 04:36:58 +00:00
} ;
2009-10-02 07:54:42 +00:00
static struct resource sdhi1_resources [ ] = {
[ 0 ] = {
. name = " SDHI1 " ,
. start = 0x04cf0000 ,
2011-03-09 13:42:42 +01:00
. end = 0x04cf00ff ,
2009-10-02 07:54:42 +00:00
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0x4e0 ) ,
2009-10-02 07:54:42 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device sdhi1_device = {
. name = " sh_mobile_sdhi " ,
. num_resources = ARRAY_SIZE ( sdhi1_resources ) ,
. resource = sdhi1_resources ,
. id = 1 ,
2009-11-27 04:36:58 +00:00
. dev = {
. platform_data = & sdhi1_info ,
} ,
2009-10-02 07:54:42 +00:00
} ;
2010-04-27 10:15:32 +00:00
# endif /* CONFIG_MMC_SH_MMCIF */
2009-10-02 07:54:42 +00:00
2009-12-07 14:05:45 +00:00
# else
2009-12-24 05:27:47 +00:00
/* MMC SPI */
2009-12-07 14:05:45 +00:00
static void mmc_spi_setpower ( struct device * dev , unsigned int maskval )
{
gpio_set_value ( GPIO_PTB6 , maskval ? 1 : 0 ) ;
}
static struct mmc_spi_platform_data mmc_spi_info = {
. caps = MMC_CAP_NEEDS_POLL ,
2013-08-08 12:38:34 +02:00
. caps2 = MMC_CAP2_RO_ACTIVE_HIGH ,
2009-12-07 14:05:45 +00:00
. ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34 , /* 3.3V only */
. setpower = mmc_spi_setpower ,
2013-08-08 12:38:34 +02:00
. flags = MMC_SPI_USE_CD_GPIO | MMC_SPI_USE_RO_GPIO ,
. cd_gpio = GPIO_PTY7 ,
. ro_gpio = GPIO_PTY6 ,
2009-12-07 14:05:45 +00:00
} ;
static struct spi_board_info spi_bus [ ] = {
{
. modalias = " mmc_spi " ,
. platform_data = & mmc_spi_info ,
. max_speed_hz = 5000000 ,
. mode = SPI_MODE_0 ,
. controller_data = ( void * ) GPIO_PTM4 ,
} ,
} ;
2009-12-24 05:27:47 +00:00
/* MSIOF0 */
2009-12-07 14:05:45 +00:00
static struct sh_msiof_spi_info msiof0_data = {
. num_chipselect = 1 ,
} ;
static struct resource msiof0_resources [ ] = {
[ 0 ] = {
. name = " MSIOF0 " ,
. start = 0xa4c40000 ,
. end = 0xa4c40063 ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xc80 ) ,
2009-12-07 14:05:45 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device msiof0_device = {
. name = " spi_sh_msiof " ,
. id = 0 , /* MSIOF0 */
. dev = {
. platform_data = & msiof0_data ,
} ,
. num_resources = ARRAY_SIZE ( msiof0_resources ) ,
. resource = msiof0_resources ,
} ;
# endif
2009-12-15 05:37:39 +00:00
/* FSI */
static struct resource fsi_resources [ ] = {
[ 0 ] = {
. name = " FSI " ,
. start = 0xFE3C0000 ,
. end = 0xFE3C021d ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0xf80 ) ,
2009-12-15 05:37:39 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device fsi_device = {
. name = " sh_fsi " ,
. id = 0 ,
. num_resources = ARRAY_SIZE ( fsi_resources ) ,
. resource = fsi_resources ,
} ;
2012-04-08 21:19:25 -07:00
static struct asoc_simple_card_info fsi_da7210_info = {
. name = " DA7210 " ,
. card = " FSIB-DA7210 " ,
. codec = " da7210.0-001a " ,
. platform = " sh_fsi.0 " ,
2014-03-13 17:56:25 -07:00
. daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM ,
2013-01-10 16:49:11 -08:00
. cpu_dai = {
. name = " fsib-dai " ,
} ,
. codec_dai = {
. name = " da7210-hifi " ,
} ,
2012-04-08 21:19:25 -07:00
} ;
static struct platform_device fsi_da7210_device = {
. name = " asoc-simple-card " ,
. dev = {
. platform_data = & fsi_da7210_info ,
2014-06-22 17:55:18 -07:00
. coherent_dma_mask = DMA_BIT_MASK ( 32 ) ,
. dma_mask = & fsi_da7210_device . dev . coherent_dma_mask ,
2012-04-08 21:19:25 -07:00
} ,
} ;
2010-02-24 00:32:28 +00:00
/* IrDA */
static struct resource irda_resources [ ] = {
[ 0 ] = {
. name = " IrDA " ,
. start = 0xA45D0000 ,
. end = 0xA45D0049 ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0x480 ) ,
2010-02-24 00:32:28 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device irda_device = {
. name = " sh_sir " ,
. num_resources = ARRAY_SIZE ( irda_resources ) ,
. resource = irda_resources ,
} ;
2015-11-10 12:01:44 -02:00
# include <media/i2c/ak881x.h>
2015-11-13 19:40:07 -02:00
# include <media/drv-intf/sh_vou.h>
2010-04-21 08:45:25 +00:00
2010-06-02 00:27:31 +00:00
static struct ak881x_pdata ak881x_pdata = {
2010-04-21 08:45:25 +00:00
. flags = AK881X_IF_MODE_SLAVE ,
} ;
static struct i2c_board_info ak8813 = {
I2C_BOARD_INFO ( " ak8813 " , 0x20 ) ,
. platform_data = & ak881x_pdata ,
} ;
2010-06-02 00:27:31 +00:00
static struct sh_vou_pdata sh_vou_pdata = {
2010-04-21 08:45:25 +00:00
. bus_fmt = SH_VOU_BUS_8BIT ,
. flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW ,
. board_info = & ak8813 ,
. i2c_adap = 0 ,
} ;
static struct resource sh_vou_resources [ ] = {
[ 0 ] = {
. start = 0xfe960000 ,
. end = 0xfe962043 ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0x8e0 ) ,
2010-04-21 08:45:25 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
static struct platform_device vou_device = {
. name = " sh-vou " ,
. id = - 1 ,
. num_resources = ARRAY_SIZE ( sh_vou_resources ) ,
. resource = sh_vou_resources ,
. dev = {
. platform_data = & sh_vou_pdata ,
} ,
} ;
2011-04-15 20:03:17 +02:00
# if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
2010-04-27 10:15:32 +00:00
/* SH_MMCIF */
static struct resource sh_mmcif_resources [ ] = {
[ 0 ] = {
. name = " SH_MMCIF " ,
. start = 0xA4CA0000 ,
. end = 0xA4CA00FF ,
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = {
/* MMC2I */
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0x5a0 ) ,
2010-04-27 10:15:32 +00:00
. flags = IORESOURCE_IRQ ,
} ,
[ 2 ] = {
/* MMC3I */
2012-05-18 15:49:38 +09:00
. start = evt2irq ( 0x5c0 ) ,
2010-04-27 10:15:32 +00:00
. flags = IORESOURCE_IRQ ,
} ,
} ;
2010-06-02 00:27:31 +00:00
static struct sh_mmcif_plat_data sh_mmcif_plat = {
2010-04-27 10:15:32 +00:00
. sup_pclk = 0 , /* SH7724: Max Pclk/2 */
. caps = MMC_CAP_4_BIT_DATA |
MMC_CAP_8_BIT_DATA |
MMC_CAP_NEEDS_POLL ,
. ocr = MMC_VDD_32_33 | MMC_VDD_33_34 ,
} ;
static struct platform_device sh_mmcif_device = {
. name = " sh_mmcif " ,
. id = 0 ,
. dev = {
. platform_data = & sh_mmcif_plat ,
} ,
. num_resources = ARRAY_SIZE ( sh_mmcif_resources ) ,
. resource = sh_mmcif_resources ,
} ;
# endif
2018-03-12 09:43:04 -04:00
static struct platform_device * ecovec_ceu_devices [ ] __initdata = {
& ceu0_device ,
& ceu1_device ,
} ;
2009-08-19 12:08:33 +00:00
static struct platform_device * ecovec_devices [ ] __initdata = {
& heartbeat_device ,
& nor_flash_device ,
2009-08-26 11:04:26 +00:00
& sh_eth_device ,
2009-08-26 11:04:31 +00:00
& usb0_host_device ,
2009-10-28 06:31:57 +00:00
& usb1_common_device ,
2011-06-15 06:08:18 +00:00
& usbhs_device ,
2009-08-26 11:04:34 +00:00
& lcdc_device ,
2013-07-04 21:13:28 +02:00
& gpio_backlight_device ,
2009-09-14 11:23:00 +00:00
& keysc_device ,
2012-06-28 12:29:46 +02:00
& cn12_power ,
2011-04-15 20:03:17 +02:00
# if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
2012-06-28 12:29:46 +02:00
& sdhi0_power ,
2009-10-02 07:54:42 +00:00
& sdhi0_device ,
2011-04-15 20:03:17 +02:00
# if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
2009-10-02 07:54:42 +00:00
& sdhi1_device ,
2010-04-27 10:15:32 +00:00
# endif
2009-12-07 14:05:45 +00:00
# else
& msiof0_device ,
# endif
2009-12-15 05:37:39 +00:00
& fsi_device ,
2012-04-08 21:19:25 -07:00
& fsi_da7210_device ,
2010-02-24 00:32:28 +00:00
& irda_device ,
2010-04-21 08:45:25 +00:00
& vou_device ,
2011-04-15 20:03:17 +02:00
# if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
2010-04-27 10:15:32 +00:00
& sh_mmcif_device ,
# endif
2009-08-19 12:08:33 +00:00
} ;
2010-02-25 11:10:54 +00:00
# ifdef CONFIG_I2C
2009-09-10 01:39:58 +00:00
# define EEPROM_ADDR 0x50
static u8 mac_read ( struct i2c_adapter * a , u8 command )
{
struct i2c_msg msg [ 2 ] ;
u8 buf ;
int ret ;
msg [ 0 ] . addr = EEPROM_ADDR ;
msg [ 0 ] . flags = 0 ;
msg [ 0 ] . len = 1 ;
msg [ 0 ] . buf = & command ;
msg [ 1 ] . addr = EEPROM_ADDR ;
msg [ 1 ] . flags = I2C_M_RD ;
msg [ 1 ] . len = 1 ;
msg [ 1 ] . buf = & buf ;
ret = i2c_transfer ( a , msg , 2 ) ;
if ( ret < 0 ) {
printk ( KERN_ERR " error %d \n " , ret ) ;
buf = 0xff ;
}
return buf ;
}
2009-10-26 10:44:37 +00:00
static void __init sh_eth_init ( struct sh_eth_plat_data * pd )
2009-09-10 01:39:58 +00:00
{
struct i2c_adapter * a = i2c_get_adapter ( 1 ) ;
int i ;
if ( ! a ) {
pr_err ( " can not get I2C 1 \n " ) ;
return ;
}
2011-03-30 22:57:33 -03:00
/* read MAC address from EEPROM */
2009-10-26 10:44:37 +00:00
for ( i = 0 ; i < sizeof ( pd - > mac_addr ) ; i + + ) {
pd - > mac_addr [ i ] = mac_read ( a , 0x10 + i ) ;
2009-09-10 01:39:58 +00:00
msleep ( 10 ) ;
}
2010-03-16 02:01:33 +00:00
i2c_put_adapter ( a ) ;
2009-09-10 01:39:58 +00:00
}
2010-02-25 11:10:54 +00:00
# else
static void __init sh_eth_init ( struct sh_eth_plat_data * pd )
{
pr_err ( " unable to read sh_eth MAC address \n " ) ;
}
# endif
2009-09-10 01:39:58 +00:00
2009-08-26 11:04:34 +00:00
# define PORT_HIZA 0xA4050158
2009-08-26 11:04:39 +00:00
# define IODRIVEA 0xA405018A
2009-10-30 04:23:59 +00:00
extern char ecovec24_sdram_enter_start ;
extern char ecovec24_sdram_enter_end ;
extern char ecovec24_sdram_leave_start ;
extern char ecovec24_sdram_leave_end ;
2009-09-10 01:39:58 +00:00
static int __init arch_setup ( void )
2009-08-19 12:08:33 +00:00
{
2009-12-15 05:37:39 +00:00
struct clk * clk ;
2012-01-28 19:36:24 +01:00
bool cn12_enabled = false ;
2009-12-15 05:37:39 +00:00
2009-10-30 04:23:59 +00:00
/* register board specific self-refresh code */
2010-02-25 11:07:52 +00:00
sh_mobile_register_self_refresh ( SUSP_SH_STANDBY | SUSP_SH_SF |
SUSP_SH_RSTANDBY ,
2009-10-30 04:23:59 +00:00
& ecovec24_sdram_enter_start ,
& ecovec24_sdram_enter_end ,
& ecovec24_sdram_leave_start ,
& ecovec24_sdram_leave_end ) ;
2009-10-07 09:00:06 +00:00
/* enable STATUS0, STATUS2 and PDSTATUS */
gpio_request ( GPIO_FN_STATUS0 , NULL ) ;
gpio_request ( GPIO_FN_STATUS2 , NULL ) ;
gpio_request ( GPIO_FN_PDSTATUS , NULL ) ;
2009-08-19 12:08:33 +00:00
/* enable SCIFA0 */
gpio_request ( GPIO_FN_SCIF0_TXD , NULL ) ;
gpio_request ( GPIO_FN_SCIF0_RXD , NULL ) ;
/* enable debug LED */
gpio_request ( GPIO_PTG0 , NULL ) ;
gpio_request ( GPIO_PTG1 , NULL ) ;
gpio_request ( GPIO_PTG2 , NULL ) ;
gpio_request ( GPIO_PTG3 , NULL ) ;
2009-08-26 11:04:22 +00:00
gpio_direction_output ( GPIO_PTG0 , 0 ) ;
gpio_direction_output ( GPIO_PTG1 , 0 ) ;
gpio_direction_output ( GPIO_PTG2 , 0 ) ;
gpio_direction_output ( GPIO_PTG3 , 0 ) ;
2010-01-26 12:58:40 +09:00
__raw_writew ( ( __raw_readw ( PORT_HIZA ) & ~ ( 0x1 < < 1 ) ) , PORT_HIZA ) ;
2009-08-19 12:08:33 +00:00
2009-08-26 11:04:26 +00:00
/* enable SH-Eth */
gpio_request ( GPIO_PTA1 , NULL ) ;
gpio_direction_output ( GPIO_PTA1 , 1 ) ;
mdelay ( 20 ) ;
gpio_request ( GPIO_FN_RMII_RXD0 , NULL ) ;
gpio_request ( GPIO_FN_RMII_RXD1 , NULL ) ;
gpio_request ( GPIO_FN_RMII_TXD0 , NULL ) ;
gpio_request ( GPIO_FN_RMII_TXD1 , NULL ) ;
gpio_request ( GPIO_FN_RMII_REF_CLK , NULL ) ;
gpio_request ( GPIO_FN_RMII_TX_EN , NULL ) ;
gpio_request ( GPIO_FN_RMII_RX_ER , NULL ) ;
gpio_request ( GPIO_FN_RMII_CRS_DV , NULL ) ;
gpio_request ( GPIO_FN_MDIO , NULL ) ;
gpio_request ( GPIO_FN_MDC , NULL ) ;
gpio_request ( GPIO_FN_LNKSTA , NULL ) ;
2009-08-26 11:04:31 +00:00
/* enable USB */
2010-01-26 12:58:40 +09:00
__raw_writew ( 0x0000 , 0xA4D80000 ) ;
__raw_writew ( 0x0000 , 0xA4D90000 ) ;
2009-08-26 11:04:31 +00:00
gpio_request ( GPIO_PTB3 , NULL ) ;
gpio_request ( GPIO_PTB4 , NULL ) ;
gpio_request ( GPIO_PTB5 , NULL ) ;
gpio_direction_input ( GPIO_PTB3 ) ;
gpio_direction_output ( GPIO_PTB4 , 0 ) ;
gpio_direction_output ( GPIO_PTB5 , 0 ) ;
2010-01-26 12:58:40 +09:00
__raw_writew ( 0x0600 , 0xa40501d4 ) ;
__raw_writew ( 0x0600 , 0xa4050192 ) ;
2009-08-26 11:04:31 +00:00
2009-10-28 06:31:57 +00:00
if ( gpio_get_value ( GPIO_PTB3 ) ) {
printk ( KERN_INFO " USB1 function is selected \n " ) ;
usb1_common_device . name = " r8a66597_udc " ;
} else {
printk ( KERN_INFO " USB1 host is selected \n " ) ;
usb1_common_device . name = " r8a66597_hcd " ;
}
2009-08-26 11:04:34 +00:00
/* enable LCDC */
gpio_request ( GPIO_FN_LCDD23 , NULL ) ;
gpio_request ( GPIO_FN_LCDD22 , NULL ) ;
gpio_request ( GPIO_FN_LCDD21 , NULL ) ;
gpio_request ( GPIO_FN_LCDD20 , NULL ) ;
gpio_request ( GPIO_FN_LCDD19 , NULL ) ;
gpio_request ( GPIO_FN_LCDD18 , NULL ) ;
gpio_request ( GPIO_FN_LCDD17 , NULL ) ;
gpio_request ( GPIO_FN_LCDD16 , NULL ) ;
gpio_request ( GPIO_FN_LCDD15 , NULL ) ;
gpio_request ( GPIO_FN_LCDD14 , NULL ) ;
gpio_request ( GPIO_FN_LCDD13 , NULL ) ;
gpio_request ( GPIO_FN_LCDD12 , NULL ) ;
gpio_request ( GPIO_FN_LCDD11 , NULL ) ;
gpio_request ( GPIO_FN_LCDD10 , NULL ) ;
gpio_request ( GPIO_FN_LCDD9 , NULL ) ;
gpio_request ( GPIO_FN_LCDD8 , NULL ) ;
gpio_request ( GPIO_FN_LCDD7 , NULL ) ;
gpio_request ( GPIO_FN_LCDD6 , NULL ) ;
gpio_request ( GPIO_FN_LCDD5 , NULL ) ;
gpio_request ( GPIO_FN_LCDD4 , NULL ) ;
gpio_request ( GPIO_FN_LCDD3 , NULL ) ;
gpio_request ( GPIO_FN_LCDD2 , NULL ) ;
gpio_request ( GPIO_FN_LCDD1 , NULL ) ;
gpio_request ( GPIO_FN_LCDD0 , NULL ) ;
gpio_request ( GPIO_FN_LCDDISP , NULL ) ;
gpio_request ( GPIO_FN_LCDHSYN , NULL ) ;
gpio_request ( GPIO_FN_LCDDCK , NULL ) ;
gpio_request ( GPIO_FN_LCDVSYN , NULL ) ;
gpio_request ( GPIO_FN_LCDDON , NULL ) ;
gpio_request ( GPIO_FN_LCDLCLK , NULL ) ;
2010-01-26 12:58:40 +09:00
__raw_writew ( ( __raw_readw ( PORT_HIZA ) & ~ 0x0001 ) , PORT_HIZA ) ;
2009-08-26 11:04:34 +00:00
gpio_request ( GPIO_PTE6 , NULL ) ;
gpio_request ( GPIO_PTU1 , NULL ) ;
gpio_request ( GPIO_PTA2 , NULL ) ;
gpio_direction_input ( GPIO_PTE6 ) ;
gpio_direction_output ( GPIO_PTU1 , 0 ) ;
gpio_direction_output ( GPIO_PTA2 , 0 ) ;
2009-12-02 09:35:42 +00:00
/* I/O buffer drive ability is high */
2010-01-26 12:58:40 +09:00
__raw_writew ( ( __raw_readw ( IODRIVEA ) & ~ 0x00c0 ) | 0x0080 , IODRIVEA ) ;
2009-08-26 11:04:39 +00:00
2009-08-26 11:04:34 +00:00
if ( gpio_get_value ( GPIO_PTE6 ) ) {
/* DVI */
lcdc_info . clock_source = LCDC_CLK_EXTERNAL ;
2010-09-03 07:20:04 +00:00
lcdc_info . ch [ 0 ] . clock_divider = 1 ;
2011-11-29 14:33:41 +01:00
lcdc_info . ch [ 0 ] . lcd_modes = ecovec_dvi_modes ;
lcdc_info . ch [ 0 ] . num_modes = ARRAY_SIZE ( ecovec_dvi_modes ) ;
2009-08-26 11:04:34 +00:00
2013-07-04 21:13:28 +02:00
/* No backlight */
gpio_backlight_data . fbdev = NULL ;
2009-08-26 11:04:34 +00:00
gpio_set_value ( GPIO_PTA2 , 1 ) ;
gpio_set_value ( GPIO_PTU1 , 1 ) ;
} else {
/* Panel */
2009-08-26 11:04:39 +00:00
lcdc_info . clock_source = LCDC_CLK_PERIPHERAL ;
2010-09-03 07:20:04 +00:00
lcdc_info . ch [ 0 ] . clock_divider = 2 ;
2011-11-29 14:33:41 +01:00
lcdc_info . ch [ 0 ] . lcd_modes = ecovec_lcd_modes ;
lcdc_info . ch [ 0 ] . num_modes = ARRAY_SIZE ( ecovec_lcd_modes ) ;
2009-08-26 11:04:39 +00:00
/* FIXME
*
* LCDDON control is needed for Panel ,
* but current sh_mobile_lcdc driver doesn ' t control it .
* It is temporary correspondence
*/
gpio_request ( GPIO_PTF4 , NULL ) ;
gpio_direction_output ( GPIO_PTF4 , 1 ) ;
2009-09-28 08:21:41 +00:00
/* enable TouchScreen */
i2c_register_board_info ( 0 , & ts_i2c_clients , 1 ) ;
2011-03-24 16:31:17 +01:00
irq_set_irq_type ( IRQ0 , IRQ_TYPE_LEVEL_LOW ) ;
2009-08-26 11:04:34 +00:00
}
2009-08-26 11:04:36 +00:00
/* enable CEU0 */
gpio_request ( GPIO_FN_VIO0_D15 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D14 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D13 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D12 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D11 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D10 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D9 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D8 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D7 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D6 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D5 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D4 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D3 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D2 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D1 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_D0 , NULL ) ;
gpio_request ( GPIO_FN_VIO0_VD , NULL ) ;
gpio_request ( GPIO_FN_VIO0_CLK , NULL ) ;
gpio_request ( GPIO_FN_VIO0_FLD , NULL ) ;
gpio_request ( GPIO_FN_VIO0_HD , NULL ) ;
/* enable CEU1 */
gpio_request ( GPIO_FN_VIO1_D7 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_D6 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_D5 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_D4 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_D3 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_D2 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_D1 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_D0 , NULL ) ;
gpio_request ( GPIO_FN_VIO1_FLD , NULL ) ;
gpio_request ( GPIO_FN_VIO1_HD , NULL ) ;
gpio_request ( GPIO_FN_VIO1_VD , NULL ) ;
gpio_request ( GPIO_FN_VIO1_CLK , NULL ) ;
2009-09-14 11:23:00 +00:00
/* enable KEYSC */
gpio_request ( GPIO_FN_KEYOUT5_IN5 , NULL ) ;
gpio_request ( GPIO_FN_KEYOUT4_IN6 , NULL ) ;
gpio_request ( GPIO_FN_KEYOUT3 , NULL ) ;
gpio_request ( GPIO_FN_KEYOUT2 , NULL ) ;
gpio_request ( GPIO_FN_KEYOUT1 , NULL ) ;
gpio_request ( GPIO_FN_KEYOUT0 , NULL ) ;
gpio_request ( GPIO_FN_KEYIN0 , NULL ) ;
2009-09-16 11:34:34 +00:00
/* enable user debug switch */
gpio_request ( GPIO_PTR0 , NULL ) ;
gpio_request ( GPIO_PTR4 , NULL ) ;
gpio_request ( GPIO_PTR5 , NULL ) ;
gpio_request ( GPIO_PTR6 , NULL ) ;
gpio_direction_input ( GPIO_PTR0 ) ;
gpio_direction_input ( GPIO_PTR4 ) ;
gpio_direction_input ( GPIO_PTR5 ) ;
gpio_direction_input ( GPIO_PTR6 ) ;
2012-01-28 19:36:24 +01:00
/* SD-card slot CN11 */
2011-04-15 20:03:17 +02:00
# if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
2009-12-07 14:05:45 +00:00
/* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
2009-10-02 07:54:42 +00:00
gpio_request ( GPIO_FN_SDHI0WP , NULL ) ;
gpio_request ( GPIO_FN_SDHI0CMD , NULL ) ;
gpio_request ( GPIO_FN_SDHI0CLK , NULL ) ;
gpio_request ( GPIO_FN_SDHI0D3 , NULL ) ;
gpio_request ( GPIO_FN_SDHI0D2 , NULL ) ;
gpio_request ( GPIO_FN_SDHI0D1 , NULL ) ;
gpio_request ( GPIO_FN_SDHI0D0 , NULL ) ;
2009-12-07 14:05:45 +00:00
# else
/* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
gpio_request ( GPIO_FN_MSIOF0_TXD , NULL ) ;
gpio_request ( GPIO_FN_MSIOF0_RXD , NULL ) ;
gpio_request ( GPIO_FN_MSIOF0_TSCK , NULL ) ;
gpio_request ( GPIO_PTM4 , NULL ) ; /* software CS control of TSYNC pin */
gpio_direction_output ( GPIO_PTM4 , 1 ) ; /* active low CS */
gpio_request ( GPIO_PTB6 , NULL ) ; /* 3.3V power control */
gpio_direction_output ( GPIO_PTB6 , 0 ) ; /* disable power by default */
spi_register_board_info ( spi_bus , ARRAY_SIZE ( spi_bus ) ) ;
# endif
2009-10-02 07:54:42 +00:00
2012-01-28 19:36:24 +01:00
/* MMC/SD-card slot CN12 */
# if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
/* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
gpio_request ( GPIO_FN_MMC_D7 , NULL ) ;
gpio_request ( GPIO_FN_MMC_D6 , NULL ) ;
gpio_request ( GPIO_FN_MMC_D5 , NULL ) ;
gpio_request ( GPIO_FN_MMC_D4 , NULL ) ;
gpio_request ( GPIO_FN_MMC_D3 , NULL ) ;
gpio_request ( GPIO_FN_MMC_D2 , NULL ) ;
gpio_request ( GPIO_FN_MMC_D1 , NULL ) ;
gpio_request ( GPIO_FN_MMC_D0 , NULL ) ;
gpio_request ( GPIO_FN_MMC_CLK , NULL ) ;
gpio_request ( GPIO_FN_MMC_CMD , NULL ) ;
cn12_enabled = true ;
# elif defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
/* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
gpio_request ( GPIO_FN_SDHI1WP , NULL ) ;
gpio_request ( GPIO_FN_SDHI1CMD , NULL ) ;
gpio_request ( GPIO_FN_SDHI1CLK , NULL ) ;
gpio_request ( GPIO_FN_SDHI1D3 , NULL ) ;
gpio_request ( GPIO_FN_SDHI1D2 , NULL ) ;
gpio_request ( GPIO_FN_SDHI1D1 , NULL ) ;
gpio_request ( GPIO_FN_SDHI1D0 , NULL ) ;
cn12_enabled = true ;
# endif
if ( cn12_enabled )
/* I/O buffer drive ability is high for CN12 */
__raw_writew ( ( __raw_readw ( IODRIVEA ) & ~ 0x3000 ) | 0x2000 ,
IODRIVEA ) ;
2009-12-15 05:37:39 +00:00
/* enable FSI */
gpio_request ( GPIO_FN_FSIMCKB , NULL ) ;
gpio_request ( GPIO_FN_FSIIBSD , NULL ) ;
gpio_request ( GPIO_FN_FSIOBSD , NULL ) ;
gpio_request ( GPIO_FN_FSIIBBCK , NULL ) ;
gpio_request ( GPIO_FN_FSIIBLRCK , NULL ) ;
gpio_request ( GPIO_FN_FSIOBBCK , NULL ) ;
gpio_request ( GPIO_FN_FSIOBLRCK , NULL ) ;
gpio_request ( GPIO_FN_CLKAUDIOBO , NULL ) ;
2010-02-22 05:18:10 +00:00
/* set SPU2 clock to 83.4 MHz */
clk = clk_get ( NULL , " spu_clk " ) ;
2010-10-15 14:37:24 +00:00
if ( ! IS_ERR ( clk ) ) {
2010-05-13 01:08:33 +00:00
clk_set_rate ( clk , clk_round_rate ( clk , 83333333 ) ) ;
clk_put ( clk ) ;
}
2010-02-22 05:18:10 +00:00
2009-12-15 05:37:39 +00:00
/* change parent of FSI B */
clk = clk_get ( NULL , " fsib_clk " ) ;
2010-10-15 14:37:24 +00:00
if ( ! IS_ERR ( clk ) ) {
2010-11-26 09:40:22 +00:00
/* 48kHz dummy clock was used to make sure 1/1 divide */
clk_set_rate ( & sh7724_fsimckb_clk , 48000 ) ;
clk_set_parent ( clk , & sh7724_fsimckb_clk ) ;
clk_set_rate ( clk , 48000 ) ;
2010-05-13 01:08:33 +00:00
clk_put ( clk ) ;
}
2009-12-15 05:37:39 +00:00
gpio_request ( GPIO_PTU0 , NULL ) ;
gpio_direction_output ( GPIO_PTU0 , 0 ) ;
mdelay ( 20 ) ;
2010-01-15 08:25:00 +09:00
/* enable motion sensor */
gpio_request ( GPIO_FN_INTC_IRQ1 , NULL ) ;
gpio_direction_input ( GPIO_FN_INTC_IRQ1 ) ;
2010-02-19 09:33:47 +00:00
/* set VPU clock to 166 MHz */
clk = clk_get ( NULL , " vpu_clk " ) ;
2010-10-15 14:37:24 +00:00
if ( ! IS_ERR ( clk ) ) {
2010-05-13 01:08:33 +00:00
clk_set_rate ( clk , clk_round_rate ( clk , 166000000 ) ) ;
clk_put ( clk ) ;
}
2010-02-19 09:33:47 +00:00
2010-02-24 00:32:28 +00:00
/* enable IrDA */
gpio_request ( GPIO_FN_IRDA_OUT , NULL ) ;
gpio_request ( GPIO_FN_IRDA_IN , NULL ) ;
gpio_request ( GPIO_PTU5 , NULL ) ;
gpio_direction_output ( GPIO_PTU5 , 0 ) ;
2018-03-12 09:43:04 -04:00
/* Register gpio lookup tables for cameras and video decoder */
gpiod_add_lookup_table ( & tw9910_gpios ) ;
gpiod_add_lookup_table ( & mt9t112_0_gpios ) ;
gpiod_add_lookup_table ( & mt9t112_1_gpios ) ;
2009-09-10 01:39:37 +00:00
/* enable I2C device */
2009-12-15 05:37:39 +00:00
i2c_register_board_info ( 0 , i2c0_devices ,
ARRAY_SIZE ( i2c0_devices ) ) ;
2009-09-10 01:39:37 +00:00
i2c_register_board_info ( 1 , i2c1_devices ,
ARRAY_SIZE ( i2c1_devices ) ) ;
2011-01-17 08:02:53 +00:00
# if defined(CONFIG_VIDEO_SH_VOU) || defined(CONFIG_VIDEO_SH_VOU_MODULE)
2010-04-21 08:45:25 +00:00
/* VOU */
gpio_request ( GPIO_FN_DV_D15 , NULL ) ;
gpio_request ( GPIO_FN_DV_D14 , NULL ) ;
gpio_request ( GPIO_FN_DV_D13 , NULL ) ;
gpio_request ( GPIO_FN_DV_D12 , NULL ) ;
gpio_request ( GPIO_FN_DV_D11 , NULL ) ;
gpio_request ( GPIO_FN_DV_D10 , NULL ) ;
gpio_request ( GPIO_FN_DV_D9 , NULL ) ;
gpio_request ( GPIO_FN_DV_D8 , NULL ) ;
gpio_request ( GPIO_FN_DV_CLKI , NULL ) ;
gpio_request ( GPIO_FN_DV_CLK , NULL ) ;
gpio_request ( GPIO_FN_DV_VSYNC , NULL ) ;
gpio_request ( GPIO_FN_DV_HSYNC , NULL ) ;
/* AK8813 power / reset sequence */
gpio_request ( GPIO_PTG4 , NULL ) ;
gpio_request ( GPIO_PTU3 , NULL ) ;
/* Reset */
gpio_direction_output ( GPIO_PTG4 , 0 ) ;
/* Power down */
gpio_direction_output ( GPIO_PTU3 , 1 ) ;
udelay ( 10 ) ;
/* Power up, reset */
gpio_set_value ( GPIO_PTU3 , 0 ) ;
udelay ( 10 ) ;
/* Remove reset */
gpio_set_value ( GPIO_PTG4 , 1 ) ;
2011-01-17 08:02:53 +00:00
# endif
2010-04-21 08:45:25 +00:00
2018-03-12 09:43:04 -04:00
/* Initialize CEU platform devices separately to map memory first */
device_initialize ( & ecovec_ceu_devices [ 0 ] - > dev ) ;
arch_setup_pdev_archdata ( ecovec_ceu_devices [ 0 ] ) ;
dma_declare_coherent_memory ( & ecovec_ceu_devices [ 0 ] - > dev ,
ceu0_dma_membase , ceu0_dma_membase ,
ceu0_dma_membase +
CEU_BUFFER_MEMORY_SIZE - 1 ,
DMA_MEMORY_EXCLUSIVE ) ;
platform_device_add ( ecovec_ceu_devices [ 0 ] ) ;
device_initialize ( & ecovec_ceu_devices [ 1 ] - > dev ) ;
arch_setup_pdev_archdata ( ecovec_ceu_devices [ 1 ] ) ;
dma_declare_coherent_memory ( & ecovec_ceu_devices [ 1 ] - > dev ,
ceu1_dma_membase , ceu1_dma_membase ,
ceu1_dma_membase +
CEU_BUFFER_MEMORY_SIZE - 1 ,
DMA_MEMORY_EXCLUSIVE ) ;
platform_device_add ( ecovec_ceu_devices [ 1 ] ) ;
2018-09-06 14:24:36 +02:00
gpiod_add_lookup_table ( & cn12_power_gpiod_table ) ;
# if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
gpiod_add_lookup_table ( & sdhi0_power_gpiod_table ) ;
# endif
2009-08-19 12:08:33 +00:00
return platform_add_devices ( ecovec_devices ,
ARRAY_SIZE ( ecovec_devices ) ) ;
}
2009-09-10 01:39:58 +00:00
arch_initcall ( arch_setup ) ;
static int __init devices_setup ( void )
{
2009-10-26 10:44:37 +00:00
sh_eth_init ( & sh_eth_plat ) ;
2009-09-10 01:39:58 +00:00
return 0 ;
}
device_initcall ( devices_setup ) ;
2018-03-12 09:43:04 -04:00
/* Reserve a portion of memory for CEU 0 and CEU 1 buffers */
static void __init ecovec_mv_mem_reserve ( void )
{
phys_addr_t phys ;
phys_addr_t size = CEU_BUFFER_MEMORY_SIZE ;
phys = memblock_alloc_base ( size , PAGE_SIZE , MEMBLOCK_ALLOC_ANYWHERE ) ;
memblock_free ( phys , size ) ;
memblock_remove ( phys , size ) ;
ceu0_dma_membase = phys ;
phys = memblock_alloc_base ( size , PAGE_SIZE , MEMBLOCK_ALLOC_ANYWHERE ) ;
memblock_free ( phys , size ) ;
memblock_remove ( phys , size ) ;
ceu1_dma_membase = phys ;
}
2009-08-19 12:08:33 +00:00
static struct sh_machine_vector mv_ecovec __initmv = {
. mv_name = " R0P7724 (EcoVec) " ,
2018-03-12 09:43:04 -04:00
. mv_mem_reserve = ecovec_mv_mem_reserve ,
2009-08-19 12:08:33 +00:00
} ;