[PATCH v4 03/39] ARM: OMAP2+: gpmc: register details for nand driver

2012-05-01 Thread Afzal Mohammed
If peripheral connected is NAND, update NAND drivers platform data
with NAND related register addresses so that NAND driver can handle
GPMC NAND operations by itself

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/gpmc.c |   25 +
 arch/arm/plat-omap/include/plat/gpmc.h |   16 
 arch/arm/plat-omap/include/plat/nand.h |1 +
 3 files changed, 42 insertions(+)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index c8d07bb..657ce95 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -30,6 +30,7 @@
 
 #include asm/mach-types.h
 #include plat/gpmc.h
+#include plat/nand.h
 
 #include plat/sdrc.h
 
@@ -891,6 +892,28 @@ static int __init gpmc_init(void)
 }
 postcore_initcall(gpmc_init);
 
+static __devinit void gpmc_update_nand_reg(struct gpmc *gpmc,
+   struct omap_nand_platform_data *nand)
+{
+   int cs = nand-cs;
+
+   nand-reg.gpmc_status = gpmc-io_base + GPMC_STATUS;
+   nand-reg.gpmc_nand_command = gpmc-io_base + GPMC_CS0_OFFSET +
+   GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
+   nand-reg.gpmc_nand_address = gpmc-io_base + GPMC_CS0_OFFSET +
+   GPMC_CS_NAND_ADDRESS + GPMC_CS_SIZE * cs;
+   nand-reg.gpmc_nand_data = gpmc-io_base + GPMC_CS0_OFFSET +
+   GPMC_CS_NAND_DATA + GPMC_CS_SIZE * cs;
+   nand-reg.gpmc_prefetch_config1 = gpmc-io_base + GPMC_PREFETCH_CONFIG1;
+   nand-reg.gpmc_prefetch_config2 = gpmc-io_base + GPMC_PREFETCH_CONFIG2;
+   nand-reg.gpmc_prefetch_control = gpmc-io_base + GPMC_PREFETCH_CONTROL;
+   nand-reg.gpmc_prefetch_status = gpmc-io_base + GPMC_PREFETCH_STATUS;
+   nand-reg.gpmc_ecc_config = gpmc-io_base + GPMC_ECC_CONFIG;
+   nand-reg.gpmc_ecc_control = gpmc-io_base + GPMC_ECC_CONTROL;
+   nand-reg.gpmc_ecc_size_config = gpmc-io_base + GPMC_ECC_SIZE_CONFIG;
+   nand-reg.gpmc_ecc1_result = gpmc-io_base + GPMC_ECC1_RESULT;
+}
+
 static inline int gpmc_waitpin_is_reserved(struct gpmc *gpmc, unsigned waitpin)
 {
return gpmc-waitpin_map  (0x1  waitpin);
@@ -1427,6 +1450,8 @@ static __devinit int gpmc_probe(struct platform_device 
*pdev)
 
for (i = 0, gdq = gp-device_pdata, gd = gpmc-device;
(i  gp-num_device)  (*gdq); i++, gdq++) {
+   if ((*gdq)-is_nand)
+   gpmc_update_nand_reg(gpmc, (*gdq)-pdata);
ret = gpmc_setup_device(gpmc, gd, *gdq);
if (IS_ERR_VALUE(ret))
dev_err(gpmc-dev, gpmc setup on %s failed\n,
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h 
b/arch/arm/plat-omap/include/plat/gpmc.h
index c5cf020..976a8f0 100644
--- a/arch/arm/plat-omap/include/plat/gpmc.h
+++ b/arch/arm/plat-omap/include/plat/gpmc.h
@@ -207,6 +207,7 @@ struct gpmc_device_pdata {
unsignedper_res_cnt;
struct gpmc_cs_data *cs_data;
unsignednum_cs;
+   boolis_nand;
 };
 
 struct gpmc_pdata {
@@ -216,6 +217,21 @@ struct gpmc_pdata {
struct gpmc_device_pdata**device_pdata;
 };
 
+struct gpmc_nand_regs {
+   void __iomem*gpmc_status;
+   void __iomem*gpmc_nand_command;
+   void __iomem*gpmc_nand_address;
+   void __iomem*gpmc_nand_data;
+   void __iomem*gpmc_prefetch_config1;
+   void __iomem*gpmc_prefetch_config2;
+   void __iomem*gpmc_prefetch_control;
+   void __iomem*gpmc_prefetch_status;
+   void __iomem*gpmc_ecc_config;
+   void __iomem*gpmc_ecc_control;
+   void __iomem*gpmc_ecc_size_config;
+   void __iomem*gpmc_ecc1_result;
+};
+
 extern int gpmc_cs_reconfigure(char *name, int id, struct gpmc_cs_data *cs);
 extern int omap_init_gpmc(struct gpmc_pdata *pdata);
 
diff --git a/arch/arm/plat-omap/include/plat/nand.h 
b/arch/arm/plat-omap/include/plat/nand.h
index 67fc506..86e4d9c 100644
--- a/arch/arm/plat-omap/include/plat/nand.h
+++ b/arch/arm/plat-omap/include/plat/nand.h
@@ -29,6 +29,7 @@ struct omap_nand_platform_data {
unsigned long   phys_base;
int devsize;
enum omap_ecc   ecc_opt;
+   struct gpmc_nand_regs   reg;
 };
 
 /* minimum size for IO mapping */
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 01/39] ARM: OMAP2+: gpmc: driver conversion

2012-05-01 Thread Afzal Mohammed
Convert GPMC code to driver. Boards using GPMC should provide driver
with type of configuration, timing, CS. Platform devices would then be
created for each connected peripheral (details also to be passed by
board so that it reaches respective driver). And GPMC driver would
populate memory resource details for the connected peripheral driver.
Boards should inform gpmc driver with platform data destined for
peripheral driver. gpmc driver will provide the same information to
peripheral driver.

A peripheral connected to GPMC can have multiple address spaces using
different chip select. Hence GPMC driver has been provided capability
to create platform device for peripheral using mutiple CS. The
peripheral that made it necessary was tusb6010.

Interrupts of GPMC are presented to drivers of connected peripherals
as resource. A fictitious interrupt controller chip handles these
interrupts at GPMC hardware level. Clients can use normal interrupt
APIs. Platform information of peripheral passed to GPMC driver should
indicate interrupts to be used via flags.

Driver is capable of configuring waitpin, waitpin details has to be
provided per CS. Wait pin has been considered as exclusive resource
as multiple peripherals should not using the same pin, at the same
it is valid for mutiple CS to use same waitpin provided they are
a part of single peripheral (eg. tusb6010)

An exported symbol for reconfiguring GPMC settings has been provided.
OneNAND is the one that neccessitated this.

Acquiring CS# for NAND is done on a few boards. It means, depending
on bootloader to embed this information. Probably CS# being used can
be set in the Kernel, and acquiring it can be removed. If ever this
capbility is needed, GPMC driver has to be made aware of handling it.

Modifications has been made keeping in mind that the driver would
have to move to driver folder. This explains requirement of clk_prd
field; even though clk_prd variable is not necessary as
gpmc_get_fclk_period is present in the same file as of now, this will
help in moving the driver easily to drivers folder.

Code related to GPMC clock may have to continue live in platform
folders as input clock is beyond the control of GPMC and calculating
timing for the peripheral may need other helpers. This explains
presence of 'gpmc_cs_calc_divider' along with 'gpmc_calc_divider',
both doing same work, latter meant to go with driver, former for
calculation in platform code.

Thanks to Vaibhav Hiremath  Jonathan Hunter on their various good
suggestions which resulted in improving the code.

Cc: Vaibhav Hiremath hvaib...@ti.com
Cc: Jon Hunter jon-hun...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/gpmc.c |  877 
 arch/arm/plat-omap/include/plat/gpmc.h |   93 +++-
 2 files changed, 872 insertions(+), 98 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 580e684..12916f3 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -14,8 +14,11 @@
  */
 #undef DEBUG
 
+#include linux/platform_device.h
+
 #include linux/irq.h
 #include linux/kernel.h
+#include linux/slab.h
 #include linux/init.h
 #include linux/err.h
 #include linux/clk.h
@@ -53,6 +56,45 @@
 #define GPMC_CS0_OFFSET0x60
 #define GPMC_CS_SIZE   0x30
 
+/* GPMC register bits */
+#defineGPMC_CONFIG1_TIMEPARAGRANULARITYBIT(4)
+#defineGPMC_CONFIG1_DEVICETYPE_NAND
GPMC_CONFIG1_DEVICETYPE(0x2)
+#defineGPMC_CONFIG1_WAIT_PIN_SEL_MASK  
GPMC_CONFIG1_WAIT_PIN_SEL(0x3)
+#defineGPMC_CONFIG1_WAIT_MON_TIME(val) ((val  0x3)  18)
+#defineGPMC_CONFIG1_WRITEMULTIPLE  BIT(28)
+#defineGPMC_CONFIG1_READMULTIPLE   BIT(30)
+#defineGPMC_CONFIG1_WRAPBURST  BIT(31)
+#defineGPMC_CONFIG_WAITPIN_POLARITY_SHIFT  0x8
+#defineGPMC_CONFIG1_WAITPIN_MONITOR_TIME(val)  ((val  0x3)  18)
+#defineGPMC_CONFIG1_WAITPIN_MONITOR_TIME_1 \
+   GPMC_CONFIG1_WAITPIN_MONITOR_TIME(0x1)
+#defineGPMC_CONFIG1_WAITPIN_MONITOR_TIME_2 \
+   GPMC_CONFIG1_WAITPIN_MONITOR_TIME(0x2)
+#defineGPMC_CONFIG1_CLOCKACTIVATION_TIME(val)  ((val  0x3)  25)
+#defineGPMC_CONFIG1_CLOCKACTIVATION_TIME_1 \
+   GPMC_CONFIG1_CLOCKACTIVATION_TIME(0x1)
+#defineGPMC_CONFIG1_CLOCKACTIVATION_TIME_2 \
+   GPMC_CONFIG1_CLOCKACTIVATION_TIME(0x2)
+
+#defineGPMC_CONFIG2_CSEXTRADELAY   BIT(7)
+
+#defineGPMC_CONFIG3_ADVEXTRADELAY  BIT(7)
+
+#defineGPMC_CONFIG4_OEEXTRADELAY   BIT(7)
+#defineGPMC_CONFIG4_WEEXTRADELAY   BIT(23)
+
+#defineGPMC_CONFIG6_CYCLE2CYCLEDIFFCSENBIT(6)
+#defineGPMC_CONFIG6_CYCLE2CYCLESAMECSENBIT(7)
+
+#define

[PATCH v4 04/39] ARM: OMAP2+: gpmc: Acquire NAND CS value

2012-05-01 Thread Afzal Mohammed
Some boards depend on bootloader to update chip select value for NAND.
It is felt that Kernel should not depend on bootloader to get CS, as
for a particular board CS is hardwired and is fixed, hence this can
directly be updated in Kernel. But as CS value for boards that depend
on this behaviour is not available, educate gpmc driver to acquire
chip select value for NAND. this ideally should be removed once CS
for those boards are available.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/gpmc.c |   32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 657ce95..ecd3384 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -892,6 +892,30 @@ static int __init gpmc_init(void)
 }
 postcore_initcall(gpmc_init);
 
+static __devinit int gpmc_acquire_nand_cs(struct gpmc *gpmc,
+   struct gpmc_device_pdata *gdp)
+{
+   int cs = 0;
+   struct omap_nand_platform_data *nand = gdp-pdata;
+
+   if ((nand-cs = 0)  (nand-cs  GPMC_CS_NUM))
+   return 0;
+
+   while (cs  GPMC_CS_NUM) {
+   u32 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
+
+   if ((l  GPMC_CONFIG1_DEVICETYPE(~0)) ==
+   GPMC_CONFIG1_DEVICETYPE_NAND) {
+   dev_info(gpmc-dev, found NAND on CS: %d\n, cs);
+   nand-cs = cs;
+   gdp-cs_data-cs = cs;
+   return 0;
+   }
+   cs++;
+   }
+   return -ENODEV;
+}
+
 static __devinit void gpmc_update_nand_reg(struct gpmc *gpmc,
struct omap_nand_platform_data *nand)
 {
@@ -1450,8 +1474,14 @@ static __devinit int gpmc_probe(struct platform_device 
*pdev)
 
for (i = 0, gdq = gp-device_pdata, gd = gpmc-device;
(i  gp-num_device)  (*gdq); i++, gdq++) {
-   if ((*gdq)-is_nand)
+   if ((*gdq)-is_nand) {
+   ret = gpmc_acquire_nand_cs(gpmc, *gdq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(gpmc-dev, CS error: %d\n, ret);
+   continue;
+   }
gpmc_update_nand_reg(gpmc, (*gdq)-pdata);
+   }
ret = gpmc_setup_device(gpmc, gd, *gdq);
if (IS_ERR_VALUE(ret))
dev_err(gpmc-dev, gpmc setup on %s failed\n,
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 06/39] ARM: OMAP2+: onenand: return value in init function

2012-05-01 Thread Afzal Mohammed
Modify board_onenand_init to return platform data. This
would be required for boards to be able to pass it to
gpmc driver so that it finally reaches onenand driver.

Also un-static the function so that boards can use it.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-flash.c |   14 --
 arch/arm/mach-omap2/board-flash.h |   12 
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/board-flash.c 
b/arch/arm/mach-omap2/board-flash.c
index 091aaf6..8727c05 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -87,22 +87,16 @@ static struct omap_onenand_platform_data board_onenand_data 
= {
.dma_channel= -1,   /* disable DMA in OMAP OneNAND driver */
 };
 
-static void
-__init board_onenand_init(struct mtd_partition *onenand_parts,
-   u8 nr_parts, u8 cs)
+struct omap_onenand_platform_data * __init
+board_onenand_init(struct mtd_partition *onenand_parts, u8 nr_parts, u8 cs)
 {
board_onenand_data.cs   = cs;
board_onenand_data.parts= onenand_parts;
board_onenand_data.nr_parts = nr_parts;
 
-   gpmc_onenand_init(board_onenand_data);
-}
-#else
-static void
-__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
-{
+   return board_onenand_data;
 }
-#endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */
+#endif
 
 #if defined(CONFIG_MTD_NAND_OMAP2) || \
defined(CONFIG_MTD_NAND_OMAP2_MODULE)
diff --git a/arch/arm/mach-omap2/board-flash.h 
b/arch/arm/mach-omap2/board-flash.h
index 052964c..75ba49f 100644
--- a/arch/arm/mach-omap2/board-flash.h
+++ b/arch/arm/mach-omap2/board-flash.h
@@ -52,3 +52,15 @@ board_nand_init(struct mtd_partition *nand_parts,
return NULL;
 }
 #endif
+
+#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
+   defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
+extern struct omap_onenand_platform_data * __init
+board_onenand_init(struct mtd_partition *onenand_parts, u8 nr_parts, u8 cs);
+#else
+static inline struct omap_onenand_platform_data *
+__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
+{
+   return NULL;
+}
+#endif
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 05/39] ARM: OMAP2+: nand: create platform data structure

2012-05-01 Thread Afzal Mohammed
New API for updating nand platform data. This has
been created by unifying the two existing ones and
taking out gpmc hardware handling.

From now on, platforms can call omap_nand_init to
initialize platform nand structures, it's fields.
Or can statically create the same.

Acquiring gpmc CS for has been removed. Acquiring CS
is done in GPMC driver. To leverage this feature,
pass CS # as any value outside the allowed range of
0 - 7 (this is valid only for connected NAND),
eg. GPMC_CS_NUM (8)

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-devkit8000.c |6 ++-
 arch/arm/mach-omap2/board-flash.c  |   61 ++--
 arch/arm/mach-omap2/board-flash.h  |   13 --
 arch/arm/mach-omap2/board-ldp.c|4 +-
 arch/arm/mach-omap2/board-omap3beagle.c|6 ++-
 arch/arm/mach-omap2/board-omap3touchbook.c |6 ++-
 arch/arm/mach-omap2/board-overo.c  |5 ++-
 arch/arm/mach-omap2/board-zoom.c   |5 ++-
 arch/arm/mach-omap2/common-board-devices.c |   46 -
 arch/arm/mach-omap2/common-board-devices.h |1 -
 10 files changed, 60 insertions(+), 93 deletions(-)

diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index a2010f0..aa352d1 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -59,6 +59,7 @@
 
 #include mux.h
 #include hsmmc.h
+#include board-flash.h
 #include common-board-devices.h
 
 #define OMAP_DM9000_GPIO_IRQ   25
@@ -648,8 +649,9 @@ static void __init devkit8000_init(void)
 
usb_musb_init(NULL);
usbhs_init(usbhs_bdata);
-   omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions,
-ARRAY_SIZE(devkit8000_nand_partitions));
+   board_nand_init(devkit8000_nand_partitions,
+   ARRAY_SIZE(devkit8000_nand_partitions), GPMC_CS_NUM,
+   NAND_BUSWIDTH_16, NULL);
 
/* Ensure SDRC pins are mux'd for self-refresh */
omap_mux_init_signal(sdrc_cke0, OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-flash.c 
b/arch/arm/mach-omap2/board-flash.c
index 0349fd2..091aaf6 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -108,45 +108,45 @@ __init board_onenand_init(struct mtd_partition 
*nor_parts, u8 nr_parts, u8 cs)
defined(CONFIG_MTD_NAND_OMAP2_MODULE)
 
 /* Note that all values in this struct are in nanoseconds */
-static struct gpmc_timings nand_timings = {
+struct gpmc_timings nand_default_timings[1] = {
+   {
+   .sync_clk = 0,
 
-   .sync_clk = 0,
+   .cs_on = 0,
+   .cs_rd_off = 36,
+   .cs_wr_off = 36,
 
-   .cs_on = 0,
-   .cs_rd_off = 36,
-   .cs_wr_off = 36,
+   .adv_on = 6,
+   .adv_rd_off = 24,
+   .adv_wr_off = 36,
 
-   .adv_on = 6,
-   .adv_rd_off = 24,
-   .adv_wr_off = 36,
+   .we_off = 30,
+   .oe_off = 48,
 
-   .we_off = 30,
-   .oe_off = 48,
+   .access = 54,
+   .rd_cycle = 72,
+   .wr_cycle = 72,
 
-   .access = 54,
-   .rd_cycle = 72,
-   .wr_cycle = 72,
-
-   .wr_access = 30,
-   .wr_data_mux_bus = 0,
+   .wr_access = 30,
+   .wr_data_mux_bus = 0,
+   },
 };
 
-static struct omap_nand_platform_data board_nand_data = {
-   .gpmc_t = nand_timings,
+static struct omap_nand_platform_data omap_nand_data = {
+   .gpmc_t = nand_default_timings,
 };
 
-void
-__init board_nand_init(struct mtd_partition *nand_parts,
-   u8 nr_parts, u8 cs, int nand_type)
+struct omap_nand_platform_data *
+__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
+   int nand_type, struct gpmc_timings *gpmc_t)
 {
-   board_nand_data.cs  = cs;
-   board_nand_data.parts   = nand_parts;
-   board_nand_data.nr_parts= nr_parts;
-   board_nand_data.devsize = nand_type;
-
-   board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
-   board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs;
-   gpmc_nand_init(board_nand_data);
+   omap_nand_data.cs   = cs;
+   omap_nand_data.parts= nand_parts;
+   omap_nand_data.nr_parts = nr_parts;
+   omap_nand_data.devsize  = nand_type;
+   omap_nand_data.gpmc_t   = gpmc_t;
+
+   return omap_nand_data;
 }
 #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
 
@@ -243,5 +243,6 @@ void __init board_flash_init(struct flash_partitions 
partition_info[],
pr_err(NAND: Unable to find configuration in GPMC\n);
else
board_nand_init(partition_info[2].parts,
-   partition_info[2].nr_parts, nandcs, nand_type

[PATCH v4 07/39] ARM: OMAP2+: gpmc-nand: Adapt to use gpmc driver

2012-05-01 Thread Afzal Mohammed
Currently gpmc is configured in platform for nand.
As configuring gpmc has been moved to gpmc driver,
populate details needed for the driver to configure
gpmc. gpmc driver would configure based on this
information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/gpmc-nand.c|   84 
 arch/arm/plat-omap/include/plat/nand.h |8 +--
 2 files changed, 35 insertions(+), 57 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 386dec8..190cdc1 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -21,24 +21,30 @@
 #include plat/board.h
 #include plat/gpmc.h
 
-static struct resource gpmc_nand_resource = {
-   .flags  = IORESOURCE_MEM,
+
+static struct gpmc_cs_data gpmc_nand_cs_info = {
+   .have_config= true,
+   .config = GPMC_DEVICETYPE_NAND,
+   .irq_config = GPMC_IRQ_FIFOEVENTENABLE | GPMC_IRQ_COUNT_EVENT,
 };
 
-static struct platform_device gpmc_nand_device = {
+static struct gpmc_device_pdata gpmc_nand_info = {
.name   = omap2-nand,
.id = 0,
-   .num_resources  = 1,
-   .resource   = gpmc_nand_resource,
+   .cs_data= gpmc_nand_cs_info,
+   .num_cs = 1,
+   .is_nand= true,
 };
 
-static int omap2_nand_gpmc_retime(struct omap_nand_platform_data 
*gpmc_nand_data)
-{
-   struct gpmc_timings t;
-   int err;
+static struct gpmc_timings t;
 
-   if (!gpmc_nand_data-gpmc_t)
+static struct gpmc_timings *
+gpmc_nand_retime(struct omap_nand_platform_data *gpmc_nand_data)
+{
+   if (!gpmc_nand_data-gpmc_t) {
+   pr_warn(gpmc timings not provided\n);
return 0;
+   }
 
memset(t, 0, sizeof(t));
t.sync_clk = gpmc_nand_data-gpmc_t-sync_clk;
@@ -68,56 +74,26 @@ static int omap2_nand_gpmc_retime(struct 
omap_nand_platform_data *gpmc_nand_data
t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_nand_data-gpmc_t-cs_wr_off);
t.wr_cycle  = gpmc_round_ns_to_ticks(gpmc_nand_data-gpmc_t-wr_cycle);
 
-   /* Configure GPMC */
-   if (gpmc_nand_data-devsize == NAND_BUSWIDTH_16)
-   gpmc_cs_configure(gpmc_nand_data-cs, GPMC_CONFIG_DEV_SIZE, 1);
-   else
-   gpmc_cs_configure(gpmc_nand_data-cs, GPMC_CONFIG_DEV_SIZE, 0);
-   gpmc_cs_configure(gpmc_nand_data-cs,
-   GPMC_CONFIG_DEV_TYPE, GPMC_DEVICETYPE_NAND);
-   err = gpmc_cs_set_timings(gpmc_nand_data-cs, t);
-   if (err)
-   return err;
-
-   return 0;
+   return t;
 }
 
-int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
+struct gpmc_device_pdata *
+__init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
 {
-   int err = 0;
-   struct device *dev = gpmc_nand_device.dev;
+   gpmc_nand_info.pdata = gpmc_nand_data;
+   gpmc_nand_info.pdata_size = sizeof(*gpmc_nand_data);
 
-   gpmc_nand_device.dev.platform_data = gpmc_nand_data;
+   gpmc_nand_cs_info.cs = gpmc_nand_data-cs;
+   gpmc_nand_cs_info.mem_size = NAND_IO_SIZE;
 
-   err = gpmc_cs_request(gpmc_nand_data-cs, NAND_IO_SIZE,
-   gpmc_nand_data-phys_base);
-   if (err  0) {
-   dev_err(dev, Cannot request GPMC CS\n);
-   return err;
-   }
+   gpmc_nand_cs_info.timing = gpmc_nand_retime(gpmc_nand_data);
 
-/* Set timings in GPMC */
-   err = omap2_nand_gpmc_retime(gpmc_nand_data);
-   if (err  0) {
-   dev_err(dev, Unable to set gpmc timings: %d\n, err);
-   return err;
-   }
-
-   /* Enable RD PIN Monitoring Reg */
-   if (gpmc_nand_data-dev_ready) {
-   gpmc_cs_configure(gpmc_nand_data-cs, GPMC_CONFIG_RDY_BSY, 1);
-   }
-
-   err = platform_device_register(gpmc_nand_device);
-   if (err  0) {
-   dev_err(dev, Unable to register NAND device\n);
-   goto out_free_cs;
-   }
-
-   return 0;
+   if (gpmc_nand_data-devsize == NAND_BUSWIDTH_16)
+   gpmc_nand_cs_info.config |= GPMC_DEVICESIZE_16;
 
-out_free_cs:
-   gpmc_cs_free(gpmc_nand_data-cs);
+   if (gpmc_nand_data-dev_ready)
+   gpmc_nand_cs_info.config |= GPMC_WAIT_READ_MON |
+   GPMC_WAIT_WRITE_MON;
 
-   return err;
+   return gpmc_nand_info;
 }
diff --git a/arch/arm/plat-omap/include/plat/nand.h 
b/arch/arm/plat-omap/include/plat/nand.h
index 86e4d9c..30c61c9 100644
--- a/arch/arm/plat-omap/include/plat/nand.h
+++ b/arch/arm/plat-omap/include/plat/nand.h
@@ -36,10 +36,12 @@ struct omap_nand_platform_data {
 #defineNAND_IO_SIZE4
 
 #if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
-extern int gpmc_nand_init(struct omap_nand_platform_data *d);
+extern struct gpmc_device_pdata *
+gpmc_nand_init(struct

[PATCH v4 08/39] ARM: OMAP2+: gpmc-onenand: Adapt to use gpmc driver

2012-05-01 Thread Afzal Mohammed
Currently gpmc is configured in platform for onenand. As configuring
gpmc has been moved to gpmc driver, populate details needed for the
driver to configure gpmc. gpmc driver would configure based on this
information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/gpmc-onenand.c|  111 +++--
 arch/arm/plat-omap/include/plat/onenand.h |7 +-
 2 files changed, 61 insertions(+), 57 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc-onenand.c 
b/arch/arm/mach-omap2/gpmc-onenand.c
index a0fa9bb..d7775d5 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -25,9 +25,17 @@
 
 static struct omap_onenand_platform_data *gpmc_onenand_data;
 
-static struct platform_device gpmc_onenand_device = {
+#define ONENAND_IO_SIZESZ_128K
+
+static struct gpmc_cs_data gpmc_onenand_cs_info = {
+   .mem_size   = ONENAND_IO_SIZE,
+};
+
+static struct gpmc_device_pdata gpmc_onenand_info = {
.name   = omap2-onenand,
.id = -1,
+   .cs_data= gpmc_onenand_cs_info,
+   .num_cs = 1,
 };
 
 static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
@@ -79,13 +87,17 @@ static int omap2_onenand_set_async_mode(int cs, void 
__iomem *onenand_base)
t.wr_cycle  = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez);
 
/* Configure GPMC for asynchronous read */
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
- GPMC_CONFIG1_DEVICESIZE_16 |
- GPMC_CONFIG1_MUXADDDATA);
-
-   err = gpmc_cs_set_timings(cs, t);
-   if (err)
+   gpmc_onenand_cs_info.have_config = true;
+   gpmc_onenand_cs_info.config = GPMC_DEVICESIZE_16 |
+   GPMC_MUXADDDATA |
+   GPMC_DEVICETYPE_NOR;
+   gpmc_onenand_cs_info.timing = t;
+   err = gpmc_cs_reconfigure(gpmc_onenand_info.name,
+   gpmc_onenand_info.id, gpmc_onenand_cs_info);
+   if (err) {
+   pr_err(%s: gpmc_cs_reconfigure failed\n, __func__);
return err;
+   }
 
/* Ensure sync read and sync write are disabled */
reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
@@ -180,7 +192,6 @@ static int omap2_onenand_set_sync_mode(struct 
omap_onenand_platform_data *cfg,
int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0;
int err, ticks_cez;
int cs = cfg-cs, freq = *freq_ptr;
-   u32 reg;
bool clk_dep = false;
 
if (cfg-flags  ONENAND_SYNC_READ) {
@@ -276,27 +287,10 @@ static int omap2_onenand_set_sync_mode(struct 
omap_onenand_platform_data *cfg,
sync_read, sync_write, hf, vhf);
 
if (div == 1) {
-   reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2);
-   reg |= (1  7);
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG2, reg);
-   reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG3);
-   reg |= (1  7);
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG3, reg);
-   reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG4);
-   reg |= (1  7);
-   reg |= (1  23);
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
-   } else {
-   reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2);
-   reg = ~(1  7);
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG2, reg);
-   reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG3);
-   reg = ~(1  7);
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG3, reg);
-   reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG4);
-   reg = ~(1  7);
-   reg = ~(1  23);
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
+   t.control.cs_extra_delay = true;
+   t.control.adv_extra_delay = true;
+   t.control.oe_extra_delay = true;
+   t.control.we_extra_delay = true;
}
 
/* Set synchronous read timings */
@@ -348,24 +342,31 @@ static int omap2_onenand_set_sync_mode(struct 
omap_onenand_platform_data *cfg,
}
 
/* Configure GPMC for synchronous read */
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
- GPMC_CONFIG1_WRAPBURST_SUPP |
- GPMC_CONFIG1_READMULTIPLE_SUPP |
- (sync_read ? GPMC_CONFIG1_READTYPE_SYNC : 0) |
- (sync_write ? GPMC_CONFIG1_WRITEMULTIPLE_SUPP : 0) |
- (sync_write ? GPMC_CONFIG1_WRITETYPE_SYNC : 0) |
- GPMC_CONFIG1_CLKACTIVATIONTIME(fclk_offset) |
- GPMC_CONFIG1_PAGE_LEN(2) |
- (cpu_is_omap34xx() ? 0 :
-   (GPMC_CONFIG1_WAIT_READ_MON |
-GPMC_CONFIG1_WAIT_PIN_SEL(0

[PATCH v4 09/39] ARM: OMAP2+: flash: Adapt to gpmc driver

2012-05-01 Thread Afzal Mohammed
gpmc driver has been converted to driver. Modify board_flash_init
so that it can setup gpmc driver platform details for boards

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c |2 +-
 arch/arm/mach-omap2/board-3630sdp.c |3 +-
 arch/arm/mach-omap2/board-flash.c   |   89 +++
 arch/arm/mach-omap2/board-flash.h   |   11 +++--
 4 files changed, 58 insertions(+), 47 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index da75f23..ac2e398 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -620,7 +620,7 @@ static void __init omap_3430sdp_init(void)
omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
usb_musb_init(NULL);
board_smc91x_init();
-   board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
+   board_flash_init(sdp_flash_partitions, chip_sel_3430, 0, NULL);
sdp3430_display_init();
enable_board_wakeup_source();
usbhs_init(usbhs_bdata);
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 6ef350d..74195b7 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -204,7 +204,8 @@ static void __init omap_sdp_init(void)
  h8mbx00u0mer0em_sdrc_params);
zoom_display_init();
board_smc91x_init();
-   board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16);
+   board_flash_init(sdp_flash_partitions, chip_sel_sdp,
+   NAND_BUSWIDTH_16, NULL);
enable_board_wakeup_source();
usbhs_init(usbhs_bdata);
 }
diff --git a/arch/arm/mach-omap2/board-flash.c 
b/arch/arm/mach-omap2/board-flash.c
index 8727c05..8deead9 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -39,46 +39,33 @@ static struct physmap_flash_data board_nor_data = {
.width  = 2,
 };
 
-static struct resource board_nor_resource = {
-   .flags  = IORESOURCE_MEM,
+static struct gpmc_cs_data gpmc_nor_cs_data = {
 };
 
-static struct platform_device board_nor_device = {
+static struct gpmc_device_pdata gpmc_nor_data = {
.name   = physmap-flash,
.id = 0,
-   .dev= {
-   .platform_data = board_nor_data,
-   },
-   .num_resources  = 1,
-   .resource   = board_nor_resource,
+   .cs_data= gpmc_nor_cs_data,
+   .num_cs = 1,
 };
 
-static void
-__init board_nor_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
+static __init struct gpmc_device_pdata *
+gpmc_nor_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
 {
-   int err;
-
board_nor_data.parts= nor_parts;
board_nor_data.nr_parts = nr_parts;
 
-   /* Configure start address and size of NOR device */
-   if (omap_rev() = OMAP3430_REV_ES1_0) {
-   err = gpmc_cs_request(cs, FLASH_SIZE_SDPV2 - 1,
-   (unsigned long *)board_nor_resource.start);
-   board_nor_resource.end = board_nor_resource.start
-   + FLASH_SIZE_SDPV2 - 1;
-   } else {
-   err = gpmc_cs_request(cs, FLASH_SIZE_SDPV1 - 1,
-   (unsigned long *)board_nor_resource.start);
-   board_nor_resource.end = board_nor_resource.start
-   + FLASH_SIZE_SDPV1 - 1;
-   }
-   if (err  0) {
-   pr_err(NOR: Can't request GPMC CS\n);
-   return;
-   }
-   if (platform_device_register(board_nor_device)  0)
-   pr_err(Unable to register NOR device\n);
+   gpmc_nor_cs_data.cs = cs;
+
+   if (omap_rev() = OMAP3430_REV_ES1_0)
+   gpmc_nor_cs_data.mem_size = FLASH_SIZE_SDPV2;
+   else
+   gpmc_nor_cs_data.mem_size = FLASH_SIZE_SDPV1;
+
+   gpmc_nor_data.pdata = board_nor_data;
+   gpmc_nor_data.pdata_size = sizeof(board_nor_data);
+
+   return gpmc_nor_data;
 }
 
 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
@@ -183,8 +170,11 @@ unmap:
  *
  * @return - void.
  */
-void __init board_flash_init(struct flash_partitions partition_info[],
-   char chip_sel_board[][GPMC_CS_NUM], int nand_type)
+__init struct gpmc_device_pdata **board_flash_init(
+   struct flash_partitions partition_info[],
+   char chip_sel_board[][GPMC_CS_NUM],
+   int nand_type,
+   struct gpmc_device_pdata **gpmc_data)
 {
u8  cs = 0;
u8  norcs = GPMC_CS_NUM + 1;
@@ -193,13 +183,18 @@ void __init board_flash_init(struct flash_partitions 
partition_info[],
u8  idx;
unsigned char   *config_sel = NULL;
 
+   if (gpmc_data

[PATCH v4 10/39] ARM: OMAP2+: gpmc-smsc911x: Adapt to use gpmc driver

2012-05-01 Thread Afzal Mohammed
gpmc has been converted to driver. And all gpmc related
configuration would be done by gpmc driver. Provide
gpmc driver with sufficient information so that it can
configure.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/gpmc-smsc911x.c |   59 ---
 arch/arm/plat-omap/include/plat/gpmc-smsc911x.h |9 +++-
 2 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c 
b/arch/arm/mach-omap2/gpmc-smsc911x.c
index b6c77be..2c89685 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -24,13 +24,8 @@
 #include plat/gpmc.h
 #include plat/gpmc-smsc911x.h
 
-static struct resource gpmc_smsc911x_resources[] = {
-   [0] = {
-   .flags  = IORESOURCE_MEM,
-   },
-   [1] = {
-   .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
-   },
+static struct resource gpmc_smsc911x_resources = {
+   .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
 };
 
 static struct smsc911x_platform_config gpmc_smsc911x_config = {
@@ -44,26 +39,42 @@ static struct smsc911x_platform_config gpmc_smsc911x_config 
= {
  * assume that pin multiplexing is done in the board-*.c file,
  * or in the bootloader.
  */
-void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg)
+__init struct gpmc_device_pdata *
+gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg)
 {
-   struct platform_device *pdev;
-   unsigned long cs_mem_base;
int ret;
+   struct gpmc_device_pdata *gpmc_pdev;
+   struct gpmc_cs_data *gpmc_cs;
 
-   if (gpmc_cs_request(gpmc_cfg-cs, SZ_16M, cs_mem_base)  0) {
-   pr_err(Failed to request GPMC mem region\n);
-   return;
+   gpmc_pdev = kzalloc(sizeof(*gpmc_pdev), GFP_KERNEL);
+   if (gpmc_pdev == NULL)
+   return gpmc_pdev;
+
+   gpmc_cs = kzalloc(sizeof(*gpmc_cs), GFP_KERNEL);
+   if (gpmc_pdev == NULL) {
+   kfree(gpmc_pdev);
+   return NULL;
}
 
-   gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0;
-   gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff;
+   gpmc_pdev-cs_data = gpmc_cs;
+   gpmc_pdev-num_cs = 1;
+   gpmc_pdev-name = smsc911x;
+   gpmc_pdev-id = gpmc_cfg-id;
+   gpmc_pdev-pdata = gpmc_smsc911x_config;
+   gpmc_pdev-pdata_size = sizeof(gpmc_smsc911x_config);
+
+   gpmc_cs-cs = gpmc_cfg-cs;
+   gpmc_cs-mem_size = 0x100;
+
+   gpmc_pdev-per_res = gpmc_smsc911x_resources;
+   gpmc_pdev-per_res_cnt = 1;
 
if (gpio_request_one(gpmc_cfg-gpio_irq, GPIOF_IN, smsc911x irq)) {
pr_err(Failed to request IRQ GPIO%d\n, gpmc_cfg-gpio_irq);
goto free1;
}
 
-   gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg-gpio_irq);
+   gpmc_smsc911x_resources.start = gpio_to_irq(gpmc_cfg-gpio_irq);
 
if (gpio_is_valid(gpmc_cfg-gpio_reset)) {
ret = gpio_request_one(gpmc_cfg-gpio_reset,
@@ -81,21 +92,15 @@ void __init gpmc_smsc911x_init(struct 
omap_smsc911x_platform_data *gpmc_cfg)
 
gpmc_smsc911x_config.flags = gpmc_cfg-flags ? : SMSC911X_USE_16BIT;
 
-   pdev = platform_device_register_resndata(NULL, smsc911x, gpmc_cfg-id,
-gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
-gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config));
-   if (!pdev) {
-   pr_err(Unable to register platform device\n);
-   gpio_free(gpmc_cfg-gpio_reset);
-   goto free2;
-   }
-
-   return;
+   return gpmc_pdev;
 
 free2:
gpio_free(gpmc_cfg-gpio_irq);
 free1:
-   gpmc_cs_free(gpmc_cfg-cs);
+   kfree(gpmc_cs);
+   kfree(gpmc_pdev);
 
pr_err(Could not initialize smsc911x device\n);
+
+   return NULL;
 }
diff --git a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h 
b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
index ea6c9c8..66dc7f1 100644
--- a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
+++ b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
@@ -11,6 +11,8 @@
  * published by the Free Software Foundation.
  */
 
+#includeplat/gpmc.h
+
 #ifndef __ASM_ARCH_OMAP_GPMC_SMSC911X_H__
 
 struct omap_smsc911x_platform_data {
@@ -23,12 +25,15 @@ struct omap_smsc911x_platform_data {
 
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 
-extern void gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d);
+extern struct gpmc_device_pdata *
+gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d);
 
 #else
 
-static inline void gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d)
+static inline struct gpmc_device_pdata *
+gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d)
 {
+   return NULL;
 }
 
 #endif
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord

[PATCH v4 11/39] ARM: OMAP2+: gpmc-smc91x: Adapt to use gpmc driver

2012-05-01 Thread Afzal Mohammed
Currently gpmc is configured in platform for smc91x. As configuring
gpmc has been moved to gpmc driver, populate details needed for the
driver to configure gpmc. gpmc driver would configure based on this
information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c   |2 +-
 arch/arm/mach-omap2/board-3430sdp.c   |1 +
 arch/arm/mach-omap2/board-3630sdp.c   |1 +
 arch/arm/mach-omap2/gpmc-smc91x.c |   87 +++--
 arch/arm/plat-omap/include/plat/gpmc-smc91x.h |   10 ++-
 5 files changed, 47 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index e658f83..68679a8 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -175,7 +175,7 @@ static struct omap_smc91x_platform_data board_smc91x_data = 
{
.gpio_irq   = 149,
.flags  = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
IORESOURCE_IRQ_LOWLEVEL,
-
+   .skip_timing= true,
 };
 
 static void __init board_smc91x_init(void)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index ac2e398..367a466 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -434,6 +434,7 @@ static struct omap_smc91x_platform_data board_smc91x_data = 
{
.cs = 3,
.flags  = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
IORESOURCE_IRQ_LOWLEVEL,
+   .skip_timing= true,
 };
 
 static void __init board_smc91x_init(void)
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 74195b7..143e47f 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -32,6 +32,7 @@
 static struct omap_smc91x_platform_data board_smc91x_data = {
.cs = 3,
.flags  = GPMC_MUX_ADD_DATA | IORESOURCE_IRQ_LOWLEVEL,
+   .skip_timing= true,
 };
 
 static void __init board_smc91x_init(void)
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c 
b/arch/arm/mach-omap2/gpmc-smc91x.c
index ba10c24..9389df1 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -23,13 +23,8 @@
 
 static struct omap_smc91x_platform_data *gpmc_cfg;
 
-static struct resource gpmc_smc91x_resources[] = {
-   [0] = {
-   .flags  = IORESOURCE_MEM,
-   },
-   [1] = {
-   .flags  = IORESOURCE_IRQ,
-   },
+static struct resource gpmc_smc91x_resource = {
+   .flags  = IORESOURCE_IRQ,
 };
 
 static struct smc91x_platdata gpmc_smc91x_info = {
@@ -38,14 +33,17 @@ static struct smc91x_platdata gpmc_smc91x_info = {
.ledb   = RPC_LED_TX_RX,
 };
 
-static struct platform_device gpmc_smc91x_device = {
+static struct gpmc_cs_data gpmc_smc91x_cs_data;
+
+static struct gpmc_device_pdata gpmc_smc91x_data = {
.name   = smc91x,
.id = -1,
-   .dev= {
-   .platform_data = gpmc_smc91x_info,
-   },
-   .num_resources  = ARRAY_SIZE(gpmc_smc91x_resources),
-   .resource   = gpmc_smc91x_resources,
+   .pdata  = gpmc_smc91x_info,
+   .pdata_size = sizeof(gpmc_smc91x_info),
+   .per_res= gpmc_smc91x_resource,
+   .per_res_cnt= 1,
+   .cs_data= gpmc_smc91x_cs_data,
+   .num_cs = 1,
 };
 
 /*
@@ -54,9 +52,10 @@ static struct platform_device gpmc_smc91x_device = {
  * http://www.smsc.com/main/catalog/lan91c96.html
  * REVISIT: Level shifters can add at least to the access latency.
  */
-static int smc91c96_gpmc_retime(void)
+static void smc91c96_gpmc_retime(void)
 {
-   struct gpmc_timings t;
+   /* GPMC timing configuration after this function dies, hence static */
+   static struct gpmc_timings t;
const int t3 = 10;  /* Figure 12.2 read and 12.4 write */
const int t4_r = 20;/* Figure 12.2 read */
const int t4_w = 5; /* Figure 12.4 write */
@@ -65,7 +64,6 @@ static int smc91c96_gpmc_retime(void)
const int t7 = 5;   /* Figure 12.4 write */
const int t8 = 5;   /* Figure 12.4 write */
const int t20 = 185;/* Figure 12.2 read and 12.4 write */
-   u32 l;
 
memset(t, 0, sizeof(t));
 
@@ -93,16 +91,17 @@ static int smc91c96_gpmc_retime(void)
t.cs_wr_off = t.we_off + t4_w;
t.wr_cycle = t20 - t.we_on;
 
-   l = GPMC_CONFIG1_DEVICESIZE_16;
+   gpmc_smc91x_cs_data.have_config = true;
+   gpmc_smc91x_cs_data.config = GPMC_DEVICESIZE_16;
if (gpmc_cfg-flags  GPMC_MUX_ADD_DATA)
-   l |= GPMC_CONFIG1_MUXADDDATA;
+   gpmc_smc91x_cs_data.config |= GPMC_MUXADDDATA;
if (gpmc_cfg-flags  GPMC_READ_MON)
-   l |= GPMC_CONFIG1_WAIT_READ_MON

[PATCH v4 12/39] ARM: OMAP2+: gpmc-tusb6010: Adapt to gpmc driver

2012-05-01 Thread Afzal Mohammed
Currently gpmc is configured in platform for tusb6010. As configuring
gpmc has been moved to gpmc driver, populate details needed for the
driver to configure gpmc. gpmc driver would configure based on this
information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/usb-tusb6010.c |  177 ++--
 include/linux/usb/musb.h   |4 +-
 2 files changed, 70 insertions(+), 111 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-tusb6010.c 
b/arch/arm/mach-omap2/usb-tusb6010.c
index db84a46..d7817d2 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -22,6 +22,24 @@
 
 #include mux.h
 
+static struct resource tusb_resources = {
+   .name   = mc,
+   .flags  = IORESOURCE_IRQ,
+};
+
+#defineTUSB_GPMC_CS_ASYNC_IDX  1
+#defineTUSB_GPMC_CS_SYNC_IDX   2
+#defineTUSB_GPMC_CS_NUM2
+
+static struct gpmc_cs_data gpmc_tusb_cs_data[TUSB_GPMC_CS_NUM];
+
+static struct gpmc_device_pdata gpmc_tusb_data = {
+   .name   = musb-tusb,
+   .id = -1,
+   .per_res= tusb_resources,
+   .per_res_cnt= 1,
+};
+
 static u8  async_cs, sync_cs;
 static unsignedrefclk_psec;
 
@@ -51,9 +69,9 @@ next_clk(unsigned t1_NS, unsigned t2_ps, unsigned fclk_ps)
 
 /* NOTE:  timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */
 
-static int tusb_set_async_mode(unsigned sysclk_ps, unsigned fclk_ps)
+static void tusb_set_async_mode(unsigned sysclk_ps, unsigned fclk_ps)
 {
-   struct gpmc_timings t;
+   static struct gpmc_timings t;
unsignedt_acsnh_advnh = sysclk_ps + 3000;
unsignedtmp;
 
@@ -106,12 +124,12 @@ static int tusb_set_async_mode(unsigned sysclk_ps, 
unsigned fclk_ps)
tmp = t.cs_wr_off * 1000 + 7000 /* t_acsn_rdy_z */;
t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps);
 
-   return gpmc_cs_set_timings(async_cs, t);
+   gpmc_tusb_cs_data[TUSB_GPMC_CS_ASYNC_IDX].timing = t;
 }
 
 static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps)
 {
-   struct gpmc_timings t;
+   static struct gpmc_timings t;
unsignedt_scsnh_advnh = sysclk_ps + 3000;
unsignedtmp;
 
@@ -174,71 +192,30 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, 
unsigned fclk_ps)
tmp = t.cs_wr_off * 1000 + 7000 /* t_scsn_rdy_z */;
t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps);
 
-   return gpmc_cs_set_timings(sync_cs, t);
+   gpmc_tusb_cs_data[TUSB_GPMC_CS_SYNC_IDX].timing = t;
+
+   return 0;
 }
 
 extern unsigned long gpmc_get_fclk_period(void);
 
 /* tusb driver calls this when it changes the chip's clocking */
-int tusb6010_platform_retime(unsigned is_refclk)
+static int tusb6010_platform_retime(unsigned is_refclk)
 {
-   static const char   error[] =
-   KERN_ERR tusb6010 %s retime error %d\n;
-
unsignedfclk_ps = gpmc_get_fclk_period();
unsignedsysclk_ps;
-   int status;
 
if (!refclk_psec || fclk_ps == 0)
return -ENODEV;
 
sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
 
-   status = tusb_set_async_mode(sysclk_ps, fclk_ps);
-   if (status  0) {
-   printk(error, async, status);
-   goto done;
-   }
-   status = tusb_set_sync_mode(sysclk_ps, fclk_ps);
-   if (status  0)
-   printk(error, sync, status);
-done:
-   return status;
+   tusb_set_async_mode(sysclk_ps, fclk_ps);
+   return tusb_set_sync_mode(sysclk_ps, fclk_ps);
 }
-EXPORT_SYMBOL_GPL(tusb6010_platform_retime);
-
-static struct resource tusb_resources[] = {
-   /* Order is significant!  The start/end fields
-* are updated during setup..
-*/
-   { /* Asynchronous access */
-   .flags  = IORESOURCE_MEM,
-   },
-   { /* Synchronous access */
-   .flags  = IORESOURCE_MEM,
-   },
-   { /* IRQ */
-   .name   = mc,
-   .flags  = IORESOURCE_IRQ,
-   },
-};
-
-static u64 tusb_dmamask = ~(u32)0;
-
-static struct platform_device tusb_device = {
-   .name   = musb-tusb,
-   .id = -1,
-   .dev = {
-   .dma_mask   = tusb_dmamask,
-   .coherent_dma_mask  = 0x,
-   },
-   .num_resources  = ARRAY_SIZE(tusb_resources),
-   .resource   = tusb_resources,
-};
-
 
 /* this may be called only from board-*.c setup code */
-int __init
+__init struct gpmc_device_pdata *
 tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
unsigned ps_refclk, unsigned waitpin,
unsigned async, unsigned sync,
@@ -249,82 +226,72 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data 
*data,
KERN_ERR tusb6010 init error %d, %d\n

[PATCH v4 14/39] ARM: OMAP2xxx: hwmod data: add gpmc

2012-05-01 Thread Afzal Mohammed
Add gpmc hwmod and associated interconnect data

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   18 +
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   18 +
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |   41 
 arch/arm/mach-omap2/omap_hwmod_common_data.h   |1 +
 arch/arm/mach-omap2/prcm-common.h  |2 +
 5 files changed, 80 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 2c087ff..55c8c7b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -428,6 +428,23 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp2 = 
{
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod_addr_space omap2420_gpmc_addrs[] = {
+   {
+   .pa_start   = 0x6800A000,
+   .pa_end = 0x6800AFFF,
+   .flags  = ADDR_TYPE_RT
+   },
+   { }
+};
+
+static struct omap_hwmod_ocp_if omap2420_l3__gpmc = {
+   .master = omap2xxx_l3_main_hwmod,
+   .slave  = omap2xxx_gpmc_hwmod,
+   .clk= core_l3_ck,
+   .addr   = omap2420_gpmc_addrs,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
omap2xxx_l3_main__l4_core,
omap2xxx_mpu__l3_main,
@@ -468,6 +485,7 @@ static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] 
__initdata = {
omap2420_l4_core__mailbox,
omap2420_l4_core__mcbsp1,
omap2420_l4_core__mcbsp2,
+   omap2420_l3__gpmc,
NULL,
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 71d9f88..dd224cca 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -838,6 +838,23 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp5 = 
{
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod_addr_space omap2430_gpmc_addrs[] = {
+   {
+   .pa_start   = 0x6E00,
+   .pa_end = 0x6E000FFF,
+   .flags  = ADDR_TYPE_RT
+   },
+   { }
+};
+
+static struct omap_hwmod_ocp_if omap2430_l3__gpmc = {
+   .master = omap2xxx_l3_main_hwmod,
+   .slave  = omap2xxx_gpmc_hwmod,
+   .clk= core_l3_ck,
+   .addr   = omap2430_gpmc_addrs,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
omap2xxx_l3_main__l4_core,
omap2xxx_mpu__l3_main,
@@ -886,6 +903,7 @@ static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] 
__initdata = {
omap2430_l4_core__mcbsp3,
omap2430_l4_core__mcbsp4,
omap2430_l4_core__mcbsp5,
+   omap2430_l3__gpmc,
NULL,
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index 45aaa07..e75da40 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -175,6 +175,26 @@ struct omap_hwmod_class omap2xxx_mcspi_class = {
 };
 
 /*
+ * 'gpmc' class
+ * general purpose memory controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap2xxx_gpmc_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .syss_offs  = 0x0014,
+   .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2xxx_gpmc_hwmod_class = {
+   .name   = gpmc,
+   .sysc   = omap2xxx_gpmc_sysc,
+};
+
+/*
  * IP blocks
  */
 
@@ -732,3 +752,24 @@ struct omap_hwmod omap2xxx_mcspi2_hwmod = {
.class  = omap2xxx_mcspi_class,
.dev_attr   = omap_mcspi2_dev_attr,
 };
+
+/* gpmc */
+static struct omap_hwmod_irq_info omap2xxx_gpmc_irqs[] = {
+   { .irq = 20 },
+   { .irq = -1 }
+};
+
+struct omap_hwmod omap2xxx_gpmc_hwmod = {
+   .name   = gpmc,
+   .class  = omap2xxx_gpmc_hwmod_class,
+   .mpu_irqs   = omap2xxx_gpmc_irqs,
+   .main_clk   = gpmc_fck,
+   .flags  = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
+   .prcm   = {
+   .omap2  = {
+   .prcm_reg_id = 3,
+   .module_bit = OMAP24XX_EN_GPMC_MASK,
+   .module_offs = CORE_MOD,
+   },
+   },
+};
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h 
b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index 7aa9156..63e0134

[PATCH v4 15/39] mtd: nand: omap2: obtain memory from resource

2012-05-01 Thread Afzal Mohammed
gpmc being converted to driver, provides drivers
of peripheral connected memory space used by the
peripheral as memory resource.

Modify nand omap driver to obtain memory detials
from resource structure.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/plat-omap/include/plat/nand.h |1 -
 drivers/mtd/nand/omap2.c   |   20 ++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/nand.h 
b/arch/arm/plat-omap/include/plat/nand.h
index 30c61c9..570c4f4 100644
--- a/arch/arm/plat-omap/include/plat/nand.h
+++ b/arch/arm/plat-omap/include/plat/nand.h
@@ -26,7 +26,6 @@ struct omap_nand_platform_data {
booldev_ready;
int gpmc_irq;
enum nand_ioxfer_type;
-   unsigned long   phys_base;
int devsize;
enum omap_ecc   ecc_opt;
struct gpmc_nand_regs   reg;
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index c2b0bba..be4b321 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -118,6 +118,7 @@ struct omap_nand_info {
 
int gpmc_cs;
unsigned long   phys_base;
+   unsigned long   mem_size;
struct completion   comp;
int dma_ch;
int gpmc_irq;
@@ -931,6 +932,7 @@ static int __devinit omap_nand_probe(struct platform_device 
*pdev)
struct omap_nand_platform_data  *pdata;
int err;
int i, offset;
+   struct resource *res;
 
pdata = pdev-dev.platform_data;
if (pdata == NULL) {
@@ -950,7 +952,6 @@ static int __devinit omap_nand_probe(struct platform_device 
*pdev)
info-pdev = pdev;
 
info-gpmc_cs   = pdata-cs;
-   info-phys_base = pdata-phys_base;
 
info-mtd.priv  = info-nand;
info-mtd.name  = dev_name(pdev-dev);
@@ -959,16 +960,23 @@ static int __devinit omap_nand_probe(struct 
platform_device *pdev)
info-nand.options  = pdata-devsize;
info-nand.options  |= NAND_SKIP_BBTSCAN;
 
-   /* NAND write protect off */
-   gpmc_cs_configure(info-gpmc_cs, GPMC_CONFIG_WP, 0);
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (res == NULL) {
+   err = -EINVAL;
+   dev_err(pdev-dev, error getting memory resource\n);
+   goto out_free_info;
+   }
+
+   info-phys_base = res-start;
+   info-mem_size = resource_size(res);
 
-   if (!request_mem_region(info-phys_base, NAND_IO_SIZE,
+   if (!request_mem_region(info-phys_base, info-mem_size,
pdev-dev.driver-name)) {
err = -EBUSY;
goto out_free_info;
}
 
-   info-nand.IO_ADDR_R = ioremap(info-phys_base, NAND_IO_SIZE);
+   info-nand.IO_ADDR_R = ioremap(info-phys_base, info-mem_size);
if (!info-nand.IO_ADDR_R) {
err = -ENOMEM;
goto out_release_mem_region;
@@ -1110,7 +1118,7 @@ static int __devinit omap_nand_probe(struct 
platform_device *pdev)
return 0;
 
 out_release_mem_region:
-   release_mem_region(info-phys_base, NAND_IO_SIZE);
+   release_mem_region(info-phys_base, info-mem_size);
 out_free_info:
kfree(info);
 
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 13/39] ARM: OMAP3: hwmod data: add gpmc

2012-05-01 Thread Afzal Mohammed
Add gpmc hwmod and associated interconnect data

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   52 
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 0c65079..4da8394 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1981,6 +1981,40 @@ static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = {
 };
 
 /*
+ * 'gpmc' class
+ * general purpose memory controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap3xxx_gpmc_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .syss_offs  = 0x0014,
+   .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_gpmc_hwmod_class = {
+   .name   = gpmc,
+   .sysc   = omap3xxx_gpmc_sysc,
+};
+
+static struct omap_hwmod_irq_info omap3xxx_gpmc_irqs[] = {
+   { .irq = 20 },
+   { .irq = -1 }
+};
+
+static struct omap_hwmod omap3xxx_gpmc_hwmod = {
+   .name   = gpmc,
+   .class  = omap3xxx_gpmc_hwmod_class,
+   .clkdm_name = l3_init_clkdm,
+   .mpu_irqs   = omap3xxx_gpmc_irqs,
+   .main_clk   = gpmc_fck,
+   .flags  = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
+};
+
+/*
  * interfaces
  */
 
@@ -3059,6 +3093,23 @@ static struct omap_hwmod_ocp_if 
omap3xxx_l4_core__usb_tll_hs = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod_addr_space omap3xxx_gpmc_addrs[] = {
+   {
+   .pa_start   = 0x6E00,
+   .pa_end = 0x6E000FFF,
+   .flags  = ADDR_TYPE_RT
+   },
+   { }
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l3_main__gpmc = {
+   .master = omap3xxx_l3_main_hwmod,
+   .slave  = omap3xxx_gpmc_hwmod,
+   .clk= core_l3_ick,
+   .addr   = omap3xxx_gpmc_addrs,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
omap3xxx_l3_main__l4_core,
omap3xxx_l3_main__l4_per,
@@ -3103,6 +3154,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] 
__initdata = {
omap34xx_l4_core__mcspi2,
omap34xx_l4_core__mcspi3,
omap34xx_l4_core__mcspi4,
+   omap3xxx_l3_main__gpmc,
NULL,
 };
 
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 16/39] mtd: nand: omap2: use gpmc provided irqs

2012-05-01 Thread Afzal Mohammed
GPMC driver provides it's clientsd with interrupts that can be used
through struct resource. Make use of it for irq mode functionality.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/mtd/nand/omap2.c |   67 +-
 1 file changed, 42 insertions(+), 25 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index be4b321..440536b 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -121,7 +121,8 @@ struct omap_nand_info {
unsigned long   mem_size;
struct completion   comp;
int dma_ch;
-   int gpmc_irq;
+   int gpmc_irq_fifo;
+   int gpmc_irq_count;
enum {
OMAP_NAND_IO_READ = 0,  /* read */
OMAP_NAND_IO_WRITE, /* write */
@@ -472,13 +473,11 @@ static irqreturn_t omap_nand_irq(int this_irq, void *dev)
 {
struct omap_nand_info *info = (struct omap_nand_info *) dev;
u32 bytes;
-   u32 irq_stat;
 
-   irq_stat = gpmc_read_status(GPMC_GET_IRQ_STATUS);
bytes = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
bytes = bytes   0xFFFC; /* io in multiple of 4 bytes */
if (info-iomode == OMAP_NAND_IO_WRITE) { /* checks for write io */
-   if (irq_stat  0x2)
+   if (this_irq == info-gpmc_irq_count)
goto done;
 
if (info-buf_len  (info-buf_len  bytes))
@@ -495,20 +494,17 @@ static irqreturn_t omap_nand_irq(int this_irq, void *dev)
(u32 *)info-buf, bytes  2);
info-buf = info-buf + bytes;
 
-   if (irq_stat  0x2)
+   if (this_irq == info-gpmc_irq_count)
goto done;
}
-   gpmc_cs_configure(info-gpmc_cs, GPMC_SET_IRQ_STATUS, irq_stat);
 
return IRQ_HANDLED;
 
 done:
complete(info-comp);
-   /* disable irq */
-   gpmc_cs_configure(info-gpmc_cs, GPMC_ENABLE_IRQ, 0);
 
-   /* clear status */
-   gpmc_cs_configure(info-gpmc_cs, GPMC_SET_IRQ_STATUS, irq_stat);
+   disable_irq_nosync(info-gpmc_irq_fifo);
+   disable_irq_nosync(info-gpmc_irq_count);
 
return IRQ_HANDLED;
 }
@@ -542,9 +538,9 @@ static void omap_read_buf_irq_pref(struct mtd_info *mtd, 
u_char *buf, int len)
goto out_copy;
 
info-buf_len = len;
-   /* enable irq */
-   gpmc_cs_configure(info-gpmc_cs, GPMC_ENABLE_IRQ,
-   (GPMC_IRQ_FIFOEVENTENABLE | GPMC_IRQ_COUNT_EVENT));
+
+   enable_irq(info-gpmc_irq_count);
+   enable_irq(info-gpmc_irq_fifo);
 
/* waiting for read to complete */
wait_for_completion(info-comp);
@@ -591,12 +587,13 @@ static void omap_write_buf_irq_pref(struct mtd_info *mtd,
goto out_copy;
 
info-buf_len = len;
-   /* enable irq */
-   gpmc_cs_configure(info-gpmc_cs, GPMC_ENABLE_IRQ,
-   (GPMC_IRQ_FIFOEVENTENABLE | GPMC_IRQ_COUNT_EVENT));
+
+   enable_irq(info-gpmc_irq_count);
+   enable_irq(info-gpmc_irq_fifo);
 
/* waiting for write to complete */
wait_for_completion(info-comp);
+
/* wait for data to flushed-out before reset the prefetch */
tim = 0;
limit = (loops_per_jiffy *  msecs_to_jiffies(OMAP_NAND_TIMEOUT_MS));
@@ -982,6 +979,14 @@ static int __devinit omap_nand_probe(struct 
platform_device *pdev)
goto out_release_mem_region;
}
 
+   info-gpmc_irq_fifo = platform_get_irq(pdev, 0);
+   if (info-gpmc_irq_fifo == -ENXIO)
+   dev_warn(pdev-dev, error getting FIFO IRQ\n);
+
+   info-gpmc_irq_count = platform_get_irq(pdev, 1);
+   if (info-gpmc_irq_fifo == -ENXIO)
+   dev_warn(pdev-dev, error getting TERMINALCOUNT IRQ\n);
+
info-nand.controller = info-controller;
 
info-nand.IO_ADDR_W = info-nand.IO_ADDR_R;
@@ -1037,17 +1042,24 @@ static int __devinit omap_nand_probe(struct 
platform_device *pdev)
break;
 
case NAND_OMAP_PREFETCH_IRQ:
-   err = request_irq(pdata-gpmc_irq,
-   omap_nand_irq, IRQF_SHARED, gpmc-nand, info);
+   err = request_irq(info-gpmc_irq_fifo,  omap_nand_irq,
+   IRQF_SHARED, gpmc-nand-fifo, info);
if (err) {
dev_err(pdev-dev, requesting irq(%d) error:%d,
-   pdata-gpmc_irq, err);
+   info-gpmc_irq_fifo, err);
goto out_release_mem_region;
-   } else {
-   info-gpmc_irq   = pdata-gpmc_irq;
-   info-nand.read_buf  = omap_read_buf_irq_pref;
-   info-nand.write_buf

[PATCH v4 17/39] mtd: nand: omap2: handle nand on gpmc

2012-05-01 Thread Afzal Mohammed
GPMC driver has been modified to fill NAND platform data with GPMC
NAND register details. As these registers are accessible in NAND
driver itself, configure NAND in GPMC by itself.

Note: Verfying that other CS have not yet enabled for prefetch  ecc
has to be incorporated. Currently this causes no issues as there are
no boards that use NAND on multiple CS. With GPMC modifications,
perhaps it would be better to consider NAND connected on multiple CS
as a single peripheral using multiple CS. This would make handling
multiple CS issues easier.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/mtd/nand/omap2.c |  209 --
 1 file changed, 165 insertions(+), 44 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 440536b..34fb726 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -129,8 +129,79 @@ struct omap_nand_info {
} iomode;
u_char  *buf;
int buf_len;
+   struct gpmc_nand_regs   reg;
 };
 
+#definePREFETCH_CONFIG1_CS_SHIFT   24
+#defineECC_CONFIG_CS_SHIFT 1
+#defineCS_MASK 0x7
+#defineENABLE_PREFETCH (0x1  7)
+#defineDMA_MPU_MODE_SHIFT  2
+#defineECCSIZE1_SHIFT  22
+#defineECC1RESULTSIZE  0x1
+#defineECC_CLEAR_SHIFT 8
+#defineECC10x1
+
+/**
+ * omap_prefetch_enable - configures and starts prefetch transfer
+ * @cs: cs (chip select) number
+ * @fifo_th: fifo threshold to be used for read/ write
+ * @dma_mode: dma mode enable (1) or disable (0)
+ * @u32_count: number of bytes to be transferred
+ * @is_write: prefetch read(0) or write post(1) mode
+ */
+static int omap_prefetch_enable(int cs, int fifo_th, int dma_mode,
+   unsigned int u32_count, int is_write, struct omap_nand_info *info)
+{
+   u32 val;
+
+   if (fifo_th  PREFETCH_FIFOTHRESHOLD_MAX) {
+   pr_err(gpmc: fifo threshold is not supported\n);
+   return -1;
+   } else if (!(readl(info-reg.gpmc_prefetch_control))) {
+   /* Set the amount of bytes to be prefetched */
+   writel(u32_count, info-reg.gpmc_prefetch_config2);
+
+   /* Set dma/mpu mode, the prefetch read / post write and
+* enable the engine. Set which cs is has requested for.
+*/
+   val = ((cs  PREFETCH_CONFIG1_CS_SHIFT) |
+   PREFETCH_FIFOTHRESHOLD(fifo_th) |
+   ENABLE_PREFETCH |
+   (dma_mode  DMA_MPU_MODE_SHIFT) |
+   (0x1  is_write));
+   writel(val, info-reg.gpmc_prefetch_config1);
+
+   /*  Start the prefetch engine */
+   writel(0x1, info-reg.gpmc_prefetch_control);
+   } else {
+   return -EBUSY;
+   }
+
+   return 0;
+}
+
+/**
+ * omap_prefetch_reset - disables and stops the prefetch engine
+ */
+static int omap_prefetch_reset(int cs, struct omap_nand_info *info)
+{
+   u32 config1;
+
+   /* check if the same module/cs is trying to reset */
+   config1 = readl(info-reg.gpmc_prefetch_config1);
+   if (((config1  PREFETCH_CONFIG1_CS_SHIFT)  CS_MASK) != cs)
+   return -EINVAL;
+
+   /* Stop the PFPW engine */
+   writel(0x0, info-reg.gpmc_prefetch_control);
+
+   /* Reset/disable the PFPW engine */
+   writel(0x0, info-reg.gpmc_prefetch_config1);
+
+   return 0;
+}
+
 /**
  * omap_hwcontrol - hardware specific access to control-lines
  * @mtd: MTD device structure
@@ -149,13 +220,13 @@ static void omap_hwcontrol(struct mtd_info *mtd, int cmd, 
unsigned int ctrl)
 
if (cmd != NAND_CMD_NONE) {
if (ctrl  NAND_CLE)
-   gpmc_nand_write(info-gpmc_cs, GPMC_NAND_COMMAND, cmd);
+   writeb(cmd, info-reg.gpmc_nand_command);
 
else if (ctrl  NAND_ALE)
-   gpmc_nand_write(info-gpmc_cs, GPMC_NAND_ADDRESS, cmd);
+   writeb(cmd, info-reg.gpmc_nand_address);
 
else /* NAND_NCE */
-   gpmc_nand_write(info-gpmc_cs, GPMC_NAND_DATA, cmd);
+   writeb(cmd, info-reg.gpmc_nand_data);
}
 }
 
@@ -189,7 +260,8 @@ static void omap_write_buf8(struct mtd_info *mtd, const 
u_char *buf, int len)
iowrite8(*p++, info-nand.IO_ADDR_W);
/* wait until buffer is available for write */
do {
-   status = gpmc_read_status(GPMC_STATUS_BUFFER);
+   status = readl(info-reg.gpmc_status) 
+   GPMC_STATUS_BUFF_EMPTY;
} while (!status

[PATCH v4 18/39] mtd: onenand: omap: obtain memory from resource

2012-05-01 Thread Afzal Mohammed
gpmc being converted to driver, provides drivers of peripheral
connected memory space used by the peripheral as memory resource.
Modify nand omap driver to obtain memory detials from resource
structure. And so remove usage of gpmc exported symbols.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/mtd/onenand/omap2.c |   29 -
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 398a827..3ff893d 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -48,13 +48,13 @@
 
 #define DRIVER_NAME omap2-onenand
 
-#define ONENAND_IO_SIZESZ_128K
 #define ONENAND_BUFRAM_SIZE(1024 * 5)
 
 struct omap2_onenand {
struct platform_device *pdev;
int gpmc_cs;
unsigned long phys_base;
+   unsigned int mem_size;
int gpio_irq;
struct mtd_info mtd;
struct onenand_chip onenand;
@@ -626,6 +626,7 @@ static int __devinit omap2_onenand_probe(struct 
platform_device *pdev)
struct omap2_onenand *c;
struct onenand_chip *this;
int r;
+   struct resource *res;
 
pdata = pdev-dev.platform_data;
if (pdata == NULL) {
@@ -647,20 +648,24 @@ static int __devinit omap2_onenand_probe(struct 
platform_device *pdev)
c-gpio_irq = 0;
}
 
-   r = gpmc_cs_request(c-gpmc_cs, ONENAND_IO_SIZE, c-phys_base);
-   if (r  0) {
-   dev_err(pdev-dev, Cannot request GPMC CS\n);
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (res == NULL) {
+   r = -EINVAL;
+   dev_err(pdev-dev, error getting memory resource\n);
goto err_kfree;
}
 
-   if (request_mem_region(c-phys_base, ONENAND_IO_SIZE,
+   c-phys_base = res-start;
+   c-mem_size = resource_size(res);
+
+   if (request_mem_region(c-phys_base, c-mem_size,
   pdev-dev.driver-name) == NULL) {
-   dev_err(pdev-dev, Cannot reserve memory region at 0x%08lx, 
-   size: 0x%x\n, c-phys_base, ONENAND_IO_SIZE);
+   dev_err(pdev-dev, Cannot reserve memory region at 0x%08lx, 
size: 0x%x\n,
+   c-phys_base, c-mem_size);
r = -EBUSY;
-   goto err_free_cs;
+   goto err_kfree;
}
-   c-onenand.base = ioremap(c-phys_base, ONENAND_IO_SIZE);
+   c-onenand.base = ioremap(c-phys_base, c-mem_size);
if (c-onenand.base == NULL) {
r = -ENOMEM;
goto err_release_mem_region;
@@ -776,9 +781,7 @@ err_release_gpio:
 err_iounmap:
iounmap(c-onenand.base);
 err_release_mem_region:
-   release_mem_region(c-phys_base, ONENAND_IO_SIZE);
-err_free_cs:
-   gpmc_cs_free(c-gpmc_cs);
+   release_mem_region(c-phys_base, c-mem_size);
 err_kfree:
kfree(c);
 
@@ -800,7 +803,7 @@ static int __devexit omap2_onenand_remove(struct 
platform_device *pdev)
gpio_free(c-gpio_irq);
}
iounmap(c-onenand.base);
-   release_mem_region(c-phys_base, ONENAND_IO_SIZE);
+   release_mem_region(c-phys_base, c-mem_size);
gpmc_cs_free(c-gpmc_cs);
kfree(c);
 
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 19/39] ARM: OMAP2+: board omap3evm: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index fd1b481..b00765e 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -43,6 +43,7 @@
 
 #include plat/board.h
 #include plat/usb.h
+#include plat/gpmc.h
 #include common.h
 #include plat/mcspi.h
 #include video/omapdss.h
@@ -102,6 +103,12 @@ static void __init omap3_evm_get_revision(void)
}
 }
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 #include plat/gpmc-smsc911x.h
 
@@ -122,7 +129,11 @@ static inline void __init omap3evm_init_smsc911x(void)
smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST;
}
 
-   gpmc_smsc911x_init(smsc911x_cfg);
+   *gpmc_device_data = gpmc_smsc911x_init(smsc911x_cfg);
+   if (*gpmc_device_data)
+   gpmc_data.num_device++;
+   else
+   pr_err(error: unable to initilaize gpmc smsc911x\n);
 }
 
 #else
@@ -679,6 +690,7 @@ static void __init omap3_evm_init(void)
usbhs_init(usbhs_bdata);
omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
omap3evm_init_smsc911x();
+   omap_init_gpmc(gpmc_data);
omap3_evm_display_init();
omap3_evm_wl12xx_init();
 }
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 20/39] ARM: OMAP2+: board omap3beagle: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-omap3beagle.c |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index 671ac1c..74bc7f6 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -517,8 +517,16 @@ static void __init beagle_opp_init(void)
return;
 }
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static void __init omap3_beagle_init(void)
 {
+   struct omap_nand_platform_data *nand_data;
+
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
omap3_beagle_init_rev();
 
@@ -543,9 +551,17 @@ static void __init omap3_beagle_init(void)
 
usb_musb_init(NULL);
usbhs_init(usbhs_bdata);
-   board_nand_init(omap3beagle_nand_partitions,
+   nand_data = board_nand_init(omap3beagle_nand_partitions,
ARRAY_SIZE(omap3beagle_nand_partitions), GPMC_CS_NUM,
NAND_BUSWIDTH_16, NULL);
+   if (nand_data != NULL) {
+   *gpmc_device_data = gpmc_nand_init(nand_data);
+   if (*gpmc_device_data)
+   gpmc_data.num_device++;
+   } else
+   pr_err(error: %s: nand init\n, __func__);
+
+   omap_init_gpmc(gpmc_data);
 
/* Ensure msecure is mux'd to be able to set the RTC. */
omap_mux_init_signal(sys_drm_msecure, OMAP_PIN_OFF_OUTPUT_HIGH);
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 21/39] ARM: OMAP2+: board apollon: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board code to
provide gpmc driver with required information. It is believed that
apollon board was added before gpmc-smc91x helper functions were
added. Reuse the now available gpmc_smc91x_init adapted for gpmc
driver.

Note: Timing values were hardcoded and written onto registers,
whether making use of gpmc_smc91x_init would configure timing
properly has to be tested.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-apollon.c |  152 +--
 1 file changed, 38 insertions(+), 114 deletions(-)

diff --git a/arch/arm/mach-omap2/board-apollon.c 
b/arch/arm/mach-omap2/board-apollon.c
index 768ece2..6a402e1 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -39,6 +39,7 @@
 #include plat/board.h
 #include common.h
 #include plat/gpmc.h
+#include plat/gpmc-smc91x.h
 
 #include video/omapdss.h
 #include video/omap-panel-generic-dpi.h
@@ -58,6 +59,12 @@
 #define APOLLON_ETH_CS 1
 #define APOLLON_ETHR_GPIO_IRQ  74
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static struct mtd_partition apollon_partitions[] = {
{
.name   = X-Loader + U-Boot,
@@ -97,57 +104,26 @@ static struct onenand_platform_data apollon_flash_data = {
.nr_parts   = ARRAY_SIZE(apollon_partitions),
 };
 
-static struct resource apollon_flash_resource[] = {
-   [0] = {
-   .flags  = IORESOURCE_MEM,
-   },
+static struct gpmc_cs_data apollon_gpmc_onenand_cs_data = {
+   .cs = APOLLON_FLASH_CS,
+   .mem_size   = SZ_128K,
 };
 
-static struct platform_device apollon_onenand_device = {
+static struct gpmc_device_pdata apollon_gpmc_onenand_data = {
.name   = onenand-flash,
.id = -1,
-   .dev= {
-   .platform_data  = apollon_flash_data,
-   },
-   .num_resources  = ARRAY_SIZE(apollon_flash_resource),
-   .resource   = apollon_flash_resource,
-};
-
-static void __init apollon_flash_init(void)
-{
-   unsigned long base;
-
-   if (gpmc_cs_request(APOLLON_FLASH_CS, SZ_128K, base)  0) {
-   printk(KERN_ERR Cannot request OneNAND GPMC CS\n);
-   return;
-   }
-   apollon_flash_resource[0].start = base;
-   apollon_flash_resource[0].end   = base + SZ_128K - 1;
-}
-
-static struct smc91x_platdata appolon_smc91x_info = {
-   .flags  = SMC91X_USE_16BIT | SMC91X_NOWAIT,
-   .leda   = RPC_LED_100_10,
-   .ledb   = RPC_LED_TX_RX,
+   .pdata  = apollon_flash_data,
+   .pdata_size = sizeof(apollon_flash_data),
+   .cs_data= apollon_gpmc_onenand_cs_data,
+   .num_cs = 1,
 };
 
-static struct resource apollon_smc91x_resources[] = {
-   [0] = {
-   .flags  = IORESOURCE_MEM,
-   },
-   [1] = {
-   .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
-   },
-};
-
-static struct platform_device apollon_smc91x_device = {
-   .name   = smc91x,
-   .id = -1,
-   .dev= {
-   .platform_data  = appolon_smc91x_info,
-   },
-   .num_resources  = ARRAY_SIZE(apollon_smc91x_resources),
-   .resource   = apollon_smc91x_resources,
+static struct omap_smc91x_platform_data apollon_smc91x_data = {
+   .gpio_irq   = APOLLON_ETHR_GPIO_IRQ,
+   .cs = APOLLON_ETH_CS,
+   .wait_pin   = GPMC_WAITPIN_1,
+   .flags  = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHEDGE |
+   GPMC_MUXADDDATA,
 };
 
 static struct omap_led_config apollon_led_config[] = {
@@ -185,74 +161,9 @@ static struct platform_device apollon_led_device = {
 };
 
 static struct platform_device *apollon_devices[] __initdata = {
-   apollon_onenand_device,
-   apollon_smc91x_device,
apollon_led_device,
 };
 
-static inline void __init apollon_init_smc91x(void)
-{
-   unsigned long base;
-
-   unsigned int rate;
-   struct clk *gpmc_fck;
-   int eth_cs;
-   int err;
-
-   gpmc_fck = clk_get(NULL, gpmc_fck);   /* Always on ENABLE_ON_INIT */
-   if (IS_ERR(gpmc_fck)) {
-   WARN_ON(1);
-   return;
-   }
-
-   clk_enable(gpmc_fck);
-   rate = clk_get_rate(gpmc_fck);
-
-   eth_cs = APOLLON_ETH_CS;
-
-   /* Make sure CS1 timings are correct */
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200);
-
-   if (rate = 16000) {
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
-   gpmc_cs_write_reg(eth_cs

[PATCH v4 22/39] ARM: OMAP2+: board h4: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.
Remove unused h4_init_debug too.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-h4.c |  130 +---
 1 file changed, 15 insertions(+), 115 deletions(-)

diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 0bbbabe..7926082 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -186,22 +186,24 @@ static struct physmap_flash_data h4_flash_data = {
.nr_parts   = ARRAY_SIZE(h4_partitions),
 };
 
-static struct resource h4_flash_resource = {
-   .flags  = IORESOURCE_MEM,
+static struct gpmc_cs_data h4_gpmc_cs_flash_data = {
+   .cs = H4_FLASH_CS,
+   .mem_size   = SZ_64M,
 };
 
-static struct platform_device h4_flash_device = {
+static struct gpmc_device_pdata h4_gpmc_flash_data = {
.name   = physmap-flash,
.id = 0,
-   .dev= {
-   .platform_data  = h4_flash_data,
-   },
-   .num_resources  = 1,
-   .resource   = h4_flash_resource,
+   .pdata  = h4_flash_data,
+   .pdata_size = sizeof(h4_flash_data),
+   .cs_data= h4_gpmc_cs_flash_data,
+   .num_cs = 1,
 };
 
-static struct platform_device *h4_devices[] __initdata = {
-   h4_flash_device,
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
 };
 
 static struct panel_generic_dpi_data h4_panel_data = {
@@ -226,109 +228,6 @@ static struct omap_dss_board_info h4_dss_data = {
.default_device = h4_lcd_device,
 };
 
-/* 2420 Sysboot setup (2430 is different) */
-static u32 get_sysboot_value(void)
-{
-   return (omap_ctrl_readl(OMAP24XX_CONTROL_STATUS) 
-   (OMAP2_SYSBOOT_5_MASK | OMAP2_SYSBOOT_4_MASK |
-OMAP2_SYSBOOT_3_MASK | OMAP2_SYSBOOT_2_MASK |
-OMAP2_SYSBOOT_1_MASK | OMAP2_SYSBOOT_0_MASK));
-}
-
-/* H4-2420's always used muxed mode, H4-2422's always use non-muxed
- *
- * Note: OMAP-GIT doesn't correctly do is_cpu_omap2422 and is_cpu_omap2423
- *  correctly.  The macro needs to look at production_id not just hawkeye.
- */
-static u32 is_gpmc_muxed(void)
-{
-   u32 mux;
-   mux = get_sysboot_value();
-   if ((mux  0xF) == 0xd)
-   return 1;   /* NAND config (could be either) */
-   if (mux  0x2)  /* if mux'ed */
-   return 1;
-   else
-   return 0;
-}
-
-static inline void __init h4_init_debug(void)
-{
-   int eth_cs;
-   unsigned long cs_mem_base;
-   unsigned int muxed, rate;
-   struct clk *gpmc_fck;
-
-   eth_cs  = H4_SMC91X_CS;
-
-   gpmc_fck = clk_get(NULL, gpmc_fck);   /* Always on ENABLE_ON_INIT */
-   if (IS_ERR(gpmc_fck)) {
-   WARN_ON(1);
-   return;
-   }
-
-   clk_enable(gpmc_fck);
-   rate = clk_get_rate(gpmc_fck);
-   clk_disable(gpmc_fck);
-   clk_put(gpmc_fck);
-
-   if (is_gpmc_muxed())
-   muxed = 0x200;
-   else
-   muxed = 0;
-
-   /* Make sure CS1 timings are correct */
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1,
- 0x00011000 | muxed);
-
-   if (rate = 16000) {
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x04C4);
-   } else if (rate = 13000) {
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x04C4);
-   } else {/* rate = 1 */
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F);
-   gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x03C2);
-   }
-
-   if (gpmc_cs_request(eth_cs, SZ_16M, cs_mem_base)  0) {
-   printk(KERN_ERR Failed to request GPMC mem for smc91x\n);
-   goto out;
-   }
-
-   udelay(100);
-
-   omap_mux_init_gpio(92, 0);
-   if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ)  0)
-   gpmc_cs_free(eth_cs);
-
-out:
-   clk_disable(gpmc_fck);
-   clk_put

[PATCH v4 23/39] ARM: OMAP2+: board 3630sdp: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-3630sdp.c |   23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 143e47f..4e0298a 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -27,18 +27,29 @@
 #include mux.h
 #include sdram-hynix-h8mbx00u0mer-0em.h
 
+static struct gpmc_device_pdata *gpmc_device_data[4];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
 
 static struct omap_smc91x_platform_data board_smc91x_data = {
.cs = 3,
.flags  = GPMC_MUX_ADD_DATA | IORESOURCE_IRQ_LOWLEVEL,
.skip_timing= true,
+   .gpio_irq   = 158,
 };
 
 static void __init board_smc91x_init(void)
 {
-   board_smc91x_data.gpio_irq = 158;
-   gpmc_smc91x_init(board_smc91x_data);
+   *gpmc_cur = gpmc_smc91x_init(board_smc91x_data);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: unable to initilaize gpmc smsc911x\n);
 }
 
 #else
@@ -204,9 +215,13 @@ static void __init omap_sdp_init(void)
omap_sdrc_init(h8mbx00u0mer0em_sdrc_params,
  h8mbx00u0mer0em_sdrc_params);
zoom_display_init();
+
board_smc91x_init();
-   board_flash_init(sdp_flash_partitions, chip_sel_sdp,
-   NAND_BUSWIDTH_16, NULL);
+   gpmc_data.num_device += board_flash_init(sdp_flash_partitions,
+   chip_sel_sdp, NAND_BUSWIDTH_16,
+   gpmc_cur) - gpmc_cur;
+   omap_init_gpmc(gpmc_data);
+
enable_board_wakeup_source();
usbhs_init(usbhs_bdata);
 }
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 24/39] ARM: OMAP2+: board 3430sdp: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c |   17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 367a466..cea5ca5 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -59,6 +59,12 @@
 
 #define TWL4030_MSECURE_GPIO 22
 
+static struct gpmc_device_pdata *gpmc_device_data[4];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
 static uint32_t board_keymap[] = {
KEY(0, 0, KEY_LEFT),
KEY(0, 1, KEY_RIGHT),
@@ -444,7 +450,11 @@ static void __init board_smc91x_init(void)
else
board_smc91x_data.gpio_irq = 29;
 
-   gpmc_smc91x_init(board_smc91x_data);
+   *gpmc_cur = gpmc_smc91x_init(board_smc91x_data);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: unable to initilaize gpmc smsc911x\n);
 }
 
 #else
@@ -621,7 +631,10 @@ static void __init omap_3430sdp_init(void)
omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
usb_musb_init(NULL);
board_smc91x_init();
-   board_flash_init(sdp_flash_partitions, chip_sel_3430, 0, NULL);
+   gpmc_data.num_device += board_flash_init(sdp_flash_partitions,
+   chip_sel_3430, 0, gpmc_cur) - gpmc_cur;
+   omap_init_gpmc(gpmc_data);
+
sdp3430_display_init();
enable_board_wakeup_source();
usbhs_init(usbhs_bdata);
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 25/39] ARM: OMAP2+: board 2430sdp: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c |   42 +--
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 68679a8..d94ada4 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -46,9 +46,16 @@
 #include hsmmc.h
 #include common-board-devices.h
 
-#define SDP2430_CS0_BASE   0x0400
+#define SDP2430_FLASH_CS   0
 #define SECONDARY_LCD_GPIO 147
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static struct mtd_partition sdp2430_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
{
@@ -86,24 +93,18 @@ static struct physmap_flash_data sdp2430_flash_data = {
.nr_parts   = ARRAY_SIZE(sdp2430_partitions),
 };
 
-static struct resource sdp2430_flash_resource = {
-   .start  = SDP2430_CS0_BASE,
-   .end= SDP2430_CS0_BASE + SZ_64M - 1,
-   .flags  = IORESOURCE_MEM,
+static struct gpmc_cs_data sdp2430_gpmc_cs_flash_data = {
+   .cs = SDP2430_FLASH_CS,
+   .mem_size   = SZ_64M,
 };
 
-static struct platform_device sdp2430_flash_device = {
+static struct gpmc_device_pdata sdp2430_gpmc_flash_device = {
.name   = physmap-flash,
.id = 0,
-   .dev = {
-   .platform_data  = sdp2430_flash_data,
-   },
-   .num_resources  = 1,
-   .resource   = sdp2430_flash_resource,
-};
-
-static struct platform_device *sdp2430_devices[] __initdata = {
-   sdp2430_flash_device,
+   .pdata  = sdp2430_flash_data,
+   .pdata_size = sizeof(sdp2430_flash_data),
+   .cs_data= sdp2430_gpmc_cs_flash_data,
+   .num_cs = 1,
 };
 
 /* LCD */
@@ -181,7 +182,11 @@ static struct omap_smc91x_platform_data board_smc91x_data 
= {
 static void __init board_smc91x_init(void)
 {
omap_mux_init_gpio(149, OMAP_PIN_INPUT);
-   gpmc_smc91x_init(board_smc91x_data);
+   *gpmc_cur = gpmc_smc91x_init(board_smc91x_data);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: unable to initilaize gpmc smsc911x\n);
 }
 
 #else
@@ -276,7 +281,9 @@ static void __init omap_2430sdp_init(void)
 
omap2430_i2c_init();
 
-   platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
+   *gpmc_cur++ = sdp2430_gpmc_flash_device;
+   gpmc_data.num_device++;
+
omap_serial_init();
omap_sdrc_init(NULL, NULL);
omap_hsmmc_init(mmc);
@@ -286,6 +293,7 @@ static void __init omap_2430sdp_init(void)
usb_musb_init(NULL);
 
board_smc91x_init();
+   omap_init_gpmc(gpmc_data);
 
/* Turn off secondary LCD backlight */
gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW,
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 26/39] ARM: OMAP2+: board cm-t3517: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-cm-t3517.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t3517.c 
b/arch/arm/mach-omap2/board-cm-t3517.c
index 9e66e16..6aa6b4a 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -234,6 +234,11 @@ static struct mtd_partition cm_t3517_nand_partitions[] = {
},
 };
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
 static struct omap_nand_platform_data cm_t3517_nand_data = {
.parts  = cm_t3517_nand_partitions,
.nr_parts   = ARRAY_SIZE(cm_t3517_nand_partitions),
@@ -242,8 +247,8 @@ static struct omap_nand_platform_data cm_t3517_nand_data = {
 
 static void __init cm_t3517_init_nand(void)
 {
-   if (gpmc_nand_init(cm_t3517_nand_data)  0)
-   pr_err(CM-T3517: NAND initialization failed\n);
+   *gpmc_device_data = gpmc_nand_init(cm_t3517_nand_data);
+   gpmc_data.num_device++;
 }
 #else
 static inline void cm_t3517_init_nand(void) {}
@@ -289,6 +294,7 @@ static void __init cm_t3517_init(void)
omap_board_config_size = ARRAY_SIZE(cm_t3517_config);
cm_t3517_init_leds();
cm_t3517_init_nand();
+   omap_init_gpmc(gpmc_data);
cm_t3517_init_rtc();
cm_t3517_init_usbh();
cm_t3517_init_hecc();
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 27/39] ARM: OMAP2+: board cm-t35: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-cm-t35.c |   21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 909a8b9..5b0b637 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -66,6 +66,13 @@
 #include linux/smsc911x.h
 #include plat/gpmc-smsc911x.h
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
.id = 0,
.cs = CM_T35_SMSC911X_CS,
@@ -99,8 +106,17 @@ static void __init cm_t35_init_ethernet(void)
regulator_register_fixed(1, sb_t35_smsc911x_supplies,
 ARRAY_SIZE(sb_t35_smsc911x_supplies));
 
-   gpmc_smsc911x_init(cm_t35_smsc911x_cfg);
-   gpmc_smsc911x_init(sb_t35_smsc911x_cfg);
+   *gpmc_cur = gpmc_smsc911x_init(cm_t35_smsc911x_cfg);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: initilaizing gpmc smsc911x instance 1\n);
+
+   *gpmc_cur = gpmc_smsc911x_init(sb_t35_smsc911x_cfg);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: initilaizing gpmc smsc911x instance 2\n);
 }
 #else
 static inline void __init cm_t35_init_ethernet(void) { return; }
@@ -658,6 +674,7 @@ static void __init cm_t3x_common_init(void)
cm_t35_init_i2c();
omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL);
cm_t35_init_ethernet();
+   omap_init_gpmc(gpmc_data);
cm_t35_init_led();
cm_t35_init_display();
 
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 28/39] ARM: OMAP2+: board ldp: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-ldp.c |   26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index b76f28d..1ebc024 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -43,6 +43,7 @@
 #include asm/delay.h
 #include plat/usb.h
 #include plat/gpmc-smsc911x.h
+#include plat/nand.h
 
 #include video/omapdss.h
 #include video/omap-panel-generic-dpi.h
@@ -58,6 +59,13 @@
 #define DEBUG_BASE 0x0800
 #define LDP_ETHR_START DEBUG_BASE
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static uint32_t board_keymap[] = {
KEY(0, 0, KEY_1),
KEY(1, 0, KEY_2),
@@ -180,7 +188,9 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
 
 static inline void __init ldp_init_smsc911x(void)
 {
-   gpmc_smsc911x_init(smsc911x_cfg);
+   *gpmc_cur = gpmc_smsc911x_init(smsc911x_cfg);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
 }
 
 /* LCD */
@@ -418,6 +428,8 @@ static struct regulator_consumer_supply dummy_supplies[] = {
 
 static void __init omap_ldp_init(void)
 {
+   struct omap_nand_platform_data *nand_data;
+
regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
ldp_init_smsc911x();
@@ -427,8 +439,16 @@ static void __init omap_ldp_init(void)
omap_serial_init();
omap_sdrc_init(NULL, NULL);
usb_musb_init(NULL);
-   board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
-   ZOOM_NAND_CS, 0, nand_default_timings);
+
+   nand_data = board_nand_init(ldp_nand_partitions,
+   ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS,
+   0, nand_default_timings);
+   if (nand_data != NULL) {
+   *gpmc_cur++ = gpmc_nand_init(nand_data);
+   gpmc_data.num_device++;
+   }
+
+   omap_init_gpmc(gpmc_data);
 
omap_hsmmc_init(mmc);
ldp_display_init();
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 29/39] ARM: OMAP2+: board n8x0: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-n8x0.c |   18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 94f6077..d3d866a 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -36,6 +36,7 @@
 #include plat/onenand.h
 #include plat/mmc.h
 #include plat/serial.h
+#include plat/gpmc.h
 
 #include mux.h
 
@@ -45,6 +46,13 @@
 #define TUSB6010_GPIO_ENABLE   0
 #define TUSB6010_DMACHAN   0x3f
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_USB_MUSB_TUSB6010) || 
defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
 /*
  * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
@@ -114,10 +122,12 @@ static void __init n8x0_usb_init(void)
}
tusb_set_power(0);
 
-   ret = tusb6010_setup_interface(tusb_data, TUSB6010_REFCLK_19, 2,
+   *gpmc_cur = tusb6010_setup_interface(tusb_data, TUSB6010_REFCLK_19, 2,
TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
TUSB6010_GPIO_INT, TUSB6010_DMACHAN);
-   if (ret != 0)
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
goto err;
 
printk(announce);
@@ -785,7 +795,9 @@ static void __init n8x0_init_machine(void)
ARRAY_SIZE(n810_i2c_board_info_2));
board_serial_init();
omap_sdrc_init(NULL, NULL);
-   gpmc_onenand_init(board_onenand_data);
+   *gpmc_cur++ = gpmc_onenand_init(board_onenand_data);
+   gpmc_data.num_device++;
+   omap_init_gpmc(gpmc_data);
n8x0_mmc_init();
n8x0_usb_init();
 }
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 30/39] ARM: OMAP2+: board omap3logic: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-omap3logic.c |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-omap3logic.c 
b/arch/arm/mach-omap2/board-omap3logic.c
index 9b3c141..9867fc8 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -55,6 +55,12 @@
 #define OMAP3_TORPEDO_MMC_GPIO_CD  127
 #define OMAP3_TORPEDO_SMSC911X_GPIO_IRQ129
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
@@ -180,7 +186,11 @@ static inline void __init board_smsc911x_init(void)
return;
}
 
-   gpmc_smsc911x_init(board_smsc911x_data);
+   *gpmc_device_data = gpmc_smsc911x_init(board_smsc911x_data);
+   if (*gpmc_device_data)
+   gpmc_data.num_device++;
+   else
+   pr_err(error: unable to initilaize gpmc smsc911x\n);
 }
 
 #ifdef CONFIG_OMAP_MUX
@@ -204,6 +214,7 @@ static void __init omap3logic_init(void)
omap_sdrc_init(NULL, NULL);
board_mmc_init();
board_smsc911x_init();
+   omap_init_gpmc(gpmc_data);
 
/* Ensure SDRC pins are mux'd for self-refresh */
omap_mux_init_signal(sdrc_cke0, OMAP_PIN_OUTPUT);
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 31/39] ARM: OMAP2+: board omap3pandora: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-omap3pandora.c |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3pandora.c 
b/arch/arm/mach-omap2/board-omap3pandora.c
index 33d995d..25b2de6 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -57,6 +57,12 @@
 #define PANDORA_WIFI_NRESET_GPIO   23
 #define OMAP3_PANDORA_TS_GPIO  94
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static struct mtd_partition omap3pandora_nand_partitions[] = {
{
.name   = xloader,
@@ -607,8 +613,9 @@ static void __init omap3pandora_init(void)
omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
usbhs_init(usbhs_bdata);
usb_musb_init(NULL);
-   gpmc_nand_init(pandora_nand_data);
-
+   *gpmc_device_data = gpmc_nand_init(pandora_nand_data);
+   gpmc_data.num_device++;
+   omap_init_gpmc(gpmc_data);
/* Ensure SDRC pins are mux'd for self-refresh */
omap_mux_init_signal(sdrc_cke0, OMAP_PIN_OUTPUT);
omap_mux_init_signal(sdrc_cke1, OMAP_PIN_OUTPUT);
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 32/39] ARM: OMAP2+: board omap3stalker: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-omap3stalker.c |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-omap3stalker.c 
b/arch/arm/mach-omap2/board-omap3stalker.c
index 4dffc95..5e92d54 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -56,6 +56,12 @@
 #include hsmmc.h
 #include common-board-devices.h
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 #include plat/gpmc-smsc911x.h
 
@@ -74,7 +80,11 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
 static inline void __init omap3stalker_init_eth(void)
 {
omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP);
-   gpmc_smsc911x_init(smsc911x_cfg);
+   *gpmc_device_data = gpmc_smsc911x_init(smsc911x_cfg);
+   if (*gpmc_device_data)
+   gpmc_data.num_device++;
+   else
+   pr_err(error: unable to initilaize gpmc smsc911x\n);
 }
 
 #else
@@ -443,6 +453,7 @@ static void __init omap3_stalker_init(void)
omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP);
 
omap3stalker_init_eth();
+   omap_init_gpmc(gpmc_data);
omap3_stalker_display_init();
 /* Ensure SDRC pins are mux'd for self-refresh */
omap_mux_init_signal(sdr_cke0, OMAP_PIN_OUTPUT);
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 33/39] ARM: OMAP2+: board omap4pcm049: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-omap4pcm049.c |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-omap4pcm049.c 
b/arch/arm/mach-omap2/board-omap4pcm049.c
index 81de7d5..b4ead86 100644
--- a/arch/arm/mach-omap2/board-omap4pcm049.c
+++ b/arch/arm/mach-omap2/board-omap4pcm049.c
@@ -130,6 +130,12 @@ static struct omap2_hsmmc_info mmc[] = {
}, {}   /* Terminator */
 };
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 static struct regulator_consumer_supply dummy_supplies[] = {
REGULATOR_SUPPLY(vddvario, smsc911x.0),
@@ -147,7 +153,11 @@ static inline void __init pcm049_init_smsc911x(void)
 {
omap_mux_init_gpio(OMAP4_PCM049_ETH_GPIO_IRQ, OMAP_PIN_INPUT);
regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-   gpmc_smsc911x_init(board_smsc911x_data);
+   *gpmc_device_data = gpmc_smsc911x_init(board_smsc911x_data);
+   if (*gpmc_device_data)
+   gpmc_data.num_device++;
+   else
+   pr_err(error: unable to initilaize gpmc smsc911x\n);
 }
 #else
 static inline void __init pcm049_init_smsc911x(void) { return; }
@@ -562,6 +572,7 @@ static void __init pcm049_init(void)
pm_power_off = pcm049_power_off;
omap4_mux_init(board_mux, NULL, OMAP_PACKAGE_CBS);
pcm049_init_smsc911x();
+   omap_init_gpmc(gpmc_data);
pcm049_i2c_init();
platform_add_devices(pcm049_devices, ARRAY_SIZE(pcm049_devices));
board_serial_init();
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 34/39] ARM: OMAP2+: board overo: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-overo.c |   29 ++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-overo.c 
b/arch/arm/mach-omap2/board-overo.c
index e08479a..fa0197e 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -72,6 +72,13 @@
 #define OVERO_SMSC911X2_CS 4
 #define OVERO_SMSC911X2_GPIO   65
 
+static struct gpmc_device_pdata *gpmc_device_data[3];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
 
@@ -137,8 +144,16 @@ static struct omap_smsc911x_platform_data smsc911x2_cfg = {
 
 static void __init overo_init_smsc911x(void)
 {
-   gpmc_smsc911x_init(smsc911x_cfg);
-   gpmc_smsc911x_init(smsc911x2_cfg);
+   *gpmc_cur = gpmc_smsc911x_init(smsc911x_cfg);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: %s: smsc911x instance 1 setup\n, __func__);
+   *gpmc_cur = gpmc_smsc911x_init(smsc911x2_cfg);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: %s: smsc911x instance 1 setup\n, __func__);
 }
 
 #else
@@ -509,6 +524,7 @@ static struct regulator_consumer_supply dummy_supplies[] = {
 static void __init overo_init(void)
 {
int ret;
+   struct omap_nand_platform_data *nand_data;
 
regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -518,12 +534,19 @@ static void __init overo_init(void)
omap_serial_init();
omap_sdrc_init(mt46h32m32lf6_sdrc_params,
  mt46h32m32lf6_sdrc_params);
-   board_nand_init(overo_nand_partitions,
+
+   nand_data = board_nand_init(overo_nand_partitions,
ARRAY_SIZE(overo_nand_partitions), GPMC_CS_NUM, 0, NULL);
+   if (nand_data != NULL) {
+   *gpmc_cur++ = gpmc_nand_init(nand_data);
+   gpmc_data.num_device++;
+   }
+
usb_musb_init(NULL);
usbhs_init(usbhs_bdata);
overo_spi_init();
overo_init_smsc911x();
+   omap_init_gpmc(gpmc_data);
overo_display_init();
overo_init_led();
overo_init_keys();
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 35/39] ARM: OMAP2+: board rm680: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-rm680.c |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-rm680.c 
b/arch/arm/mach-omap2/board-rm680.c
index ae53d71..e28e606 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -33,6 +33,12 @@
 #include sdram-nokia.h
 #include common-board-devices.h
 
+static struct gpmc_device_pdata *gpmc_device_data[1];
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
REGULATOR_SUPPLY(vmmc, omap_hsmmc.1),
 };
@@ -119,7 +125,8 @@ static void __init rm680_peripherals_init(void)
platform_add_devices(rm680_peripherals_devices,
ARRAY_SIZE(rm680_peripherals_devices));
rm680_i2c_init();
-   gpmc_onenand_init(board_onenand_data);
+   *gpmc_device_data = gpmc_onenand_init(board_onenand_data);
+   gpmc_data.num_device++;
omap_hsmmc_init(mmc);
 }
 
@@ -141,6 +148,7 @@ static void __init rm680_init(void)
 
usb_musb_init(NULL);
rm680_peripherals_init();
+   omap_init_gpmc(gpmc_data);
 }
 
 MACHINE_START(NOKIA_RM680, Nokia RM-680 board)
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 36/39] ARM: OMAP2+: board rx51: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-rx51-peripherals.c |   17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c 
b/arch/arm/mach-omap2/board-rx51-peripherals.c
index ae957c9..af7909e 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -73,6 +73,13 @@ enum {
 static struct wl12xx_platform_data wl1251_pdata;
 static struct tsc2005_platform_data tsc2005_pdata;
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
 static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
.cover_comp_gain = 16,
@@ -1039,7 +1046,11 @@ static void __init board_smc91x_init(void)
omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
 
-   gpmc_smc91x_init(board_smc91x_data);
+   *gpmc_cur = gpmc_smc91x_init(board_smc91x_data);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: gpmc smsc911x setup\n);
 }
 
 #else
@@ -1136,8 +1147,10 @@ void __init rx51_peripherals_init(void)
 {
rx51_i2c_init();
regulator_has_full_constraints();
-   gpmc_onenand_init(board_onenand_data);
+   *gpmc_cur++ = gpmc_onenand_init(board_onenand_data);
+   gpmc_data.num_device++;
board_smc91x_init();
+   omap_init_gpmc(gpmc_data);
rx51_add_gpio_keys();
rx51_init_wl1251();
rx51_init_tsc2005();
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 37/39] ARM: OMAP2+: board zoom-debugboard: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-zoom-debugboard.c |   47 +++
 1 file changed, 27 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c 
b/arch/arm/mach-omap2/board-zoom-debugboard.c
index f64f441..dae7df2 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -31,6 +31,13 @@
 #define DEBUG_BASE 0x0800
 #define ZOOM_ETHR_STARTDEBUG_BASE
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 static struct omap_smsc911x_platform_data zoom_smsc911x_cfg = {
.cs = ZOOM_SMSC911X_CS,
.gpio_irq   = ZOOM_SMSC911X_GPIO,
@@ -40,7 +47,11 @@ static struct omap_smsc911x_platform_data zoom_smsc911x_cfg 
= {
 
 static inline void __init zoom_init_smsc911x(void)
 {
-   gpmc_smsc911x_init(zoom_smsc911x_cfg);
+   *gpmc_cur = gpmc_smsc911x_init(zoom_smsc911x_cfg);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: %s: gpmc smsc911x setup\n, __func__);
 }
 
 static struct plat_serial8250_port serial_platform_data[] = {
@@ -56,18 +67,22 @@ static struct plat_serial8250_port serial_platform_data[] = 
{
}
 };
 
-static struct platform_device zoom_debugboard_serial_device = {
+static struct gpmc_cs_data zoom_debugboard_gpmc_cs_serial_data = {
+   .cs = ZOOM_QUADUART_CS,
+   .mem_size   = SZ_1M,
+};
+
+static struct gpmc_device_pdata zoom_debugboard_gpmc_serial_data = {
.name   = serial8250,
.id = PLAT8250_DEV_PLATFORM,
-   .dev= {
-   .platform_data  = serial_platform_data,
-   },
+   .pdata  = serial_platform_data,
+   .pdata_size = sizeof(serial_platform_data),
+   .cs_data= zoom_debugboard_gpmc_cs_serial_data,
+   .num_cs = 1,
 };
 
 static inline void __init zoom_init_quaduart(void)
 {
-   int quart_cs;
-   unsigned long cs_mem_base;
int quart_gpio = 0;
 
if (gpio_request_one(ZOOM_QUADUART_RST_GPIO,
@@ -78,14 +93,6 @@ static inline void __init zoom_init_quaduart(void)
return;
}
 
-   quart_cs = ZOOM_QUADUART_CS;
-
-   if (gpmc_cs_request(quart_cs, SZ_1M, cs_mem_base)  0) {
-   printk(KERN_ERR Failed to request GPMC mem
-   for Quad UART(TL16CP754C)\n);
-   return;
-   }
-
quart_gpio = ZOOM_QUADUART_GPIO;
 
if (gpio_request_one(quart_gpio, GPIOF_IN, TL16CP754C GPIO)  0)
@@ -93,6 +100,9 @@ static inline void __init zoom_init_quaduart(void)
quart_gpio);
 
serial_platform_data[0].irq = gpio_to_irq(102);
+
+   *gpmc_cur++ = zoom_debugboard_gpmc_serial_data;
+   gpmc_data.num_device++;
 }
 
 static inline int omap_zoom_debugboard_detect(void)
@@ -116,10 +126,6 @@ static inline int omap_zoom_debugboard_detect(void)
return ret;
 }
 
-static struct platform_device *zoom_devices[] __initdata = {
-   zoom_debugboard_serial_device,
-};
-
 static struct regulator_consumer_supply dummy_supplies[] = {
REGULATOR_SUPPLY(vddvario, smsc911x.0),
REGULATOR_SUPPLY(vdd33a, smsc911x.0),
@@ -133,5 +139,6 @@ int __init zoom_debugboard_init(void)
regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
zoom_init_smsc911x();
zoom_init_quaduart();
-   return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
+   omap_init_gpmc(gpmc_data);
+   return 0;
 }
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 39/39] ARM: OMAP2+: board igep0020: gpmc driver adaptation

2012-05-01 Thread Afzal Mohammed
gpmc code has been converted to driver. Modify the board
code to provide gpmc driver with required information.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/mach-omap2/board-igep0020.c |   32 
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index 6d171ca..91de8ce 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -36,6 +36,7 @@
 #include video/omapdss.h
 #include video/omap-panel-dvi.h
 #include plat/onenand.h
+#include plat/nand.h
 
 #include mux.h
 #include hsmmc.h
@@ -118,6 +119,13 @@ static void __init igep2_get_revision(void)
gpio_free(IGEP2_GPIO_LED1_RED);
 }
 
+static struct gpmc_device_pdata *gpmc_device_data[2];
+static struct gpmc_device_pdata **gpmc_cur = gpmc_device_data;
+
+static struct gpmc_pdata gpmc_data = {
+   .device_pdata = gpmc_device_data,
+};
+
 #if defined(CONFIG_MTD_ONENAND_OMAP2) ||   \
defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) || \
defined(CONFIG_MTD_NAND_OMAP2) ||   \
@@ -172,14 +180,26 @@ static void __init igep_flash_init(void)
mux = igep_get_sysboot_value();
 
