Skip to contentSkip to conversation

pxa/palm: Introduce Palm27x

PATCH New Marek Vasut 3 participants 18 messages Aug 4, 2010 – Aug 7, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/11 pxa/palm: Introduce Palm27x

This contains common code for Palm LD, TX, T5, Z72, Treo680, Centro This code also adds PMIC support for all the devices,

---
 arch/arm/mach-pxa/Kconfig                |    3 +
 arch/arm/mach-pxa/Makefile               |    1 +
 arch/arm/mach-pxa/include/mach/palm27x.h |   81 +++++
 arch/arm/mach-pxa/palm27x.c              |  477 ++++++++++++++++++++++++++++++
 4 files changed, 562 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-pxa/include/mach/palm27x.h
 create mode 100644 arch/arm/mach-pxa/palm27x.c
arch/arm/mach-pxa/Kconfig +3 -0
index 21d1224..6f04f21 100644
@@ -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
arch/arm/mach-pxa/Makefile +1 -0
index cb408ef..85c7fb3 100644
@@ -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
arch/arm/mach-pxa/include/mach/palm27x.h new file +81 -0

81 lines not on this page · raw message

arch/arm/mach-pxa/palm27x.c new file +477 -0

477 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/11 pxa/palm: Flip Palm LD,TX,T5,Z72 to Palm27x

---
 arch/arm/mach-pxa/Kconfig    |    4 +
 arch/arm/mach-pxa/palmld.c   |  291 +++++++----------------------------
 arch/arm/mach-pxa/palmt5.c   |  282 ++++------------------------------
 arch/arm/mach-pxa/palmtreo.c |  355 +++++++-----------------------------------
 arch/arm/mach-pxa/palmtx.c   |  298 ++++++------------------------------
 arch/arm/mach-pxa/palmz72.c  |  266 +++----------------------------
 6 files changed, 215 insertions(+), 1281 deletions(-)
arch/arm/mach-pxa/Kconfig +4 -0
index 6f04f21..7aefb90 100644
@@ -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.
arch/arm/mach-pxa/palmld.c +53 -238

366 lines not on this page · raw message

arch/arm/mach-pxa/palmt5.c +30 -252

324 lines not on this page · raw message

arch/arm/mach-pxa/palmtreo.c +56 -299

451 lines not on this page · raw message

arch/arm/mach-pxa/palmtx.c +46 -252

366 lines not on this page · raw message

arch/arm/mach-pxa/palmz72.c +26 -240

313 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 3/11 pxa/spitz: Rework spitz

In reply to Marek Vasut

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

---
 arch/arm/mach-pxa/include/mach/spitz.h |    6 +
 arch/arm/mach-pxa/spitz.c              |  474 ++++++++++++++++++++------------
 2 files changed, 311 insertions(+), 169 deletions(-)
arch/arm/mach-pxa/include/mach/spitz.h +6 -0
index dc1ff25..685749a 100644
@@ -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;
arch/arm/mach-pxa/spitz.c +305 -169

679 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH 4/11 pxa/spitz: Formating and naming fixes

In reply to Marek Vasut

Improve formating so checkpatch passes. Also, change some function and variable names to make the naming consistent.

---
 arch/arm/mach-pxa/spitz.c |  282 ++++++++++++++++++++++-----------------------
 1 files changed, 138 insertions(+), 144 deletions(-)
arch/arm/mach-pxa/spitz.c +138 -144
index 24c4d27..a8d4e3a 100644
@@ -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,
Signature · 1 line
1.7.1
#4 lore raw

PATCH 5/11 pxa/z2: Fix flash layout typo

In reply to Marek Vasut
---
 arch/arm/mach-pxa/z2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/z2.c +1 -1
index 07d8bd8..f0d0228 100644
@@ -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,
Signature · 1 line
1.7.1
#5 lore raw

PATCH 6/11 pxa/balloon3: Machine file cleanup

In reply to Marek Vasut

Logically separate parts of the file that are handled by one particular driver.

---
 arch/arm/mach-pxa/balloon3.c |  225 +++++++++++++++++++++++------------------
 1 files changed, 126 insertions(+), 99 deletions(-)
