mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
dwc3: dwc3-omap: add support for multiple dwc3-omap controllers
Added support for multiple dwc3 omap controllers. This gives uboot the capability to control multiple dwc3 omap controllers. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
This commit is contained in:

committed by
Marek Vasut

parent
c241d7eee4
commit
57207657a1
@ -119,9 +119,11 @@ struct dwc3_omap {
|
|||||||
u32 irq0_offset;
|
u32 irq0_offset;
|
||||||
|
|
||||||
u32 dma_status:1;
|
u32 dma_status:1;
|
||||||
|
struct list_head list;
|
||||||
|
u32 index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dwc3_omap *omap;
|
static LIST_HEAD(dwc3_omap_list);
|
||||||
|
|
||||||
static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
|
static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
|
||||||
{
|
{
|
||||||
@ -363,12 +365,14 @@ int dwc3_omap_uboot_init(struct dwc3_omap_device *omap_dev)
|
|||||||
{
|
{
|
||||||
u32 reg;
|
u32 reg;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
struct dwc3_omap *omap;
|
||||||
|
|
||||||
omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
|
omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
|
||||||
if (!omap)
|
if (!omap)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
omap->base = omap_dev->base;
|
omap->base = omap_dev->base;
|
||||||
|
omap->index = omap_dev->index;
|
||||||
|
|
||||||
dwc3_omap_map_offset(omap);
|
dwc3_omap_map_offset(omap);
|
||||||
dwc3_omap_set_utmi_mode(omap, omap_dev->utmi_mode);
|
dwc3_omap_set_utmi_mode(omap, omap_dev->utmi_mode);
|
||||||
@ -380,6 +384,7 @@ int dwc3_omap_uboot_init(struct dwc3_omap_device *omap_dev)
|
|||||||
dwc3_omap_set_mailbox(omap, omap_dev->vbus_id_status);
|
dwc3_omap_set_mailbox(omap, omap_dev->vbus_id_status);
|
||||||
|
|
||||||
dwc3_omap_enable_irqs(omap);
|
dwc3_omap_enable_irqs(omap);
|
||||||
|
list_add_tail(&omap->list, &dwc3_omap_list);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -389,16 +394,25 @@ int dwc3_omap_uboot_init(struct dwc3_omap_device *omap_dev)
|
|||||||
* @index: index of this controller
|
* @index: index of this controller
|
||||||
*
|
*
|
||||||
* Performs cleanup of memory allocated in dwc3_omap_uboot_init
|
* Performs cleanup of memory allocated in dwc3_omap_uboot_init
|
||||||
* (equivalent to dwc3_omap_remove in linux).
|
* (equivalent to dwc3_omap_remove in linux). index of _this_ controller
|
||||||
|
* should be passed and should match with the index passed in
|
||||||
|
* dwc3_omap_device during init.
|
||||||
*
|
*
|
||||||
* Generally called from board file.
|
* Generally called from board file.
|
||||||
*/
|
*/
|
||||||
void dwc3_omap_uboot_exit(void)
|
void dwc3_omap_uboot_exit(int index)
|
||||||
{
|
{
|
||||||
dwc3_omap_disable_irqs(omap);
|
struct dwc3_omap *omap = NULL;
|
||||||
kfree(omap);
|
|
||||||
|
|
||||||
return 0;
|
list_for_each_entry(omap, &dwc3_omap_list, list) {
|
||||||
|
if (omap->index != index)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
dwc3_omap_disable_irqs(omap);
|
||||||
|
list_del(&omap->list);
|
||||||
|
kfree(omap);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_ALIAS("platform:omap-dwc3");
|
MODULE_ALIAS("platform:omap-dwc3");
|
||||||
|
@ -21,10 +21,11 @@ enum omap_dwc3_vbus_id_status {
|
|||||||
|
|
||||||
struct dwc3_omap_device {
|
struct dwc3_omap_device {
|
||||||
void *base;
|
void *base;
|
||||||
|
int index;
|
||||||
enum dwc3_omap_utmi_mode utmi_mode;
|
enum dwc3_omap_utmi_mode utmi_mode;
|
||||||
enum omap_dwc3_vbus_id_status vbus_id_status;
|
enum omap_dwc3_vbus_id_status vbus_id_status;
|
||||||
};
|
};
|
||||||
|
|
||||||
int dwc3_omap_uboot_init(struct dwc3_omap_device *dev);
|
int dwc3_omap_uboot_init(struct dwc3_omap_device *dev);
|
||||||
void dwc3_omap_uboot_exit(void);
|
void dwc3_omap_uboot_exit(int index);
|
||||||
#endif /* __DWC3_OMAP_UBOOT_H_ */
|
#endif /* __DWC3_OMAP_UBOOT_H_ */
|
||||||
|
Reference in New Issue
Block a user