if (mux == IGEP_SYSBOOT_NAND) {
+   struct omap_nand_platform_data *nand_data;
+
pr_info(IGEP: initializing NAND memory device\n);
-   board_nand_init(igep_flash_partitions,
+   nand_data = board_nand_init(igep_flash_partitions,
ARRAY_SIZE(igep_flash_partitions),
-   0, NAND_BUSWIDTH_16, NULL);
+   0, NAND_BUSWIDTH_16, nand_default_timings);
+   if (nand_data != NULL) {
+   *gpmc_cur++ = gpmc_nand_init(nand_data);
+   gpmc_data.num_device++;
+   }
} else if (mux == IGEP_SYSBOOT_ONENAND) {
+   struct omap_onenand_platform_data *onenand_data;
+
pr_info(IGEP: initializing OneNAND memory device\n);
-   board_onenand_init(igep_flash_partitions,
+   onenand_data = board_onenand_init(igep_flash_partitions,
   ARRAY_SIZE(igep_flash_partitions), 0);
+   if (onenand_data != NULL) {
+   *gpmc_cur++ = gpmc_onenand_init(onenand_data);
+   gpmc_data.num_device++;
+   }
} else
pr_err(IGEP: Flash: unsupported sysboot sequence found\n);
 }
@@ -202,7 +222,11 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
 
 static inline void __init igep2_init_smsc911x(void)
 {
-   gpmc_smsc911x_init(smsc911x_cfg);
+   *gpmc_cur = gpmc_smsc911x_init(smsc911x_cfg);
+   if (*gpmc_cur)
+   gpmc_data.num_device++, gpmc_cur++;
+   else
+   pr_err(error: gpmc smsc911x setup\n);
 }
 
 #else
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 38/39] OMAP3: igep0020: Add support for Micron NAND Flash storage memory

