diff mbox

[1/2] DA8xx: OHCI platform device (take 3)

Message ID 200909252314.02619.sshtylyov@ru.mvista.com (mailing list archive)
State Superseded
Headers show

Commit Message

Sergei Shtylyov Sept. 25, 2009, 7:14 p.m. UTC
Add the function to register the OHCI platform device, given the root hub
related platform data passed from the board  specific code.  The platfrom
data provide for overriding the OHCI port power and over-current bits at
the board level.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
The patch is against the recent DaVinci tree...

Changes since the previous take:
- moved the USB 2.0 clock entry change to another patch;
- moved the OHCI platform devices from devices-da8xx.c to usb.c...

 arch/arm/mach-davinci/include/mach/da8xx.h |    2 +
 arch/arm/mach-davinci/include/mach/usb.h   |   20 ++++++++++++++++
 arch/arm/mach-davinci/usb.c                |   36 ++++++++++++++++++++++++++++-
 3 files changed, 57 insertions(+), 1 deletion(-)

Comments

Kevin Hilman Sept. 28, 2009, 11:17 p.m. UTC | #1
Sergei Shtylyov <sshtylyov@ru.mvista.com> writes:

> Add the function to register the OHCI platform device, given the root hub
> related platform data passed from the board  specific code.  The platfrom
> data provide for overriding the OHCI port power and over-current bits at
> the board level.
>
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

This generates compiler warnings...

> ---
> The patch is against the recent DaVinci tree...
>
> Changes since the previous take:
> - moved the USB 2.0 clock entry change to another patch;
> - moved the OHCI platform devices from devices-da8xx.c to usb.c...
>
>  arch/arm/mach-davinci/include/mach/da8xx.h |    2 +
>  arch/arm/mach-davinci/include/mach/usb.h   |   20 ++++++++++++++++
>  arch/arm/mach-davinci/usb.c                |   36 ++++++++++++++++++++++++++++-
>  3 files changed, 57 insertions(+), 1 deletion(-)
>
> Index: linux-davinci/arch/arm/mach-davinci/include/mach/da8xx.h
> ===================================================================
> --- linux-davinci.orig/arch/arm/mach-davinci/include/mach/da8xx.h
> +++ linux-davinci/arch/arm/mach-davinci/include/mach/da8xx.h
> @@ -19,6 +19,7 @@
>  #include <mach/emac.h>
>  #include <mach/asp.h>
>  #include <mach/mmc.h>
> +#include <mach/usb.h>
>  
>  extern void __iomem *da8xx_syscfg_base;
>  
> @@ -80,6 +81,7 @@ int da8xx_cppi41_init(void);
>  int da8xx_register_edma(void);
>  int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
>  int da8xx_register_watchdog(void);
> +int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
>  int da8xx_register_emac(void);
>  int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
>  int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
> Index: linux-davinci/arch/arm/mach-davinci/include/mach/usb.h
> ===================================================================
> --- linux-davinci.orig/arch/arm/mach-davinci/include/mach/usb.h
> +++ linux-davinci/arch/arm/mach-davinci/include/mach/usb.h
> @@ -34,4 +34,24 @@
>  #define CFGCHIP2_REFFREQ_24MHZ	(2 << 0)
>  #define CFGCHIP2_REFFREQ_48MHZ	(3 << 0)
>  
> +struct	da8xx_ohci_root_hub;
> +
> +typedef void (*da8xx_ocic_handler_t)(struct da8xx_ohci_root_hub *hub,
> +				     unsigned port);
> +
> +/* Passed as the platform data to the OHCI driver */
> +struct	da8xx_ohci_root_hub {
> +	/* Switch the port power on/off */
> +	int	(*set_power)(unsigned port, int on);
> +	/* Read the port power status */
> +	int	(*get_power)(unsigned port);
> +	/* Read the port over-current indicator */
> +	int	(*get_oci)(unsigned port);
> +	/* Over-current indicator change notification (pass NULL to disable) */
> +	int	(*ocic_notify)(da8xx_ocic_handler_t handler);
> +
> +	/* Time from power on to power good (in 2 ms units) */
> +	u8	potpgt;
> +};
> +
>  #endif	/* ifndef __ASM_ARCH_USB_H */
> Index: linux-davinci/arch/arm/mach-davinci/usb.c
> ===================================================================
> --- linux-davinci.orig/arch/arm/mach-davinci/usb.c
> +++ linux-davinci/arch/arm/mach-davinci/usb.c
> @@ -15,7 +15,8 @@
>  #include <mach/irqs.h>
>  #include <mach/cputype.h>

#include <mach/usb.h> needed here for 'struct da8xx_ohci_root_hub' define.

I'll fix up before pushing.

Kevin