arch/arm/mach-pxa/balloon3.c +126 -99
index f3b5ace..8adb87a 100644
@@ -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");
Signature · 1 line
1.7.1
#6 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

In reply to Marek Vasut

Modularize components of the Balloon3 board.

---
 arch/arm/mach-pxa/balloon3.c |  354 +++++++++++++++++++++++++++---------------
 1 files changed, 231 insertions(+), 123 deletions(-)
arch/arm/mach-pxa/balloon3.c +231 -123
index 8adb87a..572525c 100644
@@ -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 = {
Signature · 1 line
1.7.1
#7 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

Quoted 1 line · Marek Vasut

Modularize components of the Balloon3 board.

NAK.

That's not what a large portion of this patch does. You have put all of the pin definitions into balloon3_pin_config and negated the work that was done to ensure that a single kernel could run on different variants of the balloon3. If a feature isn't configured on the board you shouldn't configure the MFPs for that feature.

Quoted 48 lines
---
 arch/arm/mach-pxa/balloon3.c |  354 +++++++++++++++++++++++++++---------------
 1 files changed, 231 insertions(+), 123 deletions(-)
arch/arm/mach-pxa/balloon3.c +11 -9
index 8adb87a..572525c 100644
@@ -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,

arch/arm/mach-pxa/balloon3.c static unsigned long balloon3_pin_config[] __initdata = { · line 92

Quoted 10 lines
arch/arm/mach-pxa/balloon3.c +8 -0
+	GPIO109_MMC_DAT_1,
+	GPIO110_MMC_DAT_2,
+	GPIO111_MMC_DAT_3,
+	GPIO112_MMC_CMD,
+
+	/* USB Host */
+	GPIO88_USBH1_PWR,
+	GPIO89_USBH1_PEN,
 };
 

J.

Signature · 4 lines
     I am afraid of the dark.      |  .''`.  Debian GNU/Linux Developer
                                   | : :' :  Happy to accept PGP signed
                                   | `. `'   or encrypted mail - RSA
                                   |   `-    key on the keyservers.
#8 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

Dne P? 6. srpna 2010 01:25:06 Jonathan McDowell napsal(a):

Quoted 6 lines · Marek Vasut
Quoted 1 line

Modularize components of the Balloon3 board.

NAK.

That's not what a large portion of this patch does.

Oh, really ?

Quoted 4 lines

You have put all of
the pin definitions into balloon3_pin_config and negated the work that was done to ensure that a single kernel could run on different variants of the balloon3.

I have only this one, but read on.

Quoted 2 lines

If a feature isn't configured on the board you
shouldn't configure the MFPs for that feature.

That's not true. You should configure them as inputs. The big plan (in another patch) is to do this the same way colibri270 is done (balloon3 baseboard + expansion boards).

Quoted 73 lines
Quoted 61 lines

---

 arch/arm/mach-pxa/balloon3.c |  354

+++++++++++++++++++++++++++--------------- 1 files changed, 231 insertions(+), 123 deletions(-)

arch/arm/mach-pxa/balloon3.c +1 -0
index 8adb87a..572525c 100644
@@ -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>

arch/arm/mach-pxa/balloon3.c +10 -7
@@ -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,

arch/arm/mach-pxa/balloon3.c static unsigned long balloon3_pin_config[] · line 100

Quoted 10 lines
arch/arm/mach-pxa/balloon3.c +8 -0
+	GPIO109_MMC_DAT_1,
+	GPIO110_MMC_DAT_2,
+	GPIO111_MMC_DAT_3,
+	GPIO112_MMC_CMD,
+
+	/* USB Host */
+	GPIO88_USBH1_PWR,
+	GPIO89_USBH1_PEN,
 
 };

J.

#9 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

Quoted 9 lines · Marek Vasut

Dne P? 6. srpna 2010 01:25:06 Jonathan McDowell napsal(a):

Quoted 6 lines · Marek Vasut
Quoted 1 line

Modularize components of the Balloon3 board.

NAK.

That's not what a large portion of this patch does.

Oh, really ?

A large portion of it removes setting the MFPs based on the board capabilities. That's a different piece of work to making the various components modular.

Quoted 5 lines
Quoted 3 lines

