linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Initial B&N Nook Color (Encore) support
  2011-04-27  1:52 Initial B&N Nook Color support green
@ 2011-04-27  1:52 ` green
  2011-04-27  8:54   ` Mike Rapoport
  0 siblings, 1 reply; 16+ messages in thread
From: green @ 2011-04-27  1:52 UTC (permalink / raw)
  To: linux-omap; +Cc: Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Just bare-bones board file that has only serial console working.
---
 arch/arm/mach-omap2/Kconfig                    |    5 +
 arch/arm/mach-omap2/Makefile                   |    1 +
 arch/arm/mach-omap2/board-omap3encore.c        |  152 ++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/board-encore.h |   76 ++++++++++++
 arch/arm/plat-omap/include/plat/uncompress.h   |    1 +
 arch/arm/tools/mach-types                      |    2 +-
 6 files changed, 236 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap3encore.c
 create mode 100644 arch/arm/plat-omap/include/plat/board-encore.h

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index b997a35..5370561 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
 	 for full description please see the products webpage at
 	 http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
 
+config MACH_ENCORE
+        bool "Barnes & Noble Encore (Nook Color)"
+        depends on ARCH_OMAP3
+        select OMAP_PACKAGE_CBP
+
 config MACH_OVERO
 	bool "Gumstix Overo board"
 	depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 512b152..207f372 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -189,6 +189,7 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
 					   hsmmc.o
+obj-$(CONFIG_MACH_ENCORE)               += board-omap3encore.o
 obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
new file mode 100644
index 0000000..9a00d6b
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3encore.c
@@ -0,0 +1,152 @@
+/*
+ *
+ * Copyright (C) 2008 Texas Instruments Inc.
+ * Vikram Pandita <vikram.pandita@ti.com>
+ *
+ * Modified from mach-omap2/board-ldp.c
+ *
+ * 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.
+ *
+ * Apri 2011 Oleg Drokin <green@linuxhacker.ru> - Port to 2.6.39
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+#include <linux/workqueue.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+
+#include <linux/spi/spi.h>
+#include <linux/interrupt.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/dma-mapping.h>
+#include <plat/board-encore.h>
+#include <mach/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <plat/mcspi.h>
+#include <mach/gpio.h>
+#include <plat/board.h>
+#include <plat/common.h>
+#include <plat/gpmc.h>
+#include <plat/usb.h>
+#include <plat/mux.h>
+
+#include <asm/system.h> // For system_serial_high & system_serial_low
+#include <asm/io.h>
+#include <asm/delay.h>
+#include <plat/sram.h>
+
+#include <plat/display.h>
+#include <plat/omap-serial.h>
+
+#include <plat/system.h>
+
+#include "mux.h"
+#include "prcm-common.h"
+
+#include "sdram-hynix-h8mbx00u0mer-0em.h"
+
+#include <media/v4l2-int-device.h>
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE
+#include <linux/bootmem.h>
+#endif
+
+/* Use address that is most likely unused and untouched by u-boot */
+#define ENCORE_RAM_CONSOLE_START 0x8e000000
+#define ENCORE_RAM_CONSOLE_SIZE (0x20000)
+
+static struct resource encore_ram_console_resource[] = { 
+    {
+        .start  = ENCORE_RAM_CONSOLE_START,
+        .end    = ENCORE_RAM_CONSOLE_START + ENCORE_RAM_CONSOLE_SIZE - 1,
+        .flags  = IORESOURCE_MEM,
+    }
+};
+
+static struct platform_device encore_ram_console_device = {
+    .name           = "ram_console",
+    .id             = 0,
+    .num_resources  = ARRAY_SIZE(encore_ram_console_resource),
+    .resource       = encore_ram_console_resource,
+};
+
+static struct platform_device *encore_devices[] __initdata = {
+	&encore_ram_console_device,
+};
+
+static void __init omap_encore_init_early(void)
+{
+printk("in early ini\n");
+	omap2_init_common_infrastructure();
+	omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
+				  h8mbx00u0mer0em_sdrc_params);
+#ifdef CONFIG_ANDROID_RAM_CONSOLE
+	reserve_bootmem(ENCORE_RAM_CONSOLE_START, ENCORE_RAM_CONSOLE_SIZE, 0);
+#endif /* CONFIG_ANDROID_RAM_CONSOLE */
+printk("done early ini\n");
+}
+
+#if defined(CONFIG_USB_ANDROID) || defined(CONFIG_USB_ANDROID_MODULE)
+static struct usb_mass_storage_platform_data mass_storage_pdata = {
+	.vendor = "B&N     ",
+	.product = "Ebook Disk      ",
+	.release = 0x0100,
+};
+
+static struct platform_device usb_mass_storage_device = {
+	.name = "usb_mass_storage",
+	.id = -1,
+	.dev = {
+		.platform_data = &mass_storage_pdata,
+		},
+};
+#endif
+
+#ifdef CONFIG_OMAP_MUX
+static struct omap_board_mux board_mux[] __initdata = {
+        { .reg_offset = OMAP_MUX_TERMINATOR },
+};
+#else
+#define board_mux       NULL
+#endif
+
+static struct omap_board_config_kernel encore_config[] __initdata = {
+};
+
+static void __init omap_encore_init(void)
+{
+printk("in encore init\n");
+	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
+	omap_serial_init();
+
+	omap_board_config = encore_config;
+	omap_board_config_size = ARRAY_SIZE(encore_config);
+
+	platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
+
+        BUG_ON(!cpu_is_omap3630());
+
+printk("done encore init\n");
+}
+
+MACHINE_START(ENCORE, "encore")
+	.boot_params	= 0x80000100,
+	.reserve	= omap_reserve,
+	.map_io		= omap3_map_io,
+	.init_early	= omap_encore_init_early,
+	.init_irq	= omap_init_irq,
+	.init_machine	= omap_encore_init,
+	.timer		= &omap_timer,
+MACHINE_END
diff --git a/arch/arm/plat-omap/include/plat/board-encore.h b/arch/arm/plat-omap/include/plat/board-encore.h
new file mode 100644
index 0000000..2dd33f6
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/board-encore.h
@@ -0,0 +1,76 @@
+/*
+ * arch/arm/plat-omap/include/mach/board-boxer.h
+ *
+ * Hardware definitions for TI OMAP3-based Encore (B&N Nook Color).
+ *
+ * Copyright (C) 2008 Texas Instruments Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __ASM_ARCH_OMAP_ENCORE_H
+#define __ASM_ARCH_OMAP_ENCORE_H
+
+#define MAX17042_I2C_SLAVE_ADDRESS		0x36
+#define MAX17042_GPIO_FOR_IRQ			100
+
+/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
+#define MAX8903_UOK_GPIO_FOR_IRQ 115
+#define MAX8903_DOK_GPIO_FOR_IRQ 114      
+#define MAX8903_GPIO_CHG_EN      110
+#define MAX8903_GPIO_CHG_STATUS  111
+#define MAX8903_GPIO_CHG_FLT     101
+#define MAX8903_GPIO_CHG_IUSB    102
+#define MAX8903_GPIO_CHG_USUS    104
+#define MAX8903_GPIO_CHG_ILM     61
+
+#define BOXER_WIFI_PMENA_GPIO   22
+#define BOXER_WIFI_IRQ_GPIO     15
+#define BOXER_WIFI_EN_POW       16
+
+#define BOARD_ENCORE_REV_EVT1A      0x1
+#define BOARD_ENCORE_REV_EVT1B      0x2
+#define BOARD_ENCORE_REV_EVT2       0x3
+#define BOARD_ENCORE_REV_DVT        0x4
+#define BOARD_ENCORE_REV_PVT        0x5
+#define BOARD_ENCORE_REV_UNKNOWN    0x6
+
+static inline int is_encore_board_evt2(void)
+{
+    return (system_rev >= BOARD_ENCORE_REV_EVT2);
+}
+
+static inline int is_encore_board_evt1b(void)
+{
+    return (system_rev == BOARD_ENCORE_REV_EVT1B);
+}
+
+#define KXTF9_DEVICE_ID			"kxtf9"
+#define KXTF9_I2C_SLAVE_ADDRESS		0x0F
+#define KXTF9_GPIO_FOR_PWR		34
+#define KXTF9_GPIO_FOR_IRQ		113
+
+#define CYTTSP_I2C_SLAVEADDRESS 34
+#define ENCORE_CYTTSP_GPIO        99
+#define ENCORE_CYTTSP_RESET_GPIO 46
+
+
+#endif /* __ASM_ARCH_OMAP_ENCORE_H */
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 30b891c..c3c1a0d 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -169,6 +169,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
 		/* zoom2/3 external uart */
 		DEBUG_LL_ZOOM(omap_zoom2);
 		DEBUG_LL_ZOOM(omap_zoom3);
+		DEBUG_LL_OMAP3(3, encore);
 
 		/* TI8168 base boards using UART3 */
 		DEBUG_LL_TI816X(3, ti8168evm);
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 7ca41f0..2f0db3e 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -962,7 +962,7 @@ omapl138_case_a3	MACH_OMAPL138_CASE_A3	OMAPL138_CASE_A3	3280
 uemd			MACH_UEMD		UEMD			3281
 ccwmx51mut		MACH_CCWMX51MUT		CCWMX51MUT		3282
 rockhopper		MACH_ROCKHOPPER		ROCKHOPPER		3283
-nookcolor		MACH_NOOKCOLOR		NOOKCOLOR		3284
+encore			MACH_ENCORE		ENCORE			3284
 hkdkc100		MACH_HKDKC100		HKDKC100		3285
 ts42xx			MACH_TS42XX		TS42XX			3286
 aebl			MACH_AEBL		AEBL			3287
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (Encore) support
  2011-04-27  1:52 ` [PATCH 1/2] Initial B&N Nook Color (Encore) support green
@ 2011-04-27  8:54   ` Mike Rapoport
  0 siblings, 0 replies; 16+ messages in thread
From: Mike Rapoport @ 2011-04-27  8:54 UTC (permalink / raw)
  To: green; +Cc: linux-omap

On 04/27/11 04:52, green@linuxhacker.ru wrote:
> From: Oleg Drokin <green@linuxhacker.ru>
> 
> Just bare-bones board file that has only serial console working.
> ---
>  arch/arm/mach-omap2/Kconfig                    |    5 +
>  arch/arm/mach-omap2/Makefile                   |    1 +
>  arch/arm/mach-omap2/board-omap3encore.c        |  152 ++++++++++++++++++++++++
>  arch/arm/plat-omap/include/plat/board-encore.h |   76 ++++++++++++
>  arch/arm/plat-omap/include/plat/uncompress.h   |    1 +
>  arch/arm/tools/mach-types                      |    2 +-
>  6 files changed, 236 insertions(+), 1 deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-omap3encore.c
>  create mode 100644 arch/arm/plat-omap/include/plat/board-encore.h
> 
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index b997a35..5370561 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
>  	 for full description please see the products webpage at
>  	 http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
>  
> +config MACH_ENCORE
> +        bool "Barnes & Noble Encore (Nook Color)"
> +        depends on ARCH_OMAP3
> +        select OMAP_PACKAGE_CBP
> +
>  config MACH_OVERO
>  	bool "Gumstix Overo board"
>  	depends on ARCH_OMAP3
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 512b152..207f372 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -189,6 +189,7 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
>  					   hsmmc.o
> +obj-$(CONFIG_MACH_ENCORE)               += board-omap3encore.o
>  obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
> new file mode 100644
> index 0000000..9a00d6b
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-omap3encore.c
> @@ -0,0 +1,152 @@
> +/*
> + *
> + * Copyright (C) 2008 Texas Instruments Inc.
> + * Vikram Pandita <vikram.pandita@ti.com>
> + *
> + * Modified from mach-omap2/board-ldp.c
> + *
> + * 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.
> + *
> + * Apri 2011 Oleg Drokin <green@linuxhacker.ru> - Port to 2.6.39
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/delay.h>
> +#include <linux/input.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/workqueue.h>
> +#include <linux/err.h>
> +#include <linux/clk.h>
> +
> +#include <linux/spi/spi.h>
> +#include <linux/interrupt.h>
> +#include <linux/regulator/machine.h>
> +#include <linux/regulator/fixed.h>
> +#include <linux/dma-mapping.h>
> +#include <plat/board-encore.h>
> +#include <mach/hardware.h>
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +
> +#include <plat/mcspi.h>
> +#include <mach/gpio.h>
> +#include <plat/board.h>
> +#include <plat/common.h>
> +#include <plat/gpmc.h>
> +#include <plat/usb.h>
> +#include <plat/mux.h>
> +
> +#include <asm/system.h> // For system_serial_high & system_serial_low

No C++ comments, please.

> +#include <asm/io.h>
> +#include <asm/delay.h>
> +#include <plat/sram.h>
> +
> +#include <plat/display.h>
> +#include <plat/omap-serial.h>
> +
> +#include <plat/system.h>
> +
> +#include "mux.h"
> +#include "prcm-common.h"
> +
> +#include "sdram-hynix-h8mbx00u0mer-0em.h"
> +
> +#include <media/v4l2-int-device.h>

Please check what header files are actually required and drop the rest...

> +#ifdef CONFIG_ANDROID_RAM_CONSOLE
> +#include <linux/bootmem.h>
> +#endif

AFAIK, there's no CONFIG_ANDROID_ in the kernel

> +/* Use address that is most likely unused and untouched by u-boot */
> +#define ENCORE_RAM_CONSOLE_START 0x8e000000
> +#define ENCORE_RAM_CONSOLE_SIZE (0x20000)
> +
> +static struct resource encore_ram_console_resource[] = { 
> +    {
> +        .start  = ENCORE_RAM_CONSOLE_START,
> +        .end    = ENCORE_RAM_CONSOLE_START + ENCORE_RAM_CONSOLE_SIZE - 1,
> +        .flags  = IORESOURCE_MEM,
> +    }
> +};
> +
> +static struct platform_device encore_ram_console_device = {
> +    .name           = "ram_console",
> +    .id             = 0,
> +    .num_resources  = ARRAY_SIZE(encore_ram_console_resource),
> +    .resource       = encore_ram_console_resource,
> +};

and there's no ram_console driver as well.
I don't think it'd make sense to register ram_console device at all.

> +static struct platform_device *encore_devices[] __initdata = {
> +	&encore_ram_console_device,
> +};
> +
> +static void __init omap_encore_init_early(void)
> +{
> +printk("in early ini\n");
> +	omap2_init_common_infrastructure();
> +	omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
> +				  h8mbx00u0mer0em_sdrc_params);
> +#ifdef CONFIG_ANDROID_RAM_CONSOLE
> +	reserve_bootmem(ENCORE_RAM_CONSOLE_START, ENCORE_RAM_CONSOLE_SIZE, 0);
> +#endif /* CONFIG_ANDROID_RAM_CONSOLE */
> +printk("done early ini\n");
> +}
> +
> +#if defined(CONFIG_USB_ANDROID) || defined(CONFIG_USB_ANDROID_MODULE)
> +static struct usb_mass_storage_platform_data mass_storage_pdata = {
> +	.vendor = "B&N     ",
> +	.product = "Ebook Disk      ",
> +	.release = 0x0100,
> +};
> +
> +static struct platform_device usb_mass_storage_device = {
> +	.name = "usb_mass_storage",
> +	.id = -1,
> +	.dev = {
> +		.platform_data = &mass_storage_pdata,
> +		},
> +};
> +#endif

The above comment applies to the usb mass storage device

> +#ifdef CONFIG_OMAP_MUX
> +static struct omap_board_mux board_mux[] __initdata = {
> +        { .reg_offset = OMAP_MUX_TERMINATOR },
> +};
> +#else
> +#define board_mux       NULL
> +#endif
> +
> +static struct omap_board_config_kernel encore_config[] __initdata = {
> +};
> +
> +static void __init omap_encore_init(void)
> +{
> +printk("in encore init\n");

please remove debug leftovers

> +	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
> +	omap_serial_init();
> +
> +	omap_board_config = encore_config;
> +	omap_board_config_size = ARRAY_SIZE(encore_config);
> +
> +	platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
> +
> +        BUG_ON(!cpu_is_omap3630());

In what exact circumstances can this trigger? Are there encore boards with CPU
other than omap3630?

> +
> +printk("done encore init\n");
> +}
> +
> +MACHINE_START(ENCORE, "encore")
> +	.boot_params	= 0x80000100,
> +	.reserve	= omap_reserve,
> +	.map_io		= omap3_map_io,
> +	.init_early	= omap_encore_init_early,
> +	.init_irq	= omap_init_irq,
> +	.init_machine	= omap_encore_init,
> +	.timer		= &omap_timer,
> +MACHINE_END
> diff --git a/arch/arm/plat-omap/include/plat/board-encore.h b/arch/arm/plat-omap/include/plat/board-encore.h
> new file mode 100644
> index 0000000..2dd33f6
> --- /dev/null
> +++ b/arch/arm/plat-omap/include/plat/board-encore.h

If you really think that this header is necessary, it should be
arch/arm/mach-omap2/board-encore.h, however, I think it can be removed at all
and all the defines moved to the board-encore.c

