Commit b9923dd9ac3117b648febcf7f49308503dd308f3

Authored by Prathap M S
Committed by Vaibhav Hiremath
1 parent ae298d4a5a

ARM: AM335x: SGX: Graphics device registration using HWMOD

This adds the function for AM335x SGX device registration using HWMOD APIs.
Also added is omap_device handle creation for SGX module.
This is required for supporting pm_runtime APIs in SGX driver.
This patch is required for 3.2 kernel only.

Signed-off-by: Prathap M S <msprathap@ti.com>

Showing 3 changed files with 31 additions and 0 deletions Side-by-side Diff

arch/arm/mach-omap2/board-am335xevm.c
... ... @@ -2064,6 +2064,12 @@
2064 2064 setup_pin_mux(clkout2_pin_mux);
2065 2065 }
2066 2066  
  2067 +static void sgx_init(int evm_id, int profile)
  2068 +{
  2069 + if (omap3_has_sgx()) {
  2070 + am33xx_gpu_init();
  2071 + }
  2072 +}
2067 2073 /* General Purpose EVM */
2068 2074 static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
2069 2075 {am335x_rtc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
... ... @@ -2098,6 +2104,7 @@
2098 2104 {volume_keys_init, DEV_ON_DGHTR_BRD, PROFILE_0},
2099 2105 {uart2_init, DEV_ON_DGHTR_BRD, PROFILE_3},
2100 2106 {haptics_init, DEV_ON_DGHTR_BRD, (PROFILE_4)},
  2107 + {sgx_init, DEV_ON_BASEBOARD, PROFILE_ALL},
2101 2108 {NULL, 0, 0},
2102 2109 };
2103 2110  
... ... @@ -2126,6 +2133,7 @@
2126 2133 {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
2127 2134 {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
2128 2135 {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
  2136 + {sgx_init, DEV_ON_BASEBOARD, PROFILE_NONE},
2129 2137 {NULL, 0, 0},
2130 2138 };
2131 2139  
... ... @@ -2139,6 +2147,7 @@
2139 2147 {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
2140 2148 {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
2141 2149 {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
  2150 + {sgx_init, DEV_ON_BASEBOARD, PROFILE_NONE},
2142 2151 {NULL, 0, 0},
2143 2152 };
2144 2153  
... ... @@ -2159,6 +2168,7 @@
2159 2168 {uart1_wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL},
2160 2169 {wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL},
2161 2170 {gpio_ddr_vtt_enb_init, DEV_ON_BASEBOARD, PROFILE_ALL},
  2171 + {sgx_init, DEV_ON_BASEBOARD, PROFILE_ALL},
2162 2172 {NULL, 0, 0},
2163 2173 };
2164 2174  
arch/arm/mach-omap2/devices.c
... ... @@ -1455,4 +1455,24 @@
1455 1455  
1456 1456 return 0;
1457 1457 }
  1458 +
  1459 +void __init am33xx_gpu_init(void)
  1460 +{
  1461 + int id = -1;
  1462 + struct platform_device *pdev;
  1463 + struct omap_hwmod *oh;
  1464 + char *oh_name = "gfx";
  1465 + char *dev_name = "pvrsrvkm";
  1466 +
  1467 + oh = omap_hwmod_lookup(oh_name);
  1468 + if (!oh) {
  1469 + pr_err("Could not find %s hwmod data\n", oh_name);
  1470 + return;
  1471 + }
  1472 +
  1473 + pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
  1474 +
  1475 + WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
  1476 +
  1477 +}
arch/arm/mach-omap2/devices.h
... ... @@ -23,6 +23,7 @@
23 23 extern int __init am33xx_register_ehrpwm(int id,
24 24 struct pwmss_platform_data *pdata);
25 25 extern int __init omap_init_elm(void);
  26 +extern void __init am33xx_gpu_init(void);
26 27  
27 28 #endif