Re: [PATCH 06/10] arm: omap: usb: usbhs core device initialization

2011-02-28 Thread Felipe Balbi
On Sat, Feb 26, 2011 at 04:36:34AM +0530, Keshava Munegowda wrote:
 +void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 +{
 + struct platform_device  *pdev;
 + int i;
 +
 + pdev = platform_device_alloc(OMAP_USBHS_DEVICE, 0);

this particular pdev should be a static variable. Only his children
should be dynamically allocated.

-- 
balbi
--
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 09/10] usb: host: omap: ehci and ohci simplification

2011-02-28 Thread Felipe Balbi
Hi,

On Sat, Feb 26, 2011 at 04:36:37AM +0530, Keshava Munegowda wrote:
 @@ -148,137 +52,24 @@
  #define  EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
  #define  EHCI_INSNREG05_ULPI_WRDATA_SHIFT0
  
 -/* Values of UHH_REVISION - Note: these are not given in the TRM */
 -#define OMAP_EHCI_REV1   0x0010  /* OMAP3 */
 -#define OMAP_EHCI_REV2   0x50700100  /* OMAP4 */
 +/*-*/
  
 -#define is_omap_ehci_rev1(x) (x-omap_ehci_rev == OMAP_EHCI_REV1)
 -#define is_omap_ehci_rev2(x) (x-omap_ehci_rev == OMAP_EHCI_REV2)
 +static const struct hc_driver ehci_omap_hc_driver;
  
 -#define is_ehci_phy_mode(x)  (x == OMAP_EHCI_PORT_MODE_PHY)
 -#define is_ehci_tll_mode(x)  (x == OMAP_EHCI_PORT_MODE_TLL)
 -#define is_ehci_hsic_mode(x) (x == OMAP_EHCI_PORT_MODE_HSIC)
  
 -/*-*/
 -
 -static inline void ehci_omap_writel(void __iomem *base, u32 reg, u32 val)
 +static inline void ehci_write(void __iomem *base, u32 reg, u32 val)
  {
   __raw_writel(val, base + reg);
  }
  
 -static inline u32 ehci_omap_readl(void __iomem *base, u32 reg)
 +static inline u32 ehci_read(void __iomem *base, u32 reg)

renaming these functions is not part of this patch.

-- 
balbi
--
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 v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Semwal, Sumit
Hi,

On Mon, Feb 28, 2011 at 12:57 PM, archit taneja arc...@ti.com wrote:
 Hi,

 On Monday 28 February 2011 12:49 PM, Valkeinen, Tomi wrote:

 On Mon, 2011-02-28 at 01:09 -0600, Taneja, Archit wrote:

 Hi,

 On Monday 28 February 2011 12:23 PM, Valkeinen, Tomi wrote:

snip
 I just realized that changing the driver name will break all scripts
 and
 applications using omapdss sysfs files.

 How does this sound:

 Let's leave the omapdss device name as it is. It represents a super
 device, containing the dss sysfs files and upper level dss management.

 Name the HW module platform drivers as: omapdss_dss, omapdss_venc,
 omapdss_dispc, etc. This would indicate them to be clearly parts of
 DSS,
 and would also prevent any possible name conflict if there would happen
 to be a, say, dsi block in some other HW component.

 Any comments on this?

 I also think we need to stick to the older name, omapdss_dss sounds a
 bit confusing, and I think one of the previous versions had something
 like dss_dss in it and it wasn't approved. Does something like
 omapdss_core or omapdss_dss_core make sense, or is it more
 misleading?

 It is confusing, but so is the hardware naming =). There is a DSS module
 inside the omap display subsystem. That's why I would like to name it
 dss, not core, so it's clear it refers to this DSS module.

 dss_dss looks a bit silly, but I think omapdss_dss is slightly
 better in the sense that it doesn't repeat the same dss, and there is
 an omapdss device, which acts like manager for these module devices.
 But yes, I wouldn't call it perfect either.

 omapdss_dss_core is one option. But then again, TRM doesn't speak of
 core.

 Yes, it might get misleading if someone looking at the code tries to find
 core in the TRM, I guess we should stick to omapdss_dss, this also
 ensures a uniform matching of the platform driver names and the beginning of
 register names for each HW module.

Hmmm... I guess omapdss_dss seems a better name in this view; I'm ok
with this way of naming - do you want me to send a patch for it, or
would you update this patch itself?
~Sumit.

 Archit

--
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 v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 02:16 -0600, Semwal, Sumit wrote:
 Hi,
 
 On Mon, Feb 28, 2011 at 12:57 PM, archit taneja arc...@ti.com wrote:

snip

  Yes, it might get misleading if someone looking at the code tries to find
  core in the TRM, I guess we should stick to omapdss_dss, this also
  ensures a uniform matching of the platform driver names and the beginning of
  register names for each HW module.
 
 Hmmm... I guess omapdss_dss seems a better name in this view; I'm ok
 with this way of naming - do you want me to send a patch for it, or
 would you update this patch itself?

I've made the change. I changed the commits in my tree according to this
new naming. Quite a bit of changes, so I removed tested-bys from the
patches. I'll do some more testing, and push the changes to my master
branch.

 Tomi


--
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] cbus-retu: Add status reg bits and ADC channel definitions

2011-02-28 Thread Felipe Balbi
On Sat, Feb 26, 2011 at 12:18:36AM +0100, Michael Buesch wrote:
 This adds definitions for power management related
 RETU_REG_STATUS bits and a list of ADC channels.
 
 Signed-off-by: Michael Buesch m...@bu3sch.de

this looks fine although I don't have documentation for those :-(

-- 
balbi
--
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] cbus-tahvo: Add battery related register defines

2011-02-28 Thread Felipe Balbi
On Sat, Feb 26, 2011 at 12:23:24AM +0100, Michael Buesch wrote:
 This adds battery related register defines to the tahvo driver.
 
 Signed-off-by: Michael Buesch m...@bu3sch.de

looks good.

-- 
balbi
--
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] cbus-retu: Acquire mutex on write operation

2011-02-28 Thread Felipe Balbi
On Sun, Feb 27, 2011 at 12:34:33AM +0100, Michael Buesch wrote:
 The mutex has to be acquired on register write to avoid interference
 with a simultaneous retu_set_clear_reg_bits operation.
 
 Signed-off-by: Michael Buesch m...@bu3sch.de

good catch, please do the same for retu_read_reg()

-- 
balbi
--
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-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head

2011-02-28 Thread Felipe Balbi
On Fri, Feb 25, 2011 at 07:41:47PM +, Pavol Kurina wrote:
 Felipe Balbi balbi at ti.com writes:
  
  struct usb_request's list_head is supposed to be
  used only by gadget drivers, but musb is abusing
  that. Give struct musb_request its own list_head
  and prevent musb from poking into other driver's
  business.
 
 Hi,
 
 I think, the patch misses to fix the usage of 
 request-list in musb_gadget_dequeue in 
 musb_gadget.c.
 
 I found out by having troubles with f_mass_storage. 
 It needs musb_gadget_dequeue to work properly...
 
 I backported the patch to android-2.6.35 kernel on a 
 omap4 system and also fixed the musb_gadget_dequeue 
 there so f_mass_storage seem to work at least there 
 now...
 
 Can you check this patch regarding some missing bits
 please?

Looks like we need some extra tests to be added to g_zero, I tested with
g_zero and it didn't find that problem. Anyway, here's a patch which
probably fixes what you need to be fixed. Would you test it for me ?

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index da8c93b..bf88a61 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1274,7 +1274,8 @@ cleanup:
 static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
 {
struct musb_ep  *musb_ep = to_musb_ep(ep);
-   struct usb_request  *r;
+   struct musb_request req = to_musb_request(request);
+   struct musb_request *r;
unsigned long   flags;
int status = 0;
struct musb *musb = musb_ep-musb;
@@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, 
struct usb_request *request)
spin_lock_irqsave(musb-lock, flags);
 
list_for_each_entry(r, musb_ep-req_list, list) {
-   if (r == request)
+   if (r == req)
break;
}
-   if (r != request) {
+   if (r != req) {
DBG(3, request %p not queued to %s\n, request, ep-name);
status = -EINVAL;
goto done;

-- 
balbi
--
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/3]OMAP: DSS2: Abstract away DSI VC information from dsi panel drivers

2011-02-28 Thread Archit Taneja
The current DSI driver design requires the DSI panel driver to specify the
DSI Virtual Channel and the Panel Virtual Channel ID for the transfer of
commands and frame data. Out of these, only the second parameter is a property
of the Panel.

The DSI Virtual Channel in use by the panel driver ideally shouldn't be provided
by the panel driver. The current design leads to the following issues:
-Multiple panels connected to the same DSI interface would be unaware of the
VC's in use.
-Hard coded Virtual Channel numbers in panel drivers which is not generic.
-No clean way of configuring DSI for panels which need atleast 2 DSI Virtual
Channels.
-No clean way of configuring DSI for the special case where a panel may have 2
or VC ID's corresponding to it.

The panel driver should, instead, request for, and release DSI Virtual Channels
through calls to the DSI driver. The DSI driver should return VC numbers which
the panel can use. The panel driver then uses this VC to either send pixel data,
send commands and receive data from the panel. The DSI driver then automatically
configures the Virtual Channel source to either Video Port or L4 Slave Port.

This patch set tries to achieve the above design, and make Panel Taal driver use
this approach.

Note:
Patches can be tested on:
http://dev.omapzoom.org/?p=axelcx/kernel-display.git;a=shortlog;h=refs/heads/lo-dss2-Feb25

Archit Taneja (3):
  OMAP: DSS2: Functions to request/release DSI VCs
  OMAP: DSS2: Use request / release calls in Taal for DSI Virtual
Channels.
  OMAP: DSS2: Taal: Use 2 DSI Virtual Channels for Taal

 arch/arm/plat-omap/include/plat/display.h |3 +
 drivers/video/omap2/displays/panel-taal.c |  121 +
 drivers/video/omap2/dss/dsi.c |   58 --
 3 files changed, 124 insertions(+), 58 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/3] OMAP: DSS2: Functions to request/release DSI VCs

2011-02-28 Thread Archit Taneja
Introduce functions which request and release VC's. This will be used in panel
drivers in their probes.

omap_dsi_request_vc() takes in the pointer to the omap_dss_device, the VC_ID
parameter which goes into the header of the DSI packets, and returns a Virtual
channel number (or virtual channel register set) which it can use.

omap_dsi_releae_vc() takes the omap_dss_device pointer and frees all VCs which
were used by that device.

Initialisation of VC parameters is done in dsi_init().

Signed-off-by: Archit Taneja arc...@ti.com
---
 arch/arm/plat-omap/include/plat/display.h |3 ++
 drivers/video/omap2/dss/dsi.c |   55 ++---
 2 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/display.h 
b/arch/arm/plat-omap/include/plat/display.h
index d45f107..0057259 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -560,6 +560,9 @@ int omap_dsi_update(struct omap_dss_device *dssdev,
int channel,
u16 x, u16 y, u16 w, u16 h,
void (*callback)(int, void *), void *data);
+int omap_dsi_request_vc(struct omap_dss_device *dssdev, int vc_id,
+   int *channel);
+void omap_dsi_release_vc(struct omap_dss_device *dssdev);
 
 int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
 void omapdss_dsi_display_disable(struct omap_dss_device *dssdev);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index cda83b0..8118f62 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -233,8 +233,11 @@ static struct
enum dsi_vc_mode mode;
struct omap_dss_device *dssdev;
enum fifo_size fifo_size;
+   int vc_id;
} vc[4];
 
+   int num_vc_used;
+
struct mutex lock;
struct semaphore bus_lock;
 
@@ -1778,8 +1781,6 @@ static void dsi_vc_initial_config(int channel)
r = FLD_MOD(r, 4, 23, 21); /* DMA_TX_REQ_NB = no dma */
 
dsi_write_reg(DSI_VC_CTRL(channel), r);
-
-   dsi.vc[channel].mode = DSI_VC_MODE_L4;
 }
 
 static int dsi_vc_config_l4(int channel)
@@ -1986,7 +1987,7 @@ static inline void dsi_vc_write_long_header(int channel, 
u8 data_type,
 
WARN_ON(!dsi_bus_is_locked());
 
-   data_id = data_type | channel  6;
+   data_id = data_type | dsi.vc[channel].vc_id  6;
 
val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
FLD_VAL(ecc, 31, 24);
@@ -2089,7 +2090,7 @@ static int dsi_vc_send_short(int channel, u8 data_type, 
u16 data, u8 ecc)
return -EINVAL;
}
 
-   data_id = data_type | channel  6;
+   data_id = data_type | dsi.vc[channel].vc_id  6;
 
r = (data_id  0) | (data  8) | (ecc  24);
 
@@ -3264,6 +3265,42 @@ int dsi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
+int omap_dsi_request_vc(struct omap_dss_device *dssdev, int vc_id, int 
*channel)
+{
+   int p = dsi.num_vc_used;
+
+   if (p = 4) {
+   DSSERR(cannot get VC for display %s, dssdev-name);
+   return -EINVAL;
+   }
+
+   dsi.vc[p].dssdev = dssdev;
+   dsi.vc[p].vc_id = vc_id;
+   *channel = p;
+
+   dsi.num_vc_used += 1;
+
+   return 0;
+}
+EXPORT_SYMBOL(omap_dsi_request_vc);
+
+void omap_dsi_release_vc(struct omap_dss_device *dssdev)
+{
+   int i, num_vc_used_disp = 0;
+
+   for (i = 0; i  4; i++) {
+   if (dsi.vc[i].dssdev == dssdev) {
+   dsi.vc[i].dssdev = NULL;
+   dsi.vc[i].vc_id = 0;
+   dsi.vc[i].mode = DSI_VC_MODE_L4;
+   num_vc_used_disp++;
+   }
+   }
+
+   dsi.num_vc_used -= num_vc_used_disp;
+}
+EXPORT_SYMBOL(omap_dsi_release_vc);
+
 void dsi_wait_pll_hsdiv_dispc_active(void)
 {
if (wait_for_bit_change(DSI_PLL_STATUS, 7, 1) != 1)
@@ -3283,7 +3320,7 @@ void dsi_wait_pll_hsdiv_dsi_active(void)
 static int dsi_init(struct platform_device *pdev)
 {
u32 rev;
-   int r;
+   int r, i;
struct resource *dsi_mem;
 
spin_lock_init(dsi.errors_lock);
@@ -3337,6 +3374,14 @@ static int dsi_init(struct platform_device *pdev)
goto err2;
}
 
+   /* DSI VCs initialization */
+   for (i = 0; i  4; i++) {
+   dsi.vc[i].mode = DSI_VC_MODE_L4;
+   dsi.vc[i].dssdev = NULL;
+   dsi.vc[i].vc_id = 0;
+   }
+
+   dsi.num_vc_used = 0;
enable_clocks(1);
 
rev = dsi_read_reg(DSI_REVISION);
-- 
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/3] OMAP: DSS2: Use request / release calls in Taal for DSI Virtual Channels.

2011-02-28 Thread Archit Taneja
Taal driver used to take a hard coded Macro for Virtual Channel and the VC_ID.
The Taal panel driver now requests for a Virtual channel through the
omap_dsi_request_vc() call in taal_probe().

The channel number returned by the request_vc() call is used for sending command
and data to the Panel. The DSI driver automatically configures the Virtual
Channel's source to either Video Port or L4 Slave port based on what the panel
driver is using it for.

The driver uses omap_dsi_release_vc() to free all the VC's requested by it in
taal_remove() or when a request_vc() call fails.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/displays/panel-taal.c |  112 -
 drivers/video/omap2/dss/dsi.c |3 -
 2 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index 61026f9..e7f9010 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -218,6 +218,8 @@ struct taal_data {
u16 w;
u16 h;
} update_region;
+   int channel;
+
struct delayed_work te_timeout_work;
 
bool use_dsi_bl;
@@ -257,12 +259,12 @@ static void hw_guard_wait(struct taal_data *td)
}
 }
 
-static int taal_dcs_read_1(u8 dcs_cmd, u8 *data)
+static int taal_dcs_read_1(struct taal_data *td, u8 dcs_cmd, u8 *data)
 {
int r;
u8 buf[1];
 
-   r = dsi_vc_dcs_read(TCH, dcs_cmd, buf, 1);
+   r = dsi_vc_dcs_read(td-channel, dcs_cmd, buf, 1);
 
if (r  0)
return r;
@@ -272,17 +274,17 @@ static int taal_dcs_read_1(u8 dcs_cmd, u8 *data)
return 0;
 }
 
-static int taal_dcs_write_0(u8 dcs_cmd)
+static int taal_dcs_write_0(struct taal_data *td, u8 dcs_cmd)
 {
-   return dsi_vc_dcs_write(TCH, dcs_cmd, 1);
+   return dsi_vc_dcs_write(td-channel, dcs_cmd, 1);
 }
 
-static int taal_dcs_write_1(u8 dcs_cmd, u8 param)
+static int taal_dcs_write_1(struct taal_data *td, u8 dcs_cmd, u8 param)
 {
u8 buf[2];
buf[0] = dcs_cmd;
buf[1] = param;
-   return dsi_vc_dcs_write(TCH, buf, 2);
+   return dsi_vc_dcs_write(td-channel, buf, 2);
 }
 
 static int taal_sleep_in(struct taal_data *td)
@@ -294,7 +296,7 @@ static int taal_sleep_in(struct taal_data *td)
hw_guard_wait(td);
 
cmd = DCS_SLEEP_IN;
-   r = dsi_vc_dcs_write_nosync(TCH, cmd, 1);
+   r = dsi_vc_dcs_write_nosync(td-channel, cmd, 1);
if (r)
return r;
 
@@ -312,7 +314,7 @@ static int taal_sleep_out(struct taal_data *td)
 
hw_guard_wait(td);
 
-   r = taal_dcs_write_0(DCS_SLEEP_OUT);
+   r = taal_dcs_write_0(td, DCS_SLEEP_OUT);
if (r)
return r;
 
@@ -324,30 +326,30 @@ static int taal_sleep_out(struct taal_data *td)
return 0;
 }
 
-static int taal_get_id(u8 *id1, u8 *id2, u8 *id3)
+static int taal_get_id(struct taal_data *td, u8 *id1, u8 *id2, u8 *id3)
 {
int r;
 
-   r = taal_dcs_read_1(DCS_GET_ID1, id1);
+   r = taal_dcs_read_1(td, DCS_GET_ID1, id1);
if (r)
return r;
-   r = taal_dcs_read_1(DCS_GET_ID2, id2);
+   r = taal_dcs_read_1(td, DCS_GET_ID2, id2);
if (r)
return r;
-   r = taal_dcs_read_1(DCS_GET_ID3, id3);
+   r = taal_dcs_read_1(td, DCS_GET_ID3, id3);
if (r)
return r;
 
return 0;
 }
 
-static int taal_set_addr_mode(u8 rotate, bool mirror)
+static int taal_set_addr_mode(struct taal_data *td, u8 rotate, bool mirror)
 {
int r;
u8 mode;
int b5, b6, b7;
 
-   r = taal_dcs_read_1(DCS_READ_MADCTL, mode);
+   r = taal_dcs_read_1(td, DCS_READ_MADCTL, mode);
if (r)
return r;
 
@@ -381,10 +383,11 @@ static int taal_set_addr_mode(u8 rotate, bool mirror)
mode = ~((17) | (16) | (15));
mode |= (b7  7) | (b6  6) | (b5  5);
 
-   return taal_dcs_write_1(DCS_MEM_ACC_CTRL, mode);
+   return taal_dcs_write_1(td, DCS_MEM_ACC_CTRL, mode);
 }
 
-static int taal_set_update_window(u16 x, u16 y, u16 w, u16 h)
+static int taal_set_update_window(struct taal_data *td,
+   u16 x, u16 y, u16 w, u16 h)
 {
int r;
u16 x1 = x;
@@ -399,7 +402,7 @@ static int taal_set_update_window(u16 x, u16 y, u16 w, u16 
h)
buf[3] = (x2  8)  0xff;
buf[4] = (x2  0)  0xff;
 
-   r = dsi_vc_dcs_write_nosync(TCH, buf, sizeof(buf));
+   r = dsi_vc_dcs_write_nosync(td-channel, buf, sizeof(buf));
if (r)
return r;
 
@@ -409,11 +412,11 @@ static int taal_set_update_window(u16 x, u16 y, u16 w, 
u16 h)
buf[3] = (y2  8)  0xff;
buf[4] = (y2  0)  0xff;
 
-   r = dsi_vc_dcs_write_nosync(TCH, buf, sizeof(buf));
+   r = dsi_vc_dcs_write_nosync(td-channel, buf, sizeof(buf));
if (r)
return r;
 
-   

[PATCH 3/3] OMAP: DSS2: Taal: Use 2 DSI Virtual Channels for Taal

2011-02-28 Thread Archit Taneja
Request 2 DSI Virtual channels for the Taal Panel. The first channel is used to
send control related commands to the Panel. The second is used to send the Pixel
data to the Panel through calling omap_dsi_update().

The 2 channels are named in the struct 'taal_data' as config_channel and
update_channel for sending control commands and pixel data respectively.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/displays/panel-taal.c |   41 +---
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index e7f9010..710547c 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -218,7 +218,8 @@ struct taal_data {
u16 w;
u16 h;
} update_region;
-   int channel;
+   int config_channel;
+   int update_channel;
 
struct delayed_work te_timeout_work;
 
@@ -264,7 +265,7 @@ static int taal_dcs_read_1(struct taal_data *td, u8 
dcs_cmd, u8 *data)
int r;
u8 buf[1];
 
-   r = dsi_vc_dcs_read(td-channel, dcs_cmd, buf, 1);
+   r = dsi_vc_dcs_read(td-config_channel, dcs_cmd, buf, 1);
 
if (r  0)
return r;
@@ -276,7 +277,7 @@ static int taal_dcs_read_1(struct taal_data *td, u8 
dcs_cmd, u8 *data)
 
 static int taal_dcs_write_0(struct taal_data *td, u8 dcs_cmd)
 {
-   return dsi_vc_dcs_write(td-channel, dcs_cmd, 1);
+   return dsi_vc_dcs_write(td-config_channel, dcs_cmd, 1);
 }
 
 static int taal_dcs_write_1(struct taal_data *td, u8 dcs_cmd, u8 param)
@@ -284,7 +285,7 @@ static int taal_dcs_write_1(struct taal_data *td, u8 
dcs_cmd, u8 param)
u8 buf[2];
buf[0] = dcs_cmd;
buf[1] = param;
-   return dsi_vc_dcs_write(td-channel, buf, 2);
+   return dsi_vc_dcs_write(td-config_channel, buf, 2);
 }
 
 static int taal_sleep_in(struct taal_data *td)
@@ -296,7 +297,7 @@ static int taal_sleep_in(struct taal_data *td)
hw_guard_wait(td);
 
cmd = DCS_SLEEP_IN;
-   r = dsi_vc_dcs_write_nosync(td-channel, cmd, 1);
+   r = dsi_vc_dcs_write_nosync(td-config_channel, cmd, 1);
if (r)
return r;
 
@@ -402,7 +403,7 @@ static int taal_set_update_window(struct taal_data *td,
buf[3] = (x2  8)  0xff;
buf[4] = (x2  0)  0xff;
 
-   r = dsi_vc_dcs_write_nosync(td-channel, buf, sizeof(buf));
+   r = dsi_vc_dcs_write_nosync(td-config_channel, buf, sizeof(buf));
if (r)
return r;
 
@@ -412,11 +413,11 @@ static int taal_set_update_window(struct taal_data *td,
buf[3] = (y2  8)  0xff;
buf[4] = (y2  0)  0xff;
 
-   r = dsi_vc_dcs_write_nosync(td-channel, buf, sizeof(buf));
+   r = dsi_vc_dcs_write_nosync(td-config_channel, buf, sizeof(buf));
if (r)
return r;
 
-   dsi_vc_send_bta_sync(td-channel);
+   dsi_vc_send_bta_sync(td-config_channel);
 
return r;
 }
@@ -777,7 +778,13 @@ static int taal_probe(struct omap_dss_device *dssdev)
dev_dbg(dssdev-dev, Using GPIO TE\n);
}
 
-   r = omap_dsi_request_vc(dssdev, TCH, td-channel);
+   r = omap_dsi_request_vc(dssdev, TCH, td-config_channel);
+   if (r) {
+   dev_err(dssdev-dev, failed to get virtual channel\n);
+   goto err_req_vc;
+   }
+
+   r = omap_dsi_request_vc(dssdev, TCH, td-update_channel);
if (r) {
dev_err(dssdev-dev, failed to get virtual channel\n);
goto err_req_vc;
@@ -858,7 +865,8 @@ static int taal_power_on(struct omap_dss_device *dssdev)
 
taal_hw_reset(dssdev);
 
-   omapdss_dsi_vc_enable_hs(td-channel, false);
+   omapdss_dsi_vc_enable_hs(td-config_channel, false);
+   omapdss_dsi_vc_enable_hs(td-update_channel, false);
 
r = taal_sleep_out(td);
if (r)
@@ -915,7 +923,8 @@ static int taal_power_on(struct omap_dss_device *dssdev)
td-intro_printed = true;
}
 
-   omapdss_dsi_vc_enable_hs(td-channel, true);
+   omapdss_dsi_vc_enable_hs(td-config_channel, true);
+   omapdss_dsi_vc_enable_hs(td-update_channel, true);
 
return 0;
 err:
