mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 15:56:41 +00:00
parent
bce4fa9531
commit
3de673a8ca
@ -57,7 +57,7 @@ static void run_linux(void *s)
|
|||||||
subsys_usb_init();
|
subsys_usb_init();
|
||||||
|
|
||||||
/* host controller */
|
/* host controller */
|
||||||
platform_hcd_init(services);
|
platform_hcd_init(Lx_kit::env().env(), services);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
Lx::scheduler().current()->block_and_schedule();
|
Lx::scheduler().current()->block_and_schedule();
|
||||||
|
@ -44,7 +44,7 @@ struct Services
|
|||||||
|
|
||||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
||||||
|
|
||||||
void platform_hcd_init(Services *services);
|
void platform_hcd_init(Genode::Env &env, Services *services);
|
||||||
Genode::Irq_session_capability platform_irq_activate(int irq);
|
Genode::Irq_session_capability platform_irq_activate(int irq);
|
||||||
|
|
||||||
#endif /* _PLATFORM_H_ */
|
#endif /* _PLATFORM_H_ */
|
||||||
|
@ -333,7 +333,7 @@ void xhci_setup(Services *services)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
ehci_setup(services);
|
ehci_setup(services);
|
||||||
xhci_setup(services);
|
xhci_setup(services);
|
||||||
|
@ -22,7 +22,7 @@ extern "C" int postcore_mxs_phy_module_init();
|
|||||||
extern "C" void module_ehci_hcd_init();
|
extern "C" void module_ehci_hcd_init();
|
||||||
extern "C" void module_xhci_hcd_init();
|
extern "C" void module_xhci_hcd_init();
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
module_ehci_hcd_init();
|
module_ehci_hcd_init();
|
||||||
module_ci_hdrc_platform_register();
|
module_ci_hdrc_platform_register();
|
||||||
|
@ -183,7 +183,7 @@ extern "C" int module_usbnet_init();
|
|||||||
extern "C" int module_smsc95xx_driver_init();
|
extern "C" int module_smsc95xx_driver_init();
|
||||||
|
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
/* register EHCI controller */
|
/* register EHCI controller */
|
||||||
module_ehci_exynos_init();
|
module_ehci_exynos_init();
|
||||||
|
@ -277,7 +277,7 @@ extern "C" void module_ehci_omap_init();
|
|||||||
extern "C" int module_usbnet_init();
|
extern "C" int module_usbnet_init();
|
||||||
extern "C" int module_smsc95xx_driver_init();
|
extern "C" int module_smsc95xx_driver_init();
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
/* register EHCI controller */
|
/* register EHCI controller */
|
||||||
module_ehci_omap_init();
|
module_ehci_omap_init();
|
||||||
|
@ -55,7 +55,7 @@ static resource _dwc_otg_resource[] =
|
|||||||
extern "C" void module_dwc_otg_driver_init();
|
extern "C" void module_dwc_otg_driver_init();
|
||||||
extern bool fiq_enable, fiq_fsm_enable;
|
extern bool fiq_enable, fiq_fsm_enable;
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
/* enable USB power */
|
/* enable USB power */
|
||||||
Platform::Connection platform(services->env);
|
Platform::Connection platform(services->env);
|
||||||
|
@ -221,7 +221,7 @@ extern "C" void module_uhci_hcd_init();
|
|||||||
extern "C" void module_xhci_hcd_init();
|
extern "C" void module_xhci_hcd_init();
|
||||||
extern "C" void module_xhci_pci_init();
|
extern "C" void module_xhci_pci_init();
|
||||||
|
|
||||||
void platform_hcd_init(Services *s)
|
void platform_hcd_init(Genode::Env &, Services *s)
|
||||||
{
|
{
|
||||||
module_xhci_hcd_init();
|
module_xhci_hcd_init();
|
||||||
module_xhci_pci_init();
|
module_xhci_pci_init();
|
||||||
|
@ -129,7 +129,7 @@ struct Services
|
|||||||
|
|
||||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
||||||
|
|
||||||
void platform_hcd_init(Services *services);
|
void platform_hcd_init(Genode::Env &, Services *services);
|
||||||
Genode::Irq_session_capability platform_irq_activate(int irq);
|
Genode::Irq_session_capability platform_irq_activate(int irq);
|
||||||
|
|
||||||
#endif /* _PLATFORM_H_ */
|
#endif /* _PLATFORM_H_ */
|
||||||
|
@ -97,7 +97,7 @@ static void run_linux(void *s)
|
|||||||
module_usb_storage_driver_init();
|
module_usb_storage_driver_init();
|
||||||
|
|
||||||
/* host controller */
|
/* host controller */
|
||||||
platform_hcd_init(services);
|
platform_hcd_init(Lx_kit::env().env(), services);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
Lx::scheduler().current()->block_and_schedule();
|
Lx::scheduler().current()->block_and_schedule();
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <lx_emul.h>
|
#include <lx_emul.h>
|
||||||
|
|
||||||
#include <lx_kit/malloc.h>
|
#include <lx_kit/malloc.h>
|
||||||
|
#include <lx_kit/env.h>
|
||||||
|
|
||||||
#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
|
#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
|
||||||
driver))
|
driver))
|
||||||
@ -199,7 +200,7 @@ void *_ioremap(phys_addr_t phys_addr, unsigned long size, int wc)
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Genode::Attached_io_mem_dataspace *ds = new(Lx::Malloc::mem())
|
Genode::Attached_io_mem_dataspace *ds = new(Lx::Malloc::mem())
|
||||||
Genode::Attached_io_mem_dataspace(phys_addr, size, !!wc);
|
Genode::Attached_io_mem_dataspace(Lx_kit::env().env(), phys_addr, size, !!wc);
|
||||||
return ds->local_addr<void>();
|
return ds->local_addr<void>();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
panic("Failed to request I/O memory: [%lx,%lx)", phys_addr, phys_addr + size);
|
panic("Failed to request I/O memory: [%lx,%lx)", phys_addr, phys_addr + size);
|
||||||
|
@ -120,10 +120,10 @@ static void arndale_ehci_init(Genode::Env &env)
|
|||||||
enum Gpio_offset { D1 = 0x180, X3 = 0xc60 };
|
enum Gpio_offset { D1 = 0x180, X3 = 0xc60 };
|
||||||
|
|
||||||
/* enable USB3 clock and power up */
|
/* enable USB3 clock and power up */
|
||||||
static Regulator::Connection reg_clk(Regulator::CLK_USB20);
|
static Regulator::Connection reg_clk(env, Regulator::CLK_USB20);
|
||||||
reg_clk.state(true);
|
reg_clk.state(true);
|
||||||
|
|
||||||
static Regulator::Connection reg_pwr(Regulator::PWR_USB20);
|
static Regulator::Connection reg_pwr(env, Regulator::PWR_USB20);
|
||||||
reg_pwr.state(true);
|
reg_pwr.state(true);
|
||||||
|
|
||||||
/* reset hub via GPIO */
|
/* reset hub via GPIO */
|
||||||
@ -200,9 +200,9 @@ struct Phy_usb3 : Genode::Mmio
|
|||||||
|
|
||||||
struct Phy_resume : Register<0x34, 32> { };
|
struct Phy_resume : Register<0x34, 32> { };
|
||||||
|
|
||||||
Phy_usb3 (addr_t const base) : Mmio(base)
|
Phy_usb3 (Genode::Env &env, addr_t const base) : Mmio(base)
|
||||||
{
|
{
|
||||||
Timer::Connection timer;
|
Timer::Connection timer(env);
|
||||||
|
|
||||||
/* reset */
|
/* reset */
|
||||||
write<Phy_reg0>(0);
|
write<Phy_reg0>(0);
|
||||||
@ -269,15 +269,15 @@ struct Phy_usb3 : Genode::Mmio
|
|||||||
static void arndale_xhci_init(Genode::Env &env)
|
static void arndale_xhci_init(Genode::Env &env)
|
||||||
{
|
{
|
||||||
/* enable USB3 clock and power up */
|
/* enable USB3 clock and power up */
|
||||||
static Regulator::Connection reg_clk(Regulator::CLK_USB30);
|
static Regulator::Connection reg_clk(env, Regulator::CLK_USB30);
|
||||||
reg_clk.state(true);
|
reg_clk.state(true);
|
||||||
|
|
||||||
static Regulator::Connection reg_pwr(Regulator::PWR_USB30);
|
static Regulator::Connection reg_pwr(env, Regulator::PWR_USB30);
|
||||||
reg_pwr.state(true);
|
reg_pwr.state(true);
|
||||||
|
|
||||||
/* setup PHY */
|
/* setup PHY */
|
||||||
Attached_io_mem_dataspace io_phy(env, DWC3_PHY_BASE, 0x1000);
|
Attached_io_mem_dataspace io_phy(env, DWC3_PHY_BASE, 0x1000);
|
||||||
Phy_usb3 phy((addr_t)io_phy.local_addr<addr_t>());
|
Phy_usb3 phy(env, (addr_t)io_phy.local_addr<addr_t>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ void xhci_setup(Services *services)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
/* register network */
|
/* register network */
|
||||||
if (services->nic)
|
if (services->nic)
|
||||||
|
@ -74,9 +74,9 @@ struct Ehci : Genode::Mmio
|
|||||||
*/
|
*/
|
||||||
struct Usb_Otg : Genode::Mmio
|
struct Usb_Otg : Genode::Mmio
|
||||||
{
|
{
|
||||||
Usb_Otg(Genode::addr_t base):Genode::Mmio (base)
|
Usb_Otg(Genode::Env &env, Genode::addr_t base):Genode::Mmio (base)
|
||||||
{
|
{
|
||||||
Timer::Connection timer;
|
Timer::Connection timer(env);
|
||||||
unsigned int rstcon_mask = 0;
|
unsigned int rstcon_mask = 0;
|
||||||
unsigned int phyclk_mask = 5;
|
unsigned int phyclk_mask = 5;
|
||||||
unsigned int phypwr_mask = 0;
|
unsigned int phypwr_mask = 0;
|
||||||
@ -119,13 +119,13 @@ struct Usb_Otg : Genode::Mmio
|
|||||||
struct Rstcon : Register <0x8,32>{};
|
struct Rstcon : Register <0x8,32>{};
|
||||||
};
|
};
|
||||||
|
|
||||||
static void clock_pwr_init()
|
static void clock_pwr_init(Env &env)
|
||||||
{
|
{
|
||||||
/* enable USB2 clock and power up */
|
/* enable USB2 clock and power up */
|
||||||
static Regulator::Connection reg_clk(Regulator::CLK_USB20);
|
static Regulator::Connection reg_clk(env, Regulator::CLK_USB20);
|
||||||
reg_clk.state(true);
|
reg_clk.state(true);
|
||||||
|
|
||||||
static Regulator::Connection reg_pwr(Regulator::PWR_USB20);
|
static Regulator::Connection reg_pwr(env, Regulator::PWR_USB20);
|
||||||
reg_pwr.state(true);
|
reg_pwr.state(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,21 +133,21 @@ static void usb_phy_init(Genode::Env &env)
|
|||||||
{
|
{
|
||||||
Io_mem_connection io_usbotg(env, USBOTG, 0x1000);
|
Io_mem_connection io_usbotg(env, USBOTG, 0x1000);
|
||||||
addr_t usbotg_base = (addr_t)env.rm().attach(io_usbotg.dataspace());
|
addr_t usbotg_base = (addr_t)env.rm().attach(io_usbotg.dataspace());
|
||||||
Usb_Otg usbotg(usbotg_base);
|
Usb_Otg usbotg(env, usbotg_base);
|
||||||
env.rm().detach(usbotg_base);
|
env.rm().detach(usbotg_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void odroidx2_ehci_init(Genode::Env &env)
|
static void odroidx2_ehci_init(Genode::Env &env)
|
||||||
{
|
{
|
||||||
clock_pwr_init();
|
clock_pwr_init(env);
|
||||||
usb_phy_init(env);
|
usb_phy_init(env);
|
||||||
|
|
||||||
/* reset hub via GPIO */
|
/* reset hub via GPIO */
|
||||||
enum { X30 = 294, X34 = 298, X35 = 299 };
|
enum { X30 = 294, X34 = 298, X35 = 299 };
|
||||||
|
|
||||||
Gpio::Connection gpio_x30(X30);
|
Gpio::Connection gpio_x30(env, X30);
|
||||||
Gpio::Connection gpio_x34(X34);
|
Gpio::Connection gpio_x34(env, X34);
|
||||||
Gpio::Connection gpio_x35(X35);
|
Gpio::Connection gpio_x35(env, X35);
|
||||||
|
|
||||||
/* Set Ref freq 0 => 24MHz, 1 => 26MHz*/
|
/* Set Ref freq 0 => 24MHz, 1 => 26MHz*/
|
||||||
/* Odroid Us have it at 24MHz, Odroid Xs at 26MHz */
|
/* Odroid Us have it at 24MHz, Odroid Xs at 26MHz */
|
||||||
@ -203,7 +203,7 @@ void ehci_setup(Services *services)
|
|||||||
platform_device_register(pdev);
|
platform_device_register(pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
/* register network */
|
/* register network */
|
||||||
if (services->nic){
|
if (services->nic){
|
||||||
|
@ -236,8 +236,8 @@ static void omap_ehci_init(Genode::Env &env)
|
|||||||
Aux3 aux3(scrm_base);
|
Aux3 aux3(scrm_base);
|
||||||
|
|
||||||
/* init GPIO */
|
/* init GPIO */
|
||||||
Gpio::Connection gpio_power(HUB_POWER);
|
Gpio::Connection gpio_power(env, HUB_POWER);
|
||||||
Gpio::Connection gpio_reset(HUB_NRESET);
|
Gpio::Connection gpio_reset(env, HUB_NRESET);
|
||||||
|
|
||||||
/* disable the hub power and reset before init */
|
/* disable the hub power and reset before init */
|
||||||
gpio_power.direction(Gpio::Session::OUT);
|
gpio_power.direction(Gpio::Session::OUT);
|
||||||
@ -277,7 +277,7 @@ extern "C" void module_ehci_omap_init();
|
|||||||
extern "C" int module_usbnet_init();
|
extern "C" int module_usbnet_init();
|
||||||
extern "C" int module_smsc95xx_driver_init();
|
extern "C" int module_smsc95xx_driver_init();
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Genode::Env &, Services *services)
|
||||||
{
|
{
|
||||||
if (!services->ehci)
|
if (!services->ehci)
|
||||||
return;
|
return;
|
||||||
|
@ -160,10 +160,10 @@ extern "C" void module_dwc_otg_driver_init();
|
|||||||
extern "C" int module_usbnet_init();
|
extern "C" int module_usbnet_init();
|
||||||
extern "C" int module_smsc95xx_driver_init();
|
extern "C" int module_smsc95xx_driver_init();
|
||||||
|
|
||||||
void platform_hcd_init(Services *services)
|
void platform_hcd_init(Env &env, Services *services)
|
||||||
{
|
{
|
||||||
/* enable USB power */
|
/* enable USB power */
|
||||||
Platform::Connection platform;
|
Platform::Connection platform(env);
|
||||||
platform.power_state(Platform::Session::POWER_USB_HCD, true);
|
platform.power_state(Platform::Session::POWER_USB_HCD, true);
|
||||||
|
|
||||||
/* register network */
|
/* register network */
|
||||||
|
@ -26,7 +26,7 @@ extern "C" void module_uhci_hcd_init();
|
|||||||
extern "C" void module_xhci_hcd_init();
|
extern "C" void module_xhci_hcd_init();
|
||||||
extern "C" void module_xhci_pci_init();
|
extern "C" void module_xhci_pci_init();
|
||||||
|
|
||||||
void platform_hcd_init(Services *s)
|
void platform_hcd_init(Genode::Env &, Services *s)
|
||||||
{
|
{
|
||||||
if (s->nic) {
|
if (s->nic) {
|
||||||
module_usbnet_init();
|
module_usbnet_init();
|
||||||
|
Loading…
Reference in New Issue
Block a user