> @@ -0,0 +1,76 @@
> +/*
> + * arch/arm/plat-omap/include/mach/board-boxer.h

boxer?

> + * Hardware definitions for TI OMAP3-based Encore (B&N Nook Color).
> + *
> + * Copyright (C) 2008 Texas Instruments Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +
> +#ifndef __ASM_ARCH_OMAP_ENCORE_H
> +#define __ASM_ARCH_OMAP_ENCORE_H
> +
> +#define MAX17042_I2C_SLAVE_ADDRESS		0x36
> +#define MAX17042_GPIO_FOR_IRQ			100
> +
> +/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
> +#define MAX8903_UOK_GPIO_FOR_IRQ 115
> +#define MAX8903_DOK_GPIO_FOR_IRQ 114      
> +#define MAX8903_GPIO_CHG_EN      110
> +#define MAX8903_GPIO_CHG_STATUS  111
> +#define MAX8903_GPIO_CHG_FLT     101
> +#define MAX8903_GPIO_CHG_IUSB    102
> +#define MAX8903_GPIO_CHG_USUS    104
> +#define MAX8903_GPIO_CHG_ILM     61
> +
> +#define BOXER_WIFI_PMENA_GPIO   22
> +#define BOXER_WIFI_IRQ_GPIO     15
> +#define BOXER_WIFI_EN_POW       16
> +
> +#define BOARD_ENCORE_REV_EVT1A      0x1
> +#define BOARD_ENCORE_REV_EVT1B      0x2
> +#define BOARD_ENCORE_REV_EVT2       0x3
> +#define BOARD_ENCORE_REV_DVT        0x4
> +#define BOARD_ENCORE_REV_PVT        0x5
> +#define BOARD_ENCORE_REV_UNKNOWN    0x6
> +
> +static inline int is_encore_board_evt2(void)
> +{
> +    return (system_rev >= BOARD_ENCORE_REV_EVT2);
> +}
> +
> +static inline int is_encore_board_evt1b(void)
> +{
> +    return (system_rev == BOARD_ENCORE_REV_EVT1B);
> +}
> +
> +#define KXTF9_DEVICE_ID			"kxtf9"
> +#define KXTF9_I2C_SLAVE_ADDRESS		0x0F
> +#define KXTF9_GPIO_FOR_PWR		34
> +#define KXTF9_GPIO_FOR_IRQ		113
> +
> +#define CYTTSP_I2C_SLAVEADDRESS 34
> +#define ENCORE_CYTTSP_GPIO        99
> +#define ENCORE_CYTTSP_RESET_GPIO 46
> +
> +
> +#endif /* __ASM_ARCH_OMAP_ENCORE_H */
> diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
> index 30b891c..c3c1a0d 100644
> --- a/arch/arm/plat-omap/include/plat/uncompress.h
> +++ b/arch/arm/plat-omap/include/plat/uncompress.h
> @@ -169,6 +169,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
>  		/* zoom2/3 external uart */
>  		DEBUG_LL_ZOOM(omap_zoom2);
>  		DEBUG_LL_ZOOM(omap_zoom3);
> +		DEBUG_LL_OMAP3(3, encore);

please move it after 'DEBUG_LL_OMAP3(3, touchbook);' for consistency

>  
>  		/* TI8168 base boards using UART3 */
>  		DEBUG_LL_TI816X(3, ti8168evm);
> diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
> index 7ca41f0..2f0db3e 100644
> --- a/arch/arm/tools/mach-types
> +++ b/arch/arm/tools/mach-types
> @@ -962,7 +962,7 @@ omapl138_case_a3	MACH_OMAPL138_CASE_A3	OMAPL138_CASE_A3	3280
>  uemd			MACH_UEMD		UEMD			3281
>  ccwmx51mut		MACH_CCWMX51MUT		CCWMX51MUT		3282
>  rockhopper		MACH_ROCKHOPPER		ROCKHOPPER		3283
> -nookcolor		MACH_NOOKCOLOR		NOOKCOLOR		3284
> +encore			MACH_ENCORE		ENCORE			3284
>  hkdkc100		MACH_HKDKC100		HKDKC100		3285
>  ts42xx			MACH_TS42XX		TS42XX			3286
>  aebl			MACH_AEBL		AEBL			3287


-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Initial B&N Nook Color support, take two
@ 2011-04-28 15:57 green
  2011-04-28 15:57 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: green @ 2011-04-28 15:57 UTC (permalink / raw)
  To: linux-omap

Hello!

   Ok, this is a second attempt at B&N Nook Color board file submission.
   USB peripheral mode is fully operational as is serial console and
   MMC/SDCard.

   I threw away all the android stuff as suggested, also cleaned up
   voltage regulators and removed the ones our twl chip actually
   does not have (contrary to my previous beliefs).

Bye,
    Oleg


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-04-28 15:57 Initial B&N Nook Color support, take two green
@ 2011-04-28 15:57 ` green
  2011-04-28 23:34   ` Abimanyu Gottumukkala
  2011-05-03  9:22   ` Tony Lindgren
  2011-04-28 15:57 ` [PATCH 2/2] Add tps65921 chip green
  2011-04-28 17:05 ` Initial B&N Nook Color support, take two Paul Walmsley
  2 siblings, 2 replies; 16+ messages in thread
From: green @ 2011-04-28 15:57 UTC (permalink / raw)
  To: linux-omap; +Cc: Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Bare-bones board file, comes with serial console, gpio keys,
MMC/SDCard and USB support.
---
 arch/arm/mach-omap2/Kconfig                  |    5 +
 arch/arm/mach-omap2/Makefile                 |    2 +
 arch/arm/mach-omap2/board-omap3encore.c      |  380 ++++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/uncompress.h |    1 +
 arch/arm/tools/mach-types                    |    2 +-
 5 files changed, 389 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap3encore.c

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index b997a35..5370561 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
 	 for full description please see the products webpage at
 	 http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
 
+config MACH_ENCORE
+        bool "Barnes & Noble Encore (Nook Color)"
+        depends on ARCH_OMAP3
+        select OMAP_PACKAGE_CBP
+
 config MACH_OVERO
 	bool "Gumstix Overo board"
 	depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 512b152..b894777 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -189,6 +189,8 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
 					   hsmmc.o
+obj-$(CONFIG_MACH_ENCORE)		+= board-omap3encore.o \
+					   hsmmc.o
 obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
new file mode 100644
index 0000000..c7bf8de
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3encore.c
@@ -0,0 +1,380 @@
+/*
+ *
+ * Copyright (C) 2008 Texas Instruments Inc.
+ * Vikram Pandita <vikram.pandita@ti.com>
+ *
+ * Modified from mach-omap2/board-ldp.c
+ *
+ * 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.
+ *
+ * April 2011 Oleg Drokin <green@linuxhacker.ru> - Port to 2.6.39
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/gpio_keys.h>
+#include <linux/err.h>
+
+#include <linux/spi/spi.h>
+#include <linux/i2c/twl.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <mach/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#include <mach/gpio.h>
+#include <plat/board.h>
+#include <plat/common.h>
+#include <plat/usb.h>
+#include <plat/mux.h>
+#include <plat/sram.h>
+#include <plat/mmc.h>
+#include <plat/omap-serial.h>
+#include <plat/system.h>
+
+#include "mux.h"
+#include "hsmmc.h"
+#include "sdram-hynix-h8mbx00u0mer-0em.h"
+
+/* Encore-specific device-info and i2c addresses. */
+/* Battery, bus 1 */
+#define MAX17042_I2C_SLAVE_ADDRESS	0x36
+#define MAX17042_GPIO_FOR_IRQ		100
+
+/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
+#define MAX8903_UOK_GPIO_FOR_IRQ	115
+#define MAX8903_DOK_GPIO_FOR_IRQ	114      
+#define MAX8903_GPIO_CHG_EN		110
+#define MAX8903_GPIO_CHG_STATUS		111
+#define MAX8903_GPIO_CHG_FLT		101
+#define MAX8903_GPIO_CHG_IUSB		102
+#define MAX8903_GPIO_CHG_USUS		104
+#define MAX8903_GPIO_CHG_ILM		61
+
+/* TI WLAN */
+#define ENCORE_WIFI_PMENA_GPIO		22
+#define ENCORE_WIFI_IRQ_GPIO		15
+#define ENCORE_WIFI_EN_POW		16
+
+/* Accelerometer i2c bus 1*/
+#define KXTF9_I2C_SLAVE_ADDRESS		0x0F
+#define KXTF9_GPIO_FOR_PWR		34
+#define KXTF9_GPIO_FOR_IRQ		113
+
+/* Touch screen i2c bus 2*/
+#define CYTTSP_I2C_SLAVEADDRESS		34
+#define ENCORE_CYTTSP_GPIO		99
+#define ENCORE_CYTTSP_RESET_GPIO 	46
+
+/* Audio codec, i2c bus 2 */
+#define AUDIO_CODEC_POWER_ENABLE_GPIO	103
+#define AUDIO_CODEC_RESET_GPIO		37
+#define AUDIO_CODEC_IRQ_GPIO		59
+#define AIC3100_I2CSLAVEADDRESS		0x18
+
+
+/* Different HW revisions */
+#define BOARD_ENCORE_REV_EVT1A		0x1
+#define BOARD_ENCORE_REV_EVT1B		0x2
+#define BOARD_ENCORE_REV_EVT2		0x3
+#define BOARD_ENCORE_REV_DVT		0x4
+#define BOARD_ENCORE_REV_PVT		0x5
+#define BOARD_ENCORE_REV_UNKNOWN	0x6
+
+static inline int is_encore_board_evt2(void)
+{
+    return (system_rev >= BOARD_ENCORE_REV_EVT2);
+}
+
+static inline int is_encore_board_evt1b(void)
+{
+    return (system_rev == BOARD_ENCORE_REV_EVT1B);
+}
+
+static int encore_twl4030_keymap[] = {
+	KEY(0, 0, KEY_HOME),
+	KEY(0, 1, KEY_VOLUMEUP),
+	KEY(0, 2, KEY_VOLUMEDOWN),
+	0
+};
+
+static struct matrix_keymap_data encore_twl4030_keymap_data = {
+	.keymap			= encore_twl4030_keymap,
+	.keymap_size	= ARRAY_SIZE(encore_twl4030_keymap),
+};
+
+static struct twl4030_keypad_data encore_kp_twl4030_data = {
+	.rows			= 8,
+	.cols			= 8,
+	.keymap_data		= &encore_twl4030_keymap_data,
+	.rep			= 1,
+};
+
+/* HOME key code for HW > EVT2A */
+static struct gpio_keys_button encore_gpio_buttons[] = {
+	{
+		.code			= KEY_POWER,
+		.gpio			= 14,
+		.desc			= "POWER",
+		.active_low		= 0,
+		.wakeup			= 1,
+	},
+	{
+		.code			= KEY_HOME,
+		.gpio			= 48,
+		.desc			= "HOME",
+		.active_low		= 1,
+		.wakeup			= 1,
+	},
+};
+
+static struct gpio_keys_platform_data encore_gpio_key_info = {
+	.buttons	= encore_gpio_buttons,
+	.nbuttons	= ARRAY_SIZE(encore_gpio_buttons),
+};
+
+static struct platform_device encore_keys_gpio = {
+	.name	= "gpio-keys",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &encore_gpio_key_info,
+	},
+};
+
+static struct platform_device *encore_devices[] __initdata = {
+	&encore_keys_gpio,
+};
+
+static void __init omap_encore_init_early(void)
+{
+	omap2_init_common_infrastructure();
+	omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
+				  h8mbx00u0mer0em_sdrc_params);
+}
+
+static struct twl4030_usb_data encore_usb_data = {
+      .usb_mode	= T2_USB_MODE_ULPI,
+};
+
+static struct regulator_consumer_supply encore_vmmc1_supply = {
+	.supply		= "vmmc",
+};
+
+static struct regulator_consumer_supply encore_vdda_dac_supply = 
+	REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
+
+/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
+static struct regulator_init_data encore_vmmc1 = {
+	.constraints = {
+		.min_uV			= 1850000,
+		.max_uV			= 3150000,
+		.valid_modes_mask	= REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask		= REGULATOR_CHANGE_VOLTAGE
+					| REGULATOR_CHANGE_MODE
+					| REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies  = 1,
+	.consumer_supplies      = &encore_vmmc1_supply,
+};
+
+static struct regulator_init_data encore_vdac = {
+	.constraints = {
+		.min_uV                 = 1800000,
+		.max_uV                 = 1800000,
+		.valid_modes_mask       = REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask         = REGULATOR_CHANGE_MODE
+					| REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies  = 1,
+	.consumer_supplies      = &encore_vdda_dac_supply,
+};
+
+/* The order is reverted in this table so that internal eMMC is presented
+ * as first mmc card for compatibility with existing installations and
+ * for common sense reasons */
+static struct omap2_hsmmc_info mmc[] __initdata = {
+	{
+		.name		= "internal",
+		.mmc		= 2,
+		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+		.nonremovable	= true,
+		.power_saving	= true,
+		.ocr_mask	= MMC_VDD_165_195, /* 1.85V */
+	},
+	{
+		.name		= "external",
+		.mmc		= 1,
+		.caps		= MMC_CAP_4_BIT_DATA,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+		.power_saving	= true,
+	},
+	{
+		.name		= "internal",
+		.mmc		= 3,
+		.caps		= MMC_CAP_4_BIT_DATA,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+		.nonremovable	= true,
+		.power_saving	= true,
+	},
+	{}      /* Terminator */
+};
+
+static int encore_hsmmc_card_detect(struct device *dev, int slot)
+{
+	struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+	/* Encore board EVT2 and later has pin high when card is present) */
+	return gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+}
+
+static int encore_twl4030_hsmmc_late_init(struct device *dev)
+{
+        int ret = 0;
+        struct platform_device *pdev = container_of(dev,
+                                struct platform_device, dev);
+        struct omap_mmc_platform_data *pdata = dev->platform_data;
+
+	if(is_encore_board_evt2()) {
+		/* Setting MMC1 (external) Card detect */
+		if (pdev->id == 0) {
+			pdata->slots[0].card_detect = encore_hsmmc_card_detect;
+		}
+	}
+        return ret;
+}
+
+static __init void encore_hsmmc_set_late_init(struct device *dev)
+{
+	struct omap_mmc_platform_data *pdata;
+
+	/* dev can be null if CONFIG_MMC_OMAP_HS is not set */
+	if (!dev)
+		return;
+
+	pdata = dev->platform_data;
+	pdata->init = encore_twl4030_hsmmc_late_init;
+}
+
+static int __ref encore_twl_gpio_setup(struct device *dev,
+		unsigned gpio, unsigned ngpio)
+{
+	struct omap2_hsmmc_info *c;
+	/* 
+	 * gpio + 0 is "mmc0_cd" (input/IRQ),
+	 * gpio + 1 is "mmc1_cd" (input/IRQ)
+	 */
+	mmc[1].gpio_cd = gpio + 0;
+	mmc[0].gpio_cd = gpio + 1;
+	omap2_hsmmc_init(mmc);
+	for (c = mmc; c->mmc; c++)
+                encore_hsmmc_set_late_init(c->dev);
+
+	/*
+	 * link regulators to MMC adapters ... we "know" the
+	 * regulators will be set up only *after* we return.
+	 */
+	encore_vmmc1_supply.dev = mmc[1].dev;
+
+	return 0;
+}
+
+static struct twl4030_gpio_platform_data encore_gpio_data = {
+	.gpio_base	= OMAP_MAX_GPIO_LINES,
+	.irq_base	= TWL4030_GPIO_IRQ_BASE,
+	.irq_end	= TWL4030_GPIO_IRQ_END,
+	.setup		= encore_twl_gpio_setup,
+};
+
+static struct twl4030_madc_platform_data encore_madc_data = {
+	.irq_line	= 1,
+};
+
+static struct twl4030_platform_data __refdata encore_twldata = {
+	.irq_base	= TWL4030_IRQ_BASE,
+	.irq_end	= TWL4030_IRQ_END,
+
+	.madc		= &encore_madc_data,
+	.usb		= &encore_usb_data,
+	.gpio		= &encore_gpio_data,
+	.keypad		= &encore_kp_twl4030_data,
+	.vmmc1		= &encore_vmmc1,
+	.vdac		= &encore_vdac,
+};
+
+static struct i2c_board_info __initdata encore_i2c_bus1_info[] = {
+	{
+		I2C_BOARD_INFO("tps65921", 0x48),
+		.flags = I2C_CLIENT_WAKE,
+		.irq = INT_34XX_SYS_NIRQ,
+		.platform_data = &encore_twldata,
+	},
+};
+
+static struct i2c_board_info __initdata encore_i2c_bus2_info[] = {
+};
+
+
+static struct omap_musb_board_data musb_board_data = {
+	.interface_type		= MUSB_INTERFACE_ULPI,
+#ifdef CONFIG_USB_MUSB_OTG
+	.mode			= MUSB_OTG,
+#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
+	.mode			= MUSB_HOST,
+#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
+	.mode			= MUSB_PERIPHERAL,
+#endif
+	.power			= 100,
+};
+
+#ifdef CONFIG_OMAP_MUX
+static struct omap_board_mux board_mux[] __initdata = {
+        { .reg_offset = OMAP_MUX_TERMINATOR },
+};
+#else
+#define board_mux       NULL
+#endif
+
+static struct omap_board_config_kernel encore_config[] __initdata = {
+};
+
+static int __init omap_i2c_init(void)
+{
+	omap_register_i2c_bus(1, 100, encore_i2c_bus1_info,
+			ARRAY_SIZE(encore_i2c_bus1_info));
+	omap_register_i2c_bus(2, 400, encore_i2c_bus2_info,
+			ARRAY_SIZE(encore_i2c_bus2_info));
+	return 0;
+}
+
+static void __init omap_encore_init(void)
+{
+	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
+	omap_i2c_init();
+	omap_serial_init();
+	usb_musb_init(&musb_board_data);
+
+	omap_board_config = encore_config;
+	omap_board_config_size = ARRAY_SIZE(encore_config);
+
+	platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
+}
+
+MACHINE_START(ENCORE, "encore")
+	.boot_params	= 0x80000100,
+	.reserve	= omap_reserve,
+	.map_io		= omap3_map_io,
+	.init_early	= omap_encore_init_early,
+	.init_irq	= omap_init_irq,
+	.init_machine	= omap_encore_init,
+	.timer		= &omap_timer,
+MACHINE_END
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 30b891c..f2de4ff 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -161,6 +161,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
 		DEBUG_LL_OMAP3(3, omap_ldp);
 		DEBUG_LL_OMAP3(3, overo);
 		DEBUG_LL_OMAP3(3, touchbook);
+		DEBUG_LL_OMAP3(3, encore);
 
 		/* omap4 based boards using UART3 */
 		DEBUG_LL_OMAP4(3, omap_4430sdp);
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 7ca41f0..2f0db3e 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -962,7 +962,7 @@ omapl138_case_a3	MACH_OMAPL138_CASE_A3	OMAPL138_CASE_A3	3280
 uemd			MACH_UEMD		UEMD			3281
 ccwmx51mut		MACH_CCWMX51MUT		CCWMX51MUT		3282
 rockhopper		MACH_ROCKHOPPER		ROCKHOPPER		3283
-nookcolor		MACH_NOOKCOLOR		NOOKCOLOR		3284
+encore			MACH_ENCORE		ENCORE			3284
 hkdkc100		MACH_HKDKC100		HKDKC100		3285
 ts42xx			MACH_TS42XX		TS42XX			3286
 aebl			MACH_AEBL		AEBL			3287
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] Add tps65921 chip
  2011-04-28 15:57 Initial B&N Nook Color support, take two green
  2011-04-28 15:57 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
@ 2011-04-28 15:57 ` green
  2011-04-28 17:05 ` Initial B&N Nook Color support, take two Paul Walmsley
  2 siblings, 0 replies; 16+ messages in thread
From: green @ 2011-04-28 15:57 UTC (permalink / raw)
  To: linux-omap; +Cc: Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

---
 drivers/mfd/twl-core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 960b5be..3daebcc 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -1107,6 +1107,8 @@ static const struct i2c_device_id twl_ids[] = {
 	{ "tps65950", 0 },		/* catalog version of twl5030 */
 	{ "tps65930", TPS_SUBSET },	/* fewer LDOs and DACs; no charger */
 	{ "tps65920", TPS_SUBSET },	/* fewer LDOs; no codec or charger */
+	{ "tps65921", TPS_SUBSET },	/* fewer LDOs; no codec, no LED
+					   and vibrator. Charger in USB module*/
 	{ "twl6030", TWL6030_CLASS },	/* "Phoenix power chip" */
 	{ /* end of list */ },
 };
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: Initial B&N Nook Color support, take two
  2011-04-28 15:57 Initial B&N Nook Color support, take two green
  2011-04-28 15:57 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
  2011-04-28 15:57 ` [PATCH 2/2] Add tps65921 chip green