You have put all of the pin definitions into balloon3_pin_config and negated the work that was done to ensure that a single kernel could run on different variants of the balloon3.

I have only this one, but read on.

I suspect you have a similar board to me; a double sided board fairly well populated (sound, CF, USB host + slave, LCD). The Lightwriter, for example, is a single sided board using fewer peripherals. The CUED variant I believe is different again for their needs.

Quoted 6 lines
Quoted 2 lines

If a feature isn't configured on the board you shouldn't configure the MFPs for that feature.

That's not true. You should configure them as inputs. The big plan (in another patch) is to do this the same way colibri270 is done (balloon3 baseboard + expansion boards).

I don't have a copy of the PXA reference to hand, so I'm happy to accept best practise is to set unused pins to be inputs. However the changes in this patch don't do this and may end up setting some pins that are used for something else to an unexpected output.

I'm failing to understand the motivation for these changes, especially if you have a plan to later do more appropriate cleanup.

Quoted 69 lines
Quoted 69 lines
Quoted 69 lines

---

 arch/arm/mach-pxa/balloon3.c |  354

+++++++++++++++++++++++++++--------------- 1 files changed, 231 insertions(+), 123 deletions(-)

arch/arm/mach-pxa/balloon3.c +1 -0
index 8adb87a..572525c 100644
@@ -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>

arch/arm/mach-pxa/balloon3.c +18 -7
@@ -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,
 
Quoted 3 lines
Quoted 3 lines

arch/arm/mach-pxa/balloon3.c static unsigned long balloon3_pin_config[] · line 100

Quoted 1 line
arch/arm/mach-pxa/balloon3.c +0 -0
 };

J.

J.

Signature · 1 line
Avoid GOTOs completely if you can keep the program readable.
#10 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

Dne P? 6. srpna 2010 21:52:18 Jonathan McDowell napsal(a):

Quoted 19 lines · Marek Vasut
Quoted 9 lines

Dne P? 6. srpna 2010 01:25:06 Jonathan McDowell napsal(a):

Quoted 6 lines · Marek Vasut
Quoted 1 line

Modularize components of the Balloon3 board.

NAK.

That's not what a large portion of this patch does.

Oh, really ?

A large portion of it removes setting the MFPs based on the board capabilities. That's a different piece of work to making the various components modular.

Quoted 4 lines
Quoted 3 lines

You have put all of the pin definitions into balloon3_pin_config and negated the work that was done to ensure that a single kernel could run on different variants of the balloon3.

Quoted 6 lines
Quoted 1 line

I have only this one, but read on.

I suspect you have a similar board to me; a double sided board fairly well populated (sound, CF, USB host + slave, LCD). The Lightwriter, for example, is a single sided board using fewer peripherals. The CUED variant I believe is different again for their needs.

That's just great.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

If a feature isn't configured on the board you shouldn't configure the MFPs for that feature.

Quoted 8 lines
Quoted 3 lines

That's not true. You should configure them as inputs. The big plan (in another patch) is to do this the same way colibri270 is done (balloon3 baseboard + expansion boards).

I don't have a copy of the PXA reference to hand, so I'm happy to accept best practise is to set unused pins to be inputs. However the changes in this patch don't do this and may end up setting some pins that are used for something else to an unexpected output.

The changes in this patch should not screw up anything. If they do break something, it'll be eventually found out. Do you have any trouble with this patch on your board?

Quoted 3 lines

I'm failing to understand the motivation for these changes, especially if you have a plan to later do more appropriate cleanup.

Because you can't do everything at once. I prepared the ground for further changes.

I wonder why noone actually sent a better patch ever since balloon3 was pushed mainline ... that's like 15 kernel versions already, isn't it? I also believe this patch will make it very hard to forward-port the out-of-the-tree patches on balloon3 website, which are often in terrible shape ... well that's sad.

Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines

---

 arch/arm/mach-pxa/balloon3.c |  354

+++++++++++++++++++++++++++--------------- 1 files changed, 231 insertions(+), 123 deletions(-)

(quoted diff) +0 -0

b/arch/arm/mach-pxa/balloon3.c index 8adb87a..572525c 100644

arch/arm/mach-pxa/balloon3.c +1 -0
@@ -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>