>  
> -#define DAVINCI_USB_OTG_BASE 0x01C64000
> +#define DAVINCI_USB_OTG_BASE	0x01c64000
> +#define DA8XX_USB1_BASE 	0x01e25000
>  
>  #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
>  static struct musb_hdrc_eps_bits musb_eps[] = {
> @@ -108,3 +109,36 @@ void __init setup_usb(unsigned mA, unsig
>  
>  #endif  /* CONFIG_USB_MUSB_HDRC */
>  
> +#ifdef	CONFIG_ARCH_DAVINCI_DA8XX
> +static struct resource da8xx_usb11_resources[] = {
> +	[0] = {
> +		.start	= DA8XX_USB1_BASE,
> +		.end	= DA8XX_USB1_BASE + SZ_4K - 1,
> +		.flags	= IORESOURCE_MEM,
> +	},
> +	[1] = {
> +		.start	= IRQ_DA8XX_IRQN,
> +		.end	= IRQ_DA8XX_IRQN,
> +		.flags	= IORESOURCE_IRQ,
> +	},
> +};
> +
> +static u64 da8xx_usb11_dma_mask = DMA_BIT_MASK(32);
> +
> +static struct platform_device da8xx_usb11_device = {
> +	.name		= "ohci",
> +	.id		= 0,
> +	.dev = {
> +		.dma_mask		= &da8xx_usb11_dma_mask,
> +		.coherent_dma_mask	= DMA_BIT_MASK(32),
> +	},
> +	.num_resources	= ARRAY_SIZE(da8xx_usb11_resources),
> +	.resource	= da8xx_usb11_resources,
> +};
> +
> +int __init da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata)
> +{
> +	da8xx_usb11_device.dev.platform_data = pdata;
> +	return platform_device_register(&da8xx_usb11_device);
> +}
> +#endif	/* CONFIG_DAVINCI_DA8XX */
diff mbox

Patch

Index: linux-davinci/arch/arm/mach-davinci/include/mach/da8xx.h
===================================================================
--- linux-davinci.orig/arch/arm/mach-davinci/include/mach/da8xx.h
+++ linux-davinci/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -19,6 +19,7 @@ 
 #include <mach/emac.h>
 #include <mach/asp.h>
 #include <mach/mmc.h>
+#include <mach/usb.h>
 
 extern void __iomem *da8xx_syscfg_base;
 
@@ -80,6 +81,7 @@  int da8xx_cppi41_init(void);
 int da8xx_register_edma(void);
 int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
 int da8xx_register_watchdog(void);
+int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
 int da8xx_register_emac(void);
 int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
 int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
Index: linux-davinci/arch/arm/mach-davinci/include/mach/usb.h
===================================================================
--- linux-davinci.orig/arch/arm/mach-davinci/include/mach/usb.h
+++ linux-davinci/arch/arm/mach-davinci/include/mach/usb.h
@@ -34,4 +34,24 @@ 
 #define CFGCHIP2_REFFREQ_24MHZ	(2 << 0)
 #define CFGCHIP2_REFFREQ_48MHZ	(3 << 0)
 
+struct	da8xx_ohci_root_hub;
+
+typedef void (*da8xx_ocic_handler_t)(struct da8xx_ohci_root_hub *hub,
+				     unsigned port);
+
+/* Passed as the platform data to the OHCI driver */
+struct	da8xx_ohci_root_hub {
+	/* Switch the port power on/off */
+	int	(*set_power)(unsigned port, int on);
+	/* Read the port power status */
+	int	(*get_power)(unsigned port);
+	/* Read the port over-current indicator */
+	int	(*get_oci)(unsigned port);
+	/* Over-current indicator change notification (pass NULL to disable) */
+	int	(*ocic_notify)(da8xx_ocic_handler_t handler);
+
+	/* Time from power on to power good (in 2 ms units) */
+	u8	potpgt;
+};
+
 #endif	/* ifndef __ASM_ARCH_USB_H */
Index: linux-davinci/arch/arm/mach-davinci/usb.c
===================================================================
--- linux-davinci.orig/arch/arm/mach-davinci/usb.c
+++ linux-davinci/arch/arm/mach-davinci/usb.c
@@ -15,7 +15,8 @@ 
 #include <mach/irqs.h>
 #include <mach/cputype.h>
 
-#define DAVINCI_USB_OTG_BASE 0x01C64000
+#define DAVINCI_USB_OTG_BASE	0x01c64000
+#define DA8XX_USB1_BASE 	0x01e25000
 
 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
 static struct musb_hdrc_eps_bits musb_eps[] = {
@@ -108,3 +109,36 @@  void __init setup_usb(unsigned mA, unsig
 
 #endif  /* CONFIG_USB_MUSB_HDRC */
 
+#ifdef	CONFIG_ARCH_DAVINCI_DA8XX
+static struct resource da8xx_usb11_resources[] = {
+	[0] = {
+		.start	= DA8XX_USB1_BASE,
+		.end	= DA8XX_USB1_BASE + SZ_4K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_DA8XX_IRQN,
+		.end	= IRQ_DA8XX_IRQN,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 da8xx_usb11_dma_mask = DMA_BIT_MASK(32);
+
+static struct platform_device da8xx_usb11_device = {
+	.name		= "ohci",
+	.id		= 0,
+	.dev = {
+		.dma_mask		= &da8xx_usb11_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
+	.num_resources	= ARRAY_SIZE(da8xx_usb11_resources),
+	.resource	= da8xx_usb11_resources,
+};
+
+int __init da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata)
+{
+	da8xx_usb11_device.dev.platform_data = pdata;
+	return platform_device_register(&da8xx_usb11_device);
+}
+#endif	/* CONFIG_DAVINCI_DA8XX */