2012-05-01 Thread Afzal Mohammed
From: Javier Martinez Canillas jav...@dowhile0.org

IGEP-based boards can have two different flash memories, a OneNAND or
a NAND device. The boot configuration pins (sys_boot) are used to
specify which memory is available.

Also, this patch removes unnecesary code for registering the OneNAND.

af...@ti.com: Update to use modified board_nand_init

Signed-off-by: Javier Martinez Canillas jav...@dowhile0.org
Signed-off-by: Afzal Mohammed af...@ti.com

fixup: igep
---
 arch/arm/mach-omap2/board-igep0020.c |   75 ++
 1 file changed, 31 insertions(+), 44 deletions(-)

diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index 930c0d3..6d171ca 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -24,6 +24,8 @@
 #include linux/i2c/twl.h
 #include linux/mmc/host.h
 
+#include linux/mtd/nand.h
+
 #include asm/mach-types.h
 #include asm/mach/arch.h
 
@@ -39,6 +41,8 @@
 #include hsmmc.h
 #include sdram-numonyx-m65kam.h
 #include common-board-devices.h
+#include board-flash.h
+#include control.h
 
 #define IGEP2_SMSC911X_CS   5
 #define IGEP2_SMSC911X_GPIO 176
@@ -60,6 +64,10 @@
 #define IGEP3_GPIO_LED1_RED16
 #define IGEP3_GPIO_USBH_NRESET  183
 
