2009-06-03 18:41:53 -07:00
/*
* TI DA830 / OMAP L137 EVM board
*
* Author : Mark A . Greer < mgreer @ mvista . com >
* Derived from : arch / arm / mach - davinci / board - dm644x - evm . c
*
* 2007 , 2009 ( c ) MontaVista Software , Inc . This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed " as is " without any warranty of any kind , whether express
* or implied .
*/
# include <linux/kernel.h>
# include <linux/init.h>
# include <linux/console.h>
2009-09-25 23:28:13 +04:00
# include <linux/interrupt.h>
2009-09-15 18:15:06 -07:00
# include <linux/gpio.h>
2016-11-24 16:04:54 +01:00
# include <linux/gpio/machine.h>
2009-09-18 14:15:18 -07:00
# include <linux/platform_device.h>
2009-06-03 18:41:53 -07:00
# include <linux/i2c.h>
2017-05-21 23:57:26 +02:00
# include <linux/platform_data/pcf857x.h>
2019-01-08 10:15:31 +01:00
# include <linux/property.h>
2009-09-18 14:15:18 -07:00
# include <linux/mtd/mtd.h>
# include <linux/mtd/partitions.h>
2011-02-24 10:53:27 +05:30
# include <linux/spi/spi.h>
# include <linux/spi/flash.h>
2013-08-18 10:49:01 +05:30
# include <linux/platform_data/gpio-davinci.h>
# include <linux/platform_data/mtd-davinci.h>
# include <linux/platform_data/mtd-davinci-aemif.h>
# include <linux/platform_data/spi-davinci.h>
# include <linux/platform_data/usb-davinci.h>
2018-06-28 11:57:45 +02:00
# include <linux/platform_data/ti-aemif.h>
2019-04-12 14:36:39 +02:00
# include <linux/regulator/fixed.h>
2016-10-26 21:41:55 +02:00
# include <linux/regulator/machine.h>
2018-11-13 15:01:14 +01:00
# include <linux/nvmem-provider.h>
2009-06-03 18:41:53 -07:00
# include <asm/mach-types.h>
# include <asm/mach/arch.h>
2013-08-18 10:49:01 +05:30
# include <mach/common.h>
2009-08-28 15:05:21 -07:00
# include <mach/mux.h>
2009-06-03 18:41:53 -07:00
# include <mach/da8xx.h>
2019-02-14 15:52:03 +01:00
# include "irqs.h"
2010-09-15 10:11:25 -04:00
# define DA830_EVM_PHY_ID ""
2009-09-25 23:28:13 +04:00
/*
* USB1 VBUS is controlled by GPIO1 [ 15 ] , over - current is reported on GPIO2 [ 4 ] .
*/
# define ON_BD_USB_DRV GPIO_TO_PIN(1, 15)
# define ON_BD_USB_OVC GPIO_TO_PIN(2, 4)
static const short da830_evm_usb11_pins [ ] = {
DA830_GPIO1_15 , DA830_GPIO2_4 ,
- 1
} ;
2019-04-12 14:36:39 +02:00
static struct regulator_consumer_supply da830_evm_usb_supplies [ ] = {
REGULATOR_SUPPLY ( " vbus " , NULL ) ,
} ;
static struct regulator_init_data da830_evm_usb_vbus_data = {
. consumer_supplies = da830_evm_usb_supplies ,
. num_consumer_supplies = ARRAY_SIZE ( da830_evm_usb_supplies ) ,
2019-06-25 18:49:14 +02:00
. constraints = {
. valid_ops_mask = REGULATOR_CHANGE_STATUS ,
} ,
2019-04-12 14:36:39 +02:00
} ;
static struct fixed_voltage_config da830_evm_usb_vbus = {
. supply_name = " vbus " ,
. microvolts = 33000000 ,
. init_data = & da830_evm_usb_vbus_data ,
} ;
static struct platform_device da830_evm_usb_vbus_device = {
. name = " reg-fixed-voltage " ,
. id = 0 ,
. dev = {
. platform_data = & da830_evm_usb_vbus ,
} ,
} ;
static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = {
2019-02-11 11:36:58 +01:00
. dev_id = " ohci-da8xx " ,
. table = {
GPIO_LOOKUP ( " davinci_gpio " , ON_BD_USB_OVC , " oc " , 0 ) ,
2019-04-12 14:36:35 +02:00
{ }
2019-02-11 11:36:58 +01:00
} ,
} ;
2009-09-25 23:28:13 +04:00
2019-04-12 14:36:39 +02:00
static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = {
. dev_id = " reg-fixed-voltage.0 " ,
. table = {
2019-06-25 17:16:12 +02:00
GPIO_LOOKUP ( " davinci_gpio " , ON_BD_USB_DRV , NULL , 0 ) ,
2019-04-12 14:36:39 +02:00
{ }
} ,
} ;
static struct gpiod_lookup_table * da830_evm_usb_gpio_lookups [ ] = {
& da830_evm_usb_oc_gpio_lookup ,
& da830_evm_usb_vbus_gpio_lookup ,
} ;
2009-09-25 23:28:13 +04:00
static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = {
/* TPS2065 switch @ 5V */
. potpgt = ( 3 + 1 ) / 2 , /* 3 ms max */
} ;
static __init void da830_evm_usb_init ( void )
{
int ret ;
2018-05-18 11:48:13 -05:00
ret = da8xx_register_usb_phy_clocks ( ) ;
if ( ret )
pr_warn ( " %s: USB PHY CLK registration failed: %d \n " ,
__func__ , ret ) ;
2016-10-31 15:47:20 -05:00
2019-04-12 14:36:39 +02:00
gpiod_add_lookup_tables ( da830_evm_usb_gpio_lookups ,
ARRAY_SIZE ( da830_evm_usb_gpio_lookups ) ) ;
2016-10-26 19:18:15 -05:00
ret = da8xx_register_usb_phy ( ) ;
if ( ret )
pr_warn ( " %s: USB PHY registration failed: %d \n " ,
__func__ , ret ) ;
2009-10-30 23:52:04 +04:00
ret = davinci_cfg_reg ( DA830_USB0_DRVVBUS ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: USB 2.0 PinMux setup failed: %d \n " , __func__ , ret ) ;
2009-10-30 23:52:04 +04:00
else {
/*
* TPS2065 switch @ 5 V supplies 1 A ( sustains 1.5 A ) ,
* with the power on to power good time of 3 ms .
*/
ret = da8xx_register_usb20 ( 1000 , 3 ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: USB 2.0 registration failed: %d \n " ,
__func__ , ret ) ;
2009-10-30 23:52:04 +04:00
}
2010-03-25 17:43:48 -04:00
ret = davinci_cfg_reg_list ( da830_evm_usb11_pins ) ;
2009-09-25 23:28:13 +04:00
if ( ret ) {
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: USB 1.1 PinMux setup failed: %d \n " , __func__ , ret ) ;
2009-09-25 23:28:13 +04:00
return ;
}
2019-04-12 14:36:39 +02:00
ret = platform_device_register ( & da830_evm_usb_vbus_device ) ;
if ( ret ) {
pr_warn ( " %s: Unable to register the vbus supply \n " , __func__ ) ;
return ;
}
2009-09-25 23:28:13 +04:00
ret = da8xx_register_usb11 ( & da830_evm_usb11_pdata ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: USB 1.1 registration failed: %d \n " , __func__ , ret ) ;
2009-09-25 23:28:13 +04:00
}
2009-08-28 15:05:21 -07:00
static const short da830_evm_mcasp1_pins [ ] = {
DA830_AHCLKX1 , DA830_ACLKX1 , DA830_AFSX1 , DA830_AHCLKR1 , DA830_AFSR1 ,
DA830_AMUTE1 , DA830_AXR1_0 , DA830_AXR1_1 , DA830_AXR1_2 , DA830_AXR1_5 ,
DA830_ACLKR1 , DA830_AXR1_6 , DA830_AXR1_7 , DA830_AXR1_8 , DA830_AXR1_10 ,
DA830_AXR1_11 ,
- 1
} ;
2009-08-11 17:01:59 -04:00
static u8 da830_iis_serializer_direction [ ] = {
RX_MODE , INACTIVE_MODE , INACTIVE_MODE , INACTIVE_MODE ,
INACTIVE_MODE , TX_MODE , INACTIVE_MODE , INACTIVE_MODE ,
INACTIVE_MODE , INACTIVE_MODE , INACTIVE_MODE , INACTIVE_MODE ,
} ;
static struct snd_platform_data da830_evm_snd_data = {
. tx_dma_offset = 0x2000 ,
. rx_dma_offset = 0x2000 ,
. op_mode = DAVINCI_MCASP_IIS_MODE ,
. num_serializer = ARRAY_SIZE ( da830_iis_serializer_direction ) ,
. tdm_slots = 2 ,
. serial_dir = da830_iis_serializer_direction ,
2010-07-19 12:31:16 +05:30
. asp_chan_q = EVENTQ_0 ,
2009-08-11 17:01:59 -04:00
. version = MCASP_VERSION_2 ,
. txnumevt = 1 ,
. rxnumevt = 1 ,
} ;
2009-09-15 18:10:20 -07:00
/*
* GPIO2 [ 1 ] is used as MMC_SD_WP and GPIO2 [ 2 ] as MMC_SD_INS .
*/
static const short da830_evm_mmc_sd_pins [ ] = {
DA830_MMCSD_DAT_0 , DA830_MMCSD_DAT_1 , DA830_MMCSD_DAT_2 ,
DA830_MMCSD_DAT_3 , DA830_MMCSD_DAT_4 , DA830_MMCSD_DAT_5 ,
DA830_MMCSD_DAT_6 , DA830_MMCSD_DAT_7 , DA830_MMCSD_CLK ,
DA830_MMCSD_CMD , DA830_GPIO2_1 , DA830_GPIO2_2 ,
- 1
} ;
2018-04-24 20:05:03 +05:30
# define DA830_MMCSD_WP_PIN GPIO_TO_PIN(2, 1)
# define DA830_MMCSD_CD_PIN GPIO_TO_PIN(2, 2)
2016-11-24 16:04:54 +01:00
static struct gpiod_lookup_table mmc_gpios_table = {
. dev_id = " da830-mmc.0 " ,
. table = {
/* gpio chip 1 contains gpio range 32-63 */
2019-01-03 16:11:00 +01:00
GPIO_LOOKUP ( " davinci_gpio " , DA830_MMCSD_CD_PIN , " cd " ,
2018-04-24 20:05:03 +05:30
GPIO_ACTIVE_LOW ) ,
2019-01-03 16:11:00 +01:00
GPIO_LOOKUP ( " davinci_gpio " , DA830_MMCSD_WP_PIN , " wp " ,
2018-04-24 20:05:03 +05:30
GPIO_ACTIVE_LOW ) ,
2019-04-12 14:36:35 +02:00
{ }
2016-11-24 16:04:54 +01:00
} ,
} ;
2010-03-10 14:03:01 +05:30
2009-09-15 18:10:20 -07:00
static struct davinci_mmc_config da830_evm_mmc_config = {
2010-03-10 14:03:02 +05:30
. wires = 8 ,
2009-11-03 15:46:14 +05:30
. max_freq = 50000000 ,
. caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED ,
2009-09-15 18:10:20 -07:00
} ;
static inline void da830_evm_init_mmc ( void )
{
int ret ;
2010-03-25 17:43:48 -04:00
ret = davinci_cfg_reg_list ( da830_evm_mmc_sd_pins ) ;
2009-09-15 18:10:20 -07:00
if ( ret ) {
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: mmc/sd mux setup failed: %d \n " , __func__ , ret ) ;
2009-09-15 18:10:20 -07:00
return ;
}
2016-11-24 16:04:54 +01:00
gpiod_add_lookup_table ( & mmc_gpios_table ) ;
2010-03-10 14:03:01 +05:30
2009-09-15 18:10:20 -07:00
ret = da8xx_register_mmcsd0 ( & da830_evm_mmc_config ) ;
if ( ret ) {
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: mmc/sd registration failed: %d \n " , __func__ , ret ) ;
2016-11-24 16:04:54 +01:00
gpiod_remove_lookup_table ( & mmc_gpios_table ) ;
2009-09-15 18:10:20 -07:00
}
}
2013-04-01 12:43:44 +05:30
# define HAS_MMC IS_ENABLED(CONFIG_MMC_DAVINCI)
2009-10-21 21:18:21 +05:30
2009-09-18 14:15:18 -07:00
# ifdef CONFIG_DA830_UI_NAND
static struct mtd_partition da830_evm_nand_partitions [ ] = {
/* bootloader (U-Boot, etc) in first sector */
[ 0 ] = {
. name = " bootloader " ,
. offset = 0 ,
. size = SZ_128K ,
. mask_flags = MTD_WRITEABLE , /* force read-only */
} ,
/* bootloader params in the next sector */
[ 1 ] = {
. name = " params " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_128K ,
. mask_flags = MTD_WRITEABLE , /* force read-only */
} ,
/* kernel */
[ 2 ] = {
. name = " kernel " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_2M ,
. mask_flags = 0 ,
} ,
/* file system */
[ 3 ] = {
. name = " filesystem " ,
. offset = MTDPART_OFS_APPEND ,
. size = MTDPART_SIZ_FULL ,
. mask_flags = 0 ,
}
} ;
2020-07-15 13:48:32 +01:00
/* flash bbt descriptors */
2009-09-18 14:15:18 -07:00
static uint8_t da830_evm_nand_bbt_pattern [ ] = { ' B ' , ' b ' , ' t ' , ' 0 ' } ;
static uint8_t da830_evm_nand_mirror_pattern [ ] = { ' 1 ' , ' t ' , ' b ' , ' B ' } ;
static struct nand_bbt_descr da830_evm_nand_bbt_main_descr = {
. options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
NAND_BBT_WRITE | NAND_BBT_2BIT |
NAND_BBT_VERSION | NAND_BBT_PERCHIP ,
. offs = 2 ,
. len = 4 ,
. veroffs = 16 ,
. maxblocks = 4 ,
. pattern = da830_evm_nand_bbt_pattern
} ;
static struct nand_bbt_descr da830_evm_nand_bbt_mirror_descr = {
. options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
NAND_BBT_WRITE | NAND_BBT_2BIT |
NAND_BBT_VERSION | NAND_BBT_PERCHIP ,
. offs = 2 ,
. len = 4 ,
. veroffs = 16 ,
. maxblocks = 4 ,
. pattern = da830_evm_nand_mirror_pattern
} ;
2010-08-09 15:46:38 +05:30
static struct davinci_aemif_timing da830_evm_nandflash_timing = {
. wsetup = 24 ,
. wstrobe = 21 ,
. whold = 14 ,
. rsetup = 19 ,
. rstrobe = 50 ,
. rhold = 0 ,
. ta = 20 ,
} ;
2009-09-18 14:15:18 -07:00
static struct davinci_nand_pdata da830_evm_nand_pdata = {
2018-04-30 10:24:43 +02:00
. core_chipsel = 1 ,
2009-09-18 14:15:18 -07:00
. parts = da830_evm_nand_partitions ,
. nr_parts = ARRAY_SIZE ( da830_evm_nand_partitions ) ,
2020-08-27 10:51:58 +02:00
. engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST ,
2009-09-18 14:15:18 -07:00
. ecc_bits = 4 ,
2011-05-31 16:31:23 -07:00
. bbt_options = NAND_BBT_USE_FLASH ,
2009-09-18 14:15:18 -07:00
. bbt_td = & da830_evm_nand_bbt_main_descr ,
. bbt_md = & da830_evm_nand_bbt_mirror_descr ,
2010-08-09 15:46:38 +05:30
. timing = & da830_evm_nandflash_timing ,
2009-09-18 14:15:18 -07:00
} ;
static struct resource da830_evm_nand_resources [ ] = {
[ 0 ] = { /* First memory resource is NAND I/O window */
2010-04-16 21:29:20 +04:00
. start = DA8XX_AEMIF_CS3_BASE ,
. end = DA8XX_AEMIF_CS3_BASE + PAGE_SIZE - 1 ,
2009-09-18 14:15:18 -07:00
. flags = IORESOURCE_MEM ,
} ,
[ 1 ] = { /* Second memory resource is AEMIF control registers */
2010-04-16 21:29:20 +04:00
. start = DA8XX_AEMIF_CTL_BASE ,
. end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1 ,
2009-09-18 14:15:18 -07:00
. flags = IORESOURCE_MEM ,
} ,
} ;
2018-06-28 11:57:45 +02:00
static struct platform_device da830_evm_aemif_devices [ ] = {
{
. name = " davinci_nand " ,
. id = 1 ,
. dev = {
. platform_data = & da830_evm_nand_pdata ,
} ,
. num_resources = ARRAY_SIZE ( da830_evm_nand_resources ) ,
. resource = da830_evm_nand_resources ,
2009-09-18 14:15:18 -07:00
} ,
2018-06-28 11:57:45 +02:00
} ;
static struct resource da830_evm_aemif_resource [ ] = {
{
. start = DA8XX_AEMIF_CTL_BASE ,
. end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1 ,
. flags = IORESOURCE_MEM ,
} ,
} ;
static struct aemif_abus_data da830_evm_aemif_abus_data [ ] = {
{
. cs = 3 ,
} ,
} ;
static struct aemif_platform_data da830_evm_aemif_pdata = {
. abus_data = da830_evm_aemif_abus_data ,
. num_abus_data = ARRAY_SIZE ( da830_evm_aemif_abus_data ) ,
. sub_devices = da830_evm_aemif_devices ,
. num_sub_devices = ARRAY_SIZE ( da830_evm_aemif_devices ) ,
. cs_offset = 2 ,
} ;
static struct platform_device da830_evm_aemif_device = {
. name = " ti-aemif " ,
. id = - 1 ,
. dev = {
. platform_data = & da830_evm_aemif_pdata ,
} ,
. resource = da830_evm_aemif_resource ,
. num_resources = ARRAY_SIZE ( da830_evm_aemif_resource ) ,
2009-09-18 14:15:18 -07:00
} ;
2009-10-09 20:55:43 +05:30
2018-01-19 20:21:29 +05:30
/*
* UI board NAND / NOR flashes only use 8 - bit data bus .
*/
static const short da830_evm_emif25_pins [ ] = {
DA830_EMA_D_0 , DA830_EMA_D_1 , DA830_EMA_D_2 , DA830_EMA_D_3 ,
DA830_EMA_D_4 , DA830_EMA_D_5 , DA830_EMA_D_6 , DA830_EMA_D_7 ,
DA830_EMA_A_0 , DA830_EMA_A_1 , DA830_EMA_A_2 , DA830_EMA_A_3 ,
DA830_EMA_A_4 , DA830_EMA_A_5 , DA830_EMA_A_6 , DA830_EMA_A_7 ,
DA830_EMA_A_8 , DA830_EMA_A_9 , DA830_EMA_A_10 , DA830_EMA_A_11 ,
DA830_EMA_A_12 , DA830_EMA_BA_0 , DA830_EMA_BA_1 , DA830_NEMA_WE ,
DA830_NEMA_CS_2 , DA830_NEMA_CS_3 , DA830_NEMA_OE , DA830_EMA_WAIT_0 ,
- 1
} ;
2009-10-21 21:18:20 +05:30
static inline void da830_evm_init_nand ( int mux_mode )
2009-10-09 20:55:43 +05:30
{
int ret ;
2009-10-21 21:18:21 +05:30
if ( HAS_MMC ) {
2014-10-31 17:51:51 -07:00
pr_warn ( " WARNING: both MMC/SD and NAND are enabled, but they share AEMIF pins \n "
" \t Disable MMC/SD for NAND support \n " ) ;
2009-10-21 21:18:21 +05:30
return ;
}
2010-03-25 17:43:48 -04:00
ret = davinci_cfg_reg_list ( da830_evm_emif25_pins ) ;
2009-10-09 20:55:43 +05:30
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: emif25 mux setup failed: %d \n " , __func__ , ret ) ;
2009-10-09 20:55:43 +05:30
2018-06-28 11:57:45 +02:00
ret = platform_device_register ( & da830_evm_aemif_device ) ;
2009-10-09 20:55:43 +05:30
if ( ret )
2018-06-28 11:57:45 +02:00
pr_warn ( " %s: AEMIF device not registered \n " , __func__ ) ;
2014-01-30 13:03:40 +02:00
2009-10-21 21:18:20 +05:30
gpio_direction_output ( mux_mode , 1 ) ;
2009-10-09 20:55:43 +05:30
}
# else
2009-10-21 21:18:20 +05:30
static inline void da830_evm_init_nand ( int mux_mode ) { }
2009-09-18 14:15:18 -07:00
# endif
2009-10-09 20:55:43 +05:30
# ifdef CONFIG_DA830_UI_LCD
2009-10-21 21:18:20 +05:30
static inline void da830_evm_init_lcdc ( int mux_mode )
2009-10-09 20:55:43 +05:30
{
int ret ;
2010-03-25 17:43:48 -04:00
ret = davinci_cfg_reg_list ( da830_lcdcntl_pins ) ;
2009-10-09 20:55:43 +05:30
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: lcdcntl mux setup failed: %d \n " , __func__ , ret ) ;
2009-10-09 20:55:43 +05:30
ret = da8xx_register_lcdc ( & sharp_lcd035q3dg01_pdata ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: lcd setup failed: %d \n " , __func__ , ret ) ;
2009-10-21 21:18:20 +05:30
gpio_direction_output ( mux_mode , 0 ) ;
2009-10-09 20:55:43 +05:30
}
# else
2009-10-21 21:18:20 +05:30
static inline void da830_evm_init_lcdc ( int mux_mode ) { }
2009-10-09 20:55:43 +05:30
# endif
2009-09-18 14:15:18 -07:00
2018-11-13 15:01:14 +01:00
static struct nvmem_cell_info da830_evm_nvmem_cells [ ] = {
{
. name = " macaddr " ,
. offset = 0x7f00 ,
. bytes = ETH_ALEN ,
}
} ;
static struct nvmem_cell_table da830_evm_nvmem_cell_table = {
. nvmem_name = " 1-00500 " ,
. cells = da830_evm_nvmem_cells ,
. ncells = ARRAY_SIZE ( da830_evm_nvmem_cells ) ,
} ;
static struct nvmem_cell_lookup da830_evm_nvmem_cell_lookup = {
. nvmem_name = " 1-00500 " ,
. cell_name = " macaddr " ,
. dev_id = " davinci_emac.1 " ,
. con_id = " mac-address " ,
} ;
2019-01-08 10:15:31 +01:00
static const struct property_entry da830_evm_i2c_eeprom_properties [ ] = {
PROPERTY_ENTRY_U32 ( " pagesize " , 64 ) ,
{ }
2009-10-21 21:18:20 +05:30
} ;
2021-03-29 13:50:37 +03:00
static const struct software_node da830_evm_i2c_eeprom_node = {
. properties = da830_evm_i2c_eeprom_properties ,
} ;
2009-11-03 11:51:19 +05:30
static int __init da830_evm_ui_expander_setup ( struct i2c_client * client ,
int gpio , unsigned ngpio , void * context )
2009-10-21 21:18:20 +05:30
{
gpio_request ( gpio + 6 , " UI MUX_MODE " ) ;
2009-10-21 21:18:21 +05:30
/* Drive mux mode low to match the default without UI card */
gpio_direction_output ( gpio + 6 , 0 ) ;
2009-10-21 21:18:20 +05:30
da830_evm_init_lcdc ( gpio + 6 ) ;
da830_evm_init_nand ( gpio + 6 ) ;
return 0 ;
}
static int da830_evm_ui_expander_teardown ( struct i2c_client * client , int gpio ,
unsigned ngpio , void * context )
{
gpio_free ( gpio + 6 ) ;
return 0 ;
}
2009-11-03 11:51:19 +05:30
static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
2009-10-21 21:18:20 +05:30
. gpio_base = DAVINCI_N_GPIO ,
. setup = da830_evm_ui_expander_setup ,
. teardown = da830_evm_ui_expander_teardown ,
} ;
static struct i2c_board_info __initdata da830_evm_i2c_devices [ ] = {
{
I2C_BOARD_INFO ( " 24c256 " , 0x50 ) ,
2021-03-29 13:50:37 +03:00
. swnode = & da830_evm_i2c_eeprom_node ,
2009-10-21 21:18:20 +05:30
} ,
{
I2C_BOARD_INFO ( " tlv320aic3x " , 0x18 ) ,
} ,
{
I2C_BOARD_INFO ( " pcf8574 " , 0x3f ) ,
. platform_data = & da830_evm_ui_expander_info ,
} ,
} ;
static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
. bus_freq = 100 , /* kHz */
. bus_delay = 0 , /* usec */
} ;
2010-06-29 11:35:14 +05:30
/*
* The following EDMA channels / slots are not being used by drivers ( for
* example : Timer , GPIO , UART events etc ) on da830 / omap - l137 EVM , hence
* they are being reserved for codecs on the DSP side .
*/
static const s16 da830_dma_rsv_chans [ ] [ 2 ] = {
/* (offset, number) */
{ 8 , 2 } ,
{ 12 , 2 } ,
{ 24 , 4 } ,
{ 30 , 2 } ,
{ - 1 , - 1 }
} ;
static const s16 da830_dma_rsv_slots [ ] [ 2 ] = {
/* (offset, number) */
{ 8 , 2 } ,
{ 12 , 2 } ,
{ 24 , 4 } ,
{ 30 , 26 } ,
{ - 1 , - 1 }
} ;
static struct edma_rsv_info da830_edma_rsv [ ] = {
{
. rsv_chans = da830_dma_rsv_chans ,
. rsv_slots = da830_dma_rsv_slots ,
} ,
} ;
2011-02-24 10:53:27 +05:30
static struct mtd_partition da830evm_spiflash_part [ ] = {
[ 0 ] = {
. name = " DSP-UBL " ,
. offset = 0 ,
. size = SZ_8K ,
. mask_flags = MTD_WRITEABLE ,
} ,
[ 1 ] = {
. name = " ARM-UBL " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_16K + SZ_8K ,
. mask_flags = MTD_WRITEABLE ,
} ,
[ 2 ] = {
. name = " U-Boot " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_256K - SZ_32K ,
. mask_flags = MTD_WRITEABLE ,
} ,
[ 3 ] = {
. name = " U-Boot-Environment " ,
. offset = MTDPART_OFS_APPEND ,
. size = SZ_16K ,
. mask_flags = 0 ,
} ,
[ 4 ] = {
. name = " Kernel " ,
. offset = MTDPART_OFS_APPEND ,
. size = MTDPART_SIZ_FULL ,
. mask_flags = 0 ,
} ,
} ;
static struct flash_platform_data da830evm_spiflash_data = {
. name = " m25p80 " ,
. parts = da830evm_spiflash_part ,
. nr_parts = ARRAY_SIZE ( da830evm_spiflash_part ) ,
. type = " w25x32 " ,
} ;
static struct davinci_spi_config da830evm_spiflash_cfg = {
. io_type = SPI_IO_TYPE_DMA ,
. c2tdelay = 8 ,
. t2cdelay = 8 ,
} ;
static struct spi_board_info da830evm_spi_info [ ] = {
{
. modalias = " m25p80 " ,
. platform_data = & da830evm_spiflash_data ,
. controller_data = & da830evm_spiflash_cfg ,
. mode = SPI_MODE_0 ,
. max_speed_hz = 30000000 ,
. bus_num = 0 ,
. chip_select = 0 ,
} ,
} ;
2009-06-03 18:41:53 -07:00
static __init void da830_evm_init ( void )
{
struct davinci_soc_info * soc_info = & davinci_soc_info ;
int ret ;
2018-05-18 11:48:07 -05:00
da830_register_clocks ( ) ;
2013-08-18 10:49:01 +05:30
ret = da830_register_gpio ( ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: GPIO init failed: %d \n " , __func__ , ret ) ;
2013-08-18 10:49:01 +05:30
2010-06-29 11:35:14 +05:30
ret = da830_register_edma ( da830_edma_rsv ) ;
2009-06-03 18:41:53 -07:00
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: edma registration failed: %d \n " , __func__ , ret ) ;
2009-06-03 18:41:53 -07:00
2010-03-25 17:43:48 -04:00
ret = davinci_cfg_reg_list ( da830_i2c0_pins ) ;
2009-06-03 18:41:53 -07:00
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: i2c0 mux setup failed: %d \n " , __func__ , ret ) ;
2009-06-03 18:41:53 -07:00
ret = da8xx_register_i2c ( 0 , & da830_evm_i2c_0_pdata ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: i2c0 registration failed: %d \n " , __func__ , ret ) ;
2009-06-03 18:41:53 -07:00
2009-09-25 23:28:13 +04:00
da830_evm_usb_init ( ) ;
2009-06-03 18:41:53 -07:00
soc_info - > emac_pdata - > rmii_en = 1 ;
2010-09-15 10:11:25 -04:00
soc_info - > emac_pdata - > phy_id = DA830_EVM_PHY_ID ;
2009-06-03 18:41:53 -07:00
2010-03-25 17:43:48 -04:00
ret = davinci_cfg_reg_list ( da830_cpgmac_pins ) ;
2009-06-03 18:41:53 -07:00
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: cpgmac mux setup failed: %d \n " , __func__ , ret ) ;
2009-06-03 18:41:53 -07:00
ret = da8xx_register_emac ( ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: emac registration failed: %d \n " , __func__ , ret ) ;
2009-06-03 18:41:53 -07:00
ret = da8xx_register_watchdog ( ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: watchdog registration failed: %d \n " ,
__func__ , ret ) ;
2009-06-03 18:41:53 -07:00
2013-06-19 14:45:42 +05:30
davinci_serial_init ( da8xx_serial_device ) ;
2018-11-13 15:01:14 +01:00
nvmem_add_cell_table ( & da830_evm_nvmem_cell_table ) ;
nvmem_add_cell_lookups ( & da830_evm_nvmem_cell_lookup , 1 ) ;
2009-06-03 18:41:53 -07:00
i2c_register_board_info ( 1 , da830_evm_i2c_devices ,
ARRAY_SIZE ( da830_evm_i2c_devices ) ) ;
2009-08-11 17:01:59 -04:00
2010-03-25 17:43:48 -04:00
ret = davinci_cfg_reg_list ( da830_evm_mcasp1_pins ) ;
2009-08-11 17:01:59 -04:00
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: mcasp1 mux setup failed: %d \n " , __func__ , ret ) ;
2009-08-11 17:01:59 -04:00
2009-08-28 15:05:02 -07:00
da8xx_register_mcasp ( 1 , & da830_evm_snd_data ) ;
2009-09-15 18:10:20 -07:00
da830_evm_init_mmc ( ) ;
2009-09-15 18:15:06 -07:00
2009-09-15 18:15:54 -07:00
ret = da8xx_register_rtc ( ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: rtc setup failed: %d \n " , __func__ , ret ) ;
2011-02-24 10:53:27 +05:30
ARM: davinci: da8xx_register_spi() should not register SPI board info
Without this patch, da8xx_register_spi() registers the SPI board info,
the SPI controller, and sets its number of chipselect to the size of the
static spi_board_info array. This is bad because a SPI board info may
declare devices for different SPI buses, and because other code can also
call spi_register_board_info() (e.g. a daughter board might provide
additional SPI devices).
This patch removes the spi_register_board_info() call from
da8xx_register_spi(), renames this last one to da8xx_register_spi_bus()
to be more explicit, takes the number of chipselect as a function
parameter, and updates the impacted board-da8{3,5}0-evm.c, and
board-mityomapl138.c files accordingly. It also sets the SPI platform
data static, as it doesn't need to be exported.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
[nsekhar@ti.com: fixed conflicts with v3.7-rc7, converted to use pr_warn(),
modified print messages to use __func__]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2012-09-10 20:29:13 -04:00
ret = spi_register_board_info ( da830evm_spi_info ,
ARRAY_SIZE ( da830evm_spi_info ) ) ;
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: spi info registration failed: %d \n " ,
__func__ , ret ) ;
ARM: davinci: da8xx_register_spi() should not register SPI board info
Without this patch, da8xx_register_spi() registers the SPI board info,
the SPI controller, and sets its number of chipselect to the size of the
static spi_board_info array. This is bad because a SPI board info may
declare devices for different SPI buses, and because other code can also
call spi_register_board_info() (e.g. a daughter board might provide
additional SPI devices).
This patch removes the spi_register_board_info() call from
da8xx_register_spi(), renames this last one to da8xx_register_spi_bus()
to be more explicit, takes the number of chipselect as a function
parameter, and updates the impacted board-da8{3,5}0-evm.c, and
board-mityomapl138.c files accordingly. It also sets the SPI platform
data static, as it doesn't need to be exported.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
[nsekhar@ti.com: fixed conflicts with v3.7-rc7, converted to use pr_warn(),
modified print messages to use __func__]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2012-09-10 20:29:13 -04:00
ret = da8xx_register_spi_bus ( 0 , ARRAY_SIZE ( da830evm_spi_info ) ) ;
2011-02-24 10:53:27 +05:30
if ( ret )
2014-10-31 17:51:51 -07:00
pr_warn ( " %s: spi 0 registration failed: %d \n " , __func__ , ret ) ;
2016-10-26 21:41:55 +02:00
regulator_has_full_constraints ( ) ;
2009-06-03 18:41:53 -07:00
}
# ifdef CONFIG_SERIAL_8250_CONSOLE
static int __init da830_evm_console_init ( void )
{
2010-08-31 14:30:15 -04:00
if ( ! machine_is_davinci_da830_evm ( ) )
return 0 ;
2009-06-03 18:41:53 -07:00
return add_preferred_console ( " ttyS " , 2 , " 115200 " ) ;
}
console_initcall ( da830_evm_console_init ) ;
# endif
static void __init da830_evm_map_io ( void )
{
da830_init ( ) ;
}
2010-07-01 19:00:50 +05:30
MACHINE_START ( DAVINCI_DA830_EVM , " DaVinci DA830/OMAP-L137/AM17x EVM " )
2011-07-05 22:38:11 -04:00
. atag_offset = 0x100 ,
2009-06-03 18:41:53 -07:00
. map_io = da830_evm_map_io ,
2019-02-14 15:52:18 +01:00
. init_irq = da830_init_irq ,
2018-01-19 21:20:22 -06:00
. init_time = da830_init_time ,
2009-06-03 18:41:53 -07:00
. init_machine = da830_evm_init ,
2012-04-26 09:45:39 +08:00
. init_late = davinci_init_late ,
2011-07-05 22:28:08 -04:00
. dma_zone_size = SZ_128M ,
2009-06-03 18:41:53 -07:00
MACHINE_END