arch/arm/mach-pxa/balloon3.c +4 -5
@@ -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 */
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

arch/arm/mach-pxa/balloon3.c static unsigned long balloon3_pin_config[] · line 77

Quoted 5 lines
arch/arm/mach-pxa/balloon3.c +0 -2
-/*******************************************************************
 **** ******* - * Audio and Touchscreen
-
 *********************************************************************
 *** ******/ -static unsigned long balloon3_ac97_pin_config[] = { +	

/*

Quoted 27 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

AC97 */

arch/arm/mach-pxa/balloon3.c +13 -0
 	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,
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

};

J.

J.

#11 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

Quoted 48 lines · Marek Vasut

Dne P? 6. srpna 2010 21:52:18 Jonathan McDowell napsal(a):

Quoted 19 lines · Marek Vasut
Quoted 9 lines

Dne P? 6. srpna 2010 01:25:06 Jonathan McDowell napsal(a):

Quoted 6 lines · Marek Vasut
Quoted 1 line

Modularize components of the Balloon3 board.

NAK.

That's not what a large portion of this patch does.

Oh, really ?

A large portion of it removes setting the MFPs based on the board capabilities. That's a different piece of work to making the various components modular.

Quoted 4 lines
Quoted 3 lines

You have put all of the pin definitions into balloon3_pin_config and negated the work that was done to ensure that a single kernel could run on different variants of the balloon3.

Quoted 6 lines
Quoted 1 line

I have only this one, but read on.

I suspect you have a similar board to me; a double sided board fairly well populated (sound, CF, USB host + slave, LCD). The Lightwriter, for example, is a single sided board using fewer peripherals. The CUED variant I believe is different again for their needs.

That's just great.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

If a feature isn't configured on the board you shouldn't configure the MFPs for that feature.

Quoted 8 lines
Quoted 3 lines

That's not true. You should configure them as inputs. The big plan (in another patch) is to do this the same way colibri270 is done (balloon3 baseboard + expansion boards).

I don't have a copy of the PXA reference to hand, so I'm happy to accept best practise is to set unused pins to be inputs. However the changes in this patch don't do this and may end up setting some pins that are used for something else to an unexpected output.

The changes in this patch should not screw up anything. If they do break something, it'll be eventually found out. Do you have any trouble with this patch on your board?

Quoted 3 lines

I'm failing to understand the motivation for these changes, especially if you have a plan to later do more appropriate cleanup.

Quoted 7 lines

Because you can't do everything at once. I prepared the ground for further changes.

I wonder why noone actually sent a better patch ever since balloon3 was pushed mainline ... that's like 15 kernel versions already, isn't it? I also believe this patch will make it very hard to forward-port the out-of-the-tree patches on balloon3 website, which are often in terrible shape ... well that's sad.

Well, possibly you can now sleep even less ;-)

#12 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

Dne So 7. srpna 2010 11:06:17 Eric Miao napsal(a):

Quoted 52 lines · Marek Vasut
Quoted 51 lines

Dne P? 6. srpna 2010 21:52:18 Jonathan McDowell napsal(a):

Quoted 19 lines · Marek Vasut
Quoted 9 lines

Dne P? 6. srpna 2010 01:25:06 Jonathan McDowell napsal(a):

Quoted 6 lines · Marek Vasut
Quoted 1 line

Modularize components of the Balloon3 board.

NAK.

That's not what a large portion of this patch does.

Oh, really ?

A large portion of it removes setting the MFPs based on the board capabilities. That's a different piece of work to making the various components modular.

Quoted 4 lines
Quoted 3 lines

You have put all of the pin definitions into balloon3_pin_config and negated the work that was done to ensure that a single kernel could run on different variants of the balloon3.

Quoted 6 lines
Quoted 1 line

I have only this one, but read on.

I suspect you have a similar board to me; a double sided board fairly well populated (sound, CF, USB host + slave, LCD). The Lightwriter, for example, is a single sided board using fewer peripherals. The CUED variant I believe is different again for their needs.

That's just great.

Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

If a feature isn't configured on the board you shouldn't configure the MFPs for that feature.

That's not true. You should configure them as inputs. The big plan (in another patch) is to do this the same way colibri270 is done (balloon3 baseboard + expansion boards).