+#define IGEP_SYSBOOT_MASK   0x1f
+#define IGEP_SYSBOOT_NAND   0x0f
+#define IGEP_SYSBOOT_ONENAND0x10
+
 /*
  * IGEP2 Hardware Revision Table
  *
@@ -110,8 +118,10 @@ static void __init igep2_get_revision(void)
gpio_free(IGEP2_GPIO_LED1_RED);
 }
 
-#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
-   defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
+#if defined(CONFIG_MTD_ONENAND_OMAP2) ||   \
+   defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) || \
+   defined(CONFIG_MTD_NAND_OMAP2) ||   \
+   defined(CONFIG_MTD_NAND_OMAP2_MODULE)
 
 #define ONENAND_MAP 0x2000
 
@@ -123,7 +133,7 @@ static void __init igep2_get_revision(void)
  * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
  */
 
-static struct mtd_partition igep_onenand_partitions[] = {
+static struct mtd_partition igep_flash_partitions[] = {
{
.name   = X-Loader,
.offset = 0,
@@ -151,50 +161,27 @@ static struct mtd_partition igep_onenand_partitions[] = {
},
 };
 
-static struct omap_onenand_platform_data igep_onenand_data = {
-   .parts = igep_onenand_partitions,
-   .nr_parts = ARRAY_SIZE(igep_onenand_partitions),
-   .dma_channel= -1,   /* disable DMA in OMAP OneNAND driver */
-};
-
-static struct platform_device igep_onenand_device = {
-   .name   = omap2-onenand,
-   .id = -1,
-   .dev = {
-   .platform_data = igep_onenand_data,
-   },
-};
+static inline u32 igep_get_sysboot_value(void)
+{
+   return omap_ctrl_readl(OMAP343X_CONTROL_STATUS)  IGEP_SYSBOOT_MASK;
+}
 
 static void __init igep_flash_init(void)
 {
-   u8 cs = 0;
-   u8 onenandcs = GPMC_CS_NUM + 1;
-
-   for (cs = 0; cs  GPMC_CS_NUM; cs++) {
-   u32 ret;
-   ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
-
-   /* Check if NAND/oneNAND is configured */
-   if ((ret  0xC00) == 0x800)
-   /* NAND found */
-   pr_err(IGEP: Unsupported NAND found\n);
-   else {
-   ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
-   if ((ret  0x3F) == (ONENAND_MAP  24))
-   /* ONENAND found */
-   onenandcs = cs;
-   }
-   }
-
-   if (onenandcs  GPMC_CS_NUM) {
-   pr_err(IGEP: Unable to find configuration in GPMC\n);
-   return;
-   }
-
-   igep_onenand_data.cs = onenandcs;
-
-   if (platform_device_register(igep_onenand_device)  0)
-   pr_err(IGEP: Unable to register OneNAND device\n);
+   u32 mux;
+   mux = igep_get_sysboot_value();
+
+   if (mux == IGEP_SYSBOOT_NAND) {
+   pr_info(IGEP: initializing NAND memory device\n);
+   board_nand_init(igep_flash_partitions,
+   ARRAY_SIZE(igep_flash_partitions),
+   0, NAND_BUSWIDTH_16, NULL);
+   } else if (mux == IGEP_SYSBOOT_ONENAND) {
+   pr_info(IGEP: initializing OneNAND memory device\n);
+   board_onenand_init(igep_flash_partitions,
+  ARRAY_SIZE(igep_flash_partitions), 0);
+   } else
+   pr_err(IGEP: Flash: unsupported sysboot sequence found\n);
 }
 
 #else
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


GPMC in HWMOD (and a related AM335X issue)

2012-02-09 Thread Afzal Mohammed
Hi,

OMAP HWMOD currently does not have GPMC adapted to it.

We are facing a problem indirectly related to it in the case of
AM335X SoC. It can reuse GPMC code of OMAP except that base address
 IRQ# is different. But we get a kernel crash without
(at least) following change

---
arm:omap:gpmc: am33xx base address

GPMC base address of AM335X SoC is same as that of OMAP44XX,
update it (eventhough AM33XX is a member of OMAP34XX family)
Without this change, Kernel would crash for AM335X

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index dfffbbf..4ee2e90 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -711,7 +711,10 @@ static int __init gpmc_init(void)
gpmc_irq = INT_34XX_GPMC_IRQ;
} else if (cpu_is_omap34xx()) {
ck = gpmc_fck;
-   l = OMAP34XX_GPMC_BASE;
+   if (cpu_is_am33xx())
+   l = OMAP44XX_GPMC_BASE;
+   else
+   l = OMAP34XX_GPMC_BASE;
gpmc_irq = INT_34XX_GPMC_IRQ;
} else if (cpu_is_omap44xx()) {
ck = gpmc_ck;
---

But the above is not sufficient, even the IRQ # has to be changed
And for that we need to feed the proper IRQ # too. Now if it was a
HWMOD device, we could have passed it in HWMOD database  it would
have been taken care. Other option is to have a new AM335X specific
IRQ header file (which, if my understanding is correct, we can't get
into mainline as HWMOD is present for OMAP  due to DT things)

HWMOD entries currently does contain GPMC, is it due to the reason that
GPMC is not yet adapted to omap_device / omap_hwmod or is there any
other reason for not having it in HWMOD (as GPMC not yet a driver?)

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] AM335X: SoC type detection SRAM support

2012-02-10 Thread Afzal Mohammed
Hi,

These changes does,
1. detect SoC type (i.e. GP or not)
2. add minimal SRAM support
 for AM335X devices

These are required to get AM335X boot to prompt (but not sufficient)

Regards
Afzal

Afzal Mohammed (1):
  arm:omap:am33xx: SoC type detection

Vaibhav Bedia (1):
  arm:omap: am33xx SRAM support (minimal)

 arch/arm/mach-omap2/control.h  |5 +
 arch/arm/mach-omap2/id.c   |2 ++
 arch/arm/plat-omap/include/plat/sram.h |1 +
 arch/arm/plat-omap/sram.c  |   14 --
 4 files changed, 20 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] arm:omap:am33xx: SoC type detection