@@ -1101,7 +1110,7 @@ static irqreturn_t taal_te_isr(int irq, void *data)
if (old) {
cancel_delayed_work(td-te_timeout_work);
 
-   r = omap_dsi_update(dssdev, td-channel,
+   r = omap_dsi_update(dssdev, td-update_channel,
td-update_region.x,
td-update_region.y,
td-update_region.w,
@@ -1165,7 +1174,7 @@ static int taal_update(struct omap_dss_device *dssdev,
msecs_to_jiffies(250));
atomic_set(td-do_update, 1);
} else {
-   r = omap_dsi_update(dssdev, td-channel, x, y, w, h,
+   r = 

[PATCH 0/5 v3] usb: musb: Power management support

2011-02-28 Thread Hema HK
This patch series supports the retention and offmode support in the 
idle path for musb driver using runtime pm APIs.

This is restricted to support offmode and retention only when device not
connected.When device/cable connected with gadget driver loaded, configured
to no idle/standby which will not allow the core transition to retention
or off.

There is no context save/restore done by hardware for musb in OMAP3
and OMAP4,driver has to take care of saving and restoring the context
during offmode.

Musb has a requirement of configuring sysconfig register to force
idle/standby mode and set the ENABLE_FORCE bit in module STANDBY register
for retention and offmode support.

Runtime pm and hwmod frameworks will take care of configuring to force
idle/standby when pm_runtime_put_sync is called and back to no
idle/standby when pm_runeime_get_sync is called.

Compile, boot tested and also tested the retention in the idle path on
OMAP3630Zoom3. And tested the global suspend/resume with offmode enabled.
Usb basic functionality tested on OMAP4430SDP.

There is some problem with idle path offmode in mainline, I could not test
with offmode. But I have tested this patch with resetting the controller
in the idle path when wakeup from retention just to make sure that the
context is lost, and restore path is working fine.

V3 Vesion:

Fixed some minor comments from Felipe.

V2 version:
--
Rebased patches on Felipe's musb-hwmod-pm-runtime branch.
Fixed comments from Felipe.

Hema HK (5):
  usb: otg: TWL4030: Update the last_event variable.
  usb: musb: Remove platform context save/restore APIs
  usb: musb: Idle path retention and offmode support for OMAP3
  usb: musb: OMAP4430: Power down the PHY during board init
  usb: otg: OMAP4430: Save/restore the context

 arch/arm/mach-omap2/omap_phy_internal.c |7 
 arch/arm/mach-omap2/usb-musb.c  |4 ++
 drivers/usb/musb/musb_core.c|   40 +++
 drivers/usb/musb/musb_core.h|4 --
 drivers/usb/musb/musb_gadget.c  |   11 ++
 drivers/usb/musb/omap2430.c |   54 ++
 drivers/usb/otg/twl4030-usb.c   |2 +
 7 files changed, 89 insertions(+), 33 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


Re: [PATCH 0/5 v3] usb: musb: Power management support

2011-02-28 Thread Felipe Balbi
Hi,

On Mon, Feb 28, 2011 at 02:19:31PM +0530, Hema HK wrote:
 This patch series supports the retention and offmode support in the 
 idle path for musb driver using runtime pm APIs.
 
 This is restricted to support offmode and retention only when device not
 connected.When device/cable connected with gadget driver loaded, configured
 to no idle/standby which will not allow the core transition to retention
 or off.
 
 There is no context save/restore done by hardware for musb in OMAP3
 and OMAP4,driver has to take care of saving and restoring the context
 during offmode.
 
 Musb has a requirement of configuring sysconfig register to force
 idle/standby mode and set the ENABLE_FORCE bit in module STANDBY register
 for retention and offmode support.
 
 Runtime pm and hwmod frameworks will take care of configuring to force
 idle/standby when pm_runtime_put_sync is called and back to no
 idle/standby when pm_runeime_get_sync is called.
 
 Compile, boot tested and also tested the retention in the idle path on
 OMAP3630Zoom3. And tested the global suspend/resume with offmode enabled.
 Usb basic functionality tested on OMAP4430SDP.
 
 There is some problem with idle path offmode in mainline, I could not test
 with offmode. But I have tested this patch with resetting the controller
 in the idle path when wakeup from retention just to make sure that the
 context is lost, and restore path is working fine.

Tony and Greg, how do we handle this one ? Who should take my pull request
for this series ? I hope we still have a little time to get this into
2.6.39, but if we don't I can hold on to them until 2.6.40.

-- 
balbi
--
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: [omap-for-linus] Un-used DSS regulator data

2011-02-28 Thread Tomi Valkeinen
Hi,

On Mon, 2011-02-28 at 02:50 -0600, Shilimkar, Santosh wrote:
 Tomi/Sumit,
 
 Today while building Tony's 'omap-for-linus' branch I came
 across below build warning.
 warning: 'sdp3430_vdda_dac_supply' defined but not used
 
 It seems the DSS regulator data is not being used. Are you missing
 any patch which will use it eventually?

It was an accidental left over from conflict resolving. I have a patch
in DSS tree which removes the regulator supply.

 Tomi


--
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: [omap-for-linus] Un-used DSS regulator data

2011-02-28 Thread Santosh Shilimkar
 -Original Message-
 From: Tomi Valkeinen [mailto:tomi.valkei...@ti.com]
 Sent: Monday, February 28, 2011 2:30 PM
 To: Shilimkar, Santosh
 Cc: Semwal, Sumit; Guruswamy, Senthilvadivu; linux-
 o...@vger.kernel.org; t...@atomide.com
 Subject: Re: [omap-for-linus] Un-used DSS regulator data

 Hi,

 On Mon, 2011-02-28 at 02:50 -0600, Shilimkar, Santosh wrote:
  Tomi/Sumit,
 
  Today while building Tony's 'omap-for-linus' branch I came
  across below build warning.
  warning: 'sdp3430_vdda_dac_supply' defined but not used
 
  It seems the DSS regulator data is not being used. Are you missing
  any patch which will use it eventually?

 It was an accidental left over from conflict resolving. I have a
 patch in DSS tree which removes the regulator supply.

Ok.
--
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: git repository that was used to build TI Dev Kit 01_00_00 android kernel sources

2011-02-28 Thread Matthieu Poullet
Elvis Dowson elvis.dowson at mac.com writes:

 
 Hi Matthieu,
   Thanks for the reply.
 
 On Feb 26, 2011, at 8:00 PM, Matthieu Poullet wrote:
 
 
http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/01_00_00/index_FDS.html
  
  
 
http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/01_00_00/exports/Sources.tar.gz
  
  Hi,
  
  these DevKits are based on the Rowboat project:
  http://code.google.com/p/rowboat/
  
  Sources are available here:
  http://gitorious.org/rowboat
 
 The rowboat-eclair-2.6.32 branch doesn't have a commit tag corresponding to
the DevKit 01_00_00 release
 
 http://gitorious.org/rowboat/kernel/commits/rowboat-eclair-2.6.32
 
 However, looking at the platform manifest, I was able to get the commit id for
this release: 6bee57941d45c55ceecc5364590cb1c4ebeda053
 
 http://gitorious.org/rowboat/manifest/blobs/master/TI-Android-Eclair-DevKit-V1.xml
 
 #01:  I found a bunch of differences between the source snapshot and the
rowboat-eclair-2.6.32 branch head
 2 months ago, and wasn't sure which git repository the dev kit source
snapshots were being generated from.
 
 If you look at the release notes
 
 http://processors.wiki.ti.com/index.php/TI-Android-Éclair-DevKit-V1_ReleaseNotes
 
 the commit id mentioned in the release notes is :
b263debb4bd3565f4550bd27cf4bb78ae44ef8c3
 
 and that in the platform manifest is : 
 6bee57941d45c55ceecc5364590cb1c4ebeda053
 
 #02: Another mis-match is that the release notes mention that the kernel
branch used is
 android-eclair-2.6.32 and that used in the actual platform manifest for DevKit
v1 is android-eclair
 (which is probably 2.6.29, I guess).
 
 http://gitorious.org/rowboat/manifest/blobs/master/TI-Android-Eclair-DevKit-V1.xml
 
 Best regards,
 
 Elvis Dowson
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majordomo at vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
 

Hi Elvis,

I work on a custom-board with a custom kernel, so I haven't worked with the
standard Eclair stuff since October.
The best place to ask is, I think, the Rowboat mailing list, not this list:
http://groups.google.com/group/rowboat

and/or to ping people on IRC (#rowboat on freenode), e.g. Khasim Syed Mohammed.

FYI here are the Release threads:

TI Android Eclair DevKit V1.0 Release thread:
http://groups.google.com/group/rowboat/browse_thread/thread/6c61b3d06aee3860/73322b710d25ee0c
TI Android Eclair DevKit V2.0 Release thread:
http://groups.google.com/group/rowboat/browse_thread/thread/d0eeaa2f423c661a/5b5ac2039637f99c
TI Android Eclair DevKit V2.2 Release thread:
http://groups.google.com/group/rowboat/browse_thread/thread/38e5370b8a07cfe6/46258591b47ea46d

Regards,
Matthieu,


--
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 1/2] OMAP2PLUS: DSS2: Add dss_opt_clk_roles in pdata

2011-02-28 Thread Tomi Valkeinen
On Fri, 2011-02-25 at 02:27 -0600, Semwal, Sumit wrote:
 Provide dss_opt_clks roles in pdata, so that it can be retrieved
 in dss driver, thus avoiding the hardcoding of clock role names.
 
 Signed-off-by: Senthilvadivu Guruswamy svad...@ti.com
 (based on implementation from Senthil)
 
 Signed-off-by: Sumit Semwal sumit.sem...@ti.com
 ---
  arch/arm/mach-omap2/display.c |   41 
 -
  arch/arm/plat-omap/include/plat/display.h |3 +-
  2 files changed, 42 insertions(+), 2 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
 index cc7b4f3..f189c07 100644
 --- a/arch/arm/mach-omap2/display.c
 +++ b/arch/arm/mach-omap2/display.c
 @@ -21,6 +21,7 @@
  #include linux/io.h
  #include linux/clk.h
  #include linux/err.h
 +#include linux/slab.h
  
  #include plat/display.h
  #include plat/omap_hwmod.h
 @@ -48,6 +49,7 @@ int __init omap_display_init(struct omap_dss_board_info
   int r = 0;
   struct omap_hwmod *oh;
   struct omap_device *od;
 + struct omap_hwmod_opt_clk *oc = NULL;
   int i;
   struct omap_display_platform_data pdata;
  
 @@ -61,7 +63,7 @@ int __init omap_display_init(struct omap_dss_board_info
   dss_dsi2, dss_hdmi};
   char *dev_name[] = {omap_dss, omap_dispc, omap_rfbi, omap_venc, 
 omap_dsi1,
   omap_dsi2, omap_hdmi};
 - int oh_count;
 + int oh_count, oc_count;
  
   memset(pdata, 0, sizeof(pdata));
  
 @@ -74,7 +76,44 @@ int __init omap_display_init(struct omap_dss_board_info
   oh_count = ARRAY_SIZE(oh_name) - 2;
   /* last 2 hwmod dev in oh_name are not available for omap3 */
  
 + /* opt_clks are always associated with dss hwmod */
 + oh = omap_hwmod_lookup(dss_core);
 + if (!oh) {
 + pr_err(Could not look up %s\n, oh_name[0]);
 + return -ENODEV;
 + }
 + oc = oh-opt_clks;
 + oc_count = oh-opt_clks_cnt;
 +
 + /* copy roles of opt_clocks available from hwmod into pdata */
 + pdata.dss_opt_clk_roles = kzalloc(sizeof(char *) * oc_count,
 +   GFP_KERNEL);
 + if (!pdata.dss_opt_clk_roles) {
 + pr_err(could not allocate memory for dss_opt_clk_roles\n);
 + return -ENOMEM;
 + }
 +
 + for (i = 0; i  oc_count; i++) {
 + int oc_length = strlen(oc[i].role);
 +
 + pdata.dss_opt_clk_roles[i] = kzalloc(oc_length + 1,
 +  GFP_KERNEL);
 + if (!pdata.dss_opt_clk_roles[i]) {
 + int j = i - 1;
 +
 + pr_err(kzalloc failed for dss_opt_clk[%i]\n, i);
 + for (; j = 0; j--)
 + kfree(pdata.dss_opt_clk_roles[j]);
 +
 + kfree(pdata.dss_opt_clk_roles);
 +
 + return -ENOMEM;
 + }
 +
 + strncpy(pdata.dss_opt_clk_roles[i], oc[i].role, oc_length+1);
 + }

Do you actually need to copy the role strings? Can they every change? If
they are const data, you could just point to the original strings.

And is there even need to create clk_roles array. If I'm not mistaken,
the only use for this data is for the opt_clock_available() function. We
could just have an opt_clock_available() function pointer in the
omap_display_platform_data, and the function itself would be in
display.c. And the function could use the original hwmod data.

 Tomi


--
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 1/2] OMAP2PLUS: DSS2: Add dss_opt_clk_roles in pdata

2011-02-28 Thread Semwal, Sumit
Hi Tomi,

On Mon, Feb 28, 2011 at 2:40 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
snip
 +     oc = oh-opt_clks;
 +     oc_count = oh-opt_clks_cnt;
 +
 +     /* copy roles of opt_clocks available from hwmod into pdata */
 +     pdata.dss_opt_clk_roles = kzalloc(sizeof(char *) * oc_count,
 +                                       GFP_KERNEL);
 +     if (!pdata.dss_opt_clk_roles) {
 +             pr_err(could not allocate memory for dss_opt_clk_roles\n);
 +             return -ENOMEM;
 +     }
 +
 +     for (i = 0; i  oc_count; i++) {
 +             int oc_length = strlen(oc[i].role);
 +
 +             pdata.dss_opt_clk_roles[i] = kzalloc(oc_length + 1,
 +                                                  GFP_KERNEL);
 +             if (!pdata.dss_opt_clk_roles[i]) {
 +                     int j = i - 1;
 +
 +                     pr_err(kzalloc failed for dss_opt_clk[%i]\n, i);
 +                     for (; j = 0; j--)
 +                             kfree(pdata.dss_opt_clk_roles[j]);
 +
 +                     kfree(pdata.dss_opt_clk_roles);
 +
 +                     return -ENOMEM;
 +             }
 +
 +             strncpy(pdata.dss_opt_clk_roles[i], oc[i].role, oc_length+1);
 +     }

 Do you actually need to copy the role strings? Can they every change? If
 they are const data, you could just point to the original strings.
Right; no, I don't think they can change, so I could point to the
original strings.

 And is there even need to create clk_roles array. If I'm not mistaken,
 the only use for this data is for the opt_clock_available() function. We
 could just have an opt_clock_available() function pointer in the
 omap_display_platform_data, and the function itself would be in
 display.c. And the function could use the original hwmod data.
Ok, but in that case, we do the same hwmod lookup everytime, is it?
That may not be so bad though, considering we check that very rarely
[in dsshw_probe=dss_get_clocks() path].

Ok, will do and send the updated one soon.
~Sumit.


  Tomi



--
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 1/2] OMAP2PLUS: DSS2: Add dss_opt_clk_roles in pdata

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 03:17 -0600, Semwal, Sumit wrote:
 Hi Tomi,
 
 On Mon, Feb 28, 2011 at 2:40 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:

snip

  And is there even need to create clk_roles array. If I'm not mistaken,
  the only use for this data is for the opt_clock_available() function. We
  could just have an opt_clock_available() function pointer in the
  omap_display_platform_data, and the function itself would be in
  display.c. And the function could use the original hwmod data.
 Ok, but in that case, we do the same hwmod lookup everytime, is it?

Yes. I have no idea if hwmod lookup is heavy or not. But:

 That may not be so bad though, considering we check that very rarely
 [in dsshw_probe=dss_get_clocks() path].

Yep, we do it once (if we're not unloading  loading modules). So I
don't think it matters. But if you want, you could do
omap_hwmod_lookup(dss_core) in omap_display_init(), and store the
return value somewhere.

 Tomi


--
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: OMAP3xxx: Fix device detection in otg host mode

2011-02-28 Thread Hema HK
In OMAP3xxx with OTG mode or host only mode, When the device
is inserted after the gadget driver loading the enumeration was not
through. This is because the mentor controller will start sensing the
ID PIN only after setting the session bit.
So after ID-GND, need to set the session bit for mentor to get it
configured as A device.

This is a fix to set the session bit again in ID_GND notification handler.
Tested with OMAP3630Zoom3 platform.

Signed-off-by: Hema HK hem...@ti.com
Cc: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/omap2430.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 4726798..f5d4f36 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -246,19 +246,13 @@ static int musb_otg_notifications(struct notifier_block 
*nb,
if (musb-gadget_driver) {
pm_runtime_get_sync(musb-controller);
otg_init(musb-xceiv);
-
-   if (data-interface_type ==
-   MUSB_INTERFACE_UTMI)
-   omap2430_musb_set_vbus(musb, 1);
-
+   omap2430_musb_set_vbus(musb, 1);
}
 #endif
} else {
pm_runtime_get_sync(musb-controller);
otg_init(musb-xceiv);
-   if (data-interface_type ==
-   MUSB_INTERFACE_UTMI)
-   omap2430_musb_set_vbus(musb, 1);
+   omap2430_musb_set_vbus(musb, 1);
}
break;
 
-- 
1.7.0.4

--
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/4] OMAP: Voltage: Adaptive Body-Bias handlers

2011-02-28 Thread Gulati, Shweta
Hi,

On Tue, Feb 22, 2011 at 1:17 AM, Turquette, Mike mturque...@ti.com wrote:
 On Mon, Feb 21, 2011 at 4:31 AM, Gulati, Shweta shweta.gul...@ti.com wrote:
 Hi,

 On Fri, Feb 18, 2011 at 2:50 PM, Mike Turquette mturque...@ti.com wrote:
 Introduce voltage transition notification handlers for Adaptive Body-Bias
 LDOs.  There is an ABB LDO for VDD_MPU on OMAP3630 and an ABB_LDO on VDD_MPU
 and VDD_IVA on OMAP4430.

 All of these LDOs are handled similary.  Initial configuration is to enable
 the possibility of going into Forward Body-Bias (which boosts voltage at
 high OPPs).  This feature was designed for weak silicon, and eFuse values
 exist to control whether or not this feature should be turned on.  However
 recommendations from hardware folks always say to leave it on regardless of
 eFuse values, so we don't bother checking them.  For all other OPPs the LDO
 is in bypass and will follow the voltage of it's corresponding VDD_xxx.
 Reverse Body-Bias exists but we never use this in practice (for saving power
 on strongly characterised silicon).
 Would RBB be never enabled in future for any of the OPPs or any platforms
 that way SLOW_OPP should also be added in OPP types

 Will do this in next version.  RBB is a possibility.

 Upon a DVFS transition the notifiers handle the sequencing of voltage
 scaling and ABB LDO transitions.  When moving to a higher OPP that needs
 FBB, raise voltage first and then enable FBB.  When moving down to an OPP
 that bypasses ABB, first bypass the LDO then lower voltage.

 Signed-off-by: Mike Turquette mturque...@ti.com
 ---
  arch/arm/mach-omap2/voltage.c             |  379 
 -
  arch/arm/plat-omap/include/plat/voltage.h |    6 +-
  2 files changed, 370 insertions(+), 15 deletions(-)

 diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
 index 6ede092..644a45f 100644
 --- a/arch/arm/mach-omap2/voltage.c
 +++ b/arch/arm/mach-omap2/voltage.c
 @@ -43,6 +43,16 @@
  #define FAST_OPP               0x1
  #define NOMINAL_OPP            0x0

 +/* prototypes used by ABB function pointers */
 +static int omap_abb_notify_voltage(struct notifier_block *nb,
 +               unsigned long val, void *data);
 +
 +static int omap3_abb_configure(struct omap_abb_info *abb);
 +static int omap3_abb_set_opp(struct omap_abb_info *abb, int opp_type);
 +
 +static int omap4_abb_configure(struct omap_abb_info *abb);
 +static int omap4_abb_set_opp(struct omap_abb_info *abb, int opp_type);
 +
  static struct omap_vdd_info *vdd_info;
  /*
  * Number of scalable voltage domains.
 @@ -70,9 +80,11 @@ static struct omap_vdd_info omap3_vdd_info[] = {
                                        = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
                        .done_st_shift  = 
 OMAP3630_ABB_LDO_TRANXDONE_ST_SHIFT,
                        .done_st_mask   = OMAP3630_ABB_LDO_TRANXDONE_ST_MASK,
 -                       .configure      = NULL,
 -                       .nb_handler     = NULL,
 -                       .set_opp        = NULL,
 +                       .nb     = {
 +                               .notifier_call = omap_abb_notify_voltage,
 +                       },
 +                       .configure      = omap3_abb_configure,
 +                       .set_opp        = omap3_abb_set_opp,
                },
        },
        {
 @@ -113,9 +125,11 @@ static struct omap_vdd_info omap4_vdd_info[] = {
                                        = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
                        .done_st_shift  = OMAP4430_ABB_MPU_DONE_ST_SHIFT,
                        .done_st_mask   = OMAP4430_ABB_MPU_DONE_ST_MASK,
 -                       .configure      = NULL,
 -                       .nb_handler     = NULL,
 -                       .set_opp        = NULL,
 +                       .nb             = {
 +                               .notifier_call = omap_abb_notify_voltage,
 +                       },
 +                       .configure      = omap4_abb_configure,
 +                       .set_opp        = omap4_abb_set_opp,
                },
        },
        {
 @@ -137,9 +151,11 @@ static struct omap_vdd_info omap4_vdd_info[] = {
                                        = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
                        .done_st_shift  = OMAP4430_ABB_IVA_DONE_ST_SHIFT,
                        .done_st_mask   = OMAP4430_ABB_IVA_DONE_ST_MASK,
 -                       .configure      = NULL,
 -                       .nb_handler     = NULL,
 -                       .set_opp        = NULL,
 +                       .nb             = {
 +                               .notifier_call = omap_abb_notify_voltage,
 +                       },
 +                       .configure      = omap4_abb_configure,
 +                       .set_opp        = omap4_abb_set_opp,
                },
        },
        {
 @@ -194,7 +210,7 @@ static struct omap_volt_data 
 omap36xx_vddmpu_volt_data[] = {
                        NOMINAL_OPP),
        

Re: [PATCH v5 7/8] OMAP: adapt hsmmc to hwmod framework

2011-02-28 Thread Kadiyala, Kishore
Hi Tony,

On Sat, Feb 26, 2011 at 4:59 PM, Kadiyala, Kishore
kishore.kadiy...@ti.com wrote:
 Hi Tony,

 On Sat, Feb 26, 2011 at 2:27 AM, Tony Lindgren t...@atomide.com wrote:
 * Tony Lindgren t...@atomide.com [110225 12:42]:
 * Kishore Kadiyala kishore.kadiy...@ti.com [110225 09:00]:
  +static int omap_mmc_init(struct omap_hwmod *oh, void *hsmmcinfo)
 ...

  +   static int mmc_num;
  +
  +   c += mmc_num;

 This does not look right..

 omap2_hsmmc_info is filled in respective board files and will have a call to
 omap2_hsmmc_init [hsmm.c].
 In omap2_hsmmc_init, it will call omap_hwmod_for_each_by_class which
 takes 3 arguments out of which 2nd one is a callback and 3rd one is void
 pointer to be passed to call back if necessary.
 With this the callback omap_mmc_init will be called multiple times based on
 the class entry in hwmod data file for each controller.
 Say you have 3 controllers as in OMAP3, then omap_mmc_init will be
 called thrice.
 Here the argument hsmmcinfo needs to be  incremented for each call, so 
 having
 a static mmc_num and incrementing it on each call.


 So since mmc_num is static, it gets initialized to 0, then increased
 for each call.. What if you want to intialize controller 1 and 3 but
 not 2?

 The current implementation for initialization of MMC controllers will work
 with any of the below  order of devices:
 1) MMC1, MMC2, MMC3
 2) MMC1, MMC3
 3) MMC2, MMC1
 4) MMC3, MMC2, MMC1
 5) MMC3
 

Sorry , you are correct the current implementation will not work for
above mentioned scenarios.
I will fix this and post updated series


Regards,
Kishore
--
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 v4] twl4030-madc driver

2011-02-28 Thread Keerthy
MADC(Monitoring ADC) driver enables monitoring analog signals using
analog-to-digital conversion (ADC) on the input source.
The previous discussion concluded in keeping the generic ADC
functionality and the hwmon separate. The discussion can be found here:

http://www.mail-archive.com/linux-omap@vger.kernel.org/msg41805.html

Keerthy (2):
  hwmon: twl4030: Hwmon Driver for TWL4030 MADC
  mfd: twl4030: Driver for twl4030 madc module

 Documentation/hwmon/twl4030-madc-hwmon |   45 ++
 drivers/hwmon/Kconfig  |   10 +
 drivers/hwmon/Makefile |1 +
 drivers/hwmon/twl4030-madc-hwmon.c |  153 ++
 drivers/mfd/Kconfig|   10 +
 drivers/mfd/Makefile   |1 +
 drivers/mfd/twl4030-madc.c |  812 
 include/linux/i2c/twl4030-madc.h   |  142 ++
 8 files changed, 1174 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/hwmon/twl4030-madc-hwmon
 create mode 100644 drivers/hwmon/twl4030-madc-hwmon.c
 create mode 100644 drivers/mfd/twl4030-madc.c
 create mode 100644 include/linux/i2c/twl4030-madc.h

--
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 v4] hwmon: twl4030: Hwmon Driver for TWL4030 MADC

2011-02-28 Thread Keerthy
This driver exposes the sysfs nodes of the TWL4030 MADC module.
All the voltage channel values are expressed in terms of mV. Channel 13
and channel 14 are reserved. There are channels which represent
temperature and current the output is represented by celcius
and mA respectively.

Signed-off-by: Keerthy j-keer...@ti.com
---
V3:
Corrected channel 15 index

V2:
Changed the names of the sysfs attributes compliant to current,
voltage and temperature attributes.

V1:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg44542.html

 Documentation/hwmon/twl4030-madc-hwmon |   45 +
 drivers/hwmon/Kconfig  |   10 ++
 drivers/hwmon/Makefile |1 +
 drivers/hwmon/twl4030-madc-hwmon.c |  153 
 4 files changed, 209 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/hwmon/twl4030-madc-hwmon
 create mode 100644 drivers/hwmon/twl4030-madc-hwmon.c

diff --git a/Documentation/hwmon/twl4030-madc-hwmon 
b/Documentation/hwmon/twl4030-madc-hwmon
new file mode 100644
index 000..ef79843
--- /dev/null
+++ b/Documentation/hwmon/twl4030-madc-hwmon
@@ -0,0 +1,45 @@
+Kernel driver twl4030-madc
+=
+
+Supported chips:
+   * Texas Instruments TWL4030
+   Prefix: 'twl4030-madc'
+
+
+Authors:
+   J Keerthy j-keer...@ti.com
+
+Description
+---
+
+The Texas Instruments TWL4030 is a Power Management and Audio Circuit. Among
+other things it contains a 10-bit A/D converter MADC. The converter has 16
+channels which can be used in different modes.
+
+
+See this table for the meaning of the different channels
+
+Channel Signal
+--
+0  Battery type(BTYPE)
+1  BCI: Battery temperature (BTEMP)
+2  GP analog input
+3  GP analog input
+4  GP analog input
+5  GP analog input
+6  GP analog input
+7  GP analog input
+8  BCI: VBUS voltage(VBUS)
+9  Backup Battery voltage (VBKP)
+10 BCI: Battery charger current (ICHG)
+11 BCI: Battery charger voltage (VCHG)
+12 BCI: Main battery voltage (VBAT)
+13 Reserved
+14 Reserved
+15 VRUSB Supply/Speaker left/Speaker right polarization level
+
+
+The Sysfs nodes will represent the voltage in the units of mV,
+the temperature channel shows the converted temperature in
+degree celcius. The Battery charging current channel represents
+battery charging current in mA.
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 297bc9a..cb3d895 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -941,6 +941,16 @@ config SENSORS_TMP421
  This driver can also be built as a module.  If so, the module
  will be called tmp421.
 
+config SENSORS_TWL4030_MADC
+   tristate Texas Instruments TWL4030 MADC Hwmon
+   depends on TWL4030_MADC
+   help
+   If you say yes here you get hwmon support for triton
+   TWL4030-MADC.
+
+   This driver can also be built as a module. If so it will be called
+   twl4030-madc-hwmon.
+
 config SENSORS_VIA_CPUTEMP
tristate VIA CPU temperature sensor
depends on X86
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index dde02d9..bc7d740 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -102,6 +102,7 @@ obj-$(CONFIG_SENSORS_THMC50)+= thmc50.o
 obj-$(CONFIG_SENSORS_TMP102)   += tmp102.o
 obj-$(CONFIG_SENSORS_TMP401)   += tmp401.o
 obj-$(CONFIG_SENSORS_TMP421)   += tmp421.o
+obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o
 obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
 obj-$(CONFIG_SENSORS_VIA686A)  += via686a.o
 obj-$(CONFIG_SENSORS_VT1211)   += vt1211.o
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c 
b/drivers/hwmon/twl4030-madc-hwmon.c
new file mode 100644
index 000..5eb563f
--- /dev/null
+++ b/drivers/hwmon/twl4030-madc-hwmon.c
@@ -0,0 +1,153 @@
+/*
+ *
+ * TWL4030 MADC Hwmon driver-This driver monitors the real time
+ * conversion of analog signals like battery temperature,
+ * battery type, battery level etc. User can ask for the conversion on a
+ * particular channel using the sysfs nodes.
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ * J Keerthy j-keer...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include linux/platform_device.h
+#include 

Re: [PATCH 1/2] ARM: l2x0: Errata fix for flush by Way operation can cause data corruption

2011-02-28 Thread Russell King - ARM Linux
On Sun, Feb 27, 2011 at 12:00:21PM +, Russell King - ARM Linux wrote:
  +#else
  +/* Optimised out for non-errata case */
  +static inline void debug_writel(unsigned long val)
  +{
   }
 
 #define l2x0_set_debugNULL
 
  +#endif

I notice you got rid of the inline function.  Have you tried building this
without the errata enabled?
--
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: [PATCHv5 0/3] Introduce the /proc/socinfo and use it to export OMAP data

2011-02-28 Thread Maxime Coquelin

Hello Eduardo,

On 02/16/2011 12:57 PM, Eduardo Valentin wrote:

Hello Linus,

On Tue, Feb 15, 2011 at 01:58:00PM +0100, ext Linus Walleij wrote:

2010/5/11 Eduardo Valentineduardo.valen...@nokia.com:


Here is the version 5 of the change to export OMAP data to userspace
(name, revision, id code, production id and die id).

Basically, this version is still attempting to create a new file under /proc.
It is the /proc/socinfo, which should be used to export bits which are SoC 
specific
(not CPU related, nor machine related).

So, differences between previous version are:
- merged patch 02/04 with 03/04 to avoid compilation breakages.
- simplified the seq_file usage by using the single_open and single_release 
functions
- exported a function to register a seq_operation .show callback
- adapted the changes accordingly

As usual, comments are welcome.

Eduardo, what has happened to this patchset?

Got forgotten :-(. Unfortunately I didn't pushed it hard enough.

 I propose to refactor your patchset, moving from procfs to sysfs.

Do you want help in picking it up and try to polish it up?

Yeah, but it would need a refactoring. IIRC, result of last discussion was that
we should not mess with /proc. So, maybe moving back to something under sysfs.
Perhaps /sys/devices/soc or so?

About the location of this new sysfs entry, where do you think it should be?
I propose to create a new directory named soc in /sys/devices/system/.

As platform vendors have several/different kind of IDs to export to 
sysfs, I propose each vendor to create file entries related to their IDs 
(eg. /sys/devices/system/soc/idcode for OMAP platforms).


However, I think we should have a common file entry to export the unique 
ID of the platforms. Indeed, user-space applications should have a 
unified way to get this kind of ID, regardless of the platform (eg. 
/sys/devices/system/soc/unique_id).


Do you agree with my proposal?

Thanks for your comments.

Regards,

Maxime Coquelin

--
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] OMAP: GPIO: use PM runtime framework

2011-02-28 Thread Charulatha V
Use PM runtime framework in OMAP GPIO driver.

Patch series is based on LO Kernel omap_for_linus branch.

Dependency patches to test system wide suspend on omap_for_linus branch:
https://patchwork.kernel.org/patch/550551/
https://patchwork.kernel.org/patch/513481/

Compile tested for:
 - omap1_defconfig
 - omap2plus_defconfig

Boot test (success on the following boards):
 - OMAP1710-H3
 - OMAP2420-H4
 - OMAP2430-SDP (Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com)
 - OMAP3430-SDP
 - OMAP3630-Zoom3
 - OMAP4430-Blaze
 - OMAP4430-SDP

GPIO module functionality testing (success on the following boards):
 - OMAP2420-H4
 - OMAP2430-SDP (Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com)
 - OMAP3430-SDP
 - OMAP3630-Zoom3
 - OMAP4430-Blaze
 - OMAP4430-SDP

PM Testing:
OMAP3430-SDP(success):
 - retention
 - off_mode
 - system_wide suspend
OMAP3630-Zoom3(success):
 - retention
 - off_mode
 - system_wide suspend
 - wakeup test

using the following:
echo 5  /sys/devices/platform/omap/omap_uart.0/sleep_timeout
echo 5  /sys/devices/platform/omap/omap_uart.1/sleep_timeout
echo 5  /sys/devices/platform/omap/omap_uart.2/sleep_timeout
echo '3'  /debug/pm_debug/wakeup_timer_seconds
echo 1  /debug/pm_debug/sleep_while_idle
echo 1  /debug/pm_debug/enable_off_mode
echo mem  /sys/power/state
cat /debug/pm_debug/count

Link to previous patch series for GPIO PM runtime framework adaptation
as part of GPIO hwmod adaptation series:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35123.html
https://patchwork.kernel.org/patch/189832/

Charulatha V (5):
  OMAP: GPIO: Make gpio_context part of gpio_bank structure
  OMAP: GPIO: Use pwrdmn name to find wkup dmn GPIO
  OMAP4: GPIO: Save/restore context
  OMAP: GPIO: handle save/restore ctxt in GPIO driver
  OMAP: GPIO: Use PM runtime framework

 arch/arm/mach-omap2/gpio.c |6 +
 arch/arm/mach-omap2/pm24xx.c   |2 +-
 arch/arm/mach-omap2/pm34xx.c   |   20 +-
 arch/arm/plat-omap/gpio.c  |  563 ++--
 arch/arm/plat-omap/include/plat/gpio.h |5 +-
 5 files changed, 330 insertions(+), 266 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/5] OMAP: GPIO: make gpio_context part of gpio_bank structure

2011-02-28 Thread Charulatha V
gpio_context array, which is used to save gpio bank's context,
is used only for OMAP3 architecture.

Move gpio_context as part of gpio_bank structure so that
it can be specific to each gpio bank and can be used for
any OMAP architecture

Signed-off-by: Charulatha V ch...@ti.com

Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com
(2430-SDP testing)
---
TODO: extend the gpio save/restore context function for OMAP4
architecture. This is done in one of the next patches in this
series

 arch/arm/plat-omap/gpio.c |   72 +---
 1 files changed, 34 insertions(+), 38 deletions(-)

diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 971d186..c6ab0ff 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -133,6 +133,19 @@
 #define OMAP4_GPIO_CLEARDATAOUT0x0190
 #define OMAP4_GPIO_SETDATAOUT  0x0194
 
+struct gpio_regs {
+   u32 irqenable1;
+   u32 irqenable2;
+   u32 wake_en;
+   u32 ctrl;
+   u32 oe;
+   u32 leveldetect0;
+   u32 leveldetect1;
+   u32 risingdetect;
+   u32 fallingdetect;
+   u32 dataout;
+};
+
 struct gpio_bank {
unsigned long pbase;
void __iomem *base;
@@ -145,7 +158,7 @@ struct gpio_bank {
 #endif
u32 non_wakeup_gpios;
u32 enabled_non_wakeup_gpios;
-
+   struct gpio_regs context;
u32 saved_datain;
u32 saved_fallingdetect;
u32 saved_risingdetect;
@@ -161,23 +174,6 @@ struct gpio_bank {
int stride;
 };
 
-#ifdef CONFIG_ARCH_OMAP3
-struct omap3_gpio_regs {
-   u32 irqenable1;
-   u32 irqenable2;
-   u32 wake_en;
-   u32 ctrl;
-   u32 oe;
-   u32 leveldetect0;
-   u32 leveldetect1;
-   u32 risingdetect;
-   u32 fallingdetect;
-   u32 dataout;
-};
-
-static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
-#endif
-
 /*
  * TODO: Cleanup gpio_bank usage as it is having information
  * related to all instances of the device
@@ -2043,25 +2039,25 @@ void omap_gpio_save_context(void)
/* saving banks from 2-6 only since GPIO1 is in WKUP */
for (i = 1; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
-   gpio_context[i].irqenable1 =
+   bank-context.irqenable1 =
__raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1);
-   gpio_context[i].irqenable2 =
+   bank-context.irqenable2 =
__raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE2);
-   gpio_context[i].wake_en =
+   bank-context.wake_en =
__raw_readl(bank-base + OMAP24XX_GPIO_WAKE_EN);
-   gpio_context[i].ctrl =
+   bank-context.ctrl =
__raw_readl(bank-base + OMAP24XX_GPIO_CTRL);
-   gpio_context[i].oe =
+   bank-context.oe =
__raw_readl(bank-base + OMAP24XX_GPIO_OE);
-   gpio_context[i].leveldetect0 =
+   bank-context.leveldetect0 =
__raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT0);
-   gpio_context[i].leveldetect1 =
+   bank-context.leveldetect1 =
__raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT1);
-   gpio_context[i].risingdetect =
+   bank-context.risingdetect =
__raw_readl(bank-base + OMAP24XX_GPIO_RISINGDETECT);
-   gpio_context[i].fallingdetect =
+   bank-context.fallingdetect =
__raw_readl(bank-base + OMAP24XX_GPIO_FALLINGDETECT);
-   gpio_context[i].dataout =
+   bank-context.dataout =
__raw_readl(bank-base + OMAP24XX_GPIO_DATAOUT);
}
 }
