2019-06-04 11:11:33 +03:00
// SPDX-License-Identifier: GPL-2.0-only
2008-11-20 02:58:38 +03:00
/*
* Hardware definitions for Palm Tungsten | T5
*
* Author : Marek Vasut < marek . vasut @ gmail . com >
*
* Based on work of :
* Ales Snuparek < snuparek @ atlas . cz >
* Justin Kendrick < twilightsentry @ gmail . com >
* RichardT5 < richard_t5 @ users . sourceforge . net >
*
* ( find more info at www . hackndev . com )
*/
# include <linux/platform_device.h>
# include <linux/delay.h>
# include <linux/irq.h>
# include <linux/gpio_keys.h>
# include <linux/input.h>
2010-05-22 22:47:18 +04:00
# include <linux/memblock.h>
2008-11-20 02:58:38 +03:00
# include <linux/pda_power.h>
# include <linux/pwm_backlight.h>
# include <linux/gpio.h>
2010-06-04 05:07:33 +04:00
# include <linux/wm97xx.h>
2008-11-20 02:58:38 +03:00
# include <linux/power_supply.h>
# include <asm/mach-types.h>
# include <asm/mach/arch.h>
# include <asm/mach/map.h>
2015-01-30 12:45:33 +03:00
# include "pxa27x.h"
2008-11-20 02:58:38 +03:00
# include <mach/audio.h>
2015-01-30 12:45:33 +03:00
# include "palmt5.h"
2012-08-24 17:16:48 +04:00
# include <linux/platform_data/mmc-pxamci.h>
# include <linux/platform_data/video-pxafb.h>
# include <linux/platform_data/irda-pxaficp.h>
# include <linux/platform_data/keypad-pxa27x.h>
2015-01-30 12:45:33 +03:00
# include "udc.h"
2012-08-24 17:16:48 +04:00
# include <linux/platform_data/asoc-palm27x.h>
2015-01-30 12:45:33 +03:00
# include "palm27x.h"
2008-11-20 02:58:38 +03:00
# include "generic.h"
# include "devices.h"
/******************************************************************************
* Pin configuration
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static unsigned long palmt5_pin_config [ ] __initdata = {
/* MMC */
GPIO32_MMC_CLK ,
GPIO92_MMC_DAT_0 ,
GPIO109_MMC_DAT_1 ,
GPIO110_MMC_DAT_2 ,
GPIO111_MMC_DAT_3 ,
GPIO112_MMC_CMD ,
GPIO14_GPIO , /* SD detect */
GPIO114_GPIO , /* SD power */
GPIO115_GPIO , /* SD r/o switch */
/* AC97 */
GPIO28_AC97_BITCLK ,
GPIO29_AC97_SDATA_IN_0 ,
GPIO30_AC97_SDATA_OUT ,
GPIO31_AC97_SYNC ,
2009-05-22 03:39:10 +04:00
GPIO89_AC97_SYSCLK ,
2009-04-12 18:37:23 +04:00
GPIO95_AC97_nRESET ,
2008-11-20 02:58:38 +03:00
/* IrDA */
GPIO40_GPIO , /* ir disable */
GPIO46_FICP_RXD ,
GPIO47_FICP_TXD ,
/* USB */
GPIO15_GPIO , /* usb detect */
2009-04-12 18:37:23 +04:00
GPIO93_GPIO , /* usb power */
2008-11-20 02:58:38 +03:00
/* MATRIX KEYPAD */
2009-03-28 14:37:42 +03:00
GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH ,
GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH ,
GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH ,
GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH ,
2008-11-20 02:58:38 +03:00
GPIO103_KP_MKOUT_0 ,
GPIO104_KP_MKOUT_1 ,
GPIO105_KP_MKOUT_2 ,
/* LCD */
2010-01-04 06:37:14 +03:00
GPIOxx_LCD_TFT_16BPP ,
2008-11-20 02:58:38 +03:00
/* PWM */
GPIO16_PWM0_OUT ,
2009-07-16 21:37:29 +04:00
/* FFUART */
GPIO34_FFUART_RXD ,
GPIO39_FFUART_TXD ,
2008-11-20 02:58:38 +03:00
/* MISC */
GPIO10_GPIO , /* hotsync button */
GPIO90_GPIO , /* power detect */
GPIO107_GPIO , /* earphone detect */
} ;
/******************************************************************************
* GPIO keyboard
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-07-13 10:16:45 +04:00
# if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
2013-05-06 07:24:58 +04:00
static const unsigned int palmt5_matrix_keys [ ] = {
2008-11-20 02:58:38 +03:00
KEY ( 0 , 0 , KEY_POWER ) ,
KEY ( 0 , 1 , KEY_F1 ) ,
KEY ( 0 , 2 , KEY_ENTER ) ,
KEY ( 1 , 0 , KEY_F2 ) ,
KEY ( 1 , 1 , KEY_F3 ) ,
KEY ( 1 , 2 , KEY_F4 ) ,
KEY ( 2 , 0 , KEY_UP ) ,
KEY ( 2 , 2 , KEY_DOWN ) ,
KEY ( 3 , 0 , KEY_RIGHT ) ,
KEY ( 3 , 2 , KEY_LEFT ) ,
} ;
2013-05-06 07:24:58 +04:00
static struct matrix_keymap_data palmt5_matrix_keymap_data = {
. keymap = palmt5_matrix_keys ,
. keymap_size = ARRAY_SIZE ( palmt5_matrix_keys ) ,
} ;
2008-11-20 02:58:38 +03:00
static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
. matrix_key_rows = 4 ,
. matrix_key_cols = 3 ,
2013-05-06 07:24:58 +04:00
. matrix_keymap_data = & palmt5_matrix_keymap_data ,
2008-11-20 02:58:38 +03:00
. debounce_interval = 30 ,
} ;
2010-07-13 10:16:45 +04:00
static void __init palmt5_kpc_init ( void )
{
pxa_set_keypad_info ( & palmt5_keypad_platform_data ) ;
}
# else
static inline void palmt5_kpc_init ( void ) { }
# endif
2008-11-20 02:58:38 +03:00
/******************************************************************************
* GPIO keys
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-07-13 10:16:45 +04:00
# if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2008-11-20 02:58:38 +03:00
static struct gpio_keys_button palmt5_pxa_buttons [ ] = {
{ KEY_F8 , GPIO_NR_PALMT5_HOTSYNC_BUTTON_N , 1 , " HotSync Button " } ,
} ;
static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
. buttons = palmt5_pxa_buttons ,
. nbuttons = ARRAY_SIZE ( palmt5_pxa_buttons ) ,
} ;
static struct platform_device palmt5_pxa_keys = {
. name = " gpio-keys " ,
. id = - 1 ,
. dev = {
. platform_data = & palmt5_pxa_keys_data ,
} ,
} ;
2010-07-13 10:16:45 +04:00
static void __init palmt5_keys_init ( void )
2009-03-28 14:37:42 +03:00
{
2010-07-13 10:16:45 +04:00
platform_device_register ( & palmt5_pxa_keys ) ;
2009-03-28 14:37:42 +03:00
}
2010-07-13 10:16:45 +04:00
# else
static inline void palmt5_keys_init ( void ) { }
# endif
2009-03-28 14:37:42 +03:00
2008-11-20 02:58:38 +03:00
/******************************************************************************
* Machine init
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-05-22 21:18:57 +04:00
static void __init palmt5_reserve ( void )
{
2010-05-22 22:47:18 +04:00
memblock_reserve ( 0xa0200000 , 0x1000 ) ;
2010-05-22 21:18:57 +04:00
}
2018-12-02 11:43:23 +03:00
static struct gpiod_lookup_table palmt5_mci_gpio_table = {
. dev_id = " pxa2xx-mci.0 " ,
. table = {
GPIO_LOOKUP ( " gpio-pxa " , GPIO_NR_PALMT5_SD_DETECT_N ,
" cd " , GPIO_ACTIVE_LOW ) ,
GPIO_LOOKUP ( " gpio-pxa " , GPIO_NR_PALMT5_SD_READONLY ,
" wp " , GPIO_ACTIVE_LOW ) ,
2018-12-02 11:43:27 +03:00
GPIO_LOOKUP ( " gpio-pxa " , GPIO_NR_PALMT5_SD_POWER ,
" power " , GPIO_ACTIVE_HIGH ) ,
2018-12-02 11:43:23 +03:00
{ } ,
} ,
} ;
2008-11-20 02:58:38 +03:00
static void __init palmt5_init ( void )
{
pxa2xx_mfp_config ( ARRAY_AND_SIZE ( palmt5_pin_config ) ) ;
2009-11-09 08:34:08 +03:00
pxa_set_ffuart_info ( NULL ) ;
pxa_set_btuart_info ( NULL ) ;
pxa_set_stuart_info ( NULL ) ;
2018-12-02 11:43:27 +03:00
palm27x_mmc_init ( & palmt5_mci_gpio_table ) ;
2010-07-13 10:16:45 +04:00
palm27x_pm_init ( PALMT5_STR_BASE ) ;
palm27x_lcd_init ( - 1 , & palm_320x480_lcd_mode ) ;
palm27x_udc_init ( GPIO_NR_PALMT5_USB_DETECT_N ,
GPIO_NR_PALMT5_USB_PULLUP , 1 ) ;
palm27x_irda_init ( GPIO_NR_PALMT5_IR_DISABLE ) ;
palm27x_ac97_init ( PALMT5_BAT_MIN_VOLTAGE , PALMT5_BAT_MAX_VOLTAGE ,
GPIO_NR_PALMT5_EARPHONE_DETECT , 95 ) ;
palm27x_pwm_init ( GPIO_NR_PALMT5_BL_POWER , GPIO_NR_PALMT5_LCD_POWER ) ;
palm27x_power_init ( GPIO_NR_PALMT5_POWER_DETECT , - 1 ) ;
palm27x_pmic_init ( ) ;
palmt5_kpc_init ( ) ;
palmt5_keys_init ( ) ;
2008-11-20 02:58:38 +03:00
}
MACHINE_START ( PALMT5 , " Palm Tungsten|T5 " )
2011-07-06 06:38:15 +04:00
. atag_offset = 0x100 ,
2010-10-11 04:20:19 +04:00
. map_io = pxa27x_map_io ,
2010-05-22 21:18:57 +04:00
. reserve = palmt5_reserve ,
2012-01-04 02:53:48 +04:00
. nr_irqs = PXA_NR_IRQS ,
2008-11-20 02:58:38 +03:00
. init_irq = pxa27x_init_irq ,
2011-05-18 17:30:04 +04:00
. handle_irq = pxa27x_handle_irq ,
2012-11-08 23:40:59 +04:00
. init_time = pxa_timer_init ,
2011-11-04 18:15:53 +04:00
. init_machine = palmt5_init ,
. restart = pxa_restart ,
2008-11-20 02:58:38 +03:00
MACHINE_END