@ 2011-04-28 17:05 ` Paul Walmsley
  2011-04-28 17:21   ` Oleg Drokin
  2 siblings, 1 reply; 16+ messages in thread
From: Paul Walmsley @ 2011-04-28 17:05 UTC (permalink / raw)
  To: green; +Cc: linux-omap

On Thu, 28 Apr 2011, green@linuxhacker.ru wrote:

> Hello!
> 
>    Ok, this is a second attempt at B&N Nook Color board file submission.
>    USB peripheral mode is fully operational as is serial console and
>    MMC/SDCard.

It's good that you're sending these patches, but please also:

- Add a Signed-off-by: to each patch (see item 12 of 
Documentation/SubmittingPatches)

- Cc Vikram, the original author of the board file, in the patch messages

- Cc the linux-arm-kernel@lists.infradead.org mailing list


- Paul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Initial B&N Nook Color support, take two
  2011-04-28 17:05 ` Initial B&N Nook Color support, take two Paul Walmsley
@ 2011-04-28 17:21   ` Oleg Drokin
  0 siblings, 0 replies; 16+ messages in thread
From: Oleg Drokin @ 2011-04-28 17:21 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: linux-omap

Hello!

On Apr 28, 2011, at 1:05 PM, Paul Walmsley wrote:
>>   Ok, this is a second attempt at B&N Nook Color board file submission.
>>   USB peripheral mode is fully operational as is serial console and
>>   MMC/SDCard.
> It's good that you're sending these patches, but please also:
> - Add a Signed-off-by: to each patch (see item 12 of 
> Documentation/SubmittingPatches)

Ah, sure. Somehow I assumed this one is auto generated for the patch submitter.
(never was a problem in the past at least).

> - Cc Vikram, the original author of the board file, in the patch messages

Ok, though I am not sure he is the original author of the nook color board file
(since (C) 2008 well predates the Nook Color), the work I base this all off is
from NookColor B&N source code drop and unfortunately people that worked on it
did not identify themselves (or I don't see it) aside from just names in some
debug comments.

> - Cc the linux-arm-kernel@lists.infradead.org mailing list

Ok, I am expecting the patch will still get quite a bit of scrutiny so I'll
wait for more feedback and next submission would be conforming.

Thanks!

Bye,
    Oleg

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-04-28 15:57 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
@ 2011-04-28 23:34   ` Abimanyu Gottumukkala
  2011-04-29  0:49     ` Oleg Drokin
  2011-05-03  9:22   ` Tony Lindgren
  1 sibling, 1 reply; 16+ messages in thread
From: Abimanyu Gottumukkala @ 2011-04-28 23:34 UTC (permalink / raw)
  To: green; +Cc: linux-omap

Hi,

Nook color has Ti OMAP 3621. 3621 CPU Support is not available in
current kernel, adding CPU support will be nice before board.
BN is set to release new source code in few days, taking new code as
porting base is also recommended.

Regards,
Abimanyu G

On Thu, Apr 28, 2011 at 9:27 PM,  <green@linuxhacker.ru> wrote:
> From: Oleg Drokin <green@linuxhacker.ru>
>
> Bare-bones board file, comes with serial console, gpio keys,
> MMC/SDCard and USB support.
> ---
>  arch/arm/mach-omap2/Kconfig                  |    5 +
>  arch/arm/mach-omap2/Makefile                 |    2 +
>  arch/arm/mach-omap2/board-omap3encore.c      |  380 ++++++++++++++++++++++++++
>  arch/arm/plat-omap/include/plat/uncompress.h |    1 +
>  arch/arm/tools/mach-types                    |    2 +-
>  5 files changed, 389 insertions(+), 1 deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-omap3encore.c
>
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index b997a35..5370561 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
>         for full description please see the products webpage at
>         http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
>
> +config MACH_ENCORE
> +        bool "Barnes & Noble Encore (Nook Color)"
> +        depends on ARCH_OMAP3
> +        select OMAP_PACKAGE_CBP
> +
>  config MACH_OVERO
>        bool "Gumstix Overo board"
>        depends on ARCH_OMAP3
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 512b152..b894777 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -189,6 +189,8 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
>                                           hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
>                                           hsmmc.o
> +obj-$(CONFIG_MACH_ENCORE)              += board-omap3encore.o \
> +                                          hsmmc.o
>  obj-$(CONFIG_MACH_OVERO)               += board-overo.o \
>                                           hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3EVM)            += board-omap3evm.o \
> diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
> new file mode 100644
> index 0000000..c7bf8de
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-omap3encore.c
> @@ -0,0 +1,380 @@
> +/*
> + *
> + * Copyright (C) 2008 Texas Instruments Inc.
> + * Vikram Pandita <vikram.pandita@ti.com>
> + *
> + * Modified from mach-omap2/board-ldp.c
> + *
> + * 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.
> + *
> + * April 2011 Oleg Drokin <green@linuxhacker.ru> - Port to 2.6.39
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/err.h>
> +
> +#include <linux/spi/spi.h>
> +#include <linux/i2c/twl.h>
> +#include <linux/regulator/machine.h>
> +#include <linux/regulator/fixed.h>
> +#include <mach/hardware.h>
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +
> +#include <mach/gpio.h>
> +#include <plat/board.h>
> +#include <plat/common.h>
> +#include <plat/usb.h>
> +#include <plat/mux.h>
> +#include <plat/sram.h>
> +#include <plat/mmc.h>
> +#include <plat/omap-serial.h>
> +#include <plat/system.h>
> +
> +#include "mux.h"
> +#include "hsmmc.h"
> +#include "sdram-hynix-h8mbx00u0mer-0em.h"
> +
> +/* Encore-specific device-info and i2c addresses. */
> +/* Battery, bus 1 */
> +#define MAX17042_I2C_SLAVE_ADDRESS     0x36
> +#define MAX17042_GPIO_FOR_IRQ          100
> +
> +/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
> +#define MAX8903_UOK_GPIO_FOR_IRQ       115
> +#define MAX8903_DOK_GPIO_FOR_IRQ       114
> +#define MAX8903_GPIO_CHG_EN            110
> +#define MAX8903_GPIO_CHG_STATUS                111
> +#define MAX8903_GPIO_CHG_FLT           101
> +#define MAX8903_GPIO_CHG_IUSB          102
> +#define MAX8903_GPIO_CHG_USUS          104
> +#define MAX8903_GPIO_CHG_ILM           61
> +
> +/* TI WLAN */
> +#define ENCORE_WIFI_PMENA_GPIO         22
> +#define ENCORE_WIFI_IRQ_GPIO           15
> +#define ENCORE_WIFI_EN_POW             16
> +
> +/* Accelerometer i2c bus 1*/
> +#define KXTF9_I2C_SLAVE_ADDRESS                0x0F
> +#define KXTF9_GPIO_FOR_PWR             34
> +#define KXTF9_GPIO_FOR_IRQ             113
> +
> +/* Touch screen i2c bus 2*/
> +#define CYTTSP_I2C_SLAVEADDRESS                34
> +#define ENCORE_CYTTSP_GPIO             99
> +#define ENCORE_CYTTSP_RESET_GPIO       46
> +
> +/* Audio codec, i2c bus 2 */
> +#define AUDIO_CODEC_POWER_ENABLE_GPIO  103
> +#define AUDIO_CODEC_RESET_GPIO         37
> +#define AUDIO_CODEC_IRQ_GPIO           59
> +#define AIC3100_I2CSLAVEADDRESS                0x18
> +
> +
> +/* Different HW revisions */
> +#define BOARD_ENCORE_REV_EVT1A         0x1
> +#define BOARD_ENCORE_REV_EVT1B         0x2
> +#define BOARD_ENCORE_REV_EVT2          0x3
> +#define BOARD_ENCORE_REV_DVT           0x4
> +#define BOARD_ENCORE_REV_PVT           0x5
> +#define BOARD_ENCORE_REV_UNKNOWN       0x6
> +
> +static inline int is_encore_board_evt2(void)
> +{
> +    return (system_rev >= BOARD_ENCORE_REV_EVT2);
> +}
> +
> +static inline int is_encore_board_evt1b(void)
> +{
> +    return (system_rev == BOARD_ENCORE_REV_EVT1B);
> +}
> +
> +static int encore_twl4030_keymap[] = {
> +       KEY(0, 0, KEY_HOME),
> +       KEY(0, 1, KEY_VOLUMEUP),
> +       KEY(0, 2, KEY_VOLUMEDOWN),
> +       0
> +};
> +
> +static struct matrix_keymap_data encore_twl4030_keymap_data = {
> +       .keymap                 = encore_twl4030_keymap,
> +       .keymap_size    = ARRAY_SIZE(encore_twl4030_keymap),
> +};
> +
> +static struct twl4030_keypad_data encore_kp_twl4030_data = {
> +       .rows                   = 8,
> +       .cols                   = 8,
> +       .keymap_data            = &encore_twl4030_keymap_data,
> +       .rep                    = 1,
> +};
> +
> +/* HOME key code for HW > EVT2A */
> +static struct gpio_keys_button encore_gpio_buttons[] = {
> +       {
> +               .code                   = KEY_POWER,
> +               .gpio                   = 14,
> +               .desc                   = "POWER",
> +               .active_low             = 0,
> +               .wakeup                 = 1,
> +       },
> +       {
> +               .code                   = KEY_HOME,
> +               .gpio                   = 48,
> +               .desc                   = "HOME",
> +               .active_low             = 1,
> +               .wakeup                 = 1,
> +       },
> +};
> +
> +static struct gpio_keys_platform_data encore_gpio_key_info = {
> +       .buttons        = encore_gpio_buttons,
> +       .nbuttons       = ARRAY_SIZE(encore_gpio_buttons),
> +};
> +
> +static struct platform_device encore_keys_gpio = {
> +       .name   = "gpio-keys",
> +       .id     = -1,
> +       .dev    = {
> +               .platform_data  = &encore_gpio_key_info,
> +       },
> +};
> +
> +static struct platform_device *encore_devices[] __initdata = {
> +       &encore_keys_gpio,
> +};
> +
> +static void __init omap_encore_init_early(void)
> +{
> +       omap2_init_common_infrastructure();
> +       omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
> +                                 h8mbx00u0mer0em_sdrc_params);
> +}
> +
> +static struct twl4030_usb_data encore_usb_data = {
> +      .usb_mode        = T2_USB_MODE_ULPI,
> +};
> +
> +static struct regulator_consumer_supply encore_vmmc1_supply = {
> +       .supply         = "vmmc",
> +};
> +
> +static struct regulator_consumer_supply encore_vdda_dac_supply =
> +       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
> +
> +/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
> +static struct regulator_init_data encore_vmmc1 = {
> +       .constraints = {
> +               .min_uV                 = 1850000,
> +               .max_uV                 = 3150000,
> +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
> +                                       | REGULATOR_MODE_STANDBY,
> +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
> +                                       | REGULATOR_CHANGE_MODE
> +                                       | REGULATOR_CHANGE_STATUS,
> +       },
> +       .num_consumer_supplies  = 1,
> +       .consumer_supplies      = &encore_vmmc1_supply,
> +};
> +
> +static struct regulator_init_data encore_vdac = {
> +       .constraints = {
> +               .min_uV                 = 1800000,
> +               .max_uV                 = 1800000,
> +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
> +                                       | REGULATOR_MODE_STANDBY,
> +               .valid_ops_mask         = REGULATOR_CHANGE_MODE
> +                                       | REGULATOR_CHANGE_STATUS,
> +       },
> +       .num_consumer_supplies  = 1,
> +       .consumer_supplies      = &encore_vdda_dac_supply,
> +};
> +
> +/* The order is reverted in this table so that internal eMMC is presented
> + * as first mmc card for compatibility with existing installations and
> + * for common sense reasons */
> +static struct omap2_hsmmc_info mmc[] __initdata = {
> +       {
> +               .name           = "internal",
> +               .mmc            = 2,
> +               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
> +               .gpio_cd        = -EINVAL,
> +               .gpio_wp        = -EINVAL,
> +               .nonremovable   = true,
> +               .power_saving   = true,
> +               .ocr_mask       = MMC_VDD_165_195, /* 1.85V */
> +       },
> +       {
> +               .name           = "external",
> +               .mmc            = 1,
> +               .caps           = MMC_CAP_4_BIT_DATA,
> +               .gpio_cd        = -EINVAL,
> +               .gpio_wp        = -EINVAL,
> +               .power_saving   = true,
> +       },
> +       {
> +               .name           = "internal",
> +               .mmc            = 3,
> +               .caps           = MMC_CAP_4_BIT_DATA,
> +               .gpio_cd        = -EINVAL,
> +               .gpio_wp        = -EINVAL,
> +               .nonremovable   = true,
> +               .power_saving   = true,
> +       },
> +       {}      /* Terminator */
> +};
> +
> +static int encore_hsmmc_card_detect(struct device *dev, int slot)
> +{
> +       struct omap_mmc_platform_data *mmc = dev->platform_data;
> +
> +       /* Encore board EVT2 and later has pin high when card is present) */
> +       return gpio_get_value_cansleep(mmc->slots[0].switch_pin);
> +}
> +
> +static int encore_twl4030_hsmmc_late_init(struct device *dev)
> +{
> +        int ret = 0;
> +        struct platform_device *pdev = container_of(dev,
> +                                struct platform_device, dev);
> +        struct omap_mmc_platform_data *pdata = dev->platform_data;
> +
> +       if(is_encore_board_evt2()) {
> +               /* Setting MMC1 (external) Card detect */
> +               if (pdev->id == 0) {
> +                       pdata->slots[0].card_detect = encore_hsmmc_card_detect;
> +               }
> +       }
> +        return ret;
> +}
> +
> +static __init void encore_hsmmc_set_late_init(struct device *dev)
> +{
> +       struct omap_mmc_platform_data *pdata;
> +
> +       /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
> +       if (!dev)
> +               return;
> +
> +       pdata = dev->platform_data;
> +       pdata->init = encore_twl4030_hsmmc_late_init;
> +}
> +
> +static int __ref encore_twl_gpio_setup(struct device *dev,
> +               unsigned gpio, unsigned ngpio)
> +{
> +       struct omap2_hsmmc_info *c;
> +       /*
> +        * gpio + 0 is "mmc0_cd" (input/IRQ),
> +        * gpio + 1 is "mmc1_cd" (input/IRQ)
> +        */
> +       mmc[1].gpio_cd = gpio + 0;
> +       mmc[0].gpio_cd = gpio + 1;
> +       omap2_hsmmc_init(mmc);
> +       for (c = mmc; c->mmc; c++)
> +                encore_hsmmc_set_late_init(c->dev);
> +
> +       /*
> +        * link regulators to MMC adapters ... we "know" the
> +        * regulators will be set up only *after* we return.
> +        */
> +       encore_vmmc1_supply.dev = mmc[1].dev;
> +
> +       return 0;
> +}
> +
> +static struct twl4030_gpio_platform_data encore_gpio_data = {
> +       .gpio_base      = OMAP_MAX_GPIO_LINES,
> +       .irq_base       = TWL4030_GPIO_IRQ_BASE,
> +       .irq_end        = TWL4030_GPIO_IRQ_END,
> +       .setup          = encore_twl_gpio_setup,
> +};
> +
> +static struct twl4030_madc_platform_data encore_madc_data = {
> +       .irq_line       = 1,
> +};
> +
> +static struct twl4030_platform_data __refdata encore_twldata = {
> +       .irq_base       = TWL4030_IRQ_BASE,
> +       .irq_end        = TWL4030_IRQ_END,
> +
> +       .madc           = &encore_madc_data,
> +       .usb            = &encore_usb_data,
> +       .gpio           = &encore_gpio_data,
> +       .keypad         = &encore_kp_twl4030_data,
> +       .vmmc1          = &encore_vmmc1,
> +       .vdac           = &encore_vdac,
> +};
> +
> +static struct i2c_board_info __initdata encore_i2c_bus1_info[] = {
> +       {
> +               I2C_BOARD_INFO("tps65921", 0x48),
> +               .flags = I2C_CLIENT_WAKE,
> +               .irq = INT_34XX_SYS_NIRQ,
> +               .platform_data = &encore_twldata,
> +       },
> +};
> +
> +static struct i2c_board_info __initdata encore_i2c_bus2_info[] = {
> +};
> +
> +
> +static struct omap_musb_board_data musb_board_data = {
> +       .interface_type         = MUSB_INTERFACE_ULPI,
> +#ifdef CONFIG_USB_MUSB_OTG
> +       .mode                   = MUSB_OTG,
> +#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
> +       .mode                   = MUSB_HOST,
> +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
> +       .mode                   = MUSB_PERIPHERAL,
> +#endif
> +       .power                  = 100,
> +};
> +
> +#ifdef CONFIG_OMAP_MUX
> +static struct omap_board_mux board_mux[] __initdata = {
> +        { .reg_offset = OMAP_MUX_TERMINATOR },
> +};
> +#else
> +#define board_mux       NULL
> +#endif
> +
> +static struct omap_board_config_kernel encore_config[] __initdata = {
> +};
> +
> +static int __init omap_i2c_init(void)
> +{
> +       omap_register_i2c_bus(1, 100, encore_i2c_bus1_info,
> +                       ARRAY_SIZE(encore_i2c_bus1_info));
> +       omap_register_i2c_bus(2, 400, encore_i2c_bus2_info,
> +                       ARRAY_SIZE(encore_i2c_bus2_info));
> +       return 0;
> +}
> +
> +static void __init omap_encore_init(void)
> +{
> +       omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
> +       omap_i2c_init();
> +       omap_serial_init();
> +       usb_musb_init(&musb_board_data);
> +
> +       omap_board_config = encore_config;
> +       omap_board_config_size = ARRAY_SIZE(encore_config);
> +
> +       platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
> +}
> +
> +MACHINE_START(ENCORE, "encore")
> +       .boot_params    = 0x80000100,
> +       .reserve        = omap_reserve,
> +       .map_io         = omap3_map_io,
> +       .init_early     = omap_encore_init_early,
> +       .init_irq       = omap_init_irq,
> +       .init_machine   = omap_encore_init,
> +       .timer          = &omap_timer,
> +MACHINE_END
> diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
> index 30b891c..f2de4ff 100644
> --- a/arch/arm/plat-omap/include/plat/uncompress.h
> +++ b/arch/arm/plat-omap/include/plat/uncompress.h
> @@ -161,6 +161,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
>                DEBUG_LL_OMAP3(3, omap_ldp);
>                DEBUG_LL_OMAP3(3, overo);
>                DEBUG_LL_OMAP3(3, touchbook);
> +               DEBUG_LL_OMAP3(3, encore);
>
>                /* omap4 based boards using UART3 */
>                DEBUG_LL_OMAP4(3, omap_4430sdp);
> diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
> index 7ca41f0..2f0db3e 100644
> --- a/arch/arm/tools/mach-types
> +++ b/arch/arm/tools/mach-types
> @@ -962,7 +962,7 @@ omapl138_case_a3    MACH_OMAPL138_CASE_A3   OMAPL138_CASE_A3        3280
>  uemd                   MACH_UEMD               UEMD                    3281
>  ccwmx51mut             MACH_CCWMX51MUT         CCWMX51MUT              3282
>  rockhopper             MACH_ROCKHOPPER         ROCKHOPPER              3283
> -nookcolor              MACH_NOOKCOLOR          NOOKCOLOR               3284
> +encore                 MACH_ENCORE             ENCORE                  3284
>  hkdkc100               MACH_HKDKC100           HKDKC100                3285
>  ts42xx                 MACH_TS42XX             TS42XX                  3286
>  aebl                   MACH_AEBL               AEBL                    3287
> --
> 1.7.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-04-28 23:34   ` Abimanyu Gottumukkala
@ 2011-04-29  0:49     ` Oleg Drokin
  2011-05-03 11:08       ` Vladimir Pantelic
  0 siblings, 1 reply; 16+ messages in thread
From: Oleg Drokin @ 2011-04-29  0:49 UTC (permalink / raw)
  To: Abimanyu Gottumukkala; +Cc: linux-omap

Hello!

  Is there any special support needed for 3621, though?
  My understanding is that's just 3630 without a "phone" part?
  The .29 kernel they had only added is_omap3621 stuff that's not
  called anywhere, but smartreflex code (I guess that's might be
  useful to add too of course).

  I know about the new code drop is coming, but I don't
  expect there to be any basic stuff changes (and this board file
  is coming pretty barebones right now), besides I am not so
  optimistic to actually expect this patch to be merged right away,
  but I am already gathering valuable feedback. ;)

  BTW I saw in the archives that you are also working a port,
  do you have your tree hosted anywhere?