@@ -2073,25 +2069,25 @@ void omap_gpio_restore_context(void)
 
for (i = 1; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
-   __raw_writel(gpio_context[i].irqenable1,
+   __raw_writel(bank-context.irqenable1,
bank-base + OMAP24XX_GPIO_IRQENABLE1);
-   __raw_writel(gpio_context[i].irqenable2,
+   __raw_writel(bank-context.irqenable2,
bank-base + OMAP24XX_GPIO_IRQENABLE2);
-   __raw_writel(gpio_context[i].wake_en,
+   __raw_writel(bank-context.wake_en,
bank-base + OMAP24XX_GPIO_WAKE_EN);
-   __raw_writel(gpio_context[i].ctrl,
+   __raw_writel(bank-context.ctrl,
bank-base + OMAP24XX_GPIO_CTRL);
-   __raw_writel(gpio_context[i].oe,
+   __raw_writel(bank-context.oe,
bank-base + OMAP24XX_GPIO_OE);
-   __raw_writel(gpio_context[i].leveldetect0,
+   __raw_writel(bank-context.leveldetect0,
  

[PATCH 3/5] OMAP4: GPIO: save/restore context

2011-02-28 Thread Charulatha V
Modify the omap_gpio_save/restore_context to support OMAP4
architecture so that the GPIO driver need not be modified
when OMAP4 off mode support is available.

Signed-off-by: Charulatha V ch...@ti.com

Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com
(2430-SDP testing)
---
 arch/arm/plat-omap/gpio.c |  131 +---
 1 files changed, 86 insertions(+), 45 deletions(-)

diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index ff341ec..1da3233 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -2031,43 +2031,62 @@ void omap2_gpio_resume_after_idle(void)
 
 #endif
 
-#ifdef CONFIG_ARCH_OMAP3
-/* save the registers of bank 2-6 */
 void omap_gpio_save_context(void)
 {
int i;
 
-   /* saving banks from 2-6 only since GPIO1 is in WKUP */
for (i = 0; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
 
if (!strcmp(bank-pwrdm_name, wkup_pwrdm))
continue;
 
-   bank-context.irqenable1 =
-   __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1);
-   bank-context.irqenable2 =
-   __raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE2);
-   bank-context.wake_en =
-   __raw_readl(bank-base + OMAP24XX_GPIO_WAKE_EN);
-   bank-context.ctrl =
-   __raw_readl(bank-base + OMAP24XX_GPIO_CTRL);
-   bank-context.oe =
-   __raw_readl(bank-base + OMAP24XX_GPIO_OE);
-   bank-context.leveldetect0 =
-   __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT0);
-   bank-context.leveldetect1 =
-   __raw_readl(bank-base + OMAP24XX_GPIO_LEVELDETECT1);
-   bank-context.risingdetect =
-   __raw_readl(bank-base + OMAP24XX_GPIO_RISINGDETECT);
-   bank-context.fallingdetect =
-   __raw_readl(bank-base + OMAP24XX_GPIO_FALLINGDETECT);
-   bank-context.dataout =
-   __raw_readl(bank-base + OMAP24XX_GPIO_DATAOUT);
+   if (bank-method == METHOD_GPIO_24XX) {
+   bank-context.irqenable1 = __raw_readl(
+   bank-base + OMAP24XX_GPIO_IRQENABLE1);
+   bank-context.irqenable2 = __raw_readl(
+   bank-base + OMAP24XX_GPIO_IRQENABLE2);
+   bank-context.wake_en = __raw_readl(
+   bank-base + OMAP24XX_GPIO_WAKE_EN);
+   bank-context.ctrl = __raw_readl(
+   bank-base + OMAP24XX_GPIO_CTRL);
+   bank-context.oe = __raw_readl(
+   bank-base + OMAP24XX_GPIO_OE);
+   bank-context.leveldetect0 = __raw_readl(bank-base +
+   OMAP24XX_GPIO_LEVELDETECT0);
+   bank-context.leveldetect1 = __raw_readl(bank-base +
+   OMAP24XX_GPIO_LEVELDETECT1);
+   bank-context.risingdetect = __raw_readl(bank-base +
+   OMAP24XX_GPIO_RISINGDETECT);
+   bank-context.fallingdetect = __raw_readl(bank-base +
+   OMAP24XX_GPIO_FALLINGDETECT);
+   bank-context.dataout = __raw_readl(
+   bank-base + OMAP24XX_GPIO_DATAOUT);
+   } else if (bank-method == METHOD_GPIO_44XX) {
+   bank-context.irqenable1 = __raw_readl(
+   bank-base + OMAP4_GPIO_IRQSTATUSSET0);
+   bank-context.irqenable2 = __raw_readl(
+   bank-base + OMAP4_GPIO_IRQSTATUSSET1);
+   bank-context.wake_en = __raw_readl(
+   bank-base + OMAP4_GPIO_IRQWAKEN0);
+   bank-context.ctrl = __raw_readl(
+   bank-base + OMAP4_GPIO_CTRL);
+   bank-context.oe = __raw_readl(
+   bank-base + OMAP24XX_GPIO_OE);
+   bank-context.leveldetect0 = __raw_readl(bank-base +
+   OMAP4_GPIO_LEVELDETECT0);
+   bank-context.leveldetect1 = __raw_readl(bank-base +
+   OMAP4_GPIO_LEVELDETECT1);
+   bank-context.risingdetect = __raw_readl(bank-base +
+   OMAP4_GPIO_RISINGDETECT);
+   bank-context.fallingdetect = __raw_readl(bank-base +
+   OMAP4_GPIO_FALLINGDETECT);
+   bank-context.dataout = __raw_readl(
+   

[PATCH 2/5] OMAP: GPIO: use pwrdmn name to find wkup dmn GPIO

2011-02-28 Thread Charulatha V
In omap3, save/restore context is implemented for GPIO
banks 2-6 as GPIO bank1 is in wakeup domain. Instead
of identifying bank's power domain by bank id, make use
of powerdomain name itself.

For this, omap_hwmod_get_pwrdm() is used. omap_device_get_pwrdm()
could not be used as the pwrdm information needs to be filled
in pdata. But omap_device_get_pwrdm() can be used only after
omap_device_build() call.

Signed-off-by: Charulatha V ch...@ti.com

Tested-by: Tarun Kanti DebBarma tarun.ka...@ti.com
(2430-SDP testing)
---
 arch/arm/mach-omap2/gpio.c |6 ++
 arch/arm/plat-omap/gpio.c  |   31 ---
 arch/arm/plat-omap/include/plat/gpio.h |1 +
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 413de18..39b0d96 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -24,6 +24,8 @@
 #include plat/omap_hwmod.h
 #include plat/omap_device.h
 
+#include powerdomain.h
+
 static struct omap_device_pm_latency omap_gpio_latency[] = {
[0] = {
.deactivate_func = omap_device_idle_hwmods,
@@ -39,6 +41,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void 
*unused)
struct omap_gpio_dev_attr *dev_attr;
char *name = omap_gpio;
int id;
+   struct powerdomain *pwrdm;
 
/*
 * extract the device id from name field available in the
@@ -75,6 +78,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void 
*unused)
return -EINVAL;
}
 
+   pwrdm = omap_hwmod_get_pwrdm(oh);
+   strcpy(pdata-pwrdm_name, pwrdm-name);
+
od = omap_device_build(name, id - 1, oh, pdata,
sizeof(*pdata), omap_gpio_latency,
ARRAY_SIZE(omap_gpio_latency),
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index c6ab0ff..ff341ec 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -172,6 +172,7 @@ struct gpio_bank {
struct device *dev;
bool dbck_flag;
int stride;
+   const char *pwrdm_name;
 };
 
 /*
@@ -1720,6 +1721,7 @@ static int __devinit omap_gpio_probe(struct 
platform_device *pdev)
bank-dbck_flag = pdata-dbck_flag;
bank-stride = pdata-bank_stride;
bank_width = pdata-bank_width;
+   bank-pwrdm_name = pdata-pwrdm_name;
 
spin_lock_init(bank-lock);
 
@@ -1865,16 +1867,15 @@ static int workaround_enabled;
 void omap2_gpio_prepare_for_idle(int off_mode)
 {
int i, c = 0;
-   int min = 0;
 
-   if (cpu_is_omap34xx())
-   min = 1;
-
-   for (i = min; i  gpio_bank_count; i++) {
+   for (i = 0; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
u32 l1 = 0, l2 = 0;
int j;
 
+   if (!strcmp(bank-pwrdm_name, wkup_pwrdm))
+   continue;
+
for (j = 0; j  hweight_long(bank-dbck_enable_mask); j++)
clk_disable(bank-dbck);
 
@@ -1934,15 +1935,15 @@ void omap2_gpio_prepare_for_idle(int off_mode)
 void omap2_gpio_resume_after_idle(void)
 {
int i;
-   int min = 0;
 
-   if (cpu_is_omap34xx())
-   min = 1;
-   for (i = min; i  gpio_bank_count; i++) {
+   for (i = 0; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
u32 l = 0, gen, gen0, gen1;
int j;
 
+   if (!strcmp(bank-pwrdm_name, wkup_pwrdm))
+   continue;
+
for (j = 0; j  hweight_long(bank-dbck_enable_mask); j++)
clk_enable(bank-dbck);
 
@@ -2037,8 +2038,12 @@ void omap_gpio_save_context(void)
int i;
 
/* saving banks from 2-6 only since GPIO1 is in WKUP */
-   for (i = 1; i  gpio_bank_count; i++) {
+   for (i = 0; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
+
+   if (!strcmp(bank-pwrdm_name, wkup_pwrdm))
+   continue;
+
bank-context.irqenable1 =
__raw_readl(bank-base + OMAP24XX_GPIO_IRQENABLE1);
bank-context.irqenable2 =
@@ -2067,8 +2072,12 @@ void omap_gpio_restore_context(void)
 {
int i;
 
-   for (i = 1; i  gpio_bank_count; i++) {
+   for (i = 0; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
+
+   if (!strcmp(bank-pwrdm_name, wkup_pwrdm))
+   continue;
+
__raw_writel(bank-context.irqenable1,
bank-base + OMAP24XX_GPIO_IRQENABLE1);
__raw_writel(bank-context.irqenable2,
diff --git a/arch/arm/plat-omap/include/plat/gpio.h 
b/arch/arm/plat-omap/include/plat/gpio.h
index d6f9fa0..2c46caa 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ 

Re: [PATCH 0/8] OMAP2+: hwmod/clockevent: allow late-init of individual hwmods

2011-02-28 Thread Cousson, Benoit

Salut Paul,

On 2/28/2011 3:31 AM, Paul Walmsley wrote:

Salut Benoît,

On Wed, 23 Feb 2011, Cousson, Benoit wrote:


On 2/23/2011 8:11 AM, Paul Walmsley wrote:

This series adds the ability to late-initialize individual
hwmods.  The goal here is for clockevent (and eventually
clocksource) hwmods to be late-initialized individually, and
right before they are needed, in the timer init code.  Then
omap_hwmod_late_init(), which late-inits the rest of the hwmods,
is intended to run as an initcall -- much later in the boot
process.

This series includes the OMAP2/3 hwmod data for the GPTIMERs that
Tarun posted earlier.  This data is necessary for this new code
to avoid warnings during boot.

Boot-tested on N800, OMAP34xx Beagleboard and OMAP4430ES2 Panda.


I'm testing it on 4430sdp, and I have the following warning:

[0.00] omap_hwmod: dpll_mpu_m2_ck: missing clockdomain for 
dpll_mpu_m2_ck.
[0.00] [ cut here ]
[0.00] WARNING: at arch/arm/mach-omap2/timer-gp.c:157 
omap2_gp_timer_init+0x80/0x190()
[0.00] timer-gp: omap_dm_timer_set_source() failed
[0.00] Modules linked in:
[0.00] [c0062a6c] (unwind_backtrace+0x0/0xec) from [c009422c] 
(warn_slowpath_common+0x4c/0x64)
[0.00] [c009422c] (warn_slowpath_common+0x4c/0x64) from [c00942c4] 
(warn_slowpath_fmt+0x2c/0x3c)
[0.00] [c00942c4] (warn_slowpath_fmt+0x2c/0x3c) from [c0010e30] 
(omap2_gp_timer_init+0x80/0x190)
[0.00] [c0010e30] (omap2_gp_timer_init+0x80/0x190) from [c000c0dc] 
(time_init+0x20/0x30)
[0.00] [c000c0dc] (time_init+0x20/0x30) from [c0008cbc] 
(start_kernel+0x1a4/0x30c)
[0.00] [c0008cbc] (start_kernel+0x1a4/0x30c) from [80008038] 
(0x80008038)
[0.00] ---[ end trace 1b75b31a2719ed1c ]---
[0.00] OMAP clockevent source: GPTIMER1 at 32768 Hz


This is due to commit 3b03b58dab847883e6b9a431558c7d8e43fa94c6 (OMAP4:
hwmod data: Prevent timer1 to be reset and idle during init).  Could you
please try reverting this and see if the warning disappears?


Thanks, this is indeed fixing this warning. I didn't see these two 
patches were exclusive.


Thanks,
Benoit



Tony, I guess the omap-for-linus branch will probably need to get rebuilt
to drop that patch, once this series is merged...

- Paul


--
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 5/8] omap3: pm: TWL5030 version checking

2011-02-28 Thread Krishnamoorthy, Balaji T
On Mon, Feb 28, 2011 at 4:34 PM, Manuel, Lesly Arackal lesl...@ti.com wrote:
 Hi Balaji,

 On Mon, Feb 28, 2011 at 12:54 PM, Krishnamoorthy, Balaji T
 balaj...@ti.com wrote:
 On Sat, Feb 26, 2011 at 5:55 PM, Lesly A M lesl...@ti.com wrote:

 Minor comment you missed version number in subject.

 snip

 +/**
 + * twl_get_si_type - api to get TWL Si type.
 + *
 + * Api to get the TWL Si type from IDCODE value.
 + */
 +int twl_get_si_type(void)
 +{
 +       return TWL_SIL_TYPE(twl_idcode);
 +}
 +EXPORT_SYMBOL(twl_get_si_type);
 +
 +/**
 + * twl_get_si_version - api to get TWL Si version.
 + *
 + * Api to get the TWL Si version from IDCODE value.
 + */
 +int twl_get_si_version(void)
 +{
 +       return TWL_SIL_REV(twl_idcode);
 +}
 +EXPORT_SYMBOL(twl_get_si_version);
 +
  static struct device *
  add_numbered_child(unsigned chip, const char *name, int num,
                void *pdata, unsigned pdata_len,
 @@ -1056,6 +1114,12 @@ twl_probe(struct i2c_client *client, const struct 
 i2c_device_id *id)
        /* setup clock framework */
        clocks_init(client-dev, pdata-clock);

 +       /* read TWL IDCODE Register */
 +       if (twl_read_idcode_register(twl_idcode)) {

 Call this function only in case of Triton

 How do I check it ?
 using if (twl_id == TWL4030_CLASS_ID)

yes



 +               pr_err(TWL4030 Unable to read IDCODE Register\n);
 +               return -EIO;

 Do you really want to fail twl_probe due to error in reading IDCODE ?

 Is the twl_probe function expected to continue, if the i2c read/write
 on twl itself is failing ?

I don't want to fail twl_probe completely due to one occasional i2c failures.
Even this pr_err is not needed as you do that inside
twl_read_idcode_register


 Regards,
 Lesly A M

--
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 v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Cousson, Benoit

Hi Tomi,

On 2/28/2011 8:19 AM, Valkeinen, Tomi wrote:

On Mon, 2011-02-28 at 01:09 -0600, Taneja, Archit wrote:

Hi,

On Monday 28 February 2011 12:23 PM, Valkeinen, Tomi wrote:

On Thu, 2011-02-24 at 03:27 -0600, Tomi Valkeinen wrote:

Hi,

On Mon, 2011-01-24 at 11:51 +0530, ext Sumit Semwal wrote:

From: Senthilvadivu Guruswamysvad...@ti.com

Change the driver name from omapdss to omap_display as the driver takes care of
the display devices ie number of panels, type of panels available in the
platform.  Change the device name in the board files and 2420,2430,3xxx clock
files from omapdss to omap_display to match the driver name.


I just realized that changing the driver name will break all scripts and
applications using omapdss sysfs files.

How does this sound:

Let's leave the omapdss device name as it is. It represents a super
device, containing the dss sysfs files and upper level dss management.


This is the case for all the drivers migrated to omap_device anyway due 
to the change in the top level hierarchy. Everything is below 
platform/omap now.
That's why we are using that opportunity to clean and provide a 
consistent naming for all devices.



Name the HW module platform drivers as: omapdss_dss, omapdss_venc,
omapdss_dispc, etc. This would indicate them to be clearly parts of DSS,
and would also prevent any possible name conflict if there would happen
to be a, say, dsi block in some other HW component.


Cannot you use a device hierarchy then to do that?
 omap_dss/core
 omap_dss/dsi
 omap_dss/venc

This is moreover the way the HW is done.


Any comments on this?


I also think we need to stick to the older name, omapdss_dss sounds a
bit confusing, and I think one of the previous versions had something
like dss_dss in it and it wasn't approved. Does something like
omapdss_core or omapdss_dss_core make sense, or is it more misleading?


It is confusing, but so is the hardware naming =). There is a DSS module
inside the omap display subsystem. That's why I would like to name it
dss, not core, so it's clear it refers to this DSS module.

dss_dss looks a bit silly, but I think omapdss_dss is slightly
better in the sense that it doesn't repeat the same dss, and there is
an omapdss device, which acts like manager for these module devices.
But yes, I wouldn't call it perfect either.

omapdss_dss_core is one option. But then again, TRM doesn't speak of
core.


We should not maintain silly names just because they are in the TRM, we 
should just fix the TRM. This is exactly what we are going to do for 
most HW names we introduced in OMAP4.


So if we all agree that this name will avoid confusion and is much 
better than the current one, we can change it right now with a comment 
to explain the change and give the pointer to the current TRM naming.


Regards,
Benoit
--
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] OMAP2+: sdrc: fix compile break on OMAP4-only config on current omap-for-linus

2011-02-28 Thread Sergei Shtylyov

Hello.

On 28-02-2011 3:03, Paul Walmsley wrote:


How about empty inline instead?



Thanks for the review; that is indeed a better approach.  Following is the
updated patch.



Tony, do you want to take this one?




- Paul



From: Paul Walmsleyp...@pwsan.com
Date: Fri, 25 Feb 2011 17:38:25 -0700
Subject: [PATCH] OMAP2+: sdrc: fix compile break on OMAP4-only config on 
current omap-for-linus



On non-OMAP2 and non-OMAP3 kernel configs, turn omap2_sdrc_init() into
a no-op.  Otherwise, compilation breaks on an OMAP4-only config with
the current omap-for-linus branch:



arch/arm/mach-omap2/built-in.o: In function `omap2_init_common_devices':
../mach-omap2/io.c:421: undefined reference to `omap2_sdrc_init'



Thanks to Sergei Shtylyov sshtyl...@mvista.com  for suggesting the use
of a empty static inline function rather than a macro.


   Not at all. :-)


Signed-off-by: Paul Walmsleyp...@pwsan.com
Cc: Tony Lindgrent...@atomide.com
Cc: Sergei Shtylyovsshtyl...@mvista.com
---
  arch/arm/plat-omap/include/plat/sdrc.h |6 ++
  1 files changed, 6 insertions(+), 0 deletions(-)



diff --git a/arch/arm/plat-omap/include/plat/sdrc.h 
b/arch/arm/plat-omap/include/plat/sdrc.h
index efd87c8..2a34a65 100644
--- a/arch/arm/plat-omap/include/plat/sdrc.h
+++ b/arch/arm/plat-omap/include/plat/sdrc.h
@@ -124,8 +124,14 @@ struct omap_sdrc_params {
u32 mr;
  };

+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
  void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1);
+#else
+static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,


   No need to annotate it as __init.


+ struct omap_sdrc_params *sdrc_cs1) {};
+#endif
+


WBR, Sergei
--
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 v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 05:36 -0600, Cousson, Benoit wrote:
 Hi Tomi,
 
 On 2/28/2011 8:19 AM, Valkeinen, Tomi wrote:
  On Mon, 2011-02-28 at 01:09 -0600, Taneja, Archit wrote:
  Hi,
 
  On Monday 28 February 2011 12:23 PM, Valkeinen, Tomi wrote:
  On Thu, 2011-02-24 at 03:27 -0600, Tomi Valkeinen wrote:
  Hi,
 
  On Mon, 2011-01-24 at 11:51 +0530, ext Sumit Semwal wrote:
  From: Senthilvadivu Guruswamysvad...@ti.com
 
  Change the driver name from omapdss to omap_display as the driver takes 
  care of
  the display devices ie number of panels, type of panels available in the
  platform.  Change the device name in the board files and 2420,2430,3xxx 
  clock
  files from omapdss to omap_display to match the driver name.
 
  I just realized that changing the driver name will break all scripts and
  applications using omapdss sysfs files.
 
  How does this sound:
 
  Let's leave the omapdss device name as it is. It represents a super
  device, containing the dss sysfs files and upper level dss management.
 
 This is the case for all the drivers migrated to omap_device anyway due 
 to the change in the top level hierarchy. Everything is below 
 platform/omap now.

The HW module drivers are under platform/omap/, but omapdss is in
platform/. Do you mean that omapdss should also be under platform/omap/?

The reason I'm unwilling to change omapdss name, or location, is that
omapdss directory contains lots of DSS configuration files, used by
scripts and programs.

 That's why we are using that opportunity to clean and provide a 
 consistent naming for all devices.
 
  Name the HW module platform drivers as: omapdss_dss, omapdss_venc,
  omapdss_dispc, etc. This would indicate them to be clearly parts of DSS,
  and would also prevent any possible name conflict if there would happen
  to be a, say, dsi block in some other HW component.
 
 Cannot you use a device hierarchy then to do that?
   omap_dss/core
   omap_dss/dsi
   omap_dss/venc
 
 This is moreover the way the HW is done.

Hmm, how would that work? The devices are platform devices, and they
have a unique global name, which is used to match the driver for the
device.

 
  Any comments on this?
 
  I also think we need to stick to the older name, omapdss_dss sounds a
  bit confusing, and I think one of the previous versions had something
  like dss_dss in it and it wasn't approved. Does something like
  omapdss_core or omapdss_dss_core make sense, or is it more misleading?
 
  It is confusing, but so is the hardware naming =). There is a DSS module
  inside the omap display subsystem. That's why I would like to name it
  dss, not core, so it's clear it refers to this DSS module.
 
  dss_dss looks a bit silly, but I think omapdss_dss is slightly
  better in the sense that it doesn't repeat the same dss, and there is
  an omapdss device, which acts like manager for these module devices.
  But yes, I wouldn't call it perfect either.
 
  omapdss_dss_core is one option. But then again, TRM doesn't speak of
  core.
 
 We should not maintain silly names just because they are in the TRM, we 
 should just fix the TRM. This is exactly what we are going to do for 
 most HW names we introduced in OMAP4.
 
 So if we all agree that this name will avoid confusion and is much 
 better than the current one, we can change it right now with a comment 
 to explain the change and give the pointer to the current TRM naming.

True. But I don't think there's a huge difference with omapdss_dss or
omapdss_core.

The name is used in only a few places inside the kernel, and never from
userspace, so we can change that also later.

The main issue I had was changing the omapdss device name, which would
break the userspace.

 Tomi


--
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/1] omap3: nand: report corrected ecc errors

2011-02-28 Thread John Ogness
From: John Ogness john.ogn...@linutronix.de

The number of corrected ECC errors should be reported since other MTD
systems make use of this information (such as UBI data scrubbing).

Signed-off-by: John Ogness john.ogn...@linutronix.de
---
Patch v2:
o Patch against linux-next-20110225.
o Added comments explaining return codes.

 drivers/mtd/nand/omap2.c |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 4e33972..6324230 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -668,6 +668,8 @@ static void gen_true_ecc(u8 *ecc_buf)
  *
  * This function compares two ECC's and indicates if there is an error.
  * If the error can be corrected it will be corrected to the buffer.
+ * If there is no error, %0 is returned. If there is an error but it
+ * was corrected, %1 is returned. Otherwise, %-1 is returned.
  */
 static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */
u8 *ecc_data2,  /* read from register */
@@ -773,7 +775,7 @@ static int omap_compare_ecc(u8 *ecc_data1,  /* read from 
NAND memory */
 
page_data[find_byte] ^= (1  find_bit);
 
-   return 0;
+   return 1;
default:
if (isEccFF) {
if (ecc_data2[0] == 0 
@@ -794,8 +796,11 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from 
NAND memory */
  * @calc_ecc: ecc read from HW ECC registers
  *
  * Compares the ecc read from nand spare area with ECC registers values
- * and if ECC's mismached, it will call 'omap_compare_ecc' for error detection
- * and correction.
+ * and if ECC's mismatched, it will call 'omap_compare_ecc' for error
+ * detection and correction. If there are no errors, %0 is returned. If
+ * there were errors and all of the errors were corrected, the number of
+ * corrected errors is returned. If uncorrectable errors exist, %-1 is
+ * returned.
  */
 static int omap_correct_data(struct mtd_info *mtd, u_char *dat,
u_char *read_ecc, u_char *calc_ecc)
@@ -803,6 +808,7 @@ static int omap_correct_data(struct mtd_info *mtd, u_char 
*dat,
struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
mtd);
int blockCnt = 0, i = 0, ret = 0;
+   int stat = 0;
 
/* Ex NAND_ECC_HW12_2048 */
if ((info-nand.ecc.mode == NAND_ECC_HW) 
@@ -816,12 +822,14 @@ static int omap_correct_data(struct mtd_info *mtd, u_char 
*dat,
ret = omap_compare_ecc(read_ecc, calc_ecc, dat);
if (ret  0)
return ret;
+   /* keep track of the number of corrected errors */
+   stat += ret;
}
read_ecc += 3;
calc_ecc += 3;
dat  += 512;
}
-   return 0;
+   return stat;
 }
 
 /**
-- 
1.5.6.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


Re: [PATCH v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Russell King - ARM Linux
On Mon, Feb 28, 2011 at 02:10:26PM +0200, Tomi Valkeinen wrote:
 On Mon, 2011-02-28 at 05:36 -0600, Cousson, Benoit wrote:
  Cannot you use a device hierarchy then to do that?
omap_dss/core
omap_dss/dsi
omap_dss/venc
  
  This is moreover the way the HW is done.
 
 Hmm, how would that work? The devices are platform devices, and they
 have a unique global name, which is used to match the driver for the
 device.

And not forgetting that '/' is not permitted in device or driver names.
--
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 0/3] OMAP: DSS2: Generalize DSS clock source names

2011-02-28 Thread Tomi Valkeinen
Hi,

On Mon, 2011-02-28 at 00:50 -0600, Taneja, Archit wrote:
 The OMAP Display Subsystem has multiple clock sources available for its
 modules. One of these sources has to be selected through a global control
 register called DSS_CTRL.
 
 For example, on OMAP4, the Display Controller Module's (DISPC) functional
 clock can be derived from:
 a) output of DPLL_PER's M5 divisor
 b) output of DSI1 PLL's M4 divisor
 c) output of DSI2 PLL's M4 divisor
 d) output of HDMI PLL
 
 There is, hence, an enum called 'dss_clk_source' which is used throughout
 DSS2, to select clock sources for various DSS sub modules. These clock
 source names are currently specific to OMAP2/3 TRM clock names.
 
 All enum members, variables, functions which are based on these clock
 source names have been made generic such that they can be used for future
 OMAPs as well.
 
 Archit Taneja (3):
   OMAP2PLUS: DSS2: Make members of dss_clk_source generic
   OMAP2PLUS: DSS2: Use dss features to get clock source names of
 current OMAP
   OMAP2PLUS: DSS2: DSI: Generalize DSI PLL Clock Naming

This patch set, and also the two individual patches for using
dss_features, look ok. However, they don't apply to DSS tree. Can you
rebase these on top of DSS master branch, please?

 Tomi


--
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 1/2] ARM: l2x0: Errata fix for flush by Way operationcan cause data corruption

2011-02-28 Thread Santosh Shilimkar
 -Original Message-
 From: Russell King - ARM Linux [mailto:li...@arm.linux.org.uk]
 Sent: Monday, February 28, 2011 3:44 PM
 To: Santosh Shilimkar
 Cc: t...@atomide.com; catalin.mari...@arm.com; linux-
 o...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
 Subject: Re: [PATCH 1/2] ARM: l2x0: Errata fix for flush by Way
 operationcan cause data corruption

 On Sun, Feb 27, 2011 at 12:00:21PM +, Russell King - ARM Linux
 wrote:
   +#else
   +/* Optimised out for non-errata case */
   +static inline void debug_writel(unsigned long val)
   +{
}
 
  #define l2x0_set_debug  NULL
 
   +#endif

 I notice you got rid of the inline function.  Have you tried
 building this without the errata enabled?

I accidently dropped the inline function while
incorporating the comment from you. :(

Fixed it. Updated version # 6770/1

Regards,
Santosh
--
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 1/3] OMAP: DSS2: Functions to request/release DSI VCs

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 02:47 -0600, Taneja, Archit wrote:
 Introduce functions which request and release VC's. This will be used in panel
 drivers in their probes.
 
 omap_dsi_request_vc() takes in the pointer to the omap_dss_device, the VC_ID
 parameter which goes into the header of the DSI packets, and returns a Virtual
 channel number (or virtual channel register set) which it can use.
 
 omap_dsi_releae_vc() takes the omap_dss_device pointer and frees all VCs which
 were used by that device.
 
 Initialisation of VC parameters is done in dsi_init().
 
 Signed-off-by: Archit Taneja arc...@ti.com
 ---
  arch/arm/plat-omap/include/plat/display.h |3 ++
  drivers/video/omap2/dss/dsi.c |   55 
 ++---
  2 files changed, 53 insertions(+), 5 deletions(-)
 
 diff --git a/arch/arm/plat-omap/include/plat/display.h 
 b/arch/arm/plat-omap/include/plat/display.h
 index d45f107..0057259 100644
 --- a/arch/arm/plat-omap/include/plat/display.h
 +++ b/arch/arm/plat-omap/include/plat/display.h
 @@ -560,6 +560,9 @@ int omap_dsi_update(struct omap_dss_device *dssdev,
   int channel,
   u16 x, u16 y, u16 w, u16 h,
   void (*callback)(int, void *), void *data);
 +int omap_dsi_request_vc(struct omap_dss_device *dssdev, int vc_id,
 + int *channel);
 +void omap_dsi_release_vc(struct omap_dss_device *dssdev);

The release function is misnamed. It's actually release_all_vcs.
However, I think the request and release functions should match:
request/release one vc.

So perhaps something like:

void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);

dssdev is not really needed there, but can be used for checking validity
of the release call.

Also, about the returned channel value. It is something that the panel
driver should not use for anything else than to pass to DSI functions.
Perhaps this would be a good case for typedeffing (see CodingStyle,
chapter 5, part a). dsi_channel_t? Well, we can think about this later.

In the future we could possibly encode the DSI module number in the
channel also.

 
  int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
  void omapdss_dsi_display_disable(struct omap_dss_device *dssdev);
 diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
 index cda83b0..8118f62 100644
 --- a/drivers/video/omap2/dss/dsi.c
 +++ b/drivers/video/omap2/dss/dsi.c
 @@ -233,8 +233,11 @@ static struct
   enum dsi_vc_mode mode;
   struct omap_dss_device *dssdev;
   enum fifo_size fifo_size;
 + int vc_id;
   } vc[4];
  
 + int num_vc_used;
 +
   struct mutex lock;
   struct semaphore bus_lock;
  
 @@ -1778,8 +1781,6 @@ static void dsi_vc_initial_config(int channel)
   r = FLD_MOD(r, 4, 23, 21); /* DMA_TX_REQ_NB = no dma */
  
   dsi_write_reg(DSI_VC_CTRL(channel), r);
 -
 - dsi.vc[channel].mode = DSI_VC_MODE_L4;
  }
  
  static int dsi_vc_config_l4(int channel)
 @@ -1986,7 +1987,7 @@ static inline void dsi_vc_write_long_header(int 
 channel, u8 data_type,
  
   WARN_ON(!dsi_bus_is_locked());
  
 - data_id = data_type | channel  6;
 + data_id = data_type | dsi.vc[channel].vc_id  6;
  
   val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
   FLD_VAL(ecc, 31, 24);
 @@ -2089,7 +2090,7 @@ static int dsi_vc_send_short(int channel, u8 data_type, 
 u16 data, u8 ecc)
   return -EINVAL;
   }
  
 - data_id = data_type | channel  6;
 + data_id = data_type | dsi.vc[channel].vc_id  6;
  
   r = (data_id  0) | (data  8) | (ecc  24);
  
 @@ -3264,6 +3265,42 @@ int dsi_init_display(struct omap_dss_device *dssdev)
   return 0;
  }
  
 +int omap_dsi_request_vc(struct omap_dss_device *dssdev, int vc_id, int 
 *channel)
 +{
 + int p = dsi.num_vc_used;
 +
 + if (p = 4) {
 + DSSERR(cannot get VC for display %s, dssdev-name);
 + return -EINVAL;
 + }
 +
 + dsi.vc[p].dssdev = dssdev;
 + dsi.vc[p].vc_id = vc_id;
 + *channel = p;
 +
 + dsi.num_vc_used += 1;
 +
 + return 0;
 +}
 +EXPORT_SYMBOL(omap_dsi_request_vc);
 +
 +void omap_dsi_release_vc(struct omap_dss_device *dssdev)
 +{
 + int i, num_vc_used_disp = 0;
 +
 + for (i = 0; i  4; i++) {
 + if (dsi.vc[i].dssdev == dssdev) {
 + dsi.vc[i].dssdev = NULL;
 + dsi.vc[i].vc_id = 0;
 + dsi.vc[i].mode = DSI_VC_MODE_L4;
 + num_vc_used_disp++;
 + }
 + }
 +
 + dsi.num_vc_used -= num_vc_used_disp;
 +}
 +EXPORT_SYMBOL(omap_dsi_release_vc);

I don't think these work quite right. What happens if there are two
panel drivers, both have allocated one channel. Then the first channel
is released. At this point num_vc_used is 1. Next request would allocate
channel number 1, which is still in use.

I think the code will be cleaner and simpler if you removed num_vc_used,
and loop 

Re: [PATCH v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Cousson, Benoit

On 2/28/2011 1:10 PM, Valkeinen, Tomi wrote:

On Mon, 2011-02-28 at 05:36 -0600, Cousson, Benoit wrote:

Hi Tomi,

On 2/28/2011 8:19 AM, Valkeinen, Tomi wrote:

On Mon, 2011-02-28 at 01:09 -0600, Taneja, Archit wrote:

Hi,

On Monday 28 February 2011 12:23 PM, Valkeinen, Tomi wrote:

On Thu, 2011-02-24 at 03:27 -0600, Tomi Valkeinen wrote:

Hi,

On Mon, 2011-01-24 at 11:51 +0530, ext Sumit Semwal wrote:

From: Senthilvadivu Guruswamysvad...@ti.com

Change the driver name from omapdss to omap_display as the driver takes care of
the display devices ie number of panels, type of panels available in the
platform.  Change the device name in the board files and 2420,2430,3xxx clock
files from omapdss to omap_display to match the driver name.


I just realized that changing the driver name will break all scripts and
applications using omapdss sysfs files.

How does this sound:

Let's leave the omapdss device name as it is. It represents a super
device, containing the dss sysfs files and upper level dss management.


This is the case for all the drivers migrated to omap_device anyway due
to the change in the top level hierarchy. Everything is below
platform/omap now.


The HW module drivers are under platform/omap/, but omapdss is in
platform/. Do you mean that omapdss should also be under platform/omap/?


This is because you are probably not using omap_device yet. is should 
happen when you will change your platform_device to be omap_device.



The reason I'm unwilling to change omapdss name, or location, is that
omapdss directory contains lots of DSS configuration files, used by
scripts and programs.


Is that used for debug only?


That's why we are using that opportunity to clean and provide a
consistent naming for all devices.


Name the HW module platform drivers as: omapdss_dss, omapdss_venc,
omapdss_dispc, etc. This would indicate them to be clearly parts of DSS,
and would also prevent any possible name conflict if there would happen
to be a, say, dsi block in some other HW component.


Cannot you use a device hierarchy then to do that?
   omap_dss/core
   omap_dss/dsi
   omap_dss/venc

This is moreover the way the HW is done.


Hmm, how would that work? The devices are platform devices, and they
have a unique global name, which is used to match the driver for the
device.


Practically, I don't really know :-) Please see the reply to Russell.


Any comments on this?


I also think we need to stick to the older name, omapdss_dss sounds a
bit confusing, and I think one of the previous versions had something
like dss_dss in it and it wasn't approved. Does something like
omapdss_core or omapdss_dss_core make sense, or is it more misleading?


It is confusing, but so is the hardware naming =). There is a DSS module
inside the omap display subsystem. That's why I would like to name it
dss, not core, so it's clear it refers to this DSS module.

dss_dss looks a bit silly, but I think omapdss_dss is slightly
better in the sense that it doesn't repeat the same dss, and there is
an omapdss device, which acts like manager for these module devices.
But yes, I wouldn't call it perfect either.

omapdss_dss_core is one option. But then again, TRM doesn't speak of
core.


We should not maintain silly names just because they are in the TRM, we
should just fix the TRM. This is exactly what we are going to do for
most HW names we introduced in OMAP4.

So if we all agree that this name will avoid confusion and is much
better than the current one, we can change it right now with a comment
to explain the change and give the pointer to the current TRM naming.


True. But I don't think there's a huge difference with omapdss_dss or
omapdss_core.


You're right, at the end it is just a name. We are just trying to clean 
a little bit the current devices name mess. So the convention we are 
trying to enforce is to name omap devices omap_XXX.



The name is used in only a few places inside the kernel, and never from
userspace, so we can change that also later.

The main issue I had was changing the omapdss device name, which would
break the userspace.


That's why we'd better break it properly today once and for all :-)
At least when you will migrate to omap_device.

Benoit

--
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 v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Russell King - ARM Linux
On Mon, Feb 28, 2011 at 02:38:32PM +0100, Cousson, Benoit wrote:
 On 2/28/2011 1:13 PM, Russell King - ARM Linux wrote:
 On Mon, Feb 28, 2011 at 02:10:26PM +0200, Tomi Valkeinen wrote:
 On Mon, 2011-02-28 at 05:36 -0600, Cousson, Benoit wrote:
 Cannot you use a device hierarchy then to do that?
omap_dss/core
omap_dss/dsi
omap_dss/venc

 This is moreover the way the HW is done.

 Hmm, how would that work? The devices are platform devices, and they
 have a unique global name, which is used to match the driver for the
 device.

 And not forgetting that '/' is not permitted in device or driver names.

 I was not really considering naming the device with a '/'. The idea is  
 that the devices will not longer be flat platform devices but something  
 like dss devices that will have have a omap_dss parent.

 I do not know if that makes sense to store some kind of hierarchy in the  
 device model, but encoding the hierarchy in the name like it is proposed  
 looks like a hack to me.

Try:

tree -d /sys/devices/pci\:00

on your PC, taking special note of how pci-to-pci bridges are handled.
--
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] cbus-retu: Acquire mutex on write operation

2011-02-28 Thread Michael Büsch
On Mon, 2011-02-28 at 10:33 +0200, Felipe Balbi wrote: 
 On Sun, Feb 27, 2011 at 12:34:33AM +0100, Michael Buesch wrote:
  The mutex has to be acquired on register write to avoid interference
  with a simultaneous retu_set_clear_reg_bits operation.
  
  Signed-off-by: Michael Buesch m...@bu3sch.de
 
 good catch, please do the same for retu_read_reg()

I don't think this is necessary, because cbus_read_reg() and
cbus_write_reg() are atomic due to the cbus host-lock.
I think we can depend on this.
We could probably improve the comment on the lock in
cbus_transfer(), though.

-- 
Greetings Michael.

--
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 1/3] OMAP: DSS2: Functions to request/release DSI VCs

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 02:47 -0600, Taneja, Archit wrote:
 Introduce functions which request and release VC's. This will be used in panel
 drivers in their probes.
 
 omap_dsi_request_vc() takes in the pointer to the omap_dss_device, the VC_ID
 parameter which goes into the header of the DSI packets, and returns a Virtual
 channel number (or virtual channel register set) which it can use.
 
 omap_dsi_releae_vc() takes the omap_dss_device pointer and frees all VCs which
 were used by that device.
 
 Initialisation of VC parameters is done in dsi_init().
 
 Signed-off-by: Archit Taneja arc...@ti.com
 ---
  arch/arm/plat-omap/include/plat/display.h |3 ++
  drivers/video/omap2/dss/dsi.c |   55 
 ++---
  2 files changed, 53 insertions(+), 5 deletions(-)
 
 diff --git a/arch/arm/plat-omap/include/plat/display.h 
 b/arch/arm/plat-omap/include/plat/display.h
 index d45f107..0057259 100644
 --- a/arch/arm/plat-omap/include/plat/display.h
 +++ b/arch/arm/plat-omap/include/plat/display.h
 @@ -560,6 +560,9 @@ int omap_dsi_update(struct omap_dss_device *dssdev,
   int channel,
   u16 x, u16 y, u16 w, u16 h,
   void (*callback)(int, void *), void *data);
 +int omap_dsi_request_vc(struct omap_dss_device *dssdev, int vc_id,
 + int *channel);

One more thing: 

In theory the vc_id could be given per transmission, when calling
dsi_vc_send_xxx() functions, like it is currently.

But as the vc_id changes (probably) very rarely, it could be stored like
you do. But we should still have a separate function to set the vc_id,
without having to release and request the vc.

 Tomi


--
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/7] OMAP2+: UART: Remove certain uart calls from sram_idle

2011-02-28 Thread Govindraj.R
In preparation to UART runtime conversion. Remove certain uart specific calls
from sram_idle path in pm24xx/34xx files.
These func calls will no more be used with upcoming uart runtime design.

1.) Removing console lock holding :- Now can be handled with omap-serial file
itself with appropraite console_enable/disable calls for clk_enable/disable
cases.
2.) omap_uart_can_sleep :- not needed driver can decide based on inactivity.
3.) omap_uart_prepare_suspend :- omap-serial can take care with driver
suspend/resume hooks.

Signed-off-by: Govindraj.R govindraj.r...@ti.com
---
 arch/arm/mach-omap2/pm24xx.c |   11 ---
 arch/arm/mach-omap2/pm34xx.c |   16 
 arch/arm/plat-omap/include/plat/serial.h |4 
 3 files changed, 0 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 97feb3a..5af9881 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -132,11 +132,6 @@ static void omap2_enter_full_retention(void)
if (omap_irq_pending())
goto no_sleep;
 
-   /* Block console output in case it is on one of the OMAP UARTs */
-   if (!is_suspending())
-   if (!console_trylock())
-   goto no_sleep;
-
omap_uart_prepare_idle(0);
omap_uart_prepare_idle(1);
omap_uart_prepare_idle(2);
@@ -150,9 +145,6 @@ static void omap2_enter_full_retention(void)
omap_uart_resume_idle(1);
omap_uart_resume_idle(0);
 
-   if (!is_suspending())
-   console_unlock();
-
 no_sleep:
if (omap2_pm_debug) {
unsigned long long tmp;
@@ -267,8 +259,6 @@ static int omap2_can_sleep(void)
 {
if (omap2_fclks_active())
return 0;
-   if (!omap_uart_can_sleep())
-   return 0;
if (osc_ck-usecount  1)
return 0;
if (omap_dma_running())
@@ -319,7 +309,6 @@ static int omap2_pm_suspend(void)
mir1 = omap_readl(0x480fe0a4);
omap_writel(1  5, 0x480fe0ac);
 
-   omap_uart_prepare_suspend();
omap2_enter_full_retention();
 
omap_writel(mir1, 0x480fe0a4);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 2f864e4..850bb0a 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -395,13 +395,6 @@ void omap_sram_idle(void)
omap3_enable_io_chain();
}
 
-   /* Block console output in case it is on one of the OMAP UARTs */
-   if (!is_suspending())
-   if (per_next_state  PWRDM_POWER_ON ||
-   core_next_state  PWRDM_POWER_ON)
-   if (!console_trylock())
-   goto console_still_active;
-
/* PER */
if (per_next_state  PWRDM_POWER_ON) {
per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
@@ -481,10 +474,6 @@ void omap_sram_idle(void)
omap_uart_resume_idle(3);
}
 
-   if (!is_suspending())
-   console_unlock();
-
-console_still_active:
/* Disable IO-PAD and IO-CHAIN wakeup */
if (omap3_has_io_wakeup() 
(per_next_state  PWRDM_POWER_ON ||
@@ -503,8 +492,6 @@ int omap3_can_sleep(void)
 {
if (!sleep_while_idle)
return 0;
-   if (!omap_uart_can_sleep())
-   return 0;
return 1;
 }
 
@@ -547,7 +534,6 @@ static int omap3_pm_suspend(void)
goto restore;
}
 
-   omap_uart_prepare_suspend();
omap3_intc_suspend();
 
omap_sram_idle();
@@ -594,14 +580,12 @@ static int omap3_pm_begin(suspend_state_t state)
 {
disable_hlt();
suspend_state = state;
-   omap_uart_enable_irqs(0);
return 0;
 }
 
 static void omap3_pm_end(void)
 {
suspend_state = PM_SUSPEND_ON;
-   omap_uart_enable_irqs(1);
enable_hlt();
return;
 }
diff --git a/arch/arm/plat-omap/include/plat/serial.h 
b/arch/arm/plat-omap/include/plat/serial.h
index 8061695..6339848 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -106,12 +106,8 @@ struct omap_board_data;
 
 extern void omap_serial_init(void);
 extern void omap_serial_init_port(struct omap_board_data *bdata);
-extern int omap_uart_can_sleep(void);
-extern void omap_uart_check_wakeup(void);
-extern void omap_uart_prepare_suspend(void);
 extern void omap_uart_prepare_idle(int num);
 extern void omap_uart_resume_idle(int num);
-extern void omap_uart_enable_irqs(int enable);
 #endif
 
 #endif
-- 
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 0/7] OMAP2+: UART: runtime conversion + cleanup.

2011-02-28 Thread Govindraj.R
Converting uart driver to adapt to pm runtime api's.
Changes involves:

1.) Cleaning up certain uart calls from sram_idle func but still 
retaining the prepare_idle/resume_idle func calls because as
of today uart module level wakeup doesn't seem to work. 
We have informed the hardware folks about this and discussion
is in progress. So until we have a workaround for this we have to
depend on prepare/resume calls to cut uart clock and wakeup based
on io-daisy chain mechanism using uart_rx padconf.
2.) Removed all types of uart clock handling code from serial.c
file and now onwards serial.c file is used only for device registration 
and to probe early uart and pass some uart board data which
can be passed as pdata to driver. Also cleaned up direct padconf usage.
3.) Using hwmod_mux api enable wakeup capability for uart pad during
hwmod_idle state i.e., when uart clocks are disabled we can enable
io-pad wakeup capability for uart if mux_data is available for 
given uart. Also during during resume from idle call to uart we need
to enable clocks back conditionally and this can be done only when io-pad
wakeup event bit is set for uart_rx pad. So we need a hwmod api
which can probe the uart pad and let us know whether a uart wakeup
happened. So omap_hmwod_pad_wakeup_status api is added to meet this 
requirement.
3.) Adapted omap-serial driver to use runtime api's.
4.) Modify serial_init calls to accept certain dma based uart parameters
5.) Minor cleanups and rename uart_rx_dma api.

