* [PATCH 02/13] [ARM] pxa/palm: Flip Palm LD,TX,T5,Z72 to Palm27x
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-08-04 3:14 ` Eric Miao
2010-07-29 3:16 ` [PATCH 03/13] [ARM] pxa/palm: Add core pmic support for Palm27x Marek Vasut
` (11 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/Kconfig | 4 +
arch/arm/mach-pxa/palmld.c | 258 +++----------------------------------
arch/arm/mach-pxa/palmt5.c | 275 +++------------------------------------
arch/arm/mach-pxa/palmtreo.c | 292 +++++-------------------------------------
arch/arm/mach-pxa/palmtx.c | 270 +++------------------------------------
arch/arm/mach-pxa/palmz72.c | 261 ++-----------------------------------
6 files changed, 109 insertions(+), 1251 deletions(-)
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 6f04f21..7aefb90 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -374,6 +374,7 @@ config MACH_PALMT5
depends on ARCH_PXA_PALM
select PXA27x
select IWMMXT
+ select MACH_PALM27X
help
Say Y here if you intend to run this kernel on a Palm Tungsten|T5
handheld computer.
@@ -384,6 +385,7 @@ config MACH_PALMTX
depends on ARCH_PXA_PALM
select PXA27x
select IWMMXT
+ select MACH_PALM27X
help
Say Y here if you intend to run this kernel on a Palm T|X
handheld computer.
@@ -394,6 +396,7 @@ config MACH_PALMZ72
depends on ARCH_PXA_PALM
select PXA27x
select IWMMXT
+ select MACH_PALM27X
help
Say Y here if you intend to run this kernel on Palm Zire 72
handheld computer.
@@ -404,6 +407,7 @@ config MACH_PALMLD
depends on ARCH_PXA_PALM
select PXA27x
select IWMMXT
+ select MACH_PALM27X
help
Say Y here if you intend to run this kernel on a Palm LifeDrive
handheld computer.
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 83a1a55..cac66ca 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -41,6 +41,7 @@
#include <mach/irda.h>
#include <mach/pxa27x_keypad.h>
#include <mach/palmasoc.h>
+#include <mach/palm27x.h>
#include "generic.h"
#include "devices.h"
@@ -161,17 +162,6 @@ static struct platform_device palmld_flash = {
};
/******************************************************************************
- * SD/MMC card controller
- ******************************************************************************/
-static struct pxamci_platform_data palmld_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
- .gpio_card_detect = GPIO_NR_PALMLD_SD_DETECT_N,
- .gpio_card_ro = GPIO_NR_PALMLD_SD_READONLY,
- .gpio_power = GPIO_NR_PALMLD_SD_POWER,
- .detect_delay_ms = 200,
-};
-
-/******************************************************************************
* GPIO keyboard
******************************************************************************/
static unsigned int palmld_matrix_keys[] = {
@@ -223,74 +213,6 @@ static struct platform_device palmld_pxa_keys = {
};
/******************************************************************************
- * Backlight
- ******************************************************************************/
-static int palmld_backlight_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMLD_BL_POWER, "BL POWER");
- if (ret)
- goto err;
- ret = gpio_direction_output(GPIO_NR_PALMLD_BL_POWER, 0);
- if (ret)
- goto err2;
- ret = gpio_request(GPIO_NR_PALMLD_LCD_POWER, "LCD POWER");
- if (ret)
- goto err2;
- ret = gpio_direction_output(GPIO_NR_PALMLD_LCD_POWER, 0);
- if (ret)
- goto err3;
-
- return 0;
-err3:
- gpio_free(GPIO_NR_PALMLD_LCD_POWER);
-err2:
- gpio_free(GPIO_NR_PALMLD_BL_POWER);
-err:
- return ret;
-}
-
-static int palmld_backlight_notify(struct device *dev, int brightness)
-{
- gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness);
- gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness);
- return brightness;
-}
-
-static void palmld_backlight_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMLD_BL_POWER);
- gpio_free(GPIO_NR_PALMLD_LCD_POWER);
-}
-
-static struct platform_pwm_backlight_data palmld_backlight_data = {
- .pwm_id = 0,
- .max_brightness = PALMLD_MAX_INTENSITY,
- .dft_brightness = PALMLD_MAX_INTENSITY,
- .pwm_period_ns = PALMLD_PERIOD_NS,
- .init = palmld_backlight_init,
- .notify = palmld_backlight_notify,
- .exit = palmld_backlight_exit,
-};
-
-static struct platform_device palmld_backlight = {
- .name = "pwm-backlight",
- .dev = {
- .parent = &pxa27x_device_pwm0.dev,
- .platform_data = &palmld_backlight_data,
- },
-};
-
-/******************************************************************************
- * IrDA
- ******************************************************************************/
-static struct pxaficp_platform_data palmld_ficp_platform_data = {
- .gpio_pwdown = GPIO_NR_PALMLD_IR_DISABLE,
- .transceiver_cap = IR_SIRMODE | IR_OFF,
-};
-
-/******************************************************************************
* LEDs
******************************************************************************/
struct gpio_led gpio_leds[] = {
@@ -319,112 +241,6 @@ static struct platform_device palmld_leds = {
};
/******************************************************************************
- * Power supply
- ******************************************************************************/
-static int power_supply_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMLD_POWER_DETECT, "CABLE_STATE_AC");
- if (ret)
- goto err1;
- ret = gpio_direction_input(GPIO_NR_PALMLD_POWER_DETECT);
- if (ret)
- goto err2;
-
- ret = gpio_request(GPIO_NR_PALMLD_USB_DETECT_N, "CABLE_STATE_USB");
- if (ret)
- goto err2;
- ret = gpio_direction_input(GPIO_NR_PALMLD_USB_DETECT_N);
- if (ret)
- goto err3;
-
- return 0;
-
-err3:
- gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
-err2:
- gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
-err1:
- return ret;
-}
-
-static int palmld_is_ac_online(void)
-{
- return gpio_get_value(GPIO_NR_PALMLD_POWER_DETECT);
-}
-
-static int palmld_is_usb_online(void)
-{
- return !gpio_get_value(GPIO_NR_PALMLD_USB_DETECT_N);
-}
-
-static void power_supply_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
- gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
-}
-
-static char *palmld_supplicants[] = {
- "main-battery",
-};
-
-static struct pda_power_pdata power_supply_info = {
- .init = power_supply_init,
- .is_ac_online = palmld_is_ac_online,
- .is_usb_online = palmld_is_usb_online,
- .exit = power_supply_exit,
- .supplied_to = palmld_supplicants,
- .num_supplicants = ARRAY_SIZE(palmld_supplicants),
-};
-
-static struct platform_device power_supply = {
- .name = "pda-power",
- .id = -1,
- .dev = {
- .platform_data = &power_supply_info,
- },
-};
-
-/******************************************************************************
- * WM97xx audio, battery
- ******************************************************************************/
-static struct wm97xx_batt_pdata palmld_batt_pdata = {
- .batt_aux = WM97XX_AUX_ID3,
- .temp_aux = WM97XX_AUX_ID2,
- .charge_gpio = -1,
- .max_voltage = PALMLD_BAT_MAX_VOLTAGE,
- .min_voltage = PALMLD_BAT_MIN_VOLTAGE,
- .batt_mult = 1000,
- .batt_div = 414,
- .temp_mult = 1,
- .temp_div = 1,
- .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
- .batt_name = "main-batt",
-};
-
-static struct wm97xx_pdata palmld_wm97xx_pdata = {
- .batt_pdata = &palmld_batt_pdata,
-};
-
-static pxa2xx_audio_ops_t palmld_ac97_pdata = {
- .reset_gpio = 95,
- .codec_pdata = { &palmld_wm97xx_pdata, },
-};
-
-static struct palm27x_asoc_info palmld_asoc_pdata = {
- .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT,
-};
-
-static struct platform_device palmld_asoc = {
- .name = "palm27x-asoc",
- .id = -1,
- .dev = {
- .platform_data = &palmld_asoc_pdata,
- },
-};
-
-/******************************************************************************
* HDD
******************************************************************************/
static struct platform_device palmld_hdd = {
@@ -433,57 +249,13 @@ static struct platform_device palmld_hdd = {
};
/******************************************************************************
- * Framebuffer
- ******************************************************************************/
-static struct pxafb_mode_info palmld_lcd_modes[] = {
-{
- .pixclock = 57692,
- .xres = 320,
- .yres = 480,
- .bpp = 16,
-
- .left_margin = 32,
- .right_margin = 1,
- .upper_margin = 7,
- .lower_margin = 1,
-
- .hsync_len = 4,
- .vsync_len = 1,
-},
-};
-
-static struct pxafb_mach_info palmld_lcd_screen = {
- .modes = palmld_lcd_modes,
- .num_modes = ARRAY_SIZE(palmld_lcd_modes),
- .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
-};
-
-/******************************************************************************
- * Power management - standby
- ******************************************************************************/
-static void __init palmld_pm_init(void)
-{
- static u32 resume[] = {
- 0xe3a00101, /* mov r0, #0x40000000 */
- 0xe380060f, /* orr r0, r0, #0x00f00000 */
- 0xe590f008, /* ldr pc, [r0, #0x08] */
- };
-
- /* copy the bootloader */
- memcpy(phys_to_virt(PALMLD_STR_BASE), resume, sizeof(resume));
-}
-
-/******************************************************************************
* Machine init
******************************************************************************/
static struct platform_device *devices[] __initdata = {
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
&palmld_pxa_keys,
#endif
- &palmld_backlight,
&palmld_leds,
- &power_supply,
- &palmld_asoc,
&palmld_hdd,
&palmld_flash,
};
@@ -509,21 +281,27 @@ static void __init palmld_map_io(void)
iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
}
+struct palm27x_handheld palmld = {
+ .mmc_detect = GPIO_NR_PALMLD_SD_DETECT_N,
+ .mmc_ro = GPIO_NR_PALMLD_SD_READONLY,
+ .mmc_power = GPIO_NR_PALMLD_SD_POWER,
+ .pm_str_base = PALMLD_STR_BASE,
+ .irda_pwdn = GPIO_NR_PALMLD_IR_DISABLE,
+ .batt_minv = PALMLD_BAT_MIN_VOLTAGE,
+ .batt_maxv = PALMLD_BAT_MAX_VOLTAGE,
+ .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT,
+ .bl_bl = GPIO_NR_PALMLD_BL_POWER,
+ .bl_lcd = GPIO_NR_PALMLD_LCD_POWER,
+ .power_ac = GPIO_NR_PALMLD_POWER_DETECT,
+ .power_usb = GPIO_NR_PALMLD_USB_DETECT_N,
+ .lcd_power = -1,
+};
+
static void __init palmld_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
-
- pxa_set_ffuart_info(NULL);
- pxa_set_btuart_info(NULL);
- pxa_set_stuart_info(NULL);
-
- palmld_pm_init();
- set_pxa_fb_info(&palmld_lcd_screen);
- pxa_set_mci_info(&palmld_mci_platform_data);
- pxa_set_ac97_info(&palmld_ac97_pdata);
- pxa_set_ficp_info(&palmld_ficp_platform_data);
+ palm27x_common_init(&palmld);
pxa_set_keypad_info(&palmld_keypad_platform_data);
-
platform_add_devices(devices, ARRAY_SIZE(devices));
}
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 0b36d7d..593f57c 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -41,6 +41,7 @@
#include <mach/pxa27x_keypad.h>
#include <mach/udc.h>
#include <mach/palmasoc.h>
+#include <mach/palm27x.h>
#include "generic.h"
#include "devices.h"
@@ -103,17 +104,6 @@ static unsigned long palmt5_pin_config[] __initdata = {
};
/******************************************************************************
- * SD/MMC card controller
- ******************************************************************************/
-static struct pxamci_platform_data palmt5_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
- .gpio_card_detect = GPIO_NR_PALMT5_SD_DETECT_N,
- .gpio_card_ro = GPIO_NR_PALMT5_SD_READONLY,
- .gpio_power = GPIO_NR_PALMT5_SD_POWER,
- .detect_delay_ms = 200,
-};
-
-/******************************************************************************
* GPIO keyboard
******************************************************************************/
static unsigned int palmt5_matrix_keys[] = {
@@ -162,259 +152,32 @@ static struct platform_device palmt5_pxa_keys = {
};
/******************************************************************************
- * Backlight
- ******************************************************************************/
-static int palmt5_backlight_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER");
- if (ret)
- goto err;
- ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0);
- if (ret)
- goto err2;
- ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER");
- if (ret)
- goto err2;
- ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0);
- if (ret)
- goto err3;
-
- return 0;
-err3:
- gpio_free(GPIO_NR_PALMT5_LCD_POWER);
-err2:
- gpio_free(GPIO_NR_PALMT5_BL_POWER);
-err:
- return ret;
-}
-
-static int palmt5_backlight_notify(struct device *dev, int brightness)
-{
- gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness);
- gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness);
- return brightness;
-}
-
-static void palmt5_backlight_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMT5_BL_POWER);
- gpio_free(GPIO_NR_PALMT5_LCD_POWER);
-}
-
-static struct platform_pwm_backlight_data palmt5_backlight_data = {
- .pwm_id = 0,
- .max_brightness = PALMT5_MAX_INTENSITY,
- .dft_brightness = PALMT5_MAX_INTENSITY,
- .pwm_period_ns = PALMT5_PERIOD_NS,
- .init = palmt5_backlight_init,
- .notify = palmt5_backlight_notify,
- .exit = palmt5_backlight_exit,
-};
-
-static struct platform_device palmt5_backlight = {
- .name = "pwm-backlight",
- .dev = {
- .parent = &pxa27x_device_pwm0.dev,
- .platform_data = &palmt5_backlight_data,
- },
-};
-
-/******************************************************************************
- * IrDA
- ******************************************************************************/
-static struct pxaficp_platform_data palmt5_ficp_platform_data = {
- .gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE,
- .transceiver_cap = IR_SIRMODE | IR_OFF,
-};
-
-/******************************************************************************
- * UDC
- ******************************************************************************/
-static struct gpio_vbus_mach_info palmt5_udc_info = {
- .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N,
- .gpio_vbus_inverted = 1,
- .gpio_pullup = GPIO_NR_PALMT5_USB_PULLUP,
-};
-
-static struct platform_device palmt5_gpio_vbus = {
- .name = "gpio-vbus",
- .id = -1,
- .dev = {
- .platform_data = &palmt5_udc_info,
- },
-};
-
-/******************************************************************************
- * Power supply
- ******************************************************************************/
-static int power_supply_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC");
- if (ret)
- goto err1;
- ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT);
- if (ret)
- goto err2;
-
- return 0;
-err2:
- gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
-err1:
- return ret;
-}
-
-static int palmt5_is_ac_online(void)
-{
- return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT);
-}
-
-static void power_supply_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
-}
-
-static char *palmt5_supplicants[] = {
- "main-battery",
-};
-
-static struct pda_power_pdata power_supply_info = {
- .init = power_supply_init,
- .is_ac_online = palmt5_is_ac_online,
- .exit = power_supply_exit,
- .supplied_to = palmt5_supplicants,
- .num_supplicants = ARRAY_SIZE(palmt5_supplicants),
-};
-
-static struct platform_device power_supply = {
- .name = "pda-power",
- .id = -1,
- .dev = {
- .platform_data = &power_supply_info,
- },
-};
-
-/******************************************************************************
- * WM97xx audio, battery
- ******************************************************************************/
-static struct wm97xx_batt_pdata palmt5_batt_pdata = {
- .batt_aux = WM97XX_AUX_ID3,
- .temp_aux = WM97XX_AUX_ID2,
- .charge_gpio = -1,
- .max_voltage = PALMT5_BAT_MAX_VOLTAGE,
- .min_voltage = PALMT5_BAT_MIN_VOLTAGE,
- .batt_mult = 1000,
- .batt_div = 414,
- .temp_mult = 1,
- .temp_div = 1,
- .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
- .batt_name = "main-batt",
-};
-
-static struct wm97xx_pdata palmt5_wm97xx_pdata = {
- .batt_pdata = &palmt5_batt_pdata,
-};
-
-static pxa2xx_audio_ops_t palmt5_ac97_pdata = {
- .reset_gpio = 95,
- .codec_pdata = { &palmt5_wm97xx_pdata, },
-};
-
-static struct palm27x_asoc_info palmt5_asoc_pdata = {
- .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT,
-};
-
-static struct platform_device palmt5_asoc = {
- .name = "palm27x-asoc",
- .id = -1,
- .dev = {
- .platform_data = &palmt5_asoc_pdata,
- },
-};
-
-/******************************************************************************
- * Framebuffer
- ******************************************************************************/
-static struct pxafb_mode_info palmt5_lcd_modes[] = {
-{
- .pixclock = 57692,
- .xres = 320,
- .yres = 480,
- .bpp = 16,
-
- .left_margin = 32,
- .right_margin = 1,
- .upper_margin = 7,
- .lower_margin = 1,
-
- .hsync_len = 4,
- .vsync_len = 1,
-},
-};
-
-static struct pxafb_mach_info palmt5_lcd_screen = {
- .modes = palmt5_lcd_modes,
- .num_modes = ARRAY_SIZE(palmt5_lcd_modes),
- .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
-};
-
-/******************************************************************************
- * Power management - standby
- ******************************************************************************/
-static void __init palmt5_pm_init(void)
-{
- static u32 resume[] = {
- 0xe3a00101, /* mov r0, #0x40000000 */
- 0xe380060f, /* orr r0, r0, #0x00f00000 */
- 0xe590f008, /* ldr pc, [r0, #0x08] */
- };
-
- /* copy the bootloader */
- memcpy(phys_to_virt(PALMT5_STR_BASE), resume, sizeof(resume));
-}
-
-/******************************************************************************
* Machine init
******************************************************************************/
-static struct platform_device *devices[] __initdata = {
-#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
- &palmt5_pxa_keys,
-#endif
- &palmt5_backlight,
- &power_supply,
- &palmt5_asoc,
- &palmt5_gpio_vbus,
+struct palm27x_handheld palmt5 = {
+ .mmc_detect = GPIO_NR_PALMT5_SD_DETECT_N,
+ .mmc_ro = GPIO_NR_PALMT5_SD_READONLY,
+ .mmc_power = GPIO_NR_PALMT5_SD_POWER,
+ .pm_str_base = PALMT5_STR_BASE,
+ .udc_detect = GPIO_NR_PALMT5_USB_DETECT_N,
+ .udc_pullup = GPIO_NR_PALMT5_USB_PULLUP,
+ .irda_pwdn = GPIO_NR_PALMT5_IR_DISABLE,
+ .batt_minv = PALMT5_BAT_MIN_VOLTAGE,
+ .batt_maxv = PALMT5_BAT_MAX_VOLTAGE,
+ .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT,
+ .bl_bl = GPIO_NR_PALMT5_BL_POWER,
+ .bl_lcd = GPIO_NR_PALMT5_LCD_POWER,
+ .power_ac = GPIO_NR_PALMT5_POWER_DETECT,
+ .power_usb = -1,
+ .lcd_power = -1,
};
-/* setup udc GPIOs initial state */
-static void __init palmt5_udc_init(void)
-{
- if (!gpio_request(GPIO_NR_PALMT5_USB_PULLUP, "UDC Vbus")) {
- gpio_direction_output(GPIO_NR_PALMT5_USB_PULLUP, 1);
- gpio_free(GPIO_NR_PALMT5_USB_PULLUP);
- }
-}
-
static void __init palmt5_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
-
- pxa_set_ffuart_info(NULL);
- pxa_set_btuart_info(NULL);
- pxa_set_stuart_info(NULL);
-
- palmt5_pm_init();
- set_pxa_fb_info(&palmt5_lcd_screen);
- pxa_set_mci_info(&palmt5_mci_platform_data);
- palmt5_udc_init();
- pxa_set_ac97_info(&palmt5_ac97_pdata);
- pxa_set_ficp_info(&palmt5_ficp_platform_data);
+ palm27x_common_init(&palmt5);
pxa_set_keypad_info(&palmt5_keypad_platform_data);
-
- platform_add_devices(devices, ARRAY_SIZE(devices));
+ platform_device_register(&palmt5_pxa_keys);
}
MACHINE_START(PALMT5, "Palm Tungsten|T5")
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 4eb0258..dcb5f93 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -44,6 +44,7 @@
#include <mach/pxa2xx-regs.h>
#include <mach/palmasoc.h>
#include <mach/camera.h>
+#include <mach/palm27x.h>
#include <sound/pxa2xx-lib.h>
@@ -158,28 +159,6 @@ static unsigned long centro685_pin_config[] __initdata = {
#endif /* CONFIG_MACH_CENTRO */
/******************************************************************************
- * SD/MMC card controller
- ******************************************************************************/
-#ifdef CONFIG_MACH_TREO680
-static struct pxamci_platform_data treo680_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
- .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
- .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY,
- .gpio_power = GPIO_NR_TREO680_SD_POWER,
-};
-#endif /* CONFIG_MACH_TREO680 */
-
-#ifdef CONFIG_MACH_CENTRO
-static struct pxamci_platform_data centro_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
- .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
- .gpio_card_ro = -1,
- .gpio_power = GPIO_NR_CENTRO_SD_POWER,
- .gpio_power_invert = 1,
-};
-#endif /* CONFIG_MACH_CENTRO */
-
-/******************************************************************************
* GPIO keyboard
******************************************************************************/
#ifdef CONFIG_MACH_TREO680
@@ -327,83 +306,6 @@ static struct pxa27x_keypad_platform_data centro_keypad_platform_data = {
#endif /* CONFIG_MACH_CENTRO */
/******************************************************************************
- * aSoC audio
- ******************************************************************************/
-
-static pxa2xx_audio_ops_t treo_ac97_pdata = {
- .reset_gpio = 95,
-};
-
-/******************************************************************************
- * Backlight
- ******************************************************************************/
-static int treo_backlight_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER");
- if (ret)
- goto err;
- ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0);
- if (ret)
- goto err2;
-
- return 0;
-
-err2:
- gpio_free(GPIO_NR_TREO_BL_POWER);
-err:
- return ret;
-}
-
-static int treo_backlight_notify(struct device *dev, int brightness)
-{
- gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
- return TREO_MAX_INTENSITY - brightness;
-};
-
-static void treo_backlight_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_TREO_BL_POWER);
-}
-
-static struct platform_pwm_backlight_data treo_backlight_data = {
- .pwm_id = 0,
- .max_brightness = TREO_MAX_INTENSITY,
- .dft_brightness = TREO_DEFAULT_INTENSITY,
- .pwm_period_ns = TREO_PERIOD_NS,
- .init = treo_backlight_init,
- .notify = treo_backlight_notify,
- .exit = treo_backlight_exit,
-};
-
-static struct platform_device treo_backlight = {
- .name = "pwm-backlight",
- .dev = {
- .parent = &pxa27x_device_pwm0.dev,
- .platform_data = &treo_backlight_data,
- },
-};
-
-/******************************************************************************
- * IrDA
- ******************************************************************************/
-static struct pxaficp_platform_data treo_ficp_info = {
- .gpio_pwdown = GPIO_NR_TREO_IR_EN,
- .transceiver_cap = IR_SIRMODE | IR_OFF,
-};
-
-/******************************************************************************
- * UDC
- ******************************************************************************/
-static struct pxa2xx_udc_mach_info treo_udc_info __initdata = {
- .gpio_vbus = GPIO_NR_TREO_USB_DETECT,
- .gpio_vbus_inverted = 1,
- .gpio_pullup = GPIO_NR_TREO_USB_PULLUP,
-};
-
-
-/******************************************************************************
* USB host
******************************************************************************/
#ifdef CONFIG_MACH_TREO680
@@ -415,58 +317,6 @@ static struct pxaohci_platform_data treo680_ohci_info = {
#endif /* CONFIG_MACH_TREO680 */
/******************************************************************************
- * Power supply
- ******************************************************************************/
-static int power_supply_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC");
- if (ret)
- goto err1;
- ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT);
- if (ret)
- goto err2;
-
- return 0;
-
-err2:
- gpio_free(GPIO_NR_TREO_POWER_DETECT);
-err1:
- return ret;
-}
-
-static int treo_is_ac_online(void)
-{
- return gpio_get_value(GPIO_NR_TREO_POWER_DETECT);
-}
-
-static void power_supply_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_TREO_POWER_DETECT);
-}
-
-static char *treo_supplicants[] = {
- "main-battery",
-};
-
-static struct pda_power_pdata power_supply_info = {
- .init = power_supply_init,
- .is_ac_online = treo_is_ac_online,
- .exit = power_supply_exit,
- .supplied_to = treo_supplicants,
- .num_supplicants = ARRAY_SIZE(treo_supplicants),
-};
-
-static struct platform_device power_supply = {
- .name = "pda-power",
- .id = -1,
- .dev = {
- .platform_data = &power_supply_info,
- },
-};
-
-/******************************************************************************
* Vibra and LEDs
******************************************************************************/
#ifdef CONFIG_MACH_TREO680
@@ -537,60 +387,8 @@ static struct platform_device centro_leds = {
#endif /* CONFIG_MACH_CENTRO */
/******************************************************************************
- * Framebuffer
- ******************************************************************************/
-/* TODO: add support for 324x324 */
-static struct pxafb_mode_info treo_lcd_modes[] = {
-{
- .pixclock = 86538,
- .xres = 320,
- .yres = 320,
- .bpp = 16,
-
- .left_margin = 20,
- .right_margin = 8,
- .upper_margin = 8,
- .lower_margin = 5,
-
- .hsync_len = 4,
- .vsync_len = 1,
-},
-};
-
-static void treo_lcd_power(int on, struct fb_var_screeninfo *info)
-{
- gpio_set_value(GPIO_NR_TREO_BL_POWER, on);
-}
-
-static struct pxafb_mach_info treo_lcd_screen = {
- .modes = treo_lcd_modes,
- .num_modes = ARRAY_SIZE(treo_lcd_modes),
- .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
-};
-
-/******************************************************************************
- * Power management - standby
- ******************************************************************************/
-static void __init treo_pm_init(void)
-{
- static u32 resume[] = {
- 0xe3a00101, /* mov r0, #0x40000000 */
- 0xe380060f, /* orr r0, r0, #0x00f00000 */
- 0xe590f008, /* ldr pc, [r0, #0x08] */
- };
-
- /* this is where the bootloader jumps */
- memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume));
-}
-
-/******************************************************************************
* Machine init
******************************************************************************/
-static struct platform_device *treo_devices[] __initdata = {
- &treo_backlight,
- &power_supply,
-};
-
#ifdef CONFIG_MACH_TREO680
static struct platform_device *treo680_devices[] __initdata = {
&treo680_leds,
@@ -603,62 +401,29 @@ static struct platform_device *centro_devices[] __initdata = {
};
#endif /* CONFIG_MACH_CENTRO */
-/* setup udc GPIOs initial state */
-static void __init treo_udc_init(void)
-{
- if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) {
- gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1);
- gpio_free(GPIO_NR_TREO_USB_PULLUP);
- }
-}
-
-static void __init treo_lcd_power_init(void)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER");
- if (ret) {
- pr_err("Treo680: LCD power GPIO request failed!\n");
- return;
- }
-
- ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0);
- if (ret) {
- pr_err("Treo680: setting LCD power GPIO direction failed!\n");
- gpio_free(GPIO_NR_TREO_LCD_POWER);
- return;
- }
-
- treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
-}
-
-static void __init treo_init(void)
-{
- pxa_set_ffuart_info(NULL);
- pxa_set_btuart_info(NULL);
- pxa_set_stuart_info(NULL);
-
- treo_pm_init();
- pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
- treo_lcd_power_init();
- set_pxa_fb_info(&treo_lcd_screen);
- treo_udc_init();
- pxa_set_udc_info(&treo_udc_info);
- pxa_set_ac97_info(&treo_ac97_pdata);
- pxa_set_ficp_info(&treo_ficp_info);
-
- platform_add_devices(ARRAY_AND_SIZE(treo_devices));
-}
-
#ifdef CONFIG_MACH_TREO680
+struct palm27x_handheld palmtreo680 = {
+ .mmc_detect = GPIO_NR_TREO_SD_DETECT_N,
+ .mmc_ro = GPIO_NR_TREO680_SD_READONLY,
+ .mmc_power = GPIO_NR_TREO680_SD_POWER,
+ .pm_str_base = TREO_STR_BASE,
+ .udc_detect = GPIO_NR_TREO_USB_DETECT,
+ .udc_pullup = GPIO_NR_TREO_USB_PULLUP,
+ .irda_pwdn = GPIO_NR_TREO_IR_EN,
+ .bl_bl = GPIO_NR_TREO_BL_POWER,
+ .bl_lcd = -1,
+ .power_ac = GPIO_NR_TREO_POWER_DETECT,
+ .power_usb = -1,
+ .lcd_power = GPIO_NR_TREO_BL_POWER,
+};
+
static void __init treo680_init(void)
{
- treo_init();
+ pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
- pxa_set_mci_info(&treo680_mci_platform_data);
+ palm27x_common_init(&palmtreo680);
pxa_set_keypad_info(&treo680_keypad_platform_data);
pxa_set_ohci_info(&treo680_ohci_info);
-
platform_add_devices(ARRAY_AND_SIZE(treo680_devices));
}
@@ -674,14 +439,27 @@ MACHINE_END
#endif /* CONFIG_MACH_TREO680 */
#ifdef CONFIG_MACH_CENTRO
+struct palm27x_handheld palmcentro = {
+ .mmc_detect = GPIO_NR_TREO_SD_DETECT_N,
+ .mmc_ro = -1,
+ .mmc_power = GPIO_NR_CENTRO_SD_POWER,
+ .pm_str_base = TREO_STR_BASE,
+ .udc_detect = GPIO_NR_TREO_USB_DETECT,
+ .udc_pullup = GPIO_NR_TREO_USB_PULLUP,
+ .irda_pwdn = GPIO_NR_TREO_IR_EN,
+ .bl_bl = GPIO_NR_TREO_BL_POWER,
+ .bl_lcd = -1,
+ .power_ac = GPIO_NR_TREO_POWER_DETECT,
+ .power_usb = -1,
+ .lcd_power = GPIO_NR_TREO_BL_POWER,
+};
+
static void __init centro_init(void)
{
- treo_init();
+ pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
- pxa_set_mci_info(¢ro_mci_platform_data);
-
+ palm27x_common_init(&palmcentro);
pxa_set_keypad_info(¢ro_keypad_platform_data);
-
platform_add_devices(ARRAY_AND_SIZE(centro_devices));
}
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index a5429cd..f8ddffe 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -46,6 +46,7 @@
#include <mach/pxa27x_keypad.h>
#include <mach/udc.h>
#include <mach/palmasoc.h>
+#include <mach/palm27x.h>
#include "generic.h"
#include "devices.h"
@@ -163,17 +164,6 @@ static struct platform_device palmtx_flash = {
};
/******************************************************************************
- * SD/MMC card controller
- ******************************************************************************/
-static struct pxamci_platform_data palmtx_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
- .gpio_card_detect = GPIO_NR_PALMTX_SD_DETECT_N,
- .gpio_card_ro = GPIO_NR_PALMTX_SD_READONLY,
- .gpio_power = GPIO_NR_PALMTX_SD_POWER,
- .detect_delay_ms = 200,
-};
-
-/******************************************************************************
* GPIO keyboard
******************************************************************************/
static unsigned int palmtx_matrix_keys[] = {
@@ -222,207 +212,6 @@ static struct platform_device palmtx_pxa_keys = {
};
/******************************************************************************
- * Backlight
- ******************************************************************************/
-static int palmtx_backlight_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER");
- if (ret)
- goto err;
- ret = gpio_direction_output(GPIO_NR_PALMTX_BL_POWER, 0);
- if (ret)
- goto err2;
- ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER");
- if (ret)
- goto err2;
- ret = gpio_direction_output(GPIO_NR_PALMTX_LCD_POWER, 0);
- if (ret)
- goto err3;
-
- return 0;
-err3:
- gpio_free(GPIO_NR_PALMTX_LCD_POWER);
-err2:
- gpio_free(GPIO_NR_PALMTX_BL_POWER);
-err:
- return ret;
-}
-
-static int palmtx_backlight_notify(struct device *dev, int brightness)
-{
- gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness);
- gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness);
- return brightness;
-}
-
-static void palmtx_backlight_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMTX_BL_POWER);
- gpio_free(GPIO_NR_PALMTX_LCD_POWER);
-}
-
-static struct platform_pwm_backlight_data palmtx_backlight_data = {
- .pwm_id = 0,
- .max_brightness = PALMTX_MAX_INTENSITY,
- .dft_brightness = PALMTX_MAX_INTENSITY,
- .pwm_period_ns = PALMTX_PERIOD_NS,
- .init = palmtx_backlight_init,
- .notify = palmtx_backlight_notify,
- .exit = palmtx_backlight_exit,
-};
-
-static struct platform_device palmtx_backlight = {
- .name = "pwm-backlight",
- .dev = {
- .parent = &pxa27x_device_pwm0.dev,
- .platform_data = &palmtx_backlight_data,
- },
-};
-
-/******************************************************************************
- * IrDA
- ******************************************************************************/
-static struct pxaficp_platform_data palmtx_ficp_platform_data = {
- .gpio_pwdown = GPIO_NR_PALMTX_IR_DISABLE,
- .transceiver_cap = IR_SIRMODE | IR_OFF,
-};
-
-/******************************************************************************
- * UDC
- ******************************************************************************/
-static struct gpio_vbus_mach_info palmtx_udc_info = {
- .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N,
- .gpio_vbus_inverted = 1,
- .gpio_pullup = GPIO_NR_PALMTX_USB_PULLUP,
-};
-
-static struct platform_device palmtx_gpio_vbus = {
- .name = "gpio-vbus",
- .id = -1,
- .dev = {
- .platform_data = &palmtx_udc_info,
- },
-};
-
-/******************************************************************************
- * Power supply
- ******************************************************************************/
-static int power_supply_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC");
- if (ret)
- goto err1;
- ret = gpio_direction_input(GPIO_NR_PALMTX_POWER_DETECT);
- if (ret)
- goto err2;
-
- return 0;
-
-err2:
- gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
-err1:
- return ret;
-}
-
-static int palmtx_is_ac_online(void)
-{
- return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT);
-}
-
-static void power_supply_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
-}
-
-static char *palmtx_supplicants[] = {
- "main-battery",
-};
-
-static struct pda_power_pdata power_supply_info = {
- .init = power_supply_init,
- .is_ac_online = palmtx_is_ac_online,
- .exit = power_supply_exit,
- .supplied_to = palmtx_supplicants,
- .num_supplicants = ARRAY_SIZE(palmtx_supplicants),
-};
-
-static struct platform_device power_supply = {
- .name = "pda-power",
- .id = -1,
- .dev = {
- .platform_data = &power_supply_info,
- },
-};
-
-/******************************************************************************
- * WM97xx audio, battery
- ******************************************************************************/
-static struct wm97xx_batt_pdata palmtx_batt_pdata = {
- .batt_aux = WM97XX_AUX_ID3,
- .temp_aux = WM97XX_AUX_ID2,
- .charge_gpio = -1,
- .max_voltage = PALMTX_BAT_MAX_VOLTAGE,
- .min_voltage = PALMTX_BAT_MIN_VOLTAGE,
- .batt_mult = 1000,
- .batt_div = 414,
- .temp_mult = 1,
- .temp_div = 1,
- .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
- .batt_name = "main-batt",
-};
-
-static struct wm97xx_pdata palmtx_wm97xx_pdata = {
- .batt_pdata = &palmtx_batt_pdata,
-};
-
-static pxa2xx_audio_ops_t palmtx_ac97_pdata = {
- .reset_gpio = 95,
- .codec_pdata = { &palmtx_wm97xx_pdata, },
-};
-
-static struct palm27x_asoc_info palmtx_asoc_pdata = {
- .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT,
-};
-
-static struct platform_device palmtx_asoc = {
- .name = "palm27x-asoc",
- .id = -1,
- .dev = {
- .platform_data = &palmtx_asoc_pdata,
- },
-};
-
-/******************************************************************************
- * Framebuffer
- ******************************************************************************/
-static struct pxafb_mode_info palmtx_lcd_modes[] = {
-{
- .pixclock = 57692,
- .xres = 320,
- .yres = 480,
- .bpp = 16,
-
- .left_margin = 32,
- .right_margin = 1,
- .upper_margin = 7,
- .lower_margin = 1,
-
- .hsync_len = 4,
- .vsync_len = 1,
-},
-};
-
-static struct pxafb_mach_info palmtx_lcd_screen = {
- .modes = palmtx_lcd_modes,
- .num_modes = ARRAY_SIZE(palmtx_lcd_modes),
- .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
-};
-
-/******************************************************************************
* NAND Flash
******************************************************************************/
static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
@@ -484,20 +273,6 @@ static struct platform_device palmtx_nand = {
}
};
-/******************************************************************************
- * Power management - standby
- ******************************************************************************/
-static void __init palmtx_pm_init(void)
-{
- static u32 resume[] = {
- 0xe3a00101, /* mov r0, #0x40000000 */
- 0xe380060f, /* orr r0, r0, #0x00f00000 */
- 0xe590f008, /* ldr pc, [r0, #0x08] */
- };
-
- /* copy the bootloader */
- memcpy(phys_to_virt(PALMTX_STR_BASE), resume, sizeof(resume));
-}
/******************************************************************************
* Machine init
@@ -506,10 +281,6 @@ static struct platform_device *devices[] __initdata = {
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
&palmtx_pxa_keys,
#endif
- &palmtx_backlight,
- &power_supply,
- &palmtx_asoc,
- &palmtx_gpio_vbus,
&palmtx_flash,
&palmtx_nand,
};
@@ -539,32 +310,29 @@ static void __init palmtx_map_io(void)
iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
}
-/* setup udc GPIOs initial state */
-static void __init palmtx_udc_init(void)
-{
- if (!gpio_request(GPIO_NR_PALMTX_USB_PULLUP, "UDC Vbus")) {
- gpio_direction_output(GPIO_NR_PALMTX_USB_PULLUP, 1);
- gpio_free(GPIO_NR_PALMTX_USB_PULLUP);
- }
-}
-
+struct palm27x_handheld palmtx = {
+ .mmc_detect = GPIO_NR_PALMTX_SD_DETECT_N,
+ .mmc_ro = GPIO_NR_PALMTX_SD_READONLY,
+ .mmc_power = GPIO_NR_PALMTX_SD_POWER,
+ .pm_str_base = PALMTX_STR_BASE,
+ .udc_detect = GPIO_NR_PALMTX_USB_DETECT_N,
+ .udc_pullup = GPIO_NR_PALMTX_USB_PULLUP,
+ .irda_pwdn = GPIO_NR_PALMTX_IR_DISABLE,
+ .batt_minv = PALMTX_BAT_MIN_VOLTAGE,
+ .batt_maxv = PALMTX_BAT_MAX_VOLTAGE,
+ .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT,
+ .bl_bl = GPIO_NR_PALMTX_BL_POWER,
+ .bl_lcd = GPIO_NR_PALMTX_LCD_POWER,
+ .power_ac = GPIO_NR_PALMTX_POWER_DETECT,
+ .power_usb = -1,
+ .lcd_power = -1,
+};
static void __init palmtx_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
-
- pxa_set_ffuart_info(NULL);
- pxa_set_btuart_info(NULL);
- pxa_set_stuart_info(NULL);
-
- palmtx_pm_init();
- set_pxa_fb_info(&palmtx_lcd_screen);
- pxa_set_mci_info(&palmtx_mci_platform_data);
- palmtx_udc_init();
- pxa_set_ac97_info(&palmtx_ac97_pdata);
- pxa_set_ficp_info(&palmtx_ficp_platform_data);
+ palm27x_common_init(&palmtx);
pxa_set_keypad_info(&palmtx_keypad_platform_data);
-
platform_add_devices(devices, ARRAY_SIZE(devices));
}
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index b78c6b4..10b06ad 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -44,6 +44,7 @@
#include <mach/pxa27x_keypad.h>
#include <mach/udc.h>
#include <mach/palmasoc.h>
+#include <mach/palm27x.h>
#include <mach/pm.h>
@@ -109,19 +110,6 @@ static unsigned long palmz72_pin_config[] __initdata = {
};
/******************************************************************************
- * SD/MMC card controller
- ******************************************************************************/
-/* SD_POWER is not actually power, but it is more like chip
- * select, i.e. it is inverted */
-static struct pxamci_platform_data palmz72_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
- .gpio_card_detect = GPIO_NR_PALMZ72_SD_DETECT_N,
- .gpio_card_ro = GPIO_NR_PALMZ72_SD_RO,
- .gpio_power = GPIO_NR_PALMZ72_SD_POWER_N,
- .gpio_power_invert = 1,
-};
-
-/******************************************************************************
* GPIO keyboard
******************************************************************************/
static unsigned int palmz72_matrix_keys[] = {
@@ -150,74 +138,6 @@ static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
};
/******************************************************************************
- * Backlight
- ******************************************************************************/
-static int palmz72_backlight_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMZ72_BL_POWER, "BL POWER");
- if (ret)
- goto err;
- ret = gpio_direction_output(GPIO_NR_PALMZ72_BL_POWER, 0);
- if (ret)
- goto err2;
- ret = gpio_request(GPIO_NR_PALMZ72_LCD_POWER, "LCD POWER");
- if (ret)
- goto err2;
- ret = gpio_direction_output(GPIO_NR_PALMZ72_LCD_POWER, 0);
- if (ret)
- goto err3;
-
- return 0;
-err3:
- gpio_free(GPIO_NR_PALMZ72_LCD_POWER);
-err2:
- gpio_free(GPIO_NR_PALMZ72_BL_POWER);
-err:
- return ret;
-}
-
-static int palmz72_backlight_notify(struct device *dev, int brightness)
-{
- gpio_set_value(GPIO_NR_PALMZ72_BL_POWER, brightness);
- gpio_set_value(GPIO_NR_PALMZ72_LCD_POWER, brightness);
- return brightness;
-}
-
-static void palmz72_backlight_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMZ72_BL_POWER);
- gpio_free(GPIO_NR_PALMZ72_LCD_POWER);
-}
-
-static struct platform_pwm_backlight_data palmz72_backlight_data = {
- .pwm_id = 0,
- .max_brightness = PALMZ72_MAX_INTENSITY,
- .dft_brightness = PALMZ72_MAX_INTENSITY,
- .pwm_period_ns = PALMZ72_PERIOD_NS,
- .init = palmz72_backlight_init,
- .notify = palmz72_backlight_notify,
- .exit = palmz72_backlight_exit,
-};
-
-static struct platform_device palmz72_backlight = {
- .name = "pwm-backlight",
- .dev = {
- .parent = &pxa27x_device_pwm0.dev,
- .platform_data = &palmz72_backlight_data,
- },
-};
-
-/******************************************************************************
- * IrDA
- ******************************************************************************/
-static struct pxaficp_platform_data palmz72_ficp_platform_data = {
- .gpio_pwdown = GPIO_NR_PALMZ72_IR_DISABLE,
- .transceiver_cap = IR_SIRMODE | IR_OFF,
-};
-
-/******************************************************************************
* LEDs
******************************************************************************/
static struct gpio_led gpio_leds[] = {
@@ -241,145 +161,6 @@ static struct platform_device palmz72_leds = {
}
};
-/******************************************************************************
- * UDC
- ******************************************************************************/
-static struct gpio_vbus_mach_info palmz72_udc_info = {
- .gpio_vbus = GPIO_NR_PALMZ72_USB_DETECT_N,
- .gpio_pullup = GPIO_NR_PALMZ72_USB_PULLUP,
-};
-
-static struct platform_device palmz72_gpio_vbus = {
- .name = "gpio-vbus",
- .id = -1,
- .dev = {
- .platform_data = &palmz72_udc_info,
- },
-};
-
-/******************************************************************************
- * Power supply
- ******************************************************************************/
-static int power_supply_init(struct device *dev)
-{
- int ret;
-
- ret = gpio_request(GPIO_NR_PALMZ72_POWER_DETECT, "CABLE_STATE_AC");
- if (ret)
- goto err1;
- ret = gpio_direction_input(GPIO_NR_PALMZ72_POWER_DETECT);
- if (ret)
- goto err2;
-
- ret = gpio_request(GPIO_NR_PALMZ72_USB_DETECT_N, "CABLE_STATE_USB");
- if (ret)
- goto err2;
- ret = gpio_direction_input(GPIO_NR_PALMZ72_USB_DETECT_N);
- if (ret)
- goto err3;
-
- return 0;
-err3:
- gpio_free(GPIO_NR_PALMZ72_USB_DETECT_N);
-err2:
- gpio_free(GPIO_NR_PALMZ72_POWER_DETECT);
-err1:
- return ret;
-}
-
-static int palmz72_is_ac_online(void)
-{
- return gpio_get_value(GPIO_NR_PALMZ72_POWER_DETECT);
-}
-
-static int palmz72_is_usb_online(void)
-{
- return !gpio_get_value(GPIO_NR_PALMZ72_USB_DETECT_N);
-}
-
-static void power_supply_exit(struct device *dev)
-{
- gpio_free(GPIO_NR_PALMZ72_USB_DETECT_N);
- gpio_free(GPIO_NR_PALMZ72_POWER_DETECT);
-}
-
-static char *palmz72_supplicants[] = {
- "main-battery",
-};
-
-static struct pda_power_pdata power_supply_info = {
- .init = power_supply_init,
- .is_ac_online = palmz72_is_ac_online,
- .is_usb_online = palmz72_is_usb_online,
- .exit = power_supply_exit,
- .supplied_to = palmz72_supplicants,
- .num_supplicants = ARRAY_SIZE(palmz72_supplicants),
-};
-
-static struct platform_device power_supply = {
- .name = "pda-power",
- .id = -1,
- .dev = {
- .platform_data = &power_supply_info,
- },
-};
-
-/******************************************************************************
- * WM97xx audio, battery
- ******************************************************************************/
-static struct wm97xx_batt_pdata palmz72_batt_pdata = {
- .batt_aux = WM97XX_AUX_ID3,
- .temp_aux = WM97XX_AUX_ID2,
- .charge_gpio = -1,
- .max_voltage = PALMZ72_BAT_MAX_VOLTAGE,
- .min_voltage = PALMZ72_BAT_MIN_VOLTAGE,
- .batt_mult = 1000,
- .batt_div = 414,
- .temp_mult = 1,
- .temp_div = 1,
- .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
- .batt_name = "main-batt",
-};
-
-static struct wm97xx_pdata palmz72_wm97xx_pdata = {
- .batt_pdata = &palmz72_batt_pdata,
-};
-
-static pxa2xx_audio_ops_t palmz72_ac97_pdata = {
- .codec_pdata = { &palmz72_wm97xx_pdata, },
-};
-
-static struct platform_device palmz72_asoc = {
- .name = "palm27x-asoc",
- .id = -1,
-};
-
-/******************************************************************************
- * Framebuffer
- ******************************************************************************/
-static struct pxafb_mode_info palmz72_lcd_modes[] = {
-{
- .pixclock = 115384,
- .xres = 320,
- .yres = 320,
- .bpp = 16,
-
- .left_margin = 27,
- .right_margin = 7,
- .upper_margin = 7,
- .lower_margin = 8,
-
- .hsync_len = 6,
- .vsync_len = 1,
-},
-};
-
-static struct pxafb_mach_info palmz72_lcd_screen = {
- .modes = palmz72_lcd_modes,
- .num_modes = ARRAY_SIZE(palmz72_lcd_modes),
- .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
-};
-
#ifdef CONFIG_PM
/* We have some black magic here
@@ -457,39 +238,25 @@ device_initcall(palmz72_pm_init);
/******************************************************************************
* Machine init
******************************************************************************/
-static struct platform_device *devices[] __initdata = {
- &palmz72_backlight,
- &palmz72_leds,
- &palmz72_asoc,
- &power_supply,
- &palmz72_gpio_vbus,
+struct palm27x_handheld palmz72 = {
+ .mmc_detect = GPIO_NR_PALMZ72_SD_DETECT_N,
+ .mmc_ro = GPIO_NR_PALMZ72_SD_RO,
+ .mmc_power = GPIO_NR_PALMZ72_SD_POWER_N,
+ .pm_str_base = 0,
+ .udc_detect = GPIO_NR_PALMZ72_USB_DETECT_N,
+ .udc_pullup = GPIO_NR_PALMZ72_USB_PULLUP,
+ .irda_pwdn = GPIO_NR_PALMZ72_IR_DISABLE,
+ .batt_minv = PALMZ72_BAT_MIN_VOLTAGE,
+ .batt_maxv = PALMZ72_BAT_MAX_VOLTAGE,
+ .lcd_power = -1,
};
-/* setup udc GPIOs initial state */
-static void __init palmz72_udc_init(void)
-{
- if (!gpio_request(GPIO_NR_PALMZ72_USB_PULLUP, "USB Pullup")) {
- gpio_direction_output(GPIO_NR_PALMZ72_USB_PULLUP, 0);
- gpio_free(GPIO_NR_PALMZ72_USB_PULLUP);
- }
-}
-
static void __init palmz72_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config));
-
- pxa_set_ffuart_info(NULL);
- pxa_set_btuart_info(NULL);
- pxa_set_stuart_info(NULL);
-
- set_pxa_fb_info(&palmz72_lcd_screen);
- pxa_set_mci_info(&palmz72_mci_platform_data);
- palmz72_udc_init();
- pxa_set_ac97_info(&palmz72_ac97_pdata);
- pxa_set_ficp_info(&palmz72_ficp_platform_data);
+ palm27x_common_init(&palmz72);
pxa_set_keypad_info(&palmz72_keypad_platform_data);
-
- platform_add_devices(devices, ARRAY_SIZE(devices));
+ platform_device_register(&palmz72_leds);
}
MACHINE_START(PALMZ72, "Palm Zire72")
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 02/13] [ARM] pxa/palm: Flip Palm LD,TX,T5,Z72 to Palm27x
2010-07-29 3:16 ` [PATCH 02/13] [ARM] pxa/palm: Flip Palm LD,TX,T5,Z72 to Palm27x Marek Vasut
@ 2010-08-04 3:14 ` Eric Miao
0 siblings, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-08-04 3:14 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jul 29, 2010 at 11:16 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> ?arch/arm/mach-pxa/Kconfig ? ?| ? ?4 +
> ?arch/arm/mach-pxa/palmld.c ? | ?258 +++----------------------------------
> ?arch/arm/mach-pxa/palmt5.c ? | ?275 +++------------------------------------
> ?arch/arm/mach-pxa/palmtreo.c | ?292 +++++-------------------------------------
> ?arch/arm/mach-pxa/palmtx.c ? | ?270 +++------------------------------------
> ?arch/arm/mach-pxa/palmz72.c ?| ?261 ++-----------------------------------
> ?6 files changed, 109 insertions(+), 1251 deletions(-)
I like the number of line deletions :-)
>
> diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
> index 6f04f21..7aefb90 100644
> --- a/arch/arm/mach-pxa/Kconfig
> +++ b/arch/arm/mach-pxa/Kconfig
> @@ -374,6 +374,7 @@ config MACH_PALMT5
> ? ? ? ?depends on ARCH_PXA_PALM
> ? ? ? ?select PXA27x
> ? ? ? ?select IWMMXT
> + ? ? ? select MACH_PALM27X
Instead of introducing MACH_PALM27X, it might be better to change the Makefile
as:
obj-$(CONFIG_MACH_PALMT5) += palmt5.o palm27x.o
obj-$(CONFIG_MACH_PALMTX) += palmtx.o palm27x.o
The linker is smart enough to avoid linking palm27x.o twice.
And in the end I'd like to see
config MACH_PALMT5
depends on PXA_PALM27X
select PXA27x
select IWMMXT
...
So in Makefile:
obj-$(CONFIG_PXA_PALM27X) += palm27x.o
And all those #ifdef CONFIG_MACH_PALMT5 .. #endif in palm27x.c, like
what ezx is doing.
The rest of the patch looks good.
> ? ? ? ?help
> ? ? ? ? ?Say Y here if you intend to run this kernel on a Palm Tungsten|T5
> ? ? ? ? ?handheld computer.
> @@ -384,6 +385,7 @@ config MACH_PALMTX
> ? ? ? ?depends on ARCH_PXA_PALM
> ? ? ? ?select PXA27x
> ? ? ? ?select IWMMXT
> + ? ? ? select MACH_PALM27X
> ? ? ? ?help
> ? ? ? ? ?Say Y here if you intend to run this kernel on a Palm T|X
> ? ? ? ? ?handheld computer.
> @@ -394,6 +396,7 @@ config MACH_PALMZ72
> ? ? ? ?depends on ARCH_PXA_PALM
> ? ? ? ?select PXA27x
> ? ? ? ?select IWMMXT
> + ? ? ? select MACH_PALM27X
> ? ? ? ?help
> ? ? ? ? ?Say Y here if you intend to run this kernel on Palm Zire 72
> ? ? ? ? ?handheld computer.
> @@ -404,6 +407,7 @@ config MACH_PALMLD
> ? ? ? ?depends on ARCH_PXA_PALM
> ? ? ? ?select PXA27x
> ? ? ? ?select IWMMXT
> + ? ? ? select MACH_PALM27X
> ? ? ? ?help
> ? ? ? ? ?Say Y here if you intend to run this kernel on a Palm LifeDrive
> ? ? ? ? ?handheld computer.
> diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
> index 83a1a55..cac66ca 100644
> --- a/arch/arm/mach-pxa/palmld.c
> +++ b/arch/arm/mach-pxa/palmld.c
> @@ -41,6 +41,7 @@
> ?#include <mach/irda.h>
> ?#include <mach/pxa27x_keypad.h>
> ?#include <mach/palmasoc.h>
> +#include <mach/palm27x.h>
>
> ?#include "generic.h"
> ?#include "devices.h"
> @@ -161,17 +162,6 @@ static struct platform_device palmld_flash = {
> ?};
>
> ?/******************************************************************************
> - * SD/MMC card controller
> - ******************************************************************************/
> -static struct pxamci_platform_data palmld_mci_platform_data = {
> - ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
> - ? ? ? .gpio_card_detect ? ? ? = GPIO_NR_PALMLD_SD_DETECT_N,
> - ? ? ? .gpio_card_ro ? ? ? ? ? = GPIO_NR_PALMLD_SD_READONLY,
> - ? ? ? .gpio_power ? ? ? ? ? ? = GPIO_NR_PALMLD_SD_POWER,
> - ? ? ? .detect_delay_ms ? ? ? ?= 200,
> -};
> -
> -/******************************************************************************
> ?* GPIO keyboard
> ?******************************************************************************/
> ?static unsigned int palmld_matrix_keys[] = {
> @@ -223,74 +213,6 @@ static struct platform_device palmld_pxa_keys = {
> ?};
>
> ?/******************************************************************************
> - * Backlight
> - ******************************************************************************/
> -static int palmld_backlight_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMLD_BL_POWER, "BL POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMLD_BL_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_request(GPIO_NR_PALMLD_LCD_POWER, "LCD POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMLD_LCD_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err3;
> -
> - ? ? ? return 0;
> -err3:
> - ? ? ? gpio_free(GPIO_NR_PALMLD_LCD_POWER);
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMLD_BL_POWER);
> -err:
> - ? ? ? return ret;
> -}
> -
> -static int palmld_backlight_notify(struct device *dev, int brightness)
> -{
> - ? ? ? gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness);
> - ? ? ? gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness);
> - ? ? ? return brightness;
> -}
> -
> -static void palmld_backlight_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMLD_BL_POWER);
> - ? ? ? gpio_free(GPIO_NR_PALMLD_LCD_POWER);
> -}
> -
> -static struct platform_pwm_backlight_data palmld_backlight_data = {
> - ? ? ? .pwm_id ? ? ? ? = 0,
> - ? ? ? .max_brightness = PALMLD_MAX_INTENSITY,
> - ? ? ? .dft_brightness = PALMLD_MAX_INTENSITY,
> - ? ? ? .pwm_period_ns ?= PALMLD_PERIOD_NS,
> - ? ? ? .init ? ? ? ? ? = palmld_backlight_init,
> - ? ? ? .notify ? ? ? ? = palmld_backlight_notify,
> - ? ? ? .exit ? ? ? ? ? = palmld_backlight_exit,
> -};
> -
> -static struct platform_device palmld_backlight = {
> - ? ? ? .name ? = "pwm-backlight",
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .parent ? ? ? ? = &pxa27x_device_pwm0.dev,
> - ? ? ? ? ? ? ? .platform_data ?= &palmld_backlight_data,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * IrDA
> - ******************************************************************************/
> -static struct pxaficp_platform_data palmld_ficp_platform_data = {
> - ? ? ? .gpio_pwdown ? ? ? ? ? ?= GPIO_NR_PALMLD_IR_DISABLE,
> - ? ? ? .transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
> -};
> -
> -/******************************************************************************
> ?* LEDs
> ?******************************************************************************/
> ?struct gpio_led gpio_leds[] = {
> @@ -319,112 +241,6 @@ static struct platform_device palmld_leds = {
> ?};
>
> ?/******************************************************************************
> - * Power supply
> - ******************************************************************************/
> -static int power_supply_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMLD_POWER_DETECT, "CABLE_STATE_AC");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err1;
> - ? ? ? ret = gpio_direction_input(GPIO_NR_PALMLD_POWER_DETECT);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMLD_USB_DETECT_N, "CABLE_STATE_USB");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_direction_input(GPIO_NR_PALMLD_USB_DETECT_N);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err3;
> -
> - ? ? ? return 0;
> -
> -err3:
> - ? ? ? gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
> -err1:
> - ? ? ? return ret;
> -}
> -
> -static int palmld_is_ac_online(void)
> -{
> - ? ? ? return gpio_get_value(GPIO_NR_PALMLD_POWER_DETECT);
> -}
> -
> -static int palmld_is_usb_online(void)
> -{
> - ? ? ? return !gpio_get_value(GPIO_NR_PALMLD_USB_DETECT_N);
> -}
> -
> -static void power_supply_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
> - ? ? ? gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
> -}
> -
> -static char *palmld_supplicants[] = {
> - ? ? ? "main-battery",
> -};
> -
> -static struct pda_power_pdata power_supply_info = {
> - ? ? ? .init ? ? ? ? ? ?= power_supply_init,
> - ? ? ? .is_ac_online ? ?= palmld_is_ac_online,
> - ? ? ? .is_usb_online ? = palmld_is_usb_online,
> - ? ? ? .exit ? ? ? ? ? ?= power_supply_exit,
> - ? ? ? .supplied_to ? ? = palmld_supplicants,
> - ? ? ? .num_supplicants = ARRAY_SIZE(palmld_supplicants),
> -};
> -
> -static struct platform_device power_supply = {
> - ? ? ? .name = "pda-power",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &power_supply_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * WM97xx audio, battery
> - ******************************************************************************/
> -static struct wm97xx_batt_pdata palmld_batt_pdata = {
> - ? ? ? .batt_aux ? ? ? = WM97XX_AUX_ID3,
> - ? ? ? .temp_aux ? ? ? = WM97XX_AUX_ID2,
> - ? ? ? .charge_gpio ? ?= -1,
> - ? ? ? .max_voltage ? ?= PALMLD_BAT_MAX_VOLTAGE,
> - ? ? ? .min_voltage ? ?= PALMLD_BAT_MIN_VOLTAGE,
> - ? ? ? .batt_mult ? ? ?= 1000,
> - ? ? ? .batt_div ? ? ? = 414,
> - ? ? ? .temp_mult ? ? ?= 1,
> - ? ? ? .temp_div ? ? ? = 1,
> - ? ? ? .batt_tech ? ? ?= POWER_SUPPLY_TECHNOLOGY_LIPO,
> - ? ? ? .batt_name ? ? ?= "main-batt",
> -};
> -
> -static struct wm97xx_pdata palmld_wm97xx_pdata = {
> - ? ? ? .batt_pdata ? ? = &palmld_batt_pdata,
> -};
> -
> -static pxa2xx_audio_ops_t palmld_ac97_pdata = {
> - ? ? ? .reset_gpio ? ? = 95,
> - ? ? ? .codec_pdata ? ?= { &palmld_wm97xx_pdata, },
> -};
> -
> -static struct palm27x_asoc_info palmld_asoc_pdata = {
> - ? ? ? .jack_gpio ? ? ?= GPIO_NR_PALMLD_EARPHONE_DETECT,
> -};
> -
> -static struct platform_device palmld_asoc = {
> - ? ? ? .name = "palm27x-asoc",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &palmld_asoc_pdata,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> ?* HDD
> ?******************************************************************************/
> ?static struct platform_device palmld_hdd = {
> @@ -433,57 +249,13 @@ static struct platform_device palmld_hdd = {
> ?};
>
> ?/******************************************************************************
> - * Framebuffer
> - ******************************************************************************/
> -static struct pxafb_mode_info palmld_lcd_modes[] = {
> -{
> - ? ? ? .pixclock ? ? ? = 57692,
> - ? ? ? .xres ? ? ? ? ? = 320,
> - ? ? ? .yres ? ? ? ? ? = 480,
> - ? ? ? .bpp ? ? ? ? ? ?= 16,
> -
> - ? ? ? .left_margin ? ?= 32,
> - ? ? ? .right_margin ? = 1,
> - ? ? ? .upper_margin ? = 7,
> - ? ? ? .lower_margin ? = 1,
> -
> - ? ? ? .hsync_len ? ? ?= 4,
> - ? ? ? .vsync_len ? ? ?= 1,
> -},
> -};
> -
> -static struct pxafb_mach_info palmld_lcd_screen = {
> - ? ? ? .modes ? ? ? ? ?= palmld_lcd_modes,
> - ? ? ? .num_modes ? ? ?= ARRAY_SIZE(palmld_lcd_modes),
> - ? ? ? .lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
> -};
> -
> -/******************************************************************************
> - * Power management - standby
> - ******************************************************************************/
> -static void __init palmld_pm_init(void)
> -{
> - ? ? ? static u32 resume[] = {
> - ? ? ? ? ? ? ? 0xe3a00101, ? ? /* mov ?r0, ? ? #0x40000000 */
> - ? ? ? ? ? ? ? 0xe380060f, ? ? /* orr ?r0, r0, #0x00f00000 */
> - ? ? ? ? ? ? ? 0xe590f008, ? ? /* ldr ?pc, [r0, #0x08] */
> - ? ? ? };
> -
> - ? ? ? /* copy the bootloader */
> - ? ? ? memcpy(phys_to_virt(PALMLD_STR_BASE), resume, sizeof(resume));
> -}
> -
> -/******************************************************************************
> ?* Machine init
> ?******************************************************************************/
> ?static struct platform_device *devices[] __initdata = {
> ?#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
> ? ? ? ?&palmld_pxa_keys,
> ?#endif
> - ? ? ? &palmld_backlight,
> ? ? ? ?&palmld_leds,
> - ? ? ? &power_supply,
> - ? ? ? &palmld_asoc,
> ? ? ? ?&palmld_hdd,
> ? ? ? ?&palmld_flash,
> ?};
> @@ -509,21 +281,27 @@ static void __init palmld_map_io(void)
> ? ? ? ?iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
> ?}
>
> +struct palm27x_handheld palmld = {
> + ? ? ? .mmc_detect ? ? = GPIO_NR_PALMLD_SD_DETECT_N,
> + ? ? ? .mmc_ro ? ? ? ? = GPIO_NR_PALMLD_SD_READONLY,
> + ? ? ? .mmc_power ? ? ?= GPIO_NR_PALMLD_SD_POWER,
> + ? ? ? .pm_str_base ? ?= PALMLD_STR_BASE,
> + ? ? ? .irda_pwdn ? ? ?= GPIO_NR_PALMLD_IR_DISABLE,
> + ? ? ? .batt_minv ? ? ?= PALMLD_BAT_MIN_VOLTAGE,
> + ? ? ? .batt_maxv ? ? ?= PALMLD_BAT_MAX_VOLTAGE,
> + ? ? ? .jack_gpio ? ? ?= GPIO_NR_PALMLD_EARPHONE_DETECT,
> + ? ? ? .bl_bl ? ? ? ? ?= GPIO_NR_PALMLD_BL_POWER,
> + ? ? ? .bl_lcd ? ? ? ? = GPIO_NR_PALMLD_LCD_POWER,
> + ? ? ? .power_ac ? ? ? = GPIO_NR_PALMLD_POWER_DETECT,
> + ? ? ? .power_usb ? ? ?= GPIO_NR_PALMLD_USB_DETECT_N,
> + ? ? ? .lcd_power ? ? ?= -1,
> +};
> +
> ?static void __init palmld_init(void)
> ?{
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
> -
> - ? ? ? pxa_set_ffuart_info(NULL);
> - ? ? ? pxa_set_btuart_info(NULL);
> - ? ? ? pxa_set_stuart_info(NULL);
> -
> - ? ? ? palmld_pm_init();
> - ? ? ? set_pxa_fb_info(&palmld_lcd_screen);
> - ? ? ? pxa_set_mci_info(&palmld_mci_platform_data);
> - ? ? ? pxa_set_ac97_info(&palmld_ac97_pdata);
> - ? ? ? pxa_set_ficp_info(&palmld_ficp_platform_data);
> + ? ? ? palm27x_common_init(&palmld);
> ? ? ? ?pxa_set_keypad_info(&palmld_keypad_platform_data);
> -
> ? ? ? ?platform_add_devices(devices, ARRAY_SIZE(devices));
> ?}
>
> diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
> index 0b36d7d..593f57c 100644
> --- a/arch/arm/mach-pxa/palmt5.c
> +++ b/arch/arm/mach-pxa/palmt5.c
> @@ -41,6 +41,7 @@
> ?#include <mach/pxa27x_keypad.h>
> ?#include <mach/udc.h>
> ?#include <mach/palmasoc.h>
> +#include <mach/palm27x.h>
>
> ?#include "generic.h"
> ?#include "devices.h"
> @@ -103,17 +104,6 @@ static unsigned long palmt5_pin_config[] __initdata = {
> ?};
>
> ?/******************************************************************************
> - * SD/MMC card controller
> - ******************************************************************************/
> -static struct pxamci_platform_data palmt5_mci_platform_data = {
> - ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
> - ? ? ? .gpio_card_detect ? ? ? = GPIO_NR_PALMT5_SD_DETECT_N,
> - ? ? ? .gpio_card_ro ? ? ? ? ? = GPIO_NR_PALMT5_SD_READONLY,
> - ? ? ? .gpio_power ? ? ? ? ? ? = GPIO_NR_PALMT5_SD_POWER,
> - ? ? ? .detect_delay_ms ? ? ? ?= 200,
> -};
> -
> -/******************************************************************************
> ?* GPIO keyboard
> ?******************************************************************************/
> ?static unsigned int palmt5_matrix_keys[] = {
> @@ -162,259 +152,32 @@ static struct platform_device palmt5_pxa_keys = {
> ?};
>
> ?/******************************************************************************
> - * Backlight
> - ******************************************************************************/
> -static int palmt5_backlight_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err3;
> -
> - ? ? ? return 0;
> -err3:
> - ? ? ? gpio_free(GPIO_NR_PALMT5_LCD_POWER);
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMT5_BL_POWER);
> -err:
> - ? ? ? return ret;
> -}
> -
> -static int palmt5_backlight_notify(struct device *dev, int brightness)
> -{
> - ? ? ? gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness);
> - ? ? ? gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness);
> - ? ? ? return brightness;
> -}
> -
> -static void palmt5_backlight_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMT5_BL_POWER);
> - ? ? ? gpio_free(GPIO_NR_PALMT5_LCD_POWER);
> -}
> -
> -static struct platform_pwm_backlight_data palmt5_backlight_data = {
> - ? ? ? .pwm_id ? ? ? ? = 0,
> - ? ? ? .max_brightness = PALMT5_MAX_INTENSITY,
> - ? ? ? .dft_brightness = PALMT5_MAX_INTENSITY,
> - ? ? ? .pwm_period_ns ?= PALMT5_PERIOD_NS,
> - ? ? ? .init ? ? ? ? ? = palmt5_backlight_init,
> - ? ? ? .notify ? ? ? ? = palmt5_backlight_notify,
> - ? ? ? .exit ? ? ? ? ? = palmt5_backlight_exit,
> -};
> -
> -static struct platform_device palmt5_backlight = {
> - ? ? ? .name ? = "pwm-backlight",
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .parent ? ? ? ? = &pxa27x_device_pwm0.dev,
> - ? ? ? ? ? ? ? .platform_data ?= &palmt5_backlight_data,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * IrDA
> - ******************************************************************************/
> -static struct pxaficp_platform_data palmt5_ficp_platform_data = {
> - ? ? ? .gpio_pwdown ? ? ? ? ? ?= GPIO_NR_PALMT5_IR_DISABLE,
> - ? ? ? .transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
> -};
> -
> -/******************************************************************************
> - * UDC
> - ******************************************************************************/
> -static struct gpio_vbus_mach_info palmt5_udc_info = {
> - ? ? ? .gpio_vbus ? ? ? ? ? ? ?= GPIO_NR_PALMT5_USB_DETECT_N,
> - ? ? ? .gpio_vbus_inverted ? ? = 1,
> - ? ? ? .gpio_pullup ? ? ? ? ? ?= GPIO_NR_PALMT5_USB_PULLUP,
> -};
> -
> -static struct platform_device palmt5_gpio_vbus = {
> - ? ? ? .name ? = "gpio-vbus",
> - ? ? ? .id ? ? = -1,
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .platform_data ?= &palmt5_udc_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * Power supply
> - ******************************************************************************/
> -static int power_supply_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err1;
> - ? ? ? ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> -
> - ? ? ? return 0;
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
> -err1:
> - ? ? ? return ret;
> -}
> -
> -static int palmt5_is_ac_online(void)
> -{
> - ? ? ? return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT);
> -}
> -
> -static void power_supply_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
> -}
> -
> -static char *palmt5_supplicants[] = {
> - ? ? ? "main-battery",
> -};
> -
> -static struct pda_power_pdata power_supply_info = {
> - ? ? ? .init ? ? ? ? ? ?= power_supply_init,
> - ? ? ? .is_ac_online ? ?= palmt5_is_ac_online,
> - ? ? ? .exit ? ? ? ? ? ?= power_supply_exit,
> - ? ? ? .supplied_to ? ? = palmt5_supplicants,
> - ? ? ? .num_supplicants = ARRAY_SIZE(palmt5_supplicants),
> -};
> -
> -static struct platform_device power_supply = {
> - ? ? ? .name = "pda-power",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &power_supply_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * WM97xx audio, battery
> - ******************************************************************************/
> -static struct wm97xx_batt_pdata palmt5_batt_pdata = {
> - ? ? ? .batt_aux ? ? ? = WM97XX_AUX_ID3,
> - ? ? ? .temp_aux ? ? ? = WM97XX_AUX_ID2,
> - ? ? ? .charge_gpio ? ?= -1,
> - ? ? ? .max_voltage ? ?= PALMT5_BAT_MAX_VOLTAGE,
> - ? ? ? .min_voltage ? ?= PALMT5_BAT_MIN_VOLTAGE,
> - ? ? ? .batt_mult ? ? ?= 1000,
> - ? ? ? .batt_div ? ? ? = 414,
> - ? ? ? .temp_mult ? ? ?= 1,
> - ? ? ? .temp_div ? ? ? = 1,
> - ? ? ? .batt_tech ? ? ?= POWER_SUPPLY_TECHNOLOGY_LIPO,
> - ? ? ? .batt_name ? ? ?= "main-batt",
> -};
> -
> -static struct wm97xx_pdata palmt5_wm97xx_pdata = {
> - ? ? ? .batt_pdata ? ? = &palmt5_batt_pdata,
> -};
> -
> -static pxa2xx_audio_ops_t palmt5_ac97_pdata = {
> - ? ? ? .reset_gpio ? ? = 95,
> - ? ? ? .codec_pdata ? ?= { &palmt5_wm97xx_pdata, },
> -};
> -
> -static struct palm27x_asoc_info palmt5_asoc_pdata = {
> - ? ? ? .jack_gpio ? ? ?= GPIO_NR_PALMT5_EARPHONE_DETECT,
> -};
> -
> -static struct platform_device palmt5_asoc = {
> - ? ? ? .name = "palm27x-asoc",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &palmt5_asoc_pdata,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * Framebuffer
> - ******************************************************************************/
> -static struct pxafb_mode_info palmt5_lcd_modes[] = {
> -{
> - ? ? ? .pixclock ? ? ? = 57692,
> - ? ? ? .xres ? ? ? ? ? = 320,
> - ? ? ? .yres ? ? ? ? ? = 480,
> - ? ? ? .bpp ? ? ? ? ? ?= 16,
> -
> - ? ? ? .left_margin ? ?= 32,
> - ? ? ? .right_margin ? = 1,
> - ? ? ? .upper_margin ? = 7,
> - ? ? ? .lower_margin ? = 1,
> -
> - ? ? ? .hsync_len ? ? ?= 4,
> - ? ? ? .vsync_len ? ? ?= 1,
> -},
> -};
> -
> -static struct pxafb_mach_info palmt5_lcd_screen = {
> - ? ? ? .modes ? ? ? ? ?= palmt5_lcd_modes,
> - ? ? ? .num_modes ? ? ?= ARRAY_SIZE(palmt5_lcd_modes),
> - ? ? ? .lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
> -};
> -
> -/******************************************************************************
> - * Power management - standby
> - ******************************************************************************/
> -static void __init palmt5_pm_init(void)
> -{
> - ? ? ? static u32 resume[] = {
> - ? ? ? ? ? ? ? 0xe3a00101, ? ? /* mov ?r0, ? ? #0x40000000 */
> - ? ? ? ? ? ? ? 0xe380060f, ? ? /* orr ?r0, r0, #0x00f00000 */
> - ? ? ? ? ? ? ? 0xe590f008, ? ? /* ldr ?pc, [r0, #0x08] */
> - ? ? ? };
> -
> - ? ? ? /* copy the bootloader */
> - ? ? ? memcpy(phys_to_virt(PALMT5_STR_BASE), resume, sizeof(resume));
> -}
> -
> -/******************************************************************************
> ?* Machine init
> ?******************************************************************************/
> -static struct platform_device *devices[] __initdata = {
> -#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
> - ? ? ? &palmt5_pxa_keys,
> -#endif
> - ? ? ? &palmt5_backlight,
> - ? ? ? &power_supply,
> - ? ? ? &palmt5_asoc,
> - ? ? ? &palmt5_gpio_vbus,
> +struct palm27x_handheld palmt5 = {
> + ? ? ? .mmc_detect ? ? = GPIO_NR_PALMT5_SD_DETECT_N,
> + ? ? ? .mmc_ro ? ? ? ? = GPIO_NR_PALMT5_SD_READONLY,
> + ? ? ? .mmc_power ? ? ?= GPIO_NR_PALMT5_SD_POWER,
> + ? ? ? .pm_str_base ? ?= PALMT5_STR_BASE,
> + ? ? ? .udc_detect ? ? = GPIO_NR_PALMT5_USB_DETECT_N,
> + ? ? ? .udc_pullup ? ? = GPIO_NR_PALMT5_USB_PULLUP,
> + ? ? ? .irda_pwdn ? ? ?= GPIO_NR_PALMT5_IR_DISABLE,
> + ? ? ? .batt_minv ? ? ?= PALMT5_BAT_MIN_VOLTAGE,
> + ? ? ? .batt_maxv ? ? ?= PALMT5_BAT_MAX_VOLTAGE,
> + ? ? ? .jack_gpio ? ? ?= GPIO_NR_PALMT5_EARPHONE_DETECT,
> + ? ? ? .bl_bl ? ? ? ? ?= GPIO_NR_PALMT5_BL_POWER,
> + ? ? ? .bl_lcd ? ? ? ? = GPIO_NR_PALMT5_LCD_POWER,
> + ? ? ? .power_ac ? ? ? = GPIO_NR_PALMT5_POWER_DETECT,
> + ? ? ? .power_usb ? ? ?= -1,
> + ? ? ? .lcd_power ? ? ?= -1,
> ?};
>
> -/* setup udc GPIOs initial state */
> -static void __init palmt5_udc_init(void)
> -{
> - ? ? ? if (!gpio_request(GPIO_NR_PALMT5_USB_PULLUP, "UDC Vbus")) {
> - ? ? ? ? ? ? ? gpio_direction_output(GPIO_NR_PALMT5_USB_PULLUP, 1);
> - ? ? ? ? ? ? ? gpio_free(GPIO_NR_PALMT5_USB_PULLUP);
> - ? ? ? }
> -}
> -
> ?static void __init palmt5_init(void)
> ?{
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
> -
> - ? ? ? pxa_set_ffuart_info(NULL);
> - ? ? ? pxa_set_btuart_info(NULL);
> - ? ? ? pxa_set_stuart_info(NULL);
> -
> - ? ? ? palmt5_pm_init();
> - ? ? ? set_pxa_fb_info(&palmt5_lcd_screen);
> - ? ? ? pxa_set_mci_info(&palmt5_mci_platform_data);
> - ? ? ? palmt5_udc_init();
> - ? ? ? pxa_set_ac97_info(&palmt5_ac97_pdata);
> - ? ? ? pxa_set_ficp_info(&palmt5_ficp_platform_data);
> + ? ? ? palm27x_common_init(&palmt5);
> ? ? ? ?pxa_set_keypad_info(&palmt5_keypad_platform_data);
> -
> - ? ? ? platform_add_devices(devices, ARRAY_SIZE(devices));
> + ? ? ? platform_device_register(&palmt5_pxa_keys);
> ?}
>
> ?MACHINE_START(PALMT5, "Palm Tungsten|T5")
> diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
> index 4eb0258..dcb5f93 100644
> --- a/arch/arm/mach-pxa/palmtreo.c
> +++ b/arch/arm/mach-pxa/palmtreo.c
> @@ -44,6 +44,7 @@
> ?#include <mach/pxa2xx-regs.h>
> ?#include <mach/palmasoc.h>
> ?#include <mach/camera.h>
> +#include <mach/palm27x.h>
>
> ?#include <sound/pxa2xx-lib.h>
>
> @@ -158,28 +159,6 @@ static unsigned long centro685_pin_config[] __initdata = {
> ?#endif /* CONFIG_MACH_CENTRO */
>
> ?/******************************************************************************
> - * SD/MMC card controller
> - ******************************************************************************/
> -#ifdef CONFIG_MACH_TREO680
> -static struct pxamci_platform_data treo680_mci_platform_data = {
> - ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
> - ? ? ? .gpio_card_detect ? ? ? = GPIO_NR_TREO_SD_DETECT_N,
> - ? ? ? .gpio_card_ro ? ? ? ? ? = GPIO_NR_TREO680_SD_READONLY,
> - ? ? ? .gpio_power ? ? ? ? ? ? = GPIO_NR_TREO680_SD_POWER,
> -};
> -#endif /* CONFIG_MACH_TREO680 */
> -
> -#ifdef CONFIG_MACH_CENTRO
> -static struct pxamci_platform_data centro_mci_platform_data = {
> - ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
> - ? ? ? .gpio_card_detect ? ? ? = GPIO_NR_TREO_SD_DETECT_N,
> - ? ? ? .gpio_card_ro ? ? ? ? ? = -1,
> - ? ? ? .gpio_power ? ? ? ? ? ? = GPIO_NR_CENTRO_SD_POWER,
> - ? ? ? .gpio_power_invert ? ? ?= 1,
> -};
> -#endif /* CONFIG_MACH_CENTRO */
> -
> -/******************************************************************************
> ?* GPIO keyboard
> ?******************************************************************************/
> ?#ifdef CONFIG_MACH_TREO680
> @@ -327,83 +306,6 @@ static struct pxa27x_keypad_platform_data centro_keypad_platform_data = {
> ?#endif /* CONFIG_MACH_CENTRO */
>
> ?/******************************************************************************
> - * aSoC audio
> - ******************************************************************************/
> -
> -static pxa2xx_audio_ops_t treo_ac97_pdata = {
> - ? ? ? .reset_gpio ? ? = 95,
> -};
> -
> -/******************************************************************************
> - * Backlight
> - ******************************************************************************/
> -static int treo_backlight_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> -
> - ? ? ? return 0;
> -
> -err2:
> - ? ? ? gpio_free(GPIO_NR_TREO_BL_POWER);
> -err:
> - ? ? ? return ret;
> -}
> -
> -static int treo_backlight_notify(struct device *dev, int brightness)
> -{
> - ? ? ? gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
> - ? ? ? return TREO_MAX_INTENSITY - brightness;
> -};
> -
> -static void treo_backlight_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_TREO_BL_POWER);
> -}
> -
> -static struct platform_pwm_backlight_data treo_backlight_data = {
> - ? ? ? .pwm_id ? ? ? ? = 0,
> - ? ? ? .max_brightness = TREO_MAX_INTENSITY,
> - ? ? ? .dft_brightness = TREO_DEFAULT_INTENSITY,
> - ? ? ? .pwm_period_ns ?= TREO_PERIOD_NS,
> - ? ? ? .init ? ? ? ? ? = treo_backlight_init,
> - ? ? ? .notify ? ? ? ? = treo_backlight_notify,
> - ? ? ? .exit ? ? ? ? ? = treo_backlight_exit,
> -};
> -
> -static struct platform_device treo_backlight = {
> - ? ? ? .name ? = "pwm-backlight",
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .parent ? ? ? ? = &pxa27x_device_pwm0.dev,
> - ? ? ? ? ? ? ? .platform_data ?= &treo_backlight_data,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * IrDA
> - ******************************************************************************/
> -static struct pxaficp_platform_data treo_ficp_info = {
> - ? ? ? .gpio_pwdown ? ? ? ? ? ?= GPIO_NR_TREO_IR_EN,
> - ? ? ? .transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
> -};
> -
> -/******************************************************************************
> - * UDC
> - ******************************************************************************/
> -static struct pxa2xx_udc_mach_info treo_udc_info __initdata = {
> - ? ? ? .gpio_vbus ? ? ? ? ? ? ?= GPIO_NR_TREO_USB_DETECT,
> - ? ? ? .gpio_vbus_inverted ? ? = 1,
> - ? ? ? .gpio_pullup ? ? ? ? ? ?= GPIO_NR_TREO_USB_PULLUP,
> -};
> -
> -
> -/******************************************************************************
> ?* USB host
> ?******************************************************************************/
> ?#ifdef CONFIG_MACH_TREO680
> @@ -415,58 +317,6 @@ static struct pxaohci_platform_data treo680_ohci_info = {
> ?#endif /* CONFIG_MACH_TREO680 */
>
> ?/******************************************************************************
> - * Power supply
> - ******************************************************************************/
> -static int power_supply_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err1;
> - ? ? ? ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> -
> - ? ? ? return 0;
> -
> -err2:
> - ? ? ? gpio_free(GPIO_NR_TREO_POWER_DETECT);
> -err1:
> - ? ? ? return ret;
> -}
> -
> -static int treo_is_ac_online(void)
> -{
> - ? ? ? return gpio_get_value(GPIO_NR_TREO_POWER_DETECT);
> -}
> -
> -static void power_supply_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_TREO_POWER_DETECT);
> -}
> -
> -static char *treo_supplicants[] = {
> - ? ? ? "main-battery",
> -};
> -
> -static struct pda_power_pdata power_supply_info = {
> - ? ? ? .init ? ? ? ? ? ?= power_supply_init,
> - ? ? ? .is_ac_online ? ?= treo_is_ac_online,
> - ? ? ? .exit ? ? ? ? ? ?= power_supply_exit,
> - ? ? ? .supplied_to ? ? = treo_supplicants,
> - ? ? ? .num_supplicants = ARRAY_SIZE(treo_supplicants),
> -};
> -
> -static struct platform_device power_supply = {
> - ? ? ? .name = "pda-power",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &power_supply_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> ?* Vibra and LEDs
> ?******************************************************************************/
> ?#ifdef CONFIG_MACH_TREO680
> @@ -537,60 +387,8 @@ static struct platform_device centro_leds = {
> ?#endif /* CONFIG_MACH_CENTRO */
>
> ?/******************************************************************************
> - * Framebuffer
> - ******************************************************************************/
> -/* TODO: add support for 324x324 */
> -static struct pxafb_mode_info treo_lcd_modes[] = {
> -{
> - ? ? ? .pixclock ? ? ? ? ? ? ? = 86538,
> - ? ? ? .xres ? ? ? ? ? ? ? ? ? = 320,
> - ? ? ? .yres ? ? ? ? ? ? ? ? ? = 320,
> - ? ? ? .bpp ? ? ? ? ? ? ? ? ? ?= 16,
> -
> - ? ? ? .left_margin ? ? ? ? ? ?= 20,
> - ? ? ? .right_margin ? ? ? ? ? = 8,
> - ? ? ? .upper_margin ? ? ? ? ? = 8,
> - ? ? ? .lower_margin ? ? ? ? ? = 5,
> -
> - ? ? ? .hsync_len ? ? ? ? ? ? ?= 4,
> - ? ? ? .vsync_len ? ? ? ? ? ? ?= 1,
> -},
> -};
> -
> -static void treo_lcd_power(int on, struct fb_var_screeninfo *info)
> -{
> - ? ? ? gpio_set_value(GPIO_NR_TREO_BL_POWER, on);
> -}
> -
> -static struct pxafb_mach_info treo_lcd_screen = {
> - ? ? ? .modes ? ? ? ? ?= treo_lcd_modes,
> - ? ? ? .num_modes ? ? ?= ARRAY_SIZE(treo_lcd_modes),
> - ? ? ? .lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
> -};
> -
> -/******************************************************************************
> - * Power management - standby
> - ******************************************************************************/
> -static void __init treo_pm_init(void)
> -{
> - ? ? ? static u32 resume[] = {
> - ? ? ? ? ? ? ? 0xe3a00101, ? ? /* mov ?r0, ? ? #0x40000000 */
> - ? ? ? ? ? ? ? 0xe380060f, ? ? /* orr ?r0, r0, #0x00f00000 */
> - ? ? ? ? ? ? ? 0xe590f008, ? ? /* ldr ?pc, [r0, #0x08] */
> - ? ? ? };
> -
> - ? ? ? /* this is where the bootloader jumps */
> - ? ? ? memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume));
> -}
> -
> -/******************************************************************************
> ?* Machine init
> ?******************************************************************************/
> -static struct platform_device *treo_devices[] __initdata = {
> - ? ? ? &treo_backlight,
> - ? ? ? &power_supply,
> -};
> -
> ?#ifdef CONFIG_MACH_TREO680
> ?static struct platform_device *treo680_devices[] __initdata = {
> ? ? ? ?&treo680_leds,
> @@ -603,62 +401,29 @@ static struct platform_device *centro_devices[] __initdata = {
> ?};
> ?#endif /* CONFIG_MACH_CENTRO */
>
> -/* setup udc GPIOs initial state */
> -static void __init treo_udc_init(void)
> -{
> - ? ? ? if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) {
> - ? ? ? ? ? ? ? gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1);
> - ? ? ? ? ? ? ? gpio_free(GPIO_NR_TREO_USB_PULLUP);
> - ? ? ? }
> -}
> -
> -static void __init treo_lcd_power_init(void)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER");
> - ? ? ? if (ret) {
> - ? ? ? ? ? ? ? pr_err("Treo680: LCD power GPIO request failed!\n");
> - ? ? ? ? ? ? ? return;
> - ? ? ? }
> -
> - ? ? ? ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0);
> - ? ? ? if (ret) {
> - ? ? ? ? ? ? ? pr_err("Treo680: setting LCD power GPIO direction failed!\n");
> - ? ? ? ? ? ? ? gpio_free(GPIO_NR_TREO_LCD_POWER);
> - ? ? ? ? ? ? ? return;
> - ? ? ? }
> -
> - ? ? ? treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
> -}
> -
> -static void __init treo_init(void)
> -{
> - ? ? ? pxa_set_ffuart_info(NULL);
> - ? ? ? pxa_set_btuart_info(NULL);
> - ? ? ? pxa_set_stuart_info(NULL);
> -
> - ? ? ? treo_pm_init();
> - ? ? ? pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
> - ? ? ? treo_lcd_power_init();
> - ? ? ? set_pxa_fb_info(&treo_lcd_screen);
> - ? ? ? treo_udc_init();
> - ? ? ? pxa_set_udc_info(&treo_udc_info);
> - ? ? ? pxa_set_ac97_info(&treo_ac97_pdata);
> - ? ? ? pxa_set_ficp_info(&treo_ficp_info);
> -
> - ? ? ? platform_add_devices(ARRAY_AND_SIZE(treo_devices));
> -}
> -
> ?#ifdef CONFIG_MACH_TREO680
> +struct palm27x_handheld palmtreo680 = {
> + ? ? ? .mmc_detect ? ? = GPIO_NR_TREO_SD_DETECT_N,
> + ? ? ? .mmc_ro ? ? ? ? = GPIO_NR_TREO680_SD_READONLY,
> + ? ? ? .mmc_power ? ? ?= GPIO_NR_TREO680_SD_POWER,
> + ? ? ? .pm_str_base ? ?= TREO_STR_BASE,
> + ? ? ? .udc_detect ? ? = GPIO_NR_TREO_USB_DETECT,
> + ? ? ? .udc_pullup ? ? = GPIO_NR_TREO_USB_PULLUP,
> + ? ? ? .irda_pwdn ? ? ?= GPIO_NR_TREO_IR_EN,
> + ? ? ? .bl_bl ? ? ? ? ?= GPIO_NR_TREO_BL_POWER,
> + ? ? ? .bl_lcd ? ? ? ? = -1,
> + ? ? ? .power_ac ? ? ? = GPIO_NR_TREO_POWER_DETECT,
> + ? ? ? .power_usb ? ? ?= -1,
> + ? ? ? .lcd_power ? ? ?= GPIO_NR_TREO_BL_POWER,
> +};
> +
> ?static void __init treo680_init(void)
> ?{
> - ? ? ? treo_init();
> + ? ? ? pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
> - ? ? ? pxa_set_mci_info(&treo680_mci_platform_data);
> + ? ? ? palm27x_common_init(&palmtreo680);
> ? ? ? ?pxa_set_keypad_info(&treo680_keypad_platform_data);
> ? ? ? ?pxa_set_ohci_info(&treo680_ohci_info);
> -
> ? ? ? ?platform_add_devices(ARRAY_AND_SIZE(treo680_devices));
> ?}
>
> @@ -674,14 +439,27 @@ MACHINE_END
> ?#endif /* CONFIG_MACH_TREO680 */
>
> ?#ifdef CONFIG_MACH_CENTRO
> +struct palm27x_handheld palmcentro = {
> + ? ? ? .mmc_detect ? ? = GPIO_NR_TREO_SD_DETECT_N,
> + ? ? ? .mmc_ro ? ? ? ? = -1,
> + ? ? ? .mmc_power ? ? ?= GPIO_NR_CENTRO_SD_POWER,
> + ? ? ? .pm_str_base ? ?= TREO_STR_BASE,
> + ? ? ? .udc_detect ? ? = GPIO_NR_TREO_USB_DETECT,
> + ? ? ? .udc_pullup ? ? = GPIO_NR_TREO_USB_PULLUP,
> + ? ? ? .irda_pwdn ? ? ?= GPIO_NR_TREO_IR_EN,
> + ? ? ? .bl_bl ? ? ? ? ?= GPIO_NR_TREO_BL_POWER,
> + ? ? ? .bl_lcd ? ? ? ? = -1,
> + ? ? ? .power_ac ? ? ? = GPIO_NR_TREO_POWER_DETECT,
> + ? ? ? .power_usb ? ? ?= -1,
> + ? ? ? .lcd_power ? ? ?= GPIO_NR_TREO_BL_POWER,
> +};
> +
> ?static void __init centro_init(void)
> ?{
> - ? ? ? treo_init();
> + ? ? ? pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
> - ? ? ? pxa_set_mci_info(¢ro_mci_platform_data);
> -
> + ? ? ? palm27x_common_init(&palmcentro);
> ? ? ? ?pxa_set_keypad_info(¢ro_keypad_platform_data);
> -
> ? ? ? ?platform_add_devices(ARRAY_AND_SIZE(centro_devices));
> ?}
>
> diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
> index a5429cd..f8ddffe 100644
> --- a/arch/arm/mach-pxa/palmtx.c
> +++ b/arch/arm/mach-pxa/palmtx.c
> @@ -46,6 +46,7 @@
> ?#include <mach/pxa27x_keypad.h>
> ?#include <mach/udc.h>
> ?#include <mach/palmasoc.h>
> +#include <mach/palm27x.h>
>
> ?#include "generic.h"
> ?#include "devices.h"
> @@ -163,17 +164,6 @@ static struct platform_device palmtx_flash = {
> ?};
>
> ?/******************************************************************************
> - * SD/MMC card controller
> - ******************************************************************************/
> -static struct pxamci_platform_data palmtx_mci_platform_data = {
> - ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
> - ? ? ? .gpio_card_detect ? ? ? = GPIO_NR_PALMTX_SD_DETECT_N,
> - ? ? ? .gpio_card_ro ? ? ? ? ? = GPIO_NR_PALMTX_SD_READONLY,
> - ? ? ? .gpio_power ? ? ? ? ? ? = GPIO_NR_PALMTX_SD_POWER,
> - ? ? ? .detect_delay_ms ? ? ? ?= 200,
> -};
> -
> -/******************************************************************************
> ?* GPIO keyboard
> ?******************************************************************************/
> ?static unsigned int palmtx_matrix_keys[] = {
> @@ -222,207 +212,6 @@ static struct platform_device palmtx_pxa_keys = {
> ?};
>
> ?/******************************************************************************
> - * Backlight
> - ******************************************************************************/
> -static int palmtx_backlight_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMTX_BL_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMTX_LCD_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err3;
> -
> - ? ? ? return 0;
> -err3:
> - ? ? ? gpio_free(GPIO_NR_PALMTX_LCD_POWER);
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMTX_BL_POWER);
> -err:
> - ? ? ? return ret;
> -}
> -
> -static int palmtx_backlight_notify(struct device *dev, int brightness)
> -{
> - ? ? ? gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness);
> - ? ? ? gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness);
> - ? ? ? return brightness;
> -}
> -
> -static void palmtx_backlight_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMTX_BL_POWER);
> - ? ? ? gpio_free(GPIO_NR_PALMTX_LCD_POWER);
> -}
> -
> -static struct platform_pwm_backlight_data palmtx_backlight_data = {
> - ? ? ? .pwm_id ? ? ? ? = 0,
> - ? ? ? .max_brightness = PALMTX_MAX_INTENSITY,
> - ? ? ? .dft_brightness = PALMTX_MAX_INTENSITY,
> - ? ? ? .pwm_period_ns ?= PALMTX_PERIOD_NS,
> - ? ? ? .init ? ? ? ? ? = palmtx_backlight_init,
> - ? ? ? .notify ? ? ? ? = palmtx_backlight_notify,
> - ? ? ? .exit ? ? ? ? ? = palmtx_backlight_exit,
> -};
> -
> -static struct platform_device palmtx_backlight = {
> - ? ? ? .name ? = "pwm-backlight",
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .parent ? ? ? ? = &pxa27x_device_pwm0.dev,
> - ? ? ? ? ? ? ? .platform_data ?= &palmtx_backlight_data,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * IrDA
> - ******************************************************************************/
> -static struct pxaficp_platform_data palmtx_ficp_platform_data = {
> - ? ? ? .gpio_pwdown ? ? ? ? ? ?= GPIO_NR_PALMTX_IR_DISABLE,
> - ? ? ? .transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
> -};
> -
> -/******************************************************************************
> - * UDC
> - ******************************************************************************/
> -static struct gpio_vbus_mach_info palmtx_udc_info = {
> - ? ? ? .gpio_vbus ? ? ? ? ? ? ?= GPIO_NR_PALMTX_USB_DETECT_N,
> - ? ? ? .gpio_vbus_inverted ? ? = 1,
> - ? ? ? .gpio_pullup ? ? ? ? ? ?= GPIO_NR_PALMTX_USB_PULLUP,
> -};
> -
> -static struct platform_device palmtx_gpio_vbus = {
> - ? ? ? .name ? = "gpio-vbus",
> - ? ? ? .id ? ? = -1,
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .platform_data ?= &palmtx_udc_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * Power supply
> - ******************************************************************************/
> -static int power_supply_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err1;
> - ? ? ? ret = gpio_direction_input(GPIO_NR_PALMTX_POWER_DETECT);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> -
> - ? ? ? return 0;
> -
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
> -err1:
> - ? ? ? return ret;
> -}
> -
> -static int palmtx_is_ac_online(void)
> -{
> - ? ? ? return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT);
> -}
> -
> -static void power_supply_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
> -}
> -
> -static char *palmtx_supplicants[] = {
> - ? ? ? "main-battery",
> -};
> -
> -static struct pda_power_pdata power_supply_info = {
> - ? ? ? .init ? ? ? ? ? ?= power_supply_init,
> - ? ? ? .is_ac_online ? ?= palmtx_is_ac_online,
> - ? ? ? .exit ? ? ? ? ? ?= power_supply_exit,
> - ? ? ? .supplied_to ? ? = palmtx_supplicants,
> - ? ? ? .num_supplicants = ARRAY_SIZE(palmtx_supplicants),
> -};
> -
> -static struct platform_device power_supply = {
> - ? ? ? .name = "pda-power",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &power_supply_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * WM97xx audio, battery
> - ******************************************************************************/
> -static struct wm97xx_batt_pdata palmtx_batt_pdata = {
> - ? ? ? .batt_aux ? ? ? = WM97XX_AUX_ID3,
> - ? ? ? .temp_aux ? ? ? = WM97XX_AUX_ID2,
> - ? ? ? .charge_gpio ? ?= -1,
> - ? ? ? .max_voltage ? ?= PALMTX_BAT_MAX_VOLTAGE,
> - ? ? ? .min_voltage ? ?= PALMTX_BAT_MIN_VOLTAGE,
> - ? ? ? .batt_mult ? ? ?= 1000,
> - ? ? ? .batt_div ? ? ? = 414,
> - ? ? ? .temp_mult ? ? ?= 1,
> - ? ? ? .temp_div ? ? ? = 1,
> - ? ? ? .batt_tech ? ? ?= POWER_SUPPLY_TECHNOLOGY_LIPO,
> - ? ? ? .batt_name ? ? ?= "main-batt",
> -};
> -
> -static struct wm97xx_pdata palmtx_wm97xx_pdata = {
> - ? ? ? .batt_pdata ? ? = &palmtx_batt_pdata,
> -};
> -
> -static pxa2xx_audio_ops_t palmtx_ac97_pdata = {
> - ? ? ? .reset_gpio ? ? = 95,
> - ? ? ? .codec_pdata ? ?= { &palmtx_wm97xx_pdata, },
> -};
> -
> -static struct palm27x_asoc_info palmtx_asoc_pdata = {
> - ? ? ? .jack_gpio ? ? ?= GPIO_NR_PALMTX_EARPHONE_DETECT,
> -};
> -
> -static struct platform_device palmtx_asoc = {
> - ? ? ? .name = "palm27x-asoc",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &palmtx_asoc_pdata,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * Framebuffer
> - ******************************************************************************/
> -static struct pxafb_mode_info palmtx_lcd_modes[] = {
> -{
> - ? ? ? .pixclock ? ? ? = 57692,
> - ? ? ? .xres ? ? ? ? ? = 320,
> - ? ? ? .yres ? ? ? ? ? = 480,
> - ? ? ? .bpp ? ? ? ? ? ?= 16,
> -
> - ? ? ? .left_margin ? ?= 32,
> - ? ? ? .right_margin ? = 1,
> - ? ? ? .upper_margin ? = 7,
> - ? ? ? .lower_margin ? = 1,
> -
> - ? ? ? .hsync_len ? ? ?= 4,
> - ? ? ? .vsync_len ? ? ?= 1,
> -},
> -};
> -
> -static struct pxafb_mach_info palmtx_lcd_screen = {
> - ? ? ? .modes ? ? ? ? ?= palmtx_lcd_modes,
> - ? ? ? .num_modes ? ? ?= ARRAY_SIZE(palmtx_lcd_modes),
> - ? ? ? .lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
> -};
> -
> -/******************************************************************************
> ?* NAND Flash
> ?******************************************************************************/
> ?static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
> @@ -484,20 +273,6 @@ static struct platform_device palmtx_nand = {
> ? ? ? ?}
> ?};
>
> -/******************************************************************************
> - * Power management - standby
> - ******************************************************************************/
> -static void __init palmtx_pm_init(void)
> -{
> - ? ? ? static u32 resume[] = {
> - ? ? ? ? ? ? ? 0xe3a00101, ? ? /* mov ?r0, ? ? #0x40000000 */
> - ? ? ? ? ? ? ? 0xe380060f, ? ? /* orr ?r0, r0, #0x00f00000 */
> - ? ? ? ? ? ? ? 0xe590f008, ? ? /* ldr ?pc, [r0, #0x08] */
> - ? ? ? };
> -
> - ? ? ? /* copy the bootloader */
> - ? ? ? memcpy(phys_to_virt(PALMTX_STR_BASE), resume, sizeof(resume));
> -}
>
> ?/******************************************************************************
> ?* Machine init
> @@ -506,10 +281,6 @@ static struct platform_device *devices[] __initdata = {
> ?#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
> ? ? ? ?&palmtx_pxa_keys,
> ?#endif
> - ? ? ? &palmtx_backlight,
> - ? ? ? &power_supply,
> - ? ? ? &palmtx_asoc,
> - ? ? ? &palmtx_gpio_vbus,
> ? ? ? ?&palmtx_flash,
> ? ? ? ?&palmtx_nand,
> ?};
> @@ -539,32 +310,29 @@ static void __init palmtx_map_io(void)
> ? ? ? ?iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
> ?}
>
> -/* setup udc GPIOs initial state */
> -static void __init palmtx_udc_init(void)
> -{
> - ? ? ? if (!gpio_request(GPIO_NR_PALMTX_USB_PULLUP, "UDC Vbus")) {
> - ? ? ? ? ? ? ? gpio_direction_output(GPIO_NR_PALMTX_USB_PULLUP, 1);
> - ? ? ? ? ? ? ? gpio_free(GPIO_NR_PALMTX_USB_PULLUP);
> - ? ? ? }
> -}
> -
> +struct palm27x_handheld palmtx = {
> + ? ? ? .mmc_detect ? ? = GPIO_NR_PALMTX_SD_DETECT_N,
> + ? ? ? .mmc_ro ? ? ? ? = GPIO_NR_PALMTX_SD_READONLY,
> + ? ? ? .mmc_power ? ? ?= GPIO_NR_PALMTX_SD_POWER,
> + ? ? ? .pm_str_base ? ?= PALMTX_STR_BASE,
> + ? ? ? .udc_detect ? ? = GPIO_NR_PALMTX_USB_DETECT_N,
> + ? ? ? .udc_pullup ? ? = GPIO_NR_PALMTX_USB_PULLUP,
> + ? ? ? .irda_pwdn ? ? ?= GPIO_NR_PALMTX_IR_DISABLE,
> + ? ? ? .batt_minv ? ? ?= PALMTX_BAT_MIN_VOLTAGE,
> + ? ? ? .batt_maxv ? ? ?= PALMTX_BAT_MAX_VOLTAGE,
> + ? ? ? .jack_gpio ? ? ?= GPIO_NR_PALMTX_EARPHONE_DETECT,
> + ? ? ? .bl_bl ? ? ? ? ?= GPIO_NR_PALMTX_BL_POWER,
> + ? ? ? .bl_lcd ? ? ? ? = GPIO_NR_PALMTX_LCD_POWER,
> + ? ? ? .power_ac ? ? ? = GPIO_NR_PALMTX_POWER_DETECT,
> + ? ? ? .power_usb ? ? ?= -1,
> + ? ? ? .lcd_power ? ? ?= -1,
> +};
>
> ?static void __init palmtx_init(void)
> ?{
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
> -
> - ? ? ? pxa_set_ffuart_info(NULL);
> - ? ? ? pxa_set_btuart_info(NULL);
> - ? ? ? pxa_set_stuart_info(NULL);
> -
> - ? ? ? palmtx_pm_init();
> - ? ? ? set_pxa_fb_info(&palmtx_lcd_screen);
> - ? ? ? pxa_set_mci_info(&palmtx_mci_platform_data);
> - ? ? ? palmtx_udc_init();
> - ? ? ? pxa_set_ac97_info(&palmtx_ac97_pdata);
> - ? ? ? pxa_set_ficp_info(&palmtx_ficp_platform_data);
> + ? ? ? palm27x_common_init(&palmtx);
> ? ? ? ?pxa_set_keypad_info(&palmtx_keypad_platform_data);
> -
> ? ? ? ?platform_add_devices(devices, ARRAY_SIZE(devices));
> ?}
>
> diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
> index b78c6b4..10b06ad 100644
> --- a/arch/arm/mach-pxa/palmz72.c
> +++ b/arch/arm/mach-pxa/palmz72.c
> @@ -44,6 +44,7 @@
> ?#include <mach/pxa27x_keypad.h>
> ?#include <mach/udc.h>
> ?#include <mach/palmasoc.h>
> +#include <mach/palm27x.h>
>
> ?#include <mach/pm.h>
>
> @@ -109,19 +110,6 @@ static unsigned long palmz72_pin_config[] __initdata = {
> ?};
>
> ?/******************************************************************************
> - * SD/MMC card controller
> - ******************************************************************************/
> -/* SD_POWER is not actually power, but it is more like chip
> - * select, i.e. it is inverted */
> -static struct pxamci_platform_data palmz72_mci_platform_data = {
> - ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
> - ? ? ? .gpio_card_detect ? ? ? = GPIO_NR_PALMZ72_SD_DETECT_N,
> - ? ? ? .gpio_card_ro ? ? ? ? ? = GPIO_NR_PALMZ72_SD_RO,
> - ? ? ? .gpio_power ? ? ? ? ? ? = GPIO_NR_PALMZ72_SD_POWER_N,
> - ? ? ? .gpio_power_invert ? ? ?= 1,
> -};
> -
> -/******************************************************************************
> ?* GPIO keyboard
> ?******************************************************************************/
> ?static unsigned int palmz72_matrix_keys[] = {
> @@ -150,74 +138,6 @@ static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
> ?};
>
> ?/******************************************************************************
> - * Backlight
> - ******************************************************************************/
> -static int palmz72_backlight_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMZ72_BL_POWER, "BL POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMZ72_BL_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_request(GPIO_NR_PALMZ72_LCD_POWER, "LCD POWER");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_direction_output(GPIO_NR_PALMZ72_LCD_POWER, 0);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err3;
> -
> - ? ? ? return 0;
> -err3:
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_LCD_POWER);
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_BL_POWER);
> -err:
> - ? ? ? return ret;
> -}
> -
> -static int palmz72_backlight_notify(struct device *dev, int brightness)
> -{
> - ? ? ? gpio_set_value(GPIO_NR_PALMZ72_BL_POWER, brightness);
> - ? ? ? gpio_set_value(GPIO_NR_PALMZ72_LCD_POWER, brightness);
> - ? ? ? return brightness;
> -}
> -
> -static void palmz72_backlight_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_BL_POWER);
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_LCD_POWER);
> -}
> -
> -static struct platform_pwm_backlight_data palmz72_backlight_data = {
> - ? ? ? .pwm_id ? ? ? ? = 0,
> - ? ? ? .max_brightness = PALMZ72_MAX_INTENSITY,
> - ? ? ? .dft_brightness = PALMZ72_MAX_INTENSITY,
> - ? ? ? .pwm_period_ns ?= PALMZ72_PERIOD_NS,
> - ? ? ? .init ? ? ? ? ? = palmz72_backlight_init,
> - ? ? ? .notify ? ? ? ? = palmz72_backlight_notify,
> - ? ? ? .exit ? ? ? ? ? = palmz72_backlight_exit,
> -};
> -
> -static struct platform_device palmz72_backlight = {
> - ? ? ? .name ? = "pwm-backlight",
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .parent ? ? ? ? = &pxa27x_device_pwm0.dev,
> - ? ? ? ? ? ? ? .platform_data ?= &palmz72_backlight_data,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * IrDA
> - ******************************************************************************/
> -static struct pxaficp_platform_data palmz72_ficp_platform_data = {
> - ? ? ? .gpio_pwdown ? ? ? ? ? ?= GPIO_NR_PALMZ72_IR_DISABLE,
> - ? ? ? .transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
> -};
> -
> -/******************************************************************************
> ?* LEDs
> ?******************************************************************************/
> ?static struct gpio_led gpio_leds[] = {
> @@ -241,145 +161,6 @@ static struct platform_device palmz72_leds = {
> ? ? ? ?}
> ?};
>
> -/******************************************************************************
> - * UDC
> - ******************************************************************************/
> -static struct gpio_vbus_mach_info palmz72_udc_info = {
> - ? ? ? .gpio_vbus ? ? ? ? ? ? ?= GPIO_NR_PALMZ72_USB_DETECT_N,
> - ? ? ? .gpio_pullup ? ? ? ? ? ?= GPIO_NR_PALMZ72_USB_PULLUP,
> -};
> -
> -static struct platform_device palmz72_gpio_vbus = {
> - ? ? ? .name ? = "gpio-vbus",
> - ? ? ? .id ? ? = -1,
> - ? ? ? .dev ? ?= {
> - ? ? ? ? ? ? ? .platform_data ?= &palmz72_udc_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * Power supply
> - ******************************************************************************/
> -static int power_supply_init(struct device *dev)
> -{
> - ? ? ? int ret;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMZ72_POWER_DETECT, "CABLE_STATE_AC");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err1;
> - ? ? ? ret = gpio_direction_input(GPIO_NR_PALMZ72_POWER_DETECT);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> -
> - ? ? ? ret = gpio_request(GPIO_NR_PALMZ72_USB_DETECT_N, "CABLE_STATE_USB");
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err2;
> - ? ? ? ret = gpio_direction_input(GPIO_NR_PALMZ72_USB_DETECT_N);
> - ? ? ? if (ret)
> - ? ? ? ? ? ? ? goto err3;
> -
> - ? ? ? return 0;
> -err3:
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_USB_DETECT_N);
> -err2:
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_POWER_DETECT);
> -err1:
> - ? ? ? return ret;
> -}
> -
> -static int palmz72_is_ac_online(void)
> -{
> - ? ? ? return gpio_get_value(GPIO_NR_PALMZ72_POWER_DETECT);
> -}
> -
> -static int palmz72_is_usb_online(void)
> -{
> - ? ? ? return !gpio_get_value(GPIO_NR_PALMZ72_USB_DETECT_N);
> -}
> -
> -static void power_supply_exit(struct device *dev)
> -{
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_USB_DETECT_N);
> - ? ? ? gpio_free(GPIO_NR_PALMZ72_POWER_DETECT);
> -}
> -
> -static char *palmz72_supplicants[] = {
> - ? ? ? "main-battery",
> -};
> -
> -static struct pda_power_pdata power_supply_info = {
> - ? ? ? .init ? ? ? ? ? ?= power_supply_init,
> - ? ? ? .is_ac_online ? ?= palmz72_is_ac_online,
> - ? ? ? .is_usb_online ? = palmz72_is_usb_online,
> - ? ? ? .exit ? ? ? ? ? ?= power_supply_exit,
> - ? ? ? .supplied_to ? ? = palmz72_supplicants,
> - ? ? ? .num_supplicants = ARRAY_SIZE(palmz72_supplicants),
> -};
> -
> -static struct platform_device power_supply = {
> - ? ? ? .name = "pda-power",
> - ? ? ? .id ? = -1,
> - ? ? ? .dev ?= {
> - ? ? ? ? ? ? ? .platform_data = &power_supply_info,
> - ? ? ? },
> -};
> -
> -/******************************************************************************
> - * WM97xx audio, battery
> - ******************************************************************************/
> -static struct wm97xx_batt_pdata palmz72_batt_pdata = {
> - ? ? ? .batt_aux ? ? ? = WM97XX_AUX_ID3,
> - ? ? ? .temp_aux ? ? ? = WM97XX_AUX_ID2,
> - ? ? ? .charge_gpio ? ?= -1,
> - ? ? ? .max_voltage ? ?= PALMZ72_BAT_MAX_VOLTAGE,
> - ? ? ? .min_voltage ? ?= PALMZ72_BAT_MIN_VOLTAGE,
> - ? ? ? .batt_mult ? ? ?= 1000,
> - ? ? ? .batt_div ? ? ? = 414,
> - ? ? ? .temp_mult ? ? ?= 1,
> - ? ? ? .temp_div ? ? ? = 1,
> - ? ? ? .batt_tech ? ? ?= POWER_SUPPLY_TECHNOLOGY_LIPO,
> - ? ? ? .batt_name ? ? ?= "main-batt",
> -};
> -
> -static struct wm97xx_pdata palmz72_wm97xx_pdata = {
> - ? ? ? .batt_pdata ? ? = &palmz72_batt_pdata,
> -};
> -
> -static pxa2xx_audio_ops_t palmz72_ac97_pdata = {
> - ? ? ? .codec_pdata ? ?= { &palmz72_wm97xx_pdata, },
> -};
> -
> -static struct platform_device palmz72_asoc = {
> - ? ? ? .name = "palm27x-asoc",
> - ? ? ? .id ? = -1,
> -};
> -
> -/******************************************************************************
> - * Framebuffer
> - ******************************************************************************/
> -static struct pxafb_mode_info palmz72_lcd_modes[] = {
> -{
> - ? ? ? .pixclock ? ? ? = 115384,
> - ? ? ? .xres ? ? ? ? ? = 320,
> - ? ? ? .yres ? ? ? ? ? = 320,
> - ? ? ? .bpp ? ? ? ? ? ?= 16,
> -
> - ? ? ? .left_margin ? ?= 27,
> - ? ? ? .right_margin ? = 7,
> - ? ? ? .upper_margin ? = 7,
> - ? ? ? .lower_margin ? = 8,
> -
> - ? ? ? .hsync_len ? ? ?= 6,
> - ? ? ? .vsync_len ? ? ?= 1,
> -},
> -};
> -
> -static struct pxafb_mach_info palmz72_lcd_screen = {
> - ? ? ? .modes ? ? ? ? ?= palmz72_lcd_modes,
> - ? ? ? .num_modes ? ? ?= ARRAY_SIZE(palmz72_lcd_modes),
> - ? ? ? .lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
> -};
> -
> ?#ifdef CONFIG_PM
>
> ?/* We have some black magic here
> @@ -457,39 +238,25 @@ device_initcall(palmz72_pm_init);
> ?/******************************************************************************
> ?* Machine init
> ?******************************************************************************/
> -static struct platform_device *devices[] __initdata = {
> - ? ? ? &palmz72_backlight,
> - ? ? ? &palmz72_leds,
> - ? ? ? &palmz72_asoc,
> - ? ? ? &power_supply,
> - ? ? ? &palmz72_gpio_vbus,
> +struct palm27x_handheld palmz72 = {
> + ? ? ? .mmc_detect ? ? = GPIO_NR_PALMZ72_SD_DETECT_N,
> + ? ? ? .mmc_ro ? ? ? ? = GPIO_NR_PALMZ72_SD_RO,
> + ? ? ? .mmc_power ? ? ?= GPIO_NR_PALMZ72_SD_POWER_N,
> + ? ? ? .pm_str_base ? ?= 0,
> + ? ? ? .udc_detect ? ? = GPIO_NR_PALMZ72_USB_DETECT_N,
> + ? ? ? .udc_pullup ? ? = GPIO_NR_PALMZ72_USB_PULLUP,
> + ? ? ? .irda_pwdn ? ? ?= GPIO_NR_PALMZ72_IR_DISABLE,
> + ? ? ? .batt_minv ? ? ?= PALMZ72_BAT_MIN_VOLTAGE,
> + ? ? ? .batt_maxv ? ? ?= PALMZ72_BAT_MAX_VOLTAGE,
> + ? ? ? .lcd_power ? ? ?= -1,
> ?};
>
> -/* setup udc GPIOs initial state */
> -static void __init palmz72_udc_init(void)
> -{
> - ? ? ? if (!gpio_request(GPIO_NR_PALMZ72_USB_PULLUP, "USB Pullup")) {
> - ? ? ? ? ? ? ? gpio_direction_output(GPIO_NR_PALMZ72_USB_PULLUP, 0);
> - ? ? ? ? ? ? ? gpio_free(GPIO_NR_PALMZ72_USB_PULLUP);
> - ? ? ? }
> -}
> -
> ?static void __init palmz72_init(void)
> ?{
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config));
> -
> - ? ? ? pxa_set_ffuart_info(NULL);
> - ? ? ? pxa_set_btuart_info(NULL);
> - ? ? ? pxa_set_stuart_info(NULL);
> -
> - ? ? ? set_pxa_fb_info(&palmz72_lcd_screen);
> - ? ? ? pxa_set_mci_info(&palmz72_mci_platform_data);
> - ? ? ? palmz72_udc_init();
> - ? ? ? pxa_set_ac97_info(&palmz72_ac97_pdata);
> - ? ? ? pxa_set_ficp_info(&palmz72_ficp_platform_data);
> + ? ? ? palm27x_common_init(&palmz72);
> ? ? ? ?pxa_set_keypad_info(&palmz72_keypad_platform_data);
> -
> - ? ? ? platform_add_devices(devices, ARRAY_SIZE(devices));
> + ? ? ? platform_device_register(&palmz72_leds);
> ?}
>
> ?MACHINE_START(PALMZ72, "Palm Zire72")
> --
> 1.7.1
>
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 03/13] [ARM] pxa/palm: Add core pmic support for Palm27x
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
2010-07-29 3:16 ` [PATCH 02/13] [ARM] pxa/palm: Flip Palm LD,TX,T5,Z72 to Palm27x Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-07-29 10:03 ` Mike Rapoport
2010-07-29 3:16 ` [PATCH 04/13] [ARM] pxa/palm: Modularize rest of code in Palms Marek Vasut
` (10 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/palm27x.c | 57 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
index ff5ee8c..a1009ec 100644
--- a/arch/arm/mach-pxa/palm27x.c
+++ b/arch/arm/mach-pxa/palm27x.c
@@ -21,6 +21,7 @@
#include <linux/wm97xx.h>
#include <linux/power_supply.h>
#include <linux/usb/gpio_vbus.h>
+#include <linux/regulator/max1586.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -35,6 +36,8 @@
#include <mach/palmasoc.h>
#include <mach/palm27x.h>
+#include <plat/i2c.h>
+
#include "generic.h"
#include "devices.h"
@@ -458,6 +461,59 @@ static void __init palm27x_power_init(int ac, int usb)
static inline void palm27x_power_init(int ac, int usb) {}
#endif
+/******************************************************************************
+ * Core power regulator
+ ******************************************************************************/
+#if defined(CONFIG_REGULATOR_MAX1586) || \
+ defined(CONFIG_REGULATOR_MAX1586_MODULE)
+static struct regulator_consumer_supply palm27x_max1587a_consumers[] = {
+ {
+ .supply = "vcc_core",
+ }
+};
+
+static struct regulator_init_data palm27x_max1587a_v3_info = {
+ .constraints = {
+ .name = "vcc_core range",
+ .min_uV = 900000,
+ .max_uV = 1705000,
+ .always_on = 1,
+ .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+ },
+ .consumer_supplies = palm27x_max1587a_consumers,
+ .num_consumer_supplies = ARRAY_SIZE(palm27x_max1587a_consumers),
+};
+
+static struct max1586_subdev_data palm27x_max1587a_subdevs[] = {
+ {
+ .name = "vcc_core",
+ .id = MAX1586_V3,
+ .platform_data = &palm27x_max1587a_v3_info,
+ }
+};
+
+static struct max1586_platform_data palm27x_max1587a_info = {
+ .subdevs = palm27x_max1587a_subdevs,
+ .num_subdevs = ARRAY_SIZE(palm27x_max1587a_subdevs),
+ .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
+};
+
+static struct i2c_board_info __initdata palm27x_pi2c_board_info[] = {
+ {
+ I2C_BOARD_INFO("max1586", 0x14),
+ .platform_data = &palm27x_max1587a_info,
+ },
+};
+
+static void __init palm27x_pmic_init(void)
+{
+ i2c_register_board_info(1, ARRAY_AND_SIZE(palm27x_pi2c_board_info));
+ pxa27x_set_i2c_power_info(NULL);
+}
+#else
+static inline void palm27x_pmic_init(void) {}
+#endif
+
void __init palm27x_common_init(struct palm27x_handheld *palm)
{
pxa_set_ffuart_info(NULL);
@@ -472,4 +528,5 @@ void __init palm27x_common_init(struct palm27x_handheld *palm)
palm27x_ac97_init(palm->batt_minv, palm->batt_maxv, palm->jack_gpio);
palm27x_pwm_init(palm->bl_bl, palm->bl_lcd);
palm27x_power_init(palm->power_ac, palm->power_usb);
+ palm27x_pmic_init();
}
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 03/13] [ARM] pxa/palm: Add core pmic support for Palm27x
2010-07-29 3:16 ` [PATCH 03/13] [ARM] pxa/palm: Add core pmic support for Palm27x Marek Vasut
@ 2010-07-29 10:03 ` Mike Rapoport
2010-08-04 3:16 ` Eric Miao
0 siblings, 1 reply; 40+ messages in thread
From: Mike Rapoport @ 2010-07-29 10:03 UTC (permalink / raw)
To: linux-arm-kernel
Marek Vasut wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> arch/arm/mach-pxa/palm27x.c | 57 +++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 57 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
> index ff5ee8c..a1009ec 100644
> --- a/arch/arm/mach-pxa/palm27x.c
> +++ b/arch/arm/mach-pxa/palm27x.c
> @@ -21,6 +21,7 @@
> #include <linux/wm97xx.h>
> #include <linux/power_supply.h>
> #include <linux/usb/gpio_vbus.h>
> +#include <linux/regulator/max1586.h>
>
> #include <asm/mach-types.h>
> #include <asm/mach/arch.h>
> @@ -35,6 +36,8 @@
> #include <mach/palmasoc.h>
> #include <mach/palm27x.h>
>
> +#include <plat/i2c.h>
> +
> #include "generic.h"
> #include "devices.h"
>
> @@ -458,6 +461,59 @@ static void __init palm27x_power_init(int ac, int usb)
> static inline void palm27x_power_init(int ac, int usb) {}
> #endif
>
> +/******************************************************************************
> + * Core power regulator
> + ******************************************************************************/
> +#if defined(CONFIG_REGULATOR_MAX1586) || \
> + defined(CONFIG_REGULATOR_MAX1586_MODULE)
> +static struct regulator_consumer_supply palm27x_max1587a_consumers[] = {
> + {
> + .supply = "vcc_core",
> + }
> +};
> +
> +static struct regulator_init_data palm27x_max1587a_v3_info = {
> + .constraints = {
> + .name = "vcc_core range",
> + .min_uV = 900000,
> + .max_uV = 1705000,
> + .always_on = 1,
> + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> + },
> + .consumer_supplies = palm27x_max1587a_consumers,
> + .num_consumer_supplies = ARRAY_SIZE(palm27x_max1587a_consumers),
> +};
> +
> +static struct max1586_subdev_data palm27x_max1587a_subdevs[] = {
> + {
> + .name = "vcc_core",
> + .id = MAX1586_V3,
> + .platform_data = &palm27x_max1587a_v3_info,
> + }
> +};
> +
> +static struct max1586_platform_data palm27x_max1587a_info = {
> + .subdevs = palm27x_max1587a_subdevs,
> + .num_subdevs = ARRAY_SIZE(palm27x_max1587a_subdevs),
> + .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
> +};
> +
> +static struct i2c_board_info __initdata palm27x_pi2c_board_info[] = {
> + {
> + I2C_BOARD_INFO("max1586", 0x14),
> + .platform_data = &palm27x_max1587a_info,
> + },
> +};
> +
> +static void __init palm27x_pmic_init(void)
> +{
> + i2c_register_board_info(1, ARRAY_AND_SIZE(palm27x_pi2c_board_info));
> + pxa27x_set_i2c_power_info(NULL);
Consider using PIO mode for PMIC communications
> +}
> +#else
> +static inline void palm27x_pmic_init(void) {}
> +#endif
> +
> void __init palm27x_common_init(struct palm27x_handheld *palm)
> {
> pxa_set_ffuart_info(NULL);
> @@ -472,4 +528,5 @@ void __init palm27x_common_init(struct palm27x_handheld *palm)
> palm27x_ac97_init(palm->batt_minv, palm->batt_maxv, palm->jack_gpio);
> palm27x_pwm_init(palm->bl_bl, palm->bl_lcd);
> palm27x_power_init(palm->power_ac, palm->power_usb);
> + palm27x_pmic_init();
> }
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 03/13] [ARM] pxa/palm: Add core pmic support for Palm27x
2010-07-29 10:03 ` Mike Rapoport
@ 2010-08-04 3:16 ` Eric Miao
0 siblings, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-08-04 3:16 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jul 29, 2010 at 6:03 PM, Mike Rapoport <mike@compulab.co.il> wrote:
> Marek Vasut wrote:
>>
>> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
>> ---
>> ?arch/arm/mach-pxa/palm27x.c | ? 57
>> +++++++++++++++++++++++++++++++++++++++++++
>> ?1 files changed, 57 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
>> index ff5ee8c..a1009ec 100644
>> --- a/arch/arm/mach-pxa/palm27x.c
>> +++ b/arch/arm/mach-pxa/palm27x.c
>> @@ -21,6 +21,7 @@
>> ?#include <linux/wm97xx.h>
>> ?#include <linux/power_supply.h>
>> ?#include <linux/usb/gpio_vbus.h>
>> +#include <linux/regulator/max1586.h>
>> ?#include <asm/mach-types.h>
>> ?#include <asm/mach/arch.h>
>> @@ -35,6 +36,8 @@
>> ?#include <mach/palmasoc.h>
>> ?#include <mach/palm27x.h>
>> ?+#include <plat/i2c.h>
>> +
>> ?#include "generic.h"
>> ?#include "devices.h"
>> ?@@ -458,6 +461,59 @@ static void __init palm27x_power_init(int ac, int
>> usb)
>> ?static inline void palm27x_power_init(int ac, int usb) {}
>> ?#endif
>>
>> ?+/******************************************************************************
>> + * Core power regulator
>> +
>> ******************************************************************************/
>> +#if defined(CONFIG_REGULATOR_MAX1586) || \
>> + ? ?defined(CONFIG_REGULATOR_MAX1586_MODULE)
>> +static struct regulator_consumer_supply palm27x_max1587a_consumers[] = {
>> + ? ? ? {
>> + ? ? ? ? ? ? ? .supply = "vcc_core",
>> + ? ? ? }
>> +};
>> +
>> +static struct regulator_init_data palm27x_max1587a_v3_info = {
>> + ? ? ? .constraints = {
>> + ? ? ? ? ? ? ? .name ? ? ? ? ? = "vcc_core range",
>> + ? ? ? ? ? ? ? .min_uV ? ? ? ? = 900000,
>> + ? ? ? ? ? ? ? .max_uV ? ? ? ? = 1705000,
>> + ? ? ? ? ? ? ? .always_on ? ? ?= 1,
>> + ? ? ? ? ? ? ? .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
>> + ? ? ? },
>> + ? ? ? .consumer_supplies ? ? ?= palm27x_max1587a_consumers,
>> + ? ? ? .num_consumer_supplies ?= ARRAY_SIZE(palm27x_max1587a_consumers),
>> +};
>> +
>> +static struct max1586_subdev_data palm27x_max1587a_subdevs[] = {
>> + ? ? ? {
>> + ? ? ? ? ? ? ? .name ? ? ? ? ? = "vcc_core",
>> + ? ? ? ? ? ? ? .id ? ? ? ? ? ? = MAX1586_V3,
>> + ? ? ? ? ? ? ? .platform_data ?= &palm27x_max1587a_v3_info,
>> + ? ? ? }
>> +};
>> +
>> +static struct max1586_platform_data palm27x_max1587a_info = {
>> + ? ? ? .subdevs ? ? = palm27x_max1587a_subdevs,
>> + ? ? ? .num_subdevs = ARRAY_SIZE(palm27x_max1587a_subdevs),
>> + ? ? ? .v3_gain ? ? = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
>> +};
>> +
>> +static struct i2c_board_info __initdata palm27x_pi2c_board_info[] = {
>> + ? ? ? {
>> + ? ? ? ? ? ? ? I2C_BOARD_INFO("max1586", 0x14),
>> + ? ? ? ? ? ? ? .platform_data ?= &palm27x_max1587a_info,
>> + ? ? ? },
>> +};
>> +
>> +static void __init palm27x_pmic_init(void)
>> +{
>> + ? ? ? i2c_register_board_info(1,
>> ARRAY_AND_SIZE(palm27x_pi2c_board_info));
>> + ? ? ? pxa27x_set_i2c_power_info(NULL);
>
> Consider using PIO mode for PMIC communications
>
Yep, otherwise looks good to me.
>> +}
>> +#else
>> +static inline void palm27x_pmic_init(void) {}
>> +#endif
>> +
>> ?void __init palm27x_common_init(struct palm27x_handheld *palm)
>> ?{
>> ? ? ? ?pxa_set_ffuart_info(NULL);
>> @@ -472,4 +528,5 @@ void __init palm27x_common_init(struct
>> palm27x_handheld *palm)
>> ? ? ? ?palm27x_ac97_init(palm->batt_minv, palm->batt_maxv,
>> palm->jack_gpio);
>> ? ? ? ?palm27x_pwm_init(palm->bl_bl, palm->bl_lcd);
>> ? ? ? ?palm27x_power_init(palm->power_ac, palm->power_usb);
>> + ? ? ? palm27x_pmic_init();
>> ?}
>
>
> --
> Sincerely yours,
> Mike.
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 04/13] [ARM] pxa/palm: Modularize rest of code in Palms
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
2010-07-29 3:16 ` [PATCH 02/13] [ARM] pxa/palm: Flip Palm LD,TX,T5,Z72 to Palm27x Marek Vasut
2010-07-29 3:16 ` [PATCH 03/13] [ARM] pxa/palm: Add core pmic support for Palm27x Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-08-04 3:26 ` Eric Miao
2010-07-29 3:16 ` [PATCH 05/13] [ARM] pxa/spitz: Rework spitz Marek Vasut
` (9 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/palmld.c | 63 +++++++++++++++----
arch/arm/mach-pxa/palmt5.c | 22 ++++++-
arch/arm/mach-pxa/palmtreo.c | 141 ++++++++++++++++++++----------------------
arch/arm/mach-pxa/palmtx.c | 49 ++++++++++++---
arch/arm/mach-pxa/palmz72.c | 22 ++++++-
5 files changed, 196 insertions(+), 101 deletions(-)
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index cac66ca..d59db0b 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -128,6 +128,7 @@ static unsigned long palmld_pin_config[] __initdata = {
/******************************************************************************
* NOR Flash
******************************************************************************/
+#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
static struct mtd_partition palmld_partitions[] = {
{
.name = "Flash",
@@ -161,9 +162,18 @@ static struct platform_device palmld_flash = {
},
};
+static void __init palmld_nor_init(void)
+{
+ platform_device_register(&palmld_flash);
+}
+#else
+static inline void palmld_nor_init(void) {}
+#endif
+
/******************************************************************************
* GPIO keyboard
******************************************************************************/
+#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmld_matrix_keys[] = {
KEY(0, 1, KEY_F2),
KEY(0, 2, KEY_UP),
@@ -190,9 +200,18 @@ static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
.debounce_interval = 30,
};
+static void __init palmld_kpc_init(void)
+{
+ pxa_set_keypad_info(&palmld_keypad_platform_data);
+}
+#else
+static inline void palmld_kpc_init(void) {}
+#endif
+
/******************************************************************************
* GPIO keys
******************************************************************************/
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
static struct gpio_keys_button palmld_pxa_buttons[] = {
{KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
{KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
@@ -212,9 +231,18 @@ static struct platform_device palmld_pxa_keys = {
},
};
+static void __init palmld_keys_init(void)
+{
+ platform_device_register(&palmld_pxa_keys);
+}
+#else
+static inline void palmld_keys_init(void) {}
+#endif
+
/******************************************************************************
* LEDs
******************************************************************************/
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
struct gpio_led gpio_leds[] = {
{
.name = "palmld:green:led",
@@ -240,26 +268,34 @@ static struct platform_device palmld_leds = {
}
};
+static void __init palmld_leds_init(void)
+{
+ platform_device_register(&palmld_leds);
+}
+#else
+static inline void palmld_leds_init(void) {}
+#endif
+
/******************************************************************************
* HDD
******************************************************************************/
-static struct platform_device palmld_hdd = {
+#if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
+static struct platform_device palmld_ide_device = {
.name = "pata_palmld",
.id = -1,
};
+static void __init palmld_ide_init(void)
+{
+ platform_device_register(&palmld_ide_device);
+}
+#else
+static inline void palmld_ide_init(void) {}
+#endif
+
/******************************************************************************
* Machine init
******************************************************************************/
-static struct platform_device *devices[] __initdata = {
-#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
- &palmld_pxa_keys,
-#endif
- &palmld_leds,
- &palmld_hdd,
- &palmld_flash,
-};
-
static struct map_desc palmld_io_desc[] __initdata = {
{
.virtual = PALMLD_IDE_VIRT,
@@ -301,8 +337,11 @@ static void __init palmld_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
palm27x_common_init(&palmld);
- pxa_set_keypad_info(&palmld_keypad_platform_data);
- platform_add_devices(devices, ARRAY_SIZE(devices));
+ palmld_kpc_init();
+ palmld_keys_init();
+ palmld_nor_init();
+ palmld_leds_init();
+ palmld_ide_init();
}
MACHINE_START(PALMLD, "Palm LifeDrive")
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 593f57c..45daf1b 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -106,6 +106,7 @@ static unsigned long palmt5_pin_config[] __initdata = {
/******************************************************************************
* GPIO keyboard
******************************************************************************/
+#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmt5_matrix_keys[] = {
KEY(0, 0, KEY_POWER),
KEY(0, 1, KEY_F1),
@@ -131,9 +132,18 @@ static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
.debounce_interval = 30,
};
+static void __init palmt5_kpc_init(void)
+{
+ pxa_set_keypad_info(&palmt5_keypad_platform_data);
+}
+#else
+static inline void palmt5_kpc_init(void) {}
+#endif
+
/******************************************************************************
* GPIO keys
******************************************************************************/
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
static struct gpio_keys_button palmt5_pxa_buttons[] = {
{KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
};
@@ -151,6 +161,14 @@ static struct platform_device palmt5_pxa_keys = {
},
};
+static void __init palmt5_keys_init(void)
+{
+ platform_device_register(&palmt5_pxa_keys);
+}
+#else
+static inline void palmt5_keys_init(void) {}
+#endif
+
/******************************************************************************
* Machine init
******************************************************************************/
@@ -176,8 +194,8 @@ static void __init palmt5_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
palm27x_common_init(&palmt5);
- pxa_set_keypad_info(&palmt5_keypad_platform_data);
- platform_device_register(&palmt5_pxa_keys);
+ palmt5_kpc_init();
+ palmt5_keys_init();
}
MACHINE_START(PALMT5, "Palm Tungsten|T5")
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index dcb5f93..93c83d4 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -161,7 +161,7 @@ static unsigned long centro685_pin_config[] __initdata = {
/******************************************************************************
* GPIO keyboard
******************************************************************************/
-#ifdef CONFIG_MACH_TREO680
+#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int treo680_matrix_keys[] = {
KEY(0, 0, KEY_F8), /* Red/Off/Power */
KEY(0, 1, KEY_LEFT),
@@ -221,19 +221,6 @@ static unsigned int treo680_matrix_keys[] = {
KEY(7, 5, KEY_I),
};
-static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = {
- .matrix_key_rows = 8,
- .matrix_key_cols = 7,
- .matrix_key_map = treo680_matrix_keys,
- .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
- .direct_key_map = { KEY_CONNECT },
- .direct_key_num = 1,
-
- .debounce_interval = 30,
-};
-#endif /* CONFIG_MACH_TREO680 */
-
-#ifdef CONFIG_MACH_CENTRO
static unsigned int centro_matrix_keys[] = {
KEY(0, 0, KEY_F9), /* Home */
KEY(0, 1, KEY_LEFT),
@@ -293,28 +280,50 @@ static unsigned int centro_matrix_keys[] = {
KEY(7, 5, KEY_I),
};
-static struct pxa27x_keypad_platform_data centro_keypad_platform_data = {
+static struct pxa27x_keypad_platform_data treo680_keypad_pdata = {
.matrix_key_rows = 8,
.matrix_key_cols = 7,
- .matrix_key_map = centro_matrix_keys,
- .matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys),
+ .matrix_key_map = treo680_matrix_keys,
+ .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
.direct_key_map = { KEY_CONNECT },
.direct_key_num = 1,
.debounce_interval = 30,
};
-#endif /* CONFIG_MACH_CENTRO */
+
+static void __init palmtreo_kpc_init(void)
+{
+ static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata;
+
+ if (machine_is_centro()) {
+ data->matrix_key_map = centro_matrix_keys;
+ data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys);
+ }
+
+ pxa_set_keypad_info(&treo680_keypad_pdata);
+}
+#else
+static inline void palmtreo_kpc_init(void) {}
+#endif
/******************************************************************************
* USB host
******************************************************************************/
-#ifdef CONFIG_MACH_TREO680
+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
static struct pxaohci_platform_data treo680_ohci_info = {
.port_mode = PMM_PERPORT_MODE,
.flags = ENABLE_PORT1 | ENABLE_PORT3,
.power_budget = 0,
};
-#endif /* CONFIG_MACH_TREO680 */
+
+static void __init palmtreo_uhc_init(void)
+{
+ if (machine_is_treo680())
+ pxa_set_ohci_info(&treo680_ohci_info);
+}
+#else
+static inline void palmtreo_uhc_init(void) {}
+#endif
/******************************************************************************
* Vibra and LEDs
@@ -343,16 +352,6 @@ static struct gpio_led_platform_data treo680_gpio_led_info = {
.num_leds = ARRAY_SIZE(treo680_gpio_leds),
};
-static struct platform_device treo680_leds = {
- .name = "leds-gpio",
- .id = -1,
- .dev = {
- .platform_data = &treo680_gpio_led_info,
- }
-};
-#endif /* CONFIG_MACH_TREO680 */
-
-#ifdef CONFIG_MACH_CENTRO
static struct gpio_led centro_gpio_leds[] = {
{
.name = "centro:vibra:vibra",
@@ -377,31 +376,28 @@ static struct gpio_led_platform_data centro_gpio_led_info = {
.num_leds = ARRAY_SIZE(centro_gpio_leds),
};
-static struct platform_device centro_leds = {
+static struct platform_device palmtreo_leds = {
.name = "leds-gpio",
.id = -1,
.dev = {
- .platform_data = ¢ro_gpio_led_info,
+ .platform_data = &treo680_gpio_led_info,
}
};
-#endif /* CONFIG_MACH_CENTRO */
+
+static void __init palmtreo_leds_init(void)
+{
+ if (machine_is_centro())
+ palmtreo_leds.dev.platform_data = ¢ro_gpio_led_info;
+
+ platform_device_register(&palmtreo_leds);
+}
+#else
+static inline void palmtreo_leds_init(void) {}
+#endif
/******************************************************************************
* Machine init
******************************************************************************/
-#ifdef CONFIG_MACH_TREO680
-static struct platform_device *treo680_devices[] __initdata = {
- &treo680_leds,
-};
-#endif /* CONFIG_MACH_TREO680 */
-
-#ifdef CONFIG_MACH_CENTRO
-static struct platform_device *centro_devices[] __initdata = {
- ¢ro_leds,
-};
-#endif /* CONFIG_MACH_CENTRO */
-
-#ifdef CONFIG_MACH_TREO680
struct palm27x_handheld palmtreo680 = {
.mmc_detect = GPIO_NR_TREO_SD_DETECT_N,
.mmc_ro = GPIO_NR_TREO680_SD_READONLY,
@@ -417,28 +413,6 @@ struct palm27x_handheld palmtreo680 = {
.lcd_power = GPIO_NR_TREO_BL_POWER,
};
-static void __init treo680_init(void)
-{
- pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
- pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
- palm27x_common_init(&palmtreo680);
- pxa_set_keypad_info(&treo680_keypad_platform_data);
- pxa_set_ohci_info(&treo680_ohci_info);
- platform_add_devices(ARRAY_AND_SIZE(treo680_devices));
-}
-
-MACHINE_START(TREO680, "Palm Treo 680")
- .phys_io = TREO_PHYS_IO_START,
- .io_pg_offst = io_p2v(0x40000000),
- .boot_params = 0xa0000100,
- .map_io = pxa_map_io,
- .init_irq = pxa27x_init_irq,
- .timer = &pxa_timer,
- .init_machine = treo680_init,
-MACHINE_END
-#endif /* CONFIG_MACH_TREO680 */
-
-#ifdef CONFIG_MACH_CENTRO
struct palm27x_handheld palmcentro = {
.mmc_detect = GPIO_NR_TREO_SD_DETECT_N,
.mmc_ro = -1,
@@ -454,15 +428,33 @@ struct palm27x_handheld palmcentro = {
.lcd_power = GPIO_NR_TREO_BL_POWER,
};
-static void __init centro_init(void)
+static void __init palmtreo_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
- pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
- palm27x_common_init(&palmcentro);
- pxa_set_keypad_info(¢ro_keypad_platform_data);
- platform_add_devices(ARRAY_AND_SIZE(centro_devices));
+
+ if (machine_is_centro()) {
+ pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
+ palm27x_common_init(&palmcentro);
+ } else {
+ pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
+ palm27x_common_init(&palmtreo680);
+ }
+
+ palmtreo_kpc_init();
+ palmtreo_uhc_init();
+ palmtreo_leds_init();
}
+MACHINE_START(TREO680, "Palm Treo 680")
+ .phys_io = TREO_PHYS_IO_START,
+ .io_pg_offst = io_p2v(0x40000000),
+ .boot_params = 0xa0000100,
+ .map_io = pxa_map_io,
+ .init_irq = pxa27x_init_irq,
+ .timer = &pxa_timer,
+ .init_machine = palmtreo_init,
+MACHINE_END
+
MACHINE_START(CENTRO, "Palm Centro 685")
.phys_io = TREO_PHYS_IO_START,
.io_pg_offst = io_p2v(0x40000000),
@@ -470,6 +462,5 @@ MACHINE_START(CENTRO, "Palm Centro 685")
.map_io = pxa_map_io,
.init_irq = pxa27x_init_irq,
.timer = &pxa_timer,
- .init_machine = centro_init,
+ .init_machine = palmtreo_init,
MACHINE_END
-#endif /* CONFIG_MACH_CENTRO */
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index f8ddffe..ad39d50 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -130,6 +130,7 @@ static unsigned long palmtx_pin_config[] __initdata = {
/******************************************************************************
* NOR Flash
******************************************************************************/
+#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
static struct mtd_partition palmtx_partitions[] = {
{
.name = "Flash",
@@ -163,9 +164,18 @@ static struct platform_device palmtx_flash = {
},
};
+static void __init palmtx_nor_init(void)
+{
+ platform_device_register(&palmtx_flash);
+}
+#else
+static inline void palmtx_nor_init(void) {}
+#endif
+
/******************************************************************************
* GPIO keyboard
******************************************************************************/
+#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmtx_matrix_keys[] = {
KEY(0, 0, KEY_POWER),
KEY(0, 1, KEY_F1),
@@ -191,9 +201,18 @@ static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
.debounce_interval = 30,
};
+static void __init palmtx_kpc_init(void)
+{
+ pxa_set_keypad_info(&palmtx_keypad_platform_data);
+}
+#else
+static inline void palmtx_kpc_init(void) {}
+#endif
+
/******************************************************************************
* GPIO keys
******************************************************************************/
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
static struct gpio_keys_button palmtx_pxa_buttons[] = {
{KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
};
@@ -211,9 +230,18 @@ static struct platform_device palmtx_pxa_keys = {
},
};
+static void __init palmtx_keys_init(void)
+{
+ platform_device_register(&palmtx_pxa_keys);
+}
+#else
+static inline void palmtx_keys_init(void) {}
+#endif
+
/******************************************************************************
* NAND Flash
******************************************************************************/
+#if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
@@ -273,18 +301,17 @@ static struct platform_device palmtx_nand = {
}
};
+static void __init palmtx_nand_init(void)
+{
+ platform_device_register(&palmtx_nand);
+}
+#else
+static inline void palmtx_nand_init(void) {}
+#endif
/******************************************************************************
* Machine init
******************************************************************************/
-static struct platform_device *devices[] __initdata = {
-#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
- &palmtx_pxa_keys,
-#endif
- &palmtx_flash,
- &palmtx_nand,
-};
-
static struct map_desc palmtx_io_desc[] __initdata = {
{
.virtual = PALMTX_PCMCIA_VIRT,
@@ -332,8 +359,10 @@ static void __init palmtx_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
palm27x_common_init(&palmtx);
- pxa_set_keypad_info(&palmtx_keypad_platform_data);
- platform_add_devices(devices, ARRAY_SIZE(devices));
+ palmtx_kpc_init();
+ palmtx_keys_init();
+ palmtx_nor_init();
+ palmtx_nand_init();
}
MACHINE_START(PALMTX, "Palm T|X")
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 10b06ad..fe8a6aa 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -112,6 +112,7 @@ static unsigned long palmz72_pin_config[] __initdata = {
/******************************************************************************
* GPIO keyboard
******************************************************************************/
+#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmz72_matrix_keys[] = {
KEY(0, 0, KEY_POWER),
KEY(0, 1, KEY_F1),
@@ -137,9 +138,18 @@ static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
.debounce_interval = 30,
};
+static void __init palmz72_kpc_init(void)
+{
+ pxa_set_keypad_info(&palmz72_keypad_platform_data);
+}
+#else
+static inline void palmz72_kpc_init(void) {}
+#endif
+
/******************************************************************************
* LEDs
******************************************************************************/
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
static struct gpio_led gpio_leds[] = {
{
.name = "palmz72:green:led",
@@ -161,6 +171,14 @@ static struct platform_device palmz72_leds = {
}
};
+static void __init palmz72_leds_init(void)
+{
+ platform_device_register(&palmz72_leds);
+}
+#else
+static inline void palmz72_leds_init(void) {}
+#endif
+
#ifdef CONFIG_PM
/* We have some black magic here
@@ -255,8 +273,8 @@ static void __init palmz72_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config));
palm27x_common_init(&palmz72);
- pxa_set_keypad_info(&palmz72_keypad_platform_data);
- platform_device_register(&palmz72_leds);
+ palmz72_kpc_init();
+ palmz72_leds_init();
}
MACHINE_START(PALMZ72, "Palm Zire72")
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 04/13] [ARM] pxa/palm: Modularize rest of code in Palms
2010-07-29 3:16 ` [PATCH 04/13] [ARM] pxa/palm: Modularize rest of code in Palms Marek Vasut
@ 2010-08-04 3:26 ` Eric Miao
0 siblings, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-08-04 3:26 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jul 29, 2010 at 11:16 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> ?arch/arm/mach-pxa/palmld.c ? | ? 63 +++++++++++++++----
> ?arch/arm/mach-pxa/palmt5.c ? | ? 22 ++++++-
> ?arch/arm/mach-pxa/palmtreo.c | ?141 ++++++++++++++++++++----------------------
> ?arch/arm/mach-pxa/palmtx.c ? | ? 49 ++++++++++++---
> ?arch/arm/mach-pxa/palmz72.c ?| ? 22 ++++++-
> ?5 files changed, 196 insertions(+), 101 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
> index cac66ca..d59db0b 100644
> --- a/arch/arm/mach-pxa/palmld.c
> +++ b/arch/arm/mach-pxa/palmld.c
> @@ -128,6 +128,7 @@ static unsigned long palmld_pin_config[] __initdata = {
> ?/******************************************************************************
> ?* NOR Flash
> ?******************************************************************************/
> +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
> ?static struct mtd_partition palmld_partitions[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.name ? ? ? ? ? = "Flash",
> @@ -161,9 +162,18 @@ static struct platform_device palmld_flash = {
> ? ? ? ?},
> ?};
>
> +static void __init palmld_nor_init(void)
> +{
> + ? ? ? platform_device_register(&palmld_flash);
> +}
> +#else
> +static inline void palmld_nor_init(void) {}
> +#endif
> +
> ?/******************************************************************************
> ?* GPIO keyboard
> ?******************************************************************************/
> +#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
> ?static unsigned int palmld_matrix_keys[] = {
> ? ? ? ?KEY(0, 1, KEY_F2),
> ? ? ? ?KEY(0, 2, KEY_UP),
> @@ -190,9 +200,18 @@ static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
> ? ? ? ?.debounce_interval ? ? ?= 30,
> ?};
>
> +static void __init palmld_kpc_init(void)
> +{
> + ? ? ? pxa_set_keypad_info(&palmld_keypad_platform_data);
> +}
> +#else
> +static inline void palmld_kpc_init(void) {}
> +#endif
> +
> ?/******************************************************************************
> ?* GPIO keys
> ?******************************************************************************/
> +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
> ?static struct gpio_keys_button palmld_pxa_buttons[] = {
> ? ? ? ?{KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
> ? ? ? ?{KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
> @@ -212,9 +231,18 @@ static struct platform_device palmld_pxa_keys = {
> ? ? ? ?},
> ?};
>
> +static void __init palmld_keys_init(void)
> +{
> + ? ? ? platform_device_register(&palmld_pxa_keys);
> +}
> +#else
> +static inline void palmld_keys_init(void) {}
> +#endif
> +
> ?/******************************************************************************
> ?* LEDs
> ?******************************************************************************/
> +#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
> ?struct gpio_led gpio_leds[] = {
> ?{
> ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "palmld:green:led",
> @@ -240,26 +268,34 @@ static struct platform_device palmld_leds = {
> ? ? ? ?}
> ?};
>
> +static void __init palmld_leds_init(void)
> +{
> + ? ? ? platform_device_register(&palmld_leds);
> +}
> +#else
> +static inline void palmld_leds_init(void) {}
> +#endif
> +
> ?/******************************************************************************
> ?* HDD
> ?******************************************************************************/
> -static struct platform_device palmld_hdd = {
> +#if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
> +static struct platform_device palmld_ide_device = {
> ? ? ? ?.name ? = "pata_palmld",
> ? ? ? ?.id ? ? = -1,
> ?};
>
> +static void __init palmld_ide_init(void)
> +{
> + ? ? ? platform_device_register(&palmld_ide_device);
> +}
> +#else
> +static inline void palmld_ide_init(void) {}
> +#endif
> +
> ?/******************************************************************************
> ?* Machine init
> ?******************************************************************************/
> -static struct platform_device *devices[] __initdata = {
> -#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
> - ? ? ? &palmld_pxa_keys,
> -#endif
> - ? ? ? &palmld_leds,
> - ? ? ? &palmld_hdd,
> - ? ? ? &palmld_flash,
> -};
> -
> ?static struct map_desc palmld_io_desc[] __initdata = {
> ?{
> ? ? ? ?.virtual ? ? ? ?= PALMLD_IDE_VIRT,
> @@ -301,8 +337,11 @@ static void __init palmld_init(void)
> ?{
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
> ? ? ? ?palm27x_common_init(&palmld);
> - ? ? ? pxa_set_keypad_info(&palmld_keypad_platform_data);
> - ? ? ? platform_add_devices(devices, ARRAY_SIZE(devices));
> + ? ? ? palmld_kpc_init();
> + ? ? ? palmld_keys_init();
The original code is already well modularized, I doubt we need to go this
far. And I guess the following function names will be a bit readable?
palmld_keypad_init();
palmld_gpio_keys_init();
'kpc' - Grrr.... will take a bit time to figure out it's KeyPad Controller...
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 05/13] [ARM] pxa/spitz: Rework spitz
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (2 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 04/13] [ARM] pxa/palm: Modularize rest of code in Palms Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-08-04 5:27 ` Eric Miao
2010-07-29 3:16 ` [PATCH 06/13] [ARM] pxa/spitz: Formating and naming fixes Marek Vasut
` (8 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
This huge patch mostly shuffles code. The spitz.c file contained terrible mess
and needed a cleanup, here it is:
1) Made every part modular, components are not built in if not selected.
2) Removed loads of preprocessor goo, mostly "#ifdef MACH_AKITA .... #endif" and
similar code. The kernel size will grow by a few kb now, but the file is much
more readable.
3) Reworked SD/CF power setting function and made it reentrant.
4) Add ISL6271A regulator support
5) Correctly register WM8750
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/include/mach/spitz.h | 6 +
arch/arm/mach-pxa/spitz.c | 474 ++++++++++++++++++++------------
2 files changed, 311 insertions(+), 169 deletions(-)
diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
index dc1ff25..685749a 100644
--- a/arch/arm/mach-pxa/include/mach/spitz.h
+++ b/arch/arm/mach-pxa/include/mach/spitz.h
@@ -181,3 +181,9 @@
#define SPITZ_IRQ_GPIO_CF2_IRQ IRQ_GPIO(SPITZ_GPIO_CF2_IRQ)
#define SPITZ_IRQ_GPIO_nSD_INT IRQ_GPIO(SPITZ_GPIO_nSD_INT)
#define SPITZ_IRQ_GPIO_nSD_DETECT IRQ_GPIO(SPITZ_GPIO_nSD_DETECT)
+
+/*
+ * Shared data structures
+ */
+extern struct platform_device spitzssp_device;
+extern struct sharpsl_charger_machinfo spitz_pm_machinfo;
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 5153bf3..24c4d27 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -18,14 +18,15 @@
#include <linux/gpio_keys.h>
#include <linux/gpio.h>
#include <linux/leds.h>
-#include <linux/mtd/physmap.h>
#include <linux/i2c.h>
#include <linux/i2c/pca953x.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
#include <linux/spi/corgi_lcd.h>
+#include <linux/mtd/physmap.h>
#include <linux/mtd/sharpsl.h>
#include <linux/input/matrix_keypad.h>
+#include <linux/regulator/machine.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
@@ -33,11 +34,9 @@
#include <asm/mach/sharpsl_param.h>
#include <asm/hardware/scoop.h>
-
#include <mach/pxa27x.h>
#include <mach/pxa27x-udc.h>
#include <mach/reset.h>
-#include <plat/i2c.h>
#include <mach/irda.h>
#include <mach/mmc.h>
#include <mach/ohci.h>
@@ -46,9 +45,14 @@
#include <mach/spitz.h>
#include <mach/sharpsl_pm.h>
+#include <plat/i2c.h>
+
#include "generic.h"
#include "devices.h"
+/******************************************************************************
+ * Pin configuration
+ ******************************************************************************/
static unsigned long spitz_pin_config[] __initdata = {
/* Chip Selects */
GPIO78_nCS_2, /* SCOOP #2 */
@@ -124,6 +128,11 @@ static unsigned long spitz_pin_config[] __initdata = {
GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */
};
+
+/******************************************************************************
+ * Scoop GPIO expander
+ ******************************************************************************/
+#if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE)
/*
* Spitz SCOOP Device #1
*/
@@ -182,43 +191,60 @@ struct platform_device spitzscoop2_device = {
.resource = spitz_scoop2_resources,
};
-#define SPITZ_PWR_SD 0x01
-#define SPITZ_PWR_CF 0x02
+static void __init spitz_scoop_init(void)
+{
+ platform_device_register(&spitz_scoop1_device);
+
+ /* Akita doesn't have the second SCOOP chip */
+ if (!machine_is_akita())
+ platform_device_register(&spitzscoop2_device);
+}
/* Power control is shared with between one of the CF slots and SD */
-static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
+static void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr)
{
- unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
+ unsigned short cpr;
+ unsigned long flags;
- if (new_cpr & 0x0007) {
+ if (new_cpr & 0x7) {
gpio_set_value(SPITZ_GPIO_CF_POWER, 1);
- if (!(cpr & 0x0002) && !(cpr & 0x0004))
- mdelay(5);
- if (device == SPITZ_PWR_CF)
- cpr |= 0x0002;
- if (device == SPITZ_PWR_SD)
- cpr |= 0x0004;
- write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
- } else {
- if (device == SPITZ_PWR_CF)
- cpr &= ~0x0002;
- if (device == SPITZ_PWR_SD)
- cpr &= ~0x0004;
- if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
- write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
- mdelay(1);
- gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
- } else {
- write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
- }
+ mdelay(5);
+ }
+
+ local_irq_save(flags);
+
+ cpr = read_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR);
+
+ if (enable & new_cpr)
+ cpr |= new_cpr;
+ else
+ cpr &= ~enable;
+
+ write_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR, cpr);
+
+ local_irq_restore(flags);
+
+ if (!(cpr & 0x7)) {
+ mdelay(1);
+ gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
}
}
-static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr)
+#else
+static inline void spitz_scoop_init(void) {}
+static inline void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) {}
+#endif
+
+/******************************************************************************
+ * PCMCIA
+ ******************************************************************************/
+#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
+static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr)
{
/* Only need to override behaviour for slot 0 */
if (nr == 0)
- spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr);
+ spitz_card_pwr_ctrl(
+ cpr & (SCOOP_CPR_CF_3V | SCOOP_CPR_CF_XV), cpr);
else
write_scoop_reg(scoop, SCOOP_CPR, cpr);
}
@@ -242,9 +268,23 @@ static struct scoop_pcmcia_config spitz_pcmcia_config = {
.power_ctrl = spitz_pcmcia_pwr,
};
-/*
- * Spitz Keyboard Device
- */
+static void __init spitz_pcmcia_init(void)
+{
+ /* Akita has only one PCMCIA slot used */
+ if (machine_is_akita())
+ spitz_pcmcia_config.num_devs = 1;
+
+ platform_scoop_config = &spitz_pcmcia_config;
+}
+#else
+static inline void spitz_pcmcia_init(void) {}
+#endif
+
+/******************************************************************************
+ * GPIO keyboard
+ ******************************************************************************/
+#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
+
#define SPITZ_KEY_CALENDAR KEY_F1
#define SPITZ_KEY_ADDRESS KEY_F2
#define SPITZ_KEY_FN KEY_F3
@@ -356,7 +396,18 @@ static struct platform_device spitzkbd_device = {
},
};
+static void __init spitz_mkp_init(void)
+{
+ platform_device_register(&spitzkbd_device);
+}
+#else
+static inline void spitz_mkp_init(void) {}
+#endif
+/******************************************************************************
+ * GPIO keys
+ ******************************************************************************/
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
static struct gpio_keys_button spitz_gpio_keys[] = {
{
.type = EV_PWR,
@@ -393,10 +444,18 @@ static struct platform_device spitz_gpio_keys_device = {
},
};
+static void __init spitz_keys_init(void)
+{
+ platform_device_register(&spitz_gpio_keys_device);
+}
+#else
+static inline void spitz_keys_init(void) {}
+#endif
-/*
- * Spitz LEDs
- */
+/******************************************************************************
+ * LEDs
+ ******************************************************************************/
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
static struct gpio_led spitz_gpio_leds[] = {
{
.name = "spitz:amber:charge",
@@ -423,11 +482,18 @@ static struct platform_device spitzled_device = {
},
};
-#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
-static struct pxa2xx_spi_master spitz_spi_info = {
- .num_chipselect = 3,
-};
+static void __init spitz_leds_init(void)
+{
+ platform_device_register(&spitzled_device);
+}
+#else
+static inline void spitz_leds_init(void) {}
+#endif
+/******************************************************************************
+ * SSP Devices
+ ******************************************************************************/
+#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
static void spitz_wait_for_hsync(void)
{
while (gpio_get_value(SPITZ_GPIO_HSYNC))
@@ -505,11 +571,17 @@ static struct spi_board_info spitz_spi_devices[] = {
},
};
+static struct pxa2xx_spi_master spitz_spi_info = {
+ .num_chipselect = 3,
+};
+
static void __init spitz_init_spi(void)
{
+ struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info;
+
if (machine_is_akita()) {
- spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT;
- spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON;
+ lcd_data->gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT;
+ lcd_data->gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON;
}
pxa2xx_set_spi_info(2, &spitz_spi_info);
@@ -519,20 +591,22 @@ static void __init spitz_init_spi(void)
static inline void spitz_init_spi(void) {}
#endif
+/******************************************************************************
+ * SD/MMC card controller
+ ******************************************************************************/
+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
/*
- * MMC/SD Device
- *
- * The card detect interrupt isn't debounced so we delay it by 250ms
- * to give the card a chance to fully insert/eject.
+ * NOTE: The card detect interrupt isn't debounced so we delay it by 250ms to
+ * give the card a chance to fully insert/eject.
*/
static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
{
struct pxamci_platform_data* p_d = dev->platform_data;
- if (( 1 << vdd) & p_d->ocr_mask)
- spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004);
+ if ((1 << vdd) & p_d->ocr_mask)
+ spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, SCOOP_CPR_SD_3V);
else
- spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
+ spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, 0x0);
}
static struct pxamci_platform_data spitz_mci_platform_data = {
@@ -544,10 +618,18 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
.gpio_power = -1,
};
+static void __init spitz_mmc_init(void)
+{
+ pxa_set_mci_info(&spitz_mci_platform_data);
+}
+#else
+static inline void spitz_mmc_init(void) {}
+#endif
-/*
- * USB Host (OHCI)
- */
+/******************************************************************************
+ * USB Host
+ ******************************************************************************/
+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
static int spitz_ohci_init(struct device *dev)
{
int err;
@@ -556,9 +638,7 @@ static int spitz_ohci_init(struct device *dev)
if (err)
return err;
- /* Only Port 2 is connected
- * Setup USB Port 2 Output Control Register
- */
+ /* Only Port 2 is connected, setup USB Port 2 Output Control Register */
UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1);
@@ -577,21 +657,39 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = {
.power_budget = 150,
};
+static void __init spitz_uhc_init(void)
+{
+ pxa_set_ohci_info(&spitz_ohci_platform_data);
+}
+#else
+static inline void spitz_uhc_init(void) {}
+#endif
-/*
- * Irda
- */
-
+/******************************************************************************
+ * IrDA
+ ******************************************************************************/
+#if defined(CONFIG_PXA_FICP) || defined(CONFIG_PXA_FICP_MODULE)
static struct pxaficp_platform_data spitz_ficp_platform_data = {
-/* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */
.transceiver_cap = IR_SIRMODE | IR_OFF,
};
+static void __init spitz_irda_init(void)
+{
+ if (machine_is_akita())
+ spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
+ else
+ spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
-/*
- * Spitz PXA Framebuffer
- */
+ pxa_set_ficp_info(&spitz_ficp_platform_data);
+}
+#else
+static inline void spitz_irda_init(void) {}
+#endif
+/******************************************************************************
+ * Framebuffer
+ ******************************************************************************/
+#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
static struct pxafb_mode_info spitz_pxafb_modes[] = {
{
.pixclock = 19231,
@@ -621,12 +719,24 @@ static struct pxafb_mode_info spitz_pxafb_modes[] = {
};
static struct pxafb_mach_info spitz_pxafb_info = {
- .modes = &spitz_pxafb_modes[0],
- .num_modes = 2,
+ .modes = spitz_pxafb_modes,
+ .num_modes = ARRAY_SIZE(spitz_pxafb_modes),
.fixed_modes = 1,
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING,
};
+static void __init spitz_lcd_init(void)
+{
+ set_pxa_fb_info(&spitz_pxafb_info);
+}
+#else
+static inline void spitz_lcd_init(void) {}
+#endif
+
+/******************************************************************************
+ * Framebuffer
+ ******************************************************************************/
+#if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE)
static struct mtd_partition sharpsl_nand_partitions[] = {
{
.name = "System Area",
@@ -653,6 +763,16 @@ static struct nand_bbt_descr sharpsl_bbt = {
.pattern = scan_ff_pattern
};
+static struct nand_ecclayout spitz_akita_oobinfo = {
+ .oobfree = { {0x08, 0x09} },
+ .eccbytes = 24,
+ .eccpos = {
+ 0x05, 0x01, 0x02, 0x03, 0x06, 0x07, 0x15, 0x11,
+ 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
+ 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37,
+ },
+};
+
static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
.badblock_pattern = &sharpsl_bbt,
.partitions = sharpsl_nand_partitions,
@@ -661,8 +781,8 @@ static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
static struct resource sharpsl_nand_resources[] = {
{
- .start = 0x0C000000,
- .end = 0x0C000FFF,
+ .start = PXA_CS3_PHYS,
+ .end = PXA_CS3_PHYS + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
};
@@ -672,10 +792,35 @@ static struct platform_device sharpsl_nand_device = {
.id = -1,
.resource = sharpsl_nand_resources,
.num_resources = ARRAY_SIZE(sharpsl_nand_resources),
- .dev.platform_data = &sharpsl_nand_platform_data,
+ .dev = {
+ .platform_data = &sharpsl_nand_platform_data,
+ }
};
+static void __init spitz_nand_init(void)
+{
+ if (machine_is_spitz()) {
+ sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
+ } else if (machine_is_akita()) {
+ sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
+ sharpsl_nand_bbt.len = 1;
+ sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
+ } else if (machine_is_borzoi()) {
+ sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
+ sharpsl_nand_bbt.len = 1;
+ sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
+ }
+
+ platform_device_register(&sharpsl_nand_device);
+}
+#else
+static inline void spitz_nand_init(void) {}
+#endif
+/******************************************************************************
+ * NOR Flash
+ ******************************************************************************/
+#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
static struct mtd_partition sharpsl_rom_parts[] = {
{
.name ="Boot PROM Filesystem",
@@ -692,8 +837,8 @@ static struct physmap_flash_data sharpsl_rom_data = {
static struct resource sharpsl_rom_resources[] = {
{
- .start = 0x00000000,
- .end = 0x007fffff,
+ .start = PXA_CS0_PHYS,
+ .end = PXA_CS0_PHYS + SZ_8M - 1,
.flags = IORESOURCE_MEM,
},
};
@@ -703,18 +848,86 @@ static struct platform_device sharpsl_rom_device = {
.id = -1,
.resource = sharpsl_rom_resources,
.num_resources = ARRAY_SIZE(sharpsl_rom_resources),
- .dev.platform_data = &sharpsl_rom_data,
+ .dev = {
+ .platform_data = &sharpsl_rom_data,
+ },
+};
+
+static void __init spitz_nor_init(void)
+{
+ platform_device_register(&sharpsl_rom_device);
+}
+#else
+static inline void spitz_nor_init(void) {}
+#endif
+
+/******************************************************************************
+ * GPIO expander
+ ******************************************************************************/
+#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
+static struct pca953x_platform_data akita_pca953x_pdata = {
+ .gpio_base = AKITA_IOEXP_GPIO_BASE,
+};
+
+static struct i2c_board_info spitz_i2c_devs[] = {
+ {
+ .type = "wm8750",
+ .addr = 0x1b,
+ }, {
+ .type = "max7310",
+ .addr = 0x18,
+ .platform_data = &akita_pca953x_pdata,
+ },
+};
+
+static struct regulator_consumer_supply isl6271a_consumers[] = {
+ {
+ .supply = "vcc_core",
+ }
};
-static struct platform_device *devices[] __initdata = {
- &spitzscoop_device,
- &spitzkbd_device,
- &spitz_gpio_keys_device,
- &spitzled_device,
- &sharpsl_nand_device,
- &sharpsl_rom_device,
+static struct regulator_init_data isl6271a_info[] = {
+ {
+ .constraints = {
+ .name = "vcc_core range",
+ .min_uV = 850000,
+ .max_uV = 1600000,
+ .always_on = 1,
+ .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+ },
+ .consumer_supplies = isl6271a_consumers,
+ .num_consumer_supplies = ARRAY_SIZE(isl6271a_consumers),
+ }
};
+static struct i2c_board_info spitz_pi2c_devs[] = {
+ {
+ .type = "isl6271a",
+ .addr = 0x0c,
+ .platform_data = &isl6271a_info,
+ },
+};
+
+static void __init spitz_i2c_init(void)
+{
+ int size = ARRAY_SIZE(spitz_i2c_devs);
+
+ /* Only Akita has the max7310 chip */
+ if (!machine_is_akita())
+ size--;
+
+ pxa_set_i2c_info(NULL);
+ pxa27x_set_i2c_power_info(NULL);
+ i2c_register_board_info(0, spitz_i2c_devs, size);
+ i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs));
+}
+#else
+static inline void spitz_i2c_init(void) {}
+#endif
+
+/******************************************************************************
+ * Machine init
+ ******************************************************************************/
static void spitz_poweroff(void)
{
arm_machine_restart('g', NULL);
@@ -723,26 +936,18 @@ static void spitz_poweroff(void)
static void spitz_restart(char mode, const char *cmd)
{
/* Bootloader magic for a reboot */
- if((MSC0 & 0xffff0000) == 0x7ff00000)
+ if ((MSC0 & 0xffff0000) == 0x7ff00000)
MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
spitz_poweroff();
}
-static void __init common_init(void)
+static void __init spitz_init(void)
{
init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
pm_power_off = spitz_poweroff;
arm_pm_restart = spitz_restart;
- if (machine_is_spitz()) {
- sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
- } else if (machine_is_akita()) {
- sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
- } else if (machine_is_borzoi()) {
- sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
- }
-
PMCR = 0x00;
/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
@@ -755,88 +960,19 @@ static void __init common_init(void)
pxa_set_stuart_info(NULL);
spitz_init_spi();
-
- platform_add_devices(devices, ARRAY_SIZE(devices));
- pxa_set_mci_info(&spitz_mci_platform_data);
- pxa_set_ohci_info(&spitz_ohci_platform_data);
- pxa_set_ficp_info(&spitz_ficp_platform_data);
- set_pxa_fb_info(&spitz_pxafb_info);
- pxa_set_i2c_info(NULL);
-}
-
-#if defined(CONFIG_MACH_AKITA) || defined(CONFIG_MACH_BORZOI)
-static struct nand_bbt_descr sharpsl_akita_bbt = {
- .options = 0,
- .offs = 4,
- .len = 1,
- .pattern = scan_ff_pattern
-};
-
-static struct nand_ecclayout akita_oobinfo = {
- .eccbytes = 24,
- .eccpos = {
- 0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
- 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
- 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
- .oobfree = {{0x08, 0x09}}
-};
-#endif
-
-#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
-static void __init spitz_init(void)
-{
- spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
-
-#ifdef CONFIG_MACH_BORZOI
- if (machine_is_borzoi()) {
- sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
- sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
- }
-#endif
-
- platform_scoop_config = &spitz_pcmcia_config;
-
- common_init();
-
- platform_device_register(&spitzscoop2_device);
-}
-#endif
-
-#ifdef CONFIG_MACH_AKITA
-/*
- * Akita IO Expander
- */
-static struct pca953x_platform_data akita_ioexp = {
- .gpio_base = AKITA_IOEXP_GPIO_BASE,
-};
-
-static struct i2c_board_info akita_i2c_board_info[] = {
- {
- .type = "max7310",
- .addr = 0x18,
- .platform_data = &akita_ioexp,
- }, {
- .type = "wm8750",
- .addr = 0x1b,
- },
-};
-
-static void __init akita_init(void)
-{
- spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
-
- sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
- sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
-
- /* We just pretend the second element of the array doesn't exist */
- spitz_pcmcia_config.num_devs = 1;
- platform_scoop_config = &spitz_pcmcia_config;
-
- i2c_register_board_info(0, ARRAY_AND_SIZE(akita_i2c_board_info));
-
- common_init();
+ spitz_scoop_init();
+ spitz_mkp_init();
+ spitz_keys_init();
+ spitz_leds_init();
+ spitz_mmc_init();
+ spitz_pcmcia_init();
+ spitz_irda_init();
+ spitz_uhc_init();
+ spitz_lcd_init();
+ spitz_nor_init();
+ spitz_nand_init();
+ spitz_i2c_init();
}
-#endif
static void __init fixup_spitz(struct machine_desc *desc,
struct tag *tags, char **cmdline, struct meminfo *mi)
@@ -879,7 +1015,7 @@ MACHINE_START(AKITA, "SHARP Akita")
.fixup = fixup_spitz,
.map_io = pxa_map_io,
.init_irq = pxa27x_init_irq,
- .init_machine = akita_init,
+ .init_machine = spitz_init,
.timer = &pxa_timer,
MACHINE_END
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 05/13] [ARM] pxa/spitz: Rework spitz
2010-07-29 3:16 ` [PATCH 05/13] [ARM] pxa/spitz: Rework spitz Marek Vasut
@ 2010-08-04 5:27 ` Eric Miao
0 siblings, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-08-04 5:27 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jul 29, 2010 at 11:16 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> This huge patch mostly shuffles code. The spitz.c file contained terrible mess
> and needed a cleanup, here it is:
>
> 1) Made every part modular, components are not built in if not selected.
> 2) Removed loads of preprocessor goo, mostly "#ifdef MACH_AKITA .... #endif" and
> ? similar code. The kernel size will grow by a few kb now, but the file is much
> ? more readable.
> 3) Reworked SD/CF power setting function and made it reentrant.
> 4) Add ISL6271A regulator support
> 5) Correctly register WM8750
>
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
This one looks good, applied.
> ---
> ?arch/arm/mach-pxa/include/mach/spitz.h | ? ?6 +
> ?arch/arm/mach-pxa/spitz.c ? ? ? ? ? ? ?| ?474 ++++++++++++++++++++------------
> ?2 files changed, 311 insertions(+), 169 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
> index dc1ff25..685749a 100644
> --- a/arch/arm/mach-pxa/include/mach/spitz.h
> +++ b/arch/arm/mach-pxa/include/mach/spitz.h
> @@ -181,3 +181,9 @@
> ?#define SPITZ_IRQ_GPIO_CF2_IRQ ? ? ? ?IRQ_GPIO(SPITZ_GPIO_CF2_IRQ)
> ?#define SPITZ_IRQ_GPIO_nSD_INT ? ? ? ?IRQ_GPIO(SPITZ_GPIO_nSD_INT)
> ?#define SPITZ_IRQ_GPIO_nSD_DETECT ? ? IRQ_GPIO(SPITZ_GPIO_nSD_DETECT)
> +
> +/*
> + * Shared data structures
> + */
> +extern struct platform_device spitzssp_device;
> +extern struct sharpsl_charger_machinfo spitz_pm_machinfo;
> diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
> index 5153bf3..24c4d27 100644
> --- a/arch/arm/mach-pxa/spitz.c
> +++ b/arch/arm/mach-pxa/spitz.c
> @@ -18,14 +18,15 @@
> ?#include <linux/gpio_keys.h>
> ?#include <linux/gpio.h>
> ?#include <linux/leds.h>
> -#include <linux/mtd/physmap.h>
> ?#include <linux/i2c.h>
> ?#include <linux/i2c/pca953x.h>
> ?#include <linux/spi/spi.h>
> ?#include <linux/spi/ads7846.h>
> ?#include <linux/spi/corgi_lcd.h>
> +#include <linux/mtd/physmap.h>
> ?#include <linux/mtd/sharpsl.h>
> ?#include <linux/input/matrix_keypad.h>
> +#include <linux/regulator/machine.h>
>
> ?#include <asm/setup.h>
> ?#include <asm/mach-types.h>
> @@ -33,11 +34,9 @@
> ?#include <asm/mach/sharpsl_param.h>
> ?#include <asm/hardware/scoop.h>
>
> -
> ?#include <mach/pxa27x.h>
> ?#include <mach/pxa27x-udc.h>
> ?#include <mach/reset.h>
> -#include <plat/i2c.h>
> ?#include <mach/irda.h>
> ?#include <mach/mmc.h>
> ?#include <mach/ohci.h>
> @@ -46,9 +45,14 @@
> ?#include <mach/spitz.h>
> ?#include <mach/sharpsl_pm.h>
>
> +#include <plat/i2c.h>
> +
> ?#include "generic.h"
> ?#include "devices.h"
>
> +/******************************************************************************
> + * Pin configuration
> + ******************************************************************************/
> ?static unsigned long spitz_pin_config[] __initdata = {
> ? ? ? ?/* Chip Selects */
> ? ? ? ?GPIO78_nCS_2, ? /* SCOOP #2 */
> @@ -124,6 +128,11 @@ static unsigned long spitz_pin_config[] __initdata = {
> ? ? ? ?GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, ? ? ? /* SPITZ_GPIO_RESET */
> ?};
>
> +
> +/******************************************************************************
> + * Scoop GPIO expander
> + ******************************************************************************/
> +#if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE)
> ?/*
> ?* Spitz SCOOP Device #1
> ?*/
> @@ -182,43 +191,60 @@ struct platform_device spitzscoop2_device = {
> ? ? ? ?.resource ? ? ? = spitz_scoop2_resources,
> ?};
>
> -#define SPITZ_PWR_SD 0x01
> -#define SPITZ_PWR_CF 0x02
> +static void __init spitz_scoop_init(void)
> +{
> + ? ? ? platform_device_register(&spitz_scoop1_device);
> +
> + ? ? ? /* Akita doesn't have the second SCOOP chip */
> + ? ? ? if (!machine_is_akita())
> + ? ? ? ? ? ? ? platform_device_register(&spitzscoop2_device);
> +}
>
> ?/* Power control is shared with between one of the CF slots and SD */
> -static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
> +static void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr)
> ?{
> - ? ? ? unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
> + ? ? ? unsigned short cpr;
> + ? ? ? unsigned long flags;
>
> - ? ? ? if (new_cpr & 0x0007) {
> + ? ? ? if (new_cpr & 0x7) {
> ? ? ? ? ? ? ? ?gpio_set_value(SPITZ_GPIO_CF_POWER, 1);
> - ? ? ? ? ? ? ? if (!(cpr & 0x0002) && !(cpr & 0x0004))
> - ? ? ? ? ? ? ? ? ? ? ? mdelay(5);
> - ? ? ? ? ? ? ? if (device == SPITZ_PWR_CF)
> - ? ? ? ? ? ? ? ? ? ? ? cpr |= 0x0002;
> - ? ? ? ? ? ? ? if (device == SPITZ_PWR_SD)
> - ? ? ? ? ? ? ? ? ? ? ? cpr |= 0x0004;
> - ? ? ? ? ? ? ? write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
> - ? ? ? } else {
> - ? ? ? ? ? ? ? if (device == SPITZ_PWR_CF)
> - ? ? ? ? ? ? ? ? ? ? ? cpr &= ~0x0002;
> - ? ? ? ? ? ? ? if (device == SPITZ_PWR_SD)
> - ? ? ? ? ? ? ? ? ? ? ? cpr &= ~0x0004;
> - ? ? ? ? ? ? ? if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
> - ? ? ? ? ? ? ? ? ? ? ? write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
> - ? ? ? ? ? ? ? ? ? ? ? mdelay(1);
> - ? ? ? ? ? ? ? ? ? ? ? gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
> - ? ? ? ? ? ? ? } else {
> - ? ? ? ? ? ? ? ? ? ? ? write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
> - ? ? ? ? ? ? ? }
> + ? ? ? ? ? ? ? mdelay(5);
> + ? ? ? }
> +
> + ? ? ? local_irq_save(flags);
> +
> + ? ? ? cpr = read_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR);
> +
> + ? ? ? if (enable & new_cpr)
> + ? ? ? ? ? ? ? cpr |= new_cpr;
> + ? ? ? else
> + ? ? ? ? ? ? ? cpr &= ~enable;
> +
> + ? ? ? write_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR, cpr);
> +
> + ? ? ? local_irq_restore(flags);
> +
> + ? ? ? if (!(cpr & 0x7)) {
> + ? ? ? ? ? ? ? mdelay(1);
> + ? ? ? ? ? ? ? gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
> ? ? ? ?}
> ?}
>
> -static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr)
> +#else
> +static inline void spitz_scoop_init(void) {}
> +static inline void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) {}
> +#endif
> +
> +/******************************************************************************
> + * PCMCIA
> + ******************************************************************************/
> +#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
> +static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr)
> ?{
> ? ? ? ?/* Only need to override behaviour for slot 0 */
> ? ? ? ?if (nr == 0)
> - ? ? ? ? ? ? ? spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr);
> + ? ? ? ? ? ? ? spitz_card_pwr_ctrl(
> + ? ? ? ? ? ? ? ? ? ? ? cpr & (SCOOP_CPR_CF_3V | SCOOP_CPR_CF_XV), cpr);
> ? ? ? ?else
> ? ? ? ? ? ? ? ?write_scoop_reg(scoop, SCOOP_CPR, cpr);
> ?}
> @@ -242,9 +268,23 @@ static struct scoop_pcmcia_config spitz_pcmcia_config = {
> ? ? ? ?.power_ctrl ? = spitz_pcmcia_pwr,
> ?};
>
> -/*
> - * Spitz Keyboard Device
> - */
> +static void __init spitz_pcmcia_init(void)
> +{
> + ? ? ? /* Akita has only one PCMCIA slot used */
> + ? ? ? if (machine_is_akita())
> + ? ? ? ? ? ? ? spitz_pcmcia_config.num_devs = 1;
> +
> + ? ? ? platform_scoop_config = &spitz_pcmcia_config;
> +}
> +#else
> +static inline void spitz_pcmcia_init(void) {}
> +#endif
> +
> +/******************************************************************************
> + * GPIO keyboard
> + ******************************************************************************/
> +#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
> +
> ?#define SPITZ_KEY_CALENDAR ? ? KEY_F1
> ?#define SPITZ_KEY_ADDRESS ? ? ?KEY_F2
> ?#define SPITZ_KEY_FN ? ? ? ? ? KEY_F3
> @@ -356,7 +396,18 @@ static struct platform_device spitzkbd_device = {
> ? ? ? ?},
> ?};
>
> +static void __init spitz_mkp_init(void)
> +{
> + ? ? ? platform_device_register(&spitzkbd_device);
> +}
> +#else
> +static inline void spitz_mkp_init(void) {}
> +#endif
>
> +/******************************************************************************
> + * GPIO keys
> + ******************************************************************************/
> +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
> ?static struct gpio_keys_button spitz_gpio_keys[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.type ? = EV_PWR,
> @@ -393,10 +444,18 @@ static struct platform_device spitz_gpio_keys_device = {
> ? ? ? ?},
> ?};
>
> +static void __init spitz_keys_init(void)
> +{
> + ? ? ? platform_device_register(&spitz_gpio_keys_device);
> +}
> +#else
> +static inline void spitz_keys_init(void) {}
> +#endif
>
> -/*
> - * Spitz LEDs
> - */
> +/******************************************************************************
> + * LEDs
> + ******************************************************************************/
> +#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
> ?static struct gpio_led spitz_gpio_leds[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "spitz:amber:charge",
> @@ -423,11 +482,18 @@ static struct platform_device spitzled_device = {
> ? ? ? ?},
> ?};
>
> -#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
> -static struct pxa2xx_spi_master spitz_spi_info = {
> - ? ? ? .num_chipselect = 3,
> -};
> +static void __init spitz_leds_init(void)
> +{
> + ? ? ? platform_device_register(&spitzled_device);
> +}
> +#else
> +static inline void spitz_leds_init(void) {}
> +#endif
>
> +/******************************************************************************
> + * SSP Devices
> + ******************************************************************************/
> +#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
> ?static void spitz_wait_for_hsync(void)
> ?{
> ? ? ? ?while (gpio_get_value(SPITZ_GPIO_HSYNC))
> @@ -505,11 +571,17 @@ static struct spi_board_info spitz_spi_devices[] = {
> ? ? ? ?},
> ?};
>
> +static struct pxa2xx_spi_master spitz_spi_info = {
> + ? ? ? .num_chipselect = 3,
> +};
> +
> ?static void __init spitz_init_spi(void)
> ?{
> + ? ? ? struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info;
> +
> ? ? ? ?if (machine_is_akita()) {
> - ? ? ? ? ? ? ? spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT;
> - ? ? ? ? ? ? ? spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON;
> + ? ? ? ? ? ? ? lcd_data->gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT;
> + ? ? ? ? ? ? ? lcd_data->gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON;
> ? ? ? ?}
>
> ? ? ? ?pxa2xx_set_spi_info(2, &spitz_spi_info);
> @@ -519,20 +591,22 @@ static void __init spitz_init_spi(void)
> ?static inline void spitz_init_spi(void) {}
> ?#endif
>
> +/******************************************************************************
> + * SD/MMC card controller
> + ******************************************************************************/
> +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
> ?/*
> - * MMC/SD Device
> - *
> - * The card detect interrupt isn't debounced so we delay it by 250ms
> - * to give the card a chance to fully insert/eject.
> + * NOTE: The card detect interrupt isn't debounced so we delay it by 250ms to
> + * give the card a chance to fully insert/eject.
> ?*/
> ?static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
> ?{
> ? ? ? ?struct pxamci_platform_data* p_d = dev->platform_data;
>
> - ? ? ? if (( 1 << vdd) & p_d->ocr_mask)
> - ? ? ? ? ? ? ? spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004);
> + ? ? ? if ((1 << vdd) & p_d->ocr_mask)
> + ? ? ? ? ? ? ? spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, SCOOP_CPR_SD_3V);
> ? ? ? ?else
> - ? ? ? ? ? ? ? spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
> + ? ? ? ? ? ? ? spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, 0x0);
> ?}
>
> ?static struct pxamci_platform_data spitz_mci_platform_data = {
> @@ -544,10 +618,18 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
> ? ? ? ?.gpio_power ? ? ? ? ? ? = -1,
> ?};
>
> +static void __init spitz_mmc_init(void)
> +{
> + ? ? ? pxa_set_mci_info(&spitz_mci_platform_data);
> +}
> +#else
> +static inline void spitz_mmc_init(void) {}
> +#endif
>
> -/*
> - * USB Host (OHCI)
> - */
> +/******************************************************************************
> + * USB Host
> + ******************************************************************************/
> +#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
> ?static int spitz_ohci_init(struct device *dev)
> ?{
> ? ? ? ?int err;
> @@ -556,9 +638,7 @@ static int spitz_ohci_init(struct device *dev)
> ? ? ? ?if (err)
> ? ? ? ? ? ? ? ?return err;
>
> - ? ? ? /* Only Port 2 is connected
> - ? ? ? ?* Setup USB Port 2 Output Control Register
> - ? ? ? ?*/
> + ? ? ? /* Only Port 2 is connected, setup USB Port 2 Output Control Register */
> ? ? ? ?UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
>
> ? ? ? ?return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1);
> @@ -577,21 +657,39 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = {
> ? ? ? ?.power_budget ? = 150,
> ?};
>
> +static void __init spitz_uhc_init(void)
> +{
> + ? ? ? pxa_set_ohci_info(&spitz_ohci_platform_data);
> +}
> +#else
> +static inline void spitz_uhc_init(void) {}
> +#endif
>
> -/*
> - * Irda
> - */
> -
> +/******************************************************************************
> + * IrDA
> + ******************************************************************************/
> +#if defined(CONFIG_PXA_FICP) || defined(CONFIG_PXA_FICP_MODULE)
> ?static struct pxaficp_platform_data spitz_ficp_platform_data = {
> -/* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */
> ? ? ? ?.transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
> ?};
>
> +static void __init spitz_irda_init(void)
> +{
> + ? ? ? if (machine_is_akita())
> + ? ? ? ? ? ? ? spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
> + ? ? ? else
> + ? ? ? ? ? ? ? spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
>
> -/*
> - * Spitz PXA Framebuffer
> - */
> + ? ? ? pxa_set_ficp_info(&spitz_ficp_platform_data);
> +}
> +#else
> +static inline void spitz_irda_init(void) {}
> +#endif
>
> +/******************************************************************************
> + * Framebuffer
> + ******************************************************************************/
> +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
> ?static struct pxafb_mode_info spitz_pxafb_modes[] = {
> ?{
> ? ? ? ?.pixclock ? ? ? = 19231,
> @@ -621,12 +719,24 @@ static struct pxafb_mode_info spitz_pxafb_modes[] = {
> ?};
>
> ?static struct pxafb_mach_info spitz_pxafb_info = {
> - ? ? ? .modes ? ? ? ? ?= &spitz_pxafb_modes[0],
> - ? ? ? .num_modes ? ? ?= 2,
> + ? ? ? .modes ? ? ? ? ?= spitz_pxafb_modes,
> + ? ? ? .num_modes ? ? ?= ARRAY_SIZE(spitz_pxafb_modes),
> ? ? ? ?.fixed_modes ? ?= 1,
> ? ? ? ?.lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING,
> ?};
>
> +static void __init spitz_lcd_init(void)
> +{
> + ? ? ? set_pxa_fb_info(&spitz_pxafb_info);
> +}
> +#else
> +static inline void spitz_lcd_init(void) {}
> +#endif
> +
> +/******************************************************************************
> + * Framebuffer
> + ******************************************************************************/
> +#if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE)
> ?static struct mtd_partition sharpsl_nand_partitions[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.name = "System Area",
> @@ -653,6 +763,16 @@ static struct nand_bbt_descr sharpsl_bbt = {
> ? ? ? ?.pattern = scan_ff_pattern
> ?};
>
> +static struct nand_ecclayout spitz_akita_oobinfo = {
> + ? ? ? .oobfree ? ? ? ?= { {0x08, 0x09} },
> + ? ? ? .eccbytes ? ? ? = 24,
> + ? ? ? .eccpos ? ? ? ? = {
> + ? ? ? ? ? ? ? ? ? ? ? 0x05, 0x01, 0x02, 0x03, 0x06, 0x07, 0x15, 0x11,
> + ? ? ? ? ? ? ? ? ? ? ? 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
> + ? ? ? ? ? ? ? ? ? ? ? 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37,
> + ? ? ? },
> +};
> +
> ?static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
> ? ? ? ?.badblock_pattern ? ? ? = &sharpsl_bbt,
> ? ? ? ?.partitions ? ? ? ? ? ? = sharpsl_nand_partitions,
> @@ -661,8 +781,8 @@ static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
>
> ?static struct resource sharpsl_nand_resources[] = {
> ? ? ? ?{
> - ? ? ? ? ? ? ? .start ?= 0x0C000000,
> - ? ? ? ? ? ? ? .end ? ?= 0x0C000FFF,
> + ? ? ? ? ? ? ? .start ?= PXA_CS3_PHYS,
> + ? ? ? ? ? ? ? .end ? ?= PXA_CS3_PHYS + SZ_4K - 1,
> ? ? ? ? ? ? ? ?.flags ?= IORESOURCE_MEM,
> ? ? ? ?},
> ?};
> @@ -672,10 +792,35 @@ static struct platform_device sharpsl_nand_device = {
> ? ? ? ?.id ? ? ? ? ? ? = -1,
> ? ? ? ?.resource ? ? ? = sharpsl_nand_resources,
> ? ? ? ?.num_resources ?= ARRAY_SIZE(sharpsl_nand_resources),
> - ? ? ? .dev.platform_data ? ? ?= &sharpsl_nand_platform_data,
> + ? ? ? .dev ? ? ? ? ? ?= {
> + ? ? ? ? ? ? ? .platform_data ?= &sharpsl_nand_platform_data,
> + ? ? ? }
> ?};
>
> +static void __init spitz_nand_init(void)
> +{
> + ? ? ? if (machine_is_spitz()) {
> + ? ? ? ? ? ? ? sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
> + ? ? ? } else if (machine_is_akita()) {
> + ? ? ? ? ? ? ? sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
> + ? ? ? ? ? ? ? sharpsl_nand_bbt.len = 1;
> + ? ? ? ? ? ? ? sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
> + ? ? ? } else if (machine_is_borzoi()) {
> + ? ? ? ? ? ? ? sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
> + ? ? ? ? ? ? ? sharpsl_nand_bbt.len = 1;
> + ? ? ? ? ? ? ? sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
> + ? ? ? }
> +
> + ? ? ? platform_device_register(&sharpsl_nand_device);
> +}
> +#else
> +static inline void spitz_nand_init(void) {}
> +#endif
>
> +/******************************************************************************
> + * NOR Flash
> + ******************************************************************************/
> +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
> ?static struct mtd_partition sharpsl_rom_parts[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.name ? ="Boot PROM Filesystem",
> @@ -692,8 +837,8 @@ static struct physmap_flash_data sharpsl_rom_data = {
>
> ?static struct resource sharpsl_rom_resources[] = {
> ? ? ? ?{
> - ? ? ? ? ? ? ? .start ?= 0x00000000,
> - ? ? ? ? ? ? ? .end ? ?= 0x007fffff,
> + ? ? ? ? ? ? ? .start ?= PXA_CS0_PHYS,
> + ? ? ? ? ? ? ? .end ? ?= PXA_CS0_PHYS + SZ_8M - 1,
> ? ? ? ? ? ? ? ?.flags ?= IORESOURCE_MEM,
> ? ? ? ?},
> ?};
> @@ -703,18 +848,86 @@ static struct platform_device sharpsl_rom_device = {
> ? ? ? ?.id ? ? = -1,
> ? ? ? ?.resource = sharpsl_rom_resources,
> ? ? ? ?.num_resources = ARRAY_SIZE(sharpsl_rom_resources),
> - ? ? ? .dev.platform_data = &sharpsl_rom_data,
> + ? ? ? .dev ? ? ? ? ? ?= {
> + ? ? ? ? ? ? ? .platform_data ?= &sharpsl_rom_data,
> + ? ? ? },
> +};
> +
> +static void __init spitz_nor_init(void)
> +{
> + ? ? ? platform_device_register(&sharpsl_rom_device);
> +}
> +#else
> +static inline void spitz_nor_init(void) {}
> +#endif
> +
> +/******************************************************************************
> + * GPIO expander
> + ******************************************************************************/
> +#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
> +static struct pca953x_platform_data akita_pca953x_pdata = {
> + ? ? ? .gpio_base ? ? ? ? ? ? ?= AKITA_IOEXP_GPIO_BASE,
> +};
> +
> +static struct i2c_board_info spitz_i2c_devs[] = {
> + ? ? ? {
> + ? ? ? ? ? ? ? .type ? ? ? ? ? = "wm8750",
> + ? ? ? ? ? ? ? .addr ? ? ? ? ? = 0x1b,
> + ? ? ? }, {
> + ? ? ? ? ? ? ? .type ? ? ? ? ? = "max7310",
> + ? ? ? ? ? ? ? .addr ? ? ? ? ? = 0x18,
> + ? ? ? ? ? ? ? .platform_data ?= &akita_pca953x_pdata,
> + ? ? ? },
> +};
> +
> +static struct regulator_consumer_supply isl6271a_consumers[] = {
> + ? ? ? {
> + ? ? ? ? ? ? ? .supply = "vcc_core",
> + ? ? ? }
> ?};
>
> -static struct platform_device *devices[] __initdata = {
> - ? ? ? &spitzscoop_device,
> - ? ? ? &spitzkbd_device,
> - ? ? ? &spitz_gpio_keys_device,
> - ? ? ? &spitzled_device,
> - ? ? ? &sharpsl_nand_device,
> - ? ? ? &sharpsl_rom_device,
> +static struct regulator_init_data isl6271a_info[] = {
> + ? ? ? {
> + ? ? ? ? ? ? ? .constraints = {
> + ? ? ? ? ? ? ? ? ? ? ? .name ? ? ? ? ? = "vcc_core range",
> + ? ? ? ? ? ? ? ? ? ? ? .min_uV ? ? ? ? = 850000,
> + ? ? ? ? ? ? ? ? ? ? ? .max_uV ? ? ? ? = 1600000,
> + ? ? ? ? ? ? ? ? ? ? ? .always_on ? ? ?= 1,
> + ? ? ? ? ? ? ? ? ? ? ? .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
> + ? ? ? ? ? ? ? },
> + ? ? ? .consumer_supplies ? ? ?= isl6271a_consumers,
> + ? ? ? .num_consumer_supplies ?= ARRAY_SIZE(isl6271a_consumers),
> + ? ? ? }
> ?};
>
> +static struct i2c_board_info spitz_pi2c_devs[] = {
> + ? ? ? {
> + ? ? ? ? ? ? ? .type ? ? ? ? ? = "isl6271a",
> + ? ? ? ? ? ? ? .addr ? ? ? ? ? = 0x0c,
> + ? ? ? ? ? ? ? .platform_data ?= &isl6271a_info,
> + ? ? ? },
> +};
> +
> +static void __init spitz_i2c_init(void)
> +{
> + ? ? ? int size = ARRAY_SIZE(spitz_i2c_devs);
> +
> + ? ? ? /* Only Akita has the max7310 chip */
> + ? ? ? if (!machine_is_akita())
> + ? ? ? ? ? ? ? size--;
> +
> + ? ? ? pxa_set_i2c_info(NULL);
> + ? ? ? pxa27x_set_i2c_power_info(NULL);
> + ? ? ? i2c_register_board_info(0, spitz_i2c_devs, size);
> + ? ? ? i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs));
> +}
> +#else
> +static inline void spitz_i2c_init(void) {}
> +#endif
> +
> +/******************************************************************************
> + * Machine init
> + ******************************************************************************/
> ?static void spitz_poweroff(void)
> ?{
> ? ? ? ?arm_machine_restart('g', NULL);
> @@ -723,26 +936,18 @@ static void spitz_poweroff(void)
> ?static void spitz_restart(char mode, const char *cmd)
> ?{
> ? ? ? ?/* Bootloader magic for a reboot */
> - ? ? ? if((MSC0 & 0xffff0000) == 0x7ff00000)
> + ? ? ? if ((MSC0 & 0xffff0000) == 0x7ff00000)
> ? ? ? ? ? ? ? ?MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
>
> ? ? ? ?spitz_poweroff();
> ?}
>
> -static void __init common_init(void)
> +static void __init spitz_init(void)
> ?{
> ? ? ? ?init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
> ? ? ? ?pm_power_off = spitz_poweroff;
> ? ? ? ?arm_pm_restart = spitz_restart;
>
> - ? ? ? if (machine_is_spitz()) {
> - ? ? ? ? ? ? ? sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
> - ? ? ? } else if (machine_is_akita()) {
> - ? ? ? ? ? ? ? sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
> - ? ? ? } else if (machine_is_borzoi()) {
> - ? ? ? ? ? ? ? sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
> - ? ? ? }
> -
> ? ? ? ?PMCR = 0x00;
>
> ? ? ? ?/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
> @@ -755,88 +960,19 @@ static void __init common_init(void)
> ? ? ? ?pxa_set_stuart_info(NULL);
>
> ? ? ? ?spitz_init_spi();
> -
> - ? ? ? platform_add_devices(devices, ARRAY_SIZE(devices));
> - ? ? ? pxa_set_mci_info(&spitz_mci_platform_data);
> - ? ? ? pxa_set_ohci_info(&spitz_ohci_platform_data);
> - ? ? ? pxa_set_ficp_info(&spitz_ficp_platform_data);
> - ? ? ? set_pxa_fb_info(&spitz_pxafb_info);
> - ? ? ? pxa_set_i2c_info(NULL);
> -}
> -
> -#if defined(CONFIG_MACH_AKITA) || defined(CONFIG_MACH_BORZOI)
> -static struct nand_bbt_descr sharpsl_akita_bbt = {
> - ? ? ? .options = 0,
> - ? ? ? .offs = 4,
> - ? ? ? .len = 1,
> - ? ? ? .pattern = scan_ff_pattern
> -};
> -
> -static struct nand_ecclayout akita_oobinfo = {
> - ? ? ? .eccbytes = 24,
> - ? ? ? .eccpos = {
> - ? ? ? ? ? ? ? ? ?0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
> - ? ? ? ? ? ? ? ? ?0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
> - ? ? ? ? ? ? ? ? ?0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
> - ? ? ? .oobfree = {{0x08, 0x09}}
> -};
> -#endif
> -
> -#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
> -static void __init spitz_init(void)
> -{
> - ? ? ? spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
> -
> -#ifdef CONFIG_MACH_BORZOI
> - ? ? ? if (machine_is_borzoi()) {
> - ? ? ? ? ? ? ? sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
> - ? ? ? ? ? ? ? sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
> - ? ? ? }
> -#endif
> -
> - ? ? ? platform_scoop_config = &spitz_pcmcia_config;
> -
> - ? ? ? common_init();
> -
> - ? ? ? platform_device_register(&spitzscoop2_device);
> -}
> -#endif
> -
> -#ifdef CONFIG_MACH_AKITA
> -/*
> - * Akita IO Expander
> - */
> -static struct pca953x_platform_data akita_ioexp = {
> - ? ? ? .gpio_base ? ? ? ? ? ? ?= AKITA_IOEXP_GPIO_BASE,
> -};
> -
> -static struct i2c_board_info akita_i2c_board_info[] = {
> - ? ? ? {
> - ? ? ? ? ? ? ? .type ? ? ? ? ? = "max7310",
> - ? ? ? ? ? ? ? .addr ? ? ? ? ? = 0x18,
> - ? ? ? ? ? ? ? .platform_data ?= &akita_ioexp,
> - ? ? ? }, {
> - ? ? ? ? ? ? ? .type ? ? ? ? ? = "wm8750",
> - ? ? ? ? ? ? ? .addr ? ? ? ? ? = 0x1b,
> - ? ? ? },
> -};
> -
> -static void __init akita_init(void)
> -{
> - ? ? ? spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
> -
> - ? ? ? sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
> - ? ? ? sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
> -
> - ? ? ? /* We just pretend the second element of the array doesn't exist */
> - ? ? ? spitz_pcmcia_config.num_devs = 1;
> - ? ? ? platform_scoop_config = &spitz_pcmcia_config;
> -
> - ? ? ? i2c_register_board_info(0, ARRAY_AND_SIZE(akita_i2c_board_info));
> -
> - ? ? ? common_init();
> + ? ? ? spitz_scoop_init();
> + ? ? ? spitz_mkp_init();
> + ? ? ? spitz_keys_init();
> + ? ? ? spitz_leds_init();
> + ? ? ? spitz_mmc_init();
> + ? ? ? spitz_pcmcia_init();
> + ? ? ? spitz_irda_init();
> + ? ? ? spitz_uhc_init();
> + ? ? ? spitz_lcd_init();
> + ? ? ? spitz_nor_init();
> + ? ? ? spitz_nand_init();
> + ? ? ? spitz_i2c_init();
> ?}
> -#endif
>
> ?static void __init fixup_spitz(struct machine_desc *desc,
> ? ? ? ? ? ? ? ?struct tag *tags, char **cmdline, struct meminfo *mi)
> @@ -879,7 +1015,7 @@ MACHINE_START(AKITA, "SHARP Akita")
> ? ? ? ?.fixup ? ? ? ? ?= fixup_spitz,
> ? ? ? ?.map_io ? ? ? ? = pxa_map_io,
> ? ? ? ?.init_irq ? ? ? = pxa27x_init_irq,
> - ? ? ? .init_machine ? = akita_init,
> + ? ? ? .init_machine ? = spitz_init,
> ? ? ? ?.timer ? ? ? ? ?= &pxa_timer,
> ?MACHINE_END
> ?#endif
> --
> 1.7.1
>
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 06/13] [ARM] pxa/spitz: Formating and naming fixes
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (3 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 05/13] [ARM] pxa/spitz: Rework spitz Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-08-04 5:27 ` Eric Miao
2010-07-29 3:16 ` [PATCH 07/13] [ARM] pxa/z2: Fix flash layout typo Marek Vasut
` (7 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Improve formating so checkpatch passes. Also, change some function and variable
names to make the naming consistent.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/spitz.c | 282 ++++++++++++++++++++++-----------------------
1 files changed, 138 insertions(+), 144 deletions(-)
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 24c4d27..a8d4e3a 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -133,10 +133,8 @@ static unsigned long spitz_pin_config[] __initdata = {
* Scoop GPIO expander
******************************************************************************/
#if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE)
-/*
- * Spitz SCOOP Device #1
- */
-static struct resource spitz_scoop_resources[] = {
+/* SCOOP Device #1 */
+static struct resource spitz_scoop_1_resources[] = {
[0] = {
.start = 0x10800000,
.end = 0x10800fff,
@@ -144,7 +142,7 @@ static struct resource spitz_scoop_resources[] = {
},
};
-static struct scoop_config spitz_scoop_setup = {
+static struct scoop_config spitz_scoop_1_setup = {
.io_dir = SPITZ_SCP_IO_DIR,
.io_out = SPITZ_SCP_IO_OUT,
.suspend_clr = SPITZ_SCP_SUS_CLR,
@@ -152,20 +150,18 @@ static struct scoop_config spitz_scoop_setup = {
.gpio_base = SPITZ_SCP_GPIO_BASE,
};
-struct platform_device spitzscoop_device = {
+struct platform_device spitz_scoop_1_device = {
.name = "sharp-scoop",
.id = 0,
.dev = {
- .platform_data = &spitz_scoop_setup,
+ .platform_data = &spitz_scoop_1_setup,
},
- .num_resources = ARRAY_SIZE(spitz_scoop_resources),
- .resource = spitz_scoop_resources,
+ .num_resources = ARRAY_SIZE(spitz_scoop_1_resources),
+ .resource = spitz_scoop_1_resources,
};
-/*
- * Spitz SCOOP Device #2
- */
-static struct resource spitz_scoop2_resources[] = {
+/* SCOOP Device #2 */
+static struct resource spitz_scoop_2_resources[] = {
[0] = {
.start = 0x08800040,
.end = 0x08800fff,
@@ -173,7 +169,7 @@ static struct resource spitz_scoop2_resources[] = {
},
};
-static struct scoop_config spitz_scoop2_setup = {
+static struct scoop_config spitz_scoop_2_setup = {
.io_dir = SPITZ_SCP2_IO_DIR,
.io_out = SPITZ_SCP2_IO_OUT,
.suspend_clr = SPITZ_SCP2_SUS_CLR,
@@ -181,23 +177,23 @@ static struct scoop_config spitz_scoop2_setup = {
.gpio_base = SPITZ_SCP2_GPIO_BASE,
};
-struct platform_device spitzscoop2_device = {
+struct platform_device spitz_scoop_2_device = {
.name = "sharp-scoop",
.id = 1,
.dev = {
- .platform_data = &spitz_scoop2_setup,
+ .platform_data = &spitz_scoop_2_setup,
},
- .num_resources = ARRAY_SIZE(spitz_scoop2_resources),
- .resource = spitz_scoop2_resources,
+ .num_resources = ARRAY_SIZE(spitz_scoop_2_resources),
+ .resource = spitz_scoop_2_resources,
};
static void __init spitz_scoop_init(void)
{
- platform_device_register(&spitz_scoop1_device);
+ platform_device_register(&spitz_scoop_1_device);
/* Akita doesn't have the second SCOOP chip */
if (!machine_is_akita())
- platform_device_register(&spitzscoop2_device);
+ platform_device_register(&spitz_scoop_2_device);
}
/* Power control is shared with between one of the CF slots and SD */
@@ -250,22 +246,22 @@ static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr)
}
static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
-{
- .dev = &spitzscoop_device.dev,
- .irq = SPITZ_IRQ_GPIO_CF_IRQ,
- .cd_irq = SPITZ_IRQ_GPIO_CF_CD,
- .cd_irq_str = "PCMCIA0 CD",
-},{
- .dev = &spitzscoop2_device.dev,
- .irq = SPITZ_IRQ_GPIO_CF2_IRQ,
- .cd_irq = -1,
-},
+ {
+ .dev = &spitz_scoop_1_device.dev,
+ .irq = SPITZ_IRQ_GPIO_CF_IRQ,
+ .cd_irq = SPITZ_IRQ_GPIO_CF_CD,
+ .cd_irq_str = "PCMCIA0 CD",
+ }, {
+ .dev = &spitz_scoop_2_device.dev,
+ .irq = SPITZ_IRQ_GPIO_CF2_IRQ,
+ .cd_irq = -1,
+ },
};
static struct scoop_pcmcia_config spitz_pcmcia_config = {
- .devs = &spitz_pcmcia_scoop[0],
- .num_devs = 2,
- .power_ctrl = spitz_pcmcia_pwr,
+ .devs = &spitz_pcmcia_scoop[0],
+ .num_devs = 2,
+ .power_ctrl = spitz_pcmcia_pwr,
};
static void __init spitz_pcmcia_init(void)
@@ -300,7 +296,7 @@ static inline void spitz_pcmcia_init(void) {}
#define SPITZ_KEY_OK KEY_F11
#define SPITZ_KEY_MENU KEY_F12
-static const uint32_t spitzkbd_keymap[] = {
+static const uint32_t spitz_keymap[] = {
KEY(0, 0, KEY_LEFTCTRL),
KEY(0, 1, KEY_1),
KEY(0, 2, KEY_3),
@@ -367,38 +363,38 @@ static const uint32_t spitzkbd_keymap[] = {
KEY(6, 8, KEY_RIGHT),
};
-static const struct matrix_keymap_data spitzkbd_keymap_data = {
- .keymap = spitzkbd_keymap,
- .keymap_size = ARRAY_SIZE(spitzkbd_keymap),
+static const struct matrix_keymap_data spitz_keymap_data = {
+ .keymap = spitz_keymap,
+ .keymap_size = ARRAY_SIZE(spitz_keymap),
};
-static const uint32_t spitzkbd_row_gpios[] =
+static const uint32_t spitz_row_gpios[] =
{ 12, 17, 91, 34, 36, 38, 39 };
-static const uint32_t spitzkbd_col_gpios[] =
+static const uint32_t spitz_col_gpios[] =
{ 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 };
-static struct matrix_keypad_platform_data spitzkbd_pdata = {
- .keymap_data = &spitzkbd_keymap_data,
- .row_gpios = spitzkbd_row_gpios,
- .col_gpios = spitzkbd_col_gpios,
- .num_row_gpios = ARRAY_SIZE(spitzkbd_row_gpios),
- .num_col_gpios = ARRAY_SIZE(spitzkbd_col_gpios),
+static struct matrix_keypad_platform_data spitz_mkp_pdata = {
+ .keymap_data = &spitz_keymap_data,
+ .row_gpios = spitz_row_gpios,
+ .col_gpios = spitz_col_gpios,
+ .num_row_gpios = ARRAY_SIZE(spitz_row_gpios),
+ .num_col_gpios = ARRAY_SIZE(spitz_col_gpios),
.col_scan_delay_us = 10,
.debounce_ms = 10,
.wakeup = 1,
};
-static struct platform_device spitzkbd_device = {
+static struct platform_device spitz_mkp_device = {
.name = "matrix-keypad",
.id = -1,
.dev = {
- .platform_data = &spitzkbd_pdata,
+ .platform_data = &spitz_mkp_pdata,
},
};
static void __init spitz_mkp_init(void)
{
- platform_device_register(&spitzkbd_device);
+ platform_device_register(&spitz_mkp_device);
}
#else
static inline void spitz_mkp_init(void) {}
@@ -474,17 +470,17 @@ static struct gpio_led_platform_data spitz_gpio_leds_info = {
.num_leds = ARRAY_SIZE(spitz_gpio_leds),
};
-static struct platform_device spitzled_device = {
+static struct platform_device spitz_led_device = {
.name = "leds-gpio",
.id = -1,
.dev = {
- .platform_data = &spitz_gpio_leds_info,
+ .platform_data = &spitz_gpio_leds_info,
},
};
static void __init spitz_leds_init(void)
{
- platform_device_register(&spitzled_device);
+ platform_device_register(&spitz_led_device);
}
#else
static inline void spitz_leds_init(void) {}
@@ -494,7 +490,7 @@ static inline void spitz_leds_init(void) {}
* SSP Devices
******************************************************************************/
#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
-static void spitz_wait_for_hsync(void)
+static void spitz_ads7846_wait_for_hsync(void)
{
while (gpio_get_value(SPITZ_GPIO_HSYNC))
cpu_relax();
@@ -510,7 +506,7 @@ static struct ads7846_platform_data spitz_ads7846_info = {
.y_plate_ohms = 486,
.pressure_max = 1024,
.gpio_pendown = SPITZ_GPIO_TP_INT,
- .wait_for_sync = spitz_wait_for_hsync,
+ .wait_for_sync = spitz_ads7846_wait_for_hsync,
};
static struct pxa2xx_spi_chip spitz_ads7846_chip = {
@@ -548,26 +544,26 @@ static struct pxa2xx_spi_chip spitz_max1111_chip = {
static struct spi_board_info spitz_spi_devices[] = {
{
- .modalias = "ads7846",
- .max_speed_hz = 1200000,
- .bus_num = 2,
- .chip_select = 0,
- .platform_data = &spitz_ads7846_info,
- .controller_data= &spitz_ads7846_chip,
- .irq = gpio_to_irq(SPITZ_GPIO_TP_INT),
+ .modalias = "ads7846",
+ .max_speed_hz = 1200000,
+ .bus_num = 2,
+ .chip_select = 0,
+ .platform_data = &spitz_ads7846_info,
+ .controller_data = &spitz_ads7846_chip,
+ .irq = gpio_to_irq(SPITZ_GPIO_TP_INT),
}, {
- .modalias = "corgi-lcd",
- .max_speed_hz = 50000,
- .bus_num = 2,
- .chip_select = 1,
- .platform_data = &spitz_lcdcon_info,
- .controller_data= &spitz_lcdcon_chip,
+ .modalias = "corgi-lcd",
+ .max_speed_hz = 50000,
+ .bus_num = 2,
+ .chip_select = 1,
+ .platform_data = &spitz_lcdcon_info,
+ .controller_data = &spitz_lcdcon_chip,
}, {
- .modalias = "max1111",
- .max_speed_hz = 450000,
- .bus_num = 2,
- .chip_select = 2,
- .controller_data= &spitz_max1111_chip,
+ .modalias = "max1111",
+ .max_speed_hz = 450000,
+ .bus_num = 2,
+ .chip_select = 2,
+ .controller_data = &spitz_max1111_chip,
},
};
@@ -575,7 +571,7 @@ static struct pxa2xx_spi_master spitz_spi_info = {
.num_chipselect = 3,
};
-static void __init spitz_init_spi(void)
+static void __init spitz_spi_init(void)
{
struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info;
@@ -588,7 +584,7 @@ static void __init spitz_init_spi(void)
spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
}
#else
-static inline void spitz_init_spi(void) {}
+static inline void spitz_spi_init(void) {}
#endif
/******************************************************************************
@@ -612,7 +608,7 @@ static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
static struct pxamci_platform_data spitz_mci_platform_data = {
.detect_delay_ms = 250,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
- .setpower = spitz_mci_setpower,
+ .setpower = spitz_mci_setpower,
.gpio_card_detect = SPITZ_GPIO_nSD_DETECT,
.gpio_card_ro = SPITZ_GPIO_nSD_WP,
.gpio_power = -1,
@@ -691,31 +687,31 @@ static inline void spitz_irda_init(void) {}
******************************************************************************/
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
static struct pxafb_mode_info spitz_pxafb_modes[] = {
-{
- .pixclock = 19231,
- .xres = 480,
- .yres = 640,
- .bpp = 16,
- .hsync_len = 40,
- .left_margin = 46,
- .right_margin = 125,
- .vsync_len = 3,
- .upper_margin = 1,
- .lower_margin = 0,
- .sync = 0,
-},{
- .pixclock = 134617,
- .xres = 240,
- .yres = 320,
- .bpp = 16,
- .hsync_len = 20,
- .left_margin = 20,
- .right_margin = 46,
- .vsync_len = 2,
- .upper_margin = 1,
- .lower_margin = 0,
- .sync = 0,
-},
+ {
+ .pixclock = 19231,
+ .xres = 480,
+ .yres = 640,
+ .bpp = 16,
+ .hsync_len = 40,
+ .left_margin = 46,
+ .right_margin = 125,
+ .vsync_len = 3,
+ .upper_margin = 1,
+ .lower_margin = 0,
+ .sync = 0,
+ }, {
+ .pixclock = 134617,
+ .xres = 240,
+ .yres = 320,
+ .bpp = 16,
+ .hsync_len = 20,
+ .left_margin = 20,
+ .right_margin = 46,
+ .vsync_len = 2,
+ .upper_margin = 1,
+ .lower_margin = 0,
+ .sync = 0,
+ },
};
static struct pxafb_mach_info spitz_pxafb_info = {
@@ -737,17 +733,15 @@ static inline void spitz_lcd_init(void) {}
* Framebuffer
******************************************************************************/
#if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE)
-static struct mtd_partition sharpsl_nand_partitions[] = {
+static struct mtd_partition spitz_nand_partitions[] = {
{
.name = "System Area",
.offset = 0,
.size = 7 * 1024 * 1024,
- },
- {
+ }, {
.name = "Root Filesystem",
.offset = 7 * 1024 * 1024,
- },
- {
+ }, {
.name = "Home Filesystem",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
@@ -756,14 +750,14 @@ static struct mtd_partition sharpsl_nand_partitions[] = {
static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
-static struct nand_bbt_descr sharpsl_bbt = {
- .options = 0,
- .offs = 4,
- .len = 2,
- .pattern = scan_ff_pattern
+static struct nand_bbt_descr spitz_nand_bbt = {
+ .options = 0,
+ .offs = 4,
+ .len = 2,
+ .pattern = scan_ff_pattern
};
-static struct nand_ecclayout spitz_akita_oobinfo = {
+static struct nand_ecclayout akita_oobinfo = {
.oobfree = { {0x08, 0x09} },
.eccbytes = 24,
.eccpos = {
@@ -773,13 +767,13 @@ static struct nand_ecclayout spitz_akita_oobinfo = {
},
};
-static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
- .badblock_pattern = &sharpsl_bbt,
- .partitions = sharpsl_nand_partitions,
- .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions),
+static struct sharpsl_nand_platform_data spitz_nand_pdata = {
+ .badblock_pattern = &spitz_nand_bbt,
+ .partitions = spitz_nand_partitions,
+ .nr_partitions = ARRAY_SIZE(spitz_nand_partitions),
};
-static struct resource sharpsl_nand_resources[] = {
+static struct resource spitz_nand_resources[] = {
{
.start = PXA_CS3_PHYS,
.end = PXA_CS3_PHYS + SZ_4K - 1,
@@ -787,31 +781,31 @@ static struct resource sharpsl_nand_resources[] = {
},
};
-static struct platform_device sharpsl_nand_device = {
+static struct platform_device spitz_nand_device = {
.name = "sharpsl-nand",
.id = -1,
- .resource = sharpsl_nand_resources,
- .num_resources = ARRAY_SIZE(sharpsl_nand_resources),
+ .resource = spitz_nand_resources,
+ .num_resources = ARRAY_SIZE(spitz_nand_resources),
.dev = {
- .platform_data = &sharpsl_nand_platform_data,
+ .platform_data = &spitz_nand_pdata,
}
};
static void __init spitz_nand_init(void)
{
if (machine_is_spitz()) {
- sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
+ spitz_nand_partitions[1].size = 5 * 1024 * 1024;
} else if (machine_is_akita()) {
- sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
- sharpsl_nand_bbt.len = 1;
- sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
+ spitz_nand_partitions[1].size = 58 * 1024 * 1024;
+ spitz_nand_bbt.len = 1;
+ spitz_nand_pdata.ecc_layout = &akita_oobinfo;
} else if (machine_is_borzoi()) {
- sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
- sharpsl_nand_bbt.len = 1;
- sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
+ spitz_nand_partitions[1].size = 32 * 1024 * 1024;
+ spitz_nand_bbt.len = 1;
+ spitz_nand_pdata.ecc_layout = &akita_oobinfo;
}
- platform_device_register(&sharpsl_nand_device);
+ platform_device_register(&spitz_nand_device);
}
#else
static inline void spitz_nand_init(void) {}
@@ -821,7 +815,7 @@ static inline void spitz_nand_init(void) {}
* NOR Flash
******************************************************************************/
#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
-static struct mtd_partition sharpsl_rom_parts[] = {
+static struct mtd_partition spitz_rom_parts[] = {
{
.name ="Boot PROM Filesystem",
.offset = 0x00140000,
@@ -829,13 +823,13 @@ static struct mtd_partition sharpsl_rom_parts[] = {
},
};
-static struct physmap_flash_data sharpsl_rom_data = {
+static struct physmap_flash_data spitz_rom_data = {
.width = 2,
- .nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
- .parts = sharpsl_rom_parts,
+ .nr_parts = ARRAY_SIZE(spitz_rom_parts),
+ .parts = spitz_rom_parts,
};
-static struct resource sharpsl_rom_resources[] = {
+static struct resource spitz_rom_resources[] = {
{
.start = PXA_CS0_PHYS,
.end = PXA_CS0_PHYS + SZ_8M - 1,
@@ -843,19 +837,19 @@ static struct resource sharpsl_rom_resources[] = {
},
};
-static struct platform_device sharpsl_rom_device = {
- .name = "physmap-flash",
- .id = -1,
- .resource = sharpsl_rom_resources,
- .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
+static struct platform_device spitz_rom_device = {
+ .name = "physmap-flash",
+ .id = -1,
+ .resource = spitz_rom_resources,
+ .num_resources = ARRAY_SIZE(spitz_rom_resources),
.dev = {
- .platform_data = &sharpsl_rom_data,
+ .platform_data = &spitz_rom_data,
},
};
static void __init spitz_nor_init(void)
{
- platform_device_register(&sharpsl_rom_device);
+ platform_device_register(&spitz_rom_device);
}
#else
static inline void spitz_nor_init(void) {}
@@ -959,7 +953,7 @@ static void __init spitz_init(void)
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
- spitz_init_spi();
+ spitz_spi_init();
spitz_scoop_init();
spitz_mkp_init();
spitz_keys_init();
@@ -974,7 +968,7 @@ static void __init spitz_init(void)
spitz_i2c_init();
}
-static void __init fixup_spitz(struct machine_desc *desc,
+static void __init spitz_fixup(struct machine_desc *desc,
struct tag *tags, char **cmdline, struct meminfo *mi)
{
sharpsl_save_param();
@@ -988,7 +982,7 @@ static void __init fixup_spitz(struct machine_desc *desc,
MACHINE_START(SPITZ, "SHARP Spitz")
.phys_io = 0x40000000,
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
- .fixup = fixup_spitz,
+ .fixup = spitz_fixup,
.map_io = pxa_map_io,
.init_irq = pxa27x_init_irq,
.init_machine = spitz_init,
@@ -1000,7 +994,7 @@ MACHINE_END
MACHINE_START(BORZOI, "SHARP Borzoi")
.phys_io = 0x40000000,
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
- .fixup = fixup_spitz,
+ .fixup = spitz_fixup,
.map_io = pxa_map_io,
.init_irq = pxa27x_init_irq,
.init_machine = spitz_init,
@@ -1012,7 +1006,7 @@ MACHINE_END
MACHINE_START(AKITA, "SHARP Akita")
.phys_io = 0x40000000,
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
- .fixup = fixup_spitz,
+ .fixup = spitz_fixup,
.map_io = pxa_map_io,
.init_irq = pxa27x_init_irq,
.init_machine = spitz_init,
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 07/13] [ARM] pxa/z2: Fix flash layout typo
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (4 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 06/13] [ARM] pxa/spitz: Formating and naming fixes Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-08-04 5:36 ` Eric Miao
2010-07-29 3:16 ` [PATCH 08/13] [ARM] pxa/balloon3: Machine file cleanup Marek Vasut
` (6 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/z2.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index 07d8bd8..f0d0228 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -164,7 +164,7 @@ static struct mtd_partition z2_flash_parts[] = {
}, {
.name = "U-Boot Environment",
.offset = 0x40000,
- .size = 0x60000,
+ .size = 0x20000,
}, {
.name = "Flash",
.offset = 0x60000,
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 07/13] [ARM] pxa/z2: Fix flash layout typo
2010-07-29 3:16 ` [PATCH 07/13] [ARM] pxa/z2: Fix flash layout typo Marek Vasut
@ 2010-08-04 5:36 ` Eric Miao
0 siblings, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-08-04 5:36 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jul 29, 2010 at 11:16 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Applied.
> ---
> ?arch/arm/mach-pxa/z2.c | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
> index 07d8bd8..f0d0228 100644
> --- a/arch/arm/mach-pxa/z2.c
> +++ b/arch/arm/mach-pxa/z2.c
> @@ -164,7 +164,7 @@ static struct mtd_partition z2_flash_parts[] = {
> ? ? ? ?}, {
> ? ? ? ? ? ? ? ?.name ? = "U-Boot Environment",
> ? ? ? ? ? ? ? ?.offset = 0x40000,
> - ? ? ? ? ? ? ? .size ? = 0x60000,
> + ? ? ? ? ? ? ? .size ? = 0x20000,
> ? ? ? ?}, {
> ? ? ? ? ? ? ? ?.name ? = "Flash",
> ? ? ? ? ? ? ? ?.offset = 0x60000,
> --
> 1.7.1
>
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 08/13] [ARM] pxa/balloon3: Machine file cleanup
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (5 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 07/13] [ARM] pxa/z2: Fix flash layout typo Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-07-29 3:16 ` [PATCH 09/13] " Marek Vasut
` (5 subsequent siblings)
12 siblings, 0 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Logically separate parts of the file that are handled by one particular driver.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/balloon3.c | 225 +++++++++++++++++++++++------------------
1 files changed, 126 insertions(+), 99 deletions(-)
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index f3b5ace..8adb87a 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -51,87 +51,27 @@
#include "generic.h"
#include "devices.h"
-static unsigned long balloon3_irq_enabled;
-
-static unsigned long balloon3_features_present =
- (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
- (1 << BALLOON3_FEATURE_AUDIO) |
- (1 << BALLOON3_FEATURE_TOPPOLY);
-
-int balloon3_has(enum balloon3_features feature)
-{
- return (balloon3_features_present & (1 << feature)) ? 1 : 0;
-}
-EXPORT_SYMBOL_GPL(balloon3_has);
-
-int __init parse_balloon3_features(char *arg)
-{
- if (!arg)
- return 0;
-
- return strict_strtoul(arg, 0, &balloon3_features_present);
-}
-early_param("balloon3_features", parse_balloon3_features);
-
-static void balloon3_mask_irq(unsigned int irq)
-{
- int balloon3_irq = (irq - BALLOON3_IRQ(0));
- balloon3_irq_enabled &= ~(1 << balloon3_irq);
- __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
-}
+/******************************************************************************
+ * Pin configuration
+ ******************************************************************************/
+static unsigned long balloon3_pin_config[] __initdata = {
+ /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */
+ GPIO42_BTUART_RXD,
+ GPIO43_BTUART_TXD,
+ GPIO44_BTUART_CTS,
+ GPIO45_BTUART_RTS,
-static void balloon3_unmask_irq(unsigned int irq)
-{
- int balloon3_irq = (irq - BALLOON3_IRQ(0));
- balloon3_irq_enabled |= (1 << balloon3_irq);
- __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
-}
+ /* Wakeup GPIO */
+ GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
-static struct irq_chip balloon3_irq_chip = {
- .name = "FPGA",
- .ack = balloon3_mask_irq,
- .mask = balloon3_mask_irq,
- .unmask = balloon3_unmask_irq,
+ /* NAND & IDLE LED GPIOs */
+ GPIO9_GPIO,
+ GPIO10_GPIO,
};
-static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
-{
- unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
- balloon3_irq_enabled;
-
- do {
- /* clear useless edge notification */
- if (desc->chip->ack)
- desc->chip->ack(BALLOON3_AUX_NIRQ);
- while (pending) {
- irq = BALLOON3_IRQ(0) + __ffs(pending);
- generic_handle_irq(irq);
- pending &= pending - 1;
- }
- pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
- balloon3_irq_enabled;
- } while (pending);
-}
-
-static void __init balloon3_init_irq(void)
-{
- int irq;
-
- pxa27x_init_irq();
- /* setup extra Balloon3 irqs */
- for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) {
- set_irq_chip(irq, &balloon3_irq_chip);
- set_irq_handler(irq, handle_level_irq);
- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
- }
-
- set_irq_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler);
- set_irq_type(BALLOON3_AUX_NIRQ, IRQ_TYPE_EDGE_FALLING);
-
- pr_debug("%s: chained handler installed - irq %d automatically "
- "enabled\n", __func__, BALLOON3_AUX_NIRQ);
-}
-
+/******************************************************************************
+ * Audio and Touchscreen
+ ******************************************************************************/
static unsigned long balloon3_ac97_pin_config[] = {
GPIO28_AC97_BITCLK,
GPIO29_AC97_SDATA_IN_0,
@@ -140,19 +80,16 @@ static unsigned long balloon3_ac97_pin_config[] = {
GPIO113_AC97_nRESET,
};
+/******************************************************************************
+ * Framebuffer
+ ******************************************************************************/
+
static void balloon3_backlight_power(int on)
{
pr_debug("%s: power is %s\n", __func__, on ? "on" : "off");
gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
}
-static unsigned long balloon3_lcd_pin_config[] = {
- /* LCD - 16bpp Active TFT */
- GPIOxx_LCD_TFT_16BPP,
-
- GPIO99_GPIO, /* Backlight */
-};
-
static struct pxafb_mode_info balloon3_lcd_modes[] = {
{
.pixclock = 38000,
@@ -176,6 +113,9 @@ static struct pxafb_mach_info balloon3_pxafb_info = {
.pxafb_backlight_power = balloon3_backlight_power,
};
+/******************************************************************************
+ * SD/MMC card controller
+ ******************************************************************************/
static unsigned long balloon3_mmc_pin_config[] = {
GPIO32_MMC_CLK,
GPIO92_MMC_DAT_0,
@@ -203,6 +143,9 @@ static struct pxamci_platform_data balloon3_mci_platform_data = {
.setpower = balloon3_mci_setpower,
};
+/******************************************************************************
+ * USB Gadget
+ ******************************************************************************/
static int balloon3_udc_is_connected(void)
{
pr_debug("%s: udc connected\n", __func__);
@@ -228,10 +171,16 @@ static struct pxa2xx_udc_mach_info balloon3_udc_info = {
.udc_command = balloon3_udc_command,
};
+/******************************************************************************
+ * IrDA
+ ******************************************************************************/
static struct pxaficp_platform_data balloon3_ficp_platform_data = {
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
};
+/******************************************************************************
+ * USB Host
+ ******************************************************************************/
static unsigned long balloon3_ohci_pin_config[] = {
GPIO88_USBH1_PWR,
GPIO89_USBH1_PEN,
@@ -242,21 +191,9 @@ static struct pxaohci_platform_data balloon3_ohci_platform_data = {
.flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
};
-static unsigned long balloon3_pin_config[] __initdata = {
- /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */
- GPIO42_BTUART_RXD,
- GPIO43_BTUART_TXD,
- GPIO44_BTUART_CTS,
- GPIO45_BTUART_RTS,
-
- /* Wakeup GPIO */
- GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
-
- /* NAND & IDLE LED GPIOs */
- GPIO9_GPIO,
- GPIO10_GPIO,
-};
-
+/******************************************************************************
+ * LED
+ ******************************************************************************/
static struct gpio_led balloon3_gpio_leds[] = {
{
.name = "balloon3:green:idle",
@@ -285,6 +222,96 @@ static struct platform_device balloon3led_device = {
},
};
+/******************************************************************************
+ * Compatibility: Parameter parsing
+ ******************************************************************************/
+static unsigned long balloon3_irq_enabled;
+
+static unsigned long balloon3_features_present =
+ (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
+ (1 << BALLOON3_FEATURE_AUDIO) |
+ (1 << BALLOON3_FEATURE_TOPPOLY);
+
+int balloon3_has(enum balloon3_features feature)
+{
+ return (balloon3_features_present & (1 << feature)) ? 1 : 0;
+}
+EXPORT_SYMBOL_GPL(balloon3_has);
+
+int __init parse_balloon3_features(char *arg)
+{
+ if (!arg)
+ return 0;
+
+ return strict_strtoul(arg, 0, &balloon3_features_present);
+}
+early_param("balloon3_features", parse_balloon3_features);
+
+/******************************************************************************
+ * FPGA IRQ
+ ******************************************************************************/
+static void balloon3_mask_irq(unsigned int irq)
+{
+ int balloon3_irq = (irq - BALLOON3_IRQ(0));
+ balloon3_irq_enabled &= ~(1 << balloon3_irq);
+ __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
+}
+
+static void balloon3_unmask_irq(unsigned int irq)
+{
+ int balloon3_irq = (irq - BALLOON3_IRQ(0));
+ balloon3_irq_enabled |= (1 << balloon3_irq);
+ __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
+}
+
+static struct irq_chip balloon3_irq_chip = {
+ .name = "FPGA",
+ .ack = balloon3_mask_irq,
+ .mask = balloon3_mask_irq,
+ .unmask = balloon3_unmask_irq,
+};
+
+static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
+{
+ unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
+ balloon3_irq_enabled;
+
+ do {
+ /* clear useless edge notification */
+ if (desc->chip->ack)
+ desc->chip->ack(BALLOON3_AUX_NIRQ);
+ while (pending) {
+ irq = BALLOON3_IRQ(0) + __ffs(pending);
+ generic_handle_irq(irq);
+ pending &= pending - 1;
+ }
+ pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
+ balloon3_irq_enabled;
+ } while (pending);
+}
+
+static void __init balloon3_init_irq(void)
+{
+ int irq;
+
+ pxa27x_init_irq();
+ /* setup extra Balloon3 irqs */
+ for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) {
+ set_irq_chip(irq, &balloon3_irq_chip);
+ set_irq_handler(irq, handle_level_irq);
+ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+ }
+
+ set_irq_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler);
+ set_irq_type(BALLOON3_AUX_NIRQ, IRQ_TYPE_EDGE_FALLING);
+
+ pr_debug("%s: chained handler installed - irq %d automatically "
+ "enabled\n", __func__, BALLOON3_AUX_NIRQ);
+}
+
+/******************************************************************************
+ * Machine init
+ ******************************************************************************/
static void __init balloon3_init(void)
{
pr_info("Initialising Balloon3\n");
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 09/13] [ARM] pxa/balloon3: Machine file cleanup
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (6 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 08/13] [ARM] pxa/balloon3: Machine file cleanup Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-07-29 3:16 ` [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support Marek Vasut
` (4 subsequent siblings)
12 siblings, 0 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Modularize components of the Balloon3 board.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/balloon3.c | 354 +++++++++++++++++++++++++++---------------
1 files changed, 231 insertions(+), 123 deletions(-)
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 8adb87a..572525c 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -22,6 +22,7 @@
#include <linux/fb.h>
#include <linux/gpio.h>
#include <linux/ioport.h>
+#include <linux/ucb1400.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/types.h>
@@ -61,35 +62,136 @@ static unsigned long balloon3_pin_config[] __initdata = {
GPIO44_BTUART_CTS,
GPIO45_BTUART_RTS,
- /* Wakeup GPIO */
+ /* Reset, configured as GPIO wakeup source */
GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
- /* NAND & IDLE LED GPIOs */
- GPIO9_GPIO,
- GPIO10_GPIO,
-};
+ /* LEDs */
+ GPIO9_GPIO, /* NAND activity LED */
+ GPIO10_GPIO, /* Heartbeat LED */
-/******************************************************************************
- * Audio and Touchscreen
- ******************************************************************************/
-static unsigned long balloon3_ac97_pin_config[] = {
+ /* AC97 */
GPIO28_AC97_BITCLK,
GPIO29_AC97_SDATA_IN_0,
GPIO30_AC97_SDATA_OUT,
GPIO31_AC97_SYNC,
GPIO113_AC97_nRESET,
+ GPIO95_GPIO,
+
+ /* MMC */
+ GPIO32_MMC_CLK,
+ GPIO92_MMC_DAT_0,
+ GPIO109_MMC_DAT_1,
+ GPIO110_MMC_DAT_2,
+ GPIO111_MMC_DAT_3,
+ GPIO112_MMC_CMD,
+
+ /* USB Host */
+ GPIO88_USBH1_PWR,
+ GPIO89_USBH1_PEN,
};
/******************************************************************************
- * Framebuffer
+ * Compatibility: Parameter parsing
******************************************************************************/
+static unsigned long balloon3_irq_enabled;
-static void balloon3_backlight_power(int on)
+static unsigned long balloon3_features_present =
+ (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
+ (1 << BALLOON3_FEATURE_AUDIO) |
+ (1 << BALLOON3_FEATURE_TOPPOLY);
+
+int balloon3_has(enum balloon3_features feature)
{
- pr_debug("%s: power is %s\n", __func__, on ? "on" : "off");
- gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
+ return (balloon3_features_present & (1 << feature)) ? 1 : 0;
+}
+EXPORT_SYMBOL_GPL(balloon3_has);
+
+int __init parse_balloon3_features(char *arg)
+{
+ if (!arg)
+ return 0;
+
+ return strict_strtoul(arg, 0, &balloon3_features_present);
}
+early_param("balloon3_features", parse_balloon3_features);
+/******************************************************************************
+ * NOR Flash
+ ******************************************************************************/
+#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
+static struct mtd_partition balloon3_nor_partitions[] = {
+ {
+ .name = "Flash",
+ .offset = 0x00000000,
+ .size = MTDPART_SIZ_FULL,
+ }
+};
+
+static struct physmap_flash_data balloon3_flash_data[] = {
+ {
+ .width = 2, /* bankwidth in bytes */
+ .parts = balloon3_nor_partitions,
+ .nr_parts = ARRAY_SIZE(balloon3_nor_partitions)
+ }
+};
+
+static struct resource balloon3_flash_resource = {
+ .start = PXA_CS0_PHYS,
+ .end = PXA_CS0_PHYS + SZ_64M - 1,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device balloon3_flash = {
+ .name = "physmap-flash",
+ .id = 0,
+ .resource = &balloon3_flash_resource,
+ .num_resources = 1,
+ .dev = {
+ .platform_data = balloon3_flash_data,
+ },
+};
+static void __init balloon3_nor_init(void)
+{
+ platform_device_register(&balloon3_flash);
+}
+#else
+static inline void balloon3_nor_init(void) {}
+#endif
+
+/******************************************************************************
+ * Audio and Touchscreen
+ ******************************************************************************/
+#if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
+ defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static struct ucb1400_pdata vpac270_ucb1400_pdata = {
+ .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
+};
+
+
+static struct platform_device balloon3_ucb1400_device = {
+ .name = "ucb1400_core",
+ .id = -1,
+ .dev = {
+ .platform_data = &vpac270_ucb1400_pdata,
+ },
+};
+
+static void __init balloon3_ts_init(void)
+{
+ if (!balloon3_has(BALLOON3_FEATURE_AUDIO))
+ return;
+
+ pxa_set_ac97_info(NULL);
+ platform_device_register(&balloon3_ucb1400_device);
+}
+#else
+static inline void balloon3_ts_init(void) {}
+#endif
+
+/******************************************************************************
+ * Framebuffer
+ ******************************************************************************/
+#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
static struct pxafb_mode_info balloon3_lcd_modes[] = {
{
.pixclock = 38000,
@@ -106,102 +208,147 @@ static struct pxafb_mode_info balloon3_lcd_modes[] = {
},
};
-static struct pxafb_mach_info balloon3_pxafb_info = {
+static struct pxafb_mach_info balloon3_lcd_screen = {
.modes = balloon3_lcd_modes,
.num_modes = ARRAY_SIZE(balloon3_lcd_modes),
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
- .pxafb_backlight_power = balloon3_backlight_power,
};
-/******************************************************************************
- * SD/MMC card controller
- ******************************************************************************/
-static unsigned long balloon3_mmc_pin_config[] = {
- GPIO32_MMC_CLK,
- GPIO92_MMC_DAT_0,
- GPIO109_MMC_DAT_1,
- GPIO110_MMC_DAT_2,
- GPIO111_MMC_DAT_3,
- GPIO112_MMC_CMD,
-};
+static void balloon3_backlight_power(int on)
+{
+ gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
+}
-static void balloon3_mci_setpower(struct device *dev, unsigned int vdd)
+static void __init balloon3_lcd_init(void)
{
- struct pxamci_platform_data *p_d = dev->platform_data;
-
- if ((1 << vdd) & p_d->ocr_mask) {
- pr_debug("%s: on\n", __func__);
- /* FIXME something to prod here? */
- } else {
- pr_debug("%s: off\n", __func__);
- /* FIXME something to prod here? */
+ int ret;
+
+ if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY))
+ return;
+
+ ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON");
+ if (ret) {
+ pr_err("Requesting BKL-ON GPIO failed!\n");
+ goto err;
+ }
+
+ ret = gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
+ if (ret) {
+ pr_err("Setting BKL-ON GPIO direction failed!\n");
+ goto err2;
}
+
+ balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power;
+ set_pxa_fb_info(&balloon3_lcd_screen);
+ return;
+
+err2:
+ gpio_free(BALLOON3_GPIO_RUN_BACKLIGHT);
+err:
+ return;
}
+#else
+static inline void balloon3_lcd_init(void) {}
+#endif
+/******************************************************************************
+ * SD/MMC card controller
+ ******************************************************************************/
+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
static struct pxamci_platform_data balloon3_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
- .setpower = balloon3_mci_setpower,
+ .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
+ .gpio_card_detect = -1,
+ .gpio_card_ro = -1,
+ .gpio_power = -1,
+ .detect_delay_ms = 200,
};
+static void __init balloon3_mmc_init(void)
+{
+ pxa_set_mci_info(&balloon3_mci_platform_data);
+}
+#else
+static inline void balloon3_mmc_init(void) {}
+#endif
+
/******************************************************************************
* USB Gadget
******************************************************************************/
-static int balloon3_udc_is_connected(void)
+#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
+static void balloon3_udc_command(int cmd)
{
- pr_debug("%s: udc connected\n", __func__);
- return 1;
+ if (cmd == PXA2XX_UDC_CMD_CONNECT)
+ UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
+ else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+ UP2OCR &= ~UP2OCR_DPPUE;
}
-static void balloon3_udc_command(int cmd)
+static int balloon3_udc_is_connected(void)
{
- switch (cmd) {
- case PXA2XX_UDC_CMD_CONNECT:
- UP2OCR |= (UP2OCR_DPPUE + UP2OCR_DPPUBE);
- pr_debug("%s: connect\n", __func__);
- break;
- case PXA2XX_UDC_CMD_DISCONNECT:
- UP2OCR &= ~UP2OCR_DPPUE;
- pr_debug("%s: disconnect\n", __func__);
- break;
- }
+ return 1;
}
-static struct pxa2xx_udc_mach_info balloon3_udc_info = {
- .udc_is_connected = balloon3_udc_is_connected,
- .udc_command = balloon3_udc_command,
+static struct pxa2xx_udc_mach_info balloon3_udc_info __initdata = {
+ .udc_command = balloon3_udc_command,
+ .udc_is_connected = balloon3_udc_is_connected,
+ .gpio_pullup = -1,
};
+static void __init balloon3_udc_init(void)
+{
+ pxa_set_udc_info(&balloon3_udc_info);
+ platform_device_register(&balloon3_gpio_vbus);
+}
+#else
+static inline void balloon3_udc_init(void) {}
+#endif
+
/******************************************************************************
* IrDA
******************************************************************************/
+#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
static struct pxaficp_platform_data balloon3_ficp_platform_data = {
- .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
+ .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF,
};
+static void __init balloon3_irda_init(void)
+{
+ pxa_set_ficp_info(&balloon3_ficp_platform_data);
+}
+#else
+static inline void balloon3_irda_init(void) {}
+#endif
+
/******************************************************************************
* USB Host
******************************************************************************/
-static unsigned long balloon3_ohci_pin_config[] = {
- GPIO88_USBH1_PWR,
- GPIO89_USBH1_PEN,
-};
-
-static struct pxaohci_platform_data balloon3_ohci_platform_data = {
+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
+static struct pxaohci_platform_data balloon3_ohci_info = {
.port_mode = PMM_PERPORT_MODE,
.flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
};
+static void __init balloon3_uhc_init(void)
+{
+ if (!balloon3_has(BALLOON3_FEATURE_OHCI))
+ return;
+ pxa_set_ohci_info(&balloon3_ohci_info);
+}
+#else
+static inline void balloon3_uhc_init(void) {}
+#endif
+
/******************************************************************************
- * LED
+ * LEDs
******************************************************************************/
-static struct gpio_led balloon3_gpio_leds[] = {
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+struct gpio_led balloon3_gpio_leds[] = {
{
.name = "balloon3:green:idle",
.default_trigger = "heartbeat",
.gpio = BALLOON3_GPIO_LED_IDLE,
.active_low = 1,
- },
- {
+ }, {
.name = "balloon3:green:nand",
.default_trigger = "nand-disk",
.gpio = BALLOON3_GPIO_LED_NAND,
@@ -209,43 +356,26 @@ static struct gpio_led balloon3_gpio_leds[] = {
},
};
-static struct gpio_led_platform_data balloon3_gpio_leds_platform_data = {
+static struct gpio_led_platform_data balloon3_gpio_led_info = {
.leds = balloon3_gpio_leds,
.num_leds = ARRAY_SIZE(balloon3_gpio_leds),
};
-static struct platform_device balloon3led_device = {
+static struct platform_device balloon3_leds = {
.name = "leds-gpio",
.id = -1,
.dev = {
- .platform_data = &balloon3_gpio_leds_platform_data,
- },
+ .platform_data = &balloon3_gpio_led_info,
+ }
};
-/******************************************************************************
- * Compatibility: Parameter parsing
- ******************************************************************************/
-static unsigned long balloon3_irq_enabled;
-
-static unsigned long balloon3_features_present =
- (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
- (1 << BALLOON3_FEATURE_AUDIO) |
- (1 << BALLOON3_FEATURE_TOPPOLY);
-
-int balloon3_has(enum balloon3_features feature)
+static void __init balloon3_leds_init(void)
{
- return (balloon3_features_present & (1 << feature)) ? 1 : 0;
+ platform_device_register(&balloon3_leds);
}
-EXPORT_SYMBOL_GPL(balloon3_has);
-
-int __init parse_balloon3_features(char *arg)
-{
- if (!arg)
- return 0;
-
- return strict_strtoul(arg, 0, &balloon3_features_present);
-}
-early_param("balloon3_features", parse_balloon3_features);
+#else
+static inline void balloon3_leds_init(void) {}
+#endif
/******************************************************************************
* FPGA IRQ
@@ -314,46 +444,24 @@ static void __init balloon3_init_irq(void)
******************************************************************************/
static void __init balloon3_init(void)
{
- pr_info("Initialising Balloon3\n");
-
- /* system bus arbiter setting
- * - Core_Park
- * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
- */
ARB_CNTRL = ARB_CORE_PARK | 0x234;
+ pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
+
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
pxa_set_i2c_info(NULL);
- if (balloon3_has(BALLOON3_FEATURE_AUDIO)) {
- pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config));
- pxa_set_ac97_info(NULL);
- }
-
- if (balloon3_has(BALLOON3_FEATURE_TOPPOLY)) {
- pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config));
- gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT,
- "LCD Backlight Power");
- gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
- set_pxa_fb_info(&balloon3_pxafb_info);
- }
-
- if (balloon3_has(BALLOON3_FEATURE_MMC)) {
- pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_mmc_pin_config));
- pxa_set_mci_info(&balloon3_mci_platform_data);
- }
- pxa_set_ficp_info(&balloon3_ficp_platform_data);
- if (balloon3_has(BALLOON3_FEATURE_OHCI)) {
- pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ohci_pin_config));
- pxa_set_ohci_info(&balloon3_ohci_platform_data);
- }
- pxa_set_udc_info(&balloon3_udc_info);
-
- pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
- platform_device_register(&balloon3led_device);
+ balloon3_irda_init();
+ balloon3_lcd_init();
+ balloon3_leds_init();
+ balloon3_mmc_init();
+ balloon3_nor_init();
+ balloon3_ts_init();
+ balloon3_udc_init();
+ balloon3_uhc_init();
}
static struct map_desc balloon3_io_desc[] __initdata = {
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (7 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 09/13] " Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-07-29 10:10 ` Wookey
2010-07-29 3:16 ` [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs Marek Vasut
` (3 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
This driver adds support for the on-board CF socket.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/balloon3.c | 13 ++-
arch/arm/mach-pxa/include/mach/balloon3.h | 17 ---
drivers/pcmcia/Kconfig | 2 +-
drivers/pcmcia/Makefile | 1 +
drivers/pcmcia/pxa2xx_balloon3.c | 199 +++++++++++++++++++++++++++++
5 files changed, 213 insertions(+), 19 deletions(-)
create mode 100644 drivers/pcmcia/pxa2xx_balloon3.c
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 572525c..91ad56d 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -88,6 +88,18 @@ static unsigned long balloon3_pin_config[] __initdata = {
/* USB Host */
GPIO88_USBH1_PWR,
GPIO89_USBH1_PEN,
+
+ /* PC Card */
+ GPIO48_nPOE,
+ GPIO49_nPWE,
+ GPIO50_nPIOR,
+ GPIO51_nPIOW,
+ GPIO85_nPCE_1,
+ GPIO54_nPCE_2,
+ GPIO79_PSKTSEL,
+ GPIO55_nPREG,
+ GPIO56_nPWAIT,
+ GPIO57_nIOIS16,
};
/******************************************************************************
@@ -405,7 +417,6 @@ static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
{
unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
balloon3_irq_enabled;
-
do {
/* clear useless edge notification */
if (desc->chip->ack)
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
index 1a74106..14f4bd5 100644
--- a/arch/arm/mach-pxa/include/mach/balloon3.h
+++ b/arch/arm/mach-pxa/include/mach/balloon3.h
@@ -26,10 +26,6 @@ enum balloon3_features {
#define BALLOON3_FPGA_VIRT (0xf1000000) /* as per balloon2 */
#define BALLOON3_FPGA_LENGTH 0x01000000
-/* FPGA/CPLD registers */
-#define BALLOON3_PCMCIA0_REG (BALLOON3_FPGA_VIRT + 0x00e00008)
-/* fixme - same for now */
-#define BALLOON3_PCMCIA1_REG (BALLOON3_FPGA_VIRT + 0x00e00008)
#define BALLOON3_NANDIO_IO_REG (BALLOON3_FPGA_VIRT + 0x00e00000)
/* fpga/cpld interrupt control register */
#define BALLOON3_INT_CONTROL_REG (BALLOON3_FPGA_VIRT + 0x00e0000C)
@@ -58,16 +54,6 @@ enum balloon3_features {
#define BALLOON3_INT_S0_IRQ (1 << 0) /* PCMCIA 0 IRQ */
#define BALLOON3_INT_S0_STSCHG (1 << 1) /* PCMCIA 0 status changed */
-/* CF Status Register */
-#define BALLOON3_PCMCIA_nIRQ (1 << 0) /* IRQ / ready signal */
-#define BALLOON3_PCMCIA_nSTSCHG_BVD1 (1 << 1)
- /* VDD sense / card status changed */
-
-/* CF control register (write) */
-#define BALLOON3_PCMCIA_RESET (1 << 0) /* Card reset signal */
-#define BALLOON3_PCMCIA_ENABLE (1 << 1)
-#define BALLOON3_PCMCIA_ADD_ENABLE (1 << 2)
-
/* CPLD (and FPGA) interface definitions */
#define CPLD_LCD0_DATA_SET 0x00
#define CPLD_LCD0_DATA_CLR 0x10
@@ -132,9 +118,6 @@ enum balloon3_features {
/* Balloon3 Interrupts */
#define BALLOON3_IRQ(x) (IRQ_BOARD_START + (x))
-#define BALLOON3_BP_CF_NRDY_IRQ BALLOON3_IRQ(0)
-#define BALLOON3_BP_NSTSCHG_IRQ BALLOON3_IRQ(1)
-
#define BALLOON3_AUX_NIRQ IRQ_GPIO(BALLOON3_GPIO_AUX_NIRQ)
#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ)
#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD)
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index d0f5ad3..ef2f659 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -215,7 +215,7 @@ config PCMCIA_PXA2XX
depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
|| MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
|| ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
- || MACH_VPAC270)
+ || MACH_VPAC270 || MACH_BALLOON3)
select PCMCIA_SOC_COMMON
help
Say Y here to include support for the PXA2xx PCMCIA controller
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index d006e8b..6a60773 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -70,6 +70,7 @@ pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o
pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o
pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o
pxa2xx-obj-$(CONFIG_MACH_VPAC270) += pxa2xx_vpac270.o
+pxa2xx-obj-$(CONFIG_MACH_BALLOON3) += pxa2xx_balloon3.o
obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_base.o $(pxa2xx-obj-y)
diff --git a/drivers/pcmcia/pxa2xx_balloon3.c b/drivers/pcmcia/pxa2xx_balloon3.c
new file mode 100644
index 0000000..1f71f0d
--- /dev/null
+++ b/drivers/pcmcia/pxa2xx_balloon3.c
@@ -0,0 +1,199 @@
+/*
+ * linux/drivers/pcmcia/pxa2xx_balloon3.c
+ *
+ * Balloon3 PCMCIA specific routines.
+ *
+ * Author: Nick Bane
+ * Created: June, 2006
+ * Copyright: Toby Churchill Ltd
+ * Derived from pxa2xx_mainstone.c, by Nico Pitre
+ *
+ * Various modification by Marek Vasut <marek.vasut@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/gpio.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+
+#include <mach/balloon3.h>
+
+#include "soc_common.h"
+
+/*
+ * FPGA / CPLD register offsets for CF socket
+ */
+#define BALLOON3_CF_STATUS_REG (0x10e00008)
+#define BALLOON3_CF_CONTROL_REG (0x10e00008)
+#define BALLOON3_FPGA_VER (0x10e0001c)
+
+/* CF Status Register bits (read-only) bits */
+#define BALLOON3_CF_nIRQ (1 << 0)
+#define BALLOON3_CF_nSTSCHG_BVD1 (1 << 1)
+
+/* CF Control Set Register bits / CF Control Clear Register bits (write-only) */
+#define BALLOON3_CF_RESET (1 << 0)
+#define BALLOON3_CF_ENABLE (1 << 1)
+#define BALLOON3_CF_ADD_ENABLE (1 << 2)
+
+/* CF Interrupt sources */
+#define BALLOON3_BP_CF_NRDY_IRQ BALLOON3_IRQ(0)
+#define BALLOON3_BP_NSTSCHG_IRQ BALLOON3_IRQ(1)
+
+/*
+ * These are a list of interrupt sources that provokes a polled
+ * check of status
+ */
+static struct pcmcia_irqs irqs[] = {
+ { 0, BALLOON3_S0_CD_IRQ, "PCMCIA0 CD" },
+ { 0, BALLOON3_BP_NSTSCHG_IRQ, "PCMCIA0 STSCHG" },
+};
+
+static void __iomem *cf_control_reg;
+
+static int balloon3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
+{
+ uint16_t ver;
+ int ret;
+ static void __iomem *fpga_ver;
+
+ cf_control_reg = ioremap(BALLOON3_CF_CONTROL_REG, 0x4);
+ if (!cf_control_reg) {
+ ret = -ENOMEM;
+ goto err1;
+ }
+
+ fpga_ver = ioremap(BALLOON3_FPGA_VER, 0x4);
+ if (!fpga_ver) {
+ ret = -ENOMEM;
+ goto err2;
+ }
+
+ ver = readw(fpga_ver);
+ if (ver > 0x0201)
+ pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. "
+ "PCMCIA/CF support might be broken in this version!",
+ ver);
+
+ iounmap(fpga_ver);
+
+ skt->socket.pci_irq = BALLOON3_BP_CF_NRDY_IRQ;
+ return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+
+err2:
+ iounmap(cf_control_reg);
+err1:
+ return ret;
+}
+
+static void balloon3_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
+{
+ soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+ iounmap(cf_control_reg);
+}
+
+static unsigned long balloon3_pcmcia_status[2] = {
+ BALLOON3_CF_nSTSCHG_BVD1,
+ BALLOON3_CF_nSTSCHG_BVD1
+};
+
+static void balloon3_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+ struct pcmcia_state *state)
+{
+ uint16_t status;
+ int flip;
+
+ /* This actually reads the STATUS register */
+ status = readw(cf_control_reg);
+ flip = (status ^ balloon3_pcmcia_status[skt->nr])
+ & BALLOON3_CF_nSTSCHG_BVD1;
+ /*
+ * Workaround for STSCHG which can't be deasserted:
+ * We therefore disable/enable corresponding IRQs
+ * as needed to avoid IRQ locks.
+ */
+ if (flip) {
+ balloon3_pcmcia_status[skt->nr] = status;
+ if (status & BALLOON3_CF_nSTSCHG_BVD1)
+ enable_irq(BALLOON3_BP_NSTSCHG_IRQ);
+ else
+ disable_irq(BALLOON3_BP_NSTSCHG_IRQ);
+ }
+
+ state->detect = !gpio_get_value(BALLOON3_GPIO_S0_CD);
+ state->ready = !!(status & BALLOON3_CF_nIRQ);
+ state->bvd1 = !!(status & BALLOON3_CF_nSTSCHG_BVD1);
+ state->bvd2 = 0; /* not available */
+ state->vs_3v = 1; /* Always true its a CF card */
+ state->vs_Xv = 0; /* not available */
+ state->wrprot = 0; /* not available */
+}
+
+static int balloon3_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
+ const socket_state_t *state)
+{
+ writew((state->flags & SS_RESET) ? BALLOON3_CF_RESET:0, cf_control_reg);
+ return 0;
+}
+
+static void balloon3_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
+{
+}
+
+static void balloon3_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
+{
+}
+
+static struct pcmcia_low_level balloon3_pcmcia_ops = {
+ .owner = THIS_MODULE,
+ .hw_init = balloon3_pcmcia_hw_init,
+ .hw_shutdown = balloon3_pcmcia_hw_shutdown,
+ .socket_state = balloon3_pcmcia_socket_state,
+ .configure_socket = balloon3_pcmcia_configure_socket,
+ .socket_init = balloon3_pcmcia_socket_init,
+ .socket_suspend = balloon3_pcmcia_socket_suspend,
+ .first = 0,
+ .nr = 1,
+};
+
+static struct platform_device *balloon3_pcmcia_device;
+
+static int __init balloon3_pcmcia_init(void)
+{
+ int ret;
+
+ balloon3_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
+ if (!balloon3_pcmcia_device)
+ return -ENOMEM;
+
+ ret = platform_device_add_data(balloon3_pcmcia_device,
+ &balloon3_pcmcia_ops, sizeof(balloon3_pcmcia_ops));
+
+ if (!ret)
+ ret = platform_device_add(balloon3_pcmcia_device);
+
+ if (ret)
+ platform_device_put(balloon3_pcmcia_device);
+
+ return ret;
+}
+
+static void __exit balloon3_pcmcia_exit(void)
+{
+ platform_device_unregister(balloon3_pcmcia_device);
+}
+
+module_init(balloon3_pcmcia_init);
+module_exit(balloon3_pcmcia_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Nick Bane <nick@cecomputing.co.uk>");
+MODULE_ALIAS("platform:pxa2xx-pcmcia");
+MODULE_DESCRIPTION("Balloon3 board CF/PCMCIA driver");
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support
2010-07-29 3:16 ` [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support Marek Vasut
@ 2010-07-29 10:10 ` Wookey
2010-07-30 4:41 ` Marek Vasut
0 siblings, 1 reply; 40+ messages in thread
From: Wookey @ 2010-07-29 10:10 UTC (permalink / raw)
To: linux-arm-kernel
+++ Marek Vasut [2010-07-29 05:16 +0200]:
> This driver adds support for the on-board CF socket.
>
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> arch/arm/mach-pxa/balloon3.c | 13 ++-
> arch/arm/mach-pxa/include/mach/balloon3.h | 17 ---
> drivers/pcmcia/Kconfig | 2 +-
> drivers/pcmcia/Makefile | 1 +
> drivers/pcmcia/pxa2xx_balloon3.c | 199 +++++++++++++++++++++++++++++
> 5 files changed, 213 insertions(+), 19 deletions(-)
> create mode 100644 drivers/pcmcia/pxa2xx_balloon3.c
>
> diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
> index 572525c..91ad56d 100644
> --- a/arch/arm/mach-pxa/balloon3.c
> +++ b/arch/arm/mach-pxa/balloon3.c
> @@ -88,6 +88,18 @@ static unsigned long balloon3_pin_config[] __initdata = {
> /* USB Host */
> GPIO88_USBH1_PWR,
> GPIO89_USBH1_PEN,
> +
> + /* PC Card */
> + GPIO48_nPOE,
> + GPIO49_nPWE,
> + GPIO50_nPIOR,
> + GPIO51_nPIOW,
> + GPIO85_nPCE_1,
> + GPIO54_nPCE_2,
> + GPIO79_PSKTSEL,
> + GPIO55_nPREG,
> + GPIO56_nPWAIT,
> + GPIO57_nIOIS16,
> };
>
> /******************************************************************************
> @@ -405,7 +417,6 @@ static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
> {
> unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
> balloon3_irq_enabled;
> -
> do {
> /* clear useless edge notification */
> if (desc->chip->ack)
> diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
> index 1a74106..14f4bd5 100644
> --- a/arch/arm/mach-pxa/include/mach/balloon3.h
> +++ b/arch/arm/mach-pxa/include/mach/balloon3.h
> @@ -26,10 +26,6 @@ enum balloon3_features {
> #define BALLOON3_FPGA_VIRT (0xf1000000) /* as per balloon2 */
> #define BALLOON3_FPGA_LENGTH 0x01000000
>
> -/* FPGA/CPLD registers */
> -#define BALLOON3_PCMCIA0_REG (BALLOON3_FPGA_VIRT + 0x00e00008)
> -/* fixme - same for now */
> -#define BALLOON3_PCMCIA1_REG (BALLOON3_FPGA_VIRT + 0x00e00008)
> #define BALLOON3_NANDIO_IO_REG (BALLOON3_FPGA_VIRT + 0x00e00000)
> /* fpga/cpld interrupt control register */
> #define BALLOON3_INT_CONTROL_REG (BALLOON3_FPGA_VIRT + 0x00e0000C)
> @@ -58,16 +54,6 @@ enum balloon3_features {
> #define BALLOON3_INT_S0_IRQ (1 << 0) /* PCMCIA 0 IRQ */
> #define BALLOON3_INT_S0_STSCHG (1 << 1) /* PCMCIA 0 status changed */
>
> -/* CF Status Register */
> -#define BALLOON3_PCMCIA_nIRQ (1 << 0) /* IRQ / ready signal */
> -#define BALLOON3_PCMCIA_nSTSCHG_BVD1 (1 << 1)
> - /* VDD sense / card status changed */
> -
> -/* CF control register (write) */
> -#define BALLOON3_PCMCIA_RESET (1 << 0) /* Card reset signal */
> -#define BALLOON3_PCMCIA_ENABLE (1 << 1)
> -#define BALLOON3_PCMCIA_ADD_ENABLE (1 << 2)
> -
> -#define BALLOON3_BP_CF_NRDY_IRQ BALLOON3_IRQ(0)
> -#define BALLOON3_BP_NSTSCHG_IRQ BALLOON3_IRQ(1)
> -
> diff --git a/drivers/pcmcia/pxa2xx_balloon3.c b/drivers/pcmcia/pxa2xx_balloon3.c
> new file mode 100644
> index 0000000..1f71f0d
> --- /dev/null
> +++ b/drivers/pcmcia/pxa2xx_balloon3.c
> @@ -0,0 +1,199 @@
> +/*
> + * FPGA / CPLD register offsets for CF socket
> + */
> +#define BALLOON3_CF_STATUS_REG (0x10e00008)
> +#define BALLOON3_CF_CONTROL_REG (0x10e00008)
> +#define BALLOON3_FPGA_VER (0x10e0001c)
> +
> +/* CF Status Register bits (read-only) bits */
> +#define BALLOON3_CF_nIRQ (1 << 0)
> +#define BALLOON3_CF_nSTSCHG_BVD1 (1 << 1)
> +
> +/* CF Control Set Register bits / CF Control Clear Register bits (write-only) */
> +#define BALLOON3_CF_RESET (1 << 0)
> +#define BALLOON3_CF_ENABLE (1 << 1)
> +#define BALLOON3_CF_ADD_ENABLE (1 << 2)
> +
> +/* CF Interrupt sources */
> +#define BALLOON3_BP_CF_NRDY_IRQ BALLOON3_IRQ(0)
> +#define BALLOON3_BP_NSTSCHG_IRQ BALLOON3_IRQ(1)
erm. Why move the FPGA/CPLD register definitions out of balloon3.h
(along with the others) and put them in balloon3.c?
Is that really good kernel form?
And surely keeping the FPGA_VIRT offset makes it clearer where the
magic addresses come from?
And finally as this code is quite dependent on VHDL version numbers
and we know we have a number of incompatible versions around
should we add a version check to ensure that we have the same VHDL
version as the driver is expecting? I guess it should be of the 'at
least n' form, otherwise later VHDL updates would break the driver,
probbaly for no good reason.
Wookey
--
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM
http://wookware.org/
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support
2010-07-29 10:10 ` Wookey
@ 2010-07-30 4:41 ` Marek Vasut
2010-07-30 5:02 ` Eric Miao
0 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 4:41 UTC (permalink / raw)
To: linux-arm-kernel
Dne ?t 29. ?ervence 2010 12:10:55 Wookey napsal(a):
> +++ Marek Vasut [2010-07-29 05:16 +0200]:
> > This driver adds support for the on-board CF socket.
> >
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > ---
> >
> > arch/arm/mach-pxa/balloon3.c | 13 ++-
> > arch/arm/mach-pxa/include/mach/balloon3.h | 17 ---
> > drivers/pcmcia/Kconfig | 2 +-
> > drivers/pcmcia/Makefile | 1 +
> > drivers/pcmcia/pxa2xx_balloon3.c | 199
> > +++++++++++++++++++++++++++++ 5 files changed, 213 insertions(+), 19
> > deletions(-)
> > create mode 100644 drivers/pcmcia/pxa2xx_balloon3.c
> >
> > diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
> > index 572525c..91ad56d 100644
> > --- a/arch/arm/mach-pxa/balloon3.c
> > +++ b/arch/arm/mach-pxa/balloon3.c
> > @@ -88,6 +88,18 @@ static unsigned long balloon3_pin_config[] __initdata
> > = {
> >
> > /* USB Host */
> > GPIO88_USBH1_PWR,
> > GPIO89_USBH1_PEN,
> >
> > +
> > + /* PC Card */
> > + GPIO48_nPOE,
> > + GPIO49_nPWE,
> > + GPIO50_nPIOR,
> > + GPIO51_nPIOW,
> > + GPIO85_nPCE_1,
> > + GPIO54_nPCE_2,
> > + GPIO79_PSKTSEL,
> > + GPIO55_nPREG,
> > + GPIO56_nPWAIT,
> > + GPIO57_nIOIS16,
> >
> > };
> >
> > /***********************************************************************
> > *******
> >
> > @@ -405,7 +417,6 @@ static void balloon3_irq_handler(unsigned int irq,
> > struct irq_desc *desc)
> >
> > {
> >
> > unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
> >
> > balloon3_irq_enabled;
> >
> > -
> >
> > do {
> >
> > /* clear useless edge notification */
> > if (desc->chip->ack)
> >
> > diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h
> > b/arch/arm/mach-pxa/include/mach/balloon3.h index 1a74106..14f4bd5
> > 100644
> > --- a/arch/arm/mach-pxa/include/mach/balloon3.h
> > +++ b/arch/arm/mach-pxa/include/mach/balloon3.h
> > @@ -26,10 +26,6 @@ enum balloon3_features {
> >
> > #define BALLOON3_FPGA_VIRT (0xf1000000) /* as per balloon2 */
> > #define BALLOON3_FPGA_LENGTH 0x01000000
> >
> > -/* FPGA/CPLD registers */
> > -#define BALLOON3_PCMCIA0_REG (BALLOON3_FPGA_VIRT +
0x00e00008)
> > -/* fixme - same for now */
> > -#define BALLOON3_PCMCIA1_REG (BALLOON3_FPGA_VIRT +
0x00e00008)
> >
> > #define BALLOON3_NANDIO_IO_REG (BALLOON3_FPGA_VIRT +
0x00e00000)
> > /* fpga/cpld interrupt control register */
> > #define BALLOON3_INT_CONTROL_REG (BALLOON3_FPGA_VIRT + 0x00e0000C)
> >
> > @@ -58,16 +54,6 @@ enum balloon3_features {
> >
> > #define BALLOON3_INT_S0_IRQ (1 << 0) /* PCMCIA 0 IRQ */
> > #define BALLOON3_INT_S0_STSCHG (1 << 1) /* PCMCIA 0 status
changed */
> >
> > -/* CF Status Register */
> > -#define BALLOON3_PCMCIA_nIRQ (1 << 0) /* IRQ / ready signal
*/
> > -#define BALLOON3_PCMCIA_nSTSCHG_BVD1 (1 << 1)
> > - /* VDD sense / card status changed */
> > -
> > -/* CF control register (write) */
> > -#define BALLOON3_PCMCIA_RESET (1 << 0) /* Card reset signal
*/
> > -#define BALLOON3_PCMCIA_ENABLE (1 << 1)
> > -#define BALLOON3_PCMCIA_ADD_ENABLE (1 << 2)
> > -
> > -#define BALLOON3_BP_CF_NRDY_IRQ BALLOON3_IRQ(0)
> > -#define BALLOON3_BP_NSTSCHG_IRQ BALLOON3_IRQ(1)
> > -
> >
> >
> > diff --git a/drivers/pcmcia/pxa2xx_balloon3.c
> > b/drivers/pcmcia/pxa2xx_balloon3.c new file mode 100644
> > index 0000000..1f71f0d
> > --- /dev/null
> > +++ b/drivers/pcmcia/pxa2xx_balloon3.c
> > @@ -0,0 +1,199 @@
> > +/*
> > + * FPGA / CPLD register offsets for CF socket
> > + */
> > +#define BALLOON3_CF_STATUS_REG (0x10e00008)
> > +#define BALLOON3_CF_CONTROL_REG (0x10e00008)
> > +#define BALLOON3_FPGA_VER (0x10e0001c)
> > +
> > +/* CF Status Register bits (read-only) bits */
> > +#define BALLOON3_CF_nIRQ (1 << 0)
> > +#define BALLOON3_CF_nSTSCHG_BVD1 (1 << 1)
> > +
> > +/* CF Control Set Register bits / CF Control Clear Register bits
> > (write-only) */ +#define BALLOON3_CF_RESET (1 << 0)
> > +#define BALLOON3_CF_ENABLE (1 << 1)
> > +#define BALLOON3_CF_ADD_ENABLE (1 << 2)
> > +
> > +/* CF Interrupt sources */
> > +#define BALLOON3_BP_CF_NRDY_IRQ BALLOON3_IRQ(0)
> > +#define BALLOON3_BP_NSTSCHG_IRQ BALLOON3_IRQ(1)
>
> erm. Why move the FPGA/CPLD register definitions out of balloon3.h
> (along with the others) and put them in balloon3.c?
> Is that really good kernel form?
They are not used anywhere else so they don't need to be in that file publically
available.
>
> And surely keeping the FPGA_VIRT offset makes it clearer where the
> magic addresses come from?
You mean PHYS offset I believe. That is a good idea, but I'd firstly like to
distribute all the addresses in balloon3.h into drivers (well all that can be
distributed) and then flip it over so all registers will be defined by offset
from some FPGA base address. That's not possible yet so for consistency's sake,
I do it this way now. The patch flipping it to offsets will be very easy, but
this cleanup needs a two-stage plan.
>
> And finally as this code is quite dependent on VHDL version numbers
> and we know we have a number of incompatible versions around
> should we add a version check to ensure that we have the same VHDL
> version as the driver is expecting? I guess it should be of the 'at
> least n' form, otherwise later VHDL updates would break the driver,
> probbaly for no good reason.
Yes, the check is in place.
+ if (ver > 0x0201)
+ pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. "
+ "PCMCIA/CF support might be broken in this version!",
+ ver);
Actually I'm planning to fix the VHDL if I'll have some time for that.
Cheers
>
>
> Wookey
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support
2010-07-30 4:41 ` Marek Vasut
@ 2010-07-30 5:02 ` Eric Miao
2010-07-30 5:12 ` Marek Vasut
0 siblings, 1 reply; 40+ messages in thread
From: Eric Miao @ 2010-07-30 5:02 UTC (permalink / raw)
To: linux-arm-kernel
>> erm. Why move the FPGA/CPLD register definitions out of balloon3.h
>> (along with the others) and put them in balloon3.c?
>> Is that really good kernel form?
>
> They are not used anywhere else so they don't need to be in that file publically
> available.
If the FPGA/CPLD is _not_ solely for the purpose of CF/PCMCIA,
nor it is like an MFD device where the functionality can be clearly
separated from different ranges of registers, I'd agree with Wookey
better to keep them in balloon3.h.
>>
>> And surely keeping the FPGA_VIRT offset makes it clearer where the
>> magic addresses come from?
>
> You mean PHYS offset I believe. That is a good idea, but I'd firstly like to
> distribute all the addresses in balloon3.h into drivers (well all that can be
> distributed) and then flip it over so all registers will be defined by offset
> from some FPGA base address. That's not possible yet so for consistency's sake,
> I do it this way now. The patch flipping it to offsets will be very easy, but
> this cleanup needs a two-stage plan.
And the offsets were a bit different from their originals here?
> - #define BALLOON3_PCMCIA0_REG (BALLOON3_FPGA_VIRT + 0x00e00008)
And
> +#define BALLOON3_CF_STATUS_REG (0x10e00008)
Even the name has been changed?
>>
>> And finally as this code is quite dependent on VHDL version numbers
>> and we know we have a number of incompatible versions around
>> should we add a version check to ensure that we have the same VHDL
>> version as the driver is expecting? I guess it should be of the 'at
>> least n' form, otherwise later VHDL updates would break the driver,
>> probbaly for no good reason.
>
> Yes, the check is in place.
>
> + ? ? ? if (ver > 0x0201)
> + ? ? ? ? ? ? ? pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. "
> + ? ? ? ? ? ? ? ? ? ? ? "PCMCIA/CF support might be broken in this version!",
> + ? ? ? ? ? ? ? ? ? ? ? ver);
>
> Actually I'm planning to fix the VHDL if I'll have some time for that.
>
> Cheers
>>
>>
>> Wookey
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support
2010-07-30 5:02 ` Eric Miao
@ 2010-07-30 5:12 ` Marek Vasut
2010-07-30 5:19 ` Eric Miao
0 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 5:12 UTC (permalink / raw)
To: linux-arm-kernel
Dne P? 30. ?ervence 2010 07:02:46 Eric Miao napsal(a):
> >> erm. Why move the FPGA/CPLD register definitions out of balloon3.h
> >> (along with the others) and put them in balloon3.c?
> >> Is that really good kernel form?
> >
> > They are not used anywhere else so they don't need to be in that file
> > publically available.
>
> If the FPGA/CPLD is _not_ solely for the purpose of CF/PCMCIA,
> nor it is like an MFD device where the functionality can be clearly
> separated from different ranges of registers, I'd agree with Wookey
> better to keep them in balloon3.h.
Well the registers used are solely for PCMCIA (or rather CF socket on the board,
which clears your question below).
>
> >> And surely keeping the FPGA_VIRT offset makes it clearer where the
> >> magic addresses come from?
> >
> > You mean PHYS offset I believe. That is a good idea, but I'd firstly like
> > to distribute all the addresses in balloon3.h into drivers (well all
> > that can be distributed) and then flip it over so all registers will be
> > defined by offset from some FPGA base address. That's not possible yet
> > so for consistency's sake, I do it this way now. The patch flipping it
> > to offsets will be very easy, but this cleanup needs a two-stage plan.
>
> And the offsets were a bit different from their originals here?
I ioremap-ed them.
>
> > - #define BALLOON3_PCMCIA0_REG (BALLOON3_FPGA_VIRT +
> > 0x00e00008)
>
> And
>
> > +#define BALLOON3_CF_STATUS_REG (0x10e00008)
>
> Even the name has been changed?
This is more appropriate. The thing on the board is a CF socket.
>
> >> And finally as this code is quite dependent on VHDL version numbers
> >> and we know we have a number of incompatible versions around
> >> should we add a version check to ensure that we have the same VHDL
> >> version as the driver is expecting? I guess it should be of the 'at
> >> least n' form, otherwise later VHDL updates would break the driver,
> >> probbaly for no good reason.
> >
> > Yes, the check is in place.
> >
> > + if (ver > 0x0201)
> > + pr_warn("The FPGA code, version 0x%04x, is newer than
> > rel-0.3. " + "PCMCIA/CF support might be broken in
> > this version!", + ver);
> >
> > Actually I'm planning to fix the VHDL if I'll have some time for that.
> >
> > Cheers
> >
> >> Wookey
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support
2010-07-30 5:12 ` Marek Vasut
@ 2010-07-30 5:19 ` Eric Miao
0 siblings, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-07-30 5:19 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jul 30, 2010 at 1:12 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Dne P? 30. ?ervence 2010 07:02:46 Eric Miao napsal(a):
>> >> erm. Why move the FPGA/CPLD register definitions out of balloon3.h
>> >> (along with the others) and put them in balloon3.c?
>> >> Is that really good kernel form?
>> >
>> > They are not used anywhere else so they don't need to be in that file
>> > publically available.
>>
>> If the FPGA/CPLD is _not_ solely for the purpose of CF/PCMCIA,
>> nor it is like an MFD device where the functionality can be clearly
>> separated from different ranges of registers, I'd agree with Wookey
>> better to keep them in balloon3.h.
>
> Well the registers used are solely for PCMCIA (or rather CF socket on the board,
> which clears your question below).
I see something like:
#define BALLOON3_NANDIO_IO_REG (BALLOON3_FPGA_VIRT + 0x00e00000)
/* fpga/cpld interrupt control register */
#define BALLOON3_INT_CONTROL_REG (BALLOON3_FPGA_VIRT + 0x00e0000C)
But yeah, I don't know balloon3 board much, so it would be good
to have Wookey's Ack on this. Otherwise the patch looks OK to
me.
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (8 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 10/13] [ARM] pxa/balloon3: PCMCIA Support Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-07-29 10:00 ` Wookey
2010-07-29 3:16 ` [PATCH 12/13] [ARM] pxa/balloon3: Add NAND driver Marek Vasut
` (2 subsequent siblings)
12 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Add supported for PCF8574A GPIO expander and LEDs attached to it.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/balloon3.c | 84 +++++++++++++++++++++++++++-
arch/arm/mach-pxa/include/mach/balloon3.h | 11 ++++
2 files changed, 92 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 91ad56d..6f594bd 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -26,6 +26,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/types.h>
+#include <linux/i2c/pcf857x.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
@@ -375,15 +376,65 @@ static struct gpio_led_platform_data balloon3_gpio_led_info = {
static struct platform_device balloon3_leds = {
.name = "leds-gpio",
- .id = -1,
+ .id = 0,
.dev = {
.platform_data = &balloon3_gpio_led_info,
}
};
+struct gpio_led balloon3_pcf_gpio_leds[] = {
+ {
+ .name = "balloon3:green:led0",
+ .gpio = BALLOON3_PCF_GPIO_LED0,
+ .active_low = 1,
+ }, {
+ .name = "balloon3:green:led1",
+ .gpio = BALLOON3_PCF_GPIO_LED1,
+ .active_low = 1,
+ }, {
+ .name = "balloon3:orange:led2",
+ .gpio = BALLOON3_PCF_GPIO_LED2,
+ .active_low = 1,
+ }, {
+ .name = "balloon3:orange:led3",
+ .gpio = BALLOON3_PCF_GPIO_LED3,
+ .active_low = 1,
+ }, {
+ .name = "balloon3:orange:led4",
+ .gpio = BALLOON3_PCF_GPIO_LED4,
+ .active_low = 1,
+ }, {
+ .name = "balloon3:orange:led5",
+ .gpio = BALLOON3_PCF_GPIO_LED5,
+ .active_low = 1,
+ }, {
+ .name = "balloon3:red:led6",
+ .gpio = BALLOON3_PCF_GPIO_LED6,
+ .active_low = 1,
+ }, {
+ .name = "balloon3:red:led7",
+ .gpio = BALLOON3_PCF_GPIO_LED7,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_led_platform_data balloon3_pcf_gpio_led_info = {
+ .leds = balloon3_pcf_gpio_leds,
+ .num_leds = ARRAY_SIZE(balloon3_pcf_gpio_leds),
+};
+
+static struct platform_device balloon3_pcf_leds = {
+ .name = "leds-gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &balloon3_pcf_gpio_led_info,
+ }
+};
+
static void __init balloon3_leds_init(void)
{
platform_device_register(&balloon3_leds);
+ platform_device_register(&balloon3_pcf_leds);
}
#else
static inline void balloon3_leds_init(void) {}
@@ -451,6 +502,34 @@ static void __init balloon3_init_irq(void)
}
/******************************************************************************
+ * GPIO expander
+ ******************************************************************************/
+#if defined(CONFIG_GPIO_PCF857X) || defined(CONFIG_GPIO_PCF857X_MODULE)
+static struct pcf857x_platform_data balloon3_pcf857x_pdata = {
+ .gpio_base = BALLOON3_PCF_GPIO_BASE,
+ .n_latch = 0,
+ .setup = NULL,
+ .teardown = NULL,
+ .context = NULL,
+};
+
+static struct i2c_board_info __initdata balloon3_i2c_devs[] = {
+ {
+ I2C_BOARD_INFO("pcf8574a", 0x38),
+ .platform_data = &balloon3_pcf857x_pdata,
+ },
+};
+
+static void __init balloon3_i2c_init(void)
+{
+ pxa_set_i2c_info(NULL);
+ i2c_register_board_info(0, ARRAY_AND_SIZE(balloon3_i2c_devs));
+}
+#else
+static inline void balloon3_i2c_init(void) {}
+#endif
+
+/******************************************************************************
* Machine init
******************************************************************************/
static void __init balloon3_init(void)
@@ -463,8 +542,7 @@ static void __init balloon3_init(void)
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
- pxa_set_i2c_info(NULL);
-
+ balloon3_i2c_init();
balloon3_irda_init();
balloon3_lcd_init();
balloon3_leds_init();
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
index 14f4bd5..8886c23 100644
--- a/arch/arm/mach-pxa/include/mach/balloon3.h
+++ b/arch/arm/mach-pxa/include/mach/balloon3.h
@@ -50,6 +50,17 @@ enum balloon3_features {
#define BALLOON3_GPIO_S0_CD (105)
+/* PCF8574A Leds */
+#define BALLOON3_PCF_GPIO_BASE 160
+#define BALLOON3_PCF_GPIO_LED0 (BALLOON3_PCF_GPIO_BASE + 0)
+#define BALLOON3_PCF_GPIO_LED1 (BALLOON3_PCF_GPIO_BASE + 1)
+#define BALLOON3_PCF_GPIO_LED2 (BALLOON3_PCF_GPIO_BASE + 2)
+#define BALLOON3_PCF_GPIO_LED3 (BALLOON3_PCF_GPIO_BASE + 3)
+#define BALLOON3_PCF_GPIO_LED4 (BALLOON3_PCF_GPIO_BASE + 4)
+#define BALLOON3_PCF_GPIO_LED5 (BALLOON3_PCF_GPIO_BASE + 5)
+#define BALLOON3_PCF_GPIO_LED6 (BALLOON3_PCF_GPIO_BASE + 6)
+#define BALLOON3_PCF_GPIO_LED7 (BALLOON3_PCF_GPIO_BASE + 7)
+
/* FPGA Interrupt Mask/Acknowledge Register */
#define BALLOON3_INT_S0_IRQ (1 << 0) /* PCMCIA 0 IRQ */
#define BALLOON3_INT_S0_STSCHG (1 << 1) /* PCMCIA 0 status changed */
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-29 3:16 ` [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs Marek Vasut
@ 2010-07-29 10:00 ` Wookey
2010-07-30 4:44 ` Marek Vasut
0 siblings, 1 reply; 40+ messages in thread
From: Wookey @ 2010-07-29 10:00 UTC (permalink / raw)
To: linux-arm-kernel
+++ Marek Vasut [2010-07-29 05:16 +0200]:
> Add supported for PCF8574A GPIO expander and LEDs attached to it.
This IO board is an add-on used in some ballon configurations, not
part of the core board. There needs to be some way of selecting this
support when the loon is used in this configuration. We have the
balloon_has() macro which is used for dealing with the different
builds of the board itself. Perhaps it should be extended to deal with
add-on board functionality too?
More obvious is using the CONFIG system to just enable this if
CUED_IO_BOARD is configured.
Wookey
--
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM
http://wookware.org/
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-29 10:00 ` Wookey
@ 2010-07-30 4:44 ` Marek Vasut
2010-07-30 5:09 ` Eric Miao
2010-07-30 9:39 ` Wookey
0 siblings, 2 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 4:44 UTC (permalink / raw)
To: linux-arm-kernel
Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
> +++ Marek Vasut [2010-07-29 05:16 +0200]:
> > Add supported for PCF8574A GPIO expander and LEDs attached to it.
>
> This IO board is an add-on used in some ballon configurations, not
> part of the core board. There needs to be some way of selecting this
> support when the loon is used in this configuration. We have the
> balloon_has() macro which is used for dealing with the different
> builds of the board itself. Perhaps it should be extended to deal with
> add-on board functionality too?
>
> More obvious is using the CONFIG system to just enable this if
> CUED_IO_BOARD is configured.
You can just disable the PCF driver if you want to save space. In case you won't
have the CUED board connected, the driver will just fail to probe so it's ok I
believe.
The macro could be extended, but do we want such a weird stuff in kernel?
(especially if the driver can simply fail to probe).
>
> Wookey
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 4:44 ` Marek Vasut
@ 2010-07-30 5:09 ` Eric Miao
2010-07-30 5:19 ` Marek Vasut
2010-07-30 9:39 ` Wookey
1 sibling, 1 reply; 40+ messages in thread
From: Eric Miao @ 2010-07-30 5:09 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jul 30, 2010 at 12:44 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
>> +++ Marek Vasut [2010-07-29 05:16 +0200]:
>> > Add supported for PCF8574A GPIO expander and LEDs attached to it.
>>
>> This IO board is an add-on used in some ballon configurations, not
>> part of the core board. There needs to be some way of selecting this
>> support when the loon is used in this configuration. We have the
>> balloon_has() macro which is used for dealing with the different
>> builds of the board itself. Perhaps it should be extended to deal with
>> add-on board functionality too?
>>
>> More obvious is using the CONFIG system to just enable this if
>> CUED_IO_BOARD is configured.
>
> You can just disable the PCF driver if you want to save space. In case you won't
> have the CUED board connected, the driver will just fail to probe so it's ok I
> believe.
>
> The macro could be extended, but do we want such a weird stuff in kernel?
> (especially if the driver can simply fail to probe).
Are we able to detect this expansion board at run-time and registers
i2c/led-gpio if present. The thing I'm worried more on space is the
gpio_leds will be registered there even without the expansion board,
but what if someone tries to read/write to those LED controls?
>>
>> Wookey
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 5:09 ` Eric Miao
@ 2010-07-30 5:19 ` Marek Vasut
2010-07-30 5:21 ` Eric Miao
0 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 5:19 UTC (permalink / raw)
To: linux-arm-kernel
Dne P? 30. ?ervence 2010 07:09:00 Eric Miao napsal(a):
> On Fri, Jul 30, 2010 at 12:44 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
> >> +++ Marek Vasut [2010-07-29 05:16 +0200]:
> >> > Add supported for PCF8574A GPIO expander and LEDs attached to it.
> >>
> >> This IO board is an add-on used in some ballon configurations, not
> >> part of the core board. There needs to be some way of selecting this
> >> support when the loon is used in this configuration. We have the
> >> balloon_has() macro which is used for dealing with the different
> >> builds of the board itself. Perhaps it should be extended to deal with
> >> add-on board functionality too?
> >>
> >> More obvious is using the CONFIG system to just enable this if
> >> CUED_IO_BOARD is configured.
> >
> > You can just disable the PCF driver if you want to save space. In case
> > you won't have the CUED board connected, the driver will just fail to
> > probe so it's ok I believe.
> >
> > The macro could be extended, but do we want such a weird stuff in kernel?
> > (especially if the driver can simply fail to probe).
>
> Are we able to detect this expansion board at run-time and registers
> i2c/led-gpio if present. The thing I'm worried more on space is the
> gpio_leds will be registered there even without the expansion board,
> but what if someone tries to read/write to those LED controls?
They won't register because the GPIOs won't be there.
>
> >> Wookey
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 5:19 ` Marek Vasut
@ 2010-07-30 5:21 ` Eric Miao
0 siblings, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-07-30 5:21 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jul 30, 2010 at 1:19 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Dne P? 30. ?ervence 2010 07:09:00 Eric Miao napsal(a):
>> On Fri, Jul 30, 2010 at 12:44 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
>> > Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
>> >> +++ Marek Vasut [2010-07-29 05:16 +0200]:
>> >> > Add supported for PCF8574A GPIO expander and LEDs attached to it.
>> >>
>> >> This IO board is an add-on used in some ballon configurations, not
>> >> part of the core board. There needs to be some way of selecting this
>> >> support when the loon is used in this configuration. We have the
>> >> balloon_has() macro which is used for dealing with the different
>> >> builds of the board itself. Perhaps it should be extended to deal with
>> >> add-on board functionality too?
>> >>
>> >> More obvious is using the CONFIG system to just enable this if
>> >> CUED_IO_BOARD is configured.
>> >
>> > You can just disable the PCF driver if you want to save space. In case
>> > you won't have the CUED board connected, the driver will just fail to
>> > probe so it's ok I believe.
>> >
>> > The macro could be extended, but do we want such a weird stuff in kernel?
>> > (especially if the driver can simply fail to probe).
>>
>> Are we able to detect this expansion board at run-time and registers
>> i2c/led-gpio if present. The thing I'm worried more on space is the
>> gpio_leds will be registered there even without the expansion board,
>> but what if someone tries to read/write to those LED controls?
>
> They won't register because the GPIOs won't be there.
Ah right, gpio_request() should fail them. If there's no way to
detect this board at run-time, I think I'm fine with the patch.
>>
>> >> Wookey
>> >
>> > _______________________________________________
>> > linux-arm-kernel mailing list
>> > linux-arm-kernel at lists.infradead.org
>> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 4:44 ` Marek Vasut
2010-07-30 5:09 ` Eric Miao
@ 2010-07-30 9:39 ` Wookey
2010-07-30 12:36 ` Marek Vasut
[not found] ` <Prayer.1.3.3.1007301954290.28463@hermes-2.csi.cam.ac.uk>
1 sibling, 2 replies; 40+ messages in thread
From: Wookey @ 2010-07-30 9:39 UTC (permalink / raw)
To: linux-arm-kernel
+++ Marek Vasut [2010-07-30 06:44 +0200]:
> Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
> > +++ Marek Vasut [2010-07-29 05:16 +0200]:
> > > Add supported for PCF8574A GPIO expander and LEDs attached to it.
> >
> > This IO board is an add-on used in some ballon configurations, not
> > part of the core board. There needs to be some way of selecting this
> > support when the loon is used in this configuration. We have the
> > balloon_has() macro which is used for dealing with the different
> > builds of the board itself. Perhaps it should be extended to deal with
> > add-on board functionality too?
> >
> > More obvious is using the CONFIG system to just enable this if
> > CUED_IO_BOARD is configured.
>
> You can just disable the PCF driver if you want to save space. In case you won't
> have the CUED board connected, the driver will just fail to probe so it's ok I
> believe.
>
> The macro could be extended, but do we want such a weird stuff in kernel?
That was how this list suggested we deal with the unprobe-able build variation, I
beleive.
> (especially if the driver can simply fail to probe).
No. Clearly anything that is probe-able should be probed. I thought
thtat this wouldn't be as I2C devices are pretty dumb, but I guess we
know its address here so we can try it and if no response then it's
not there.
Wookey
--
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM
http://wookware.org/
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 9:39 ` Wookey
@ 2010-07-30 12:36 ` Marek Vasut
2010-07-30 12:36 ` Marek Vasut
[not found] ` <Prayer.1.3.3.1007301954290.28463@hermes-2.csi.cam.ac.uk>
1 sibling, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 12:36 UTC (permalink / raw)
To: linux-arm-kernel
Dne P? 30. ?ervence 2010 11:39:40 Wookey napsal(a):
> +++ Marek Vasut [2010-07-30 06:44 +0200]:
> > Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
> > > +++ Marek Vasut [2010-07-29 05:16 +0200]:
> > > > Add supported for PCF8574A GPIO expander and LEDs attached to it.
> > >
> > > This IO board is an add-on used in some ballon configurations, not
> > > part of the core board. There needs to be some way of selecting this
> > > support when the loon is used in this configuration. We have the
> > > balloon_has() macro which is used for dealing with the different
> > > builds of the board itself. Perhaps it should be extended to deal with
> > > add-on board functionality too?
> > >
> > > More obvious is using the CONFIG system to just enable this if
> > > CUED_IO_BOARD is configured.
> >
> > You can just disable the PCF driver if you want to save space. In case
> > you won't have the CUED board connected, the driver will just fail to
> > probe so it's ok I believe.
> >
> > The macro could be extended, but do we want such a weird stuff in kernel?
>
> That was how this list suggested we deal with the unprobe-able build
> variation, I beleive.
We have loadable kernel modules ever since ... long time ago. Maybe that's more
like the way to go.
>
> > (especially if the driver can simply fail to probe).
>
> No. Clearly anything that is probe-able should be probed. I thought
> thtat this wouldn't be as I2C devices are pretty dumb, but I guess we
> know its address here so we can try it and if no response then it's
> not there.
Yes, this one is probeable.
Cheers
>
> Wookey
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 12:36 ` Marek Vasut
@ 2010-07-30 12:36 ` Marek Vasut
2010-07-30 13:07 ` Wookey
0 siblings, 1 reply; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 12:36 UTC (permalink / raw)
To: linux-arm-kernel
Dne P? 30. ?ervence 2010 14:36:09 Marek Vasut napsal(a):
> Dne P? 30. ?ervence 2010 11:39:40 Wookey napsal(a):
> > +++ Marek Vasut [2010-07-30 06:44 +0200]:
> > > Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
> > > > +++ Marek Vasut [2010-07-29 05:16 +0200]:
> > > > > Add supported for PCF8574A GPIO expander and LEDs attached to it.
> > > >
> > > > This IO board is an add-on used in some ballon configurations, not
> > > > part of the core board. There needs to be some way of selecting this
> > > > support when the loon is used in this configuration. We have the
> > > > balloon_has() macro which is used for dealing with the different
> > > > builds of the board itself. Perhaps it should be extended to deal
> > > > with add-on board functionality too?
> > > >
> > > > More obvious is using the CONFIG system to just enable this if
> > > > CUED_IO_BOARD is configured.
> > >
> > > You can just disable the PCF driver if you want to save space. In case
> > > you won't have the CUED board connected, the driver will just fail to
> > > probe so it's ok I believe.
> > >
> > > The macro could be extended, but do we want such a weird stuff in
> > > kernel?
> >
> > That was how this list suggested we deal with the unprobe-able build
> > variation, I beleive.
>
> We have loadable kernel modules ever since ... long time ago. Maybe that's
> more like the way to go.
>
> > > (especially if the driver can simply fail to probe).
> >
> > No. Clearly anything that is probe-able should be probed. I thought
> > thtat this wouldn't be as I2C devices are pretty dumb, but I guess we
> > know its address here so we can try it and if no response then it's
> > not there.
>
> Yes, this one is probeable.
Re-adding Eric as he was dropped. Cheers
>
> Cheers
>
> > Wookey
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 12:36 ` Marek Vasut
@ 2010-07-30 13:07 ` Wookey
2010-07-30 13:16 ` Marek Vasut
0 siblings, 1 reply; 40+ messages in thread
From: Wookey @ 2010-07-30 13:07 UTC (permalink / raw)
To: linux-arm-kernel
+++ Marek Vasut [2010-07-30 14:36 +0200]:
> Dne P? 30. ?ervence 2010 14:36:09 Marek Vasut napsal(a):
> > > > > support when the loon is used in this configuration. We have the
> > > > > balloon_has() macro which is used for dealing with the different
> > > > > builds of the board itself.
> > > > >
> > > > > More obvious is using the CONFIG system to just enable this if
> > > > > CUED_IO_BOARD is configured.
> > > >
> > > > You can just disable the PCF driver if you want to save space. In case
> > > > you won't have the CUED board connected, the driver will just fail to
> > > > probe so it's ok I believe.
> > > >
> > > > The macro could be extended, but do we want such a weird stuff in
> > > > kernel?
> > >
> > > That was how this list suggested we deal with the unprobe-able build
> > > variation, I beleive.
> >
> > We have loadable kernel modules ever since ... long time ago. Maybe that's
> > more like the way to go.
But that makes it impossible to have a 'balloon' kernel that works on
different hardware builds. So far we have been able to have one kernel
build that works on all the different build variants by using that
macro to avoid doing things which will hang forever when hardware is
missing. Having to have a pile of different defconfigs for different
build options helps no-one (and we don't like defconfigs anymore
anyway :-)
More generic kernels is good, and ther has been much work on that sort
of thing recently.
> > > > (especially if the driver can simply fail to probe).
> > >
> > > No. Clearly anything that is probe-able should be probed. I thought
> > > thtat this wouldn't be as I2C devices are pretty dumb, but I guess we
> > > know its address here so we can try it and if no response then it's
> > > not there.
> >
> > Yes, this one is probeable.
>
> Re-adding Eric as he was dropped. Cheers
OK. Just to be clear I am not objecting to any of the stuff Marek is
posting here. It's great to have some of it upstream at last.
Once we have most of the basic support in we can consider the best
ways of dealing with the odd configuration issues of balloon variants
and add-on boards. (I'm not sure what you lot are going to think of
our Samosa bus - hopefuly it's not too ugly these days as we did make
it into a proper bus)
So, I am acking these patches.
Wookey
--
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM
http://wookware.org/
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
2010-07-30 13:07 ` Wookey
@ 2010-07-30 13:16 ` Marek Vasut
0 siblings, 0 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 13:16 UTC (permalink / raw)
To: linux-arm-kernel
Dne P? 30. ?ervence 2010 15:07:55 Wookey napsal(a):
> +++ Marek Vasut [2010-07-30 14:36 +0200]:
> > Dne P? 30. ?ervence 2010 14:36:09 Marek Vasut napsal(a):
> > > > > > support when the loon is used in this configuration. We have the
> > > > > > balloon_has() macro which is used for dealing with the different
> > > > > > builds of the board itself.
> > > > > >
> > > > > > More obvious is using the CONFIG system to just enable this if
> > > > > > CUED_IO_BOARD is configured.
> > > > >
> > > > > You can just disable the PCF driver if you want to save space. In
> > > > > case you won't have the CUED board connected, the driver will just
> > > > > fail to probe so it's ok I believe.
> > > > >
> > > > > The macro could be extended, but do we want such a weird stuff in
> > > > > kernel?
> > > >
> > > > That was how this list suggested we deal with the unprobe-able build
> > > > variation, I beleive.
> > >
> > > We have loadable kernel modules ever since ... long time ago. Maybe
> > > that's more like the way to go.
>
> But that makes it impossible to have a 'balloon' kernel that works on
> different hardware builds. So far we have been able to have one kernel
> build that works on all the different build variants by using that
> macro to avoid doing things which will hang forever when hardware is
> missing. Having to have a pile of different defconfigs for different
> build options helps no-one (and we don't like defconfigs anymore
> anyway :-)
>
> More generic kernels is good, and ther has been much work on that sort
> of thing recently.
Maybe we should figure out a more generic way of doing this so it can be
reusable on other machines too. Eric ? Maybe the Device tree would help here?
>
> > > > > (especially if the driver can simply fail to probe).
> > > >
> > > > No. Clearly anything that is probe-able should be probed. I thought
> > > > thtat this wouldn't be as I2C devices are pretty dumb, but I guess we
> > > > know its address here so we can try it and if no response then it's
> > > > not there.
> > >
> > > Yes, this one is probeable.
> >
> > Re-adding Eric as he was dropped. Cheers
>
> OK. Just to be clear I am not objecting to any of the stuff Marek is
> posting here. It's great to have some of it upstream at last.
>
> Once we have most of the basic support in we can consider the best
> ways of dealing with the odd configuration issues of balloon variants
> and add-on boards. (I'm not sure what you lot are going to think of
> our Samosa bus - hopefuly it's not too ugly these days as we did make
> it into a proper bus)
>
> So, I am acking these patches.
>
> Wookey
^ permalink raw reply [flat|nested] 40+ messages in thread
[parent not found: <Prayer.1.3.3.1007301954290.28463@hermes-2.csi.cam.ac.uk>]
* [Balloon] [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs
[not found] ` <Prayer.1.3.3.1007301954290.28463@hermes-2.csi.cam.ac.uk>
@ 2010-07-30 19:34 ` Marek Vasut
0 siblings, 0 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-30 19:34 UTC (permalink / raw)
To: linux-arm-kernel
Dne P? 30. ?ervence 2010 20:54:29 Paul Fidler napsal(a):
> On Jul 30 2010, Wookey wrote:
> >+++ Marek Vasut [2010-07-30 06:44 +0200]:
> >> Dne ?t 29. ?ervence 2010 12:00:41 Wookey napsal(a):
> >> > +++ Marek Vasut [2010-07-29 05:16 +0200]:
> >> > > Add supported for PCF8574A GPIO expander and LEDs attached to it.
> >> >
> >> > This IO board is an add-on used in some ballon configurations, not
> >> > part of the core board. There needs to be some way of selecting this
> >> > support when the loon is used in this configuration. We have the
> >> > balloon_has() macro which is used for dealing with the different
> >> > builds of the board itself. Perhaps it should be extended to deal with
> >> > add-on board functionality too?
> >> >
> >> > More obvious is using the CONFIG system to just enable this if
> >> > CUED_IO_BOARD is configured.
> >>
> >> You can just disable the PCF driver if you want to save space. In case
> >> you won't have the CUED board connected, the driver will just fail to
> >> probe so it's ok I believe.
> >>
> >> The macro could be extended, but do we want such a weird stuff in
> >> kernel?
> >
> > That was how this list suggested we deal with the unprobe-able build
> > variation, I beleive.
> >
> >> (especially if the driver can simply fail to probe).
>
> I'd strongly recommend not adding anything at all in the kernel
> to specifically support the CUED IO Board. The LEDs attached to
> the PCF8574 on the board can be driven from user space quite easily
> using programs such as as i2cset from the i2ctools package.
>
> We've been using these boards at CUED for a number of years now
> without any kernel support beyond i2c-pxa.ko and i2c-dev.ko.
>
> If support is added for these LEDs in the kernel, it would be nice
> if we could still write their PCF8574 device using the i2c-dev ioctls.
> It would be inconvenient (for us) if the only way to set these LEDs
> was by writing a 1 or 0 to /sys/devices/system/leds-gpio/balloon3:gpio:ledN
> (or similar).
And also _please_ keep the CC correct. Cheers
>
> Best wishes,
>
> Paul.
>
>
> Paul Fidler
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 12/13] [ARM] pxa/balloon3: Add NAND driver
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (9 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 11/13] [ARM] pxa/balloon3: PCF857x GPIO expander and LEDs Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-07-29 3:16 ` [PATCH 13/13] [ARM] pxa/balloon3: Add MAX1586 PMIC support Marek Vasut
2010-07-29 10:04 ` [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Mike Rapoport
12 siblings, 0 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
The NAND support is implemented through the gen_nand driver.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/balloon3.c | 198 +++++++++++++++++++++++++++++
arch/arm/mach-pxa/include/mach/balloon3.h | 3 +
2 files changed, 201 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 6f594bd..781dab7 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -27,6 +27,8 @@
#include <linux/mtd/partitions.h>
#include <linux/types.h>
#include <linux/i2c/pcf857x.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/physmap.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
@@ -530,6 +532,201 @@ static inline void balloon3_i2c_init(void) {}
#endif
/******************************************************************************
+ * NAND
+ ******************************************************************************/
+#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
+
+#define BALLOON3_NAND_BASE (0x10e00000)
+#define BALLOON3_NAND_IO_REG (0x10e00000)
+#define BALLOON3_NAND_CONTROL2_REG (0x10e00010)
+#define BALLOON3_NAND_STAT_REG (0x10e00010)
+#define BALLOON3_NAND_CONTROL_REG (0x10e00014)
+#define BALLOON3_FPGA_VER (0x10e0001c)
+
+#define BALLOON3_NAND_CONTROL_FLWP (1 << 7)
+#define BALLOON3_NAND_CONTROL_FLSE (1 << 6)
+#define BALLOON3_NAND_CONTROL_FLCE3 (1 << 5)
+#define BALLOON3_NAND_CONTROL_FLCE2 (1 << 4)
+#define BALLOON3_NAND_CONTROL_FLCE1 (1 << 3)
+#define BALLOON3_NAND_CONTROL_FLCE0 (1 << 2)
+#define BALLOON3_NAND_CONTROL_FLALE (1 << 1)
+#define BALLOON3_NAND_CONTROL_FLCLE (1 << 0)
+
+#define BALLOON3_NAND_STAT_RNB (1 << 0)
+
+#define BALLOON3_NAND_CONTROL2_16BIT (1 << 0)
+
+static void __iomem *nand_control_reg;
+
+static uint16_t balloon3_ctl =
+ BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
+ BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3 |
+ BALLOON3_NAND_CONTROL_FLWP;
+
+static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
+{
+ struct nand_chip *this = mtd->priv;
+
+ if (ctrl & NAND_CTRL_CHANGE) {
+ if (ctrl & NAND_CLE)
+ balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCLE;
+ else
+ balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLCLE;
+
+ if (ctrl & NAND_ALE)
+ balloon3_ctl |= BALLOON3_NAND_CONTROL_FLALE;
+ else
+ balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLALE;
+
+ writel(balloon3_ctl, nand_control_reg);
+ }
+
+ if (cmd != NAND_CMD_NONE)
+ writeb(cmd, this->IO_ADDR_W);
+}
+
+static void balloon3_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+ if (chip < 0 || chip > 3)
+ return;
+
+ balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCE0 |
+ BALLOON3_NAND_CONTROL_FLCE1 |
+ BALLOON3_NAND_CONTROL_FLCE2 |
+ BALLOON3_NAND_CONTROL_FLCE3;
+
+ /* Deassert correct nCE line */
+ balloon3_ctl &= ~(BALLOON3_NAND_CONTROL_FLCE0 << chip);
+
+ writew(balloon3_ctl, nand_control_reg);
+}
+
+static int balloon3_nand_probe(struct platform_device *pdev)
+{
+ void __iomem *temp_map;
+ uint16_t ver;
+ int ret;
+
+ /* Configure the FPGA to use 8bit NAND */
+ temp_map = ioremap(BALLOON3_NAND_CONTROL2_REG, 0x4);
+ if (!temp_map) {
+ ret = -ENOMEM;
+ goto err1;
+ }
+ writew(BALLOON3_NAND_CONTROL2_16BIT, temp_map);
+ iounmap(temp_map);
+
+ /* Configure the FPGA to use 8bit NAND */
+ temp_map = ioremap(BALLOON3_FPGA_VER, 0x4);
+ if (!temp_map) {
+ ret = -ENOMEM;
+ goto err1;
+ }
+ ver = readw(temp_map);
+ if (ver > 0x0201)
+ pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. "
+ "NAND support might be broken in this version!", ver);
+ iounmap(temp_map);
+
+ /* Remap control register */
+ nand_control_reg = ioremap(BALLOON3_NAND_CONTROL_REG, 0x4);
+ if (!nand_control_reg) {
+ ret = -ENOMEM;
+ goto err1;
+ }
+
+ /* Power up the NAND chips */
+ ret = gpio_request(BALLOON3_GPIO_RUN_NAND, "NAND");
+ if (ret)
+ goto err2;
+
+ ret = gpio_direction_output(BALLOON3_GPIO_RUN_NAND, 1);
+ if (ret)
+ goto err3;
+
+ gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1);
+
+ /* Deassert all nCE lines and write protect line */
+ writel(balloon3_ctl, nand_control_reg);
+ return 0;
+
+err3:
+ gpio_free(BALLOON3_GPIO_RUN_NAND);
+err2:
+ iounmap(nand_control_reg);
+err1:
+ return ret;
+}
+
+static void balloon3_nand_remove(struct platform_device *pdev)
+{
+ /* Power down the NAND chips */
+ gpio_set_value(BALLOON3_GPIO_RUN_NAND, 0);
+ gpio_free(BALLOON3_GPIO_RUN_NAND);
+ iounmap(nand_control_reg);
+}
+
+static struct mtd_partition balloon3_partition_info[] = {
+ [0] = {
+ .name = "Boot",
+ .offset = 0,
+ .size = SZ_4M,
+ },
+ [1] = {
+ .name = "RootFS",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL
+ },
+};
+
+static const char *balloon3_part_probes[] = { "cmdlinepart", NULL };
+
+struct platform_nand_data balloon3_nand_pdata = {
+ .chip = {
+ .nr_chips = 4,
+ .chip_offset = 0,
+ .nr_partitions = ARRAY_SIZE(balloon3_partition_info),
+ .partitions = balloon3_partition_info,
+ .chip_delay = 50,
+ .part_probe_types = balloon3_part_probes,
+ },
+ .ctrl = {
+ .hwcontrol = 0,
+ .dev_ready = 0,
+ .select_chip = balloon3_nand_select_chip,
+ .cmd_ctrl = balloon3_nand_cmd_ctl,
+ .probe = balloon3_nand_probe,
+ .remove = balloon3_nand_remove,
+ },
+};
+
+static struct resource balloon3_nand_resource[] = {
+ [0] = {
+ .start = BALLOON3_NAND_BASE,
+ .end = BALLOON3_NAND_BASE + 0x4,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device balloon3_nand = {
+ .name = "gen_nand",
+ .num_resources = ARRAY_SIZE(balloon3_nand_resource),
+ .resource = balloon3_nand_resource,
+ .id = -1,
+ .dev = {
+ .platform_data = &balloon3_nand_pdata,
+ }
+};
+
+static void __init balloon3_nand_init(void)
+{
+ platform_device_register(&balloon3_nand);
+}
+#else
+static inline void balloon3_nand_init(void) {}
+#endif
+
+/******************************************************************************
* Machine init
******************************************************************************/
static void __init balloon3_init(void)
@@ -547,6 +744,7 @@ static void __init balloon3_init(void)
balloon3_lcd_init();
balloon3_leds_init();
balloon3_mmc_init();
+ balloon3_nand_init();
balloon3_nor_init();
balloon3_ts_init();
balloon3_udc_init();
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
index 8886c23..555c5ba 100644
--- a/arch/arm/mach-pxa/include/mach/balloon3.h
+++ b/arch/arm/mach-pxa/include/mach/balloon3.h
@@ -50,6 +50,9 @@ enum balloon3_features {
#define BALLOON3_GPIO_S0_CD (105)
+/* NAND */
+#define BALLOON3_GPIO_RUN_NAND (102)
+
/* PCF8574A Leds */
#define BALLOON3_PCF_GPIO_BASE 160
#define BALLOON3_PCF_GPIO_LED0 (BALLOON3_PCF_GPIO_BASE + 0)
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 13/13] [ARM] pxa/balloon3: Add MAX1586 PMIC support
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (10 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 12/13] [ARM] pxa/balloon3: Add NAND driver Marek Vasut
@ 2010-07-29 3:16 ` Marek Vasut
2010-07-29 10:04 ` [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Mike Rapoport
12 siblings, 0 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 3:16 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/balloon3.c | 55 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 781dab7..5069478 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -29,6 +29,7 @@
#include <linux/i2c/pcf857x.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/physmap.h>
+#include <linux/regulator/max1586.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
@@ -727,6 +728,59 @@ static inline void balloon3_nand_init(void) {}
#endif
/******************************************************************************
+ * Core power regulator
+ ******************************************************************************/
+#if defined(CONFIG_REGULATOR_MAX1586) || \
+ defined(CONFIG_REGULATOR_MAX1586_MODULE)
+static struct regulator_consumer_supply balloon3_max1587a_consumers[] = {
+ {
+ .supply = "vcc_core",
+ }
+};
+
+static struct regulator_init_data balloon3_max1587a_v3_info = {
+ .constraints = {
+ .name = "vcc_core range",
+ .min_uV = 900000,
+ .max_uV = 1705000,
+ .always_on = 1,
+ .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+ },
+ .consumer_supplies = balloon3_max1587a_consumers,
+ .num_consumer_supplies = ARRAY_SIZE(balloon3_max1587a_consumers),
+};
+
+static struct max1586_subdev_data balloon3_max1587a_subdevs[] = {
+ {
+ .name = "vcc_core",
+ .id = MAX1586_V3,
+ .platform_data = &balloon3_max1587a_v3_info,
+ }
+};
+
+static struct max1586_platform_data balloon3_max1587a_info = {
+ .subdevs = balloon3_max1587a_subdevs,
+ .num_subdevs = ARRAY_SIZE(balloon3_max1587a_subdevs),
+ .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
+};
+
+static struct i2c_board_info __initdata balloon3_pi2c_board_info[] = {
+ {
+ I2C_BOARD_INFO("max1586", 0x14),
+ .platform_data = &balloon3_max1587a_info,
+ },
+};
+
+static void __init balloon3_pmic_init(void)
+{
+ pxa27x_set_i2c_power_info(NULL);
+ i2c_register_board_info(1, ARRAY_AND_SIZE(balloon3_pi2c_board_info));
+}
+#else
+static inline void balloon3_pmic_init(void) {}
+#endif
+
+/******************************************************************************
* Machine init
******************************************************************************/
static void __init balloon3_init(void)
@@ -746,6 +800,7 @@ static void __init balloon3_init(void)
balloon3_mmc_init();
balloon3_nand_init();
balloon3_nor_init();
+ balloon3_pmic_init();
balloon3_ts_init();
balloon3_udc_init();
balloon3_uhc_init();
--
1.7.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x
2010-07-29 3:16 [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Marek Vasut
` (11 preceding siblings ...)
2010-07-29 3:16 ` [PATCH 13/13] [ARM] pxa/balloon3: Add MAX1586 PMIC support Marek Vasut
@ 2010-07-29 10:04 ` Mike Rapoport
2010-07-29 15:54 ` Marek Vasut
12 siblings, 1 reply; 40+ messages in thread
From: Mike Rapoport @ 2010-07-29 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Marek Vasut wrote:
> This contains common code for Palm LD, TX, T5, Z72, Treo680, Centro
>
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> arch/arm/mach-pxa/Kconfig | 3 +
> arch/arm/mach-pxa/Makefile | 1 +
> arch/arm/mach-pxa/include/mach/palm27x.h | 48 +++
> arch/arm/mach-pxa/palm27x.c | 475 ++++++++++++++++++++++++++++++
> 4 files changed, 527 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/mach-pxa/include/mach/palm27x.h
> create mode 100644 arch/arm/mach-pxa/palm27x.c
>
> diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
> index 21d1224..6f04f21 100644
> --- a/arch/arm/mach-pxa/Kconfig
> +++ b/arch/arm/mach-pxa/Kconfig
> @@ -347,6 +347,9 @@ config ARCH_PXA_PALM
> bool "PXA based Palm PDAs"
> select HAVE_PWM
>
> +config MACH_PALM27X
> + bool
> +
> config MACH_PALMTE2
> bool "Palm Tungsten|E2"
> default y
> diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
> index cb408ef..85c7fb3 100644
> --- a/arch/arm/mach-pxa/Makefile
> +++ b/arch/arm/mach-pxa/Makefile
> @@ -75,6 +75,7 @@ obj-$(CONFIG_PXA_EZX) += ezx.o
> obj-$(CONFIG_MACH_MP900C) += mp900.o
> obj-$(CONFIG_MACH_PALMTE2) += palmte2.o
> obj-$(CONFIG_MACH_PALMTC) += palmtc.o
> +obj-$(CONFIG_MACH_PALM27X) += palm27x.o
> obj-$(CONFIG_MACH_PALMT5) += palmt5.o
> obj-$(CONFIG_MACH_PALMTX) += palmtx.o
> obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
> diff --git a/arch/arm/mach-pxa/include/mach/palm27x.h b/arch/arm/mach-pxa/include/mach/palm27x.h
> new file mode 100644
> index 0000000..94ae6d9
> --- /dev/null
> +++ b/arch/arm/mach-pxa/include/mach/palm27x.h
Does it have to be in arch/arm/mach-pxa/include/mach/? I'd move it to
arch/arm/mach-pxa/ to reduce the header visibility
> @@ -0,0 +1,48 @@
> +/*
> + * Common functions for Palm LD, T5, TX, Z72
> + *
> + * Copyright (C) 2010
> + * Marek Vasut <marek.vasut@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +
> +struct palm27x_handheld {
> + /* SD/MMC */
> + int mmc_detect;
> + int mmc_ro;
> + int mmc_power;
> +
> + /* PM */
> + unsigned long pm_str_base;
> +
> + /* UDC */
> + int udc_detect;
> + int udc_pullup;
> +
> + /* IrDA */
> + int irda_pwdn;
> +
> + /* Battery */
> + int batt_minv;
> + int batt_maxv;
> +
> + /* Audio */
> + int jack_gpio;
> +
> + /* Backlight */
> + int bl_bl;
> + int bl_lcd;
> +
> + /* Power supply */
> + int power_ac;
> + int power_usb;
> +
> + /* LCD */
> + int lcd_power;
> +};
> +
> +extern void __init palm27x_common_init(struct palm27x_handheld *);
> diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
> new file mode 100644
> index 0000000..ff5ee8c
> --- /dev/null
> +++ b/arch/arm/mach-pxa/palm27x.c
> @@ -0,0 +1,475 @@
> +/*
> + * Common code for Palm LD, T5, TX, Z72
> + *
> + * Copyright (C) 2010
> + * Marek Vasut <marek.vasut@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +
> +#include <linux/platform_device.h>
> +#include <linux/delay.h>
> +#include <linux/irq.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/input.h>
> +#include <linux/pda_power.h>
> +#include <linux/pwm_backlight.h>
> +#include <linux/gpio.h>
> +#include <linux/wm97xx.h>
> +#include <linux/power_supply.h>
> +#include <linux/usb/gpio_vbus.h>
> +
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +
> +#include <mach/pxa27x.h>
> +#include <mach/audio.h>
> +#include <mach/mmc.h>
> +#include <mach/pxafb.h>
> +#include <mach/irda.h>
> +#include <mach/udc.h>
> +#include <mach/palmasoc.h>
> +#include <mach/palm27x.h>
> +
> +#include "generic.h"
> +#include "devices.h"
> +
> +/******************************************************************************
> + * SD/MMC card controller
> + ******************************************************************************/
> +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
> +static struct pxamci_platform_data palm27x_mci_platform_data = {
> + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
> + .detect_delay_ms = 200,
> +};
> +
> +static void __init palm27x_mmc_init(int detect, int ro, int power)
> +{
> + palm27x_mci_platform_data.gpio_card_detect = detect;
> + palm27x_mci_platform_data.gpio_card_ro = ro;
> + palm27x_mci_platform_data.gpio_power = power;
> +
> + if (machine_is_palmz72() || machine_is_centro())
> + palm27x_mci_platform_data.gpio_power_invert = 1;
> +
> + pxa_set_mci_info(&palm27x_mci_platform_data);
> +}
> +#else
> +static inline void palm27x_mmc_init(int detect, int ro, int power) {}
> +#endif
> +
> +/******************************************************************************
> + * Power management - standby
> + ******************************************************************************/
> +#if defined(CONFIG_SUSPEND)
> +static void __init palm27x_pm_init(unsigned long str_base)
> +{
> + static const unsigned long resume[] = {
> + 0xe3a00101, /* mov r0, #0x40000000 */
> + 0xe380060f, /* orr r0, r0, #0x00f00000 */
> + 0xe590f008, /* ldr pc, [r0, #0x08] */
> + };
> +
> + /*
> + * Copy the bootloader.
> + * NOTE: PalmZ72 uses a different wakeup method!
> + */
> + if (!machine_is_palmz72())
> + memcpy(phys_to_virt(str_base), resume, sizeof(resume));
> +}
> +#else
> +static inline void palm27x_pm_init(unsigned long str_base) {}
> +#endif
> +
> +/******************************************************************************
> + * Framebuffer
> + ******************************************************************************/
> +/*
> + * NOTE: PalmZ72 has so called HiRes screen -- 320x320
> + * The rest of devices has HiRes+ screen -- 320x480
> + */
> +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
> +static struct pxafb_mode_info palm27x_modes[] = {
> + {
> + .pixclock = 57692,
> + .xres = 320,
> + .yres = 480,
> + .bpp = 16,
> +
> + .left_margin = 32,
> + .right_margin = 1,
> + .upper_margin = 7,
> + .lower_margin = 1,
> +
> + .hsync_len = 4,
> + .vsync_len = 1,
> + }, {
> + .pixclock = 115384,
> + .xres = 320,
> + .yres = 320,
> + .bpp = 16,
> +
> + .left_margin = 27,
> + .right_margin = 7,
> + .upper_margin = 7,
> + .lower_margin = 8,
> +
> + .hsync_len = 6,
> + .vsync_len = 1,
> + }, {
> + .pixclock = 86538,
> + .xres = 320,
> + .yres = 320,
> + .bpp = 16,
> +
> + .left_margin = 20,
> + .right_margin = 8,
> + .upper_margin = 8,
> + .lower_margin = 5,
> +
> + .hsync_len = 4,
> + .vsync_len = 1,
> + }
> +};
I think that keeping three structures is more readable than the array, i.e
static struct pxafb_mode_info palmz72_mode = {
...
};
static struct pxafb_mode_info palmz72_mode = {
...
};
static struct pxafb_mode_info treo_centro_mode = {
...
};
static struct pxafb_mode_info palmz72x_mode = {
...
};
> +static struct pxafb_mach_info palm27x_lcd_screen = {
> + .num_modes = 1,
> + .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
> +};
> +
> +static int palm27x_lcd_power;
> +static void palm27x_lcd_ctl(int on, struct fb_var_screeninfo *info)
> +{
> + gpio_set_value(palm27x_lcd_power, on);
> +}
> +
> +static void __init palm27x_lcd_init(int power)
> +{
> + if (machine_is_palmz72())
> + palm27x_lcd_screen.modes = &palm27x_modes[1];
> + else if (machine_is_treo680() || machine_is_centro())
> + palm27x_lcd_screen.modes = &palm27x_modes[2];
> + else
> + palm27x_lcd_screen.modes = &palm27x_modes[0];
> +
> + if (gpio_is_valid(power)) {
> + if (!gpio_request(power, "LCD power")) {
> + pr_err("Palm27x: failed to claim lcd power gpio!\n");
> + return;
> + }
> + if (!gpio_direction_output(power, 1)) {
> + pr_err("Palm27x: lcd power configuration failed!\n");
> + return;
> + }
> + palm27x_lcd_power = power;
> + palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl;
> + }
> +
> + set_pxa_fb_info(&palm27x_lcd_screen);
> +}
> +
> +#else
> +static inline void palm27x_lcd_init(int power) {}
> +#endif
> +
> +/******************************************************************************
> + * USB Gadget
> + ******************************************************************************/
> +#if defined(CONFIG_USB_GADGET_PXA27X) || \
> + defined(CONFIG_USB_GADGET_PXA27X_MODULE)
> +static struct gpio_vbus_mach_info palm27x_udc_info = {
> + .gpio_vbus_inverted = 1,
> +};
> +
> +static struct platform_device palm27x_gpio_vbus = {
> + .name = "gpio-vbus",
> + .id = -1,
> + .dev = {
> + .platform_data = &palm27x_udc_info,
> + },
> +};
> +
> +static void __init palm27x_udc_init(int vbus, int pullup)
> +{
> + if (machine_is_palmld())
> + return;
> +
> + palm27x_udc_info.gpio_vbus = vbus;
> + palm27x_udc_info.gpio_pullup = pullup;
> +
> + if (machine_is_palmz72())
> + palm27x_udc_info.gpio_vbus_inverted = 0;
> +
> + if (!gpio_request(pullup, "USB Pullup")) {
> + gpio_direction_output(pullup,
> + palm27x_udc_info.gpio_vbus_inverted);
> + gpio_free(pullup);
> + } else
> + return;
> +
> + platform_device_register(&palm27x_gpio_vbus);
> +}
> +#else
> +static inline void palm27x_udc_init(int vbus, int pullup) {}
> +#endif
> +
> +/******************************************************************************
> + * IrDA
> + ******************************************************************************/
> +#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
> +static struct pxaficp_platform_data palm27x_ficp_platform_data = {
> + .transceiver_cap = IR_SIRMODE | IR_OFF,
> +};
> +
> +static void __init palm27x_irda_init(int pwdn)
> +{
> + palm27x_ficp_platform_data.gpio_pwdown = pwdn;
> + pxa_set_ficp_info(&palm27x_ficp_platform_data);
> +}
> +#else
> +static inline void palm27x_irda_init(int pwdn) {}
> +#endif
> +
> +/******************************************************************************
> + * WM97xx audio, battery
> + ******************************************************************************/
> +#if defined(CONFIG_TOUCHSCREEN_WM97XX) || \
> + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE)
> +static struct wm97xx_batt_pdata palm27x_batt_pdata = {
> + .batt_aux = WM97XX_AUX_ID3,
> + .temp_aux = WM97XX_AUX_ID2,
> + .charge_gpio = -1,
> + .batt_mult = 1000,
> + .batt_div = 414,
> + .temp_mult = 1,
> + .temp_div = 1,
> + .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
> + .batt_name = "main-batt",
> +};
> +
> +static struct wm97xx_pdata palm27x_wm97xx_pdata = {
> + .batt_pdata = &palm27x_batt_pdata,
> +};
> +
> +static pxa2xx_audio_ops_t palm27x_ac97_pdata = {
> + .codec_pdata = { &palm27x_wm97xx_pdata, },
> +};
> +
> +static struct palm27x_asoc_info palm27x_asoc_pdata = {
> + .jack_gpio = -1,
> +};
> +
> +static struct platform_device palm27x_asoc = {
> + .name = "palm27x-asoc",
> + .id = -1,
> + .dev = {
> + .platform_data = &palm27x_asoc_pdata,
> + },
> +};
> +
> +static void __init palm27x_ac97_init(int minv, int maxv, int jack)
> +{
> + if (!machine_is_palmz72())
> + palm27x_ac97_pdata.reset_gpio = 95;
> + else
> + palm27x_asoc_pdata.jack_gpio = jack;
> +
> + if (machine_is_treo680() || machine_is_centro()) {
> + palm27x_ac97_pdata.codec_pdata[0] = NULL;
> + pxa_set_ac97_info(&palm27x_ac97_pdata);
> + } else {
> + palm27x_batt_pdata.min_voltage = minv,
> + palm27x_batt_pdata.max_voltage = maxv,
> +
> + pxa_set_ac97_info(&palm27x_ac97_pdata);
> + platform_device_register(&palm27x_asoc);
> + }
> +}
> +#else
> +static inline void palm27x_ac97_init(int minv, int maxv, int jack) {}
> +#endif
> +
> +/******************************************************************************
> + * Backlight
> + ******************************************************************************/
> +#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
> +struct {
> + int bl_power;
> + int lcd_power;
> +} palm27x_bl_info;
> +
> +static int palm27x_backlight_init(struct device *dev)
> +{
> + int ret;
> +
> + ret = gpio_request(palm27x_bl_info.bl_power, "BL POWER");
> + if (ret)
> + goto err;
> + ret = gpio_direction_output(palm27x_bl_info.bl_power, 0);
> + if (ret)
> + goto err2;
> +
> + if (gpio_is_valid(palm27x_bl_info.lcd_power)) {
> + ret = gpio_request(palm27x_bl_info.lcd_power, "LCD POWER");
> + if (ret)
> + goto err2;
> + ret = gpio_direction_output(palm27x_bl_info.lcd_power, 0);
> + if (ret)
> + goto err3;
> + }
> +
> + return 0;
> +err3:
> + gpio_free(palm27x_bl_info.lcd_power);
> +err2:
> + gpio_free(palm27x_bl_info.bl_power);
> +err:
> + return ret;
> +}
> +
> +static int palm27x_backlight_notify(struct device *dev, int brightness)
> +{
> + gpio_set_value(palm27x_bl_info.bl_power, brightness);
> + if (gpio_is_valid(palm27x_bl_info.lcd_power))
> + gpio_set_value(palm27x_bl_info.lcd_power, brightness);
> + return brightness;
> +}
> +
> +static void palm27x_backlight_exit(struct device *dev)
> +{
> + gpio_free(palm27x_bl_info.bl_power);
> + if (gpio_is_valid(palm27x_bl_info.lcd_power))
> + gpio_free(palm27x_bl_info.lcd_power);
> +}
> +
> +static struct platform_pwm_backlight_data palm27x_backlight_data = {
> + .pwm_id = 0,
> + .max_brightness = 0xfe,
> + .dft_brightness = 0x7e,
> + .pwm_period_ns = 3500,
> + .init = palm27x_backlight_init,
> + .notify = palm27x_backlight_notify,
> + .exit = palm27x_backlight_exit,
> +};
> +
> +static struct platform_device palm27x_backlight = {
> + .name = "pwm-backlight",
> + .dev = {
> + .parent = &pxa27x_device_pwm0.dev,
> + .platform_data = &palm27x_backlight_data,
> + },
> +};
> +
> +static void __init palm27x_pwm_init(int bl, int lcd)
> +{
> + palm27x_bl_info.bl_power = bl;
> + palm27x_bl_info.lcd_power = lcd;
> + platform_device_register(&palm27x_backlight);
> +}
> +#else
> +static inline void palm27x_pwm_init(int bl, int lcd) {}
> +#endif
> +
> +/******************************************************************************
> + * Power supply
> + ******************************************************************************/
> +#if defined(CONFIG_PDA_POWER) || defined(CONFIG_PDA_POWER_MODULE)
> +struct {
> + int ac_state;
> + int usb_state;
> +} palm27x_power_info;
> +
> +static int palm27x_power_supply_init(struct device *dev)
> +{
> + int ret;
> +
> + ret = gpio_request(palm27x_power_info.ac_state, "AC state");
> + if (ret)
> + goto err1;
> + ret = gpio_direction_input(palm27x_power_info.ac_state);
> + if (ret)
> + goto err2;
> +
> + if (gpio_is_valid(palm27x_power_info.usb_state)) {
> + ret = gpio_request(palm27x_power_info.usb_state, "USB state");
> + if (ret)
> + goto err2;
> + ret = gpio_direction_input(palm27x_power_info.usb_state);
> + if (ret)
> + goto err3;
> + }
> +
> + return 0;
> +err3:
> + gpio_free(palm27x_power_info.usb_state);
> +err2:
> + gpio_free(palm27x_power_info.ac_state);
> +err1:
> + return ret;
> +}
> +
> +static void palm27x_power_supply_exit(struct device *dev)
> +{
> + gpio_free(palm27x_power_info.usb_state);
> + gpio_free(palm27x_power_info.ac_state);
> +}
> +
> +static int palm27x_is_ac_online(void)
> +{
> + return gpio_get_value(palm27x_power_info.ac_state);
> +}
> +
> +static int palm27x_is_usb_online(void)
> +{
> + return !gpio_get_value(palm27x_power_info.usb_state);
> +}
> +static char *palm27x_supplicants[] = {
> + "main-battery",
> +};
> +
> +static struct pda_power_pdata palm27x_ps_info = {
> + .init = palm27x_power_supply_init,
> + .exit = palm27x_power_supply_exit,
> + .is_ac_online = palm27x_is_ac_online,
> + .is_usb_online = palm27x_is_usb_online,
> + .supplied_to = palm27x_supplicants,
> + .num_supplicants = ARRAY_SIZE(palm27x_supplicants),
> +};
> +
> +static struct platform_device palm27x_power_supply = {
> + .name = "pda-power",
> + .id = -1,
> + .dev = {
> + .platform_data = &palm27x_ps_info,
> + },
> +};
> +
> +static void __init palm27x_power_init(int ac, int usb)
> +{
> + palm27x_power_info.ac_state = ac;
> + palm27x_power_info.usb_state = usb;
> + platform_device_register(&palm27x_power_supply);
> +}
> +#else
> +static inline void palm27x_power_init(int ac, int usb) {}
> +#endif
> +
> +void __init palm27x_common_init(struct palm27x_handheld *palm)
> +{
> + pxa_set_ffuart_info(NULL);
> + pxa_set_btuart_info(NULL);
> + pxa_set_stuart_info(NULL);
> +
> + palm27x_mmc_init(palm->mmc_detect, palm->mmc_ro, palm->mmc_power);
> + palm27x_pm_init(palm->pm_str_base);
> + palm27x_lcd_init(palm->lcd_power);
> + palm27x_udc_init(palm->udc_detect, palm->udc_pullup);
> + palm27x_irda_init(palm->irda_pwdn);
> + palm27x_ac97_init(palm->batt_minv, palm->batt_maxv, palm->jack_gpio);
> + palm27x_pwm_init(palm->bl_bl, palm->bl_lcd);
> + palm27x_power_init(palm->power_ac, palm->power_usb);
> +}
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x
2010-07-29 10:04 ` [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x Mike Rapoport
@ 2010-07-29 15:54 ` Marek Vasut
2010-07-29 16:16 ` Mike Rapoport
2010-08-04 3:07 ` Eric Miao
0 siblings, 2 replies; 40+ messages in thread
From: Marek Vasut @ 2010-07-29 15:54 UTC (permalink / raw)
To: linux-arm-kernel
Dne ?t 29. ?ervence 2010 12:04:55 Mike Rapoport napsal(a):
> Marek Vasut wrote:
> > This contains common code for Palm LD, TX, T5, Z72, Treo680, Centro
> >
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > ---
> >
> > arch/arm/mach-pxa/Kconfig | 3 +
> > arch/arm/mach-pxa/Makefile | 1 +
> > arch/arm/mach-pxa/include/mach/palm27x.h | 48 +++
> > arch/arm/mach-pxa/palm27x.c | 475
> > ++++++++++++++++++++++++++++++ 4 files changed, 527 insertions(+), 0
> > deletions(-)
> > create mode 100644 arch/arm/mach-pxa/include/mach/palm27x.h
> > create mode 100644 arch/arm/mach-pxa/palm27x.c
> >
> > diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
> > index 21d1224..6f04f21 100644
> > --- a/arch/arm/mach-pxa/Kconfig
> > +++ b/arch/arm/mach-pxa/Kconfig
> > @@ -347,6 +347,9 @@ config ARCH_PXA_PALM
> >
> > bool "PXA based Palm PDAs"
> > select HAVE_PWM
> >
> > +config MACH_PALM27X
> > + bool
> > +
> >
> > config MACH_PALMTE2
> >
> > bool "Palm Tungsten|E2"
> > default y
> >
> > diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
> > index cb408ef..85c7fb3 100644
> > --- a/arch/arm/mach-pxa/Makefile
> > +++ b/arch/arm/mach-pxa/Makefile
> > @@ -75,6 +75,7 @@ obj-$(CONFIG_PXA_EZX) += ezx.o
> >
> > obj-$(CONFIG_MACH_MP900C) += mp900.o
> > obj-$(CONFIG_MACH_PALMTE2) += palmte2.o
> > obj-$(CONFIG_MACH_PALMTC) += palmtc.o
> >
> > +obj-$(CONFIG_MACH_PALM27X) += palm27x.o
> >
> > obj-$(CONFIG_MACH_PALMT5) += palmt5.o
> > obj-$(CONFIG_MACH_PALMTX) += palmtx.o
> > obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
> >
> > diff --git a/arch/arm/mach-pxa/include/mach/palm27x.h
> > b/arch/arm/mach-pxa/include/mach/palm27x.h new file mode 100644
> > index 0000000..94ae6d9
> > --- /dev/null
> > +++ b/arch/arm/mach-pxa/include/mach/palm27x.h
>
> Does it have to be in arch/arm/mach-pxa/include/mach/? I'd move it to
> arch/arm/mach-pxa/ to reduce the header visibility
>
> > @@ -0,0 +1,48 @@
> > +/*
> > + * Common functions for Palm LD, T5, TX, Z72
> > + *
> > + * Copyright (C) 2010
> > + * Marek Vasut <marek.vasut@gmail.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + *
> > + */
> > +
> > +struct palm27x_handheld {
> > + /* SD/MMC */
> > + int mmc_detect;
> > + int mmc_ro;
> > + int mmc_power;
> > +
> > + /* PM */
> > + unsigned long pm_str_base;
> > +
> > + /* UDC */
> > + int udc_detect;
> > + int udc_pullup;
> > +
> > + /* IrDA */
> > + int irda_pwdn;
> > +
> > + /* Battery */
> > + int batt_minv;
> > + int batt_maxv;
> > +
> > + /* Audio */
> > + int jack_gpio;
> > +
> > + /* Backlight */
> > + int bl_bl;
> > + int bl_lcd;
> > +
> > + /* Power supply */
> > + int power_ac;
> > + int power_usb;
> > +
> > + /* LCD */
> > + int lcd_power;
> > +};
> > +
> > +extern void __init palm27x_common_init(struct palm27x_handheld *);
> > diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
> > new file mode 100644
> > index 0000000..ff5ee8c
> > --- /dev/null
> > +++ b/arch/arm/mach-pxa/palm27x.c
> > @@ -0,0 +1,475 @@
> > +/*
> > + * Common code for Palm LD, T5, TX, Z72
> > + *
> > + * Copyright (C) 2010
> > + * Marek Vasut <marek.vasut@gmail.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + *
> > + */
> > +
> > +#include <linux/platform_device.h>
> > +#include <linux/delay.h>
> > +#include <linux/irq.h>
> > +#include <linux/gpio_keys.h>
> > +#include <linux/input.h>
> > +#include <linux/pda_power.h>
> > +#include <linux/pwm_backlight.h>
> > +#include <linux/gpio.h>
> > +#include <linux/wm97xx.h>
> > +#include <linux/power_supply.h>
> > +#include <linux/usb/gpio_vbus.h>
> > +
> > +#include <asm/mach-types.h>
> > +#include <asm/mach/arch.h>
> > +#include <asm/mach/map.h>
> > +
> > +#include <mach/pxa27x.h>
> > +#include <mach/audio.h>
> > +#include <mach/mmc.h>
> > +#include <mach/pxafb.h>
> > +#include <mach/irda.h>
> > +#include <mach/udc.h>
> > +#include <mach/palmasoc.h>
> > +#include <mach/palm27x.h>
> > +
> > +#include "generic.h"
> > +#include "devices.h"
> > +
> > +/***********************************************************************
> > ******* + * SD/MMC card controller
> > +
> > ************************************************************************
> > ******/ +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
> > +static struct pxamci_platform_data palm27x_mci_platform_data = {
> > + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
> > + .detect_delay_ms = 200,
> > +};
> > +
> > +static void __init palm27x_mmc_init(int detect, int ro, int power)
> > +{
> > + palm27x_mci_platform_data.gpio_card_detect = detect;
> > + palm27x_mci_platform_data.gpio_card_ro = ro;
> > + palm27x_mci_platform_data.gpio_power = power;
> > +
> > + if (machine_is_palmz72() || machine_is_centro())
> > + palm27x_mci_platform_data.gpio_power_invert = 1;
> > +
> > + pxa_set_mci_info(&palm27x_mci_platform_data);
> > +}
> > +#else
> > +static inline void palm27x_mmc_init(int detect, int ro, int power) {}
> > +#endif
> > +
> > +/***********************************************************************
> > ******* + * Power management - standby
> > +
> > ************************************************************************
> > ******/ +#if defined(CONFIG_SUSPEND)
> > +static void __init palm27x_pm_init(unsigned long str_base)
> > +{
> > + static const unsigned long resume[] = {
> > + 0xe3a00101, /* mov r0, #0x40000000 */
> > + 0xe380060f, /* orr r0, r0, #0x00f00000 */
> > + 0xe590f008, /* ldr pc, [r0, #0x08] */
> > + };
> > +
> > + /*
> > + * Copy the bootloader.
> > + * NOTE: PalmZ72 uses a different wakeup method!
> > + */
> > + if (!machine_is_palmz72())
> > + memcpy(phys_to_virt(str_base), resume, sizeof(resume));
> > +}
> > +#else
> > +static inline void palm27x_pm_init(unsigned long str_base) {}
> > +#endif
> > +
> > +/***********************************************************************
> > ******* + * Framebuffer
> > +
> > ************************************************************************
> > ******/ +/*
> > + * NOTE: PalmZ72 has so called HiRes screen -- 320x320
> > + * The rest of devices has HiRes+ screen -- 320x480
> > + */
> > +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
> > +static struct pxafb_mode_info palm27x_modes[] = {
> > + {
> > + .pixclock = 57692,
> > + .xres = 320,
> > + .yres = 480,
> > + .bpp = 16,
> > +
> > + .left_margin = 32,
> > + .right_margin = 1,
> > + .upper_margin = 7,
> > + .lower_margin = 1,
> > +
> > + .hsync_len = 4,
> > + .vsync_len = 1,
> > + }, {
> > + .pixclock = 115384,
> > + .xres = 320,
> > + .yres = 320,
> > + .bpp = 16,
> > +
> > + .left_margin = 27,
> > + .right_margin = 7,
> > + .upper_margin = 7,
> > + .lower_margin = 8,
> > +
> > + .hsync_len = 6,
> > + .vsync_len = 1,
> > + }, {
> > + .pixclock = 86538,
> > + .xres = 320,
> > + .yres = 320,
> > + .bpp = 16,
> > +
> > + .left_margin = 20,
> > + .right_margin = 8,
> > + .upper_margin = 8,
> > + .lower_margin = 5,
> > +
> > + .hsync_len = 4,
> > + .vsync_len = 1,
> > + }
> > +};
>
> I think that keeping three structures is more readable than the array, i.e
> static struct pxafb_mode_info palmz72_mode = {
> ...
> };
>
> static struct pxafb_mode_info palmz72_mode = {
> ...
> };
>
> static struct pxafb_mode_info treo_centro_mode = {
> ...
> };
>
> static struct pxafb_mode_info palmz72x_mode = {
> ...
> };
>
> > +static struct pxafb_mach_info palm27x_lcd_screen = {
> > + .num_modes = 1,
> > + .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
> > +};
> > +
> > +static int palm27x_lcd_power;
> > +static void palm27x_lcd_ctl(int on, struct fb_var_screeninfo *info)
> > +{
> > + gpio_set_value(palm27x_lcd_power, on);
> > +}
> > +
> > +static void __init palm27x_lcd_init(int power)
> > +{
> > + if (machine_is_palmz72())
> > + palm27x_lcd_screen.modes = &palm27x_modes[1];
> > + else if (machine_is_treo680() || machine_is_centro())
> > + palm27x_lcd_screen.modes = &palm27x_modes[2];
> > + else
> > + palm27x_lcd_screen.modes = &palm27x_modes[0];
> > +
> > + if (gpio_is_valid(power)) {
> > + if (!gpio_request(power, "LCD power")) {
> > + pr_err("Palm27x: failed to claim lcd power gpio!\n");
> > + return;
> > + }
> > + if (!gpio_direction_output(power, 1)) {
> > + pr_err("Palm27x: lcd power configuration failed!\n");
> > + return;
> > + }
> > + palm27x_lcd_power = power;
> > + palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl;
> > + }
> > +
> > + set_pxa_fb_info(&palm27x_lcd_screen);
> > +}
> > +
> > +#else
> > +static inline void palm27x_lcd_init(int power) {}
> > +#endif
> > +
> > +/***********************************************************************
> > ******* + * USB Gadget
> > +
> > ************************************************************************
> > ******/ +#if defined(CONFIG_USB_GADGET_PXA27X) || \
> > + defined(CONFIG_USB_GADGET_PXA27X_MODULE)
> > +static struct gpio_vbus_mach_info palm27x_udc_info = {
> > + .gpio_vbus_inverted = 1,
> > +};
> > +
> > +static struct platform_device palm27x_gpio_vbus = {
> > + .name = "gpio-vbus",
> > + .id = -1,
> > + .dev = {
> > + .platform_data = &palm27x_udc_info,
> > + },
> > +};
> > +
> > +static void __init palm27x_udc_init(int vbus, int pullup)
> > +{
> > + if (machine_is_palmld())
> > + return;
> > +
> > + palm27x_udc_info.gpio_vbus = vbus;
> > + palm27x_udc_info.gpio_pullup = pullup;
> > +
> > + if (machine_is_palmz72())
> > + palm27x_udc_info.gpio_vbus_inverted = 0;
> > +
> > + if (!gpio_request(pullup, "USB Pullup")) {
> > + gpio_direction_output(pullup,
> > + palm27x_udc_info.gpio_vbus_inverted);
> > + gpio_free(pullup);
> > + } else
> > + return;
> > +
> > + platform_device_register(&palm27x_gpio_vbus);
> > +}
> > +#else
> > +static inline void palm27x_udc_init(int vbus, int pullup) {}
> > +#endif
> > +
> > +/***********************************************************************
> > ******* + * IrDA
> > +
> > ************************************************************************
> > ******/ +#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
> > +static struct pxaficp_platform_data palm27x_ficp_platform_data = {
> > + .transceiver_cap = IR_SIRMODE | IR_OFF,
> > +};
> > +
> > +static void __init palm27x_irda_init(int pwdn)
> > +{
> > + palm27x_ficp_platform_data.gpio_pwdown = pwdn;
> > + pxa_set_ficp_info(&palm27x_ficp_platform_data);
> > +}
> > +#else
> > +static inline void palm27x_irda_init(int pwdn) {}
> > +#endif
> > +
> > +/***********************************************************************
> > ******* + * WM97xx audio, battery
> > +
> > ************************************************************************
> > ******/ +#if defined(CONFIG_TOUCHSCREEN_WM97XX) || \
> > + defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE)
> > +static struct wm97xx_batt_pdata palm27x_batt_pdata = {
> > + .batt_aux = WM97XX_AUX_ID3,
> > + .temp_aux = WM97XX_AUX_ID2,
> > + .charge_gpio = -1,
> > + .batt_mult = 1000,
> > + .batt_div = 414,
> > + .temp_mult = 1,
> > + .temp_div = 1,
> > + .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
> > + .batt_name = "main-batt",
> > +};
> > +
> > +static struct wm97xx_pdata palm27x_wm97xx_pdata = {
> > + .batt_pdata = &palm27x_batt_pdata,
> > +};
> > +
> > +static pxa2xx_audio_ops_t palm27x_ac97_pdata = {
> > + .codec_pdata = { &palm27x_wm97xx_pdata, },
> > +};
> > +
> > +static struct palm27x_asoc_info palm27x_asoc_pdata = {
> > + .jack_gpio = -1,
> > +};
> > +
> > +static struct platform_device palm27x_asoc = {
> > + .name = "palm27x-asoc",
> > + .id = -1,
> > + .dev = {
> > + .platform_data = &palm27x_asoc_pdata,
> > + },
> > +};
> > +
> > +static void __init palm27x_ac97_init(int minv, int maxv, int jack)
> > +{
> > + if (!machine_is_palmz72())
> > + palm27x_ac97_pdata.reset_gpio = 95;
> > + else
> > + palm27x_asoc_pdata.jack_gpio = jack;
> > +
> > + if (machine_is_treo680() || machine_is_centro()) {
> > + palm27x_ac97_pdata.codec_pdata[0] = NULL;
> > + pxa_set_ac97_info(&palm27x_ac97_pdata);
> > + } else {
> > + palm27x_batt_pdata.min_voltage = minv,
> > + palm27x_batt_pdata.max_voltage = maxv,
> > +
> > + pxa_set_ac97_info(&palm27x_ac97_pdata);
> > + platform_device_register(&palm27x_asoc);
> > + }
> > +}
> > +#else
> > +static inline void palm27x_ac97_init(int minv, int maxv, int jack) {}
> > +#endif
> > +
> > +/***********************************************************************
> > ******* + * Backlight
> > +
> > ************************************************************************
> > ******/ +#if defined(CONFIG_BACKLIGHT_PWM) ||
> > defined(CONFIG_BACKLIGHT_PWM_MODULE) +struct {
> > + int bl_power;
> > + int lcd_power;
> > +} palm27x_bl_info;
> > +
> > +static int palm27x_backlight_init(struct device *dev)
> > +{
> > + int ret;
> > +
> > + ret = gpio_request(palm27x_bl_info.bl_power, "BL POWER");
> > + if (ret)
> > + goto err;
> > + ret = gpio_direction_output(palm27x_bl_info.bl_power, 0);
> > + if (ret)
> > + goto err2;
> > +
> > + if (gpio_is_valid(palm27x_bl_info.lcd_power)) {
> > + ret = gpio_request(palm27x_bl_info.lcd_power, "LCD POWER");
> > + if (ret)
> > + goto err2;
> > + ret = gpio_direction_output(palm27x_bl_info.lcd_power, 0);
> > + if (ret)
> > + goto err3;
> > + }
> > +
> > + return 0;
> > +err3:
> > + gpio_free(palm27x_bl_info.lcd_power);
> > +err2:
> > + gpio_free(palm27x_bl_info.bl_power);
> > +err:
> > + return ret;
> > +}
> > +
> > +static int palm27x_backlight_notify(struct device *dev, int brightness)
> > +{
> > + gpio_set_value(palm27x_bl_info.bl_power, brightness);
> > + if (gpio_is_valid(palm27x_bl_info.lcd_power))
> > + gpio_set_value(palm27x_bl_info.lcd_power, brightness);
> > + return brightness;
> > +}
> > +
> > +static void palm27x_backlight_exit(struct device *dev)
> > +{
> > + gpio_free(palm27x_bl_info.bl_power);
> > + if (gpio_is_valid(palm27x_bl_info.lcd_power))
> > + gpio_free(palm27x_bl_info.lcd_power);
> > +}
> > +
> > +static struct platform_pwm_backlight_data palm27x_backlight_data = {
> > + .pwm_id = 0,
> > + .max_brightness = 0xfe,
> > + .dft_brightness = 0x7e,
> > + .pwm_period_ns = 3500,
> > + .init = palm27x_backlight_init,
> > + .notify = palm27x_backlight_notify,
> > + .exit = palm27x_backlight_exit,
> > +};
> > +
> > +static struct platform_device palm27x_backlight = {
> > + .name = "pwm-backlight",
> > + .dev = {
> > + .parent = &pxa27x_device_pwm0.dev,
> > + .platform_data = &palm27x_backlight_data,
> > + },
> > +};
> > +
> > +static void __init palm27x_pwm_init(int bl, int lcd)
> > +{
> > + palm27x_bl_info.bl_power = bl;
> > + palm27x_bl_info.lcd_power = lcd;
> > + platform_device_register(&palm27x_backlight);
> > +}
> > +#else
> > +static inline void palm27x_pwm_init(int bl, int lcd) {}
> > +#endif
> > +
> > +/***********************************************************************
> > ******* + * Power supply
> > +
> > ************************************************************************
> > ******/ +#if defined(CONFIG_PDA_POWER) ||
> > defined(CONFIG_PDA_POWER_MODULE) +struct {
> > + int ac_state;
> > + int usb_state;
> > +} palm27x_power_info;
> > +
> > +static int palm27x_power_supply_init(struct device *dev)
> > +{
> > + int ret;
> > +
> > + ret = gpio_request(palm27x_power_info.ac_state, "AC state");
> > + if (ret)
> > + goto err1;
> > + ret = gpio_direction_input(palm27x_power_info.ac_state);
> > + if (ret)
> > + goto err2;
> > +
> > + if (gpio_is_valid(palm27x_power_info.usb_state)) {
> > + ret = gpio_request(palm27x_power_info.usb_state, "USB state");
> > + if (ret)
> > + goto err2;
> > + ret = gpio_direction_input(palm27x_power_info.usb_state);
> > + if (ret)
> > + goto err3;
> > + }
> > +
> > + return 0;
> > +err3:
> > + gpio_free(palm27x_power_info.usb_state);
> > +err2:
> > + gpio_free(palm27x_power_info.ac_state);
> > +err1:
> > + return ret;
> > +}
> > +
> > +static void palm27x_power_supply_exit(struct device *dev)
> > +{
> > + gpio_free(palm27x_power_info.usb_state);
> > + gpio_free(palm27x_power_info.ac_state);
> > +}
> > +
> > +static int palm27x_is_ac_online(void)
> > +{
> > + return gpio_get_value(palm27x_power_info.ac_state);
> > +}
> > +
> > +static int palm27x_is_usb_online(void)
> > +{
> > + return !gpio_get_value(palm27x_power_info.usb_state);
> > +}
> > +static char *palm27x_supplicants[] = {
> > + "main-battery",
> > +};
> > +
> > +static struct pda_power_pdata palm27x_ps_info = {
> > + .init = palm27x_power_supply_init,
> > + .exit = palm27x_power_supply_exit,
> > + .is_ac_online = palm27x_is_ac_online,
> > + .is_usb_online = palm27x_is_usb_online,
> > + .supplied_to = palm27x_supplicants,
> > + .num_supplicants = ARRAY_SIZE(palm27x_supplicants),
> > +};
> > +
> > +static struct platform_device palm27x_power_supply = {
> > + .name = "pda-power",
> > + .id = -1,
> > + .dev = {
> > + .platform_data = &palm27x_ps_info,
> > + },
> > +};
> > +
> > +static void __init palm27x_power_init(int ac, int usb)
> > +{
> > + palm27x_power_info.ac_state = ac;
> > + palm27x_power_info.usb_state = usb;
> > + platform_device_register(&palm27x_power_supply);
> > +}
> > +#else
> > +static inline void palm27x_power_init(int ac, int usb) {}
> > +#endif
> > +
> > +void __init palm27x_common_init(struct palm27x_handheld *palm)
> > +{
> > + pxa_set_ffuart_info(NULL);
> > + pxa_set_btuart_info(NULL);
> > + pxa_set_stuart_info(NULL);
> > +
> > + palm27x_mmc_init(palm->mmc_detect, palm->mmc_ro, palm->mmc_power);
> > + palm27x_pm_init(palm->pm_str_base);
> > + palm27x_lcd_init(palm->lcd_power);
> > + palm27x_udc_init(palm->udc_detect, palm->udc_pullup);
> > + palm27x_irda_init(palm->irda_pwdn);
> > + palm27x_ac97_init(palm->batt_minv, palm->batt_maxv, palm->jack_gpio);
> > + palm27x_pwm_init(palm->bl_bl, palm->bl_lcd);
> > + palm27x_power_init(palm->power_ac, palm->power_usb);
> > +}
Hey Mike,
I'll push the changes you suggested in a separate patch to avoid breaking the
already existing code (I can't currently test this on all affected platforms,
but I should be able to do it once I get another palmld). Especially I'll have
to analyze the PMIC change.
Thanks for the review !
Cheers
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x
2010-07-29 15:54 ` Marek Vasut
@ 2010-07-29 16:16 ` Mike Rapoport
2010-08-04 3:07 ` Eric Miao
1 sibling, 0 replies; 40+ messages in thread
From: Mike Rapoport @ 2010-07-29 16:16 UTC (permalink / raw)
To: linux-arm-kernel
Marek Vasut wrote:
> Dne ?t 29. ?ervence 2010 12:04:55 Mike Rapoport napsal(a):
>> Marek Vasut wrote:
>>> This contains common code for Palm LD, TX, T5, Z72, Treo680, Centro
>>>
>>> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
>>> ---
>>>
[ snip ]
> Hey Mike,
>
> I'll push the changes you suggested in a separate patch to avoid breaking the
> already existing code (I can't currently test this on all affected platforms,
> but I should be able to do it once I get another palmld). Especially I'll have
> to analyze the PMIC change.
Using PIO mode on power I2C interface allows communications with PMIC late in
suspend and early during resume. If it's not required for Palms, just skip the
comment.
> Thanks for the review !
> Cheers
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 01/13] [ARM] pxa/palm: Introduce Palm27x
2010-07-29 15:54 ` Marek Vasut
2010-07-29 16:16 ` Mike Rapoport
@ 2010-08-04 3:07 ` Eric Miao
1 sibling, 0 replies; 40+ messages in thread
From: Eric Miao @ 2010-08-04 3:07 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jul 29, 2010 at 11:54 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Dne ?t 29. ?ervence 2010 12:04:55 Mike Rapoport napsal(a):
>> Marek Vasut wrote:
>> > This contains common code for Palm LD, TX, T5, Z72, Treo680, Centro
>> >
>> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
>> > ---
>> >
>> > ?arch/arm/mach-pxa/Kconfig ? ? ? ? ? ? ? ?| ? ?3 +
>> > ?arch/arm/mach-pxa/Makefile ? ? ? ? ? ? ? | ? ?1 +
>> > ?arch/arm/mach-pxa/include/mach/palm27x.h | ? 48 +++
>> > ?arch/arm/mach-pxa/palm27x.c ? ? ? ? ? ? ?| ?475
>> > ?++++++++++++++++++++++++++++++ 4 files changed, 527 insertions(+), 0
>> > ?deletions(-)
>> > ?create mode 100644 arch/arm/mach-pxa/include/mach/palm27x.h
>> > ?create mode 100644 arch/arm/mach-pxa/palm27x.c
>> >
>> > diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
>> > index 21d1224..6f04f21 100644
>> > --- a/arch/arm/mach-pxa/Kconfig
>> > +++ b/arch/arm/mach-pxa/Kconfig
>> > @@ -347,6 +347,9 @@ config ARCH_PXA_PALM
>> >
>> > ? ? bool "PXA based Palm PDAs"
>> > ? ? select HAVE_PWM
>> >
>> > +config MACH_PALM27X
>> > + ? bool
>> > +
>> >
>> > ?config MACH_PALMTE2
>> >
>> > ? ? bool "Palm Tungsten|E2"
>> > ? ? default y
>> >
>> > diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
>> > index cb408ef..85c7fb3 100644
>> > --- a/arch/arm/mach-pxa/Makefile
>> > +++ b/arch/arm/mach-pxa/Makefile
>> > @@ -75,6 +75,7 @@ obj-$(CONFIG_PXA_EZX) ? ? ? ? ? += ezx.o
>> >
>> > ?obj-$(CONFIG_MACH_MP900C) ?+= mp900.o
>> > ?obj-$(CONFIG_MACH_PALMTE2) += palmte2.o
>> > ?obj-$(CONFIG_MACH_PALMTC) ?+= palmtc.o
>> >
>> > +obj-$(CONFIG_MACH_PALM27X) += palm27x.o
>> >
>> > ?obj-$(CONFIG_MACH_PALMT5) ?+= palmt5.o
>> > ?obj-$(CONFIG_MACH_PALMTX) ?+= palmtx.o
>> > ?obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
>> >
>> > diff --git a/arch/arm/mach-pxa/include/mach/palm27x.h
>> > b/arch/arm/mach-pxa/include/mach/palm27x.h new file mode 100644
>> > index 0000000..94ae6d9
>> > --- /dev/null
>> > +++ b/arch/arm/mach-pxa/include/mach/palm27x.h
>>
>> Does it have to be in arch/arm/mach-pxa/include/mach/? I'd move it to
>> arch/arm/mach-pxa/ to reduce the header visibility
>>
>> > @@ -0,0 +1,48 @@
>> > +/*
>> > + * Common functions for Palm LD, T5, TX, Z72
>> > + *
>> > + * Copyright (C) 2010
>> > + * Marek Vasut <marek.vasut@gmail.com>
>> > + *
>> > + * This program is free software; you can redistribute it and/or modify
>> > + * it under the terms of the GNU General Public License version 2 as
>> > + * published by the Free Software Foundation.
>> > + *
>> > + */
>> > +
>> > +struct palm27x_handheld {
>> > + ? /* SD/MMC */
>> > + ? int ? ? ? ? ? ? mmc_detect;
>> > + ? int ? ? ? ? ? ? mmc_ro;
>> > + ? int ? ? ? ? ? ? mmc_power;
>> > +
>> > + ? /* PM */
>> > + ? unsigned long ? pm_str_base;
>> > +
>> > + ? /* UDC */
>> > + ? int ? ? ? ? ? ? udc_detect;
>> > + ? int ? ? ? ? ? ? udc_pullup;
>> > +
>> > + ? /* IrDA */
>> > + ? int ? ? ? ? ? ? irda_pwdn;
>> > +
>> > + ? /* Battery */
>> > + ? int ? ? ? ? ? ? batt_minv;
>> > + ? int ? ? ? ? ? ? batt_maxv;
>> > +
>> > + ? /* Audio */
>> > + ? int ? ? ? ? ? ? jack_gpio;
>> > +
>> > + ? /* Backlight */
>> > + ? int ? ? ? ? ? ? bl_bl;
>> > + ? int ? ? ? ? ? ? bl_lcd;
>> > +
>> > + ? /* Power supply */
>> > + ? int ? ? ? ? ? ? power_ac;
>> > + ? int ? ? ? ? ? ? power_usb;
>> > +
>> > + ? /* LCD */
>> > + ? int ? ? ? ? ? ? lcd_power;
>> > +};
>> > +
>> > +extern void __init palm27x_common_init(struct palm27x_handheld *);
>> > diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
>> > new file mode 100644
>> > index 0000000..ff5ee8c
>> > --- /dev/null
>> > +++ b/arch/arm/mach-pxa/palm27x.c
>> > @@ -0,0 +1,475 @@
>> > +/*
>> > + * Common code for Palm LD, T5, TX, Z72
>> > + *
>> > + * Copyright (C) 2010
>> > + * Marek Vasut <marek.vasut@gmail.com>
>> > + *
>> > + * This program is free software; you can redistribute it and/or modify
>> > + * it under the terms of the GNU General Public License version 2 as
>> > + * published by the Free Software Foundation.
>> > + *
>> > + */
>> > +
>> > +#include <linux/platform_device.h>
>> > +#include <linux/delay.h>
>> > +#include <linux/irq.h>
>> > +#include <linux/gpio_keys.h>
>> > +#include <linux/input.h>
>> > +#include <linux/pda_power.h>
>> > +#include <linux/pwm_backlight.h>
>> > +#include <linux/gpio.h>
>> > +#include <linux/wm97xx.h>
>> > +#include <linux/power_supply.h>
>> > +#include <linux/usb/gpio_vbus.h>
>> > +
>> > +#include <asm/mach-types.h>
>> > +#include <asm/mach/arch.h>
>> > +#include <asm/mach/map.h>
>> > +
>> > +#include <mach/pxa27x.h>
>> > +#include <mach/audio.h>
>> > +#include <mach/mmc.h>
>> > +#include <mach/pxafb.h>
>> > +#include <mach/irda.h>
>> > +#include <mach/udc.h>
>> > +#include <mach/palmasoc.h>
>> > +#include <mach/palm27x.h>
>> > +
>> > +#include "generic.h"
>> > +#include "devices.h"
>> > +
>> > +/***********************************************************************
>> > ******* + * SD/MMC card controller
>> > +
>> > ************************************************************************
>> > ******/ +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
>> > +static struct pxamci_platform_data palm27x_mci_platform_data = {
0 is a valid number for GPIO, so you may want to initialize this as:
.gpio_card_detect = -1,
.gpio_card_ro = -1,
.gpio_power = -1,
>> > + ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
>> > + ? .detect_delay_ms ? ? ? ?= 200,
>> > +};
>> > +
>> > +static void __init palm27x_mmc_init(int detect, int ro, int power)
>> > +{
>> > + ? palm27x_mci_platform_data.gpio_card_detect ? ? ?= detect;
>> > + ? palm27x_mci_platform_data.gpio_card_ro ? ? ? ? ?= ro;
>> > + ? palm27x_mci_platform_data.gpio_power ? ? ? ? ? ?= power;
>> > +
>> > + ? if (machine_is_palmz72() || machine_is_centro())
>> > + ? ? ? ? ? palm27x_mci_platform_data.gpio_power_invert = 1;
Moving 'gpio_power_invert' to the parameter list of the function could help
saving this if (machine_is_*()...), so when adding a new palm27x board or
fixing an error, you don't have to list the machine types here.
>> > +
>> > + ? pxa_set_mci_info(&palm27x_mci_platform_data);
>> > +}
>> > +#else
>> > +static inline void palm27x_mmc_init(int detect, int ro, int power) {}
>> > +#endif
>> > +
>> > +/***********************************************************************
>> > ******* + * Power management - standby
>> > +
>> > ************************************************************************
>> > ******/ +#if defined(CONFIG_SUSPEND)
>> > +static void __init palm27x_pm_init(unsigned long str_base)
>> > +{
>> > + ? static const unsigned long resume[] = {
>> > + ? ? ? ? ? 0xe3a00101, ? ? /* mov ?r0, ? ? #0x40000000 */
>> > + ? ? ? ? ? 0xe380060f, ? ? /* orr ?r0, r0, #0x00f00000 */
>> > + ? ? ? ? ? 0xe590f008, ? ? /* ldr ?pc, [r0, #0x08] */
>> > + ? };
>> > +
>> > + ? /*
>> > + ? ?* Copy the bootloader.
>> > + ? ?* NOTE: PalmZ72 uses a different wakeup method!
>> > + ? ?*/
>> > + ? if (!machine_is_palmz72())
>> > + ? ? ? ? ? memcpy(phys_to_virt(str_base), resume, sizeof(resume));
>> > +}
>> > +#else
>> > +static inline void palm27x_pm_init(unsigned long str_base) {}
>> > +#endif
>> > +
>> > +/***********************************************************************
>> > ******* + * Framebuffer
>> > +
>> > ************************************************************************
>> > ******/ +/*
>> > + * NOTE: PalmZ72 has so called HiRes screen -- 320x320
>> > + * ? ? ? The rest of devices has HiRes+ screen -- 320x480
>> > + */
>> > +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
>> > +static struct pxafb_mode_info palm27x_modes[] = {
>> > + ? {
>> > + ? ? ? ? ? .pixclock ? ? ? = 57692,
>> > + ? ? ? ? ? .xres ? ? ? ? ? = 320,
>> > + ? ? ? ? ? .yres ? ? ? ? ? = 480,
>> > + ? ? ? ? ? .bpp ? ? ? ? ? ?= 16,
>> > +
>> > + ? ? ? ? ? .left_margin ? ?= 32,
>> > + ? ? ? ? ? .right_margin ? = 1,
>> > + ? ? ? ? ? .upper_margin ? = 7,
>> > + ? ? ? ? ? .lower_margin ? = 1,
>> > +
>> > + ? ? ? ? ? .hsync_len ? ? ?= 4,
>> > + ? ? ? ? ? .vsync_len ? ? ?= 1,
>> > + ? }, {
>> > + ? ? ? ? ? .pixclock ? ? ? = 115384,
>> > + ? ? ? ? ? .xres ? ? ? ? ? = 320,
>> > + ? ? ? ? ? .yres ? ? ? ? ? = 320,
>> > + ? ? ? ? ? .bpp ? ? ? ? ? ?= 16,
>> > +
>> > + ? ? ? ? ? .left_margin ? ?= 27,
>> > + ? ? ? ? ? .right_margin ? = 7,
>> > + ? ? ? ? ? .upper_margin ? = 7,
>> > + ? ? ? ? ? .lower_margin ? = 8,
>> > +
>> > + ? ? ? ? ? .hsync_len ? ? ?= 6,
>> > + ? ? ? ? ? .vsync_len ? ? ?= 1,
>> > + ? }, {
>> > + ? ? ? ? ? .pixclock ? ? ? = 86538,
>> > + ? ? ? ? ? .xres ? ? ? ? ? = 320,
>> > + ? ? ? ? ? .yres ? ? ? ? ? = 320,
>> > + ? ? ? ? ? .bpp ? ? ? ? ? ?= 16,
>> > +
>> > + ? ? ? ? ? .left_margin ? ?= 20,
>> > + ? ? ? ? ? .right_margin ? = 8,
>> > + ? ? ? ? ? .upper_margin ? = 8,
>> > + ? ? ? ? ? .lower_margin ? = 5,
>> > +
>> > + ? ? ? ? ? .hsync_len ? ? ?= 4,
>> > + ? ? ? ? ? .vsync_len ? ? ?= 1,
>> > + ? }
>> > +};
>>
>> I think that keeping three structures is more readable than the array, i.e
>> static struct pxafb_mode_info palmz72_mode = {
>> ...
>> };
>>
>> static struct pxafb_mode_info palmz72_mode = {
>> ...
>> };
>>
>> static struct pxafb_mode_info treo_centro_mode = {
>> ...
>> };
>>
>> static struct pxafb_mode_info palmz72x_mode = {
>> ...
>> };
>>
>> > +static struct pxafb_mach_info palm27x_lcd_screen = {
>> > + ? .num_modes ? ? ?= 1,
>> > + ? .lcd_conn ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
>> > +};
>> > +
>> > +static int palm27x_lcd_power;
>> > +static void palm27x_lcd_ctl(int on, struct fb_var_screeninfo *info)
>> > +{
>> > + ? gpio_set_value(palm27x_lcd_power, on);
>> > +}
>> > +
>> > +static void __init palm27x_lcd_init(int power)
>> > +{
>> > + ? if (machine_is_palmz72())
>> > + ? ? ? ? ? palm27x_lcd_screen.modes = &palm27x_modes[1];
>> > + ? else if (machine_is_treo680() || machine_is_centro())
>> > + ? ? ? ? ? palm27x_lcd_screen.modes = &palm27x_modes[2];
>> > + ? else
>> > + ? ? ? ? ? palm27x_lcd_screen.modes = &palm27x_modes[0];
Mike's suggestion would be better in my POV.
>> > +
>> > + ? if (gpio_is_valid(power)) {
>> > + ? ? ? ? ? if (!gpio_request(power, "LCD power")) {
>> > + ? ? ? ? ? ? ? ? ? pr_err("Palm27x: failed to claim lcd power gpio!\n");
>> > + ? ? ? ? ? ? ? ? ? return;
>> > + ? ? ? ? ? }
>> > + ? ? ? ? ? if (!gpio_direction_output(power, 1)) {
>> > + ? ? ? ? ? ? ? ? ? pr_err("Palm27x: lcd power configuration failed!\n");
>> > + ? ? ? ? ? ? ? ? ? return;
>> > + ? ? ? ? ? }
>> > + ? ? ? ? ? palm27x_lcd_power = power;
>> > + ? ? ? ? ? palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl;
>> > + ? }
>> > +
>> > + ? set_pxa_fb_info(&palm27x_lcd_screen);
>> > +}
>> > +
>> > +#else
>> > +static inline void palm27x_lcd_init(int power) {}
>> > +#endif
>> > +
>> > +/***********************************************************************
>> > ******* + * USB Gadget
>> > +
>> > ************************************************************************
>> > ******/ +#if ? ? ? ?defined(CONFIG_USB_GADGET_PXA27X) || \
>> > + ? defined(CONFIG_USB_GADGET_PXA27X_MODULE)
>> > +static struct gpio_vbus_mach_info palm27x_udc_info = {
>> > + ? .gpio_vbus_inverted ? ? = 1,
>> > +};
>> > +
>> > +static struct platform_device palm27x_gpio_vbus = {
>> > + ? .name ? = "gpio-vbus",
>> > + ? .id ? ? = -1,
>> > + ? .dev ? ?= {
>> > + ? ? ? ? ? .platform_data ?= &palm27x_udc_info,
>> > + ? },
>> > +};
>> > +
>> > +static void __init palm27x_udc_init(int vbus, int pullup)
>> > +{
>> > + ? if (machine_is_palmld())
>> > + ? ? ? ? ? return;
>> > +
>> > + ? palm27x_udc_info.gpio_vbus ? ? ?= vbus;
>> > + ? palm27x_udc_info.gpio_pullup ? ?= pullup;
>> > +
>> > + ? if (machine_is_palmz72())
>> > + ? ? ? ? ? palm27x_udc_info.gpio_vbus_inverted = 0;
>> > +
>> > + ? if (!gpio_request(pullup, "USB Pullup")) {
>> > + ? ? ? ? ? gpio_direction_output(pullup,
>> > + ? ? ? ? ? ? ? ? ? palm27x_udc_info.gpio_vbus_inverted);
>> > + ? ? ? ? ? gpio_free(pullup);
>> > + ? } else
>> > + ? ? ? ? ? return;
>> > +
>> > + ? platform_device_register(&palm27x_gpio_vbus);
>> > +}
>> > +#else
>> > +static inline void palm27x_udc_init(int vbus, int pullup) {}
>> > +#endif
>> > +
>> > +/***********************************************************************
>> > ******* + * IrDA
>> > +
>> > ************************************************************************
>> > ******/ +#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
>> > +static struct pxaficp_platform_data palm27x_ficp_platform_data = {
>> > + ? .transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
>> > +};
>> > +
>> > +static void __init palm27x_irda_init(int pwdn)
>> > +{
>> > + ? palm27x_ficp_platform_data.gpio_pwdown = pwdn;
>> > + ? pxa_set_ficp_info(&palm27x_ficp_platform_data);
>> > +}
>> > +#else
>> > +static inline void palm27x_irda_init(int pwdn) {}
>> > +#endif
>> > +
>> > +/***********************************************************************
>> > ******* + * WM97xx audio, battery
>> > +
>> > ************************************************************************
>> > ******/ +#if ? ? ? ?defined(CONFIG_TOUCHSCREEN_WM97XX) || \
>> > + ? defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE)
>> > +static struct wm97xx_batt_pdata palm27x_batt_pdata = {
>> > + ? .batt_aux ? ? ? = WM97XX_AUX_ID3,
>> > + ? .temp_aux ? ? ? = WM97XX_AUX_ID2,
>> > + ? .charge_gpio ? ?= -1,
>> > + ? .batt_mult ? ? ?= 1000,
>> > + ? .batt_div ? ? ? = 414,
>> > + ? .temp_mult ? ? ?= 1,
>> > + ? .temp_div ? ? ? = 1,
>> > + ? .batt_tech ? ? ?= POWER_SUPPLY_TECHNOLOGY_LIPO,
>> > + ? .batt_name ? ? ?= "main-batt",
>> > +};
>> > +
>> > +static struct wm97xx_pdata palm27x_wm97xx_pdata = {
>> > + ? .batt_pdata ? ? = &palm27x_batt_pdata,
>> > +};
>> > +
>> > +static pxa2xx_audio_ops_t palm27x_ac97_pdata = {
>> > + ? .codec_pdata ? ?= { &palm27x_wm97xx_pdata, },
>> > +};
>> > +
>> > +static struct palm27x_asoc_info palm27x_asoc_pdata = {
>> > + ? .jack_gpio ? ? ?= -1,
>> > +};
>> > +
>> > +static struct platform_device palm27x_asoc = {
>> > + ? .name = "palm27x-asoc",
>> > + ? .id ? = -1,
>> > + ? .dev ?= {
>> > + ? ? ? ? ? .platform_data = &palm27x_asoc_pdata,
>> > + ? },
>> > +};
>> > +
>> > +static void __init palm27x_ac97_init(int minv, int maxv, int jack)
>> > +{
>> > + ? if (!machine_is_palmz72())
>> > + ? ? ? ? ? palm27x_ac97_pdata.reset_gpio = 95;
>> > + ? else
>> > + ? ? ? ? ? palm27x_asoc_pdata.jack_gpio = jack;
>> > +
>> > + ? if (machine_is_treo680() || machine_is_centro()) {
>> > + ? ? ? ? ? palm27x_ac97_pdata.codec_pdata[0] = NULL;
>> > + ? ? ? ? ? pxa_set_ac97_info(&palm27x_ac97_pdata);
>> > + ? } else {
>> > + ? ? ? ? ? palm27x_batt_pdata.min_voltage ?= minv,
>> > + ? ? ? ? ? palm27x_batt_pdata.max_voltage ?= maxv,
>> > +
>> > + ? ? ? ? ? pxa_set_ac97_info(&palm27x_ac97_pdata);
>> > + ? ? ? ? ? platform_device_register(&palm27x_asoc);
>> > + ? }
The handling of treo680¢ro seems to be quite different from the others,
no platform_device_register(&palm27x_asoc) for treo680/centro?
And since we really wanna common functions here, can we reduce if we cannot
avoid completely the use of machine_is_*() here, since the invoker apparently
knows which machine it is running on?
I don't actually mind adding a bit redundancy to the data in this case,
finally it will be easier to modify data only instead of modifying the
code. e.g. let's say now we add a new palm27x board, which is partly like
the treo series and partly like the others, so we will have to add more
tricky if (machine_is_*()) code here.
>> > +}
>> > +#else
>> > +static inline void palm27x_ac97_init(int minv, int maxv, int jack) {}
>> > +#endif
>> > +
>> > +/***********************************************************************
>> > ******* + * Backlight
>> > +
>> > ************************************************************************
>> > ******/ +#if defined(CONFIG_BACKLIGHT_PWM) ||
>> > defined(CONFIG_BACKLIGHT_PWM_MODULE) +struct {
>> > + ? int ? ? bl_power;
>> > + ? int ? ? lcd_power;
>> > +} palm27x_bl_info;
Or simply two static variables:
static int gpio_bl_power;
static int gpio_lcd_power;
>> > +
>> > +static int palm27x_backlight_init(struct device *dev)
>> > +{
>> > + ? int ret;
>> > +
>> > + ? ret = gpio_request(palm27x_bl_info.bl_power, "BL POWER");
>> > + ? if (ret)
>> > + ? ? ? ? ? goto err;
>> > + ? ret = gpio_direction_output(palm27x_bl_info.bl_power, 0);
>> > + ? if (ret)
>> > + ? ? ? ? ? goto err2;
>> > +
>> > + ? if (gpio_is_valid(palm27x_bl_info.lcd_power)) {
>> > + ? ? ? ? ? ret = gpio_request(palm27x_bl_info.lcd_power, "LCD POWER");
>> > + ? ? ? ? ? if (ret)
>> > + ? ? ? ? ? ? ? ? ? goto err2;
>> > + ? ? ? ? ? ret = gpio_direction_output(palm27x_bl_info.lcd_power, 0);
>> > + ? ? ? ? ? if (ret)
>> > + ? ? ? ? ? ? ? ? ? goto err3;
>> > + ? }
>> > +
>> > + ? return 0;
>> > +err3:
>> > + ? gpio_free(palm27x_bl_info.lcd_power);
>> > +err2:
>> > + ? gpio_free(palm27x_bl_info.bl_power);
>> > +err:
>> > + ? return ret;
>> > +}
>> > +
>> > +static int palm27x_backlight_notify(struct device *dev, int brightness)
>> > +{
>> > + ? gpio_set_value(palm27x_bl_info.bl_power, brightness);
>> > + ? if (gpio_is_valid(palm27x_bl_info.lcd_power))
>> > + ? ? ? ? ? gpio_set_value(palm27x_bl_info.lcd_power, brightness);
>> > + ? return brightness;
>> > +}
>> > +
>> > +static void palm27x_backlight_exit(struct device *dev)
>> > +{
>> > + ? gpio_free(palm27x_bl_info.bl_power);
>> > + ? if (gpio_is_valid(palm27x_bl_info.lcd_power))
>> > + ? ? ? ? ? gpio_free(palm27x_bl_info.lcd_power);
>> > +}
>> > +
>> > +static struct platform_pwm_backlight_data palm27x_backlight_data = {
>> > + ? .pwm_id ? ? ? ? = 0,
>> > + ? .max_brightness = 0xfe,
>> > + ? .dft_brightness = 0x7e,
>> > + ? .pwm_period_ns ?= 3500,
>> > + ? .init ? ? ? ? ? = palm27x_backlight_init,
>> > + ? .notify ? ? ? ? = palm27x_backlight_notify,
>> > + ? .exit ? ? ? ? ? = palm27x_backlight_exit,
>> > +};
>> > +
>> > +static struct platform_device palm27x_backlight = {
>> > + ? .name ? = "pwm-backlight",
>> > + ? .dev ? ?= {
>> > + ? ? ? ? ? .parent ? ? ? ? = &pxa27x_device_pwm0.dev,
>> > + ? ? ? ? ? .platform_data ?= &palm27x_backlight_data,
>> > + ? },
>> > +};
>> > +
>> > +static void __init palm27x_pwm_init(int bl, int lcd)
>> > +{
>> > + ? palm27x_bl_info.bl_power ? ? ? ?= bl;
>> > + ? palm27x_bl_info.lcd_power ? ? ? = lcd;
>> > + ? platform_device_register(&palm27x_backlight);
>> > +}
>> > +#else
>> > +static inline void palm27x_pwm_init(int bl, int lcd) {}
>> > +#endif
>> > +
>> > +/***********************************************************************
>> > ******* + * Power supply
>> > +
>> > ************************************************************************
>> > ******/ +#if defined(CONFIG_PDA_POWER) ||
>> > defined(CONFIG_PDA_POWER_MODULE) +struct {
>> > + ? int ? ? ac_state;
>> > + ? int ? ? usb_state;
>> > +} palm27x_power_info;
Mmm.... won't bother to introduce a struct, two static variables should be
enough?
static int gpio_ac_state;
static int gpio_usb_state;
>> > +
>> > +static int palm27x_power_supply_init(struct device *dev)
>> > +{
>> > + ? int ret;
>> > +
>> > + ? ret = gpio_request(palm27x_power_info.ac_state, "AC state");
>> > + ? if (ret)
>> > + ? ? ? ? ? goto err1;
>> > + ? ret = gpio_direction_input(palm27x_power_info.ac_state);
>> > + ? if (ret)
>> > + ? ? ? ? ? goto err2;
>> > +
>> > + ? if (gpio_is_valid(palm27x_power_info.usb_state)) {
>> > + ? ? ? ? ? ret = gpio_request(palm27x_power_info.usb_state, "USB state");
>> > + ? ? ? ? ? if (ret)
>> > + ? ? ? ? ? ? ? ? ? goto err2;
>> > + ? ? ? ? ? ret = gpio_direction_input(palm27x_power_info.usb_state);
>> > + ? ? ? ? ? if (ret)
>> > + ? ? ? ? ? ? ? ? ? goto err3;
>> > + ? }
>> > +
>> > + ? return 0;
>> > +err3:
>> > + ? gpio_free(palm27x_power_info.usb_state);
>> > +err2:
>> > + ? gpio_free(palm27x_power_info.ac_state);
>> > +err1:
>> > + ? return ret;
>> > +}
>> > +
>> > +static void palm27x_power_supply_exit(struct device *dev)
>> > +{
>> > + ? gpio_free(palm27x_power_info.usb_state);
>> > + ? gpio_free(palm27x_power_info.ac_state);
>> > +}
>> > +
>> > +static int palm27x_is_ac_online(void)
>> > +{
>> > + ? return gpio_get_value(palm27x_power_info.ac_state);
>> > +}
>> > +
>> > +static int palm27x_is_usb_online(void)
>> > +{
>> > + ? return !gpio_get_value(palm27x_power_info.usb_state);
>> > +}
>> > +static char *palm27x_supplicants[] = {
>> > + ? "main-battery",
>> > +};
>> > +
>> > +static struct pda_power_pdata palm27x_ps_info = {
>> > + ? .init ? ? ? ? ? ? ? ? ? = palm27x_power_supply_init,
>> > + ? .exit ? ? ? ? ? ? ? ? ? = palm27x_power_supply_exit,
>> > + ? .is_ac_online ? ? ? ? ? = palm27x_is_ac_online,
>> > + ? .is_usb_online ? ? ? ? ?= palm27x_is_usb_online,
>> > + ? .supplied_to ? ? ? ? ? ?= palm27x_supplicants,
>> > + ? .num_supplicants ? ? ? ?= ARRAY_SIZE(palm27x_supplicants),
>> > +};
>> > +
>> > +static struct platform_device palm27x_power_supply = {
>> > + ? .name = "pda-power",
>> > + ? .id ? = -1,
>> > + ? .dev ?= {
>> > + ? ? ? ? ? .platform_data = &palm27x_ps_info,
>> > + ? },
>> > +};
>> > +
>> > +static void __init palm27x_power_init(int ac, int usb)
>> > +{
>> > + ? palm27x_power_info.ac_state ? ? = ac;
>> > + ? palm27x_power_info.usb_state ? ?= usb;
>> > + ? platform_device_register(&palm27x_power_supply);
>> > +}
>> > +#else
>> > +static inline void palm27x_power_init(int ac, int usb) {}
>> > +#endif
>> > +
>> > +void __init palm27x_common_init(struct palm27x_handheld *palm)
>> > +{
>> > + ? pxa_set_ffuart_info(NULL);
>> > + ? pxa_set_btuart_info(NULL);
>> > + ? pxa_set_stuart_info(NULL);
Can we only choose those UARTs actually used?
>> > +
>> > + ? palm27x_mmc_init(palm->mmc_detect, palm->mmc_ro, palm->mmc_power);
>> > + ? palm27x_pm_init(palm->pm_str_base);
>> > + ? palm27x_lcd_init(palm->lcd_power);
>> > + ? palm27x_udc_init(palm->udc_detect, palm->udc_pullup);
>> > + ? palm27x_irda_init(palm->irda_pwdn);
>> > + ? palm27x_ac97_init(palm->batt_minv, palm->batt_maxv, palm->jack_gpio);
>> > + ? palm27x_pwm_init(palm->bl_bl, palm->bl_lcd);
>> > + ? palm27x_power_init(palm->power_ac, palm->power_usb);
>> > +}
This might be abstracted too much. Instead I'd like to avoid introducing
'struct palm27x_handheld' (and a better name could be 'palm27x_params'?),
and having machines to call these common init functions directly:
static void __init palmld_init(void)
{
...
palm27x_mmc_init(GPIO_PALMLD_MMC_DETECT,
GPIO_PALMLD_MMC_RO,
GPIO_PALMLD_MMC_POWER);
palm27x_lcd_init(GPIO_PALMLD_LCD_POWER);
...
}
>
> Hey Mike,
>
> I'll push the changes you suggested in a separate patch to avoid breaking the
> already existing code (I can't currently test this on all affected platforms,
> but I should be able to do it once I get another palmld). Especially I'll have
> to analyze the PMIC change.
>
> Thanks for the review !
> Cheers
>
^ permalink raw reply [flat|nested] 40+ messages in thread