Bye,
    Oleg
On Apr 28, 2011, at 7:34 PM, Abimanyu Gottumukkala wrote:

> Hi,
> 
> Nook color has Ti OMAP 3621. 3621 CPU Support is not available in
> current kernel, adding CPU support will be nice before board.
> BN is set to release new source code in few days, taking new code as
> porting base is also recommended.
> 
> Regards,
> Abimanyu G
> 
> On Thu, Apr 28, 2011 at 9:27 PM,  <green@linuxhacker.ru> wrote:
>> From: Oleg Drokin <green@linuxhacker.ru>
>> 
>> Bare-bones board file, comes with serial console, gpio keys,
>> MMC/SDCard and USB support.
>> ---
>>  arch/arm/mach-omap2/Kconfig                  |    5 +
>>  arch/arm/mach-omap2/Makefile                 |    2 +
>>  arch/arm/mach-omap2/board-omap3encore.c      |  380 ++++++++++++++++++++++++++
>>  arch/arm/plat-omap/include/plat/uncompress.h |    1 +
>>  arch/arm/tools/mach-types                    |    2 +-
>>  5 files changed, 389 insertions(+), 1 deletions(-)
>>  create mode 100644 arch/arm/mach-omap2/board-omap3encore.c
>> 
>> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
>> index b997a35..5370561 100644
>> --- a/arch/arm/mach-omap2/Kconfig
>> +++ b/arch/arm/mach-omap2/Kconfig
>> @@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
>>         for full description please see the products webpage at
>>         http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
>> 
>> +config MACH_ENCORE
>> +        bool "Barnes & Noble Encore (Nook Color)"
>> +        depends on ARCH_OMAP3
>> +        select OMAP_PACKAGE_CBP
>> +
>>  config MACH_OVERO
>>        bool "Gumstix Overo board"
>>        depends on ARCH_OMAP3
>> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
>> index 512b152..b894777 100644
>> --- a/arch/arm/mach-omap2/Makefile
>> +++ b/arch/arm/mach-omap2/Makefile
>> @@ -189,6 +189,8 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
>>                                           hsmmc.o
>>  obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
>>                                           hsmmc.o
>> +obj-$(CONFIG_MACH_ENCORE)              += board-omap3encore.o \
>> +                                          hsmmc.o
>>  obj-$(CONFIG_MACH_OVERO)               += board-overo.o \
>>                                           hsmmc.o
>>  obj-$(CONFIG_MACH_OMAP3EVM)            += board-omap3evm.o \
>> diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
>> new file mode 100644
>> index 0000000..c7bf8de
>> --- /dev/null
>> +++ b/arch/arm/mach-omap2/board-omap3encore.c
>> @@ -0,0 +1,380 @@
>> +/*
>> + *
>> + * Copyright (C) 2008 Texas Instruments Inc.
>> + * Vikram Pandita <vikram.pandita@ti.com>
>> + *
>> + * Modified from mach-omap2/board-ldp.c
>> + *
>> + * 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.
>> + *
>> + * April 2011 Oleg Drokin <green@linuxhacker.ru> - Port to 2.6.39
>> + *
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/gpio_keys.h>
>> +#include <linux/err.h>
>> +
>> +#include <linux/spi/spi.h>
>> +#include <linux/i2c/twl.h>
>> +#include <linux/regulator/machine.h>
>> +#include <linux/regulator/fixed.h>
>> +#include <mach/hardware.h>
>> +#include <asm/mach-types.h>
>> +#include <asm/mach/arch.h>
>> +
>> +#include <mach/gpio.h>
>> +#include <plat/board.h>
>> +#include <plat/common.h>
>> +#include <plat/usb.h>
>> +#include <plat/mux.h>
>> +#include <plat/sram.h>
>> +#include <plat/mmc.h>
>> +#include <plat/omap-serial.h>
>> +#include <plat/system.h>
>> +
>> +#include "mux.h"
>> +#include "hsmmc.h"
>> +#include "sdram-hynix-h8mbx00u0mer-0em.h"
>> +
>> +/* Encore-specific device-info and i2c addresses. */
>> +/* Battery, bus 1 */
>> +#define MAX17042_I2C_SLAVE_ADDRESS     0x36
>> +#define MAX17042_GPIO_FOR_IRQ          100
>> +
>> +/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
>> +#define MAX8903_UOK_GPIO_FOR_IRQ       115
>> +#define MAX8903_DOK_GPIO_FOR_IRQ       114
>> +#define MAX8903_GPIO_CHG_EN            110
>> +#define MAX8903_GPIO_CHG_STATUS                111
>> +#define MAX8903_GPIO_CHG_FLT           101
>> +#define MAX8903_GPIO_CHG_IUSB          102
>> +#define MAX8903_GPIO_CHG_USUS          104
>> +#define MAX8903_GPIO_CHG_ILM           61
>> +
>> +/* TI WLAN */
>> +#define ENCORE_WIFI_PMENA_GPIO         22
>> +#define ENCORE_WIFI_IRQ_GPIO           15
>> +#define ENCORE_WIFI_EN_POW             16
>> +
>> +/* Accelerometer i2c bus 1*/
>> +#define KXTF9_I2C_SLAVE_ADDRESS                0x0F
>> +#define KXTF9_GPIO_FOR_PWR             34
>> +#define KXTF9_GPIO_FOR_IRQ             113
>> +
>> +/* Touch screen i2c bus 2*/
>> +#define CYTTSP_I2C_SLAVEADDRESS                34
>> +#define ENCORE_CYTTSP_GPIO             99
>> +#define ENCORE_CYTTSP_RESET_GPIO       46
>> +
>> +/* Audio codec, i2c bus 2 */
>> +#define AUDIO_CODEC_POWER_ENABLE_GPIO  103
>> +#define AUDIO_CODEC_RESET_GPIO         37
>> +#define AUDIO_CODEC_IRQ_GPIO           59
>> +#define AIC3100_I2CSLAVEADDRESS                0x18
>> +
>> +
>> +/* Different HW revisions */
>> +#define BOARD_ENCORE_REV_EVT1A         0x1
>> +#define BOARD_ENCORE_REV_EVT1B         0x2
>> +#define BOARD_ENCORE_REV_EVT2          0x3
>> +#define BOARD_ENCORE_REV_DVT           0x4
>> +#define BOARD_ENCORE_REV_PVT           0x5
>> +#define BOARD_ENCORE_REV_UNKNOWN       0x6
>> +
>> +static inline int is_encore_board_evt2(void)
>> +{
>> +    return (system_rev >= BOARD_ENCORE_REV_EVT2);
>> +}
>> +
>> +static inline int is_encore_board_evt1b(void)
>> +{
>> +    return (system_rev == BOARD_ENCORE_REV_EVT1B);
>> +}
>> +
>> +static int encore_twl4030_keymap[] = {
>> +       KEY(0, 0, KEY_HOME),
>> +       KEY(0, 1, KEY_VOLUMEUP),
>> +       KEY(0, 2, KEY_VOLUMEDOWN),
>> +       0
>> +};
>> +
>> +static struct matrix_keymap_data encore_twl4030_keymap_data = {
>> +       .keymap                 = encore_twl4030_keymap,
>> +       .keymap_size    = ARRAY_SIZE(encore_twl4030_keymap),
>> +};
>> +
>> +static struct twl4030_keypad_data encore_kp_twl4030_data = {
>> +       .rows                   = 8,
>> +       .cols                   = 8,
>> +       .keymap_data            = &encore_twl4030_keymap_data,
>> +       .rep                    = 1,
>> +};
>> +
>> +/* HOME key code for HW > EVT2A */
>> +static struct gpio_keys_button encore_gpio_buttons[] = {
>> +       {
>> +               .code                   = KEY_POWER,
>> +               .gpio                   = 14,
>> +               .desc                   = "POWER",
>> +               .active_low             = 0,
>> +               .wakeup                 = 1,
>> +       },
>> +       {
>> +               .code                   = KEY_HOME,
>> +               .gpio                   = 48,
>> +               .desc                   = "HOME",
>> +               .active_low             = 1,
>> +               .wakeup                 = 1,
>> +       },
>> +};
>> +
>> +static struct gpio_keys_platform_data encore_gpio_key_info = {
>> +       .buttons        = encore_gpio_buttons,
>> +       .nbuttons       = ARRAY_SIZE(encore_gpio_buttons),
>> +};
>> +
>> +static struct platform_device encore_keys_gpio = {
>> +       .name   = "gpio-keys",
>> +       .id     = -1,
>> +       .dev    = {
>> +               .platform_data  = &encore_gpio_key_info,
>> +       },
>> +};
>> +
>> +static struct platform_device *encore_devices[] __initdata = {
>> +       &encore_keys_gpio,
>> +};
>> +
>> +static void __init omap_encore_init_early(void)
>> +{
>> +       omap2_init_common_infrastructure();
>> +       omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
>> +                                 h8mbx00u0mer0em_sdrc_params);
>> +}
>> +
>> +static struct twl4030_usb_data encore_usb_data = {
>> +      .usb_mode        = T2_USB_MODE_ULPI,
>> +};
>> +
>> +static struct regulator_consumer_supply encore_vmmc1_supply = {
>> +       .supply         = "vmmc",
>> +};
>> +
>> +static struct regulator_consumer_supply encore_vdda_dac_supply =
>> +       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
>> +
>> +/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
>> +static struct regulator_init_data encore_vmmc1 = {
>> +       .constraints = {
>> +               .min_uV                 = 1850000,
>> +               .max_uV                 = 3150000,
>> +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
>> +                                       | REGULATOR_MODE_STANDBY,
>> +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
>> +                                       | REGULATOR_CHANGE_MODE
>> +                                       | REGULATOR_CHANGE_STATUS,
>> +       },
>> +       .num_consumer_supplies  = 1,
>> +       .consumer_supplies      = &encore_vmmc1_supply,
>> +};
>> +
>> +static struct regulator_init_data encore_vdac = {
>> +       .constraints = {
>> +               .min_uV                 = 1800000,
>> +               .max_uV                 = 1800000,
>> +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
>> +                                       | REGULATOR_MODE_STANDBY,
>> +               .valid_ops_mask         = REGULATOR_CHANGE_MODE
>> +                                       | REGULATOR_CHANGE_STATUS,
>> +       },
>> +       .num_consumer_supplies  = 1,
>> +       .consumer_supplies      = &encore_vdda_dac_supply,
>> +};
>> +
>> +/* The order is reverted in this table so that internal eMMC is presented
>> + * as first mmc card for compatibility with existing installations and
>> + * for common sense reasons */
>> +static struct omap2_hsmmc_info mmc[] __initdata = {
>> +       {
>> +               .name           = "internal",
>> +               .mmc            = 2,
>> +               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
>> +               .gpio_cd        = -EINVAL,
>> +               .gpio_wp        = -EINVAL,
>> +               .nonremovable   = true,
>> +               .power_saving   = true,
>> +               .ocr_mask       = MMC_VDD_165_195, /* 1.85V */
>> +       },
>> +       {
>> +               .name           = "external",
>> +               .mmc            = 1,
>> +               .caps           = MMC_CAP_4_BIT_DATA,
>> +               .gpio_cd        = -EINVAL,
>> +               .gpio_wp        = -EINVAL,
>> +               .power_saving   = true,
>> +       },
>> +       {
>> +               .name           = "internal",
>> +               .mmc            = 3,
>> +               .caps           = MMC_CAP_4_BIT_DATA,
>> +               .gpio_cd        = -EINVAL,
>> +               .gpio_wp        = -EINVAL,
>> +               .nonremovable   = true,
>> +               .power_saving   = true,
>> +       },
>> +       {}      /* Terminator */
>> +};
>> +
>> +static int encore_hsmmc_card_detect(struct device *dev, int slot)
>> +{
>> +       struct omap_mmc_platform_data *mmc = dev->platform_data;
>> +
>> +       /* Encore board EVT2 and later has pin high when card is present) */
>> +       return gpio_get_value_cansleep(mmc->slots[0].switch_pin);
>> +}
>> +
>> +static int encore_twl4030_hsmmc_late_init(struct device *dev)
>> +{
>> +        int ret = 0;
>> +        struct platform_device *pdev = container_of(dev,
>> +                                struct platform_device, dev);
>> +        struct omap_mmc_platform_data *pdata = dev->platform_data;
>> +
>> +       if(is_encore_board_evt2()) {
>> +               /* Setting MMC1 (external) Card detect */
>> +               if (pdev->id == 0) {
>> +                       pdata->slots[0].card_detect = encore_hsmmc_card_detect;
>> +               }
>> +       }
>> +        return ret;
>> +}
>> +
>> +static __init void encore_hsmmc_set_late_init(struct device *dev)
>> +{
>> +       struct omap_mmc_platform_data *pdata;
>> +
>> +       /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
>> +       if (!dev)
>> +               return;
>> +
>> +       pdata = dev->platform_data;
>> +       pdata->init = encore_twl4030_hsmmc_late_init;
>> +}
>> +
>> +static int __ref encore_twl_gpio_setup(struct device *dev,
>> +               unsigned gpio, unsigned ngpio)
>> +{
>> +       struct omap2_hsmmc_info *c;
>> +       /*
>> +        * gpio + 0 is "mmc0_cd" (input/IRQ),
>> +        * gpio + 1 is "mmc1_cd" (input/IRQ)
>> +        */
>> +       mmc[1].gpio_cd = gpio + 0;
>> +       mmc[0].gpio_cd = gpio + 1;
>> +       omap2_hsmmc_init(mmc);
>> +       for (c = mmc; c->mmc; c++)
>> +                encore_hsmmc_set_late_init(c->dev);
>> +
>> +       /*
>> +        * link regulators to MMC adapters ... we "know" the
>> +        * regulators will be set up only *after* we return.
>> +        */
>> +       encore_vmmc1_supply.dev = mmc[1].dev;
>> +
>> +       return 0;
>> +}
>> +
>> +static struct twl4030_gpio_platform_data encore_gpio_data = {
>> +       .gpio_base      = OMAP_MAX_GPIO_LINES,
>> +       .irq_base       = TWL4030_GPIO_IRQ_BASE,
>> +       .irq_end        = TWL4030_GPIO_IRQ_END,
>> +       .setup          = encore_twl_gpio_setup,
>> +};
>> +
>> +static struct twl4030_madc_platform_data encore_madc_data = {
>> +       .irq_line       = 1,
>> +};
>> +
>> +static struct twl4030_platform_data __refdata encore_twldata = {
>> +       .irq_base       = TWL4030_IRQ_BASE,
>> +       .irq_end        = TWL4030_IRQ_END,
>> +
>> +       .madc           = &encore_madc_data,
>> +       .usb            = &encore_usb_data,
>> +       .gpio           = &encore_gpio_data,
>> +       .keypad         = &encore_kp_twl4030_data,
>> +       .vmmc1          = &encore_vmmc1,
>> +       .vdac           = &encore_vdac,
>> +};
>> +
>> +static struct i2c_board_info __initdata encore_i2c_bus1_info[] = {
>> +       {
>> +               I2C_BOARD_INFO("tps65921", 0x48),
>> +               .flags = I2C_CLIENT_WAKE,
>> +               .irq = INT_34XX_SYS_NIRQ,
>> +               .platform_data = &encore_twldata,
>> +       },
>> +};
>> +
>> +static struct i2c_board_info __initdata encore_i2c_bus2_info[] = {
>> +};
>> +
>> +
>> +static struct omap_musb_board_data musb_board_data = {
>> +       .interface_type         = MUSB_INTERFACE_ULPI,
>> +#ifdef CONFIG_USB_MUSB_OTG
>> +       .mode                   = MUSB_OTG,
>> +#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
>> +       .mode                   = MUSB_HOST,
>> +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
>> +       .mode                   = MUSB_PERIPHERAL,
>> +#endif
>> +       .power                  = 100,
>> +};
>> +
>> +#ifdef CONFIG_OMAP_MUX
>> +static struct omap_board_mux board_mux[] __initdata = {
>> +        { .reg_offset = OMAP_MUX_TERMINATOR },
>> +};
>> +#else
>> +#define board_mux       NULL
>> +#endif
>> +
>> +static struct omap_board_config_kernel encore_config[] __initdata = {
>> +};
>> +
>> +static int __init omap_i2c_init(void)
>> +{
>> +       omap_register_i2c_bus(1, 100, encore_i2c_bus1_info,
>> +                       ARRAY_SIZE(encore_i2c_bus1_info));
>> +       omap_register_i2c_bus(2, 400, encore_i2c_bus2_info,
>> +                       ARRAY_SIZE(encore_i2c_bus2_info));
>> +       return 0;
>> +}
>> +
>> +static void __init omap_encore_init(void)
>> +{
>> +       omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
>> +       omap_i2c_init();
>> +       omap_serial_init();
>> +       usb_musb_init(&musb_board_data);
>> +
>> +       omap_board_config = encore_config;
>> +       omap_board_config_size = ARRAY_SIZE(encore_config);
>> +
>> +       platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
>> +}
>> +
>> +MACHINE_START(ENCORE, "encore")
>> +       .boot_params    = 0x80000100,
>> +       .reserve        = omap_reserve,
>> +       .map_io         = omap3_map_io,
>> +       .init_early     = omap_encore_init_early,
>> +       .init_irq       = omap_init_irq,
>> +       .init_machine   = omap_encore_init,
>> +       .timer          = &omap_timer,
>> +MACHINE_END
>> diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
>> index 30b891c..f2de4ff 100644
>> --- a/arch/arm/plat-omap/include/plat/uncompress.h
>> +++ b/arch/arm/plat-omap/include/plat/uncompress.h
>> @@ -161,6 +161,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
>>                DEBUG_LL_OMAP3(3, omap_ldp);
>>                DEBUG_LL_OMAP3(3, overo);
>>                DEBUG_LL_OMAP3(3, touchbook);
>> +               DEBUG_LL_OMAP3(3, encore);
>> 
>>                /* omap4 based boards using UART3 */
>>                DEBUG_LL_OMAP4(3, omap_4430sdp);
>> diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
>> index 7ca41f0..2f0db3e 100644
>> --- a/arch/arm/tools/mach-types
>> +++ b/arch/arm/tools/mach-types
>> @@ -962,7 +962,7 @@ omapl138_case_a3    MACH_OMAPL138_CASE_A3   OMAPL138_CASE_A3        3280
>>  uemd                   MACH_UEMD               UEMD                    3281
>>  ccwmx51mut             MACH_CCWMX51MUT         CCWMX51MUT              3282
>>  rockhopper             MACH_ROCKHOPPER         ROCKHOPPER              3283
>> -nookcolor              MACH_NOOKCOLOR          NOOKCOLOR               3284
>> +encore                 MACH_ENCORE             ENCORE                  3284
>>  hkdkc100               MACH_HKDKC100           HKDKC100                3285
>>  ts42xx                 MACH_TS42XX             TS42XX                  3286
>>  aebl                   MACH_AEBL               AEBL                    3287
>> --
>> 1.7.4.4
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-04-28 15:57 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
  2011-04-28 23:34   ` Abimanyu Gottumukkala
@ 2011-05-03  9:22   ` Tony Lindgren
  1 sibling, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2011-05-03  9:22 UTC (permalink / raw)
  To: green; +Cc: linux-omap