Patch series is based on LO Kernel omap_for_linus branch.
Commit-id: 7cab8713b1ed0dab08ad6458f92a40b7ff4be619
Dependency patches needed to test system wide suspend on omap_for_linus branch.
https://patchwork.kernel.org/patch/550551/
https://patchwork.kernel.org/patch/513481/
https://patchwork.kernel.org/patch/501211/

Testing updates:

3430SDP, ZOOM2: retention, off_mode, system_wide suspend is tested.
OMAP3630 - Zoom3: pm-retention checked, off mode for per domain checked.
[uart3/uart4 in per domain on omap3630].
OMAP4430[Blaze]: Boot tested.
OMAP2420/2430SDP: Boot tested

Govindraj.R (5):
  OMAP2+ : hwmod_data: update uart hwmod data.
  OMAP2+: mux: Enable wakeup for wakeup enable requested pads.
  OMAP2+: UART: Remove certain uart calls from sram_idle.
  OMAP2+: UART: Remove uart clock handling code serial.c
  Serial: OMAP: add runtime pm support for omap-serial driver

Jon Hunter (2):
  OMAP: Serial: Allow UART parameters to be configured from board file
  Serial: OMAP2+: Make the RX_TIMEOUT for DMA configurable for each
UART

 arch/arm/mach-omap2/board-2430sdp.c   |3 +-
 arch/arm/mach-omap2/board-3430sdp.c   |4 +-
 arch/arm/mach-omap2/board-4430sdp.c   |3 +-
 arch/arm/mach-omap2/board-am3517evm.c |3 +-
 arch/arm/mach-omap2/board-apollon.c   |3 +-
 arch/arm/mach-omap2/board-cm-t35.c|3 +-
 arch/arm/mach-omap2/board-cm-t3517.c  |3 +-
 arch/arm/mach-omap2/board-devkit8000.c|3 +-
 arch/arm/mach-omap2/board-generic.c   |3 +-
 arch/arm/mach-omap2/board-h4.c|3 +-
 arch/arm/mach-omap2/board-igep0020.c  |3 +-
 arch/arm/mach-omap2/board-igep0030.c  |3 +-
 arch/arm/mach-omap2/board-ldp.c   |3 +-
 arch/arm/mach-omap2/board-n8x0.c  |9 +-
 arch/arm/mach-omap2/board-omap3beagle.c   |3 +-
 arch/arm/mach-omap2/board-omap3evm.c  |3 +-
 arch/arm/mach-omap2/board-omap3logic.c|3 +-
 arch/arm/mach-omap2/board-omap3pandora.c  |3 +-
 arch/arm/mach-omap2/board-omap3stalker.c  |3 +-
 arch/arm/mach-omap2/board-omap3touchbook.c|3 +-
 arch/arm/mach-omap2/board-omap4panda.c|3 +-
 arch/arm/mach-omap2/board-overo.c |3 +-
 arch/arm/mach-omap2/board-rm680.c |3 +-
 arch/arm/mach-omap2/board-rx51.c  |3 +-
 arch/arm/mach-omap2/board-ti8168evm.c |2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c  |3 +-
 arch/arm/mach-omap2/mux.c |   23 +
 arch/arm/mach-omap2/mux.h |   13 +
 arch/arm/mach-omap2/omap_hwmod.c  |   13 +
 arch/arm/mach-omap2/omap_hwmod_2420_data.c|3 +
 arch/arm/mach-omap2/omap_hwmod_2430_data.c|3 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c|4 +
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c|4 +
 arch/arm/mach-omap2/pm24xx.c  |   11 -
 arch/arm/mach-omap2/pm34xx.c  |   16 -
 arch/arm/mach-omap2/serial.c  |  845 +
 arch/arm/plat-omap/include/plat/omap-serial.h |   37 +-
 arch/arm/plat-omap/include/plat/omap_hwmod.h  |1 +
 arch/arm/plat-omap/include/plat/serial.h  |   10 +-
 drivers/tty/serial/omap-serial.c  |  323 +-
 40 files changed, 601 insertions(+), 

[PATCH 2/7] OMAP2+: mux: Enable wakeup for wakeup enable requested pads

2011-02-28 Thread Govindraj.R
For device pads which have OMAP_DEVICE_PAD_WAKEUP set (which means they
are wakeup capable) enable the IO-daisy wakeup capability.
During re-muxing avoid direct write with val as this can disturb if any
mux done at bootloader level so read the pad then write back.

Also add a api to fetch the wake-up status bit is set for given omap-hwmod
device using available mux info which is added during omap_hwmod_mux_init.
Wakeup status bit is needed for uart_resume_idle call from sram_idle path
based on wake-up event has occurred for given uart we can enable clocks back.

Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Govindraj.R govindraj.r...@ti.com
---
 arch/arm/mach-omap2/mux.c|   23 +++
 arch/arm/mach-omap2/mux.h|   13 +
 arch/arm/mach-omap2/omap_hwmod.c |   13 +
 arch/arm/plat-omap/include/plat/omap_hwmod.h |1 +
 4 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 98148b6..5338b93 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -317,6 +317,24 @@ err1:
return NULL;
 }
 
+/* Gets the wakeup status of given pad from omap-hwmod */
+int omap_hwmod_mux_wakeup(struct omap_hwmod_mux_info *hmux)
+{
+   int i;
+   unsigned int val = -EINVAL;
+
+   for (i = 0; i  hmux-nr_pads; i++) {
+   struct omap_device_pad *pad = hmux-pads[i];
+
+   val = omap_mux_read(pad-partition, pad-mux-reg_offset);
+   }
+
+   if (val  0  val  OMAP_WAKEUP_EVENT)
+   return 1;
+   else
+   return 0;
+}
+
 /* Assumes the calling function takes care of locking */
 void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
 {
@@ -342,6 +360,9 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 
state)
break;
flags = ~OMAP_DEVICE_PAD_ENABLED;
val = pad-idle;
+   if (flags  OMAP_DEVICE_PAD_WAKEUP)
+   val |= OMAP_WAKEUP_EN;
+
pr_debug(%s: Idling %s %x\n, __func__,
pad-name, val);
break;
@@ -358,6 +379,8 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 
state)
};
 
if (val = 0) {
+   val |= omap_mux_read(pad-partition,
+   pad-mux-reg_offset);
omap_mux_write(pad-partition, val,
pad-mux-reg_offset);
pad-flags = flags;
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index a4ab17a..84a8fc2 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -220,8 +220,21 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int 
nr_pads);
  */
 void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state);
 
+
+/**
+ * omap_hwmod_mux_wakeup - omap hwmod check given pad had wakeup event
+ * @hmux:  Pads for a hwmod
+ *
+ * Called only from omap_hwmod.c, do not use.
+ */
+int omap_hwmod_mux_wakeup(struct omap_hwmod_mux_info *hmux);
 #else
 
+static inline int omap_hwmod_mux_wakeup(struct omap_hwmod_mux_info *hmux)
+{
+   return 0;
+}
+
 static inline int omap_mux_init_gpio(int gpio, int val)
 {
return 0;
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 9e89a58..893dae1 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2239,3 +2239,16 @@ u32 omap_hwmod_get_context_loss_count(struct omap_hwmod 
*oh)
 
return ret;
 }
+
+/**
+ * omap_hwmod_pad_wakeup_status - get pad wakeup status if mux is available.
+ * @oh: struct omap_hwmod *
+ *
+ * Returns the wake_up status bit of available pad mux pin.
+ */
+int omap_hmwod_pad_wakeup_status(struct omap_hwmod *oh)
+{
+   if (oh-mux)
+   return omap_hwmod_mux_wakeup(oh-mux);
+   return -EINVAL;
+}
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h 
b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index fedd829..4100be0 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -588,6 +588,7 @@ int omap_hwmod_for_each_by_class(const char *classname,
 int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state);
 u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh);
 
+int omap_hmwod_pad_wakeup_status(struct omap_hwmod *oh);
 /*
  * Chip variant-specific hwmod init routines - XXX should be converted
  * to use initcalls once the initial boot ordering is straightened out
-- 
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 5/7] Serial: OMAP: add runtime pm support for omap-serial driver

2011-02-28 Thread Govindraj.R
Adapts omap-serial driver to use pm_runtime api's.

1.) Populate reg values to uart port which can be used for context restore.
2.) Moved Erratum handling func to driver from serial.c
3.) adding port_enable/disable func to enable/disable given uart port.
4.) using prepare/resume api's to cut and enable back uart func_clks.
5.) using timer to set flag to cut uart clocks based on this flag in
sram_idle path.

Signed-off-by: Govindraj.R govindraj.r...@ti.com
---
 drivers/tty/serial/omap-serial.c |  304 +++---
 1 files changed, 283 insertions(+), 21 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d40924a..bc877b9 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -33,10 +33,21 @@
 #include linux/clk.h
 #include linux/serial_core.h
 #include linux/irq.h
+#include linux/pm_runtime.h
 
 #include plat/dma.h
 #include plat/dmtimer.h
 #include plat/omap-serial.h
+#include plat/serial.h
+#include plat/omap_device.h
+
+#ifdef CONFIG_SERIAL_OMAP_CONSOLE
+#define omap_uart_console(port) ((port)-cons  (port)-cons-index == 
(port)-line)
+#else
+#define omap_uart_console(port)NULL
+#endif
+
+#define OMAP_UART_CLK_PUT_DELAY (5 * HZ)
 
 static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
 
@@ -44,6 +55,7 @@ static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
 static void uart_tx_dma_callback(int lch, u16 ch_status, void *data);
 static void serial_omap_rx_timeout(unsigned long uart_no);
 static int serial_omap_start_rxdma(struct uart_omap_port *up);
+static void omap_uart_mdr1_errataset(struct uart_omap_port *up);
 
 static inline unsigned int serial_in(struct uart_omap_port *up, int offset)
 {
@@ -90,6 +102,73 @@ serial_omap_get_divisor(struct uart_port *port, unsigned 
int baud)
return port-uartclk/(baud * divisor);
 }
 
+static void omap_uart_smart_idle(struct uart_omap_port *up)
+{
+   struct platform_device *pdev = up-pdev;
+   struct omap_device *od = container_of(pdev, struct omap_device, pdev);
+
+   omap_hwmod_set_slave_idlemode(od-hwmods[0], HWMOD_IDLEMODE_SMART);
+}
+
+static void serial_omap_port_disable(struct uart_omap_port *up)
+{
+   if (!pm_runtime_suspended(up-pdev-dev)) {
+   del_timer(up-inactivity_timer);
+   if (omap_uart_console(up-port))
+   console_stop(up-port.cons);
+
+   pm_runtime_put_sync(up-pdev-dev);
+   }
+}
+
+static void serial_omap_inactivity_timer(unsigned long uart_no)
+{
+   struct uart_omap_port *up = ui[uart_no];
+
+   up-can_sleep = 1;
+   omap_uart_smart_idle(up);
+}
+
+static void serial_omap_port_enable(struct uart_omap_port *up)
+{
+   if (pm_runtime_suspended(up-pdev-dev)) {
+   if (omap_uart_console(up-port))
+   console_start(up-port.cons);
+
+   pm_runtime_get_sync(up-pdev-dev);
+   }
+
+   up-can_sleep = 0;
+   mod_timer(up-inactivity_timer, jiffies + OMAP_UART_CLK_PUT_DELAY);
+}
+
+void omap_uart_prepare_idle(int num)
+{
+   struct uart_omap_port *up = ui[num];
+
+   if (up  up-can_sleep)
+   serial_omap_port_disable(up);
+}
+
+void omap_uart_resume_idle(int num)
+{
+   struct uart_omap_port *up = ui[num];
+   struct omap_device *od;
+   struct platform_device *pdev;
+
+   if (!up)
+   return;
+
+   pdev = up-pdev;
+   od = container_of(pdev, struct omap_device, pdev);
+
+   if (omap_hmwod_pad_wakeup_status(od-hwmods[0]) == true)
+   serial_omap_port_enable(up);
+
+   if (up-wk_st  (__raw_readl(up-wk_st)  up-wk_mask))
+   serial_omap_port_enable(up);
+}
+
 static void serial_omap_stop_rxdma(struct uart_omap_port *up)
 {
if (up-uart_dma.rx_dma_used) {
@@ -105,6 +184,7 @@ static void serial_omap_enable_ms(struct uart_port *port)
 {
struct uart_omap_port *up = (struct uart_omap_port *)port;
 
+   serial_omap_port_enable(up);
dev_dbg(up-port.dev, serial_omap_enable_ms+%d\n, up-pdev-id);
up-ier |= UART_IER_MSI;
serial_out(up, UART_IER, up-ier);
@@ -114,6 +194,7 @@ static void serial_omap_stop_tx(struct uart_port *port)
 {
struct uart_omap_port *up = (struct uart_omap_port *)port;
 
+   serial_omap_port_enable(up);
if (up-use_dma 
up-uart_dma.tx_dma_channel != OMAP_UART_DMA_CH_FREE) {
/*
@@ -137,6 +218,7 @@ static void serial_omap_stop_rx(struct uart_port *port)
 {
struct uart_omap_port *up = (struct uart_omap_port *)port;
 
+   serial_omap_port_enable(up);
if (up-use_dma)
serial_omap_stop_rxdma(up);
up-ier = ~UART_IER_RLSI;
@@ -258,6 +340,7 @@ static void serial_omap_start_tx(struct uart_port *port)
unsigned int start;
int ret = 0;
 
+   serial_omap_port_enable(up);
if (!up-use_dma) {
serial_omap_enable_ier_thri(up);

[PATCH 7/7] Serial: OMAP2+: Make the RX_TIMEOUT for DMA configurable for each UART

2011-02-28 Thread Govindraj.R
From: Jon Hunter jon-hun...@ti.com

When using DMA there are two timeouts defined. The first timeout,
rx_timeout, is really a polling rate in which software polls the
DMA status to see if the DMA has finished. This is necessary for
the RX side because we do not know how much data we will receive.
The secound timeout, RX_TIMEOUT, is a timeout after which the
DMA will be stopped if no more data is received. To make this
clearer, rename rx_timeout as rx_poll_rate and rename the
function serial_omap_rx_timeout() to serial_omap_rxdma_poll().

The OMAP-Serial driver defines an RX_TIMEOUT of 3 seconds that is
used to indicate when the DMA for UART can be stopped if no more
data is received. The value is a global definition that is applied
to all instances of the UART.

Each UART may be used for a different purpose and so the timeout
required may differ. Make this value configurable for each UART so
that this value can be optimised for power savings.

Signed-off-by: Govindraj.R govindraj.r...@ti.com
Signed-off-by: Jon Hunter jon-hun...@ti.com
---
 arch/arm/mach-omap2/serial.c  |2 ++
 arch/arm/plat-omap/include/plat/omap-serial.h |6 --
 drivers/tty/serial/omap-serial.c  |   15 ---
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 530e9e3..ff52442 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -48,6 +48,7 @@ static struct omap_uart_port_info omap_serial_default_info[] 
= {
{
.dma_enabled= 0,
.dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
+   .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
.dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
.idle_timeout   = DEFAULT_IDLE_TIMEOUT,
},
@@ -268,6 +269,7 @@ void __init omap_serial_init_port(struct omap_board_data 
*bdata,
pdata-flags = UPF_BOOT_AUTOCONF;
pdata-dma_enabled = info-dma_enabled;
pdata-dma_rx_buf_size = info-dma_rx_buf_size;
+   pdata-dma_rx_poll_rate = info-dma_rx_poll_rate;
pdata-dma_rx_timeout = info-dma_rx_timeout;
pdata-idle_timeout = info-idle_timeout;
if (bdata-id == omap_uart_con_id)
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h 
b/arch/arm/plat-omap/include/plat/omap-serial.h
index 4f12d6c..e338f4e 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -51,8 +51,8 @@
 
 #define OMAP_UART_DMA_CH_FREE  -1
 
-#define RX_TIMEOUT (3 * HZ)/* RX DMA timeout (jiffies) */
-#define DEFAULT_RXDMA_TIMEOUT  1   /* RX DMA polling rate (us) */
+#define DEFAULT_RXDMA_TIMEOUT  (3 * HZ)/* RX DMA timeout (jiffies) */
+#define DEFAULT_RXDMA_POLLRATE 1   /* RX DMA polling rate (us) */
 #define DEFAULT_RXDMA_BUFSIZE  4096/* RX DMA buffer size */
 #define DEFAULT_IDLE_TIMEOUT   (5 * HZ)/* UART idle timeout (secs) */
 
