Re: [PATCH v1 01/27] usb: musb: introduce get_hw_revision callback in glue ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 22, 2010 at 12:14:29AM +0800, tom.leiming@xxxxxxxxx wrote:
From: Ming Lei <tom.leiming@xxxxxxxxx>

This patch introduces get_hw_revision callback in glue_ops,
and implement it in tusb glue driver, so tusb dma code can
get tusb revision via .get_hw_revision callback and we can
make glue drivers built as module easyly in later patches.

Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
---
drivers/usb/musb/musb_core.h     |   11 +++++++++++
drivers/usb/musb/tusb6010.c      |    2 ++
drivers/usb/musb/tusb6010_omap.c |    2 +-
3 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index d0c236f..2818057 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -259,6 +259,7 @@ enum musb_g_ep0_state {
 * @exit:	undoes @init
 * @set_mode:	forcefully changes operating mode
 * @try_ilde:	tries to idle the IP
+ * @get_hw_revision: get hardware revision
 * @vbus_status: returns vbus status if possible
 * @set_vbus:	forces vbus status
 */
@@ -272,6 +273,8 @@ struct musb_platform_ops {
	int	(*set_mode)(struct musb *musb, u8 mode);
	void	(*try_idle)(struct musb *musb, unsigned long timeout);

+	u8  (*get_hw_revision)(struct musb *musb);
+
	int	(*vbus_status)(struct musb *musb);
	void	(*set_vbus)(struct musb *musb, int on);
};
@@ -651,4 +654,12 @@ static inline int musb_platform_exit(struct musb *musb)
	return musb->ops->exit(musb);
}

+static inline u8 musb_platform_get_hw_revision(struct musb *musb)
+{
+	if (!musb->ops->get_hw_revision)
+		return 0;
+
+	return musb->ops->get_hw_revision(musb);
+}

This is wrong. There's a generic way of reading MUSB's revision:

hwvers = musb_readw(musb->mregs, MUSB_HWVERS);

So, if platform doesn't implement get_hw_revision(), you could fallback
to the generic way.

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux