1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/income.c
5 * Support for Income s.r.o. SH-Dmaster PXA270 SBC
8 * Marek Vasut <marek.vasut@gmail.com>
9 * Pavel Revak <palo@bielyvlk.sk>
12 #include <linux/bitops.h>
13 #include <linux/delay.h>
14 #include <linux/gpio/machine.h>
15 #include <linux/init.h>
16 #include <linux/interrupt.h>
17 #include <linux/leds.h>
18 #include <linux/ioport.h>
19 #include <linux/kernel.h>
20 #include <linux/platform_device.h>
21 #include <linux/pwm.h>
22 #include <linux/pwm_backlight.h>
23 #include <linux/platform_data/i2c-pxa.h>
26 #include <asm/mach-types.h>
28 #include <mach/hardware.h>
29 #include <linux/platform_data/mmc-pxamci.h>
30 #include <linux/platform_data/usb-ohci-pxa27x.h>
32 #include "pxa27x-udc.h"
33 #include <linux/platform_data/video-pxafb.h>
38 #define GPIO114_INCOME_ETH_IRQ (114)
39 #define GPIO0_INCOME_SD_DETECT (0)
40 #define GPIO0_INCOME_SD_RO (1)
41 #define GPIO54_INCOME_LED_A (54)
42 #define GPIO55_INCOME_LED_B (55)
43 #define GPIO113_INCOME_TS_IRQ (113)
45 /******************************************************************************
46 * SD/MMC card controller
47 ******************************************************************************/
48 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
49 static struct pxamci_platform_data income_mci_platform_data
= {
50 .ocr_mask
= MMC_VDD_32_33
| MMC_VDD_33_34
,
51 .detect_delay_ms
= 200,
54 static struct gpiod_lookup_table income_mci_gpio_table
= {
55 .dev_id
= "pxa2xx-mci.0",
57 /* Card detect on GPIO 0 */
58 GPIO_LOOKUP("gpio-pxa", GPIO0_INCOME_SD_DETECT
,
59 "cd", GPIO_ACTIVE_LOW
),
60 /* Write protect on GPIO 1 */
61 GPIO_LOOKUP("gpio-pxa", GPIO0_INCOME_SD_RO
,
62 "wp", GPIO_ACTIVE_LOW
),
67 static void __init
income_mmc_init(void)
69 gpiod_add_lookup_table(&income_mci_gpio_table
);
70 pxa_set_mci_info(&income_mci_platform_data
);
73 static inline void income_mmc_init(void) {}
76 /******************************************************************************
78 ******************************************************************************/
79 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
80 static struct pxaohci_platform_data income_ohci_info
= {
81 .port_mode
= PMM_PERPORT_MODE
,
82 .flags
= ENABLE_PORT1
| POWER_CONTROL_LOW
| POWER_SENSE_LOW
,
85 static void __init
income_uhc_init(void)
87 pxa_set_ohci_info(&income_ohci_info
);
90 static inline void income_uhc_init(void) {}
93 /******************************************************************************
95 ******************************************************************************/
96 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
97 struct gpio_led income_gpio_leds
[] = {
99 .name
= "income:green:leda",
100 .default_trigger
= "none",
101 .gpio
= GPIO54_INCOME_LED_A
,
105 .name
= "income:green:ledb",
106 .default_trigger
= "none",
107 .gpio
= GPIO55_INCOME_LED_B
,
112 static struct gpio_led_platform_data income_gpio_led_info
= {
113 .leds
= income_gpio_leds
,
114 .num_leds
= ARRAY_SIZE(income_gpio_leds
),
117 static struct platform_device income_leds
= {
121 .platform_data
= &income_gpio_led_info
,
125 static void __init
income_led_init(void)
127 platform_device_register(&income_leds
);
130 static inline void income_led_init(void) {}
133 /******************************************************************************
135 ******************************************************************************/
136 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
137 static struct i2c_board_info __initdata income_i2c_devs
[] = {
139 I2C_BOARD_INFO("ds1340", 0x68),
141 I2C_BOARD_INFO("lm75", 0x4f),
145 static void __init
income_i2c_init(void)
147 pxa_set_i2c_info(NULL
);
148 pxa27x_set_i2c_power_info(NULL
);
149 i2c_register_board_info(0, ARRAY_AND_SIZE(income_i2c_devs
));
152 static inline void income_i2c_init(void) {}
155 /******************************************************************************
157 ******************************************************************************/
158 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
159 static struct pxafb_mode_info income_lcd_modes
[] = {
175 .sync
= FB_SYNC_VERT_HIGH_ACT
,
179 static struct pxafb_mach_info income_lcd_screen
= {
180 .modes
= income_lcd_modes
,
181 .num_modes
= ARRAY_SIZE(income_lcd_modes
),
182 .lcd_conn
= LCD_COLOR_TFT_18BPP
| LCD_PCLK_EDGE_FALL
,
185 static void __init
income_lcd_init(void)
187 pxa_set_fb_info(NULL
, &income_lcd_screen
);
190 static inline void income_lcd_init(void) {}
193 /******************************************************************************
195 ******************************************************************************/
196 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
197 static struct pwm_lookup income_pwm_lookup
[] = {
198 PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL
, 1000000,
199 PWM_POLARITY_NORMAL
),
202 static struct platform_pwm_backlight_data income_backlight_data
= {
203 .max_brightness
= 0x3ff,
204 .dft_brightness
= 0x1ff,
207 static struct platform_device income_backlight
= {
208 .name
= "pwm-backlight",
210 .parent
= &pxa27x_device_pwm0
.dev
,
211 .platform_data
= &income_backlight_data
,
215 static void __init
income_pwm_init(void)
217 pwm_add_table(income_pwm_lookup
, ARRAY_SIZE(income_pwm_lookup
));
218 platform_device_register(&income_backlight
);
221 static inline void income_pwm_init(void) {}
224 void __init
colibri_pxa270_income_boardinit(void)
226 pxa_set_ffuart_info(NULL
);
227 pxa_set_btuart_info(NULL
);
228 pxa_set_stuart_info(NULL
);