* green@linuxhacker.ru <green@linuxhacker.ru> [110428 08:55]:
> From: Oleg Drokin <green@linuxhacker.ru>
> 
> Bare-bones board file, comes with serial console, gpio keys,
> MMC/SDCard and USB support.

Good to see that. Unfortunately you probably have to do few
more rebases on the devel-cleanup branch because of the code
consolidation effort. We'll have to wait a bit and see what
new platform code we can merge after that is all the
consolidation is sorted out.

Please also post your series with linux-arm-kernel mailing
list Cc'd. Few comments below too.

> +#include <mach/gpio.h>

This should be linux/gpio.h nowadays.

> +	if(is_encore_board_evt2()) {

You should have if ( here with space.

Maybe run scripts/checkpatch.pl --strict on the patch?

> --- a/arch/arm/tools/mach-types
> +++ b/arch/arm/tools/mach-types
> @@ -962,7 +962,7 @@ omapl138_case_a3	MACH_OMAPL138_CASE_A3	OMAPL138_CASE_A3	3280
>  uemd			MACH_UEMD		UEMD			3281
>  ccwmx51mut		MACH_CCWMX51MUT		CCWMX51MUT		3282
>  rockhopper		MACH_ROCKHOPPER		ROCKHOPPER		3283
> -nookcolor		MACH_NOOKCOLOR		NOOKCOLOR		3284
> +encore			MACH_ENCORE		ENCORE			3284
>  hkdkc100		MACH_HKDKC100		HKDKC100		3285
>  ts42xx			MACH_TS42XX		TS42XX			3286
>  aebl			MACH_AEBL		AEBL			3287

For this you need to follow the instructions at www.arm.linux.org.uk.

Regards,

Tony

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-04-29  0:49     ` Oleg Drokin
@ 2011-05-03 11:08       ` Vladimir Pantelic
  0 siblings, 0 replies; 16+ messages in thread
From: Vladimir Pantelic @ 2011-05-03 11:08 UTC (permalink / raw)
  To: Oleg Drokin; +Cc: Abimanyu Gottumukkala, linux-omap

Oleg Drokin wrote:
> Hello!
>
>    Is there any special support needed for 3621, though?
>    My understanding is that's just 3630 without a "phone" part?

3621 is more or less a 3630 in a different package, less pins,
0.5mm ball pitch and no PoP option.

>    The .29 kernel they had only added is_omap3621 stuff that's not
>    called anywhere, but smartreflex code (I guess that's might be
>    useful to add too of course).
>
>    I know about the new code drop is coming, but I don't
>    expect there to be any basic stuff changes (and this board file
>    is coming pretty barebones right now), besides I am not so
>    optimistic to actually expect this patch to be merged right away,
>    but I am already gathering valuable feedback. ;)
>
>    BTW I saw in the archives that you are also working a port,
>    do you have your tree hosted anywhere?
>
> Bye,
>      Oleg
> On Apr 28, 2011, at 7:34 PM, Abimanyu Gottumukkala wrote:
>
>>  Hi,
>>
>>  Nook color has Ti OMAP 3621. 3621 CPU Support is not available in
>>  current kernel, adding CPU support will be nice before board.
>>  BN is set to release new source code in few days, taking new code as
>>  porting base is also recommended.
>>
>>  Regards,
>>  Abimanyu G
>>
>>  On Thu, Apr 28, 2011 at 9:27 PM,<green@linuxhacker.ru>  wrote:
>>>  From: Oleg Drokin<green@linuxhacker.ru>
>>>
>>>  Bare-bones board file, comes with serial console, gpio keys,
>>>  MMC/SDCard and USB support.
>>>  ---
>>>   arch/arm/mach-omap2/Kconfig                  |    5 +
>>>   arch/arm/mach-omap2/Makefile                 |    2 +
>>>   arch/arm/mach-omap2/board-omap3encore.c      |  380 ++++++++++++++++++++++++++
>>>   arch/arm/plat-omap/include/plat/uncompress.h |    1 +
>>>   arch/arm/tools/mach-types                    |    2 +-
>>>   5 files changed, 389 insertions(+), 1 deletions(-)
>>>   create mode 100644 arch/arm/mach-omap2/board-omap3encore.c
>>>
>>>  diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
>>>  index b997a35..5370561 100644
>>>  --- a/arch/arm/mach-omap2/Kconfig
>>>  +++ b/arch/arm/mach-omap2/Kconfig
>>>  @@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
>>>          for full description please see the products webpage at
>>>          http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
>>>
>>>  +config MACH_ENCORE
>>>  +        bool "Barnes&  Noble Encore (Nook Color)"
>>>  +        depends on ARCH_OMAP3
>>>  +        select OMAP_PACKAGE_CBP
>>>  +
>>>   config MACH_OVERO
>>>         bool "Gumstix Overo board"
>>>         depends on ARCH_OMAP3
>>>  diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
>>>  index 512b152..b894777 100644
>>>  --- a/arch/arm/mach-omap2/Makefile
>>>  +++ b/arch/arm/mach-omap2/Makefile
>>>  @@ -189,6 +189,8 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
>>>                                            hsmmc.o
>>>   obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
>>>                                            hsmmc.o
>>>  +obj-$(CONFIG_MACH_ENCORE)              += board-omap3encore.o \
>>>  +                                          hsmmc.o
>>>   obj-$(CONFIG_MACH_OVERO)               += board-overo.o \
>>>                                            hsmmc.o
>>>   obj-$(CONFIG_MACH_OMAP3EVM)            += board-omap3evm.o \
>>>  diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
>>>  new file mode 100644
>>>  index 0000000..c7bf8de
>>>  --- /dev/null
>>>  +++ b/arch/arm/mach-omap2/board-omap3encore.c
>>>  @@ -0,0 +1,380 @@
>>>  +/*
>>>  + *
>>>  + * Copyright (C) 2008 Texas Instruments Inc.
>>>  + * Vikram Pandita<vikram.pandita@ti.com>
>>>  + *
>>>  + * Modified from mach-omap2/board-ldp.c
>>>  + *
>>>  + * 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.
>>>  + *
>>>  + * April 2011 Oleg Drokin<green@linuxhacker.ru>  - Port to 2.6.39
>>>  + *
>>>  + */
>>>  +
>>>  +#include<linux/kernel.h>
>>>  +#include<linux/platform_device.h>
>>>  +#include<linux/gpio_keys.h>
>>>  +#include<linux/err.h>
>>>  +
>>>  +#include<linux/spi/spi.h>
>>>  +#include<linux/i2c/twl.h>
>>>  +#include<linux/regulator/machine.h>
>>>  +#include<linux/regulator/fixed.h>
>>>  +#include<mach/hardware.h>
>>>  +#include<asm/mach-types.h>
>>>  +#include<asm/mach/arch.h>
>>>  +
>>>  +#include<mach/gpio.h>
>>>  +#include<plat/board.h>
>>>  +#include<plat/common.h>
>>>  +#include<plat/usb.h>
>>>  +#include<plat/mux.h>
>>>  +#include<plat/sram.h>
>>>  +#include<plat/mmc.h>
>>>  +#include<plat/omap-serial.h>
>>>  +#include<plat/system.h>
>>>  +
>>>  +#include "mux.h"
>>>  +#include "hsmmc.h"
>>>  +#include "sdram-hynix-h8mbx00u0mer-0em.h"
>>>  +
>>>  +/* Encore-specific device-info and i2c addresses. */
>>>  +/* Battery, bus 1 */
>>>  +#define MAX17042_I2C_SLAVE_ADDRESS     0x36
>>>  +#define MAX17042_GPIO_FOR_IRQ          100
>>>  +
>>>  +/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
>>>  +#define MAX8903_UOK_GPIO_FOR_IRQ       115
>>>  +#define MAX8903_DOK_GPIO_FOR_IRQ       114
>>>  +#define MAX8903_GPIO_CHG_EN            110
>>>  +#define MAX8903_GPIO_CHG_STATUS                111
>>>  +#define MAX8903_GPIO_CHG_FLT           101
>>>  +#define MAX8903_GPIO_CHG_IUSB          102
>>>  +#define MAX8903_GPIO_CHG_USUS          104
>>>  +#define MAX8903_GPIO_CHG_ILM           61
>>>  +
>>>  +/* TI WLAN */
>>>  +#define ENCORE_WIFI_PMENA_GPIO         22
>>>  +#define ENCORE_WIFI_IRQ_GPIO           15
>>>  +#define ENCORE_WIFI_EN_POW             16
>>>  +
>>>  +/* Accelerometer i2c bus 1*/
>>>  +#define KXTF9_I2C_SLAVE_ADDRESS                0x0F
>>>  +#define KXTF9_GPIO_FOR_PWR             34
>>>  +#define KXTF9_GPIO_FOR_IRQ             113
>>>  +
>>>  +/* Touch screen i2c bus 2*/
>>>  +#define CYTTSP_I2C_SLAVEADDRESS                34
>>>  +#define ENCORE_CYTTSP_GPIO             99
>>>  +#define ENCORE_CYTTSP_RESET_GPIO       46
>>>  +
>>>  +/* Audio codec, i2c bus 2 */
>>>  +#define AUDIO_CODEC_POWER_ENABLE_GPIO  103
>>>  +#define AUDIO_CODEC_RESET_GPIO         37
>>>  +#define AUDIO_CODEC_IRQ_GPIO           59
>>>  +#define AIC3100_I2CSLAVEADDRESS                0x18
>>>  +
>>>  +
>>>  +/* Different HW revisions */
>>>  +#define BOARD_ENCORE_REV_EVT1A         0x1
>>>  +#define BOARD_ENCORE_REV_EVT1B         0x2
>>>  +#define BOARD_ENCORE_REV_EVT2          0x3
>>>  +#define BOARD_ENCORE_REV_DVT           0x4
>>>  +#define BOARD_ENCORE_REV_PVT           0x5
>>>  +#define BOARD_ENCORE_REV_UNKNOWN       0x6
>>>  +
>>>  +static inline int is_encore_board_evt2(void)
>>>  +{
>>>  +    return (system_rev>= BOARD_ENCORE_REV_EVT2);
>>>  +}
>>>  +
>>>  +static inline int is_encore_board_evt1b(void)
>>>  +{
>>>  +    return (system_rev == BOARD_ENCORE_REV_EVT1B);
>>>  +}
>>>  +
>>>  +static int encore_twl4030_keymap[] = {
>>>  +       KEY(0, 0, KEY_HOME),
>>>  +       KEY(0, 1, KEY_VOLUMEUP),
>>>  +       KEY(0, 2, KEY_VOLUMEDOWN),
>>>  +       0
>>>  +};
>>>  +
>>>  +static struct matrix_keymap_data encore_twl4030_keymap_data = {
>>>  +       .keymap                 = encore_twl4030_keymap,
>>>  +       .keymap_size    = ARRAY_SIZE(encore_twl4030_keymap),
>>>  +};
>>>  +
>>>  +static struct twl4030_keypad_data encore_kp_twl4030_data = {
>>>  +       .rows                   = 8,
>>>  +       .cols                   = 8,
>>>  +       .keymap_data            =&encore_twl4030_keymap_data,
>>>  +       .rep                    = 1,
>>>  +};
>>>  +
>>>  +/* HOME key code for HW>  EVT2A */
>>>  +static struct gpio_keys_button encore_gpio_buttons[] = {
>>>  +       {
>>>  +               .code                   = KEY_POWER,
>>>  +               .gpio                   = 14,
>>>  +               .desc                   = "POWER",
>>>  +               .active_low             = 0,
>>>  +               .wakeup                 = 1,
>>>  +       },
>>>  +       {
>>>  +               .code                   = KEY_HOME,
>>>  +               .gpio                   = 48,
>>>  +               .desc                   = "HOME",
>>>  +               .active_low             = 1,
>>>  +               .wakeup                 = 1,
>>>  +       },
>>>  +};
>>>  +
>>>  +static struct gpio_keys_platform_data encore_gpio_key_info = {
>>>  +       .buttons        = encore_gpio_buttons,
>>>  +       .nbuttons       = ARRAY_SIZE(encore_gpio_buttons),
>>>  +};
>>>  +
>>>  +static struct platform_device encore_keys_gpio = {
>>>  +       .name   = "gpio-keys",
>>>  +       .id     = -1,
>>>  +       .dev    = {
>>>  +               .platform_data  =&encore_gpio_key_info,
>>>  +       },
>>>  +};
>>>  +
>>>  +static struct platform_device *encore_devices[] __initdata = {
>>>  +&encore_keys_gpio,
>>>  +};
>>>  +
>>>  +static void __init omap_encore_init_early(void)
>>>  +{
>>>  +       omap2_init_common_infrastructure();
>>>  +       omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
>>>  +                                 h8mbx00u0mer0em_sdrc_params);
>>>  +}
>>>  +
>>>  +static struct twl4030_usb_data encore_usb_data = {
>>>  +      .usb_mode        = T2_USB_MODE_ULPI,
>>>  +};
>>>  +
>>>  +static struct regulator_consumer_supply encore_vmmc1_supply = {
>>>  +       .supply         = "vmmc",
>>>  +};
>>>  +
>>>  +static struct regulator_consumer_supply encore_vdda_dac_supply =
>>>  +       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
>>>  +
>>>  +/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
>>>  +static struct regulator_init_data encore_vmmc1 = {
>>>  +       .constraints = {
>>>  +               .min_uV                 = 1850000,
>>>  +               .max_uV                 = 3150000,
>>>  +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
>>>  +                                       | REGULATOR_MODE_STANDBY,
>>>  +               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
>>>  +                                       | REGULATOR_CHANGE_MODE
>>>  +                                       | REGULATOR_CHANGE_STATUS,
>>>  +       },
>>>  +       .num_consumer_supplies  = 1,
>>>  +       .consumer_supplies      =&encore_vmmc1_supply,
>>>  +};
>>>  +
>>>  +static struct regulator_init_data encore_vdac = {
>>>  +       .constraints = {
>>>  +               .min_uV                 = 1800000,
>>>  +               .max_uV                 = 1800000,
>>>  +               .valid_modes_mask       = REGULATOR_MODE_NORMAL
>>>  +                                       | REGULATOR_MODE_STANDBY,
>>>  +               .valid_ops_mask         = REGULATOR_CHANGE_MODE
>>>  +                                       | REGULATOR_CHANGE_STATUS,
>>>  +       },
>>>  +       .num_consumer_supplies  = 1,
>>>  +       .consumer_supplies      =&encore_vdda_dac_supply,
>>>  +};
>>>  +
>>>  +/* The order is reverted in this table so that internal eMMC is presented
>>>  + * as first mmc card for compatibility with existing installations and
>>>  + * for common sense reasons */
>>>  +static struct omap2_hsmmc_info mmc[] __initdata = {
>>>  +       {
>>>  +               .name           = "internal",
>>>  +               .mmc            = 2,
>>>  +               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
>>>  +               .gpio_cd        = -EINVAL,
>>>  +               .gpio_wp        = -EINVAL,
>>>  +               .nonremovable   = true,
>>>  +               .power_saving   = true,
>>>  +               .ocr_mask       = MMC_VDD_165_195, /* 1.85V */
>>>  +       },
>>>  +       {
>>>  +               .name           = "external",
>>>  +               .mmc            = 1,
>>>  +               .caps           = MMC_CAP_4_BIT_DATA,
>>>  +               .gpio_cd        = -EINVAL,
>>>  +               .gpio_wp        = -EINVAL,
>>>  +               .power_saving   = true,
>>>  +       },
>>>  +       {
>>>  +               .name           = "internal",
>>>  +               .mmc            = 3,
>>>  +               .caps           = MMC_CAP_4_BIT_DATA,
>>>  +               .gpio_cd        = -EINVAL,
>>>  +               .gpio_wp        = -EINVAL,
>>>  +               .nonremovable   = true,
>>>  +               .power_saving   = true,
>>>  +       },
>>>  +       {}      /* Terminator */
>>>  +};
>>>  +
>>>  +static int encore_hsmmc_card_detect(struct device *dev, int slot)
>>>  +{
>>>  +       struct omap_mmc_platform_data *mmc = dev->platform_data;
>>>  +
>>>  +       /* Encore board EVT2 and later has pin high when card is present) */
>>>  +       return gpio_get_value_cansleep(mmc->slots[0].switch_pin);
>>>  +}
>>>  +
>>>  +static int encore_twl4030_hsmmc_late_init(struct device *dev)
>>>  +{
>>>  +        int ret = 0;
>>>  +        struct platform_device *pdev = container_of(dev,
>>>  +                                struct platform_device, dev);
>>>  +        struct omap_mmc_platform_data *pdata = dev->platform_data;
>>>  +
>>>  +       if(is_encore_board_evt2()) {
>>>  +               /* Setting MMC1 (external) Card detect */
>>>  +               if (pdev->id == 0) {
>>>  +                       pdata->slots[0].card_detect = encore_hsmmc_card_detect;
>>>  +               }
>>>  +       }
>>>  +        return ret;
>>>  +}
>>>  +
>>>  +static __init void encore_hsmmc_set_late_init(struct device *dev)
>>>  +{
>>>  +       struct omap_mmc_platform_data *pdata;
>>>  +
>>>  +       /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
>>>  +       if (!dev)
>>>  +               return;
>>>  +
>>>  +       pdata = dev->platform_data;
>>>  +       pdata->init = encore_twl4030_hsmmc_late_init;
>>>  +}
>>>  +
>>>  +static int __ref encore_twl_gpio_setup(struct device *dev,
>>>  +               unsigned gpio, unsigned ngpio)
>>>  +{
>>>  +       struct omap2_hsmmc_info *c;
>>>  +       /*
>>>  +        * gpio + 0 is "mmc0_cd" (input/IRQ),
>>>  +        * gpio + 1 is "mmc1_cd" (input/IRQ)
>>>  +        */
>>>  +       mmc[1].gpio_cd = gpio + 0;
>>>  +       mmc[0].gpio_cd = gpio + 1;
>>>  +       omap2_hsmmc_init(mmc);
>>>  +       for (c = mmc; c->mmc; c++)
>>>  +                encore_hsmmc_set_late_init(c->dev);
>>>  +
>>>  +       /*
>>>  +        * link regulators to MMC adapters ... we "know" the
>>>  +        * regulators will be set up only *after* we return.
>>>  +        */
>>>  +       encore_vmmc1_supply.dev = mmc[1].dev;
>>>  +
>>>  +       return 0;
>>>  +}
>>>  +
>>>  +static struct twl4030_gpio_platform_data encore_gpio_data = {
>>>  +       .gpio_base      = OMAP_MAX_GPIO_LINES,
>>>  +       .irq_base       = TWL4030_GPIO_IRQ_BASE,
>>>  +       .irq_end        = TWL4030_GPIO_IRQ_END,
>>>  +       .setup          = encore_twl_gpio_setup,
>>>  +};
>>>  +
>>>  +static struct twl4030_madc_platform_data encore_madc_data = {
>>>  +       .irq_line       = 1,
>>>  +};
>>>  +
>>>  +static struct twl4030_platform_data __refdata encore_twldata = {
>>>  +       .irq_base       = TWL4030_IRQ_BASE,
>>>  +       .irq_end        = TWL4030_IRQ_END,
>>>  +
>>>  +       .madc           =&encore_madc_data,
>>>  +       .usb            =&encore_usb_data,
>>>  +       .gpio           =&encore_gpio_data,
>>>  +       .keypad         =&encore_kp_twl4030_data,
>>>  +       .vmmc1          =&encore_vmmc1,
>>>  +       .vdac           =&encore_vdac,
>>>  +};
>>>  +
>>>  +static struct i2c_board_info __initdata encore_i2c_bus1_info[] = {
>>>  +       {
>>>  +               I2C_BOARD_INFO("tps65921", 0x48),
>>>  +               .flags = I2C_CLIENT_WAKE,
>>>  +               .irq = INT_34XX_SYS_NIRQ,
>>>  +               .platform_data =&encore_twldata,
>>>  +       },
>>>  +};
>>>  +
>>>  +static struct i2c_board_info __initdata encore_i2c_bus2_info[] = {
>>>  +};
>>>  +
>>>  +
>>>  +static struct omap_musb_board_data musb_board_data = {
>>>  +       .interface_type         = MUSB_INTERFACE_ULPI,
>>>  +#ifdef CONFIG_USB_MUSB_OTG
>>>  +       .mode                   = MUSB_OTG,
>>>  +#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
>>>  +       .mode                   = MUSB_HOST,
>>>  +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
>>>  +       .mode                   = MUSB_PERIPHERAL,
>>>  +#endif
>>>  +       .power                  = 100,
>>>  +};
>>>  +
>>>  +#ifdef CONFIG_OMAP_MUX
>>>  +static struct omap_board_mux board_mux[] __initdata = {
>>>  +        { .reg_offset = OMAP_MUX_TERMINATOR },
>>>  +};
>>>  +#else
>>>  +#define board_mux       NULL
>>>  +#endif
>>>  +
>>>  +static struct omap_board_config_kernel encore_config[] __initdata = {
>>>  +};
>>>  +
>>>  +static int __init omap_i2c_init(void)
>>>  +{
>>>  +       omap_register_i2c_bus(1, 100, encore_i2c_bus1_info,
>>>  +                       ARRAY_SIZE(encore_i2c_bus1_info));
>>>  +       omap_register_i2c_bus(2, 400, encore_i2c_bus2_info,
>>>  +                       ARRAY_SIZE(encore_i2c_bus2_info));
>>>  +       return 0;
>>>  +}
>>>  +
>>>  +static void __init omap_encore_init(void)
>>>  +{
>>>  +       omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
>>>  +       omap_i2c_init();
>>>  +       omap_serial_init();
>>>  +       usb_musb_init(&musb_board_data);
>>>  +
>>>  +       omap_board_config = encore_config;
>>>  +       omap_board_config_size = ARRAY_SIZE(encore_config);
>>>  +
>>>  +       platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
>>>  +}
>>>  +
>>>  +MACHINE_START(ENCORE, "encore")
>>>  +       .boot_params    = 0x80000100,
>>>  +       .reserve        = omap_reserve,
>>>  +       .map_io         = omap3_map_io,
>>>  +       .init_early     = omap_encore_init_early,
>>>  +       .init_irq       = omap_init_irq,
>>>  +       .init_machine   = omap_encore_init,
>>>  +       .timer          =&omap_timer,
>>>  +MACHINE_END
>>>  diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
>>>  index 30b891c..f2de4ff 100644
>>>  --- a/arch/arm/plat-omap/include/plat/uncompress.h
>>>  +++ b/arch/arm/plat-omap/include/plat/uncompress.h
>>>  @@ -161,6 +161,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
>>>                 DEBUG_LL_OMAP3(3, omap_ldp);
>>>                 DEBUG_LL_OMAP3(3, overo);
>>>                 DEBUG_LL_OMAP3(3, touchbook);
>>>  +               DEBUG_LL_OMAP3(3, encore);
>>>
>>>                 /* omap4 based boards using UART3 */
>>>                 DEBUG_LL_OMAP4(3, omap_4430sdp);
>>>  diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
>>>  index 7ca41f0..2f0db3e 100644
>>>  --- a/arch/arm/tools/mach-types
>>>  +++ b/arch/arm/tools/mach-types
>>>  @@ -962,7 +962,7 @@ omapl138_case_a3    MACH_OMAPL138_CASE_A3   OMAPL138_CASE_A3        3280
>>>   uemd                   MACH_UEMD               UEMD                    3281
>>>   ccwmx51mut             MACH_CCWMX51MUT         CCWMX51MUT              3282
>>>   rockhopper             MACH_ROCKHOPPER         ROCKHOPPER              3283
>>>  -nookcolor              MACH_NOOKCOLOR          NOOKCOLOR               3284
>>>  +encore                 MACH_ENCORE             ENCORE                  3284
>>>   hkdkc100               MACH_HKDKC100           HKDKC100                3285
>>>   ts42xx                 MACH_TS42XX             TS42XX                  3286
>>>   aebl                   MACH_AEBL               AEBL                    3287
>>>  --
>>>  1.7.4.4
>>>
>>>  --
>>>  To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>>>  the body of a message to majordomo@vger.kernel.org
>>>  More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-05-08 21:50 Initial B&N Nook Color support, take three green
@ 2011-05-08 21:50 ` green
  2011-05-09  7:03   ` Igor Grinberg
  2011-05-09 20:28   ` Mark Brown
  0 siblings, 2 replies; 16+ messages in thread
From: green @ 2011-05-08 21:50 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Bare-bones board file, comes with serial console, gpio keys,
MMC/SDCard and USB support.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
 arch/arm/mach-omap2/Kconfig                  |    5 +
 arch/arm/mach-omap2/Makefile                 |    2 +
 arch/arm/mach-omap2/board-omap3encore.c      |  363 ++++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/uncompress.h |    1 +
 arch/arm/tools/mach-types                    |    2 +-
 5 files changed, 372 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap3encore.c

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index b997a35..5370561 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
 	 for full description please see the products webpage at
 	 http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
 
+config MACH_ENCORE
+        bool "Barnes & Noble Encore (Nook Color)"
+        depends on ARCH_OMAP3
+        select OMAP_PACKAGE_CBP
+
 config MACH_OVERO
 	bool "Gumstix Overo board"
 	depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a0c2cae..619e5ca 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -189,6 +189,8 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
 					   hsmmc.o
+obj-$(CONFIG_MACH_ENCORE)		+= board-omap3encore.o \
+					   hsmmc.o
 obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
new file mode 100644
index 0000000..6c044c0
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3encore.c
@@ -0,0 +1,363 @@
+/*
+ * Support for Barns&Noble Nook Color
+ *
+ * Loosely based on mach-omap2/board-zoom.c
+ * Copyright (C) 2008-2010 Texas Instruments Inc.
+ *
+ * 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.
+ *
+ * May 2011 Oleg Drokin <green@linuxhacker.ru> - Port to 2.6.39
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/gpio_keys.h>
+#include <linux/err.h>
+
+#include <linux/spi/spi.h>
+#include <linux/i2c/twl.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <mach/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#include <linux/gpio.h>
+#include <plat/board.h>
+#include <plat/common.h>
+#include <plat/usb.h>
+#include <plat/mux.h>
+#include <plat/sram.h>
+#include <plat/mmc.h>
+#include <plat/omap-serial.h>
+#include <plat/system.h>
+
+#include "mux.h"
+#include "hsmmc.h"
+#include "sdram-hynix-h8mbx00u0mer-0em.h"
+
+/* Encore-specific device-info and i2c addresses. */
+/* Battery, bus 1 */
+#define MAX17042_I2C_SLAVE_ADDRESS	0x36
+#define MAX17042_GPIO_FOR_IRQ		100
+
+/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
+#define MAX8903_UOK_GPIO_FOR_IRQ	115
+#define MAX8903_DOK_GPIO_FOR_IRQ	114
+#define MAX8903_GPIO_CHG_EN		110
+#define MAX8903_GPIO_CHG_STATUS		111
+#define MAX8903_GPIO_CHG_FLT		101
+#define MAX8903_GPIO_CHG_IUSB		102
+#define MAX8903_GPIO_CHG_USUS		104
+#define MAX8903_GPIO_CHG_ILM		61
+
+/* TI WLAN */
+#define ENCORE_WIFI_PMENA_GPIO		22
+#define ENCORE_WIFI_IRQ_GPIO		15
+#define ENCORE_WIFI_EN_POW		16
+
+/* Accelerometer i2c bus 1*/
+#define KXTF9_I2C_SLAVE_ADDRESS		0x0F
+#define KXTF9_GPIO_FOR_PWR		34
+#define KXTF9_GPIO_FOR_IRQ		113
+
+/* Touch screen i2c bus 2*/
+#define CYTTSP_I2C_SLAVEADDRESS		34
+#define ENCORE_CYTTSP_GPIO		99
+#define ENCORE_CYTTSP_RESET_GPIO	46
+
+/* Audio codec, i2c bus 2 */
+#define AUDIO_CODEC_POWER_ENABLE_GPIO	103
+#define AUDIO_CODEC_RESET_GPIO		37
+#define AUDIO_CODEC_IRQ_GPIO		59
+#define AIC3100_I2CSLAVEADDRESS		0x18
+
+
+/* Different HW revisions */
+#define BOARD_ENCORE_REV_EVT1A		0x1
+#define BOARD_ENCORE_REV_EVT1B		0x2
+#define BOARD_ENCORE_REV_EVT2		0x3
+#define BOARD_ENCORE_REV_DVT		0x4
+#define BOARD_ENCORE_REV_PVT		0x5
+#define BOARD_ENCORE_REV_UNKNOWN	0x6
+
+static inline int is_encore_board_evt2(void)
+{
+	return (system_rev >= BOARD_ENCORE_REV_EVT2);
+}
+
+static inline int is_encore_board_evt1b(void)
+{
+	return (system_rev == BOARD_ENCORE_REV_EVT1B);
+}
+
+static int encore_twl4030_keymap[] = {
+	KEY(1, 0, KEY_VOLUMEUP),
+	KEY(2, 0, KEY_VOLUMEDOWN),
+};
+
+static struct matrix_keymap_data encore_twl4030_keymap_data = {
+	.keymap			= encore_twl4030_keymap,
+	.keymap_size		= ARRAY_SIZE(encore_twl4030_keymap),
+};
+
+static struct twl4030_keypad_data encore_kp_twl4030_data = {
+	.rows			= 8,
+	.cols			= 8,
+	.keymap_data		= &encore_twl4030_keymap_data,
+	.rep			= 1,
+};
+
+/* HOME key code for HW > EVT2A */
+static struct gpio_keys_button encore_gpio_buttons[] = {
+	{
+		.code			= KEY_POWER,
+		.gpio			= 14,
+		.desc			= "POWER",
+		.active_low		= 0,
+		.wakeup			= 1,
+	},
+	{
+		.code			= KEY_HOME,
+		.gpio			= 48,
+		.desc			= "HOME",
+		.active_low		= 1,
+		.wakeup			= 1,
+	},
+};
+
+static struct gpio_keys_platform_data encore_gpio_key_info = {
+	.buttons	= encore_gpio_buttons,
+	.nbuttons	= ARRAY_SIZE(encore_gpio_buttons),
+};
+
+static struct platform_device encore_keys_gpio = {
+	.name	= "gpio-keys",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &encore_gpio_key_info,
+	},
+};
+
+static struct platform_device *encore_devices[] __initdata = {
+	&encore_keys_gpio,
+};
+
+static void __init omap_encore_init_early(void)
+{
+	omap2_init_common_infrastructure();
+	omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
+				  h8mbx00u0mer0em_sdrc_params);
+}
+
+static struct twl4030_usb_data encore_usb_data = {
+	.usb_mode	= T2_USB_MODE_ULPI,
+};
+
+static struct regulator_consumer_supply encore_vmmc1_supply = {
+	.supply		= "vmmc",
+};
+
+static struct regulator_consumer_supply encore_vdda_dac_supply =
+	REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
+
+/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
+static struct regulator_init_data encore_vmmc1 = {
+	.constraints = {
+		.min_uV			= 1850000,
+		.max_uV			= 3150000,
+		.valid_modes_mask	= REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask		= REGULATOR_CHANGE_VOLTAGE
+					| REGULATOR_CHANGE_MODE
+					| REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies  = 1,
+	.consumer_supplies      = &encore_vmmc1_supply,
+};
+
+static struct regulator_init_data encore_vdac = {
+	.constraints = {
+		.min_uV                 = 1800000,
+		.max_uV                 = 1800000,
+		.valid_modes_mask       = REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask         = REGULATOR_CHANGE_MODE
+					| REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies  = 1,
+	.consumer_supplies      = &encore_vdda_dac_supply,
+};
+
+/* The order is reverted in this table so that internal eMMC is presented
+ * as first mmc card for compatibility with existing installations and
+ * for common sense reasons */
+static struct omap2_hsmmc_info mmc[] __initdata = {
+	{
+		.name		= "internal",
+		.mmc		= 2,
+		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+		.nonremovable	= true,
+		.power_saving	= true,
+		.ocr_mask	= MMC_VDD_165_195, /* 1.85V */
+	},
+	{
+		.name		= "external",
+		.mmc		= 1,
+		.caps		= MMC_CAP_4_BIT_DATA,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+		.power_saving	= true,
+	},
+	{
+		.name		= "internal",
+		.mmc		= 3,
+		.caps		= MMC_CAP_4_BIT_DATA,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+		.nonremovable	= true,
+		.power_saving	= true,
+	},
+	{}      /* Terminator */
+};
+
+static int encore_hsmmc_card_detect(struct device *dev, int slot)
+{
+	struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+	/* Encore board EVT2 and later has pin high when card is present) */
+	return gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+}
+
+static int encore_twl4030_hsmmc_late_init(struct device *dev)
+{
+	int ret = 0;
+	struct platform_device *pdev = container_of(dev,
+						struct platform_device, dev);
+	struct omap_mmc_platform_data *pdata = dev->platform_data;
+
+	if (is_encore_board_evt2()) {
+		/* Setting MMC1 (external) Card detect */
+		if (pdev->id == 0)
+			pdata->slots[0].card_detect = encore_hsmmc_card_detect;
+	}
+	return ret;
+}
+
+static __init void encore_hsmmc_set_late_init(struct device *dev)
+{
+	struct omap_mmc_platform_data *pdata;
+
+	/* dev can be null if CONFIG_MMC_OMAP_HS is not set */
+	if (!dev)
+		return;
+
+	pdata = dev->platform_data;
+	pdata->init = encore_twl4030_hsmmc_late_init;
+}
+
+static int __ref encore_twl_gpio_setup(struct device *dev,
+		unsigned gpio, unsigned ngpio)
+{
+	struct omap2_hsmmc_info *c;
+	/*
+	 * gpio + 0 is "mmc0_cd" (input/IRQ),
+	 * gpio + 1 is "mmc1_cd" (input/IRQ)
+	 */
+	mmc[1].gpio_cd = gpio + 0;
+	mmc[0].gpio_cd = gpio + 1;
+	omap2_hsmmc_init(mmc);
+	for (c = mmc; c->mmc; c++)
+		encore_hsmmc_set_late_init(c->dev);
+
+	/*
+	 * link regulators to MMC adapters ... we "know" the
+	 * regulators will be set up only *after* we return.
+	 */
+	encore_vmmc1_supply.dev = mmc[1].dev;
+
+	return 0;
+}
+
+static struct twl4030_gpio_platform_data encore_gpio_data = {
+	.gpio_base	= OMAP_MAX_GPIO_LINES,
+	.irq_base	= TWL4030_GPIO_IRQ_BASE,
+	.irq_end	= TWL4030_GPIO_IRQ_END,
+	.setup		= encore_twl_gpio_setup,
+};
+
+static struct twl4030_madc_platform_data encore_madc_data = {
+	.irq_line	= 1,
+};
+
+static struct twl4030_platform_data __refdata encore_twldata = {
+	.irq_base	= TWL4030_IRQ_BASE,
+	.irq_end	= TWL4030_IRQ_END,
+
+	.madc		= &encore_madc_data,
+	.usb		= &encore_usb_data,
+	.gpio		= &encore_gpio_data,
+	.keypad		= &encore_kp_twl4030_data,
+	.vmmc1		= &encore_vmmc1,
+	.vdac		= &encore_vdac,
+};
+
+static struct i2c_board_info __initdata encore_i2c_bus1_info[] = {
+	{
+		I2C_BOARD_INFO("tps65921", 0x48),
+		.flags = I2C_CLIENT_WAKE,
+		.irq = INT_34XX_SYS_NIRQ,
+		.platform_data = &encore_twldata,
+	},
+};
+
+static struct i2c_board_info __initdata encore_i2c_bus2_info[] = {
+};
+
+#ifdef CONFIG_OMAP_MUX
+static struct omap_board_mux board_mux[] __initdata = {
+	{ .reg_offset = OMAP_MUX_TERMINATOR },
+};
+#else
+#define board_mux       NULL
+#endif
+
+static struct omap_board_config_kernel encore_config[] __initdata = {
+};
+
+static int __init omap_i2c_init(void)
+{
+	omap_register_i2c_bus(1, 100, encore_i2c_bus1_info,
+			ARRAY_SIZE(encore_i2c_bus1_info));
+	omap_register_i2c_bus(2, 400, encore_i2c_bus2_info,
+			ARRAY_SIZE(encore_i2c_bus2_info));
+	return 0;
+}
+
+static void __init omap_encore_init(void)
+{
+	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
+	omap_i2c_init();
+	omap_serial_init();
+	usb_musb_init(NULL);
+
+	omap_board_config = encore_config;
+	omap_board_config_size = ARRAY_SIZE(encore_config);
+
+	platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
+}
+
+MACHINE_START(ENCORE, "encore")
+	.boot_params	= 0x80000100,
+	.reserve	= omap_reserve,
+	.map_io		= omap3_map_io,
+	.init_early	= omap_encore_init_early,
+	.init_irq	= omap_init_irq,
+	.init_machine	= omap_encore_init,
+	.timer		= &omap_timer,
+MACHINE_END
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 30b891c..f2de4ff 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -161,6 +161,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
 		DEBUG_LL_OMAP3(3, omap_ldp);
 		DEBUG_LL_OMAP3(3, overo);
 		DEBUG_LL_OMAP3(3, touchbook);
+		DEBUG_LL_OMAP3(3, encore);
 
 		/* omap4 based boards using UART3 */
 		DEBUG_LL_OMAP4(3, omap_4430sdp);
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 7ca41f0..2f0db3e 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -962,7 +962,7 @@ omapl138_case_a3	MACH_OMAPL138_CASE_A3	OMAPL138_CASE_A3	3280
 uemd			MACH_UEMD		UEMD			3281
 ccwmx51mut		MACH_CCWMX51MUT		CCWMX51MUT		3282
 rockhopper		MACH_ROCKHOPPER		ROCKHOPPER		3283
-nookcolor		MACH_NOOKCOLOR		NOOKCOLOR		3284
+encore			MACH_ENCORE		ENCORE			3284
 hkdkc100		MACH_HKDKC100		HKDKC100		3285
 ts42xx			MACH_TS42XX		TS42XX			3286
 aebl			MACH_AEBL		AEBL			3287
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-05-08 21:50 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
@ 2011-05-09  7:03   ` Igor Grinberg
  2011-05-13  3:52     ` Oleg Drokin
  2011-05-09 20:28   ` Mark Brown
  1 sibling, 1 reply; 16+ messages in thread
