blob: 739b7dcd1b27cdf25532863221d31edb59797db4 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <mach/dal_axi.h>
14
15/* The AXI device ID */
16#define DALDEVICEID_AXI 0x02000053
17#define DALRPC_PORT_NAME "DAL00"
18
19enum {
20 DALRPC_AXI_CONFIGURE_BRIDGE = DALDEVICE_FIRST_DEVICE_API_IDX + 11
21};
22
23enum {
24 DAL_AXI_BRIDGE_CFG_CGR_SS_2DGRP_SYNC_MODE = 14,
25 DAL_AXI_BRIDGE_CFG_CGR_SS_2DGRP_ASYNC_MODE,
26 DAL_AXI_BRIDGE_CFG_CGR_SS_2DGRP_ISOSYNC_MODE,
27 DAL_AXI_BRIDGE_CFG_CGR_SS_2DGRP_DEBUG_EN,
28 DAL_AXI_BRIDGE_CFG_CGR_SS_2DGRP_DEBUG_DIS,
29 DAL_AXI_BRIDGE_CFG_CGR_SS_3DGRP_SYNC_MODE,
30 DAL_AXI_BRIDGE_CFG_CGR_SS_3DGRP_ASYNC_MODE,
31 DAL_AXI_BRIDGE_CFG_CGR_SS_3DGRP_ISOSYNC_MODE,
32 DAL_AXI_BRIDGE_CFG_CGR_SS_3DGRP_DEBUG_EN,
33 DAL_AXI_BRIDGE_CFG_CGR_SS_3DGRP_DEBUG_DIS,
34 /* 7x27(A) Graphics Subsystem Bridge Configuration */
35 DAL_AXI_BRIDGE_CFG_GRPSS_XBAR_SYNC_MODE = 58,
36 DAL_AXI_BRIDGE_CFG_GRPSS_XBAR_ASYNC_MODE = 59,
37 DAL_AXI_BRIDGE_CFG_GRPSS_XBAR_ISOSYNC_MODE = 60
38
39};
40
41static int axi_configure_bridge_grfx_sync_mode(int bridge_mode)
42{
43 int rc;
44 void *dev_handle;
45
46 /* get device handle */
47 rc = daldevice_attach(
48 DALDEVICEID_AXI, DALRPC_PORT_NAME,
49 DALRPC_DEST_MODEM, &dev_handle
50 );
51 if (rc) {
52 printk(KERN_ERR "%s: failed to attach AXI bus device (%d)\n",
53 __func__, rc);
54 goto fail_dal_attach_detach;
55 }
56
57 /* call ConfigureBridge */
58 rc = dalrpc_fcn_0(
59 DALRPC_AXI_CONFIGURE_BRIDGE, dev_handle,
60 bridge_mode
61 );
62 if (rc) {
63 printk(KERN_ERR "%s: AXI bus device (%d) failed to be configured\n",
64 __func__, rc);
65 goto fail_dal_fcn_0;
66 }
67
68 /* close device handle */
69 rc = daldevice_detach(dev_handle);
70 if (rc) {
71 printk(KERN_ERR "%s: failed to detach AXI bus device (%d)\n",
72 __func__, rc);
73 goto fail_dal_attach_detach;
74 }
75
76 return 0;
77
78fail_dal_fcn_0:
79 (void)daldevice_detach(dev_handle);
80fail_dal_attach_detach:
81
82 return rc;
83}
84
85
86
87int set_grp2d_async(void)
88{
89 return axi_configure_bridge_grfx_sync_mode(
90 DAL_AXI_BRIDGE_CFG_CGR_SS_2DGRP_ASYNC_MODE);
91}
92
93int set_grp3d_async(void)
94{
95 return axi_configure_bridge_grfx_sync_mode(
96 DAL_AXI_BRIDGE_CFG_CGR_SS_3DGRP_ASYNC_MODE);
97}
98
99int set_grp_xbar_async(void)
100{ return axi_configure_bridge_grfx_sync_mode(
101 DAL_AXI_BRIDGE_CFG_GRPSS_XBAR_ASYNC_MODE);
102}