I don't have a copy of the PXA reference to hand, so I'm happy to accept best practise is to set unused pins to be inputs. However the changes in this patch don't do this and may end up setting some pins that are used for something else to an unexpected output.

The changes in this patch should not screw up anything. If they do break something, it'll be eventually found out. Do you have any trouble with this patch on your board?

Quoted 2 lines

I'm failing to understand the motivation for these changes, especially if you have a plan to later do more appropriate cleanup.

Because you can't do everything at once. I prepared the ground for further changes.

Quoted 7 lines
Quoted 5 lines

I wonder why noone actually sent a better patch ever since balloon3 was pushed mainline ... that's like 15 kernel versions already, isn't it? I also believe this patch will make it very hard to forward-port the out-of-the-tree patches on balloon3 website, which are often in terrible shape ... well that's sad.

Well, possibly you can now sleep even less ;-)

I'm trying to get the sane ones mainline, but otherwise I'm NOT INSANE to care for out-of-the-tree patches :)

#13 lore raw

PATCH 7/11 pxa/balloon3: Machine file cleanup

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Dne P? 6. srpna 2010 21:52:18 Jonathan McDowell napsal(a):

Quoted 9 lines · Marek Vasut
Quoted 7 lines

Dne P? 6. srpna 2010 01:25:06 Jonathan McDowell napsal(a):

Quoted 4 lines

On Wed, Aug 04, 2010 at 01:22:09PM +0200, Marek Vasut wrote: You have put all of the pin definitions into balloon3_pin_config and negated the work that was done to ensure that a single kernel could run on different variants of the balloon3.

I have only this one, but read on.

Quoted 7 lines
Quoted 5 lines

I suspect you have a similar board to me; a double sided board fairly well populated (sound, CF, USB host + slave, LCD). The Lightwriter, for example, is a single sided board using fewer peripherals. The CUED variant I believe is different again for their needs.

That's just great.

I'll happily agree it's far from perfect; what I've suggested as an improvement is either a board configuration register which would indicate the features on the board, or potentially the use of device tree when/if that hits. Until that point what we've got, while a kludge, does allow a single kernel to run on all board types.

(In Balloon's defence a lack of probability is hardly unique to that platform.)

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

If a feature isn't configured on the board you shouldn't configure the MFPs for that feature.

That's not true. You should configure them as inputs. The big plan (in another patch) is to do this the same way colibri270 is done (balloon3 baseboard + expansion boards).

Quoted 8 lines
Quoted 4 lines

I don't have a copy of the PXA reference to hand, so I'm happy to accept best practise is to set unused pins to be inputs. However the changes in this patch don't do this and may end up setting some pins that are used for something else to an unexpected output.

The changes in this patch should not screw up anything. If they do break something, it'll be eventually found out. Do you have any trouble with this patch on your board?

I don't envisage any problems with my board, which as I said is I suspect identical to yours. Unfortunately I'm currently at DebConf and so don't have any access to it to confirm. My worry is about the boards I don't have but know exist.

Quoted 5 lines
Quoted 2 lines

I'm failing to understand the motivation for these changes, especially if you have a plan to later do more appropriate cleanup.

Because you can't do everything at once. I prepared the ground for further changes.

Let me be clear about the bits of this patch I have a problem with; I'm fully in favour of the bits that wrap up config in CONFIG_[FEATURE]. It's the removal of doing the pxa2xx_mfp_config based on the balloon3_has feature bits that I think is mistaken.

Quoted 3 lines

I wonder why noone actually sent a better patch ever since balloon3 was pushed mainline ... that's like 15 kernel versions already, isn't it?

The base balloon3 support patch didn't go in to Eric's devel tree until September; 2.6.32 is the first release with it present.

With regards to the out of tree patches that haven't been pushed that's largely due to a complete lack of time on my part; getting the base support in took a lot longer than I expected and there have also been VHDL changes I haven't had a chance to fully discuss with the author to determine the effect on existing patches. It's great you've picked up this work, but please don't think there's any lack of desire to get things pushed upstream; it mostly comes down to a lack of manpower.

J.

Signature · 3 lines
/-\                             |   Mac system message: Like, dude,
|@/  Debian GNU/Linux Developer |        something went wrong.
\-                              |
#14 lore raw

PATCH 8/11 pxa/balloon3: PCMCIA Support

In reply to Marek Vasut

This driver adds support for the on-board CF socket.

---
 arch/arm/mach-pxa/balloon3.c              |   13 ++-
 arch/arm/mach-pxa/include/mach/balloon3.h |   36 ++++---
 drivers/pcmcia/Kconfig                    |    2 +-
 drivers/pcmcia/Makefile                   |    1 +
 drivers/pcmcia/pxa2xx_balloon3.c          |  158 +++++++++++++++++++++++++++++
 5 files changed, 191 insertions(+), 19 deletions(-)
 create mode 100644 drivers/pcmcia/pxa2xx_balloon3.c
arch/arm/mach-pxa/balloon3.c +12 -1
index 572525c..91ad56d 100644
@@ -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)
arch/arm/mach-pxa/include/mach/balloon3.h +19 -17
index 1a74106..d5dcf75 100644
@@ -26,10 +26,12 @@ 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)
+/* FPGA / CPLD registers for CF socket */
+#define	BALLOON3_CF_STATUS_REG		(BALLOON3_FPGA_VIRT + 0x00e00008)
+#define	BALLOON3_CF_CONTROL_REG		(BALLOON3_FPGA_VIRT + 0x00e00008)
+/* FPGA / CPLD version register */
+#define	BALLOON3_FPGA_VER		(BALLOON3_FPGA_VIRT + 0x00e0001c)
+
 #define BALLOON3_NANDIO_IO_REG		(BALLOON3_FPGA_VIRT + 0x00e00000)
 /* fpga/cpld interrupt control register */
 #define BALLOON3_INT_CONTROL_REG	(BALLOON3_FPGA_VIRT + 0x00e0000C)