From: Igor Grinberg @ 2011-05-09  7:03 UTC (permalink / raw)
  To: green; +Cc: linux-omap, linux-arm-kernel

Hi Oleg,

On 05/09/11 00:50, green@linuxhacker.ru wrote:
> From: Oleg Drokin <green@linuxhacker.ru>
>
> Bare-bones board file, comes with serial console, gpio keys,
> MMC/SDCard and USB support.
>
> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
> ---

In general, here you should write the version history of your patch...

>  arch/arm/mach-omap2/Kconfig                  |    5 +
>  arch/arm/mach-omap2/Makefile                 |    2 +
>  arch/arm/mach-omap2/board-omap3encore.c      |  363 ++++++++++++++++++++++++++
>  arch/arm/plat-omap/include/plat/uncompress.h |    1 +
>  arch/arm/tools/mach-types                    |    2 +-
>  5 files changed, 372 insertions(+), 1 deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-omap3encore.c
>
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index b997a35..5370561 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -173,6 +173,11 @@ config MACH_OMAP3_TORPEDO
>  	 for full description please see the products webpage at
>  	 http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
>  
> +config MACH_ENCORE
> +        bool "Barnes & Noble Encore (Nook Color)"
> +        depends on ARCH_OMAP3
> +        select OMAP_PACKAGE_CBP
> +
>  config MACH_OVERO
>  	bool "Gumstix Overo board"
>  	depends on ARCH_OMAP3
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index a0c2cae..619e5ca 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -189,6 +189,8 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM)      += board-omap3logic.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
>  					   hsmmc.o
> +obj-$(CONFIG_MACH_ENCORE)		+= board-omap3encore.o \
> +					   hsmmc.o
>  obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> diff --git a/arch/arm/mach-omap2/board-omap3encore.c b/arch/arm/mach-omap2/board-omap3encore.c
> new file mode 100644
> index 0000000..6c044c0
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-omap3encore.c
> @@ -0,0 +1,363 @@
> +/*
> + * Support for Barns&Noble Nook Color
> + *
> + * Loosely based on mach-omap2/board-zoom.c
> + * Copyright (C) 2008-2010 Texas Instruments Inc.
> + *
> + * 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.
> + *
> + * May 2011 Oleg Drokin <green@linuxhacker.ru> - Port to 2.6.39
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/err.h>
> +
> +#include <linux/spi/spi.h>
> +#include <linux/i2c/twl.h>
> +#include <linux/regulator/machine.h>
> +#include <linux/regulator/fixed.h>
> +#include <mach/hardware.h>
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +
> +#include <linux/gpio.h>
> +#include <plat/board.h>
> +#include <plat/common.h>
> +#include <plat/usb.h>
> +#include <plat/mux.h>
> +#include <plat/sram.h>
> +#include <plat/mmc.h>
> +#include <plat/omap-serial.h>
> +#include <plat/system.h>
> +
> +#include "mux.h"
> +#include "hsmmc.h"
> +#include "sdram-hynix-h8mbx00u0mer-0em.h"

Are all the above includes needed? (spi? maybe some others)

> +
> +/* Encore-specific device-info and i2c addresses. */
> +/* Battery, bus 1 */
> +#define MAX17042_I2C_SLAVE_ADDRESS	0x36
> +#define MAX17042_GPIO_FOR_IRQ		100
> +
> +/*addition of MAXIM8903/TI GPIO mapping WRT schematics */
> +#define MAX8903_UOK_GPIO_FOR_IRQ	115
> +#define MAX8903_DOK_GPIO_FOR_IRQ	114
> +#define MAX8903_GPIO_CHG_EN		110
> +#define MAX8903_GPIO_CHG_STATUS		111
> +#define MAX8903_GPIO_CHG_FLT		101
> +#define MAX8903_GPIO_CHG_IUSB		102
> +#define MAX8903_GPIO_CHG_USUS		104
> +#define MAX8903_GPIO_CHG_ILM		61
> +
> +/* TI WLAN */
> +#define ENCORE_WIFI_PMENA_GPIO		22
> +#define ENCORE_WIFI_IRQ_GPIO		15
> +#define ENCORE_WIFI_EN_POW		16
> +
> +/* Accelerometer i2c bus 1*/
> +#define KXTF9_I2C_SLAVE_ADDRESS		0x0F
> +#define KXTF9_GPIO_FOR_PWR		34
> +#define KXTF9_GPIO_FOR_IRQ		113
> +
> +/* Touch screen i2c bus 2*/
> +#define CYTTSP_I2C_SLAVEADDRESS		34
> +#define ENCORE_CYTTSP_GPIO		99
> +#define ENCORE_CYTTSP_RESET_GPIO	46
> +
> +/* Audio codec, i2c bus 2 */
> +#define AUDIO_CODEC_POWER_ENABLE_GPIO	103
> +#define AUDIO_CODEC_RESET_GPIO		37
> +#define AUDIO_CODEC_IRQ_GPIO		59
> +#define AIC3100_I2CSLAVEADDRESS		0x18
> +
> +
> +/* Different HW revisions */
> +#define BOARD_ENCORE_REV_EVT1A		0x1
> +#define BOARD_ENCORE_REV_EVT1B		0x2
> +#define BOARD_ENCORE_REV_EVT2		0x3
> +#define BOARD_ENCORE_REV_DVT		0x4
> +#define BOARD_ENCORE_REV_PVT		0x5
> +#define BOARD_ENCORE_REV_UNKNOWN	0x6
> +
> +static inline int is_encore_board_evt2(void)
> +{
> +	return (system_rev >= BOARD_ENCORE_REV_EVT2);

No need for parentheses

> +}
> +
> +static inline int is_encore_board_evt1b(void)
> +{
> +	return (system_rev == BOARD_ENCORE_REV_EVT1B);

ditto

> +}
> +
> +static int encore_twl4030_keymap[] = {
> +	KEY(1, 0, KEY_VOLUMEUP),
> +	KEY(2, 0, KEY_VOLUMEDOWN),
> +};
> +
> +static struct matrix_keymap_data encore_twl4030_keymap_data = {
> +	.keymap			= encore_twl4030_keymap,
> +	.keymap_size		= ARRAY_SIZE(encore_twl4030_keymap),
> +};
> +
> +static struct twl4030_keypad_data encore_kp_twl4030_data = {
> +	.rows			= 8,
> +	.cols			= 8,
> +	.keymap_data		= &encore_twl4030_keymap_data,
> +	.rep			= 1,
> +};
> +
> +/* HOME key code for HW > EVT2A */
> +static struct gpio_keys_button encore_gpio_buttons[] = {
> +	{
> +		.code			= KEY_POWER,
> +		.gpio			= 14,
> +		.desc			= "POWER",
> +		.active_low		= 0,
> +		.wakeup			= 1,
> +	},
> +	{
> +		.code			= KEY_HOME,
> +		.gpio			= 48,
> +		.desc			= "HOME",
> +		.active_low		= 1,
> +		.wakeup			= 1,
> +	},
> +};
> +
> +static struct gpio_keys_platform_data encore_gpio_key_info = {
> +	.buttons	= encore_gpio_buttons,
> +	.nbuttons	= ARRAY_SIZE(encore_gpio_buttons),
> +};
> +
> +static struct platform_device encore_keys_gpio = {
> +	.name	= "gpio-keys",
> +	.id	= -1,
> +	.dev	= {
> +		.platform_data	= &encore_gpio_key_info,
> +	},
> +};
> +
> +static struct platform_device *encore_devices[] __initdata = {
> +	&encore_keys_gpio,
> +};
> +
> +static void __init omap_encore_init_early(void)
> +{
> +	omap2_init_common_infrastructure();
> +	omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
> +				  h8mbx00u0mer0em_sdrc_params);
> +}
> +
> +static struct twl4030_usb_data encore_usb_data = {
> +	.usb_mode	= T2_USB_MODE_ULPI,
> +};
> +
> +static struct regulator_consumer_supply encore_vmmc1_supply = {
> +	.supply		= "vmmc",
> +};
> +
> +static struct regulator_consumer_supply encore_vdda_dac_supply =
> +	REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
> +
> +/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
> +static struct regulator_init_data encore_vmmc1 = {
> +	.constraints = {
> +		.min_uV			= 1850000,
> +		.max_uV			= 3150000,
> +		.valid_modes_mask	= REGULATOR_MODE_NORMAL
> +					| REGULATOR_MODE_STANDBY,
> +		.valid_ops_mask		= REGULATOR_CHANGE_VOLTAGE
> +					| REGULATOR_CHANGE_MODE
> +					| REGULATOR_CHANGE_STATUS,
> +	},
> +	.num_consumer_supplies  = 1,
> +	.consumer_supplies      = &encore_vmmc1_supply,
> +};
> +
> +static struct regulator_init_data encore_vdac = {
> +	.constraints = {
> +		.min_uV                 = 1800000,
> +		.max_uV                 = 1800000,
> +		.valid_modes_mask       = REGULATOR_MODE_NORMAL
> +					| REGULATOR_MODE_STANDBY,
> +		.valid_ops_mask         = REGULATOR_CHANGE_MODE
> +					| REGULATOR_CHANGE_STATUS,
> +	},
> +	.num_consumer_supplies  = 1,
> +	.consumer_supplies      = &encore_vdda_dac_supply,
> +};
> +
> +/* The order is reverted in this table so that internal eMMC is presented
> + * as first mmc card for compatibility with existing installations and
> + * for common sense reasons */