2012-02-10 Thread Afzal Mohammed
Determine SoC type, i.e. whether GP or not

Note: cpu_is_34xx() is true for am33xx also. Doing
cpu_is_am33xx() check after cpu_is_34xx() will not
achieve what we want due to the above reason.
Hence cpu_is_am33xx() is done before cpu_is_34xx()

Signed-off-by: Afzal Mohammed af...@ti.com
Signed-off-by: Vaibhav Hiremath hvaib...@ti.com
---
 arch/arm/mach-omap2/control.h |5 +
 arch/arm/mach-omap2/id.c  |2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 0ba68d3..96c4bcc 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -339,6 +339,11 @@
 #define AM35XX_VPFE_PCLK_SW_RSTBIT(4)
 
 /*
+ * CONTROL AM33XX STATUS register
+ */
+#define AM33XX_CONTROL_STATUS  0x040
+
+/*
  * CONTROL OMAP STATUS register to identify OMAP3 features
  */
 #define OMAP3_CONTROL_OMAP_STATUS  0x044c
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 92e4d55..2879c7b 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -44,6 +44,8 @@ int omap_type(void)
 
if (cpu_is_omap24xx()) {
val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
+   } else if (cpu_is_am33xx()) {
+   val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
} else if (cpu_is_omap34xx()) {
val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
} else if (cpu_is_omap44xx()) {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] arm:omap: am33xx SRAM support (minimal)

2012-02-10 Thread Afzal Mohammed
From: Vaibhav Bedia vaibhav.be...@ti.com

Update SRAM start  size for am33xx SoC's.

Note: cpu_is_34xx() is true for am33xx also. Doing
cpu_is_am33xx() check after cpu_is_34xx() will not
achieve what we want due to the above reason.
Hence cpu_is_am33xx() is done before cpu_is_34xx()

Signed-off-by: Vaibhav Bedia vaibhav.be...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/plat-omap/include/plat/sram.h |1 +
 arch/arm/plat-omap/sram.c  |   14 --
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/sram.h 
b/arch/arm/plat-omap/include/plat/sram.h
index 75aa1b2..227ae26 100644
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ b/arch/arm/plat-omap/include/plat/sram.h
@@ -101,4 +101,5 @@ static inline void omap_push_sram_idle(void) {}
 #else
 #define OMAP4_SRAM_PA  0x4030
 #endif
+#define AM33XX_SRAM_PA 0x4030
 #endif
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 4243bdc..596f222 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -86,7 +86,7 @@ static int is_sram_locked(void)
__raw_writel(0xCFDE, OMAP24XX_VA_READPERM0);  /* all 
i-read */
__raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all 
i-write */
}
-   if (cpu_is_omap34xx()) {
+   if (cpu_is_omap34xx()  !cpu_is_am33xx()) {
__raw_writel(0x, OMAP34XX_VA_REQINFOPERM0); /* all 
q-vects */
__raw_writel(0x, OMAP34XX_VA_READPERM0);  /* all 
i-read */
__raw_writel(0x, OMAP34XX_VA_WRITEPERM0); /* all 
i-write */
@@ -124,7 +124,10 @@ static void __init omap_detect_sram(void)
omap_sram_size = 0x800; /* 2K */
}
} else {
-   if (cpu_is_omap34xx()) {
+   if (cpu_is_am33xx()) {
+   omap_sram_start = AM33XX_SRAM_PA;
+   omap_sram_size = 0x1; /* 64K */
+   } else if (cpu_is_omap34xx()) {
omap_sram_start = OMAP3_SRAM_PA;
omap_sram_size = 0x1; /* 64K */
} else if (cpu_is_omap44xx()) {
@@ -368,6 +371,11 @@ static inline int omap34xx_sram_init(void)
return 0;
 }
 
+static inline int am33xx_sram_init(void)
+{
+   return 0;
+}
+
 int __init omap_sram_init(void)
 {
omap_detect_sram();
@@ -379,6 +387,8 @@ int __init omap_sram_init(void)
omap242x_sram_init();
else if (cpu_is_omap2430())
omap243x_sram_init();
+   else if (cpu_is_am33xx())
+   am33xx_sram_init();
else if (cpu_is_omap34xx())
omap34xx_sram_init();
 
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/2] AM335X: SoC type detection SRAM support

2012-02-12 Thread Afzal Mohammed
Hi,

These changes does,
1. detect SoC type (i.e. GP or not)
2. add minimal SRAM support
 for AM335X devices

These are required to get AM335X boot to prompt (but not sufficient)

v2: Use OMAP naming conventions for subject

Regards
Afzal

Afzal Mohammed (1):
  ARM: OMAP2+: id: Add am33xx SoC type detection

Vaibhav Bedia (1):
  ARM: OMAP: sram: Add am33xx SRAM support (minimal)

 arch/arm/mach-omap2/control.h  |5 +
 arch/arm/mach-omap2/id.c   |2 ++
 arch/arm/plat-omap/include/plat/sram.h |1 +
 arch/arm/plat-omap/sram.c  |   14 --
 4 files changed, 20 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] ARM: OMAP2+: id: Add am33xx SoC type detection

2012-02-12 Thread Afzal Mohammed
Determine SoC type, i.e. whether GP or HS

Note: cpu_is_34xx() is true for am33xx also. Doing
cpu_is_am33xx() check after cpu_is_34xx() will not
achieve what we want due to the above reason.
Hence cpu_is_am33xx() is done before cpu_is_34xx()

Signed-off-by: Afzal Mohammed af...@ti.com
Signed-off-by: Vaibhav Hiremath hvaib...@ti.com
---

v2: Use OMAP naming conventions for subject

 arch/arm/mach-omap2/control.h |5 +
 arch/arm/mach-omap2/id.c  |2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 0ba68d3..96c4bcc 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -339,6 +339,11 @@
 #define AM35XX_VPFE_PCLK_SW_RSTBIT(4)
 
 /*
+ * CONTROL AM33XX STATUS register
+ */
+#define AM33XX_CONTROL_STATUS  0x040
+
+/*
  * CONTROL OMAP STATUS register to identify OMAP3 features
  */
 #define OMAP3_CONTROL_OMAP_STATUS  0x044c
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 92e4d55..2879c7b 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -44,6 +44,8 @@ int omap_type(void)
 
if (cpu_is_omap24xx()) {
val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
+   } else if (cpu_is_am33xx()) {
+   val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
} else if (cpu_is_omap34xx()) {
val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
} else if (cpu_is_omap44xx()) {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] ARM: OMAP: sram: Add am33xx SRAM support (minimal)

2012-02-12 Thread Afzal Mohammed
From: Vaibhav Bedia vaibhav.be...@ti.com

Update SRAM start  size for am33xx SoC's.

Note: cpu_is_34xx() is true for am33xx also. Doing
cpu_is_am33xx() check after cpu_is_34xx() will not
achieve what we want due to the above reason.
Hence cpu_is_am33xx() is done before cpu_is_34xx()

Signed-off-by: Vaibhav Bedia vaibhav.be...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---

v2: Use OMAP naming conventions for subject

 arch/arm/plat-omap/include/plat/sram.h |1 +
 arch/arm/plat-omap/sram.c  |   14 --
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/sram.h 
b/arch/arm/plat-omap/include/plat/sram.h
index 75aa1b2..227ae26 100644
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ b/arch/arm/plat-omap/include/plat/sram.h
@@ -101,4 +101,5 @@ static inline void omap_push_sram_idle(void) {}
 #else
 #define OMAP4_SRAM_PA  0x4030
 #endif
+#define AM33XX_SRAM_PA 0x4030
 #endif
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 4243bdc..596f222 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -86,7 +86,7 @@ static int is_sram_locked(void)
__raw_writel(0xCFDE, OMAP24XX_VA_READPERM0);  /* all 
i-read */
__raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all 
i-write */
}
-   if (cpu_is_omap34xx()) {
+   if (cpu_is_omap34xx()  !cpu_is_am33xx()) {
__raw_writel(0x, OMAP34XX_VA_REQINFOPERM0); /* all 
q-vects */
__raw_writel(0x, OMAP34XX_VA_READPERM0);  /* all 
i-read */
__raw_writel(0x, OMAP34XX_VA_WRITEPERM0); /* all 
i-write */
@@ -124,7 +124,10 @@ static void __init omap_detect_sram(void)
omap_sram_size = 0x800; /* 2K */
}
} else {
-   if (cpu_is_omap34xx()) {
+   if (cpu_is_am33xx()) {
+   omap_sram_start = AM33XX_SRAM_PA;
+   omap_sram_size = 0x1; /* 64K */
+   } else if (cpu_is_omap34xx()) {
omap_sram_start = OMAP3_SRAM_PA;
omap_sram_size = 0x1; /* 64K */
} else if (cpu_is_omap44xx()) {
@@ -368,6 +371,11 @@ static inline int omap34xx_sram_init(void)
return 0;
 }
 
+static inline int am33xx_sram_init(void)
+{
+   return 0;
+}
+
 int __init omap_sram_init(void)
 {
omap_detect_sram();
@@ -379,6 +387,8 @@ int __init omap_sram_init(void)
omap242x_sram_init();
else if (cpu_is_omap2430())
omap243x_sram_init();
+   else if (cpu_is_am33xx())
+   am33xx_sram_init();
else if (cpu_is_omap34xx())
omap34xx_sram_init();
 
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: musb: dsps: dt binding - add resources, example

2012-11-06 Thread Afzal Mohammed
OMAP2+ family of devices are now obtaining resources via DT, earlier
it was obtained from hwmod. Update binding document accrodingly, while
at it add example.

Signed-off-by: Afzal Mohammed af...@ti.com
---

v2: node name changed to usb

 .../devicetree/bindings/usb/am33xx-usb.txt  | 21 +
 1 file changed, 21 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index a922505..ea840f7 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -1,5 +1,7 @@
 AM33XX MUSB GLUE
  - compatible : Should be ti,musb-am33xx
+ - reg : offset and length of register sets, first usbss, then for musb 
instances
+ - interrupts : usbss, musb instance interrupts in order
  - ti,hwmods : must be usb_otg_hs
  - multipoint : Should be 1 indicating the musb controller supports
multipoint. This is a MUSB configuration-specific setting.
@@ -12,3 +14,22 @@ AM33XX MUSB GLUE
represents PERIPHERAL.
  - power : Should be 250. This signifies the controller can supply upto
500mA when operating in host mode.
+
+Example:
+
+usb@4740  {
+   compatible = ti,musb-am33xx;
+   reg = 0x4740 0x1000/* usbss */
+  0x47401000 0x800 /* musb instance 0 */
+  0x47401800 0x800;   /* musb instance 1 */
+   interrupts = 17/* usbss */
+ 18/* musb instance 0 */
+ 19;  /* musb instance 1 */
+   multipoint = 1;
+   num-eps = 16;
+   ram-bits = 12;
+   port0-mode = 3;
+   port1-mode = 3;
+   power = 250;
+   ti,hwmods = usb_otg_hs;
+};
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] ARM: dts: AM33XX: Add usbss node

2012-11-06 Thread Afzal Mohammed
From: Ajay Kumar Gupta ajay.gu...@ti.com

Device tree node for usbss on AM33XX. There are two musb
controllers on am33xx platform so have port0-mode and
port1-mode data.

[af...@ti.com: reg  interrupt property addition]

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---

v2: node named as usb

Depends on usb: musb: dsps: dt binding - add resources, example
(https://patchwork.kernel.org/patch/1704691/)

 arch/arm/boot/dts/am33xx.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 5dfd682..20a3f29 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -321,5 +321,22 @@
ti,hwmods = spi1;
status = disabled;
};
+
+   usb@4740 {
+   compatible = ti,musb-am33xx;
+   reg = 0x4740 0x1000/* usbss */
+  0x47401000 0x800 /* musb instance 0 */
+  0x47401800 0x800;   /* musb instance 1 */
+   interrupts = 17/* usbss */
+ 18/* musb instance 0 */
+ 19;  /* musb instance 1 */
+   multipoint = 1;
+   num-eps = 16;
+   ram-bits = 12;
+   port0-mode = 3;
+   port1-mode = 3;
+   power = 250;
+   ti,hwmods = usb_otg_hs;
+   };
};
 };
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] usb: musb: dsps: dt binding - add resources, example

2012-11-06 Thread Afzal Mohammed

Hi Balbi,

On Tuesday 06 November 2012 06:32 PM, Felipe Balbi wrote:

On Fri, Nov 02, 2012 at 10:02:47PM +0530, Afzal Mohammed wrote:



+Example:
+
+usb_otg_hs@4740  {



this should be usb@4740.


Updated version with the above change has been posted.

Regards
Afzal
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RESEND 0/2] usb: musb: am335x support part-2

2012-11-06 Thread Afzal Mohammed
Hi Balbi,

This is a resend of remaining changes to get am335x usb working. These
were sent on 31 Oct with subject, usb: musb: dsps: fixes for -rc.

First one restores capability to support at least one instance of musb.
Without it, even a single instance can't be supported as change which
is reverted by it was made along with multi phy changes and nop
transciever dt support, both other changes didn't make it to mainline. 

Second one corrects binding document; changes were made in driver as
per review comments, but documentation was not updated.

This is made on top of your musb branch. To get USB0 functional on
am335x based boards like beagle bone, first one is required.

Regards
Afzal

Afzal Mohammed (2):
  Revert usb: musb: dsps: remove explicit NOP device creation
  usb: musb: dsps: document dt bindings properly

 Documentation/devicetree/bindings/usb/am33xx-usb.txt | 8 
 drivers/usb/musb/musb_dsps.c | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RESEND 1/2] Revert usb: musb: dsps: remove explicit NOP device creation

2012-11-06 Thread Afzal Mohammed
This reverts commit d8c3ef256f88b7c6ecd673d03073b5645be9c5e4.

Above mentioned change was made along with multi usb phy change and
adding DT support for nop transceiver. But other two changes did not
make it to mainline. This in effect makes dsps musb wrapper unusable
even for single instance.

Hence revert it so that at least single instance can be supported.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 6053af1..e770f79 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -411,7 +411,8 @@ static int dsps_musb_init(struct musb *musb)
/* mentor core register starts at offset of 0x400 from musb base */
musb-mregs += wrp-musb_core_offset;
 
-   /* Get the NOP PHY */
+   /* NOP driver needs change if supporting dual instance */
+   usb_nop_xceiv_register();
musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb-xceiv))
return -ENODEV;
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RESEND 2/2] usb: musb: dsps: document dt bindings properly

2012-11-06 Thread Afzal Mohammed
DT bindings normally use '-' (hyphens) instead of '_' (underscore),
driver has it the proper way, but binding documentation does not
reflect it, fix it.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 Documentation/devicetree/bindings/usb/am33xx-usb.txt | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index ca8fa56..a922505 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -3,12 +3,12 @@ AM33XX MUSB GLUE
  - ti,hwmods : must be usb_otg_hs
  - multipoint : Should be 1 indicating the musb controller supports
multipoint. This is a MUSB configuration-specific setting.
- - num_eps : Specifies the number of endpoints. This is also a
+ - num-eps : Specifies the number of endpoints. This is also a
MUSB configuration-specific setting. Should be set to 16
- - ram_bits : Specifies the ram address size. Should be set to 12
- - port0_mode : Should be 3 to represent OTG. 1 signifies HOST and 2
+ - ram-bits : Specifies the ram address size. Should be set to 12
+ - port0-mode : Should be 3 to represent OTG. 1 signifies HOST and 2
represents PERIPHERAL.
- - port1_mode : Should be 1 to represent HOST. 3 signifies OTG and 2
+ - port1-mode : Should be 1 to represent HOST. 3 signifies OTG and 2
represents PERIPHERAL.
  - power : Should be 250. This signifies the controller can supply upto
500mA when operating in host mode.
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL] ARM: OMAP: GPMC generic timing

2012-11-09 Thread Afzal Mohammed
The following changes since commit 6ba54ab4a49bbad736b0254aa6bdf0cb83013815:

  ARM: OMAP: Remove omap_init_consistent_dma_size() (2012-11-06 16:01:19 -0800)

are available in the git repository at:

  git://gitorious.org/x0148406-public/linux-kernel.git tags/gpmc-generic-timing

for you to fetch changes up to 47acde16726080e5157b602f23937d00a04cd2ed:

  ARM: OMAP2+: tusb6010: generic timing calculation (2012-11-09 18:07:23 +0530)


These changes provide a generic gpmc timing calculation method,
migrates existing peripherals that makes use of custom gpmc timing
calculation method to use the new generic one.

Generic routine has been verified for onenand async timing calculation
on omap3evm (with a local change to add onenand support). Generic
timing calculation method were verified for other peripherals by
simulation. Generic method has to be verified on peripherals supported
in mainline.


Afzal Mohammed (6):
  ARM: OMAP2+: nand: remove redundant rounding
  ARM: OMAP2+: gpmc: handle additional timings
  ARM: OMAP2+: gpmc: generic timing calculation
  ARM: OMAP2+: onenand: generic timing calculation
  ARM: OMAP2+: smc91x: generic timing calculation
  ARM: OMAP2+: tusb6010: generic timing calculation

 Documentation/bus-devices/ti-gpmc.txt | 122 +++
 arch/arm/mach-omap2/gpmc-nand.c   |  26 +--
 arch/arm/mach-omap2/gpmc-onenand.c| 143 -
 arch/arm/mach-omap2/gpmc-smc91x.c |  43 ++--
 arch/arm/mach-omap2/gpmc.c| 373 ++
 arch/arm/mach-omap2/gpmc.h| 113 --
 arch/arm/mach-omap2/usb-tusb6010.c| 181 -
 7 files changed, 709 insertions(+), 292 deletions(-)
 create mode 100644 Documentation/bus-devices/ti-gpmc.txt
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: musb: dsps: header movement build error fix