@@ -41,6 +43,19 @@ enum balloon3_features {
 #define BALLOON3_SAMOSA_DATA_REG	(BALLOON3_FPGA_VIRT + 0x00c00004)
 #define BALLOON3_SAMOSA_STATUS_REG	(BALLOON3_FPGA_VIRT + 0x00c0001c)
 
+/* 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)
+
 /* GPIOs for irqs */
 #define BALLOON3_GPIO_AUX_NIRQ		(94)
 #define BALLOON3_GPIO_CODEC_IRQ		(95)
@@ -58,16 +73,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 +137,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)
drivers/pcmcia/Kconfig +1 -1
index d0f5ad3..ef2f659 100644
@@ -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
drivers/pcmcia/Makefile +1 -0
index d006e8b..6a60773 100644
@@ -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)
 
drivers/pcmcia/pxa2xx_balloon3.c new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
1.7.1
#15 lore raw

PATCH 9/11 pxa/balloon3: PCF857x GPIO expander and LEDs

In reply to Marek Vasut

Add supported for PCF8574A GPIO expander and LEDs attached to it.

---
 arch/arm/mach-pxa/balloon3.c              |   84 +++++++++++++++++++++++++++-
 arch/arm/mach-pxa/include/mach/balloon3.h |   11 ++++
 2 files changed, 92 insertions(+), 3 deletions(-)
arch/arm/mach-pxa/balloon3.c +81 -3
index 91ad56d..6f594bd 100644
@@ -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();
arch/arm/mach-pxa/include/mach/balloon3.h +11 -0
index d5dcf75..238f887 100644
@@ -69,6 +69,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 */
Signature · 1 line
1.7.1
#16 lore raw

PATCH 10/11 pxa/balloon3: Add NAND driver

In reply to Marek Vasut

The NAND support is implemented through the gen_nand driver.

---
 arch/arm/mach-pxa/balloon3.c              |  151 +++++++++++++++++++++++++++++
 arch/arm/mach-pxa/include/mach/balloon3.h |   28 +++++-
 2 files changed, 176 insertions(+), 3 deletions(-)