/*
 *
 */

> +static struct omap2_hsmmc_info mmc[] __initdata = {
> +	{
> +		.name		= "internal",
> +		.mmc		= 2,
> +		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
> +		.gpio_cd	= -EINVAL,
> +		.gpio_wp	= -EINVAL,
> +		.nonremovable	= true,
> +		.power_saving	= true,
> +		.ocr_mask	= MMC_VDD_165_195, /* 1.85V */
> +	},
> +	{
> +		.name		= "external",
> +		.mmc		= 1,
> +		.caps		= MMC_CAP_4_BIT_DATA,
> +		.gpio_cd	= -EINVAL,
> +		.gpio_wp	= -EINVAL,
> +		.power_saving	= true,
> +	},
> +	{
> +		.name		= "internal",
> +		.mmc		= 3,
> +		.caps		= MMC_CAP_4_BIT_DATA,
> +		.gpio_cd	= -EINVAL,
> +		.gpio_wp	= -EINVAL,
> +		.nonremovable	= true,
> +		.power_saving	= true,
> +	},
> +	{}      /* Terminator */
> +};
> +
> +static int encore_hsmmc_card_detect(struct device *dev, int slot)
> +{
> +	struct omap_mmc_platform_data *mmc = dev->platform_data;
> +
> +	/* Encore board EVT2 and later has pin high when card is present) */

parentheses?

> +	return gpio_get_value_cansleep(mmc->slots[0].switch_pin);
> +}
> +
> +static int encore_twl4030_hsmmc_late_init(struct device *dev)
> +{
> +	int ret = 0;
> +	struct platform_device *pdev = container_of(dev,
> +						struct platform_device, dev);
> +	struct omap_mmc_platform_data *pdata = dev->platform_data;
> +
> +	if (is_encore_board_evt2()) {
> +		/* Setting MMC1 (external) Card detect */
> +		if (pdev->id == 0)
> +			pdata->slots[0].card_detect = encore_hsmmc_card_detect;
> +	}

empty line here would be nice

> +	return ret;
> +}
> +
> +static __init void encore_hsmmc_set_late_init(struct device *dev)
> +{
> +	struct omap_mmc_platform_data *pdata;
> +
> +	/* dev can be null if CONFIG_MMC_OMAP_HS is not set */
> +	if (!dev)
> +		return;
> +
> +	pdata = dev->platform_data;
> +	pdata->init = encore_twl4030_hsmmc_late_init;
> +}
> +
> +static int __ref encore_twl_gpio_setup(struct device *dev,
> +		unsigned gpio, unsigned ngpio)
> +{
> +	struct omap2_hsmmc_info *c;
> +	/*
> +	 * gpio + 0 is "mmc0_cd" (input/IRQ),
> +	 * gpio + 1 is "mmc1_cd" (input/IRQ)
> +	 */
> +	mmc[1].gpio_cd = gpio + 0;
> +	mmc[0].gpio_cd = gpio + 1;
> +	omap2_hsmmc_init(mmc);
> +	for (c = mmc; c->mmc; c++)
> +		encore_hsmmc_set_late_init(c->dev);
> +
> +	/*
> +	 * link regulators to MMC adapters ... we "know" the
> +	 * regulators will be set up only *after* we return.
> +	 */
> +	encore_vmmc1_supply.dev = mmc[1].dev;
> +
> +	return 0;
> +}
> +
> +static struct twl4030_gpio_platform_data encore_gpio_data = {
> +	.gpio_base	= OMAP_MAX_GPIO_LINES,
> +	.irq_base	= TWL4030_GPIO_IRQ_BASE,
> +	.irq_end	= TWL4030_GPIO_IRQ_END,
> +	.setup		= encore_twl_gpio_setup,
> +};
> +
> +static struct twl4030_madc_platform_data encore_madc_data = {
> +	.irq_line	= 1,
> +};
> +
> +static struct twl4030_platform_data __refdata encore_twldata = {
> +	.irq_base	= TWL4030_IRQ_BASE,
> +	.irq_end	= TWL4030_IRQ_END,
> +
> +	.madc		= &encore_madc_data,
> +	.usb		= &encore_usb_data,
> +	.gpio		= &encore_gpio_data,
> +	.keypad		= &encore_kp_twl4030_data,
> +	.vmmc1		= &encore_vmmc1,
> +	.vdac		= &encore_vdac,
> +};
> +
> +static struct i2c_board_info __initdata encore_i2c_bus1_info[] = {
> +	{
> +		I2C_BOARD_INFO("tps65921", 0x48),
> +		.flags = I2C_CLIENT_WAKE,
> +		.irq = INT_34XX_SYS_NIRQ,
> +		.platform_data = &encore_twldata,
> +	},
> +};
> +
> +static struct i2c_board_info __initdata encore_i2c_bus2_info[] = {
> +};
> +
> +#ifdef CONFIG_OMAP_MUX
> +static struct omap_board_mux board_mux[] __initdata = {
> +	{ .reg_offset = OMAP_MUX_TERMINATOR },
> +};
> +#else
> +#define board_mux       NULL
> +#endif
> +
> +static struct omap_board_config_kernel encore_config[] __initdata = {
> +};
> +
> +static int __init omap_i2c_init(void)