2012-11-27 Thread Afzal Mohammed
54db6ee ARM: OMAP2+: Introduce local usb.h moved control module bit
definitions from plat/usb.h (which dsps glue was using) to a local
header in mach-omap2. And in parallel,
c68bb4c usb: musb: dsps: control module handling (quirk) added
control module handling capability to dsps glue driver that used
those control module bit definitions.

Integration of above two changes would cause build error in musb dsps
glue driver (they go through different trees upstream) as is seen now
in linux-next. Fix it by adding necessary definitions in dsps glue
driver.

Signed-off-by: Afzal Mohammed af...@ti.com
---

Hi Felipe,

This applies on top of your musb branch, please help this reach
mainline along with other musb dsps changes for coming merge window
so that they would not cause build error and so that we can have a
working usb in mainline for am335x (beaglebone) at the earliest.

Regards
Afzal

 drivers/usb/musb/musb_dsps.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index e6f2ae8..f7d764d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -134,6 +134,11 @@ static const resource_size_t dsps_control_module_phys[] = {
DSPS_AM33XX_CONTROL_MODULE_PHYS_1,
 };
 
+#define USBPHY_CM_PWRDN(1  0)
+#define USBPHY_OTG_PWRDN   (1  1)
+#define USBPHY_OTGVDET_EN  (1  19)
+#define USBPHY_OTGSESSEND_EN   (1  20)
+
 /**
  * musb_dsps_phy_control - phy on/off
  * @glue: struct dsps_glue *
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 00/10] video: da8xx-fb: runtime timing configuration

2013-01-06 Thread Afzal Mohammed
Hi,

This series makes da8xx-fb driver (device found on DaVinci and AM335x)
capable of handling runtime timing configuration by adding fb_set_par.

The last change adds actual fb_set_par support. Other preceeding
changes makes the way clear for it as well as does certain cleanup's
on the way.

This has been tested on da850 evm as is. This was also tested on
am335x-evm  am335x-evmsk with a series that adds DT support which
follows shortly.

This is based on v3.8-rc2

Regards
Afzal

v2: disable raster in fb_set_par properly

Afzal Mohammed (10):
  video: da8xx-fb: fb_check_var enhancement
  video: da8xx-fb: simplify lcd_reset
  video: da8xx-fb: use modedb helper to update var
  video: da8xx-fb: remove unneeded var initialization
  video: da8xx-fb: store current display information
  video: da8xx-fb: store clk rate even if !CPUFREQ
  video: da8xx-fb: pix clk and clk div handling cleanup
  video: da8xx-fb: store struct device *
  video: da8xx-fb: report correct pixclock
  video: da8xx-fb: fb_set_par support

 drivers/video/da8xx-fb.c |  181 +++---
 1 file changed, 105 insertions(+), 76 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 01/10] video: da8xx-fb: fb_check_var enhancement

2013-01-06 Thread Afzal Mohammed
Check whether struct fb_var_screeninfo fields are sane, if not
update it to be within allowed limits.

If user sends down buggy var values, this will bring those within
allowable limits. And fb_set_par is not supposed to change var
values, fb_check_var has to ensure that values are proper.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 46534e0..89446aa 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -888,6 +888,9 @@ static int fb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
 {
int err = 0;
+   struct da8xx_fb_par *par = info-par;
+   int bpp = var-bits_per_pixel  3;
+   unsigned long line_size = var-xres_virtual * bpp;
 
if (var-bits_per_pixel  16  lcd_revision == LCD_VERSION_1)
return -EINVAL;
@@ -955,6 +958,21 @@ static int fb_check_var(struct fb_var_screeninfo *var,
var-green.msb_right = 0;
var-blue.msb_right = 0;
var-transp.msb_right = 0;
+
+   if (line_size * var-yres_virtual  par-vram_size)
+   var-yres_virtual = par-vram_size / line_size;
+
+   if (var-yres  var-yres_virtual)
+   var-yres = var-yres_virtual;
+
+   if (var-xres  var-xres_virtual)
+   var-xres = var-xres_virtual;
+
+   if (var-xres + var-xoffset  var-xres_virtual)
+   var-xoffset = var-xres_virtual - var-xres;
+   if (var-yres + var-yoffset  var-yres_virtual)
+   var-yoffset = var-yres_virtual - var-yres;
+
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 03/10] video: da8xx-fb: use modedb helper to update var

2013-01-06 Thread Afzal Mohammed
modedb structure is now used to store panel information, run modedb
helper over it for initial update of var information instead of
equating each fields.

While at it, remove redundant update of bits_per_pixel.

Note: pixclock is overridden with proper value using an existing code
as currently modedb is having it in Hz instead of ps, this would be
fixed in a later change and this overide would be removed.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   18 ++
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index c8e97de..0c404ed 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1329,6 +1329,8 @@ static int __devinit fb_probe(struct platform_device 
*device)
par-panel_power_ctrl(1);
}
 
+   fb_videomode_to_var(da8xx_fb_var, lcdc_info);
+
if (lcd_init(par, lcd_cfg, lcdc_info)  0) {
dev_err(device-dev, lcd_init failed\n);
ret = -EFAULT;
@@ -1381,25 +1383,9 @@ static int __devinit fb_probe(struct platform_device 
*device)
goto err_release_pl_mem;
}
 
-   /* Initialize par */
-   da8xx_fb_info-var.bits_per_pixel = lcd_cfg-bpp;
-
-   da8xx_fb_var.xres = lcdc_info-xres;
-   da8xx_fb_var.xres_virtual = lcdc_info-xres;
-
-   da8xx_fb_var.yres = lcdc_info-yres;
-   da8xx_fb_var.yres_virtual = lcdc_info-yres * LCD_NUM_BUFFERS;
-
da8xx_fb_var.grayscale =
lcd_cfg-panel_shade == MONOCHROME ? 1 : 0;
da8xx_fb_var.bits_per_pixel = lcd_cfg-bpp;
-
-   da8xx_fb_var.hsync_len = lcdc_info-hsync_len;
-   da8xx_fb_var.vsync_len = lcdc_info-vsync_len;
-   da8xx_fb_var.right_margin = lcdc_info-right_margin;
-   da8xx_fb_var.left_margin  = lcdc_info-left_margin;
-   da8xx_fb_var.lower_margin = lcdc_info-lower_margin;
-   da8xx_fb_var.upper_margin = lcdc_info-upper_margin;
da8xx_fb_var.pixclock = da8xxfb_pixel_clk_period(par);
 
/* Initialize fbinfo */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 05/10] video: da8xx-fb: store current display information

2013-01-06 Thread Afzal Mohammed
store current videomode and controller data so that reconfiguring can
be done easily. Reconfiguring would be required in fb_set_par, which
is going to be added soon.

If these details are not stored, the work probe does to retrieve these
information would have to repeated at the place of reconfiguring and
modifying platform data would be necessary to handle controller data
changes like bpp.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 79862ff..072074d 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -182,6 +182,8 @@ struct da8xx_fb_par {
 #endif
void (*panel_power_ctrl)(int);
u32 pseudo_palette[16];
+   struct fb_videomode mode;
+   struct lcd_ctrl_config  cfg;
 };
 
 static struct fb_var_screeninfo da8xx_fb_var;
@@ -1314,6 +1316,8 @@ static int __devinit fb_probe(struct platform_device 
*device)
}
 
fb_videomode_to_var(da8xx_fb_var, lcdc_info);
+   fb_var_to_videomode(par-mode, da8xx_fb_var);
+   par-cfg = *lcd_cfg;
 
if (lcd_init(par, lcd_cfg, lcdc_info)  0) {
dev_err(device-dev, lcd_init failed\n);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 10/10] video: da8xx-fb: fb_set_par support

2013-01-06 Thread Afzal Mohammed
fb_set_par helps in runtime configuration of lcd controller like
changing resolution, pixel clock etc. (eg. using fbset utility)

Reconfigure lcd controller based on information passed by framework.
Enable raster back if it was already enabled.

As fb_set_par would get invoked indirectly from probe via fb_set_var,
remove existing lcdc initialization in probe and do lcdc reset in
probe so that reset happens only at the begining.

Signed-off-by: Afzal Mohammed af...@ti.com
---

v2: disable raster in fb_set_par properly as required, without this
there would be no issue on DA850, but it will cause problem on AM335X

 drivers/video/da8xx-fb.c |   60 +-
 1 file changed, 49 insertions(+), 11 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index c7393f1..240eac7 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -247,6 +247,11 @@ static struct fb_videomode known_lcd_panels[] = {
},
 };
 
+static inline bool da8xx_fb_is_raster_enabled(void)
+{
+   return !!(lcdc_read(LCD_RASTER_CTRL_REG)  LCD_RASTER_ENABLE);
+}
+
 /* Enable the Raster Engine of the LCD Controller */
 static inline void lcd_enable_raster(void)
 {
@@ -669,9 +674,6 @@ static int fb_setcolreg(unsigned regno, unsigned red, 
unsigned green,
 
 static void da8xx_fb_lcd_reset(void)
 {
-   /* Disable the Raster if previously Enabled */
-   lcd_disable_raster(false);
-
/* DMA has to be disabled */
lcdc_write(0, LCD_DMA_CTRL_REG);
lcdc_write(0, LCD_RASTER_CTRL_REG);
@@ -724,8 +726,6 @@ static int lcd_init(struct da8xx_fb_par *par, const struct 
lcd_ctrl_config *cfg,
u32 bpp;
int ret = 0;
 
-   da8xx_fb_lcd_reset();
-
da8xx_fb_calc_config_clk_divider(par, panel);
 
if (panel-sync  FB_SYNC_CLK_INVERT)
@@ -1205,9 +1205,52 @@ static int da8xx_pan_display(struct fb_var_screeninfo 
*var,
return ret;
 }
 
+static int da8xxfb_set_par(struct fb_info *info)
+{
+   struct da8xx_fb_par *par = info-par;
+   int ret;
+   bool raster = da8xx_fb_is_raster_enabled();
+
+   if (raster)
+   lcd_disable_raster(true);
+   else
+   lcd_disable_raster(false);
+
+   fb_var_to_videomode(par-mode, info-var);
+
+   par-cfg.bpp = info-var.bits_per_pixel;
+
+   info-fix.visual = (par-cfg.bpp = 8) ?
+   FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
+   info-fix.line_length = (par-mode.xres * par-cfg.bpp) / 8;
+
+   ret = lcd_init(par, par-cfg, par-mode);
+   if (ret  0) {
+   dev_err(par-dev, lcd init failed\n);
+   return ret;
+   }
+
+   par-dma_start = info-fix.smem_start +
+info-var.yoffset * info-fix.line_length +
+info-var.xoffset * info-var.bits_per_pixel / 8;
+   par-dma_end   = par-dma_start +
+info-var.yres * info-fix.line_length - 1;
+
+   lcdc_write(par-dma_start, LCD_DMA_FRM_BUF_BASE_ADDR_0_REG);
+   lcdc_write(par-dma_end, LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG);
+   lcdc_write(par-dma_start, LCD_DMA_FRM_BUF_BASE_ADDR_1_REG);
+   lcdc_write(par-dma_end, LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG);
+
+   if (raster)
+   lcd_enable_raster();
+
+   return 0;
+}
+
 static struct fb_ops da8xx_fb_ops = {
.owner = THIS_MODULE,
.fb_check_var = fb_check_var,
+   .fb_set_par = da8xxfb_set_par,
.fb_setcolreg = fb_setcolreg,
.fb_pan_display = da8xx_pan_display,
.fb_ioctl = fb_ioctl,
@@ -1316,14 +1359,9 @@ static int __devinit fb_probe(struct platform_device 
*device)
}
 
fb_videomode_to_var(da8xx_fb_var, lcdc_info);
-   fb_var_to_videomode(par-mode, da8xx_fb_var);
par-cfg = *lcd_cfg;
 
-   if (lcd_init(par, lcd_cfg, lcdc_info)  0) {
-   dev_err(device-dev, lcd_init failed\n);
-   ret = -EFAULT;
-   goto err_release_fb;
-   }
+   da8xx_fb_lcd_reset();
 
/* allocate frame buffer */
par-vram_size = lcdc_info-xres * lcdc_info-yres * lcd_cfg-bpp;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 08/10] video: da8xx-fb: store struct device *

2013-01-06 Thread Afzal Mohammed
store struct device pointer so that dev_dbg/err can be used outside
of probe.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 19ee560..663b3c5 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -154,6 +154,7 @@ static inline void lcdc_write(unsigned int val, unsigned 
int addr)
 }
 
 struct da8xx_fb_par {
+   struct device   *dev;
resource_size_t p_palette_base;
unsigned char *v_palette_base;
dma_addr_t  vram_phys;
@@ -1295,6 +1296,7 @@ static int __devinit fb_probe(struct platform_device 
*device)
}
 
par = da8xx_fb_info-par;
+   par-dev = device-dev;
par-lcdc_clk = fb_clk;
par-lcd_fck_rate = clk_get_rate(fb_clk);
if (fb_pdata-panel_power_ctrl) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 02/10] video: da8xx-fb: simplify lcd_reset

2013-01-06 Thread Afzal Mohammed
lcd_reset function doesn't require any arguement, remove it.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 89446aa..c8e97de 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -681,7 +681,7 @@ static int fb_setcolreg(unsigned regno, unsigned red, 
unsigned green,
 }
 #undef CNVT_TOHW
 