@@ -70,6 +70,7 @@ struct omap_uart_port_info {
unsigned intconsole_uart;
unsigned intdma_rx_buf_size;/* DMA Rx Buffer Size */
unsigned intdma_rx_timeout; /* DMA RX timeout */
+   unsigned intdma_rx_poll_rate;   /* DMA RX timeout */
unsigned intidle_timeout;   /* OMAP UART idle timeout */
 
void __iomem *wk_st;
@@ -99,6 +100,7 @@ struct uart_omap_dma {
/* timer to poll activity on rx dma */
struct timer_list   rx_timer;
unsigned intrx_buf_size;
+   unsigned intrx_poll_rate;
unsigned intrx_timeout;
 };
 
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 008645c..5c3d2fc 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -51,7 +51,7 @@ static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
 
 /* Forward declaration of functions */
 static void uart_tx_dma_callback(int lch, u16 ch_status, void *data);
-static void serial_omap_rx_timeout(unsigned long uart_no);
+static void serial_omap_rxdma_poll(unsigned long uart_no);
 static int serial_omap_start_rxdma(struct uart_omap_port *up);
 static void omap_uart_mdr1_errataset(struct uart_omap_port *up);
 
@@ -589,7 +589,7 @@ static int serial_omap_startup(struct uart_port *port)
(dma_addr_t *)(up-uart_dma.tx_buf_dma_phys),
0);
init_timer((up-uart_dma.rx_timer));
-   up-uart_dma.rx_timer.function = serial_omap_rx_timeout;
+   up-uart_dma.rx_timer.function = serial_omap_rxdma_poll;
up-uart_dma.rx_timer.data = up-pdev-id;
/* Currently the buffer size is 4KB. Can increase it */
up-uart_dma.rx_buf = dma_alloc_coherent(NULL,
@@ -1191,7 +1191,7 @@ static int serial_omap_resume(struct device *dev)

[PATCH 4/7] OMAP2+: UART: Remove uart clock handling code serial.c

2011-02-28 Thread Govindraj.R
Cleanup serial.c file in preparation to addition of runtime api's in omap-serial
file. Cleanup serial.c file and remove all clock handling mechanism as
this will be taken care with pm runtime apis in omap-serial.c file itself.

1.) remove omap-device enable and disable. We can can use get_sync/put_sync 
api's
2.) remove context save/restore can be done with runtime_resume callback for
get_sync call. No need to save context as all reg details available in
uart_port structure can be used for restore, so add missing regs in
uart port struct.
3.) Add api to identify console uart.
4.) Erratum handling informed as flag to driver and func to handle erratum
can be moved to omap-serial driver itself.

Signed-off-by: Govindraj.R govindraj.r...@ti.com
---
 arch/arm/mach-omap2/serial.c  |  749 ++---
 arch/arm/plat-omap/include/plat/omap-serial.h |   21 +-
 2 files changed, 75 insertions(+), 695 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 47eef48..755f4aa 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -19,25 +19,18 @@
  */
 #include linux/kernel.h
 #include linux/init.h
-#include linux/serial_reg.h
 #include linux/clk.h
 #include linux/io.h
 #include linux/delay.h
 #include linux/platform_device.h
 #include linux/slab.h
-#include linux/serial_8250.h
 #include linux/pm_runtime.h
-#include linux/console.h
 
-#ifdef CONFIG_SERIAL_OMAP
 #include plat/omap-serial.h
-#endif
-
 #include plat/common.h
 #include plat/board.h
 #include plat/clock.h
 #include plat/dma.h
-#include plat/omap_hwmod.h
 #include plat/omap_device.h
 
 #include prm2xxx_3xxx.h
@@ -47,65 +40,9 @@
 #include control.h
 #include mux.h
 
-#define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV0x52
-#define UART_OMAP_WER  0x17/* Wake-up enable register */
-
-#define UART_ERRATA_FIFO_FULL_ABORT(0x1  0)
-#define UART_ERRATA_i202_MDR1_ACCESS   (0x1  1)
-
-/*
- * NOTE: By default the serial timeout is disabled as it causes lost characters
- * over the serial ports. This means that the UART clocks will stay on until
- * disabled via sysfs. This also causes that any deeper omap sleep states are
- * blocked. 
- */
-#define DEFAULT_TIMEOUT 0
-
-#define MAX_UART_HWMOD_NAME_LEN16
-
-struct omap_uart_state {
-   int num;
-   int can_sleep;
-   struct timer_list timer;
-   u32 timeout;
-
-   void __iomem *wk_st;
-   void __iomem *wk_en;
-   u32 wk_mask;
-   u32 padconf;
-   u32 dma_enabled;
-
-   struct clk *ick;
-   struct clk *fck;
-   int clocked;
-
-   int irq;
-   int regshift;
-   int irqflags;
-   void __iomem *membase;
-   resource_size_t mapbase;
-
-   struct list_head node;
-   struct omap_hwmod *oh;
-   struct platform_device *pdev;
-
-   u32 errata;
-#if defined(CONFIG_ARCH_OMAP3)  defined(CONFIG_PM)
-   int context_valid;
+#define MAX_UART_HWMOD_NAME_LEN16
 
-   /* Registers to be saved/restored for OFF-mode */
-   u16 dll;
-   u16 dlh;
-   u16 ier;
-   u16 sysc;
-   u16 scr;
-   u16 wer;
-   u16 mcr;
-#endif
-};
-
-static LIST_HEAD(uart_list);
-static u8 num_uarts;
+static int omap_uart_con_id __initdata = -1;
 
 static int uart_idle_hwmod(struct omap_device *od)
 {
@@ -129,396 +66,35 @@ static struct omap_device_pm_latency omap_uart_latency[] 
= {
},
 };
 
-static inline unsigned int __serial_read_reg(struct uart_port *up,
-int offset)
-{
-   offset = up-regshift;
-   return (unsigned int)__raw_readb(up-membase + offset);
-}
-
-static inline unsigned int serial_read_reg(struct omap_uart_state *uart,
-  int offset)
-{
-   offset = uart-regshift;
-   return (unsigned int)__raw_readb(uart-membase + offset);
-}
-
-static inline void __serial_write_reg(struct uart_port *up, int offset,
-   int value)
-{
-   offset = up-regshift;
-   __raw_writeb(value, up-membase + offset);
-}
-
-static inline void serial_write_reg(struct omap_uart_state *uart, int offset,
-   int value)
-{
-   offset = uart-regshift;
-   __raw_writeb(value, uart-membase + offset);
-}
-
-/*
- * Internal UARTs need to be initialized for the 8250 autoconfig to work
- * properly. Note that the TX watermark initialization may not be needed
- * once the 8250.c watermark handling code is merged.
- */
-
-static inline void __init omap_uart_reset(struct omap_uart_state *uart)
-{
-   serial_write_reg(uart, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE);
-   serial_write_reg(uart, UART_OMAP_SCR, 0x08);
-   serial_write_reg(uart, UART_OMAP_MDR1, UART_OMAP_MDR1_16X_MODE);
-}
-
-#if defined(CONFIG_PM)  defined(CONFIG_ARCH_OMAP3)
-
-/*
- * Work Around for Errata i202 (3430 - 1.12, 3630 - 1.6)
- * The access to uart register after MDR1 Access
- * 

[PATCH 6/7] OMAP: Serial: Allow UART parameters to be configured from board file

2011-02-28 Thread Govindraj.R
From: Jon Hunter jon-hun...@ti.com

The following UART parameters are defined within the UART driver:

1). Whether the UART uses DMA (dma_enabled), by default set to 0
2). The size of dma buffer (set to 4096 bytes)
3). The time after which the dma should stop if no more data is received.
4). The idle timeout (DEFAULT_TIMEOUT) that sets the can_sleep flag after
uart inactivity.
5). Add default serial pads to board data if no pad info is available from
board file to avoid breaking uart wakeup capability from rx pad.

Different UARTs may be used for different purpose such as the console,
for interfacing bluetooth chip, for interfacing to a modem chip, etc.
Therefore, it is necessary to be able to customize the above settings
for a given board on a per UART basis.

This change allows these parameters to be configured from the board file
and allows the parameters to be configured for each UART independently.

If a board does not define its own custom parameters for the UARTs, then
use the default parameters in the structure omap_serial_default_info.
The default parameters are defined to be the same as the current settings
in the UART driver to avoid breaking the UART for any board. By default,
make all boards use the default UART parameters.

Signed-off-by: Govindraj.R govindraj.r...@ti.com
Signed-off-by: Deepak K deepa...@ti.com
Signed-off-by: Jon Hunter jon-hun...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c   |3 +-
 arch/arm/mach-omap2/board-3430sdp.c   |4 +-
 arch/arm/mach-omap2/board-4430sdp.c   |3 +-
 arch/arm/mach-omap2/board-am3517evm.c |3 +-
 arch/arm/mach-omap2/board-apollon.c   |3 +-
 arch/arm/mach-omap2/board-cm-t35.c|3 +-
 arch/arm/mach-omap2/board-cm-t3517.c  |3 +-
 arch/arm/mach-omap2/board-devkit8000.c|3 +-
 arch/arm/mach-omap2/board-generic.c   |3 +-
 arch/arm/mach-omap2/board-h4.c|3 +-
 arch/arm/mach-omap2/board-igep0020.c  |3 +-
 arch/arm/mach-omap2/board-igep0030.c  |3 +-
 arch/arm/mach-omap2/board-ldp.c   |3 +-
 arch/arm/mach-omap2/board-n8x0.c  |9 +-
 arch/arm/mach-omap2/board-omap3beagle.c   |3 +-
 arch/arm/mach-omap2/board-omap3evm.c  |3 +-
 arch/arm/mach-omap2/board-omap3logic.c|3 +-
 arch/arm/mach-omap2/board-omap3pandora.c  |3 +-
 arch/arm/mach-omap2/board-omap3stalker.c  |3 +-
 arch/arm/mach-omap2/board-omap3touchbook.c|3 +-
 arch/arm/mach-omap2/board-omap4panda.c|3 +-
 arch/arm/mach-omap2/board-overo.c |3 +-
 arch/arm/mach-omap2/board-rm680.c |3 +-
 arch/arm/mach-omap2/board-rx51.c  |3 +-
 arch/arm/mach-omap2/board-ti8168evm.c |2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c  |3 +-
 arch/arm/mach-omap2/serial.c  |  108 +++-
 arch/arm/plat-omap/include/plat/omap-serial.h |   14 +++-
 arch/arm/plat-omap/include/plat/serial.h  |6 +-
 drivers/tty/serial/omap-serial.c  |   10 +-
 30 files changed, 177 insertions(+), 45 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index cc42d47..0cfa3c7 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -38,6 +38,7 @@
 #include plat/gpmc.h
 #include plat/usb.h
 #include plat/gpmc-smc91x.h
+#include plat/omap-serial.h
 
 #include mux.h
 #include hsmmc.h
@@ -249,7 +250,7 @@ static void __init omap_2430sdp_init(void)
omap2430_i2c_init();
 
platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
-   omap_serial_init();
+   omap_serial_init(NULL);
omap2_hsmmc_init(mmc);
omap2_usbfs_init(sdp2430_usb_config);
 
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 8950ecc..7d7df08 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -39,8 +39,8 @@
 #include plat/gpmc.h
 #include plat/display.h
 #include plat/panel-generic-dpi.h
-
 #include plat/gpmc-smc91x.h
+#include plat/omap-serial.h
 
 #include board-flash.h
 #include mux.h
@@ -798,7 +798,7 @@ static void __init omap_3430sdp_init(void)
spi_register_board_info(sdp3430_spi_board_info,
ARRAY_SIZE(sdp3430_spi_board_info));
ads7846_dev_init();
-   omap_serial_init();
+   omap_serial_init(NULL);
usb_musb_init(musb_board_data);
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1a943be..9687aec 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -36,6 +36,7 @@
 #include plat/usb.h
 #include plat/mmc.h
 #include plat/omap4-keypad.h
+#include plat/omap-serial.h
 
 

Re: [PATCH] cbus-retu: Fix nested IRQ handling

2011-02-28 Thread Michael Büsch
On Mon, 2011-02-28 at 10:36 +0200, Felipe Balbi wrote: 
 On Sun, Feb 27, 2011 at 06:17:01PM +0100, Michael Buesch wrote:
  handle_nested_irq() expects a global IRQ number, so
  the irq_base has to be added to the RETU irq number.
  
  Signed-off-by: Michael Buesch m...@bu3sch.de
 
 Good catch, while at that, could you also cook another patch to add
 locking on retu_irq_handler ? We are using the internal lockless
 version of the read/write functions, so we need to hold the mutex before
 reading/writing to avoid problems.

Ok, it probably is safe without locking (due to the reads being atomic),
but I agree that it's more robust to add some locking here. I'll send
a patch.

-- 
Greetings Michael.

--
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 0/5 v3] usb: musb: Power management support

2011-02-28 Thread Greg KH
On Mon, Feb 28, 2011 at 10:56:11AM +0200, Felipe Balbi wrote:
 Hi,
 
 On Mon, Feb 28, 2011 at 02:19:31PM +0530, Hema HK wrote:
  This patch series supports the retention and offmode support in the 
  idle path for musb driver using runtime pm APIs.
  
  This is restricted to support offmode and retention only when device not
  connected.When device/cable connected with gadget driver loaded, configured
  to no idle/standby which will not allow the core transition to retention
  or off.
  
  There is no context save/restore done by hardware for musb in OMAP3
  and OMAP4,driver has to take care of saving and restoring the context
  during offmode.
  
  Musb has a requirement of configuring sysconfig register to force
  idle/standby mode and set the ENABLE_FORCE bit in module STANDBY register
  for retention and offmode support.
  
  Runtime pm and hwmod frameworks will take care of configuring to force
  idle/standby when pm_runtime_put_sync is called and back to no
  idle/standby when pm_runeime_get_sync is called.
  
  Compile, boot tested and also tested the retention in the idle path on
  OMAP3630Zoom3. And tested the global suspend/resume with offmode enabled.
  Usb basic functionality tested on OMAP4430SDP.
  
  There is some problem with idle path offmode in mainline, I could not test
  with offmode. But I have tested this patch with resetting the controller
  in the idle path when wakeup from retention just to make sure that the
  context is lost, and restore path is working fine.
 
 Tony and Greg, how do we handle this one ? Who should take my pull request
 for this series ? I hope we still have a little time to get this into
 2.6.39, but if we don't I can hold on to them until 2.6.40.

Doesn't bother me which tree they go through, I can take them, or, if
it's easier due to omap merges, Tony can.

thanks,

greg k-h
--
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 1/1] twl4030_charger: Make the driver atomic notifier safe

2011-02-28 Thread Anton Vorontsov
On Mon, Feb 28, 2011 at 08:29:53AM +0200, Heikki Krogerus wrote:
 On Sat, Feb 26, 2011 at 07:53:03PM +0200, ext Grazvydas Ignotas wrote:
  On Fri, Feb 25, 2011 at 1:56 PM, Heikki Krogerus
  heikki.kroge...@nokia.com wrote:
   This queues work from the otg notification where the
   i2c operations can be safely made. Needed for atomic otg
   notifiers.
  
   Signed-off-by: Heikki Krogerus heikki.kroge...@nokia.com
   Cc: Grazvydas Ignotas nota...@gmail.com
   Cc: Anton Vorontsov cbouatmai...@gmail.com
  
  seems to work fine.
  Tested-by: Grazvydas Ignotas nota...@gmail.com
 
 Anton, can you take this?

Applied, thanks!

-- 
Anton Vorontsov
Email: cbouatmai...@gmail.com
--
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 resend] omap: Fix linker error in drivers/video/omap/lcd_2430sdp.c

2011-02-28 Thread Jarkko Nikula
On Thu, 24 Feb 2011 13:26:44 -0800
Tony Lindgren t...@atomide.com wrote:

 We should avoid selecting driver related things, otherwise we can never
 build a tiny kernel with initramfs with everything as modules.
 
 Can you see if adding depends to the LCD panel option does the trick
 instead?
 
True and as lcd_2430sdp.c is not compiled without CONFIG_FB_OMAP a hack
below should work a bit better.

What would you think Tomi?

diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig
index 083c8fe..c981249 100644
--- a/drivers/video/omap/Kconfig
+++ b/drivers/video/omap/Kconfig
@@ -5,6 +5,7 @@ config FB_OMAP
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
+   select TWL4030_CORE if MACH_OMAP_2430SDP
help
   Frame buffer driver for OMAP based boards.

-- 
Jarkko
--
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 v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Cousson, Benoit
On 2/28/2011 3:06 PM, Russell King - ARM Linux wrote:
 On Mon, Feb 28, 2011 at 02:38:32PM +0100, Cousson, Benoit wrote:
 On 2/28/2011 1:13 PM, Russell King - ARM Linux wrote:
 On Mon, Feb 28, 2011 at 02:10:26PM +0200, Tomi Valkeinen wrote:
 On Mon, 2011-02-28 at 05:36 -0600, Cousson, Benoit wrote:
 Cannot you use a device hierarchy then to do that?
 omap_dss/core
 omap_dss/dsi
 omap_dss/venc

 This is moreover the way the HW is done.

 Hmm, how would that work? The devices are platform devices, and they
 have a unique global name, which is used to match the driver for the
 device.

 And not forgetting that '/' is not permitted in device or driver names.

 I was not really considering naming the device with a '/'. The idea is
 that the devices will not longer be flat platform devices but something
 like dss devices that will have have a omap_dss parent.

 I do not know if that makes sense to store some kind of hierarchy in the
 device model, but encoding the hierarchy in the name like it is proposed
 looks like a hack to me.
 
 Try:
 
 tree -d /sys/devices/pci\:00
 
 on your PC, taking special note of how pci-to-pci bridges are handled.

Here it is, but I'm not sure to understand how it is really done :-(

/sys/devices/pci:00
├── :00:00.0
│   ├── firmware_node - ../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/PNP0C02:00
│   ├── power
│   └── subsystem - ../../../bus/pci
├── :00:02.0
│   ├── :00:02.0:pcie01
│   │   ├── power
│   │   └── subsystem - ../../../../bus/pci_express
│   ├── :00:02.0:pcie02
│   │   ├── driver - ../../../../bus/pci_express/drivers/aer
│   │   ├── power
│   │   └── subsystem - ../../../../bus/pci_express
│   ├── :06:00.0
│   │   ├── :06:00.0:pcie12
│   │   │   ├── power
│   │   │   └── subsystem - ../../../../../bus/pci_express
│   │   ├── :07:00.0
│   │   │   ├── :07:00.0:pcie22
│   │   │   │   ├── power
│   │   │   │   └── subsystem - ../../../../../../bus/pci_express
│   │   │   ├── :08:00.0
│   │   │   │   ├── :09:00.0
│   │   │   │   │   ├── driver - ../../../../../../../bus/pci/drivers/bnx2
│   │   │   │   │   ├── net
│   │   │   │   │   │   └── eth1
│   │   │   │   │   │   ├── device - ../../../:09:00.0
│   │   │   │   │   │   ├── power
│   │   │   │   │   │   ├── statistics
│   │   │   │   │   │   └── subsystem - 
../../../../../../../../../class/net
│   │   │   │   │   ├── power
│   │   │   │   │   └── subsystem - ../../../../../../../bus/pci
│   │   │   │   ├── pci_bus
│   │   │   │   │   └── :09
│   │   │   │   │   ├── device - ../../../:08:00.0
│   │   │   │   │   ├── power
│   │   │   │   │   └── subsystem - ../../../../../../../../class/pci_bus
│   │   │   │   ├── power
│   │   │   │   └── subsystem - ../../../../../../bus/pci
│   │   │   ├── driver - ../../../../../bus/pci/drivers/pcieport
│   │   │   ├── pci_bus
│   │   │   │   └── :08
│   │   │   │   ├── device - ../../../:07:00.0
│   │   │   │   ├── power
│   │   │   │   └── subsystem - ../../../../../../../class/pci_bus
│   │   │   ├── power
│   │   │   └── subsystem - ../../../../../bus/pci
...

--
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 v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 08:00 -0600, Cousson, Benoit wrote:
 On 2/28/2011 1:10 PM, Valkeinen, Tomi wrote:
  On Mon, 2011-02-28 at 05:36 -0600, Cousson, Benoit wrote:
  Hi Tomi,
 
  On 2/28/2011 8:19 AM, Valkeinen, Tomi wrote:
  On Mon, 2011-02-28 at 01:09 -0600, Taneja, Archit wrote:
  Hi,
 
  On Monday 28 February 2011 12:23 PM, Valkeinen, Tomi wrote:
  On Thu, 2011-02-24 at 03:27 -0600, Tomi Valkeinen wrote:
  Hi,
 
  On Mon, 2011-01-24 at 11:51 +0530, ext Sumit Semwal wrote:
  From: Senthilvadivu Guruswamysvad...@ti.com
 
  Change the driver name from omapdss to omap_display as the driver 
  takes care of
  the display devices ie number of panels, type of panels available in 
  the
  platform.  Change the device name in the board files and 
  2420,2430,3xxx clock
  files from omapdss to omap_display to match the driver name.
 
  I just realized that changing the driver name will break all scripts 
  and
  applications using omapdss sysfs files.
 
  How does this sound:
 
  Let's leave the omapdss device name as it is. It represents a super
  device, containing the dss sysfs files and upper level dss management.
 
  This is the case for all the drivers migrated to omap_device anyway due
  to the change in the top level hierarchy. Everything is below
  platform/omap now.
 
  The HW module drivers are under platform/omap/, but omapdss is in
  platform/. Do you mean that omapdss should also be under platform/omap/?
 
 This is because you are probably not using omap_device yet. is should 
 happen when you will change your platform_device to be omap_device.

Hmm. The HW module devices use omap_device. But we have also a
management device, omapdss, which is doesn't match directly to any HW
component but manages the HW module drivers. It contains, so to say, the
HW module drivers.

Should this device also be a omap_device? What does omap_device actually
represent? My understanding is that omap_device is a linux device for a
HW block inside OMAP. omapdss doesn't quite match that definition.

  The reason I'm unwilling to change omapdss name, or location, is that
  omapdss directory contains lots of DSS configuration files, used by
  scripts and programs.
 
 Is that used for debug only?

Unfortunately no. DSS contains many features which cannot be exported to
userspace via the framebuffer device. While I'm not really happy with
the current omapdss sysfs interface, it's the best we've come up with.

 Tomi


--
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 2/2 v4] mfd: twl4030: Driver for twl4030 madc module

2011-02-28 Thread Krishnamoorthy, Balaji T
On Mon, Feb 28, 2011 at 3:18 PM, Keerthy j-keer...@ti.com wrote:
 +static int twl4030_madc_read_channels(struct twl4030_madc_data *madc,
 +                                     u8 reg_base, unsigned
 +                                               long channels, int *buf)
 +{
 +       int count = 0, count_req = 0, i;
 +       u8 reg;
 +
 +       for_each_set_bit(i, channels, TWL4030_MADC_MAX_CHANNELS) {
 +               reg = reg_base + 2 * i;
 +               buf[i] = twl4030_madc_channel_raw_read(madc, reg);
 +               if (buf[i]  0) {
 +                       dev_err(madc-dev,
 +                       Unable to read register 0x%X\n, reg);
 +                       count_req++;
 +                       continue;
 +               }
 +               switch (i) {
 +               case 10:
 +                       buf[i] =
 +                               twl4030battery_current(buf[i]);

Possibly fix these breaks in statements where applicable.

 +                       if (buf[i]  0) {
 +                               dev_err(madc-dev,
 +                               error reading current);
 +                               count_req++;
 +                       } else {
 +                               count++;
 +                               buf[i] = buf[i] - 750;
 +                       }
 +                       break;
 +               case 1:
 +                       buf[i] =
 +                       twl4030battery_temperature(buf[i]);
 +                       if (buf[i]  0) {
 +                               dev_err(madc-dev,
 +                               error reading temperature);
 +                               count_req++;
 +                       } else {
 +                               count++;
 +                       }
 +                       break;
 +               default:
 +                       count++;
 +                       /* Analog Input (V) = conv_result *
 +                        *                      step_size / R
 +                        * conv_result = decimal value
 +                        *               of 10-bit conversion
 +                        *               result
 +                        * step size = 1.5 / (2 ^ 10 -1)
 +                        * R = Prescaler ratio for input
 +                        *      channels
 +                        * Result given in mV hence multiplied
 +                        *      by 1000
 +                        */
 +                       buf[i] = (buf[i] * 3 * 1000 *
 +                       twl4030_divider_ratios[i].denominator)
 +                               / (2 * 1023 *
 +               twl4030_divider_ratios[i].numerator);
 +               }
 +       }
 +       if (count_req)
 +               dev_dbg(madc-dev, %d channel conversion failed\n, 
 count_req);
 +
 +       return count;
 +}
 +


[Patch v2 0/2] OMAP2PLUS:DSS2: use opt-clocks information from hwmod.

2011-02-28 Thread Sumit Semwal
This series uses information about opt-clocks provided by omap_hwmod framework
to select which of the non-mandatory DSS clocks are available on a given
platform.

A function pointer opt_clock_available is exported via pdata, which checks the
clock roles returned by hwmod database.
In the driver, while doing clk-get, it is checked if as per hwmod a given clock
is an opt-clock or not, and is handled accordingly.

Tested on: OMAP3430sdp

Sumit Semwal (2):
  OMAP2PLUS:DSS2: add opt_clock_available in pdata
  OMAP2PLUS:DSS2: Use opt_clock_available from pdata

changes from v1:
- made opt_clock_available a function pointer in the omap_display_platform_data
  to avoid having to copy the opt-clock role names.

Based on top of:
http://gitorious.org/linux-omap-dss2/linux/commits/master
commit: ad1c76c: OMAP: Overo Palo43 LCD support


 arch/arm/mach-omap2/display.c |   20 
 arch/arm/plat-omap/include/plat/display.h |2 +
 drivers/video/omap2/dss/dss.c |   46 +++--
 3 files changed, 52 insertions(+), 16 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] OMAP2PLUS:DSS2: add opt_clock_available in pdata

2011-02-28 Thread Sumit Semwal
Provide a function in pdata to allow dss submodules to check if a given
clock is available on a platform as an optional clock.

Signed-off-by: Senthilvadivu Guruswamy svad...@ti.com
(based on implementation from Senthil)

Signed-off-by: Sumit Semwal sumit.sem...@ti.com
---
 arch/arm/mach-omap2/display.c |   20 
 arch/arm/plat-omap/include/plat/display.h |2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 5ab6a74..9f4f862 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = {
},
 };
 
+static bool opt_clock_available(const char *clk_role)
+{
+   int i;
+   struct omap_hwmod *oh;
+
+   /* opt_clks are always associated with dss hwmod */
+   oh = omap_hwmod_lookup(dss_core);
+   if (!oh) {
+   pr_err(Could not look up dss_core.\n);
+   return -ENODEV;
+   }
+
+   for (i = 0; i  oh-opt_clks_cnt; i++) {
+   if (!strcmp(oh-opt_clks[i].role, clk_role))
+   return true;
+   }
+   return false;
+}
+
 int __init omap_display_init(struct omap_dss_board_info *board_data)
 {
int r = 0;
@@ -76,6 +95,7 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
 
pdata.board_data = board_data;
pdata.board_data-get_last_off_on_transaction_id = NULL;
+   pdata.opt_clock_available = opt_clock_available;
 
for (i = 0; i  oh_count; i++) {
oh = omap_hwmod_lookup(oh_name[i]);
diff --git a/arch/arm/plat-omap/include/plat/display.h 
b/arch/arm/plat-omap/include/plat/display.h
index 2fb057e..4101bcd 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -240,6 +240,8 @@ static inline int omap_display_init(struct 
omap_dss_board_info *board_data)
 struct omap_display_platform_data {
struct omap_dss_board_info *board_data;
/* TODO: Additional members to be added when PM is considered */
+
+   bool (*opt_clock_available)(const char *clk_role);
 };
 
 struct omap_video_timings {
-- 
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] OMAP2PLUS:DSS2: Use opt_clock_available from pdata

2011-02-28 Thread Sumit Semwal
hwmod databases provide information about which optional clocks are available
for a given platform. This is available via a function pointer opt_clock_enable
in pdata.

Use this information during get/enable/disable/put of clocks.

Signed-off-by: Sumit Semwal sumit.sem...@ti.com
---
 drivers/video/omap2/dss/dss.c |   46 ++--
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 5a93e66..3d0277d 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -699,6 +699,7 @@ static int dss_get_clock(struct clk **clock, const char 
*clk_name)
 static int dss_get_clocks(void)
 {
int r;
+   struct omap_display_platform_data *pdata = dss.pdev-dev.platform_data;
 
dss.dss_ick = NULL;
dss.dss_fck = NULL;
@@ -714,17 +715,28 @@ static int dss_get_clocks(void)
if (r)
goto err;
 
-   r = dss_get_clock(dss.dss_sys_clk, sys_clk);
-   if (r)
+   if (!pdata-opt_clock_available) {
+   r = -ENODEV;
goto err;
+   }
 
-   r = dss_get_clock(dss.dss_tv_fck, tv_clk);
-   if (r)
-   goto err;
+   if (pdata-opt_clock_available(sys_clk)) {
+   r = dss_get_clock(dss.dss_sys_clk, sys_clk);
+   if (r)
+   goto err;
+   }
 
-   r = dss_get_clock(dss.dss_video_fck, video_clk);
-   if (r)
-   goto err;
+   if (pdata-opt_clock_available(tv_clk)) {
+   r = dss_get_clock(dss.dss_tv_fck, tv_clk);
+   if (r)
+   goto err;
+   }
+
+   if (pdata-opt_clock_available(video_clk)) {
+   r = dss_get_clock(dss.dss_video_fck, video_clk);
+   if (r)
+   goto err;
+   }
 
return 0;
 
@@ -747,9 +759,11 @@ static void dss_put_clocks(void)
 {
if (dss.dss_video_fck)
clk_put(dss.dss_video_fck);
-   clk_put(dss.dss_tv_fck);
+   if (dss.dss_tv_fck)
+   clk_put(dss.dss_tv_fck);
+   if (dss.dss_sys_clk)
+   clk_put(dss.dss_sys_clk);
clk_put(dss.dss_fck);
-   clk_put(dss.dss_sys_clk);
clk_put(dss.dss_ick);
 }
 
@@ -798,11 +812,11 @@ static void dss_clk_enable_no_ctx(enum dss_clock clks)
clk_enable(dss.dss_ick);
if (clks  DSS_CLK_FCK)
clk_enable(dss.dss_fck);
-   if (clks  DSS_CLK_SYSCK)
+   if ((clks  DSS_CLK_SYSCK)  dss.dss_sys_clk)
clk_enable(dss.dss_sys_clk);
-   if (clks  DSS_CLK_TVFCK)
+   if ((clks  DSS_CLK_TVFCK)  dss.dss_tv_fck)
clk_enable(dss.dss_tv_fck);
-   if (clks  DSS_CLK_VIDFCK)
+   if ((clks  DSS_CLK_VIDFCK)  dss.dss_video_fck)
clk_enable(dss.dss_video_fck);
 
dss.num_clks_enabled += num_clks;
@@ -826,11 +840,11 @@ static void dss_clk_disable_no_ctx(enum dss_clock clks)
clk_disable(dss.dss_ick);
if (clks  DSS_CLK_FCK)
clk_disable(dss.dss_fck);
-   if (clks  DSS_CLK_SYSCK)
+   if ((clks  DSS_CLK_SYSCK)  dss.dss_sys_clk)
clk_disable(dss.dss_sys_clk);
-   if (clks  DSS_CLK_TVFCK)
+   if ((clks  DSS_CLK_TVFCK)  dss.dss_tv_fck)
clk_disable(dss.dss_tv_fck);
-   if (clks  DSS_CLK_VIDFCK)
+   if ((clks  DSS_CLK_VIDFCK)  dss.dss_video_fck)
clk_disable(dss.dss_video_fck);
 
dss.num_clks_enabled -= num_clks;
-- 
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


Re: [PATCH resend] omap: Fix linker error in drivers/video/omap/lcd_2430sdp.c

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 08:47 -0600, Jarkko Nikula wrote:
 On Thu, 24 Feb 2011 13:26:44 -0800
 Tony Lindgren t...@atomide.com wrote:
 
  We should avoid selecting driver related things, otherwise we can never
  build a tiny kernel with initramfs with everything as modules.
  
  Can you see if adding depends to the LCD panel option does the trick
  instead?
  
 True and as lcd_2430sdp.c is not compiled without CONFIG_FB_OMAP a hack
 below should work a bit better.
 
 What would you think Tomi?
 
 diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig
 index 083c8fe..c981249 100644
 --- a/drivers/video/omap/Kconfig
 +++ b/drivers/video/omap/Kconfig
 @@ -5,6 +5,7 @@ config FB_OMAP
   select FB_CFB_FILLRECT
   select FB_CFB_COPYAREA
   select FB_CFB_IMAGEBLIT
 + select TWL4030_CORE if MACH_OMAP_2430SDP
   help
Frame buffer driver for OMAP based boards.
 

Well, it's a bit ugly, but I'm fine with it. It's for the old omapfb,
which hopefully nobody uses anymore (right =), and there's no simple way
to make it modular and neat.

The old omapfb compiles lcd_2430sdp always into the kernel if
MACH_OMAP_2430SDP is defined, so this looks like a correct fix to me.

Heh, interestingly, the old omapfb Makefile says: Makefile for the new
OMAP framebuffer device driver. Things are relative =).

 Tomi


--
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 v2 0/2] OMAP2PLUS:DSS2: use opt-clocks information from hwmod.

2011-02-28 Thread Semwal, Sumit
Minor correction:

On Mon, Feb 28, 2011 at 8:32 PM, Sumit Semwal sumit.sem...@ti.com wrote:
snip
 Based on top of:
 http://gitorious.org/linux-omap-dss2/linux/commits/master
 commit: ad1c76c: OMAP: Overo Palo43 LCD support
The correct base is:
http://gitorious.org/linux-omap-dss2/linux/commits/for-next
commit: 799a626: MAINTAINERS: Update OMAP DSS maintainer

Please let me know if you want me to rebase on top of master.

BR,
~S.
snip
--
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 v6 8/8] OMAP: hsmmc: Rename the device and driver