You always return 0 here and you don't check the return value,
why not make it void and remove the return statement?

> +{
> +	omap_register_i2c_bus(1, 100, encore_i2c_bus1_info,
> +			ARRAY_SIZE(encore_i2c_bus1_info));
> +	omap_register_i2c_bus(2, 400, encore_i2c_bus2_info,
> +			ARRAY_SIZE(encore_i2c_bus2_info));
> +	return 0;
> +}
> +
> +static void __init omap_encore_init(void)
> +{
> +	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);

You select CBP package in Kconfig, but pass CBB here?

> +	omap_i2c_init();
> +	omap_serial_init();
> +	usb_musb_init(NULL);
> +
> +	omap_board_config = encore_config;
> +	omap_board_config_size = ARRAY_SIZE(encore_config);
> +
> +	platform_add_devices(encore_devices, ARRAY_SIZE(encore_devices));
> +}
> +
> +MACHINE_START(ENCORE, "encore")
> +	.boot_params	= 0x80000100,
> +	.reserve	= omap_reserve,
> +	.map_io		= omap3_map_io,
> +	.init_early	= omap_encore_init_early,
> +	.init_irq	= omap_init_irq,
> +	.init_machine	= omap_encore_init,
> +	.timer		= &omap_timer,
> +MACHINE_END
> diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
> index 30b891c..f2de4ff 100644
> --- a/arch/arm/plat-omap/include/plat/uncompress.h
> +++ b/arch/arm/plat-omap/include/plat/uncompress.h
> @@ -161,6 +161,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
>  		DEBUG_LL_OMAP3(3, omap_ldp);
>  		DEBUG_LL_OMAP3(3, overo);
>  		DEBUG_LL_OMAP3(3, touchbook);
> +		DEBUG_LL_OMAP3(3, encore);

Please, keep it sorted by mach name

>  
>  		/* omap4 based boards using UART3 */
>  		DEBUG_LL_OMAP4(3, omap_4430sdp);
> diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
> index 7ca41f0..2f0db3e 100644
> --- a/arch/arm/tools/mach-types
> +++ b/arch/arm/tools/mach-types
> @@ -962,7 +962,7 @@ omapl138_case_a3	MACH_OMAPL138_CASE_A3	OMAPL138_CASE_A3	3280
>  uemd			MACH_UEMD		UEMD			3281
>  ccwmx51mut		MACH_CCWMX51MUT		CCWMX51MUT		3282
>  rockhopper		MACH_ROCKHOPPER		ROCKHOPPER		3283
> -nookcolor		MACH_NOOKCOLOR		NOOKCOLOR		3284
> +encore			MACH_ENCORE		ENCORE			3284
>  hkdkc100		MACH_HKDKC100		HKDKC100		3285
>  ts42xx			MACH_TS42XX		TS42XX			3286
>  aebl			MACH_AEBL		AEBL			3287

You should contact Russell for this kind of stuff.
I don't think you should be patching it directly...
If you want to tell us that your patch should be applied with this
change to mach-types, then it would be better to make a separate
patch for it and describe it in your cover letter.

-- 
Regards,
Igor.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-05-08 21:50 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
  2011-05-09  7:03   ` Igor Grinberg
@ 2011-05-09 20:28   ` Mark Brown
  1 sibling, 0 replies; 16+ messages in thread
From: Mark Brown @ 2011-05-09 20:28 UTC (permalink / raw)
  To: green; +Cc: linux-omap, linux-arm-kernel

On Sun, May 08, 2011 at 05:50:06PM -0400, green@linuxhacker.ru wrote:

> +	/*
> +	 * link regulators to MMC adapters ... we "know" the
> +	 * regulators will be set up only *after* we return.
> +	 */
> +	encore_vmmc1_supply.dev = mmc[1].dev;

Just specify dev_name in the supply rather than doing this.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-05-09  7:03   ` Igor Grinberg
@ 2011-05-13  3:52     ` Oleg Drokin
  2011-05-15  7:25       ` Igor Grinberg
  0 siblings, 1 reply; 16+ messages in thread
From: Oleg Drokin @ 2011-05-13  3:52 UTC (permalink / raw)
  To: Igor Grinberg; +Cc: linux-omap, linux-arm-kernel

Hello!

On May 9, 2011, at 3:03 AM, Igor Grinberg wrote:

>> Bare-bones board file, comes with serial console, gpio keys,
>> MMC/SDCard and USB support.
>> 
>> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
>> ---
> 
> In general, here you should write the version history of your patch...

umm, ok.
Do you think the history of the changes is important in this case, though?
I mean it's mostly the case of "kill unneeded includes, fix style, fix incorrect mux package type" and so on.
Nothing of real interest to anybody.

>> +static void __init omap_encore_init(void)
>> +{
>> +	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
> 
> You select CBP package in Kconfig, but pass CBB here?

Ah, indeed, thanks for catching this.

>> -nookcolor		MACH_NOOKCOLOR		NOOKCOLOR		3284
>> +encore			MACH_ENCORE		ENCORE			3284
>> hkdkc100		MACH_HKDKC100		HKDKC100		3285
>> ts42xx			MACH_TS42XX		TS42XX			3286
>> aebl			MACH_AEBL		AEBL			3287
> 
> You should contact Russell for this kind of stuff.

Yes, I already did.
I am carrying it as part of the patch so that it's actually buildable while
awaiting for the decision.

> I don't think you should be patching it directly...
> If you want to tell us that your patch should be applied with this
> change to mach-types, then it would be better to make a separate
> patch for it and describe it in your cover letter.

Hm, ok.

Thanks for the feedback.

Bye,
    Oleg

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] Initial B&N Nook Color (encore) support.
  2011-05-13  3:52     ` Oleg Drokin
@ 2011-05-15  7:25       ` Igor Grinberg
  0 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2011-05-15  7:25 UTC (permalink / raw)
  To: Oleg Drokin; +Cc: linux-omap, linux-arm-kernel

On 05/13/11 06:52, Oleg Drokin wrote:

> Hello!
>
> On May 9, 2011, at 3:03 AM, Igor Grinberg wrote:
>
>>> Bare-bones board file, comes with serial console, gpio keys,
>>> MMC/SDCard and USB support.
>>>
>>> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
>>> ---
>> In general, here you should write the version history of your patch...
> umm, ok.
> Do you think the history of the changes is important in this case, though?
> I mean it's mostly the case of "kill unneeded includes, fix style, fix incorrect mux package type" and so on.
> Nothing of real interest to anybody.

It can help everybody (also yourself), for example, the fact that you
already contacted Russell regarding mach-types (though the better place
for it is cover letter) could help me to not wonder why do you have this
stuff here.


-- 
Regards,
Igor.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-05-15  7:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-28 15:57 Initial B&N Nook Color support, take two green
2011-04-28 15:57 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
2011-04-28 23:34   ` Abimanyu Gottumukkala
2011-04-29  0:49     ` Oleg Drokin
2011-05-03 11:08       ` Vladimir Pantelic
2011-05-03  9:22   ` Tony Lindgren
2011-04-28 15:57 ` [PATCH 2/2] Add tps65921 chip green
2011-04-28 17:05 ` Initial B&N Nook Color support, take two Paul Walmsley
2011-04-28 17:21   ` Oleg Drokin
  -- strict thread matches above, loose matches on Subject: below --
2011-05-08 21:50 Initial B&N Nook Color support, take three green
2011-05-08 21:50 ` [PATCH 1/2] Initial B&N Nook Color (encore) support green
2011-05-09  7:03   ` Igor Grinberg
2011-05-13  3:52     ` Oleg Drokin
2011-05-15  7:25       ` Igor Grinberg
2011-05-09 20:28   ` Mark Brown
2011-04-27  1:52 Initial B&N Nook Color support green
2011-04-27  1:52 ` [PATCH 1/2] Initial B&N Nook Color (Encore) support green
2011-04-27  8:54   ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).