-static void lcd_reset(struct da8xx_fb_par *par)
+static void da8xx_fb_lcd_reset(void)
 {
/* Disable the Raster if previously Enabled */
lcd_disable_raster(false);
@@ -721,7 +721,7 @@ static int lcd_init(struct da8xx_fb_par *par, const struct 
lcd_ctrl_config *cfg,
u32 bpp;
int ret = 0;
 
-   lcd_reset(par);
+   da8xx_fb_lcd_reset();
 
/* Calculate the divider */
lcd_calc_clk_divider(par);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/10] video: da8xx-fb: remove unneeded var initialization

2013-01-06 Thread Afzal Mohammed
modedb helper now updates var information based on the detected
panel, remove the unnecessary initialization.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 0c404ed..79862ff 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -184,23 +184,7 @@ struct da8xx_fb_par {
u32 pseudo_palette[16];
 };
 
-/* Variable Screen Information */
-static struct fb_var_screeninfo da8xx_fb_var __devinitdata = {
-   .xoffset = 0,
-   .yoffset = 0,
-   .transp = {0, 0, 0},
-   .nonstd = 0,
-   .activate = 0,
-   .height = -1,
-   .width = -1,
-   .accel_flags = 0,
-   .left_margin = LEFT_MARGIN,
-   .right_margin = RIGHT_MARGIN,
-   .upper_margin = UPPER_MARGIN,
-   .lower_margin = LOWER_MARGIN,
-   .sync = 0,
-   .vmode = FB_VMODE_NONINTERLACED
-};
+static struct fb_var_screeninfo da8xx_fb_var;
 
 static struct fb_fix_screeninfo da8xx_fb_fix __devinitdata = {
.id = DA8xx FB Drv,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 06/10] video: da8xx-fb: store clk rate even if !CPUFREQ

2013-01-06 Thread Afzal Mohammed
store lcd clk rate always, i.e. irrespective of whether CPUFREQ is
enabled or not. This can be used to get clk rate directly instead of
enquiring with clock framework with clk handle every time.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 072074d..e858438 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -178,8 +178,8 @@ struct da8xx_fb_par {
unsigned intwhich_dma_channel_done;
 #ifdef CONFIG_CPU_FREQ
struct notifier_block   freq_transition;
-   unsigned intlcd_fck_rate;
 #endif
+   unsigned intlcd_fck_rate;
void (*panel_power_ctrl)(int);
u32 pseudo_palette[16];
struct fb_videomode mode;
@@ -1306,9 +1306,7 @@ static int __devinit fb_probe(struct platform_device 
*device)
 
par = da8xx_fb_info-par;
par-lcdc_clk = fb_clk;
-#ifdef CONFIG_CPU_FREQ
par-lcd_fck_rate = clk_get_rate(fb_clk);
-#endif
par-pxl_clk = lcdc_info-pixclock;
if (fb_pdata-panel_power_ctrl) {
par-panel_power_ctrl = fb_pdata-panel_power_ctrl;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 07/10] video: da8xx-fb: pix clk and clk div handling cleanup

2013-01-06 Thread Afzal Mohammed
Use the new modedb field to store pix clk. Reorganize existing clock
divider functions with names now corresponding to what they do, add
common function prefix.

Fix existing panel modedb pixclock to be in ps instead of Hz. This
needed a change in the way clock divider is calculated. As modedb
pixclock information is now in ps, override on var pixclock over
modedb to var conversion is removed.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   48 +-
 1 file changed, 18 insertions(+), 30 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index e858438..19ee560 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -164,7 +164,6 @@ struct da8xx_fb_par {
struct clk *lcdc_clk;
int irq;
unsigned int palette_sz;
-   unsigned int pxl_clk;
int blank;
wait_queue_head_t   vsync_wait;
int vsync_flag;
@@ -205,7 +204,7 @@ static struct fb_videomode known_lcd_panels[] = {
.name   = Sharp_LCD035Q3DG01,
.xres   = 320,
.yres   = 240,
-   .pixclock   = 4608000,
+   .pixclock   = 217014,
.left_margin= 6,
.right_margin   = 8,
.upper_margin   = 2,
@@ -220,7 +219,7 @@ static struct fb_videomode known_lcd_panels[] = {
.name   = Sharp_LK043T1DG01,
.xres   = 480,
.yres   = 272,
-   .pixclock   = 7833600,
+   .pixclock   = 127655,
.left_margin= 2,
.right_margin   = 2,
.upper_margin   = 2,
@@ -235,7 +234,7 @@ static struct fb_videomode known_lcd_panels[] = {
.name   = SP10Q010,
.xres   = 320,
.yres   = 240,
-   .pixclock   = 7833600,
+   .pixclock   = 127655,
.left_margin= 10,
.right_margin   = 10,
.upper_margin   = 10,
@@ -684,13 +683,14 @@ static void da8xx_fb_lcd_reset(void)
}
 }
 
-static void lcd_calc_clk_divider(struct da8xx_fb_par *par)
+static inline unsigned da8xx_fb_calc_clk_divider(struct da8xx_fb_par *par,
+unsigned pixclock)
 {
-   unsigned int lcd_clk, div;
-
-   lcd_clk = clk_get_rate(par-lcdc_clk);
-   div = lcd_clk / par-pxl_clk;
+   return par-lcd_fck_rate / (PICOS2KHZ(pixclock) * 1000);
+}
 
+static inline void da8xx_fb_config_clk_divider(unsigned div)
+{
/* Configure the LCD clock divisor. */
lcdc_write(LCD_CLK_DIVISOR(div) |
(LCD_RASTER_MODE  0x1), LCD_CTRL_REG);
@@ -698,7 +698,14 @@ static void lcd_calc_clk_divider(struct da8xx_fb_par *par)
if (lcd_revision == LCD_VERSION_2)
lcdc_write(LCD_V2_DMA_CLK_EN | LCD_V2_LIDD_CLK_EN |
LCD_V2_CORE_CLK_EN, LCD_CLK_ENABLE_REG);
+}
+
+static inline void da8xx_fb_calc_config_clk_divider(struct da8xx_fb_par *par,
+   struct fb_videomode *mode)
+{
+   unsigned div = da8xx_fb_calc_clk_divider(par, mode-pixclock);
 
+   da8xx_fb_config_clk_divider(div);
 }
 
 static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config 
*cfg,
@@ -709,8 +716,7 @@ static int lcd_init(struct da8xx_fb_par *par, const struct 
lcd_ctrl_config *cfg,
 
da8xx_fb_lcd_reset();
 
-   /* Calculate the divider */
-   lcd_calc_clk_divider(par);
+   da8xx_fb_calc_config_clk_divider(par, panel);
 
if (panel-sync  FB_SYNC_CLK_INVERT)
lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |
@@ -973,7 +979,7 @@ static int lcd_da8xx_cpufreq_transition(struct 
notifier_block *nb,
if (par-lcd_fck_rate != clk_get_rate(par-lcdc_clk)) {
par-lcd_fck_rate = clk_get_rate(par-lcdc_clk);
lcd_disable_raster(true);
-   lcd_calc_clk_divider(par);
+   da8xx_fb_calc_config_clk_divider(par, par-mode);
if (par-blank == FB_BLANK_UNBLANK)
lcd_enable_raster();
}
@@ -1199,22 +1205,6 @@ static struct fb_ops da8xx_fb_ops = {
.fb_blank = cfb_blank,
 };
 
-/* Calculate and return pixel clock period in pico seconds */
-static unsigned int da8xxfb_pixel_clk_period(struct da8xx_fb_par *par)
-{
-   unsigned int lcd_clk, div;
-   unsigned int configured_pix_clk;
-   unsigned long long pix_clk_period_picosec = 1ULL;
-
-   lcd_clk = clk_get_rate(par-lcdc_clk);
-   div = lcd_clk / par-pxl_clk;
-   configured_pix_clk = (lcd_clk / div);
-
-   do_div(pix_clk_period_picosec, configured_pix_clk);
-
-   return

[PATCH v2 09/10] video: da8xx-fb: report correct pixclock

2013-01-06 Thread Afzal Mohammed
Update var pixclock with the value that is configurable in hardware.
This lets user know the actual pixclock.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 663b3c5..c7393f1 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -690,6 +690,15 @@ static inline unsigned da8xx_fb_calc_clk_divider(struct 
da8xx_fb_par *par,
return par-lcd_fck_rate / (PICOS2KHZ(pixclock) * 1000);
 }
 
+static inline unsigned da8xx_fb_round_clk(struct da8xx_fb_par *par,
+ unsigned pixclock)
+{
+   unsigned div;
+
+   div = da8xx_fb_calc_clk_divider(par, pixclock);
+   return KHZ2PICOS(par-lcd_fck_rate / (1000 * div));
+}
+
 static inline void da8xx_fb_config_clk_divider(unsigned div)
 {
/* Configure the LCD clock divisor. */
@@ -966,6 +975,8 @@ static int fb_check_var(struct fb_var_screeninfo *var,
if (var-yres + var-yoffset  var-yres_virtual)
var-yoffset = var-yres_virtual - var-yres;
 
+   var-pixclock = da8xx_fb_round_clk(par, var-pixclock);
+
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/10] video: da8xx-fb: DT support

2013-01-06 Thread Afzal Mohammed
Hi,

This series adds DT support to da8xx-fb driver (device found on
DaVinci and AM335x SoC's). It does certain cleanup's in the process.

This makes use of Steffen Trumtrar's v16 of display timing DT support.

Testing has been done on AM335x SoC based boards like AM335x EVM and
AM335x EVM-SK. It has also been verified that display on DA850 EVM
(non-DT boot) works as earlier.

Another series that adds DT nodes for AM335x SoC/board would follow
this.

This series is based on v3.8-rc2,
 and is dependent on,
1. Series v16 of: add display helper by,
Steffen Trumtrar s.trumt...@pengutronix.de
2. Patch da8xx: Allow use by am33xx based devices by,
Pantelis Antoniou pa...@antoniou-consulting.com
3. Series v2 video: da8xx-fb: runtime timing configuration by,
me (Afzal Mohammed af...@ti.com)

To test this series on AM335x based boards,
1. Series ARM: dts: AM33XX: lcdc support by,
me (Afzal Mohammed af...@ti.com),
as well as,
2. Series HWMOD fixes for AM33xx PWM submodules and device tree nodes by,
Philip, Avinash avinashphi...@ti.com
would be needed.

A tree with all above dependencies (and below mentioned hack) is available
 @git://gitorious.org/x0148406-public/linux-kernel.git da8xx-fb-dt

In the case of AM335x, in addition to this series, display PLL has to
be locked to required frequency. Unless bootloader configures it
properly, a hack would required in the Kernel. This is also present in
the above mentioned branch of the tree. A solution in the Kernel
is being worked upon and would be posted at the earliest.


Regards
Afzal

Afzal Mohammed (9):
  video: da8xx-fb: enable sync lost intr for v2 ip
  video: da8xx-fb: use devres
  video: da8xx-fb: ensure non-null cfg in pdata
  video: da8xx-fb: reorganize panel detection
  video: da8xx-fb: minimal dt support
  video: da8xx-fb: invoke platform callback safely
  video: da8xx-fb: obtain fb_videomode info from dt
  video: da8xx-fb: ensure pdata only for non-dt
  video: da8xx-fb: setup struct lcd_ctrl_config for dt

Manjunathappa, Prakash (1):
  video: da8xx-fb: fix 24bpp raster configuration

 .../devicetree/bindings/video/fb-da8xx.txt |   36 +
 drivers/video/da8xx-fb.c   |  145 +---
 2 files changed, 132 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/fb-da8xx.txt

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/10] video: da8xx-fb: enable sync lost intr for v2 ip

2013-01-06 Thread Afzal Mohammed
interrupt handler is checking for sync lost interrupt, but it was not
enabled, enable it.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index cd73b87..4f92028 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -322,7 +322,7 @@ static void lcd_blit(int load_mode, struct da8xx_fb_par 
*par)
reg_int = lcdc_read(LCD_INT_ENABLE_SET_REG) |
LCD_V2_END_OF_FRAME0_INT_ENA |
LCD_V2_END_OF_FRAME1_INT_ENA |
-   LCD_FRAME_DONE;
+   LCD_FRAME_DONE | LCD_SYNC_LOST;
lcdc_write(reg_int, LCD_INT_ENABLE_SET_REG);
}
reg_dma |= LCD_DUAL_FRAME_BUFFER_ENABLE;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/10] video: da8xx-fb: ensure non-null cfg in pdata

2013-01-06 Thread Afzal Mohammed
Ensure that platform data contains pointer for lcd_ctrl_config.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index e119ec8..32ce385 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1324,6 +1324,11 @@ static int __devinit fb_probe(struct platform_device 
*device)
 
lcd_cfg = (struct lcd_ctrl_config *)fb_pdata-controller_data;
 
+   if (!lcd_cfg) {
+   ret = -EINVAL;
+   goto err_pm_runtime_disable;
+   }
+
da8xx_fb_info = framebuffer_alloc(sizeof(struct da8xx_fb_par),
device-dev);
if (!da8xx_fb_info) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/10] video: da8xx-fb: setup struct lcd_ctrl_config for dt

2013-01-06 Thread Afzal Mohammed
strcut lcd_ctrl_config information required for driver is currently
obtained via platform data. To handle DT probing, create
lcd_ctrl_config and populate it with default values, these values are
sufficient for the panels so far used with this controller to work.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   34 +-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 3e590d4..4a4b4dc 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1257,6 +1257,35 @@ static struct fb_ops da8xx_fb_ops = {
.fb_blank = cfb_blank,
 };
 
+static struct lcd_ctrl_config *da8xx_fb_create_cfg(struct platform_device *dev)
+{
+   struct lcd_ctrl_config *cfg;
+
+   cfg = devm_kzalloc(dev-dev, sizeof(struct fb_videomode), GFP_KERNEL);
+   if (!cfg) {
+   dev_err(dev-dev, memory allocation failed\n);
+   return NULL;
+   }
+
+   /* default values */
+
+   if (lcd_revision == LCD_VERSION_1)
+   cfg-bpp = 16;
+   else
+   cfg-bpp = 32;
+
+   /*
+* For panels so far used with this LCDC, below statement is sufficient.
+* For new panels, if required, struct lcd_ctrl_cfg fields to be updated
+* with additional/modified values. Those values would have to be then
+* obtained from dt(requiring new dt bindings).
+*/
+
+   cfg-panel_shade = COLOR_ACTIVE;
+
+   return cfg;
+}
+
 static struct fb_videomode *da8xx_fb_get_videomode(struct platform_device *dev)
 {
struct da8xx_lcdc_platform_data *fb_pdata = dev-dev.platform_data;
@@ -1348,7 +1377,10 @@ static int __devinit fb_probe(struct platform_device 
*device)
break;
}
 
-   lcd_cfg = (struct lcd_ctrl_config *)fb_pdata-controller_data;
+   if (device-dev.of_node)
+   lcd_cfg = da8xx_fb_create_cfg(device);
+   else
+   lcd_cfg = (struct lcd_ctrl_config *)fb_pdata-controller_data;
 
if (!lcd_cfg) {
ret = -EINVAL;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/10] video: da8xx-fb: obtain fb_videomode info from dt

2013-01-06 Thread Afzal Mohammed
Obtain fb_videomode details for the connected lcd panel using the
display timing details present in DT.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../devicetree/bindings/video/fb-da8xx.txt |   20 
 drivers/video/da8xx-fb.c   |   16 
 2 files changed, 36 insertions(+)

diff --git a/Documentation/devicetree/bindings/video/fb-da8xx.txt 
b/Documentation/devicetree/bindings/video/fb-da8xx.txt
index 581e014..eeb935b 100644
--- a/Documentation/devicetree/bindings/video/fb-da8xx.txt
+++ b/Documentation/devicetree/bindings/video/fb-da8xx.txt
@@ -6,6 +6,11 @@ Required properties:
AM335x SoC's - ti,am3352-lcdc, ti,da830-lcdc
 - reg: Address range of lcdc register set
 - interrupts: lcdc interrupt
+- display-timings: list of different videomodes supported by the lcd
+  panel, represented as childs, can have multiple modes supported, if
+  only one, then it is considered native mode, if multiple modes are
+  provided, native mode can be set explicitly, more details available
+  @Documentation/devicetree/bindings/video/display-timing.txt
 
 Example:
 
@@ -13,4 +18,19 @@ lcdc@4830e000 {
compatible = ti,am3352-lcdc, ti,da830-lcdc;
reg =  0x4830e000 0x1000;
interrupts = 36;
+   display-timings {
+   800x480p62 {
+   clock-frequency = 3000;
+   hactive = 800;
+   vactive = 480;
+   hfront-porch = 39;
+   hback-porch = 39;
+   hsync-len = 47;
+   vback-porch = 29;
+   vfront-porch = 13;
+   vsync-len = 2;
+   hsync-active = 1;
+   vsync-active = 1;
+   };
+   };
 };
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 68ae925..94add01 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1261,8 +1261,24 @@ static struct fb_videomode 
*da8xx_fb_get_videomode(struct platform_device *dev)
 {
struct da8xx_lcdc_platform_data *fb_pdata = dev-dev.platform_data;
struct fb_videomode *lcdc_info;
+   struct device_node *np = dev-dev.of_node;
int i;
 
+   if (np) {
+   lcdc_info = devm_kzalloc(dev-dev,
+sizeof(struct fb_videomode),
+GFP_KERNEL);
+   if (!lcdc_info) {
+   dev_err(dev-dev, memory allocation failed\n);
+   return NULL;
+   }
+   if (of_get_fb_videomode(np, lcdc_info, 0)) {
+   dev_err(dev-dev, timings not available in DT\n);
+   return NULL;
+   }
+   return lcdc_info;
+   }
+
for (i = 0, lcdc_info = known_lcd_panels;
i  ARRAY_SIZE(known_lcd_panels); i++, lcdc_info++) {
if (strcmp(fb_pdata-type, lcdc_info-name) == 0)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/10] video: da8xx-fb: ensure pdata only for non-dt

2013-01-06 Thread Afzal Mohammed
This driver is DT probe-able, hence ensure presence of platform data
only for non-DT boot.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 94add01..3e590d4 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1306,7 +1306,7 @@ static int __devinit fb_probe(struct platform_device 
*device)
int ret;
unsigned long ulcm;
 
-   if (fb_pdata == NULL) {
+   if (fb_pdata == NULL  !device-dev.of_node) {
dev_err(device-dev, Can not get platform data\n);
return -ENOENT;
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10] video: da8xx-fb: fix 24bpp raster configuration

2013-01-06 Thread Afzal Mohammed
From: Manjunathappa, Prakash prakash...@ti.com

Set only LCD_V2_TFT_24BPP_MODE bit for 24bpp and LCD_V2_TFT_24BPP_UNPACK
bit along with LCD_V2_TFT_24BPP_MODE for 32bpp configuration.

Patch is tested on am335x-evm for 24bpp and da850-evm for 16bpp
configurations.

Signed-off-by: Manjunathappa, Prakash prakash...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 240eac7..cd73b87 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -554,10 +554,10 @@ static int lcd_cfg_frame_buffer(struct da8xx_fb_par *par, 
u32 width, u32 height,
case 4:
case 16:
break;
-   case 24:
-   reg |= LCD_V2_TFT_24BPP_MODE;
case 32:
reg |= LCD_V2_TFT_24BPP_UNPACK;
+   case 24:
+   reg |= LCD_V2_TFT_24BPP_MODE;
break;
 
case 8:
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/10] video: da8xx-fb: use devres

2013-01-06 Thread Afzal Mohammed
Replace existing resource handling in the driver with managed device
resource.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   35 ++-
 1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 4f92028..e119ec8 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1040,12 +1040,9 @@ static int __devexit fb_remove(struct platform_device 
*dev)
  par-p_palette_base);
dma_free_coherent(NULL, par-vram_size, par-vram_virt,
  par-vram_phys);
-   free_irq(par-irq, par);
pm_runtime_put_sync(dev-dev);
pm_runtime_disable(dev-dev);
framebuffer_release(info);
-   iounmap(da8xx_fb_reg_base);
-   release_mem_region(lcdc_regs-start, resource_size(lcdc_regs));
 
}
return 0;
@@ -1269,7 +1266,6 @@ static int __devinit fb_probe(struct platform_device 
*device)
struct fb_info *da8xx_fb_info;
struct clk *fb_clk = NULL;
struct da8xx_fb_par *par;
-   resource_size_t len;
int ret, i;
unsigned long ulcm;
 
@@ -1279,29 +1275,16 @@ static int __devinit fb_probe(struct platform_device 
*device)
}
 
lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0);
-   if (!lcdc_regs) {
-   dev_err(device-dev,
-   Can not get memory resource for LCD controller\n);
-   return -ENOENT;
-   }
-
-   len = resource_size(lcdc_regs);
-
-   lcdc_regs = request_mem_region(lcdc_regs-start, len, lcdc_regs-name);
-   if (!lcdc_regs)
-   return -EBUSY;
-
-   da8xx_fb_reg_base = ioremap(lcdc_regs-start, len);
+   da8xx_fb_reg_base = devm_request_and_ioremap(device-dev, lcdc_regs);
if (!da8xx_fb_reg_base) {
-   ret = -EBUSY;
-   goto err_request_mem;
+   dev_err(device-dev, memory resource setup failed\n);
+   return -EADDRNOTAVAIL;
}
 
-   fb_clk = clk_get(device-dev, fck);
+   fb_clk = devm_clk_get(device-dev, fck);
if (IS_ERR(fb_clk)) {
dev_err(device-dev, Can not get device clock\n);
-   ret = -ENODEV;
-   goto err_ioremap;
+   return -ENODEV;
}
 
pm_runtime_enable(device-dev);
@@ -1462,7 +1445,7 @@ static int __devinit fb_probe(struct platform_device 
*device)
lcdc_irq_handler = lcdc_irq_handler_rev02;
}
 
-   ret = request_irq(par-irq, lcdc_irq_handler, 0,
+   ret = devm_request_irq(device-dev, par-irq, lcdc_irq_handler, 0,
DRIVER_NAME, par);
if (ret)
goto irq_freq;
@@ -1492,12 +1475,6 @@ err_pm_runtime_disable:
pm_runtime_put_sync(device-dev);
pm_runtime_disable(device-dev);
 
-err_ioremap:
-   iounmap(da8xx_fb_reg_base);
-
-err_request_mem:
-   release_mem_region(lcdc_regs-start, len);
-
return ret;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/10] video: da8xx-fb: minimal dt support

2013-01-06 Thread Afzal Mohammed
Driver is provided a means to have the probe triggered by DT.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../devicetree/bindings/video/fb-da8xx.txt |   16 
 drivers/video/da8xx-fb.c   |7 +++
 2 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/fb-da8xx.txt

diff --git a/Documentation/devicetree/bindings/video/fb-da8xx.txt 
b/Documentation/devicetree/bindings/video/fb-da8xx.txt
new file mode 100644
index 000..581e014
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/fb-da8xx.txt
@@ -0,0 +1,16 @@
+TI LCD Controller on DA830/DA850/AM335x SoC's
+
+Required properties:
+- compatible:
+   DA830 - ti,da830-lcdc
+   AM335x SoC's - ti,am3352-lcdc, ti,da830-lcdc
+- reg: Address range of lcdc register set
+- interrupts: lcdc interrupt
+
+Example:
+
+lcdc@4830e000 {
+   compatible = ti,am3352-lcdc, ti,da830-lcdc;
+   reg =  0x4830e000 0x1000;
+   interrupts = 36;
+};
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 991d9e3..d10479f 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1599,6 +1599,12 @@ static int fb_resume(struct platform_device *dev)
 #define fb_resume NULL
 #endif
 
+static const struct of_device_id da8xx_fb_of_match[] = {
+   {.compatible = ti,da830-lcdc, },
+   {},
+};
+MODULE_DEVICE_TABLE(of, da8xx_fb_of_match);
+
 static struct platform_driver da8xx_fb_driver = {
.probe = fb_probe,
.remove = __devexit_p(fb_remove),
@@ -1607,6 +1613,7 @@ static struct platform_driver da8xx_fb_driver = {
.driver = {
   .name = DRIVER_NAME,
   .owner = THIS_MODULE,
+  .of_match_table = of_match_ptr(da8xx_fb_of_match),
   },
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/10] video: da8xx-fb: reorganize panel detection

2013-01-06 Thread Afzal Mohammed
Move panel detection to a separate function, this helps in readability
as well as makes DT support cleaner.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   42 ++
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 32ce385..991d9e3 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1257,6 +1257,27 @@ static struct fb_ops da8xx_fb_ops = {
.fb_blank = cfb_blank,
 };
 
+static struct fb_videomode *da8xx_fb_get_videomode(struct platform_device *dev)
+{
+   struct da8xx_lcdc_platform_data *fb_pdata = dev-dev.platform_data;
+   struct fb_videomode *lcdc_info;
+   int i;
+
+   for (i = 0, lcdc_info = known_lcd_panels;
+   i  ARRAY_SIZE(known_lcd_panels); i++, lcdc_info++) {
+   if (strcmp(fb_pdata-type, lcdc_info-name) == 0)
+   break;
+   }
+
+   if (i == ARRAY_SIZE(known_lcd_panels)) {
+   dev_err(dev-dev, no panel found\n);
+   return NULL;
+   }
+   dev_info(dev-dev, found %s panel\n, lcdc_info-name);
+
+   return lcdc_info;
+}
+
 static int __devinit fb_probe(struct platform_device *device)
 {
struct da8xx_lcdc_platform_data *fb_pdata =
@@ -1266,7 +1287,7 @@ static int __devinit fb_probe(struct platform_device 
*device)
struct fb_info *da8xx_fb_info;
struct clk *fb_clk = NULL;
struct da8xx_fb_par *par;
-   int ret, i;
+   int ret;
unsigned long ulcm;
 
if (fb_pdata == NULL) {
@@ -1274,6 +1295,10 @@ static int __devinit fb_probe(struct platform_device 
*device)
return -ENOENT;
}
 
+   lcdc_info = da8xx_fb_get_videomode(device);
+   if (lcdc_info == NULL)
+   return -ENODEV;
+
lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0);
da8xx_fb_reg_base = devm_request_and_ioremap(device-dev, lcdc_regs);
if (!da8xx_fb_reg_base) {
@@ -1307,21 +1332,6 @@ static int __devinit fb_probe(struct platform_device 
*device)
break;
}
 
-   for (i = 0, lcdc_info = known_lcd_panels;
-   i  ARRAY_SIZE(known_lcd_panels);
-   i++, lcdc_info++) {
-   if (strcmp(fb_pdata-type, lcdc_info-name) == 0)
-   break;
-   }
-
-   if (i == ARRAY_SIZE(known_lcd_panels)) {
-   dev_err(device-dev, GLCD: No valid panel found\n);
-   ret = -ENODEV;
-   goto err_pm_runtime_disable;
-   } else
-   dev_info(device-dev, GLCD: Found %s panel\n,
-   fb_pdata-type);
-
lcd_cfg = (struct lcd_ctrl_config *)fb_pdata-controller_data;
 
if (!lcd_cfg) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/10] video: da8xx-fb: invoke platform callback safely

2013-01-06 Thread Afzal Mohammed
Ensure that platform data is present before checking whether platform
callback is present (the one used to control backlight). So far this
was not an issue as driver was purely non-DT triggered, but now DT
support has been added.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index d10479f..68ae925 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1351,7 +1351,7 @@ static int __devinit fb_probe(struct platform_device 
*device)
par-dev = device-dev;
par-lcdc_clk = fb_clk;
par-lcd_fck_rate = clk_get_rate(fb_clk);
-   if (fb_pdata-panel_power_ctrl) {
+   if (fb_pdata  fb_pdata-panel_power_ctrl) {
par-panel_power_ctrl = fb_pdata-panel_power_ctrl;
par-panel_power_ctrl(1);
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] ARM: dts: AM33XX: lcdc support

2013-01-06 Thread Afzal Mohammed
Hi,

This series add DT sources for AM335x SoC as well as AM335x based
boards.

As pinmux is an SoC specific detail rather than IP specific one,
addition of pin control has been done in a separate patch from
the one in which display timings are added. Also it may aid in
debugging in case of any issues.

This has been tested on AM335x based boards like AM335x EVM and
AM335x EVM-SK.

This series is based on v3.8-rc2.

This series has a dependency on,
1. Series v16 of: add display helper by,
Steffen Trumtrar s.trumt...@pengutronix.de
2. Series v2 video: da8xx-fb: runtime timing configuration by,
me (Afzal Mohammed af...@ti.com)
3. Series video: da8xx-fb: DT support by,
me (Afzal Mohammed af...@ti.com)

To test on AM335x, in addition to the above, following changes,
1. Patch da8xx: Allow use by am33xx based devices by,
Pantelis Antoniou pa...@antoniou-consulting.com
3. Series HWMOD fixes for AM33xx PWM submodules and device tree nodes by,
Philip, Avinash avinashphi...@ti.com
would be required

A tree with all above for testing is available
 @git://gitorious.org/x0148406-public/linux-kernel.git da8xx-fb-dt


Regards
Afzal

Afzal Mohammed (5):
  ARM: dts: AM33XX: Add lcdc node
  ARM: dts: AM33XX: Add am335x-evm lcdc panel timings
  ARM: dts: AM33XX: Add am335x-evm lcdc pincontrol info
  ARM: dts: AM33XX: Add am335x-evmsk lcdc panel timings
  ARM: dts: AM33XX: Add am335x-evmsk lcdc pincontrol info

 arch/arm/boot/dts/am335x-evm.dts   |   55 +++-
 arch/arm/boot/dts/am335x-evmsk.dts |   55 +++-
 arch/arm/boot/dts/am33xx.dtsi  |8 ++
 3 files changed, 116 insertions(+), 2 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] ARM: dts: AM33XX: Add am335x-evmsk lcdc panel timings

2013-01-06 Thread Afzal Mohammed
Update lcdc node with panel timings (typical) for AM335X-EVMSK.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am335x-evmsk.dts |   20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-evmsk.dts 
b/arch/arm/boot/dts/am335x-evmsk.dts
index f5a6162..a7e017b 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -248,3 +248,23 @@
};
};
 };
+
+lcdc {
+   status = okay;
+
+   display-timings {
+   480x272p57 {
+   clock-frequency = 900;
+   hactive = 480;
+   vactive = 272;
+   hfront-porch = 8;
+   hback-porch = 43;
+   hsync-len = 4;
+   vback-porch = 12;
+   vfront-porch = 4;
+   vsync-len = 10;
+   hsync-active = 1;
+   vsync-active = 1;
+   };
+   };
+};
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] ARM: dts: AM33XX: Add lcdc node

2013-01-06 Thread Afzal Mohammed
Add lcdc node.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am33xx.dtsi |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index c2f14e8..432d4bb8 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -385,5 +385,13 @@
mac-address = [ 00 00 00 00 00 00 ];
};
};
+
+   lcdc: lcdc@4830e000 {
+   compatible = ti,am3352-lcdc, ti,da830-lcdc;
+   reg = 0x4830e000 0x1000;
+   interrupts = 36;
+   status = disabled;
+   ti,hwmods = lcdc;
+   };
};
 };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] ARM: dts: AM33XX: Add am335x-evm lcdc panel timings

2013-01-06 Thread Afzal Mohammed
Update lcdc node with panel timings (typical) for AM335X-EVM.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am335x-evm.dts |   20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index d649644..a4229aa 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -244,3 +244,23 @@
 cpsw_emac1 {
phy_id = davinci_mdio, 1;
 };
+
+lcdc {
+   status = okay;
+
+   display-timings {
+   800x480p62 {
+   clock-frequency = 3000;
+   hactive = 800;
+   vactive = 480;
+   hfront-porch = 39;
+   hback-porch = 39;
+   hsync-len = 47;
+   vback-porch = 29;
+   vfront-porch = 13;
+   vsync-len = 2;
+   hsync-active = 1;
+   vsync-active = 1;
+   };
+   };
+};
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] ARM: dts: AM33XX: Add am335x-evm lcdc pincontrol info

2013-01-06 Thread Afzal Mohammed
Update pin mux information for lcd panel on AM335X-EVM

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am335x-evm.dts |   35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index a4229aa..25ebfc2 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -26,7 +26,7 @@
 
am33xx_pinmux: pinmux@44e10800 {
pinctrl-names = default;
-   pinctrl-0 = matrix_keypad_s0 volume_keys_s0;
+   pinctrl-0 = matrix_keypad_s0 volume_keys_s0 lcd_pins_s0;
 
matrix_keypad_s0: matrix_keypad_s0 {
pinctrl-single,pins = 
@@ -44,6 +44,39 @@
0x154 0x27  /* spi0_d0.gpio0_3, INPUT | 
MODE7 */
;
};
+
+   lcd_pins_s0: lcd_pins_s0 {
+   pinctrl-single,pins = 
+   0x20 0x01
+   0x24 0x01
+   0x28 0x01
+   0x2c 0x01
+   0x30 0x01
+   0x34 0x01
+   0x38 0x01
+   0x3c 0x01
+   0xa0 0x08
+   0xa4 0x08
+   0xa8 0x08
+   0xac 0x08
+   0xb0 0x08
+   0xb4 0x08
+   0xb8 0x08
+   0xbc 0x08
+   0xc0 0x08
+   0xc4 0x08
+   0xc8 0x08
+   0xcc 0x08
+   0xd0 0x08
+   0xd4 0x08
+   0xd8 0x08
+   0xdc 0x08
+   0xe0 0x00
+   0xe4 0x00
+   0xe8 0x00
+   0xec 0x00
+   ;
+   };
};
 
ocp {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] ARM: dts: AM33XX: Add am335x-evmsk lcdc pincontrol info

2013-01-06 Thread Afzal Mohammed
Update pin mux information for lcd panel on AM335X-EVMSK.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 arch/arm/boot/dts/am335x-evmsk.dts |   35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am335x-evmsk.dts 
b/arch/arm/boot/dts/am335x-evmsk.dts
index a7e017b..6275a50 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -32,7 +32,7 @@
 
am33xx_pinmux: pinmux@44e10800 {
pinctrl-names = default;
-   pinctrl-0 = user_leds_s0 gpio_keys_s0;
+   pinctrl-0 = user_leds_s0 gpio_keys_s0 lcd_pins_s0;
 
user_leds_s0: user_leds_s0 {
pinctrl-single,pins = 
@@ -51,6 +51,39 @@
0x9c 0x27   /* gpmc_ben0_cle.gpio2_5, INPUT 
| MODE7 */
;
};
+
+   lcd_pins_s0: lcd_pins_s0 {
+   pinctrl-single,pins = 
+   0x20 0x01
+   0x24 0x01
+   0x28 0x01
+   0x2c 0x01
+   0x30 0x01
+   0x34 0x01
+   0x38 0x01
+   0x3c 0x01
+   0xa0 0x08
+   0xa4 0x08
+   0xa8 0x08
+   0xac 0x08
+   0xb0 0x08
+   0xb4 0x08
+   0xb8 0x08
+   0xbc 0x08
+   0xc0 0x08
+   0xc4 0x08
+   0xc8 0x08
+   0xcc 0x08
+   0xd0 0x08
+   0xd4 0x08
+   0xd8 0x08
+   0xdc 0x08
+   0xe0 0x00
+   0xe4 0x00
+   0xe8 0x00
+   0xec 0x00
+   ;
+   };
};
 
ocp {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 00/10] video: da8xx-fb: runtime timing configuration

2013-01-15 Thread Afzal Mohammed
Hi,

This series makes da8xx-fb driver (device found on DaVinci and AM335x)
capable of handling runtime timing configuration by adding fb_set_par.

The last change adds actual fb_set_par support. Other preceeding
changes makes the way clear for it as well as does certain cleanup's
on the way.

This has been tested on da850 evm as is. This was also tested on
am335x-evm  am335x-evmsk with a series that adds DT support.

This is based on v3.8-rc3, this is the only change in this revision.
The new version of this series is being posted so that this series can
be applied easily (as __dev* are removed, there would be merge
conflicts with v2, which was based on -rc2).
series

Regards
Afzal

v3: rebased over -rc3, no functional changes
v2: disable raster in fb_set_par properly

Afzal Mohammed (10):
  video: da8xx-fb: fb_check_var enhancement
  video: da8xx-fb: simplify lcd_reset
  video: da8xx-fb: use modedb helper to update var
  video: da8xx-fb: remove unneeded var initialization
  video: da8xx-fb: store current display information
  video: da8xx-fb: store clk rate even if !CPUFREQ
  video: da8xx-fb: pix clk and clk div handling cleanup
  video: da8xx-fb: store struct device *
  video: da8xx-fb: report correct pixclock
  video: da8xx-fb: fb_set_par support

 drivers/video/da8xx-fb.c |  185 ++
 1 file changed, 105 insertions(+), 80 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 02/10] video: da8xx-fb: simplify lcd_reset

2013-01-15 Thread Afzal Mohammed
lcd_reset function doesn't require any arguement, remove it.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index d00dd17..52977b1 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -681,7 +681,7 @@ static int fb_setcolreg(unsigned regno, unsigned red, 
unsigned green,
 }
 #undef CNVT_TOHW
 
-static void lcd_reset(struct da8xx_fb_par *par)
+static void da8xx_fb_lcd_reset(void)
 {
/* Disable the Raster if previously Enabled */
lcd_disable_raster(false);
@@ -721,7 +721,7 @@ static int lcd_init(struct da8xx_fb_par *par, const struct 
lcd_ctrl_config *cfg,
u32 bpp;
int ret = 0;
 
-   lcd_reset(par);
+   da8xx_fb_lcd_reset();
 
/* Calculate the divider */
lcd_calc_clk_divider(par);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 05/10] video: da8xx-fb: store current display information

2013-01-15 Thread Afzal Mohammed
store current videomode and controller data so that reconfiguring can
be done easily. Reconfiguring would be required in fb_set_par, which
is going to be added soon.

If these details are not stored, the work probe does to retrieve these
information would have to repeated at the place of reconfiguring and
modifying platform data would be necessary to handle controller data
changes like bpp.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 18834fa..d060f14 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -178,6 +178,8 @@ struct da8xx_fb_par {
 #endif
void (*panel_power_ctrl)(int);
u32 pseudo_palette[16];
+   struct fb_videomode mode;
+   struct lcd_ctrl_config  cfg;
 };
 
 static struct fb_var_screeninfo da8xx_fb_var;
@@ -1310,6 +1312,8 @@ static int fb_probe(struct platform_device *device)
}
 
fb_videomode_to_var(da8xx_fb_var, lcdc_info);
+   fb_var_to_videomode(par-mode, da8xx_fb_var);
+   par-cfg = *lcd_cfg;
 
if (lcd_init(par, lcd_cfg, lcdc_info)  0) {
dev_err(device-dev, lcd_init failed\n);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 07/10] video: da8xx-fb: pix clk and clk div handling cleanup

2013-01-15 Thread Afzal Mohammed
Use the new modedb field to store pix clk. Reorganize existing clock
divider functions with names now corresponding to what they do, add
common function prefix.