arch/arm/mach-pxa/balloon3.c +151 -0
index 6f594bd..e2eb0b7 100644
@@ -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,154 @@ static inline void balloon3_i2c_init(void) {}
 #endif
 
 /******************************************************************************
+ * NAND
+ ******************************************************************************/
+#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
+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;
+
+		__raw_writel(balloon3_ctl, BALLOON3_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);
+
+	__raw_writew(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
+}
+
+static int balloon3_nand_probe(struct platform_device *pdev)
+{
+	void __iomem *temp_map;
+	uint16_t ver;
+	int ret;
+
+	__raw_writew(BALLOON3_NAND_CONTROL2_16BIT, BALLOON3_NAND_CONTROL2_REG);
+
+	ver = __raw_readw(BALLOON3_FPGA_VER);
+	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);
+
+	/* Power up the NAND chips */
+	ret = gpio_request(BALLOON3_GPIO_RUN_NAND, "NAND");
+	if (ret)
+		goto err1;
+
+	ret = gpio_direction_output(BALLOON3_GPIO_RUN_NAND, 1);
+	if (ret)
+		goto err2;
+
+	gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1);
+
+	/* Deassert all nCE lines and write protect line */
+	__raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
+	return 0;
+
+err2:
+	gpio_free(BALLOON3_GPIO_RUN_NAND);
+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);
+}
+
+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 +697,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();
arch/arm/mach-pxa/include/mach/balloon3.h +25 -3
index 238f887..eec92e6 100644
@@ -31,12 +31,15 @@ enum balloon3_features {
 #define	BALLOON3_CF_CONTROL_REG		(BALLOON3_FPGA_VIRT + 0x00e00008)
 /* FPGA / CPLD version register */
 #define	BALLOON3_FPGA_VER		(BALLOON3_FPGA_VIRT + 0x00e0001c)
+/* FPGA / CPLD registers for NAND flash */
+#define	BALLOON3_NAND_BASE		(PXA_CS4_PHYS + 0x00e00000)
+#define	BALLOON3_NAND_IO_REG		(BALLOON3_FPGA_VIRT + 0x00e00000)
+#define	BALLOON3_NAND_CONTROL2_REG	(BALLOON3_FPGA_VIRT + 0x00e00010)
+#define	BALLOON3_NAND_STAT_REG		(BALLOON3_FPGA_VIRT + 0x00e00010)
+#define	BALLOON3_NAND_CONTROL_REG	(BALLOON3_FPGA_VIRT + 0x00e00014)
 
-#define BALLOON3_NANDIO_IO_REG		(BALLOON3_FPGA_VIRT + 0x00e00000)
 /* fpga/cpld interrupt control register */
 #define BALLOON3_INT_CONTROL_REG	(BALLOON3_FPGA_VIRT + 0x00e0000C)
-#define BALLOON3_NANDIO_CTL2_REG 	(BALLOON3_FPGA_VIRT + 0x00e00010)
-#define BALLOON3_NANDIO_CTL_REG 	(BALLOON3_FPGA_VIRT + 0x00e00014)
 #define BALLOON3_VERSION_REG		(BALLOON3_FPGA_VIRT + 0x00e0001c)
 
 #define BALLOON3_SAMOSA_ADDR_REG	(BALLOON3_FPGA_VIRT + 0x00c00000)
@@ -56,6 +59,22 @@ enum balloon3_features {
 #define BALLOON3_BP_CF_NRDY_IRQ		BALLOON3_IRQ(0)
 #define BALLOON3_BP_NSTSCHG_IRQ		BALLOON3_IRQ(1)
 
+/* NAND Control register */
+#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)
+
+/* NAND Status register */
+#define	BALLOON3_NAND_STAT_RNB		(1 << 0)
+
+/* NAND Control2 register */
+#define	BALLOON3_NAND_CONTROL2_16BIT	(1 << 0)
+
 /* GPIOs for irqs */
 #define BALLOON3_GPIO_AUX_NIRQ		(94)
 #define BALLOON3_GPIO_CODEC_IRQ		(95)
@@ -69,6 +88,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)
Signature · 1 line
1.7.1
#17 lore raw

PATCH 11/11 pxa/balloon3: Add MAX1586 PMIC support

In reply to Marek Vasut
---
 arch/arm/mach-pxa/balloon3.c |   55 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/balloon3.c +55 -0
index e2eb0b7..9041340 100644
@@ -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>
@@ -680,6 +681,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)
@@ -699,6 +753,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();
Signature · 1 line
1.7.1