2011-02-28 Thread Kishore Kadiyala
Modifying the device  driver name from mmci-omap-hs to
omap_hsmmc.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +++---
 arch/arm/mach-omap2/board-4430sdp.c  |   14 +++---
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +++---
 arch/arm/mach-omap2/board-igep0030.c |6 +++---
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +++---
 arch/arm/mach-omap2/board-omap4panda.c   |4 ++--
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 ++--
 arch/arm/mach-omap2/clock3xxx_data.c |   12 ++--
 arch/arm/mach-omap2/clock44xx_data.c |   20 ++--
 arch/arm/mach-omap2/hsmmc.c  |2 +-
 drivers/mmc/host/omap_hsmmc.c|2 +-
 17 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index cc42d47..ab0880b 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -149,7 +149,7 @@ static void __init omap_2430sdp_init_early(void)
 }
 
 static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 8950ecc..40b0174 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -410,15 +410,15 @@ static struct regulator_consumer_supply 
sdp3430_vpll2_supplies[] = {
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
-   REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.0),
+   REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.0),
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1),
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.1),
 };
 
 /*
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1a943be..f914099 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -349,11 +349,6 @@ static struct twl4030_usb_data omap4_usbphy_data = {
 
 static struct omap2_hsmmc_info mmc[] = {
{
-   .mmc= 1,
-   .caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
-   .gpio_wp= -EINVAL,
-   },
-   {
.mmc= 2,
.caps   =  MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
.gpio_cd= -EINVAL,
@@ -361,19 +356,24 @@ static struct omap2_hsmmc_info mmc[] = {
.nonremovable   = true,
.ocr_mask   = MMC_VDD_29_30,
},
+   {
+   .mmc= 1,
+   .caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+   .gpio_wp= -EINVAL,
+   },
{}  /* Terminator */
 };
 
 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.1,
+   .dev_name = omap_hsmmc.1,
},
 };
 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
{
.supply = vmmc,
-   .dev_name = mmci-omap-hs.0,
+   .dev_name = omap_hsmmc.0,
},
 };
 
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 54abdd0..c9170f4 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -140,7 +140,7 @@ static void devkit8000_panel_disable_dvi(struct 
omap_dss_device *dssdev)
 }
 
 static struct regulator_consumer_supply devkit8000_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 
 /* ads7846 on SPI */
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index 54e6318..1877c28 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -250,7 +250,7 @@ static inline void __init igep2_init_smsc911x(void) { }
 #endif
 
 static struct regulator_consumer_supply igep2_vmmc1_supply =
-   REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0);
+   REGULATOR_SUPPLY(vmmc, omap_hsmmc.0);
 
 /* VMMC1 for OMAP 

[PATCH v6 5/8] OMAP: hwmod data: Add dev_attr and use in the host driver

2011-02-28 Thread Kishore Kadiyala
Add a device attribute to hwmod data of omap2430, omap3, omap4.
Currently the device attribute holds information regarding dual volt MMC card
support by the controller which will be later passed to the host driver via
platform data.

Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |8 
 arch/arm/plat-omap/include/plat/mmc.h  |9 +
 4 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index cba1800..d144540 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include plat/i2c.h
 #include plat/gpio.h
 #include plat/mcspi.h
+#include plat/mmc.h
 #include plat/l3_2xxx.h
 
 #include omap_hwmod_common_data.h
@@ -1585,6 +1586,10 @@ static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] 
= {
omap2430_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap2430_mmc1_hwmod = {
.name   = mmc1,
.flags  = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -1604,6 +1609,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
.idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap2430_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
.class  = omap2430_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 7726932..07065c3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -22,6 +22,7 @@
 #include plat/l4_3xxx.h
 #include plat/i2c.h
 #include plat/gpio.h
+#include plat/mmc.h
 #include plat/smartreflex.h
 #include plat/mcspi.h
 
@@ -2309,6 +2310,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] 
= {
omap3xxx_l4_core__mmc1,
 };
 
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.name   = mmc1,
.mpu_irqs   = omap34xx_mmc1_mpu_irqs,
@@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
.idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap3xxx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
.class  = omap34xx_mmc_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index dd39e75..0f7d02b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -25,6 +25,7 @@
 #include plat/gpio.h
 #include plat/dma.h
 #include plat/mcspi.h
+#include plat/mmc.h
 
 #include omap_hwmod_common_data.h
 
@@ -3383,6 +3384,7 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = 
{
 };
 
 /* mmc1 */
+
 static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3420,6 +3422,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] 
= {
omap44xx_l4_per__mmc1,
 };
 
+/* mmc1 dev_attr */
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+   .flags  = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod omap44xx_mmc1_hwmod = {
.name   = mmc1,
.class  = omap44xx_mmc_hwmod_class,
@@ -3433,6 +3440,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
.clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
},
},
+   .dev_attr   = mmc1_dev_attr,
.slaves = omap44xx_mmc1_slaves,
.slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves),
.masters= omap44xx_mmc1_masters,
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index e5de5d4..a7afab0 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -43,6 +43,12 @@
 
 #define OMAP_MMC_MAX_SLOTS 2
 
+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT  BIT(1)
+
+struct omap_mmc_dev_attr {
+   u8 flags;
+};
+
 struct omap_mmc_platform_data {
/* back-link to device */
struct device *dev;
@@ -71,6 +77,9 @@ struct omap_mmc_platform_data {
 
u64 dma_mask;
 
+   /* Integrating attributes from the omap_hwmod layer */
+   u8 controller_flags;
+
/* Register offset deviation */
u16 reg_offset;
 
-- 
1.7.1

--
To unsubscribe from 

[PATCH v6 0/8] OMAP: HSMMC: hwmod adaptation

2011-02-28 Thread Kishore Kadiyala
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework.

Omap2420 platform consists of mmc block as in omap1 and not the hsmmc block
as present in omap2430, omap3, omap4 platforms. The series takes care of
spliting out the mmc device init for omap2420 and thus doing hwmod adaptation
for hsmmc drivers. 

Also includes moving of mux setting API for hsmmc devices from devices.c to 
hsmmc.c and renaming of device  driver name.

The patch series is based on omap-for-linus and tested on OMAP2430, OMAP3430SDP,
OMAP4430SDP  OMAP4Panda.Also boot tested on OMAP2420SDP.

For testing hsmmc with hwmod adaptaion on OMAP2430SDP,has dependency on:
http://www.spinics.net/lists/linux-omap/msg47088.html

V6:
---
In the previous versions, implementation for adaptation of hsmmc to 
hwmod framework was based on omap_hwmod_for_each_by_class and using
this will not support flexible resgistration of hsmmc devices.
The current implemetation uses omap_hwmod_lookup and supports flexible
registration of hsmmc devices based on the entry in board file.

V5:
---
http://www.spinics.net/lists/linux-omap/msg47046.html

V4:
---
http://www.spinics.net/lists/linux-mmc/msg06237.html

V3:
--
http://www.spinics.net/lists/linux-omap/msg46783.html

V2:
---
http://www.spinics.net/lists/linux-omap/msg45443.html

V1:
---
http://www.spinics.net/lists/linux-mmc/msg05689.html


Anand Gadiyar (2):
  omap: mmc: split out init for 2420
  OMAP4: hwmod data: enable HSMMC

Kishore Kadiyala (4):
  OMAP: hwmod data: Add dev_attr and use in the host driver
  OMAP: hsmmc: Move mux configuration to hsmmc.c
  OMAP: adapt hsmmc to hwmod framework
  OMAP: hsmmc: Rename the device and driver

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC

 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-3430sdp.c  |6 +-
 arch/arm/mach-omap2/board-4430sdp.c  |   14 +-
 arch/arm/mach-omap2/board-devkit8000.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |6 +-
 arch/arm/mach-omap2/board-igep0030.c |6 +-
 arch/arm/mach-omap2/board-n8x0.c |2 +-
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c |6 +-
 arch/arm/mach-omap2/board-omap4panda.c   |4 +-
 arch/arm/mach-omap2/board-rm680.c|2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |8 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/clock2430_data.c |   12 +-
 arch/arm/mach-omap2/clock3xxx_data.c |   12 +-
 arch/arm/mach-omap2/clock44xx_data.c |   20 +-
 arch/arm/mach-omap2/devices.c|  293 ++
 arch/arm/mach-omap2/hsmmc.c  |  424 +-
 arch/arm/mach-omap2/omap_hwmod_2430_data.c   |  154 ++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c   |  215 +
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c   |   18 +-
 arch/arm/mach-omap2/prcm-common.h|4 +
 arch/arm/plat-omap/include/plat/mmc.h|   29 +-
 drivers/mmc/host/omap_hsmmc.c|6 +-
 24 files changed, 765 insertions(+), 484 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 v6 7/8] OMAP: adapt hsmmc to hwmod framework

2011-02-28 Thread Kishore Kadiyala
OMAP2420 platform consists of mmc block as in omap1 and not the
hsmmc block as present in omap2430, omap3, omap4 platforms.
Removing all base address macro defines except keeping one for OMAP2420 and
adapting only hsmmc device registration and driver to hwmod framework.

Changes involves:
1) Remove controller reset in devices.c which is taken care of
   by hwmod framework.
2) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.
3) Update the driver to use dev_attr to find whether controller
   supports dual volt cards

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Reviewed-by: Balaji T K balaj...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
CC: Kevin Hilman khil...@deeprootsystems.com
Cc: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c |  168 
 arch/arm/mach-omap2/hsmmc.c   |  346 +++--
 arch/arm/plat-omap/include/plat/mmc.h |   20 +--
 drivers/mmc/host/omap_hsmmc.c |4 +-
 4 files changed, 200 insertions(+), 338 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2f4a598..31632ac 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -544,112 +544,6 @@ static inline void omap_init_aes(void) { }
 
 /*-*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG0x0010
-#define MMCHS_SYSCONFIG_SWRESET(1  1)
-#define MMCHS_SYSSTATUS0x0014
-#define MMCHS_SYSSTATUS_RESETDONE  (1  0)
-
-static struct platform_device dummy_pdev = {
-   .dev = {
-   .bus = platform_bus_type,
-   },
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-   u32 i, nr_controllers;
-   struct clk *iclk, *fclk;
-
-   if (cpu_is_omap242x())
-   return;
-
-   nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-   (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-   for (i = 0; i  nr_controllers; i++) {
-   u32 v, base = 0;
-   struct device *dev = dummy_pdev.dev;
-
-   switch (i) {
-   case 0:
-   base = OMAP2_MMC1_BASE;
-   break;
-   case 1:
-   base = OMAP2_MMC2_BASE;
-   break;
-   case 2:
-   base = OMAP3_MMC3_BASE;
-   break;
-   case 3:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC4_BASE;
-   break;
-   case 4:
-   if (!cpu_is_omap44xx())
-   return;
-   base = OMAP4_MMC5_BASE;
-   break;
-   }
-
-   if (cpu_is_omap44xx())
-   base += OMAP4_MMC_REG_OFFSET;
-
-   dummy_pdev.id = i;
-   dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i);
-   iclk = clk_get(dev, ick);
-   if (IS_ERR(iclk))
-   goto err1;
-   if (clk_enable(iclk))
-   goto err2;
-
-   fclk = clk_get(dev, fck);
-   if (IS_ERR(fclk))
-   goto err3;
-   if (clk_enable(fclk))
-   goto err4;
-
-   omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
-   v = omap_readl(base + MMCHS_SYSSTATUS);
-   while (!(omap_readl(base + MMCHS_SYSSTATUS) 
-MMCHS_SYSSTATUS_RESETDONE))
-   cpu_relax();
-
-   clk_disable(fclk);
-   clk_put(fclk);
-   clk_disable(iclk);
-   clk_put(iclk);
-   }
-   return;
-
-err4:
-   clk_put(fclk);
-err3:
-   clk_disable(iclk);
-err2:
-   clk_put(iclk);
-err1:
-   printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, 
-   cannot reset.\n,  __func__, i);
-}
-#else
-static inline void omap_hsmmc_reset(void) {}
-#endif
-
 #if defined(CONFIG_MMC_OMAP) || 

[PATCH v6 3/8] OMAP3: hwmod data: Add HSMMC

2011-02-28 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  209 
 arch/arm/mach-omap2/prcm-common.h  |4 +
 2 files changed, 213 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index e9d0012..7726932 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -68,6 +68,9 @@ static struct omap_hwmod omap34xx_mcspi1;
 static struct omap_hwmod omap34xx_mcspi2;
 static struct omap_hwmod omap34xx_mcspi3;
 static struct omap_hwmod omap34xx_mcspi4;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 static struct omap_hwmod am35xx_usbhsotg_hwmod;
 
 static struct omap_hwmod omap3xxx_dma_system_hwmod;
@@ -158,6 +161,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap3xxx_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc2_hwmod,
+   .clk= mmchs2_ick,
+   .addr   = omap3xxx_mmc2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
+/* L4 CORE - MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+   {
+   .pa_start   = 0x480ad000,
+   .pa_end = 0x480ad1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+   .master = omap3xxx_l4_core_hwmod,
+   .slave  = omap3xxx_mmc3_hwmod,
+   .clk= mmchs3_ick,
+   .addr   = omap3xxx_mmc3_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+   .flags  = OMAP_FIREWALL_L4
+};
+
 /* L4 CORE - UART1 interface */
 static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
{
@@ -2212,11 +2272,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig omap34xx_mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap34xx_mmc_class = {
+   .name = mmc,
+   .sysc = omap34xx_mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info omap34xx_mmc1_mpu_irqs[] = {
+   { .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info omap34xx_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61, },
+   { .name = rx, .dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = {
+   { .role = dbck, .clk = omap_32k_fck, },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = {
+   omap3xxx_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap3xxx_mmc1_hwmod = {
+   .name   = mmc1,
+   .mpu_irqs   = omap34xx_mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap34xx_mmc1_mpu_irqs),
+   .sdma_reqs  = omap34xx_mmc1_sdma_reqs,
+   

[PATCH v6 6/8] OMAP: hsmmc: Move mux configuration to hsmmc.c

2011-02-28 Thread Kishore Kadiyala
Moving the definition of mux setting API from devices.c to hsmmc.c
and renaming it from omap2_mmc_mux to omap_hsmmc_mux.
Also calling omap_hsmmc_mux from omap2_hsmmc_init.

Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Chris Ball c...@laptop.org
Cc: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c |   83 
 arch/arm/mach-omap2/hsmmc.c   |   84 +
 2 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 100bb42..2f4a598 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -708,87 +708,6 @@ void __init omap242x_init_mmc(struct 
omap_mmc_platform_data **mmc_data)
 
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-   int controller_nr)
-{
-   if ((mmc_controller-slots[0].switch_pin  0)  \
-   (mmc_controller-slots[0].switch_pin  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].switch_pin,
-   OMAP_PIN_INPUT_PULLUP);
-   if ((mmc_controller-slots[0].gpio_wp  0)  \
-   (mmc_controller-slots[0].gpio_wp  OMAP_MAX_GPIO_LINES))
-   omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp,
-   OMAP_PIN_INPUT_PULLUP);
-   if (cpu_is_omap34xx()) {
-   if (controller_nr == 0) {
-   omap_mux_init_signal(sdmmc1_clk,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_cmd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat0,
-   OMAP_PIN_INPUT_PULLUP);
-   if (mmc_controller-slots[0].caps 
-   (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-   omap_mux_init_signal(sdmmc1_dat1,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat2,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat3,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   if (mmc_controller-slots[0].caps 
-   MMC_CAP_8_BIT_DATA) {
-   omap_mux_init_signal(sdmmc1_dat4,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat5,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat6,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc1_dat7,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   }
-   if (controller_nr == 1) {
-   /* MMC2 */
-   omap_mux_init_signal(sdmmc2_clk,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_cmd,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat0,
-   OMAP_PIN_INPUT_PULLUP);
-
-   /*
-* For 8 wire configurations, Lines DAT4, 5, 6 and 7 
need to be muxed
-* in the board-*.c files
-*/
-   if (mmc_controller-slots[0].caps 
-   (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-   omap_mux_init_signal(sdmmc2_dat1,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat2,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat3,
-   OMAP_PIN_INPUT_PULLUP);
-   }
-   if (mmc_controller-slots[0].caps 
-   MMC_CAP_8_BIT_DATA) {
-   omap_mux_init_signal(sdmmc2_dat4.sdmmc2_dat4,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat5.sdmmc2_dat5,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat6.sdmmc2_dat6,
-   OMAP_PIN_INPUT_PULLUP);
-   omap_mux_init_signal(sdmmc2_dat7.sdmmc2_dat7,
- 

[PATCH v6 2/8] OMAP2430: hwmod data: Add HSMMC

2011-02-28 Thread Kishore Kadiyala
From: Paul Walmsley p...@pwsan.com

Update the omap2430 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Rajendra Nayak rna...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  148 
 1 files changed, 148 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index de0015d..cba1800 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod;
 static struct omap_hwmod omap2430_mcspi1_hwmod;
 static struct omap_hwmod omap2430_mcspi2_hwmod;
 static struct omap_hwmod omap2430_mcspi3_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 - L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if 
*omap2430_usbhsotg_slaves[] = {
omap2430_l4_core__usbhsotg,
 };
 
+/* L4 CORE - MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+   {
+   .pa_start   = 0x4809c000,
+   .pa_end = 0x4809c1ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc1_hwmod,
+   .clk= mmchs1_ick,
+   .addr   = omap2430_mmc1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc1_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE - MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+   {
+   .pa_start   = 0x480b4000,
+   .pa_end = 0x480b41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+   .master = omap2430_l4_core_hwmod,
+   .slave  = omap2430_mmc2_hwmod,
+   .addr   = omap2430_mmc2_addr_space,
+   .clk= mmchs2_ick,
+   .addr_cnt   = ARRAY_SIZE(omap2430_mmc2_addr_space),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
omap2430_l3_main__l4_core,
@@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] 
= {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
omap2430_l4_core__l4_wkup,
+   omap2430_l4_core__mmc1,
+   omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -1508,6 +1548,112 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
 
 
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = {
+   .rev_offs   = 0x1fc,
+   .sysc_offs  = 0x10,
+   .syss_offs  = 0x14,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_mmc_class = {
+   .name = mmc,
+   .sysc = omap2430_mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = {
+   { .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = {
+   { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */
+   { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
+   { .role = dbck, .clk = mmchsdb1_fck },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+   omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+   .name   = mmc1,
+   .flags  = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
+   .mpu_irqs   = omap2430_mmc1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap2430_mmc1_mpu_irqs),
+   .sdma_reqs  = omap2430_mmc1_sdma_reqs,
+   .sdma_reqs_cnt  = ARRAY_SIZE(omap2430_mmc1_sdma_reqs),
+   .opt_clks   = omap2430_mmc1_opt_clks,
+   .opt_clks_cnt   = ARRAY_SIZE(omap2430_mmc1_opt_clks),
+   .main_clk   = mmchs1_fck,
+   .prcm   = {
+   .omap2 = {
+   .module_offs = CORE_MOD,
+   .prcm_reg_id = 2,
+   .module_bit  = OMAP2430_EN_MMCHS1_SHIFT,
+   .idlest_reg_id = 2,
+ 

[PATCH v6 4/8] OMAP4: hwmod data: enable HSMMC

2011-02-28 Thread Kishore Kadiyala
From: Anand Gadiyar gadi...@ti.com

Enabling hsmmc hwmod for OMAP4

Signed-off-by: Anand Gadiyar gadi...@ti.com
Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com
Acked-by: Benoit Coussonb-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 79a8601..dd39e75 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] 
= {
omap44xx_mcspi4_hwmod,
 
/* mmc class */
-/* omap44xx_mmc1_hwmod, */
-/* omap44xx_mmc2_hwmod, */
-/* omap44xx_mmc3_hwmod, */
-/* omap44xx_mmc4_hwmod, */
-/* omap44xx_mmc5_hwmod, */
+   omap44xx_mmc1_hwmod,
+   omap44xx_mmc2_hwmod,
+   omap44xx_mmc3_hwmod,
+   omap44xx_mmc4_hwmod,
+   omap44xx_mmc5_hwmod,
 
/* mpu class */
omap44xx_mpu_hwmod,
-- 
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


Re: [PATCH 1/2 v3] hwmon: twl4030: Hwmon Driver for TWL4030 MADC

2011-02-28 Thread Guenter Roeck
Hi,

On Mon, Feb 28, 2011 at 01:05:41AM -0500, Keerthy wrote:
 This driver exposes the sysfs nodes of the TWL4030 MADC module.
 All the voltage channel values are expressed in terms of mV. Channel 13
 and channel 14 are reserved. There are channels which represent
 temperature and current the output is represented by celcius
 and mA respectively.
 
 Signed-off-by: Keerthy j-keer...@ti.com
 ---
 V3:
 Corrected channel 15 index
 
 V2:
 Changed the names of the sysfs attributes compliant to current,
 voltage and temperature attributes.
 
 V1:
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg44542.html
 
  Documentation/hwmon/twl4030-madc-hwmon |   45 +
  drivers/hwmon/Kconfig  |   10 ++
  drivers/hwmon/Makefile |1 +
  drivers/hwmon/twl4030-madc-hwmon.c |  153 
 
  4 files changed, 209 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/hwmon/twl4030-madc-hwmon
  create mode 100644 drivers/hwmon/twl4030-madc-hwmon.c
 
 diff --git a/Documentation/hwmon/twl4030-madc-hwmon 
 b/Documentation/hwmon/twl4030-madc-hwmon
 new file mode 100644
 index 000..ef79843
 --- /dev/null
 +++ b/Documentation/hwmon/twl4030-madc-hwmon
 @@ -0,0 +1,45 @@
 +Kernel driver twl4030-madc
 +=
 +
 +Supported chips:
 + * Texas Instruments TWL4030
 + Prefix: 'twl4030-madc'
 +
 +
 +Authors:
 + J Keerthy j-keer...@ti.com
 +
 +Description
 +---
 +
 +The Texas Instruments TWL4030 is a Power Management and Audio Circuit. Among
 +other things it contains a 10-bit A/D converter MADC. The converter has 16
 +channels which can be used in different modes.
 +
 +
 +See this table for the meaning of the different channels
 +
 +Channel Signal
 +--
 +0Battery type(BTYPE)
 +1BCI: Battery temperature (BTEMP)
 +2GP analog input
 +3GP analog input
 +4GP analog input
 +5GP analog input
 +6GP analog input
 +7GP analog input
 +8BCI: VBUS voltage(VBUS)
 +9Backup Battery voltage (VBKP)
 +10   BCI: Battery charger current (ICHG)
 +11   BCI: Battery charger voltage (VCHG)
 +12   BCI: Main battery voltage (VBAT)
 +13   Reserved
 +14   Reserved
 +15   VRUSB Supply/Speaker left/Speaker right polarization level
 +
 +
 +The Sysfs nodes will represent the voltage in the units of mV,
 +the temperature channel shows the converted temperature in
 +degree celcius. The Battery charging current channel represents
 +battery charging current in mA.
 diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
 index 297bc9a..cb3d895 100644
 --- a/drivers/hwmon/Kconfig
 +++ b/drivers/hwmon/Kconfig
 @@ -941,6 +941,16 @@ config SENSORS_TMP421
 This driver can also be built as a module.  If so, the module
 will be called tmp421.
  
 +config SENSORS_TWL4030_MADC
 + tristate Texas Instruments TWL4030 MADC Hwmon
 + depends on TWL4030_MADC
 + help
 + If you say yes here you get hwmon support for triton
 + TWL4030-MADC.
 +
 + This driver can also be built as a module. If so it will be called
 + twl4030-madc-hwmon.
 +
  config SENSORS_VIA_CPUTEMP
   tristate VIA CPU temperature sensor
   depends on X86
 diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
 index dde02d9..bc7d740 100644
 --- a/drivers/hwmon/Makefile
 +++ b/drivers/hwmon/Makefile
 @@ -102,6 +102,7 @@ obj-$(CONFIG_SENSORS_THMC50)  += thmc50.o
  obj-$(CONFIG_SENSORS_TMP102) += tmp102.o
  obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
  obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
 +obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o
  obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
  obj-$(CONFIG_SENSORS_VIA686A)+= via686a.o
  obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
 diff --git a/drivers/hwmon/twl4030-madc-hwmon.c 
 b/drivers/hwmon/twl4030-madc-hwmon.c
 new file mode 100644
 index 000..5eb563f
 --- /dev/null
 +++ b/drivers/hwmon/twl4030-madc-hwmon.c
 @@ -0,0 +1,153 @@
 +/*
 + *
 + * TWL4030 MADC Hwmon driver-This driver monitors the real time
 + * conversion of analog signals like battery temperature,
 + * battery type, battery level etc. User can ask for the conversion on a
 + * particular channel using the sysfs nodes.
 + *
 + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 + * J Keerthy j-keer...@ti.com
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * version 2 as published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope that it will be useful, but
 + * WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * 

Re: [PATCH 2/2 v4] mfd: twl4030: Driver for twl4030 madc module

2011-02-28 Thread Guenter Roeck
On Mon, Feb 28, 2011 at 04:48:12AM -0500, Keerthy wrote:
 Introducing a driver for MADC on TWL4030 powerIC. MADC stands for monitoring
 ADC. This driver monitors the real time conversion of analog signals like
 battery temperature, battery cuurent etc.
 
 Signed-off-by: Keerthy j-keer...@ti.com
 ---
 
 V4:
 Removed unwanted else from twl4030_madc_read_channels functions.
 
 V3:
 Added for_each_set_bit for efficient bit checking
 and locking the mutex earlier in the threaded irq
 handler.
 
 V2:
 Added functions to convert raw voltages to current and temperature.
 
 V1:
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg44543.html
 
  drivers/mfd/Kconfig  |   10 +
  drivers/mfd/Makefile |1 +
  drivers/mfd/twl4030-madc.c   |  812 
 ++
  include/linux/i2c/twl4030-madc.h |  142 +++
  4 files changed, 965 insertions(+), 0 deletions(-)
  create mode 100644 drivers/mfd/twl4030-madc.c
  create mode 100644 include/linux/i2c/twl4030-madc.h
 
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index fd01836..029e078 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -167,6 +167,16 @@ config TWL4030_CORE
   high speed USB OTG transceiver, an audio codec (on most
   versions) and many other features.
 
 +config TWL4030_MADC
 +   tristate Texas Instruments TWL4030 MADC
 +   depends on TWL4030_CORE
 +   help
 +   This driver provides support for triton TWL4030-MADC. The
 +   driver supports both RT and SW conversion methods.
 +
 +   This driver can be built as a module. If so it will be
 +   named twl4030-madc
 +
  config TWL4030_POWER
 bool Support power resources on TWL4030 family chips
 depends on TWL4030_CORE  ARM
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index a54e2c7..2922cc2 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -37,6 +37,7 @@ obj-$(CONFIG_TPS6507X)+= tps6507x.o
  obj-$(CONFIG_MENELAUS) += menelaus.o
 
  obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o
 +obj-$(CONFIG_TWL4030_MADC)  += twl4030-madc.o
  obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o
  obj-$(CONFIG_TWL4030_CODEC)+= twl4030-codec.o
  obj-$(CONFIG_TWL6030_PWM)  += twl6030-pwm.o
 diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
 new file mode 100644
 index 000..e533c72
 --- /dev/null
 +++ b/drivers/mfd/twl4030-madc.c
 @@ -0,0 +1,812 @@
 +/*
 + *
 + * TWL4030 MADC module driver-This driver monitors the real time
 + * conversion of analog signals like battery temperature,
 + * battery type, battery level etc.
 + *
 + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 + * J Keerthy j-keer...@ti.com
 + *
 + * Based on twl4030-madc.c
 + * Copyright (C) 2008 Nokia Corporation
 + * Mikko Ylinen mikko.k.yli...@nokia.com
 + *
 + * Amit Kucheria amit.kuche...@canonical.com
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * version 2 as published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope that it will be useful, but
 + * WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 + * 02110-1301 USA
 + *
 + */
 +
 +#include linux/interrupt.h
 +#include linux/delay.h
 +#include linux/platform_device.h
 +#include linux/slab.h
 +#include linux/i2c/twl.h
 +#include linux/i2c/twl4030-madc.h
 +
I didn't have a close look, but I suspect that several includes are missing 
here.
See Documentation/SubmitChecklist, item #1.

 +/*
 + * struct twl4030_madc_data - a container for madc info
 + * @dev - pointer to device structure for madc
 + * @lock - mutex protecting this data structire
 + * @requests - Array of request struct corresponding to SW1, SW2 and RT
 + * @imr - Interrupt mask register of MADC
 + * @isr - Interrupt status register of MADC
 + */
 +struct twl4030_madc_data {
 +   struct device *dev;
 +   struct mutex lock;  /* mutex protecting this data structire */
 +   struct twl4030_madc_request requests[TWL4030_MADC_NUM_METHODS];
 +   int imr;
 +   int isr;
 +};
 +
 +static struct twl4030_madc_data *twl4030_madc;
 +
 +struct twl4030_prescale_divider_ratios {
 +   s16 numerator;
 +   s16 denominator;
 +};
 +
 +static const struct twl4030_prescale_divider_ratios
 +twl4030_divider_ratios[16] = {
 +   {1, 1}, /* CHANNEL 0 No Prescaler */
 +   {1, 1}, /* CHANNEL 1 No Prescaler */
 +   {6, 10},/* CHANNEL 2 */
 +   {6, 10},/* CHANNEL 3 */
 +   

Re: [Patch v2 1/2] OMAP2PLUS:DSS2: add opt_clock_available in pdata

2011-02-28 Thread Tomi Valkeinen
On Mon, 2011-02-28 at 09:02 -0600, Semwal, Sumit wrote:
 Provide a function in pdata to allow dss submodules to check if a given
 clock is available on a platform as an optional clock.
 
 Signed-off-by: Senthilvadivu Guruswamy svad...@ti.com
 (based on implementation from Senthil)
 
 Signed-off-by: Sumit Semwal sumit.sem...@ti.com
 ---
  arch/arm/mach-omap2/display.c |   20 
  arch/arm/plat-omap/include/plat/display.h |2 ++
  2 files changed, 22 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
 index 5ab6a74..9f4f862 100644
 --- a/arch/arm/mach-omap2/display.c
 +++ b/arch/arm/mach-omap2/display.c
 @@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = {
   },
  };
  
 +static bool opt_clock_available(const char *clk_role)
 +{
 + int i;
 + struct omap_hwmod *oh;
 +
 + /* opt_clks are always associated with dss hwmod */
 + oh = omap_hwmod_lookup(dss_core);
 + if (!oh) {
 + pr_err(Could not look up dss_core.\n);
 + return -ENODEV;

The function returns a bool. Perhaps the lookup would be better done in
omap_display_init(), and stored in a static variable.

Or if it's clear that this should never happen, BUG_ON(!oh);

 Tomi


--
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] cbus-retu: Add locking around register access in irq handler

2011-02-28 Thread Michael Buesch
This adds locking around the register access in the
interrupt service routine.

Signed-off-by: Michael Buesch m...@bu3sch.de
Reported-by: Felipe Balbi ba...@ti.com

---

Index: linux-omap-2.6/drivers/cbus/retu.c
===
--- linux-omap-2.6.orig/drivers/cbus/retu.c 2011-02-28 16:59:10.767302605 
+0100
+++ linux-omap-2.6/drivers/cbus/retu.c  2011-02-28 16:59:58.629389762 +0100
@@ -198,10 +198,12 @@ static irqreturn_t retu_irq_handler(int
u16 idr;
u16 imr;
 
+   mutex_lock(retu-mutex);
idr = __retu_read_reg(retu, RETU_REG_IDR);
imr = __retu_read_reg(retu, RETU_REG_IMR);
-   idr = ~imr;
+   mutex_unlock(retu-mutex);
 
+   idr = ~imr;
if (!idr) {
dev_vdbg(retu-dev, No IRQ, spurious?\n);
return IRQ_NONE;


--
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 v1] EHCI and OHCI patches of OMAP3 and OMAP4

2011-02-28 Thread Keshava Munegowda
this is how it EHCI/OHCI code re oraganize look like:
. we have EHCI and OHCI be children of a usbhs core driver
which will take care of all accesses to
UHH and TLL bases. 

. we pass enable/disable functions down from EHCI and OHCI drivers.
to USBHS driver.

. UHH and TLL power management will eventually move to
omap-usb-host.c

Felipe Balbi (3):
  arm: omap: usb: host: add names to resources
  usb: host: omap: switch to platform_get_resource_byname
  arm: omap2: usb: rename usb-ehci.c to usb-host.c

Keshava Munegowda (7):
  arm: omap: usb: create common enums and structures for ehci and ohci
  usb: host: omap: common usb host core driver
  arm: omap: usb: usbhs core device initialization
  arm: omap: usb: Invoke usbhs core device initialization
  arm: omap: usb: cleanup ehci and ohci resources and devices
  usb: host: omap: ehci and ohci simplification
  arm: omap: usb: clock entries for omap3 and omap4

 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/board-3430sdp.c|   10 +-
 arch/arm/mach-omap2/board-3630sdp.c|   10 +-
 arch/arm/mach-omap2/board-4430sdp.c|   10 +-
 arch/arm/mach-omap2/board-am3517crane.c|   10 +-
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +-
 arch/arm/mach-omap2/board-cm-t35.c |   10 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |   10 +-
 arch/arm/mach-omap2/board-devkit8000.c |   10 +-
 arch/arm/mach-omap2/board-igep0020.c   |   10 +-
 arch/arm/mach-omap2/board-igep0030.c   |   10 +-
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +-
 arch/arm/mach-omap2/board-omap3evm.c   |   14 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +-
 arch/arm/mach-omap2/board-omap4panda.c |   10 +-
 arch/arm/mach-omap2/board-overo.c  |   10 +-
 arch/arm/mach-omap2/board-zoom.c   |   10 +-
 arch/arm/mach-omap2/clock3xxx_data.c   |   14 +-
 arch/arm/mach-omap2/clock44xx_data.c   |   10 +-
 arch/arm/mach-omap2/{usb-ehci.c = usb-host.c} |  307 +---
 arch/arm/plat-omap/include/plat/usb.h  |   55 +-
 drivers/mfd/Kconfig|9 +
 drivers/mfd/Makefile   |1 +
 drivers/mfd/omap-usb-host.c|  981 
 drivers/usb/host/ehci-omap.c   |  877 ++---
 drivers/usb/host/ohci-omap3.c  |  584 ++-
 28 files changed, 1445 insertions(+), 1581 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c = usb-host.c} (68%)
 create mode 100644 drivers/mfd/omap-usb-host.c

--
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 v1] arm: omap: usb: host: add names to resources

2011-02-28 Thread Keshava Munegowda
From: Felipe Balbi ba...@ti.com

add names to EHCI and OHCI resources. That will help us
identify the resource correctly when moving to a setup
where OHCI and EHCI play well together.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 arch/arm/mach-omap2/usb-ehci.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c
index 25eeada..2c74fa1 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-ehci.c
@@ -350,6 +350,11 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
setup_4430ehci_io_mux(pdata-port_mode);
}
 
+   ehci_resources[0].name  = ehci;
+   ehci_resources[1].name  = uhh;
+   ehci_resources[2].name  = tll;
+   ehci_resources[3].name  = irq;
+
if (platform_device_register(ehci_device)  0) {
printk(KERN_ERR Unable to register HS-USB (EHCI) device\n);
return;
@@ -369,21 +374,25 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
 
 static struct resource ohci_resources[] = {
{
+   .name   = ohci,
.start  = OMAP34XX_OHCI_BASE,
.end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = uhh,
.start  = OMAP34XX_UHH_CONFIG_BASE,
.end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = tll,
.start  = OMAP34XX_USBTLL_BASE,
.end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
.flags  = IORESOURCE_MEM,
},
{   /* general IRQ */
+   .name   = irq,
.start  = INT_34XX_OHCI_IRQ,
.flags  = IORESOURCE_IRQ,
}
-- 
1.6.0.4

--
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 v1] arm: omap: usb: cleanup ehci and ohci resources and devices

2011-02-28 Thread Keshava Munegowda
The prototype and defination of functions usb_ehci_init and
usb_ohci_init are removed. The ehci and ohci devices are
removed since usbhs device contains both ehci and ohci details.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
---
 arch/arm/mach-omap2/usb-host.c|  176 +
 arch/arm/plat-omap/include/plat/usb.h |4 -
 2 files changed, 26 insertions(+), 154 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 19cf0d6..ffb4b37 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -33,34 +33,46 @@
 
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
-static struct resource ehci_resources[] = {
+#define OMAP_USBHS_DEVICE  usbhs-omap
+
+static struct resource usbhs_resources[] = {
+   {
+   .name   = uhh,
+   .flags  = IORESOURCE_MEM,
+   },
{
+   .name   = tll,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = ehci,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = ehci-irq,
+   .flags  = IORESOURCE_IRQ,
+   },
+   {
+   .name   = ohci,
.flags  = IORESOURCE_MEM,
},
-   { /* general IRQ */
-   .flags   = IORESOURCE_IRQ,
+   {
+   .name   = ohci-irq,
+   .flags  = IORESOURCE_IRQ,
}
 };
 
-static u64 ehci_dmamask = ~(u32)0;
-static struct platform_device ehci_device = {
-   .name   = ehci-omap,
-   .id = 0,
-   .dev = {
-   .dma_mask   = ehci_dmamask,
-   .coherent_dma_mask  = 0x,
-   .platform_data  = NULL,
-   },
-   .num_resources  = ARRAY_SIZE(ehci_resources),
-   .resource   = ehci_resources,
+static struct platform_device usbhs_device = {
+   .name   = OMAP_USBHS_DEVICE,
+   .id = 0,
+   .num_resources  = ARRAY_SIZE(usbhs_resources),
+   .resource   = usbhs_resources,
 };
 
+static struct usbhs_omap_platform_data usbhs_data;
+static struct ehci_hcd_omap_platform_data  ehci_data;
+static struct ohci_hcd_omap_platform_data  ohci_data;
+
 /* MUX settings for EHCI pins */
 /*
  * setup_ehci_io_mux - initialize IO pad mux for USBHOST
@@ -326,81 +338,6 @@ static void setup_4430ehci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-{
-   platform_device_add_data(ehci_device, pdata, sizeof(*pdata));
-
-   /* Setup Pin IO MUX for EHCI */
-   if (cpu_is_omap34xx()) {
-   ehci_resources[0].start = OMAP34XX_EHCI_BASE;
-   ehci_resources[0].end   = OMAP34XX_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP34XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
-   ehci_resources[2].start = OMAP34XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = INT_34XX_EHCI_IRQ;
-   setup_ehci_io_mux(pdata-port_mode);
-   } else if (cpu_is_omap44xx()) {
-   ehci_resources[0].start = OMAP44XX_HSUSB_EHCI_BASE;
-   ehci_resources[0].end   = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP44XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP44XX_UHH_CONFIG_BASE + SZ_2K - 1;
-   ehci_resources[2].start = OMAP44XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = OMAP44XX_IRQ_EHCI;
-   setup_4430ehci_io_mux(pdata-port_mode);
-   }
-
-   ehci_resources[0].name  = ehci;
-   ehci_resources[1].name  = uhh;
-   ehci_resources[2].name  = tll;
-   ehci_resources[3].name  = irq;
-
-   if (platform_device_register(ehci_device)  0) {
-   printk(KERN_ERR Unable to register HS-USB (EHCI) device\n);
-   return;
-   }
-}
-
-static struct resource ohci_resources[] = {
-   {
-   .name   = ohci,
-   .start  = OMAP34XX_OHCI_BASE,
-   .end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = uhh,
-   .start  = OMAP34XX_UHH_CONFIG_BASE,
-   .end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = tll,
-   .start  = OMAP34XX_USBTLL_BASE,
-   .end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {   /* general IRQ */
-   .name   = irq,
-   .start  = INT_34XX_OHCI_IRQ,
-   .flags  = 

[PATCH 07/10 v1] arm: omap: usb: Invoke usbhs core device initialization

2011-02-28 Thread Keshava Munegowda
The usbhs intialization is invoked by all omap3 and omap4
variant board files.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c|2 +-
 arch/arm/mach-omap2/board-3630sdp.c|2 +-
 arch/arm/mach-omap2/board-4430sdp.c|2 +-
 arch/arm/mach-omap2/board-am3517crane.c|2 +-
 arch/arm/mach-omap2/board-am3517evm.c  |2 +-
 arch/arm/mach-omap2/board-cm-t35.c |2 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |2 +-
 arch/arm/mach-omap2/board-devkit8000.c |2 +-
 arch/arm/mach-omap2/board-igep0020.c   |2 +-
 arch/arm/mach-omap2/board-igep0030.c   |2 +-
 arch/arm/mach-omap2/board-omap3beagle.c|2 +-
 arch/arm/mach-omap2/board-omap3evm.c   |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |2 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |2 +-
 arch/arm/mach-omap2/board-omap4panda.c |2 +-
 arch/arm/mach-omap2/board-overo.c  |2 +-
 arch/arm/mach-omap2/board-zoom.c   |2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index a991aeb..7542ba5 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(usbhs_bdata);
+   usbhs_init(usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, OMAP3430 3430SDP board)
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 03fd8ac..deed2db 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(usbhs_bdata);
+   usbhs_init(usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, OMAP 3630SDP board)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1f59e8d..13cb1cf 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(usbhs_bdata);
+   usbhs_init(usbhs_bdata);
usb_musb_init(musb_board_data);
 
status = omap_ethernet_init();
diff --git a/arch/arm/mach-omap2/board-am3517crane.c 
b/arch/arm/mach-omap2/board-am3517crane.c
index 1b825a0..e3a194f 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -103,7 +103,7 @@ static void __init am3517_crane_init(void)
return;
}
 
-   usb_ehci_init(usbhs_bdata);
+   usbhs_init(usbhs_bdata);
 }
 
 MACHINE_START(CRANEBOARD, AM3517/05 CRANEBOARD)
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index f5bc1c6..913538a 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -502,7 +502,7 @@ static void __init am3517_evm_init(void)
 
/* Configure GPIO for EHCI port */
omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
-   usb_ehci_init(usbhs_bdata);
+   usbhs_init(usbhs_bdata);
am3517_evm_hecc_init(am3517_evm_hecc_pdata);
/* DSS */
am3517_evm_display_init();
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index c79aa9b..9be7289 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -810,7 +810,7 @@ static void __init cm_t35_init(void)
cm_t35_init_display();
 
usb_musb_init(musb_board_data);
-   usb_ehci_init(usbhs_bdata);
+   usbhs_init(usbhs_bdata);
 }
 
 MACHINE_START(CM_T35, Compulab CM-T35)
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c 
b/arch/arm/mach-omap2/board-cm-t3517.c
index 8288a0b..8e18dc7 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -192,7 +192,7 @@ static int cm_t3517_init_usbh(void)
msleep(1);
}
 
-   usb_ehci_init(cm_t3517_ehci_pdata);
+   usbhs_init(cm_t3517_ehci_pdata);
 
return 0;
 }
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index e0131dd..bc0141b 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -803,7 +803,7 @@ static void __init devkit8000_init(void)
devkit8000_ads7846_init();
 
usb_musb_init(musb_board_data);
-   usb_ehci_init(usbhs_bdata);
+   usbhs_init(usbhs_bdata);
devkit8000_flash_init();
 
/* 

[PATCH 09/10 v1] usb: host: omap: ehci and ohci simplification

2011-02-28 Thread Keshava Munegowda
The ehci and ohci drivers are simplified; Since
UHH and TLL initialization, clock handling are
done by common usbhs core driver, these fucntionalities
are removed from ehci and ohci drivers.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
---
 drivers/usb/host/ehci-omap.c  |  877 -
 drivers/usb/host/ohci-omap3.c |  584 +++-
 2 files changed, 130 insertions(+), 1331 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 77e9906..583dafe 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -4,9 +4,10 @@
  * Bus Glue for the EHCI controllers in OMAP3/4
  * Tested on several OMAP3 boards, and OMAP4 Pandaboard
  *
- * Copyright (C) 2007-2010 Texas Instruments, Inc.
+ * Copyright (C) 2007-2011 Texas Instruments, Inc.
  * Author: Vikram Pandita vikram.pand...@ti.com
  * Author: Anand Gadiyar gadi...@ti.com
+ * Author: Keshava Munegowda keshava_mgo...@ti.com
  *
  * Copyright (C) 2009 Nokia Corporation
  * Contact: Felipe Balbi felipe.ba...@nokia.com
@@ -27,116 +28,19 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * TODO (last updated Nov 21, 2010):
+ * TODO (last updated Feb 27, 2010):
  * - add kernel-doc
  * - enable AUTOIDLE
  * - add suspend/resume
- * - move workarounds to board-files
- * - factor out code common to OHCI
  * - add HSIC and TLL support
  * - convert to use hwmod and runtime PM
  */
 
 #include linux/platform_device.h
-#include linux/clk.h
-#include linux/gpio.h
-#include linux/regulator/consumer.h
 #include linux/slab.h
 #include linux/usb/ulpi.h
 #include plat/usb.h
 
-/*
- * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES
- * Use ehci_omap_readl()/ehci_omap_writel() functions
- */
-
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1  8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1  3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1  2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1  1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1  0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1  0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1  6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1  5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1  2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1  1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1  0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1  11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1  10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1  9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1  8)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1  0)
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1  0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1  1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1  2)
-
-/* UHH Register Set */
-#defineOMAP_UHH_REVISION   (0x00)
-#defineOMAP_UHH_SYSCONFIG  (0x10)
-#defineOMAP_UHH_SYSCONFIG_MIDLEMODE(1  12)
-#defineOMAP_UHH_SYSCONFIG_CACTIVITY(1  8)
-#defineOMAP_UHH_SYSCONFIG_SIDLEMODE  

[PATCH 05/10 v1] usb: host: omap: common usb host core driver

2011-02-28 Thread Keshava Munegowda
enabling and disabling the common clocks for ehci
and ohci is implemented. usbhs is a common parent
platform driver for EHCI and OHCI driver. This driver
receives the clock enable and disable requests
from ehci and ohci drivers.The UHH and TLL
initialization is also performed.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
---
 arch/arm/plat-omap/include/plat/usb.h |3 +
 drivers/mfd/Kconfig   |9 +
 drivers/mfd/Makefile  |1 +
 drivers/mfd/omap-usb-host.c   |  981 +
 4 files changed, 994 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-host.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index dc6ef62..7aeaa76 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -102,6 +102,9 @@ extern void usb_ehci_init(const struct 
usbhs_omap_board_data *pdata);
 
 extern void usb_ohci_init(const struct usbhs_omap_board_data *pdata);
 
+extern int omap_usbhs_enable(struct device *dev);
+extern void omap_usbhs_disable(struct device *dev);
+
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
 extern int omap4430_phy_init(struct device *dev);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index fd01836..a6dfa37 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -624,6 +624,15 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
 
+config MFD_OMAP_USB_HOST
+   bool Support OMAP USBHS core driver
+   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
+   default y
+   help
+ This is the core driver for the OAMP EHCI and OHCI drivers.
+ This MFD driver does the required setup functionalities for
+ OMAP USB Host drivers.
+
 endif # MFD_SUPPORT
 
 menu Multimedia Capabilities Port drivers
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a54e2c7..91fe384 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -83,3 +83,4 @@ obj-$(CONFIG_MFD_TPS6586X)+= tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
new file mode 100644
index 000..5fb60b5
--- /dev/null
+++ b/drivers/mfd/omap-usb-host.c
@@ -0,0 +1,981 @@
+/**
+ * omap-usb-host.c - The USBHS core driver for OMAP EHCI  OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda keshava_mgo...@ti.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ */
+#include linux/kernel.h
+#include linux/types.h
+#include linux/slab.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/clk.h
+#include linux/dma-mapping.h
+#include linux/spinlock.h
+#include linux/gpio.h
+#include linux/regulator/consumer.h
+#include plat/usb.h
+
+#define USBHS_DRIVER_NAME  usbhs-omap
+#define OMAP_EHCI_DEVICE   ehci-omap
+#define OMAP_OHCI_DEVICE   ohci-omap3
+
+/* OMAP USBHOST Register addresses  */
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1  8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1  3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1  2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1  1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1  0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1  0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1  6)
+#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1  5)
+#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1  2)
+#define

[PATCH 10/10 v1] arm: omap: usb: clock entries for omap3 and omap4

2011-02-28 Thread Keshava Munegowda
The devices of clocks are set to usbhs, so that
only usbhs common driver can invoke these clocks.
The dummy per port clocks are added to omap3
clock data base. This helps to invoke common
clock get APIs for omap3 and omap4.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
---
 arch/arm/mach-omap2/clock3xxx_data.c |   14 +-
 arch/arm/mach-omap2/clock44xx_data.c |   10 +-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 403a4a1..bba590f 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3286,7 +3286,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   cpefuse_fck,  cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   ts_fck,   ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   usbtll_fck,   usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK(ehci-omap.0,  usbtll_fck,   usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK(usbhs-omap.0, usbtll_fck,   usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK(omap-mcbsp.1, prcm_fck, core_96m_fck,  CK_3XXX),
CLK(omap-mcbsp.5, prcm_fck, core_96m_fck,  CK_3XXX),
CLK(NULL,   core_96m_fck, core_96m_fck,  CK_3XXX),
@@ -3322,7 +3322,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   pka_ick,  pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   core_l4_ick,  core_l4_ick,   CK_3XXX),
CLK(NULL,   usbtll_ick,   usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK(ehci-omap.0,  usbtll_ick,   usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK(usbhs-omap.0, usbtll_ick,   usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK(mmci-omap-hs.2,   ick,  mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   icr_ick,  icr_ick,   CK_34XX | CK_36XX),
CLK(omap-aes, ick,  aes2_ick,  CK_34XX | CK_36XX),
@@ -3368,11 +3368,15 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   cam_ick,  cam_ick,   CK_34XX | CK_36XX),
CLK(NULL,   csi2_96m_fck, csi2_96m_fck,  CK_34XX | CK_36XX),
CLK(NULL,   usbhost_120m_fck, usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK(ehci-omap.0,  hs_fck, usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK(usbhs-omap.0, hs_fck, usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   usbhost_48m_fck, usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK(ehci-omap.0,  fs_fck, usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK(usbhs-omap.0, fs_fck, usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   usbhost_ick,  usbhost_ick,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK(ehci-omap.0,  usbhost_ick,  usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK(usbhs-omap.0, usbhost_ick,  usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK(usbhs-omap.0, utmi_p1_gfclk,dummy_ck,  
CK_3XXX),
+   CLK(usbhs-omap.0, utmi_p2_gfclk,dummy_ck,  
CK_3XXX),
+   CLK(usbhs-omap.0, xclk60mhsp1_ck,   dummy_ck,  
CK_3XXX),
+   CLK(usbhs-omap.0, xclk60mhsp2_ck,   dummy_ck,  
CK_3XXX),
CLK(NULL,   usim_fck, usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   gpt1_fck, gpt1_fck,  CK_3XXX),
CLK(NULL,   wkup_32k_fck, wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index de9ec8d..46fd3f6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3197,7 +3197,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   uart3_fck,uart3_fck, 
CK_443X),
CLK(NULL,   uart4_fck,uart4_fck, 
CK_443X),
CLK(NULL,   usb_host_fs_fck,  usb_host_fs_fck,   
CK_443X),
-   CLK(ehci-omap.0,  fs_fck,   usb_host_fs_fck,   
CK_443X),
+   CLK(usbhs-omap.0, fs_fck,   usb_host_fs_fck,   
CK_443X),
CLK(NULL,   utmi_p1_gfclk,utmi_p1_gfclk, 
CK_443X),
CLK(NULL,   usb_host_hs_utmi_p1_clk,  
usb_host_hs_utmi_p1_clk,   CK_443X),
CLK(NULL,   utmi_p2_gfclk,utmi_p2_gfclk, 
CK_443X),
@@ -3209,8 +3209,8 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   usb_host_hs_hsic480m_p2_clk,  
usb_host_hs_hsic480m_p2_clk,   CK_443X),
CLK(NULL,   usb_host_hs_func48mclk,   
usb_host_hs_func48mclk,CK_443X),
CLK(NULL,   usb_host_hs_fck,  usb_host_hs_fck, 

[PATCH 03/10 v1] arm: omap2: usb: rename usb-ehci.c to usb-host.c

2011-02-28 Thread Keshava Munegowda
From: Felipe Balbi ba...@ti.com

We already have both EHCI and OHCI there, so let's
rename to be sure everybody will understand the entire
USB HOST functionality is setup on this file.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/{usb-ehci.c = usb-host.c} |8 
 2 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c = usb-host.c} (98%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 1c0c2b0..64dc417 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -229,7 +229,7 @@ usbfs-$(CONFIG_ARCH_OMAP_OTG)   := usb-fs.o
 obj-y  += $(usbfs-m) $(usbfs-y)
 obj-y  += usb-musb.o
 obj-$(CONFIG_MACH_OMAP2_TUSB6010)  += usb-tusb6010.o
-obj-y  += usb-ehci.o
+obj-y  += usb-host.o
 
 onenand-$(CONFIG_MTD_ONENAND_OMAP2):= gpmc-onenand.o
 obj-y  += $(onenand-m) $(onenand-y)
diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-host.c
similarity index 98%
rename from arch/arm/mach-omap2/usb-ehci.c
rename to arch/arm/mach-omap2/usb-host.c
index 2c74fa1..45f9b80 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -1,14 +1,14 @@
 /*
- * linux/arch/arm/mach-omap2/usb-ehci.c
+ * usb-host.c - OMAP USB Host
  *
  * This file will contain the board specific details for the
- * Synopsys EHCI host controller on OMAP3430
+ * Synopsys EHCI/OHCI host controller on OMAP3430 and onwards
  *
- * Copyright (C) 2007 Texas Instruments
+ * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita vikram.pand...@ti.com
  *
  * Generalization by:
- * Felipe Balbi felipe.ba...@nokia.com
+ * Felipe Balbi ba...@ti.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
-- 
1.6.0.4

--
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 v1] arm: omap: usb: create common enums and structures for ehci and ohci

2011-02-28 Thread Keshava Munegowda
Create the ehci and ohci specific platform data structures.
The port enum values are made common for both ehci and ohci.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-3630sdp.c|   10 +++---
 arch/arm/mach-omap2/board-4430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-am3517crane.c|   10 +++---
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +++---
 arch/arm/mach-omap2/board-cm-t35.c |   10 +++---
 arch/arm/mach-omap2/board-cm-t3517.c   |8 ++--
 arch/arm/mach-omap2/board-devkit8000.c |   10 +++---
 arch/arm/mach-omap2/board-igep0020.c   |   10 +++---
 arch/arm/mach-omap2/board-igep0030.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +++---
 arch/arm/mach-omap2/board-omap3evm.c   |   14 
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +++---
 arch/arm/mach-omap2/board-omap4panda.c |   10 +++---
 arch/arm/mach-omap2/board-overo.c  |   10 +++---
 arch/arm/mach-omap2/board-zoom.c   |   10 +++---
 arch/arm/mach-omap2/usb-host.c |   50 +-
 arch/arm/plat-omap/include/plat/usb.h  |   54 ++--
 drivers/usb/host/ehci-omap.c   |   42 +++---
 drivers/usb/host/ohci-omap3.c  |   22 ++--
 22 files changed, 184 insertions(+), 168 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index d4e41ef..a991aeb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -653,11 +653,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 57,
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(ehci_pdata);
+   usb_ehci_init(usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, OMAP3430 3430SDP board)
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 6264564..03fd8ac 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -54,11 +54,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 126,
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(ehci_pdata);
+   usb_ehci_init(usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, OMAP 3630SDP board)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 07d1b20..1f59e8d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -251,10 +251,10 @@ static void __init omap_4430sdp_init_irq(void)
gic_init_irq();
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
-   .port_mode[0]   = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
-   .port_mode[2]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
+   .port_mode[0]   = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1]   = OMAP_USBHS_PORT_MODE_UNUSED,
+   .port_mode[2]   = OMAP_USBHS_PORT_MODE_UNUSED,
.phy_reset  = false,
.reset_gpio_port[0]  = -EINVAL,
.reset_gpio_port[1]  = -EINVAL,
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(ehci_pdata);
+   usb_ehci_init(usbhs_bdata);
 

[PATCH 06/10 v1] arm: omap: usb: usbhs core device initialization

2011-02-28 Thread Keshava Munegowda
A new usbhs platform device is defined;
this device will be the parent device of ehci and
ohci platform devices. the usbhs_init function
is defined which does the usbhs device initialization
and I/O mux of ehci and ohci.

Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com
---
 arch/arm/mach-omap2/usb-host.c|  196 ++---
 arch/arm/plat-omap/include/plat/usb.h |2 +
 2 files changed, 184 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index b04ce6f..19cf0d6 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -6,6 +6,7 @@
  *
  * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita vikram.pand...@ti.com
+ * Author: Keshava Munegowda keshava_mgo...@ti.com
  *
  * Generalization by:
  * Felipe Balbi ba...@ti.com
@@ -19,7 +20,7 @@
 #include linux/errno.h
 #include linux/delay.h
 #include linux/platform_device.h
-#include linux/clk.h
+#include linux/slab.h
 #include linux/dma-mapping.h
 
 #include asm/io.h
@@ -30,7 +31,7 @@
 
 #include mux.h
 
-#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
+#ifdef CONFIG_MFD_OMAP_USB_HOST
 
 static struct resource ehci_resources[] = {
{
@@ -361,17 +362,6 @@ void __init usb_ehci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
-#else
-
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-
-{
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-
 static struct resource ohci_resources[] = {
{
.name   = ohci,
@@ -508,6 +498,77 @@ static void setup_ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
+static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
+{
+   switch (port_mode[0]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal(usbb1_mm_rxdp,
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal(usbb1_mm_rxdm,
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal(usbb1_mm_rxrcv,
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal(usbb1_mm_txen,
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal(usbb1_mm_txdat,
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal(usbb1_mm_txse0,
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+
+   switch (port_mode[1]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal(usbb2_mm_rxdp,
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal(usbb2_mm_rxdm,
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal(usbb2_mm_rxrcv,
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal(usbb2_mm_txen,
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal(usbb2_mm_txdat,
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal(usbb2_mm_txse0,
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+}
+
 void __init usb_ohci_init(const struct usbhs_omap_board_data *pdata)
 {
platform_device_add_data(ohci_device, pdata, sizeof(*pdata));
@@ -522,10 +583,117 @@ void __init usb_ohci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
+#define OMAP_USBHS_DEVICE  usbhs-omap
+
+static struct resource usbhs_resources[] = {
+   {
+   .name   = uhh,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .name   = tll,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .name   = ehci,
+   .flags  = IORESOURCE_MEM,
+  

[PATCH 02/10 v1] usb: host: omap: switch to platform_get_resource_byname

2011-02-28 Thread Keshava Munegowda
From: Felipe Balbi ba...@ti.com

now that we have names on all memory bases, we can
switch to use platform_get_resource_byname() which
will make it simpler when we move to a setup where
OHCI and EHCI on OMAP play well together.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/host/ehci-omap.c  |6 +++---
 drivers/usb/host/ohci-omap3.c |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index f784ceb..37cf12b 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -813,7 +813,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap-ehci  = hcd_to_ehci(hcd);
omap-ehci-sbrn= 0x20;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, ehci);
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
@@ -829,7 +829,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap-ehci-caps = hcd-regs;
omap-ehci_base = hcd-regs;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, uhh);
omap-uhh_base = ioremap(res-start, resource_size(res));
if (!omap-uhh_base) {
dev_err(pdev-dev, UHH ioremap failed\n);
@@ -837,7 +837,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, tll);
omap-tll_base = ioremap(res-start, resource_size(res));
if (!omap-tll_base) {
dev_err(pdev-dev, TLL ioremap failed\n);
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index a37d599..32f56bb 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -618,7 +618,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
omap-es2_compatibility = pdata-es2_compatibility;
omap-ohci  = hcd_to_ohci(hcd);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, ohci);
 
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
@@ -630,7 +630,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, uhh);
omap-uhh_base = ioremap(res-start, resource_size(res));
if (!omap-uhh_base) {
dev_err(pdev-dev, UHH ioremap failed\n);
@@ -638,7 +638,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, tll);
omap-tll_base = ioremap(res-start, resource_size(res));
if (!omap-tll_base) {
dev_err(pdev-dev, TLL ioremap failed\n);
-- 
1.6.0.4

--
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] perf: add OMAP support for the new power events

2011-02-28 Thread Jean Pihet
Hi Kevin,

Can you please check this patch? From the previous discussions I
understood it was OK.
This one has been submitted to and l-o and l-a-k MLs. How will this
one be merged in?

Thanks,
Jean

On Mon, Feb 21, 2011 at 9:53 AM, Santosh Shilimkar
santosh.shilim...@ti.com wrote:
 -Original Message-
 From: Jean Pihet [mailto:jean.pi...@newoldbits.com]
 Sent: Monday, February 21, 2011 2:14 PM
 To: Santosh Shilimkar
 Cc: Kevin Hilman; Thomas Renninger; linux-omap@vger.kernel.org;
 linux-arm-ker...@lists.infradead.org; Jean Pihet-XID
 Subject: Re: [PATCH] perf: add OMAP support for the new power events

 Hi Santosh,


 [...]

  diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-
  omap2/pm34xx.c
  index 2f864e4..d1cc3f4 100644
  --- a/arch/arm/mach-omap2/pm34xx.c
  +++ b/arch/arm/mach-omap2/pm34xx.c
  @@ -29,6 +29,7 @@
   #include linux/delay.h
   #include linux/slab.h
   #include linux/console.h
  +#include trace/events/power.h
 
   #include plat/sram.h
   #include clockdomain.h
  @@ -519,8 +520,14 @@ static void omap3_pm_idle(void)
        if (omap_irq_pending() || need_resched())
                goto out;
 
  +     trace_power_start(POWER_CSTATE, 1, smp_processor_id());
  +     trace_cpu_idle(1, smp_processor_id());
  +
 
  This default idle code won't be used when you enable the
  CONFIG_CPUIDLE. That case the cpuidle34xx.c idle code gets
  registered.
 That is correct. OMAP has a default idle handler (omap3_pm_idle) and
 a
 cpuidle handler (omap3_enter_idle in
 arch/arm/mach-omap2/cpuidle34xx.c).

  Shouldn't you patch that code instead? This is more or less
  dead code and it is just like default idle code when idle
  drivers isn't registered.
 The cpuidle framework already is instrumented in a generic way. This
 code adds the instrumentation to the default idle handler so that
 all
 cases are covered. BTW the patch description gives that information.

 If there is dead code then it is not only the code from this patch
 but
 all the code for the default idle handler.

 I read your change log. It says.

 The trace points are for:
 - default idle handler. Since the cpuidle framework is
   instrumented in the generic way there is no need to
   add trace points in the OMAP specific cpuidle handler;
 Now code in cpuilde34xx.c is also OMAP specific and hence the
 confusion at least for me.
 Regarding dead code, I meant existing code of default handler.

 Thanks for clarification.

 Regards,
 Santosh

--
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/3] OMAP PM: implement the wake-up latency constraints using PM QOS

2011-02-28 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

Use the PM QOS framework to set wake-up latency constraints on the MPU and DMA.
Cpuidle for OMAP34xx uses PM QOS to retreive the strongest constraint and to
determine the next state for the MPU and CORE power domains.

As of today only I2C is requesting a constraint, but every omap_device
should be able to do so.

Note: To be replaced by a more generic solution which allows every
 device to put a constraint, and which can control all power
 domains in the system. This solution is currently under
 investigation.

Jean Pihet (3):
  OMAP PM: create a PM layer plugin for the devices wakeup latency
constraints
  OMAP: implement MPU and DMA wake-up constraints using PM_QOS
  OMAP: use PM QOS for wake-up constraints from I2C

 arch/arm/plat-omap/Kconfig|7 +
 arch/arm/plat-omap/Makefile   |1 +
 arch/arm/plat-omap/i2c.c  |   22 ++-
 arch/arm/plat-omap/include/plat/omap-pm.h |   96 ---
 arch/arm/plat-omap/include/plat/omap_device.h |1 +
 arch/arm/plat-omap/omap-pm-constraints.c  |  349 +
 arch/arm/plat-omap/omap-pm-noop.c |   70 +++---
 7 files changed, 469 insertions(+), 77 deletions(-)
 create mode 100644 arch/arm/plat-omap/omap-pm-constraints.c

-- 
1.7.2.3

--
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/3] OMAP PM: create a PM layer plugin for the devices wakeup latency constraints

2011-02-28 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

Created arch/arm/plat-omap/omap-pm-constraints.c file from
arch/arm/plat-omap/omap-pm-noop.c and the associated Kconfig option
OMAP_PM_CONSTRAINTS.

Based on the original patch from Vishwanath,
cf. https://patchwork.kernel.org/patch/327312/

Cc: Vishwanath BS vishwanath...@ti.com

Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/plat-omap/Kconfig   |7 +
 arch/arm/plat-omap/Makefile  |1 +
 arch/arm/plat-omap/omap-pm-constraints.c |  363 ++
 3 files changed, 371 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/omap-pm-constraints.c

diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index b6333ae..b8f51e3 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -215,6 +215,13 @@ config OMAP_PM_NONE
 config OMAP_PM_NOOP
bool No-op/debug PM layer
 
+config OMAP_PM_CONSTRAINTS
+   depends on PM
+   bool OMAP PM layer implementation, devices wakeup latency constraints
+   help
+ Select this option to enable the PM layer plugin for
+ the devices wakeup latency constraints support
+
 endchoice
 
 endmenu
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index a4a1285..a293367 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -32,3 +32,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
 
 obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
+obj-$(CONFIG_OMAP_PM_CONSTRAINTS) += omap-pm-constraints.o
diff --git a/arch/arm/plat-omap/omap-pm-constraints.c 
b/arch/arm/plat-omap/omap-pm-constraints.c
new file mode 100644
index 000..c8b4e4c
--- /dev/null
+++ b/arch/arm/plat-omap/omap-pm-constraints.c
@@ -0,0 +1,363 @@
+/*
+ * omap-pm.c - OMAP power management interface
+ *
+ * This code implements the OMAP power management interface to
+ * drivers, CPUIdle, CPUFreq, and DSP Bridge.
+ *
+ * Copyright (C) 2008-2009 Texas Instruments, Inc.
+ * Copyright (C) 2008-2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * Interface developed by (in alphabetical order):
+ * Karthik Dasu, Tony Lindgren, Jean Pihet, Rajendra Nayak, Sakari Poussa,
+ * Veeramanikandan Raju, Anand Sawant, Igor Stoppa, Paul Walmsley,
+ * Richard Woodruff
+ */
+
+#undef DEBUG
+
+#include linux/init.h
+#include linux/cpufreq.h
+#include linux/device.h
+#include linux/platform_device.h
+
+/* Interface documentation is in mach/omap-pm.h */
+#include plat/omap-pm.h
+#include plat/omap_device.h
+
+static bool off_mode_enabled;
+static u32 dummy_context_loss_counter;
+
+/*
+ * Device-driver-originated constraints (via board-*.c files)
+ */
+
+int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)
+{
+   if (!dev || t  -1) {
+   WARN(1, OMAP PM: %s: invalid parameter(s), __func__);
+   return -EINVAL;
+   };
+
+   if (t == -1)
+   pr_debug(OMAP PM: remove max MPU wakeup latency constraint: 
+dev %s\n, dev_name(dev));
+   else
+   pr_debug(OMAP PM: add max MPU wakeup latency constraint: 
+dev %s, t = %ld usec\n, dev_name(dev), t);
+
+   /*
+* For current Linux, this needs to map the MPU to a
+* powerdomain, then go through the list of current max lat
+* constraints on the MPU and find the smallest.  If
+* the latency constraint has changed, the code should
+* recompute the state to enter for the next powerdomain
+* state.
+*
+* TI CDP code can call constraint_set here.
+*/
+
+   return 0;
+}
+
+int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r)
+{
+   if (!dev || (agent_id != OCP_INITIATOR_AGENT 
+   agent_id != OCP_TARGET_AGENT)) {
+   WARN(1, OMAP PM: %s: invalid parameter(s), __func__);
+   return -EINVAL;
+   };
+
+   if (r == 0)
+   pr_debug(OMAP PM: remove min bus tput constraint: 
+dev %s for agent_id %d\n, dev_name(dev), agent_id);
+   else
+   pr_debug(OMAP PM: add min bus tput constraint: 
+dev %s for agent_id %d: rate %ld KiB\n,
+dev_name(dev), agent_id, r);
+
+   /*
+* This code should model the interconnect and compute the
+* required clock frequency, convert that to a VDD2 OPP ID, then
+* set the VDD2 OPP appropriately.
+*
+* TI CDP code can call constraint_set here on the VDD2 OPP.
+*/
+
+   return 0;
+}
+
+int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
+  long t)
+{
+   if (!req_dev || !dev || t  -1) {
+   WARN(1, OMAP PM: %s: invalid parameter(s), __func__);
+   return -EINVAL;
+   };
+
+   if (t == -1)
+   pr_debug(OMAP PM: remove max device latency 

[PATCH 2/3] OMAP: implement MPU and DMA wake-up constraints using PM_QOS

2011-02-28 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

Implement the wake-up constraints using the PM QOS API.

Due to the nature of PM QOS only the MPU and DMA constraints
can be used.
Due to the implementation of cpuidle on OMAP34xx
(in arch/arm/mach-omap2/cpuidle34xx.c) only the global
C-states wakeup latencies are used to determine the next
state of the MPU and CORE power domains.

The PM QOS handle pointer is stored inside the omap_device structure
and so the patch only applies to OMAP devices.

To be replaced by a more generic solution which allows every
device to put a constraint, and which can control all power
domains in the system. This solution is currently under
investigation.

Based on the original patch from Vishwanath,
cf. https://patchwork.kernel.org/patch/327312/

Cc: Vishwanath BS vishwanath...@ti.com

Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/plat-omap/include/plat/omap-pm.h |   96 ++---
 arch/arm/plat-omap/include/plat/omap_device.h |1 +
 arch/arm/plat-omap/omap-pm-constraints.c  |   80 +
 arch/arm/plat-omap/omap-pm-noop.c |   70 +-
 4 files changed, 124 insertions(+), 123 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h 
b/arch/arm/plat-omap/include/plat/omap-pm.h
index c0a7520..7180473 100644
--- a/arch/arm/plat-omap/include/plat/omap-pm.h
+++ b/arch/arm/plat-omap/include/plat/omap-pm.h
@@ -18,6 +18,7 @@
 #include linux/cpufreq.h
 #include linux/clk.h
 #include linux/opp.h
+#include linux/pm_qos_params.h
 
 /*
  * agent_id values for use with omap_pm_set_min_bus_tput():
@@ -70,44 +71,6 @@ void omap_pm_if_exit(void);
  * Device-driver-originated constraints (via board-*.c files, platform_data)
  */
 
-
-/**
- * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency
- * @dev: struct device * requesting the constraint
- * @t: maximum MPU wakeup latency in microseconds
- *
- * Request that the maximum interrupt latency for the MPU to be no
- * greater than @t microseconds. Interrupt latency in this case is
- * defined as the elapsed time from the occurrence of a hardware or
- * timer interrupt to the time when the device driver's interrupt
- * service routine has been entered by the MPU.
- *
- * It is intended that underlying PM code will use this information to
- * determine what power state to put the MPU powerdomain into, and
- * possibly the CORE powerdomain as well, since interrupt handling
- * code currently runs from SDRAM.  Advanced PM or board*.c code may
- * also configure interrupt controller priorities, OCP bus priorities,
- * CPU speed(s), etc.
- *
- * This function will not affect device wakeup latency, e.g., time
- * elapsed from when a device driver enables a hardware device with
- * clk_enable(), to when the device is ready for register access or
- * other use.  To control this device wakeup latency, use
- * omap_pm_set_max_dev_wakeup_lat()
- *
- * Multiple calls to omap_pm_set_max_mpu_wakeup_lat() will replace the
- * previous t value.  To remove the latency target for the MPU, call
- * with t = -1.
- *
- * XXX This constraint will be deprecated soon in favor of the more
- * general omap_pm_set_max_dev_wakeup_lat()
- *
- * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
- * is not satisfiable, or 0 upon success.
- */
-int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
-
-
 /**
  * omap_pm_set_min_bus_tput - set minimum bus throughput needed by device
  * @dev: struct device * requesting the constraint
@@ -139,7 +102,6 @@ int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long 
t);
  */
 int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r);
 
-
 /**
  * omap_pm_set_max_dev_wakeup_lat - set the maximum device enable latency
  * @req_dev: struct device * requesting the constraint, or NULL if none
@@ -169,10 +131,53 @@ int omap_pm_set_min_bus_tput(struct device *dev, u8 
agent_id, unsigned long r);
 int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
   long t);
 
+/**
+ * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency
+ * @qos_request: handle for the constraint
+ * @t: maximum MPU wakeup latency in microseconds
+ *
+ * Request that the maximum interrupt latency for the MPU to be no
+ * greater than @t microseconds. Interrupt latency in this case is
+ * defined as the elapsed time from the occurrence of a hardware or
+ * timer interrupt to the time when the device driver's interrupt
+ * service routine has been entered by the MPU.
+ *
+ * It is intended that underlying PM code will use this information to
+ * determine what power state to put the MPU powerdomain into, and
+ * possibly the CORE powerdomain as well, since interrupt handling
+ * code currently runs from SDRAM.  Advanced PM or board*.c code may
+ * also configure interrupt controller priorities, OCP bus priorities,
+ * CPU speed(s), etc.
+ *
+ * This function will not 

[PATCH 3/3] OMAP: use PM QOS for wake-up constraints from I2C

2011-02-28 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

Implements the PM QOS API for the wake-up constraints on the MPU.

Note: the caller shall allocate and store the PM QOS handle for future use
(update/removal of the constraint).

Based on the original patch from Vishwanath,
cf. https://patchwork.kernel.org/patch/327312/

Cc: Vishwanath BS vishwanath...@ti.com

Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/plat-omap/i2c.c |   22 +-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 3341ca4..207a320 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -117,10 +117,15 @@ static inline int omap1_i2c_add_bus(int bus_id)
  * XXX This function is a temporary compatibility wrapper - only
  * needed until the I2C driver can be converted to call
  * omap_pm_set_max_dev_wakeup_lat() and handle a return code.
+ *
+ * The PM QOS handle is stored in the corresponding omap_device struct.
  */
 static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
 {
-   omap_pm_set_max_mpu_wakeup_lat(dev, t);
+   struct omap_device *od = to_omap_device(to_platform_device(dev));
+
+   if (od-pm_qos_request)
+   omap_pm_set_max_mpu_wakeup_lat(od-pm_qos_request, t);
 }
 
 static struct omap_device_pm_latency omap_i2c_latency[] = {
@@ -160,11 +165,26 @@ static inline int omap2_i2c_add_bus(int bus_id)
 */
if (cpu_is_omap34xx())
pdata-set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
+
od = omap_device_build(name, bus_id, oh, pdata,
sizeof(struct omap_i2c_bus_platform_data),
omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
WARN(IS_ERR(od), Could not build omap_device for %s\n, name);
 
+   /* Allocate the PM QOS handle and initialize it */
+   if ((!(IS_ERR(od)))  cpu_is_omap34xx()) {
+   od-pm_qos_request = kzalloc(sizeof(struct pm_qos_request_list),
+  GFP_KERNEL);
+   if (od-pm_qos_request) {
+   pm_qos_add_request(od-pm_qos_request,
+  PM_QOS_CPU_DMA_LATENCY,
+  PM_QOS_DEFAULT_VALUE);
+   } else {
+   WARN(1, %s: could not reserve memory for 
+pm_qos_request\n, __func__);
+   }
+   }
+
return PTR_ERR(od);
 }
 #else
-- 
1.7.2.3

--
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 v3 2/5] ARM: pm: add generic CPU suspend/resume support

2011-02-28 Thread Santosh Shilimkar
+ linux-omap on this thread.

 -Original Message-
 From: Santosh Shilimkar [mailto:santosh.shilim...@ti.com]
 Sent: Saturday, February 12, 2011 8:40 PM
 To: Russell King - ARM Linux
 Cc: Colin Cross; Kukjin Kim; saeed bishara; linux-arm-
 ker...@lists.infradead.org
 Subject: RE: [PATCH v3 2/5] ARM: pm: add generic CPU suspend/resume
 support

  -Original Message-
  From: Russell King - ARM Linux [mailto:li...@arm.linux.org.uk]
  Sent: Saturday, February 12, 2011 8:20 PM
  To: Santosh Shilimkar
  Cc: Colin Cross; Kukjin Kim; saeed bishara; linux-arm-
  ker...@lists.infradead.org
  Subject: Re: [PATCH v3 2/5] ARM: pm: add generic CPU
 suspend/resume
  support
 
  On Fri, Feb 11, 2011 at 05:37:04PM +0530, Santosh Shilimkar wrote:
   There is a Monitor secure API, needs to be called from non-
 secure
   software to set this diagnostic registers in resume path.
 
  It would be an idea to get the OMAP sleep code up to date so that
 I
  can
  look at OMAPs requirements for this to be useful.
 
  As the current code stands, I don't see any reason why the
 sleep34xx
  code
  can't use this infrastructure, but I'm loathed to start modifying
  that if there's outstanding code changes in that area.

 Yep. There are few issues out there with sleep34xx code.
   - Secure APIs
   - Current code needs to be cleaned up to remove
   unwanted registers save restore
   - Some part of the code on OMAP3 must be run from
   SRAM. It can't run from DDR
   - AUXCTLR, Diagnostic registers aren't accessible
   in secure mode.
   - L2 cache needs to be handled with secure APIs.
   - Code sequence needs to handle errata's handling
   which accesses OMAP PM registers.

 Few of the above are getting addressed for this merge window.

 So my plan was to take a look at generic suspend after the
 merge window. By that time your generic stuff and omap
 cleanup would have got merged hopefully.

 Regards,
 Santosh
--
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] cbus-retu: Add locking around register access in irq handler

2011-02-28 Thread Felipe Balbi
On Mon, Feb 28, 2011 at 05:06:08PM +0100, Michael Buesch wrote:
 This adds locking around the register access in the
 interrupt service routine.
 
 Signed-off-by: Michael Buesch m...@bu3sch.de
 Reported-by: Felipe Balbi ba...@ti.com

Fine by me. Tony, you can apply.

-- 
balbi
--
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 00/10 v1] EHCI and OHCI patches of OMAP3 and OMAP4

2011-02-28 Thread Felipe Balbi
On Mon, Feb 28, 2011 at 10:01:42PM +0530, Keshava Munegowda wrote:
 this is how it EHCI/OHCI code re oraganize look like:
   . we have EHCI and OHCI be children of a usbhs core driver
   which will take care of all accesses to
   UHH and TLL bases. 
 
   . we pass enable/disable functions down from EHCI and OHCI drivers.
   to USBHS driver.
 
   . UHH and TLL power management will eventually move to
   omap-usb-host.c

Anand, I'm not taking this directly. I need a pull request from you in
order for me to send a pull request to Greg. Bear in mind we have little
time for this merge window, I'll wait until tomorrow and if I have no
reply, this won't be going into this merge window. Sorry but I also have
other MUSB patches which will be waiting until tomorrow due to these
EHCI/OHCI patches.

Greg, I'll be sending a pull request for you tomorrow with or without
these patches.

-- 
balbi
--
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


Nokia n810 LCD (MIPID/blizzard) on 2.6.38

2011-02-28 Thread Michael Buesch
The n810 LCD does not work on the 2.6.38(-rc6) kernel
due to changes in the OMAP GPIO-hwmod code.

The hwmod code performs a soft-reset on the GPIO
module. The first GPIO module carries the MIPID
nreset line, which is toggled due to the hwmod soft reset.
This resets Blizzard and breaks it, because
it assumes the LCD was left in the state that the
bootloader initialized it to:

if (!(blizzard_read_reg(BLIZZARD_PLL_DIV)  0x80)) {
dev_err(fbdev-dev,
  controller not initialized by the bootloader\n);
r = -ENODEV;
goto err3;
}

My temporary workaround to this issue is to disable
soft reset for the first GPIO module:

static struct omap_hwmod omap2420_gpio1_hwmod = {
.name   = gpio1,
.flags  = HWMOD_INIT_NO_RESET, /* Workaround: Don't 
reset the n810 MIPID */

I'm wondering if a better fix suitable for the mainline
kernel inclusion could be found.
Any ideas?

-- 
Greetings, Michael.




--
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/9] OMAP2+: hwmod/clockevent: allow hwmods to be set up individually

2011-02-28 Thread Paul Walmsley
Hello,

This series adds the ability to set up (formerly known
as late-initialize) individual hwmods, rather than doing them
all at once.  The goal here is for clockevent (and eventually
clocksource) hwmods to be set up right before they are needed, in
the timer init code.  Then omap_hwmod_setup_all(), which
sets up the rest of the hwmods, is intended to run as an
initcall -- much later in the boot process.

This series includes the OMAP2/3 hwmod data for the GPTIMERs that
Tarun posted earlier.  This data is necessary for this new code
to avoid warnings during boot.

Boot-tested on OMAP34xx Beagleboard and OMAP4430ES2 Panda.
Applies on Tony's 7cab8713b1ed0dab08ad6458f92a40b7ff4be619
(Merge branch 'for-tony' of
git://gitorious.org/linux-omap-dss2/linux into omap-for-linus)


- Paul

---

hwmod_clockevent_2.6.39
   textdata bss dec hex filename
5781261  484056 5598712 11864029 b507dd vmlinux.omap2plus_defconfig.orig
5785233  491096 5598680 11875009 b532c1 vmlinux.omap2plus_defconfig

Paul Walmsley (6):
  OMAP2+: hwmod: allow multiple calls to omap_hwmod_init()
  OMAP2+: hwmod: rename some init functions
  OMAP2+: hwmod: find MPU initiator hwmod during in _register()
  OMAP2+: hwmod: ignore attempts to re-setup a hwmod
  OMAP2+: hwmod: add ability to setup individual hwmods
  OMAP2+: clockevent: set up GPTIMER clockevent hwmod right before timer 
init

Thara Gopinath (3):
  OMAP2420: hwmod data: add dmtimer
  OMAP2430: hwmod data: add dmtimer
  OMAP3: hwmod data: add dmtimer


 arch/arm/mach-omap2/omap_hwmod.c |  154 --
 arch/arm/mach-omap2/omap_hwmod_2420_data.c   |  636 +
 arch/arm/mach-omap2/omap_hwmod_2430_data.c   |  635 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c   |  651 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c   |2 
 arch/arm/mach-omap2/serial.c |2 
 arch/arm/mach-omap2/timer-gp.c   |7 
 arch/arm/plat-omap/include/plat/dmtimer.h|   11 
 arch/arm/plat-omap/include/plat/omap_hwmod.h |9 
 9 files changed, 2045 insertions(+), 62 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 3/9] OMAP3: hwmod data: add dmtimer

2011-02-28 Thread Paul Walmsley
From: Thara Gopinath th...@ti.com

Add dmtimer data.

Signed-off-by: Thara Gopinath th...@ti.com
Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
Acked-by: Benoit Cousson b-cous...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  649 
 1 files changed, 649 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index e9d0012..b8776ee 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -24,6 +24,7 @@
 #include plat/gpio.h
 #include plat/smartreflex.h
 #include plat/mcspi.h
+#include plat/dmtimer.h
 
 #include omap_hwmod_common_data.h
 
@@ -515,6 +516,640 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
+/* timer class */
+static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .syss_offs  = 0x0014,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
+   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+   SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = {
+   .name = timer,
+   .sysc = omap3xxx_timer_1ms_sysc,
+   .rev = OMAP_TIMER_IP_VERSION_1,
+};
+
+static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .syss_offs  = 0x0014,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
+  SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
+   .name = timer,
+   .sysc = omap3xxx_timer_sysc,
+   .rev =  OMAP_TIMER_IP_VERSION_1,
+};
+
+/* timer1 */
+static struct omap_hwmod omap3xxx_timer1_hwmod;
+static struct omap_hwmod_irq_info omap3xxx_timer1_mpu_irqs[] = {
+   { .irq = 37, },
+};
+
+static struct omap_hwmod_addr_space omap3xxx_timer1_addrs[] = {
+   {
+   .pa_start   = 0x48318000,
+   .pa_end = 0x48318000 + SZ_1K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_wkup - timer1 */
+static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__timer1 = {
+   .master = omap3xxx_l4_wkup_hwmod,
+   .slave  = omap3xxx_timer1_hwmod,
+   .clk= gpt1_ick,
+   .addr   = omap3xxx_timer1_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_timer1_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* timer1 slave port */
+static struct omap_hwmod_ocp_if *omap3xxx_timer1_slaves[] = {
+   omap3xxx_l4_wkup__timer1,
+};
+
+/* timer1 hwmod */
+static struct omap_hwmod omap3xxx_timer1_hwmod = {
+   .name   = timer1,
+   .mpu_irqs   = omap3xxx_timer1_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap3xxx_timer1_mpu_irqs),
+   .main_clk   = gpt1_fck,
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP3430_EN_GPT1_SHIFT,
+   .module_offs = WKUP_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP3430_ST_GPT1_SHIFT,
+   },
+   },
+   .slaves = omap3xxx_timer1_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap3xxx_timer1_slaves),
+   .class  = omap3xxx_timer_1ms_hwmod_class,
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
+};
+
+/* timer2 */
+static struct omap_hwmod omap3xxx_timer2_hwmod;
+static struct omap_hwmod_irq_info omap3xxx_timer2_mpu_irqs[] = {
+   { .irq = 38, },
+};
+
+static struct omap_hwmod_addr_space omap3xxx_timer2_addrs[] = {
+   {
+   .pa_start   = 0x49032000,
+   .pa_end = 0x49032000 + SZ_1K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_per - timer2 */
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer2 = {
+   .master = omap3xxx_l4_per_hwmod,
+   .slave  = omap3xxx_timer2_hwmod,
+   .clk= gpt2_ick,
+   .addr   = omap3xxx_timer2_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_timer2_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* timer2 slave port */
+static struct omap_hwmod_ocp_if *omap3xxx_timer2_slaves[] = {
+   omap3xxx_l4_per__timer2,
+};
+
+/* timer2 hwmod */
+static struct omap_hwmod omap3xxx_timer2_hwmod = {
+   .name   = timer2,
+   .mpu_irqs   = omap3xxx_timer2_mpu_irqs,
+ 

[PATCH v2 7/9] OMAP2+: hwmod: ignore attempts to re-setup a hwmod

2011-02-28 Thread Paul Walmsley
Previously, if a hwmod had already been set up, and the code attempted
to set up the hwmod again, an error would be returned.  This is not
really useful behavior if we wish to allow the OMAP core code to setup
the hwmods needed for the Linux clocksources and clockevents before
the rest of the hwmods are setup.  So, instead of generating errors,
just ignore the attempt to re-setup the hwmod.

Signed-off-by: Paul Walmsley p...@pwsan.com
Cc: Benoît Cousson b-cous...@ti.com
Cc: Kevin Hilman khil...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c |   19 +++
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e4c934b..43aa894 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -902,17 +902,15 @@ static struct omap_hwmod *_lookup(const char *name)
  * @data: not used; pass NULL
  *
  * Called by omap_hwmod_setup_all() (after omap2_clk_init()).
- * Resolves all clock names embedded in the hwmod.  Returns -EINVAL if
- * the omap_hwmod has not yet been registered or if the clocks have
- * already been initialized, 0 on success, or a non-zero error on
- * failure.
+ * Resolves all clock names embedded in the hwmod.  Returns 0 on
+ * success, or a negative error code on failure.
  */
 static int _init_clocks(struct omap_hwmod *oh, void *data)
 {
int ret = 0;
 
-   if (!oh || (oh-_state != _HWMOD_STATE_REGISTERED))
-   return -EINVAL;
+   if (oh-_state != _HWMOD_STATE_REGISTERED)
+   return 0;
 
pr_debug(omap_hwmod: %s: looking up clocks\n, oh-name);
 
@@ -1351,14 +1349,16 @@ static int _shutdown(struct omap_hwmod *oh)
  * @oh: struct omap_hwmod *
  *
  * Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh
- * OCP_SYSCONFIG register.  Returns -EINVAL if the hwmod is in the
- * wrong state or returns 0.
+ * OCP_SYSCONFIG register.  Returns 0.
  */
 static int _setup(struct omap_hwmod *oh, void *data)
 {
int i, r;
u8 postsetup_state;
 
+   if (oh-_state != _HWMOD_STATE_CLKS_INITED)
+   return 0;
+
/* Set iclk autoidle mode */
if (oh-slaves_cnt  0) {
for (i = 0; i  oh-slaves_cnt; i++) {
@@ -1621,6 +1621,9 @@ int __init omap_hwmod_register(struct omap_hwmod **ohs)
  */
 static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data)
 {
+   if (oh-_state != _HWMOD_STATE_REGISTERED)
+   return 0;
+
if (oh-_int_flags  _HWMOD_NO_MPU_PORT)
return 0;
 


--
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 9/9] OMAP2+: clockevent: set up GPTIMER clockevent hwmod right before timer init

2011-02-28 Thread Paul Walmsley
Set up the GPTIMER hwmod used for the clockevent source immediately
before it is used.  This avoids the need to set up all of the hwmods
until the boot process is further along.  (In general, we want to defer
as much as possible until late in the boot process.)

This second version fixes a bug pointed out by Santosh Shilimkar
santosh.shilim...@ti.com, that would cause the kernel to use an
incorrect timer hwmod name if the selected GPTIMER was not 1 or 12 -
thanks Santosh.  Also, Tarun Kanti DebBarma tarun.ka...@ti.com
pointed out that the original patch did not apply cleanly; this has
now been fixed.

Signed-off-by: Paul Walmsley p...@pwsan.com
Cc: Benoît Cousson b-cous...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Kevin Hilman khil...@ti.com
Cc: Santosh Shilimkar santosh.shilim...@ti.com
Acked-by: Santosh Shilimkar santosh.shilim...@ti.com
Cc: Tarun Kanti DebBarma tarun.ka...@ti.com
---
 arch/arm/mach-omap2/timer-gp.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 7b7c268..fb8d656 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -39,10 +39,11 @@
 #include asm/mach/time.h
 #include plat/dmtimer.h
 #include asm/localtimer.h
+#include plat/common.h
+#include plat/omap_hwmod.h
 
 #include timer-gp.h
 
-#include plat/common.h
 
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID 12
@@ -132,9 +133,13 @@ static void __init omap2_gp_clockevent_init(void)
 {
u32 tick_rate;
int src;
+   char clockevent_hwmod_name[8]; /* 8 = sizeof(timerXX0) */
 
inited = 1;
 
+   sprintf(clockevent_hwmod_name, timer%d, gptimer_id);
+   omap_hwmod_setup_one(clockevent_hwmod_name);
+
gptimer = omap_dm_timer_request_specific(gptimer_id);
BUG_ON(gptimer == NULL);
gptimer_wakeup = gptimer;


--
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   >