24 static unsigned int ambapp_freq_calc(
36 bridge = abus->ahbs[ahbidx].bridge;
41 if ((bridge->vendor == VENDOR_GAISLER) &&
42 ((bridge->device == GAISLER_AHB2AHB) ||
43 (bridge->device == GAISLER_L2CACHE))) {
44 ahb = DEV_TO_AHB(bridge);
45 ffact = (ahb->custom[0] & AMBAPP_FLAG_FFACT) >> 4;
47 dir = ahb->custom[0] & AMBAPP_FLAG_FFACT_DIR;
52 if ((dir && !inverse) || (!dir && inverse))
53 freq_hz = freq_hz * ffact;
55 freq_hz = freq_hz / ffact;
57 return ambapp_freq_calc(abus, ahb->common.ahbidx, freq_hz, inverse);
67 void ambapp_freq_init(
75 for (i=0; i<AHB_BUS_MAX; i++)
76 abus->ahbs[i].freq_hz = 0;
82 info = DEV_TO_COMMON(dev);
83 abus->ahbs[info->ahbidx].freq_hz = freq_hz;
86 abus->ahbs[0].freq_hz = ambapp_freq_calc(abus, info->ahbidx, freq_hz, 1);
88 abus->ahbs[0].freq_hz = freq_hz;
94 for (i=1; i<AHB_BUS_MAX; i++) {
95 if (abus->ahbs[i].ioarea == 0)
97 if (abus->ahbs[i].freq_hz != 0)
99 abus->ahbs[i].freq_hz = ambapp_freq_calc(abus, i, abus->ahbs[0].freq_hz, 0);
108 return abus->ahbs[info->ahbidx].freq_hz;