Fix existing panel modedb pixclock to be in ps instead of Hz. This
needed a change in the way clock divider is calculated. As modedb
pixclock information is now in ps, override on var pixclock over
modedb to var conversion is removed.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   48 +-
 1 file changed, 18 insertions(+), 30 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index f1d88ac..7f08644 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -160,7 +160,6 @@ struct da8xx_fb_par {
struct clk *lcdc_clk;
int irq;
unsigned int palette_sz;
-   unsigned int pxl_clk;
int blank;
wait_queue_head_t   vsync_wait;
int vsync_flag;
@@ -201,7 +200,7 @@ static struct fb_videomode known_lcd_panels[] = {
.name   = Sharp_LCD035Q3DG01,
.xres   = 320,
.yres   = 240,
-   .pixclock   = 4608000,
+   .pixclock   = 217014,
.left_margin= 6,
.right_margin   = 8,
.upper_margin   = 2,
@@ -216,7 +215,7 @@ static struct fb_videomode known_lcd_panels[] = {
.name   = Sharp_LK043T1DG01,
.xres   = 480,
.yres   = 272,
-   .pixclock   = 7833600,
+   .pixclock   = 127655,
.left_margin= 2,
.right_margin   = 2,
.upper_margin   = 2,
@@ -231,7 +230,7 @@ static struct fb_videomode known_lcd_panels[] = {
.name   = SP10Q010,
.xres   = 320,
.yres   = 240,
-   .pixclock   = 7833600,
+   .pixclock   = 127655,
.left_margin= 10,
.right_margin   = 10,
.upper_margin   = 10,
@@ -680,13 +679,14 @@ static void da8xx_fb_lcd_reset(void)
}
 }
 
-static void lcd_calc_clk_divider(struct da8xx_fb_par *par)
+static inline unsigned da8xx_fb_calc_clk_divider(struct da8xx_fb_par *par,
+unsigned pixclock)
 {
-   unsigned int lcd_clk, div;
-
-   lcd_clk = clk_get_rate(par-lcdc_clk);
-   div = lcd_clk / par-pxl_clk;
+   return par-lcd_fck_rate / (PICOS2KHZ(pixclock) * 1000);
+}
 
+static inline void da8xx_fb_config_clk_divider(unsigned div)
+{
/* Configure the LCD clock divisor. */
lcdc_write(LCD_CLK_DIVISOR(div) |
(LCD_RASTER_MODE  0x1), LCD_CTRL_REG);
@@ -694,7 +694,14 @@ static void lcd_calc_clk_divider(struct da8xx_fb_par *par)
if (lcd_revision == LCD_VERSION_2)
lcdc_write(LCD_V2_DMA_CLK_EN | LCD_V2_LIDD_CLK_EN |
LCD_V2_CORE_CLK_EN, LCD_CLK_ENABLE_REG);
+}
+
+static inline void da8xx_fb_calc_config_clk_divider(struct da8xx_fb_par *par,
+   struct fb_videomode *mode)
+{
+   unsigned div = da8xx_fb_calc_clk_divider(par, mode-pixclock);
 
+   da8xx_fb_config_clk_divider(div);
 }
 
 static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config 
*cfg,
@@ -705,8 +712,7 @@ static int lcd_init(struct da8xx_fb_par *par, const struct 
lcd_ctrl_config *cfg,
 
da8xx_fb_lcd_reset();
 
-   /* Calculate the divider */
-   lcd_calc_clk_divider(par);
+   da8xx_fb_calc_config_clk_divider(par, panel);
 
if (panel-sync  FB_SYNC_CLK_INVERT)
lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |
@@ -969,7 +975,7 @@ static int lcd_da8xx_cpufreq_transition(struct 
notifier_block *nb,
if (par-lcd_fck_rate != clk_get_rate(par-lcdc_clk)) {
par-lcd_fck_rate = clk_get_rate(par-lcdc_clk);
lcd_disable_raster(true);
-   lcd_calc_clk_divider(par);
+   da8xx_fb_calc_config_clk_divider(par, par-mode);
if (par-blank == FB_BLANK_UNBLANK)
lcd_enable_raster();
}
@@ -1195,22 +1201,6 @@ static struct fb_ops da8xx_fb_ops = {
.fb_blank = cfb_blank,
 };
 
-/* Calculate and return pixel clock period in pico seconds */
-static unsigned int da8xxfb_pixel_clk_period(struct da8xx_fb_par *par)
-{
-   unsigned int lcd_clk, div;
-   unsigned int configured_pix_clk;
-   unsigned long long pix_clk_period_picosec = 1ULL;
-
-   lcd_clk = clk_get_rate(par-lcdc_clk);
-   div = lcd_clk / par-pxl_clk;
-   configured_pix_clk = (lcd_clk / div);
-
-   do_div(pix_clk_period_picosec, configured_pix_clk);
-
-   return

[PATCH v3 08/10] video: da8xx-fb: store struct device *

2013-01-15 Thread Afzal Mohammed
store struct device pointer so that dev_dbg/err can be used outside
of probe.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 7f08644..a5341d0 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -150,6 +150,7 @@ static inline void lcdc_write(unsigned int val, unsigned 
int addr)
 }
 
 struct da8xx_fb_par {
+   struct device   *dev;
resource_size_t p_palette_base;
unsigned char *v_palette_base;
dma_addr_t  vram_phys;
@@ -1291,6 +1292,7 @@ static int fb_probe(struct platform_device *device)
}
 
par = da8xx_fb_info-par;
+   par-dev = device-dev;
par-lcdc_clk = fb_clk;
par-lcd_fck_rate = clk_get_rate(fb_clk);
if (fb_pdata-panel_power_ctrl) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 06/10] video: da8xx-fb: store clk rate even if !CPUFREQ

2013-01-15 Thread Afzal Mohammed
store lcd clk rate always, i.e. irrespective of whether CPUFREQ is
enabled or not. This can be used to get clk rate directly instead of
enquiring with clock framework with clk handle every time.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index d060f14..f1d88ac 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -174,8 +174,8 @@ struct da8xx_fb_par {
unsigned intwhich_dma_channel_done;
 #ifdef CONFIG_CPU_FREQ
struct notifier_block   freq_transition;
-   unsigned intlcd_fck_rate;
 #endif
+   unsigned intlcd_fck_rate;
void (*panel_power_ctrl)(int);
u32 pseudo_palette[16];
struct fb_videomode mode;
@@ -1302,9 +1302,7 @@ static int fb_probe(struct platform_device *device)
 
par = da8xx_fb_info-par;
par-lcdc_clk = fb_clk;
-#ifdef CONFIG_CPU_FREQ
par-lcd_fck_rate = clk_get_rate(fb_clk);
-#endif
par-pxl_clk = lcdc_info-pixclock;
if (fb_pdata-panel_power_ctrl) {
par-panel_power_ctrl = fb_pdata-panel_power_ctrl;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 04/10] video: da8xx-fb: remove unneeded var initialization

2013-01-15 Thread Afzal Mohammed
modedb helper now updates var information based on the detected
panel, remove the unnecessary initialization.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   22 +-
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index a1f6544..18834fa 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -131,10 +131,6 @@
 
 #define WSI_TIMEOUT50
 #define PALETTE_SIZE   256
-#define LEFT_MARGIN64
-#define RIGHT_MARGIN   64
-#define UPPER_MARGIN   32
-#define LOWER_MARGIN   32
 
 static void __iomem *da8xx_fb_reg_base;
 static struct resource *lcdc_regs;
@@ -184,23 +180,7 @@ struct da8xx_fb_par {
u32 pseudo_palette[16];
 };
 
-/* Variable Screen Information */
-static struct fb_var_screeninfo da8xx_fb_var = {
-   .xoffset = 0,
-   .yoffset = 0,
-   .transp = {0, 0, 0},
-   .nonstd = 0,
-   .activate = 0,
-   .height = -1,
-   .width = -1,
-   .accel_flags = 0,
-   .left_margin = LEFT_MARGIN,
-   .right_margin = RIGHT_MARGIN,
-   .upper_margin = UPPER_MARGIN,
-   .lower_margin = LOWER_MARGIN,
-   .sync = 0,
-   .vmode = FB_VMODE_NONINTERLACED
-};
+static struct fb_var_screeninfo da8xx_fb_var;
 
 static struct fb_fix_screeninfo da8xx_fb_fix = {
.id = DA8xx FB Drv,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: AM33XX: clock: SET_RATE_PARENT in lcd path

2013-01-15 Thread Afzal Mohammed
LCDC clock node is a one that does not have set rate capability. It
just passes on the rate that is sent downstream by it's parent. While
lcdc clock parent and it's grand parent - dpll_disp_m2_ck and
dpll_disp_ck has the capability to configure rate.

And the default rates provided by LCDC clock's ancestors are not
sufficient to obtain pixel clock for current LCDC use cases, hence
currently display would not work on AM335x SoC's (with driver
modifications in platfrom independent way).

Hence inform clock framework to propogate set rate for LCDC clock as
well as it's parent - dpll_disp_m2_ck. With this change, set rate on
LCDC clock would get propogated till dpll_disp_ck via dpll_disp_m2_ck,
hence allowing the driver (same driver is used in DaVinci too) to set
rates using LCDC clock without worrying about platform dependent clock
details.

Signed-off-by: Afzal Mohammed af...@ti.com
---

Based on v3.8-rc3

 arch/arm/mach-omap2/cclock33xx_data.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/cclock33xx_data.c 
b/arch/arm/mach-omap2/cclock33xx_data.c
index ea64ad6..b731216 100644
--- a/arch/arm/mach-omap2/cclock33xx_data.c
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -284,9 +284,10 @@ DEFINE_STRUCT_CLK(dpll_disp_ck, dpll_core_ck_parents, 
dpll_ddr_ck_ops);
  * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
  * and ALT_CLK1/2)
  */
-DEFINE_CLK_DIVIDER(dpll_disp_m2_ck, dpll_disp_ck, dpll_disp_ck, 0x0,
-  AM33XX_CM_DIV_M2_DPLL_DISP, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
-  AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
+DEFINE_CLK_DIVIDER(dpll_disp_m2_ck, dpll_disp_ck, dpll_disp_ck,
+  CLK_SET_RATE_PARENT, AM33XX_CM_DIV_M2_DPLL_DISP,
+  AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
+  CLK_DIVIDER_ONE_BASED, NULL);
 
 /* DPLL_PER */
 static struct dpll_data dpll_per_dd = {
@@ -932,6 +933,8 @@ int __init am33xx_clk_init(void)
cpu_clkflg = CK_AM33XX;
}
 
+   lcd_gclk.flags |= CLK_SET_RATE_PARENT;
+
for (c = am33xx_clks; c  am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
if (c-cpu  cpu_clkflg) {
clkdev_add(c-lk);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 01/10] video: da8xx-fb: fb_check_var enhancement

2013-01-15 Thread Afzal Mohammed
Check whether struct fb_var_screeninfo fields are sane, if not
update it to be within allowed limits.

If user sends down buggy var values, this will bring those within
allowable limits. And fb_set_par is not supposed to change var
values, fb_check_var has to ensure that values are proper.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 0810939..d00dd17 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -888,6 +888,9 @@ static int fb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
 {
int err = 0;
+   struct da8xx_fb_par *par = info-par;
+   int bpp = var-bits_per_pixel  3;
+   unsigned long line_size = var-xres_virtual * bpp;
 
if (var-bits_per_pixel  16  lcd_revision == LCD_VERSION_1)
return -EINVAL;
@@ -955,6 +958,21 @@ static int fb_check_var(struct fb_var_screeninfo *var,
var-green.msb_right = 0;
var-blue.msb_right = 0;
var-transp.msb_right = 0;
+
+   if (line_size * var-yres_virtual  par-vram_size)
+   var-yres_virtual = par-vram_size / line_size;
+
+   if (var-yres  var-yres_virtual)
+   var-yres = var-yres_virtual;
+
+   if (var-xres  var-xres_virtual)
+   var-xres = var-xres_virtual;
+
+   if (var-xres + var-xoffset  var-xres_virtual)
+   var-xoffset = var-xres_virtual - var-xres;
+   if (var-yres + var-yoffset  var-yres_virtual)
+   var-yoffset = var-yres_virtual - var-yres;
+
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 03/10] video: da8xx-fb: use modedb helper to update var

2013-01-15 Thread Afzal Mohammed
modedb structure is now used to store panel information, run modedb
helper over it for initial update of var information instead of
equating each fields.

While at it, remove redundant update of bits_per_pixel.

Note: pixclock is overridden with proper value using an existing code
as currently modedb is having it in Hz instead of ps, this would be
fixed in a later change and this overide would be removed.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   18 ++
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 52977b1..a1f6544 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1329,6 +1329,8 @@ static int fb_probe(struct platform_device *device)
par-panel_power_ctrl(1);
}
 
+   fb_videomode_to_var(da8xx_fb_var, lcdc_info);
+
if (lcd_init(par, lcd_cfg, lcdc_info)  0) {
dev_err(device-dev, lcd_init failed\n);
ret = -EFAULT;
@@ -1381,25 +1383,9 @@ static int fb_probe(struct platform_device *device)
goto err_release_pl_mem;
}
 
-   /* Initialize par */
-   da8xx_fb_info-var.bits_per_pixel = lcd_cfg-bpp;
-
-   da8xx_fb_var.xres = lcdc_info-xres;
-   da8xx_fb_var.xres_virtual = lcdc_info-xres;
-
-   da8xx_fb_var.yres = lcdc_info-yres;
-   da8xx_fb_var.yres_virtual = lcdc_info-yres * LCD_NUM_BUFFERS;
-
da8xx_fb_var.grayscale =
lcd_cfg-panel_shade == MONOCHROME ? 1 : 0;
da8xx_fb_var.bits_per_pixel = lcd_cfg-bpp;
-
-   da8xx_fb_var.hsync_len = lcdc_info-hsync_len;
-   da8xx_fb_var.vsync_len = lcdc_info-vsync_len;
-   da8xx_fb_var.right_margin = lcdc_info-right_margin;
-   da8xx_fb_var.left_margin  = lcdc_info-left_margin;
-   da8xx_fb_var.lower_margin = lcdc_info-lower_margin;
-   da8xx_fb_var.upper_margin = lcdc_info-upper_margin;
da8xx_fb_var.pixclock = da8xxfb_pixel_clk_period(par);
 
/* Initialize fbinfo */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 08/12] video: da8xx-fb: invoke platform callback safely

2013-01-15 Thread Afzal Mohammed
Ensure that platform data is present before checking whether platform
callback is present (the one used to control backlight). So far this
was not an issue as driver was purely non-DT triggered, but now DT
support has been added.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 08ee8eb..0beed20 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1347,7 +1347,7 @@ static int fb_probe(struct platform_device *device)
par-dev = device-dev;
par-lcdc_clk = fb_clk;
par-lcd_fck_rate = clk_get_rate(fb_clk);
-   if (fb_pdata-panel_power_ctrl) {
+   if (fb_pdata  fb_pdata-panel_power_ctrl) {
par-panel_power_ctrl = fb_pdata-panel_power_ctrl;
par-panel_power_ctrl(1);
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 09/12] video: da8xx-fb: obtain fb_videomode info from dt

2013-01-15 Thread Afzal Mohammed
Obtain fb_videomode details for the connected lcd panel using the
display timing details present in DT.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../devicetree/bindings/video/fb-da8xx.txt |   21 
 drivers/video/da8xx-fb.c   |   17 
 2 files changed, 38 insertions(+)

diff --git a/Documentation/devicetree/bindings/video/fb-da8xx.txt 
b/Documentation/devicetree/bindings/video/fb-da8xx.txt
index 581e014..0741f78 100644
--- a/Documentation/devicetree/bindings/video/fb-da8xx.txt
+++ b/Documentation/devicetree/bindings/video/fb-da8xx.txt
@@ -6,6 +6,12 @@ Required properties:
AM335x SoC's - ti,am3352-lcdc, ti,da830-lcdc
 - reg: Address range of lcdc register set
 - interrupts: lcdc interrupt
+- display-timings: typical videomode of lcd panel, represented as child.
+  Refer Documentation/devicetree/bindings/video/display-timing.txt for
+  display timing binding details. If multiple videomodes are mentioned
+  in display timings node, typical videomode has to be mentioned as the
+  native mode or it has to be first child (driver cares only for native
+  videomode).
 
 Example:
 
@@ -13,4 +19,19 @@ lcdc@4830e000 {
compatible = ti,am3352-lcdc, ti,da830-lcdc;
reg =  0x4830e000 0x1000;
interrupts = 36;
+   display-timings {
+   800x480p62 {
+   clock-frequency = 3000;
+   hactive = 800;
+   vactive = 480;
+   hfront-porch = 39;
+   hback-porch = 39;
+   hsync-len = 47;
+   vback-porch = 29;
+   vfront-porch = 13;
+   vsync-len = 2;
+   hsync-active = 1;
+   vsync-active = 1;
+   };
+   };
 };
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 0beed20..0c68712 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -36,6 +36,7 @@
 #include linux/slab.h
 #include linux/delay.h
 #include linux/lcm.h
+#include video/of_display_timing.h
 #include video/da8xx-fb.h
 #include asm/div64.h
 
@@ -1257,8 +1258,24 @@ static struct fb_videomode 
*da8xx_fb_get_videomode(struct platform_device *dev)
 {
struct da8xx_lcdc_platform_data *fb_pdata = dev-dev.platform_data;
struct fb_videomode *lcdc_info;
+   struct device_node *np = dev-dev.of_node;
int i;
 
+   if (np) {
+   lcdc_info = devm_kzalloc(dev-dev,
+sizeof(struct fb_videomode),
+GFP_KERNEL);
+   if (!lcdc_info) {
+   dev_err(dev-dev, memory allocation failed\n);
+   return NULL;
+   }
+   if (of_get_fb_videomode(np, lcdc_info, OF_USE_NATIVE_MODE)) {
+   dev_err(dev-dev, timings not available in DT\n);
+   return NULL;
+   }
+   return lcdc_info;
+   }
+
for (i = 0, lcdc_info = known_lcd_panels;
i  ARRAY_SIZE(known_lcd_panels); i++, lcdc_info++) {
if (strcmp(fb_pdata-type, lcdc_info-name) == 0)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 10/12] video: da8xx-fb: ensure pdata only for non-dt

2013-01-15 Thread Afzal Mohammed
This driver is DT probe-able, hence ensure presence of platform data
only for non-DT boot.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 0c68712..1c1a616 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1303,7 +1303,7 @@ static int fb_probe(struct platform_device *device)
int ret;
unsigned long ulcm;
 
-   if (fb_pdata == NULL) {
+   if (fb_pdata == NULL  !device-dev.of_node) {
dev_err(device-dev, Can not get platform data\n);
return -ENOENT;
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 11/12] video: da8xx-fb: setup struct lcd_ctrl_config for dt

2013-01-15 Thread Afzal Mohammed
strcut lcd_ctrl_config information required for driver is currently
obtained via platform data. To handle DT probing, create
lcd_ctrl_config and populate it with default values, these values are
sufficient for the panels so far used with this controller to work.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |   34 +-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 1c1a616..5455682 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1254,6 +1254,35 @@ static struct fb_ops da8xx_fb_ops = {
.fb_blank = cfb_blank,
 };
 
+static struct lcd_ctrl_config *da8xx_fb_create_cfg(struct platform_device *dev)
+{
+   struct lcd_ctrl_config *cfg;
+
+   cfg = devm_kzalloc(dev-dev, sizeof(struct fb_videomode), GFP_KERNEL);
+   if (!cfg) {
+   dev_err(dev-dev, memory allocation failed\n);
+   return NULL;
+   }
+
+   /* default values */
+
+   if (lcd_revision == LCD_VERSION_1)
+   cfg-bpp = 16;
+   else
+   cfg-bpp = 32;
+
+   /*
+* For panels so far used with this LCDC, below statement is sufficient.
+* For new panels, if required, struct lcd_ctrl_cfg fields to be updated
+* with additional/modified values. Those values would have to be then
+* obtained from dt(requiring new dt bindings).
+*/
+
+   cfg-panel_shade = COLOR_ACTIVE;
+
+   return cfg;
+}
+
 static struct fb_videomode *da8xx_fb_get_videomode(struct platform_device *dev)
 {
struct da8xx_lcdc_platform_data *fb_pdata = dev-dev.platform_data;
@@ -1345,7 +1374,10 @@ static int fb_probe(struct platform_device *device)
break;
}
 
-   lcd_cfg = (struct lcd_ctrl_config *)fb_pdata-controller_data;
+   if (device-dev.of_node)
+   lcd_cfg = da8xx_fb_create_cfg(device);
+   else
+   lcd_cfg = (struct lcd_ctrl_config *)fb_pdata-controller_data;
 
if (!lcd_cfg) {
ret = -EINVAL;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 00/12] video: da8xx-fb: DT support

2013-01-15 Thread Afzal Mohammed
Hi,

This series adds DT support to da8xx-fb driver (device found on
DaVinci and AM335x SoC's). It does certain cleanup's in the process.

This series as compared to previous version handles configuration of
the LCDC input clock to required value if clock divider in IP cannot
take care of required pixel clock. In the case of AM335x (where there
is requirement of configuring input clock), it's clock tree has to be
updated with proper flags, relevant patch is,

ARM: AM33XX: clock: SET_RATE_PARENT in lcd path.

There is an additional patch in this new series to make io operations
safe.

This makes use of Steffen Trumtrar's v16 of display timing DT support.

Testing has been done on AM335x SoC based boards like AM335x EVM and
AM335x EVM-SK. It has also been verified that display on DA850 EVM
(non-DT boot) works as earlier.

This series is based on v3.8-rc3,
 and is dependent on,
1. Series v16 of: add display helper by,
Steffen Trumtrar s.trumt...@pengutronix.de
2. Patch da8xx: Allow use by am33xx based devices by,
Pantelis Antoniou pa...@antoniou-consulting.com
3. Series v3 video: da8xx-fb: runtime timing configuration by,
me (Afzal Mohammed af...@ti.com)

To test this series on AM335x based boards,
1. Series v2 ARM: dts: AM33XX: lcdc support by,
me (Afzal Mohammed af...@ti.com),
2. Patch ARM: AM33XX: clock: SET_RATE_PARENT in lcd path by,
me (Afzal Mohammed af...@ti.com),
3. Series HWMOD fixes for AM33xx PWM submodules and device tree nodes by,
Philip, Avinash avinashphi...@ti.com
would be needed.

All above dependencies along with those required for testing is available
 @git://gitorious.org/x0148406-public/linux-kernel.git tags/da8xx-fb-dt-v3.8-rc3

Regards
Afzal

v2: 2 new patches - one to configure clock rate properly (12/12)and
other to make io operations safe (1/12)

Afzal Mohammed (11):
  video: da8xx-fb: make io operations safe
  video: da8xx-fb: enable sync lost intr for v2 ip
  video: da8xx-fb: use devres
  video: da8xx-fb: ensure non-null cfg in pdata
  video: da8xx-fb: reorganize panel detection
  video: da8xx-fb: minimal dt support
  video: da8xx-fb: invoke platform callback safely
  video: da8xx-fb: obtain fb_videomode info from dt
  video: da8xx-fb: ensure pdata only for non-dt
  video: da8xx-fb: setup struct lcd_ctrl_config for dt
  video: da8xx-fb: set upstream clock rate (if reqd)

Manjunathappa, Prakash (1):
  video: da8xx-fb: fix 24bpp raster configuration

 .../devicetree/bindings/video/fb-da8xx.txt |   37 
 drivers/video/da8xx-fb.c   |  226 ++--
 2 files changed, 194 insertions(+), 69 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/fb-da8xx.txt

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 01/12] video: da8xx-fb: make io operations safe

2013-01-15 Thread Afzal Mohammed
Replace __raw_readl/__raw_writel with readl/writel; this driver is
reused on ARMv7 (AM335x SoC).

Signed-off-by: Afzal Mohammed af...@ti.com
---

v2: new patch

 drivers/video/da8xx-fb.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 720604c..35a33ca 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -141,12 +141,12 @@ static int frame_done_flag;
 
 static inline unsigned int lcdc_read(unsigned int addr)
 {
-   return (unsigned int)__raw_readl(da8xx_fb_reg_base + (addr));
+   return (unsigned int)readl(da8xx_fb_reg_base + (addr));
 }
 
 static inline void lcdc_write(unsigned int val, unsigned int addr)
 {
-   __raw_writel(val, da8xx_fb_reg_base + (addr));
+   writel(val, da8xx_fb_reg_base + (addr));
 }
 
 struct da8xx_fb_par {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 02/12] video: da8xx-fb: fix 24bpp raster configuration

2013-01-15 Thread Afzal Mohammed
From: Manjunathappa, Prakash prakash...@ti.com

Set only LCD_V2_TFT_24BPP_MODE bit for 24bpp and LCD_V2_TFT_24BPP_UNPACK
bit along with LCD_V2_TFT_24BPP_MODE for 32bpp configuration.

Patch is tested on am335x-evm for 24bpp and da850-evm for 16bpp
configurations.

Signed-off-by: Manjunathappa, Prakash prakash...@ti.com
Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 35a33ca..7f92f37 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -550,10 +550,10 @@ static int lcd_cfg_frame_buffer(struct da8xx_fb_par *par, 
u32 width, u32 height,
case 4:
case 16:
break;
-   case 24:
-   reg |= LCD_V2_TFT_24BPP_MODE;
case 32:
reg |= LCD_V2_TFT_24BPP_UNPACK;
+   case 24:
+   reg |= LCD_V2_TFT_24BPP_MODE;
break;
 
case 8:
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 03/12] video: da8xx-fb: enable sync lost intr for v2 ip

2013-01-15 Thread Afzal Mohammed
interrupt handler is checking for sync lost interrupt, but it was not
enabled, enable it.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 drivers/video/da8xx-fb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 7f92f37..ca69e01 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -318,7 +318,7 @@ static void lcd_blit(int load_mode, struct da8xx_fb_par 
*par)
reg_int = lcdc_read(LCD_INT_ENABLE_SET_REG) |
LCD_V2_END_OF_FRAME0_INT_ENA |
LCD_V2_END_OF_FRAME1_INT_ENA |
-   LCD_FRAME_DONE;
+   LCD_FRAME_DONE | LCD_SYNC_LOST;
lcdc_write(reg_int, LCD_INT_ENABLE_SET_REG);
}
reg_dma |= LCD_DUAL_FRAME_BUFFER_ENABLE;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 07/12] video: da8xx-fb: minimal dt support

2013-01-15 Thread Afzal Mohammed
Driver is provided a means to have the probe triggered by DT.

Signed-off-by: Afzal Mohammed af...@ti.com
---
 .../devicetree/bindings/video/fb-da8xx.txt |   16 
 drivers/video/da8xx-fb.c   |7 +++
 2 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/fb-da8xx.txt

diff --git a/Documentation/devicetree/bindings/video/fb-da8xx.txt 
b/Documentation/devicetree/bindings/video/fb-da8xx.txt
new file mode 100644
index 000..581e014
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/fb-da8xx.txt
@@ -0,0 +1,16 @@
+TI LCD Controller on DA830/DA850/AM335x SoC's
+
+Required properties:
+- compatible:
+   DA830 - ti,da830-lcdc
+   AM335x SoC's - ti,am3352-lcdc, ti,da830-lcdc
+- reg: Address range of lcdc register set
+- interrupts: lcdc interrupt
+
+Example:
+
+lcdc@4830e000 {
+   compatible = ti,am3352-lcdc, ti,da830-lcdc;
+   reg =  0x4830e000 0x1000;
+   interrupts = 36;
+};
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index b6ea5e9..08ee8eb 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1595,6 +1595,12 @@ static int fb_resume(struct platform_device *dev)
 #define fb_resume NULL
 #endif
 
+static const struct of_device_id da8xx_fb_of_match[] = {
+   {.compatible = ti,da830-lcdc, },
+   {},
+};
+MODULE_DEVICE_TABLE(of, da8xx_fb_of_match);
+
 static struct platform_driver da8xx_fb_driver = {
.probe = fb_probe,
.remove = fb_remove,
@@ -1603,6 +1609,7 @@ static struct platform_driver da8xx_fb_driver = {
.driver = {
   .name = DRIVER_NAME,
   .owner = THIS_MODULE,
+  .of_match_table = of_match_ptr(da8xx_fb_of_match),
   },
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


<    1   2   3   4   5   6   7   >