msm: clock-local: Move mnd_en_mask from freq tables to struct rcg_clk

The mnd_en_mask should be considered a property of the clock, not of a
frequency. Previously, the mnd_en_mask in the frequency table served
two purposes: (1) to indicate what NS register bit must be set to
enable the MND counter, and (2) to indicate if the MND counter needed
to be enabled for a given frequency. If the MND counter was not needed,
the mask was set to 0.

This was undesirable for a couple reasons. First, it meant than an
identical copy of the mask was stored for every frequency that the MND
counter was needed for. This is improved upon by storing one copy of
the mask in the struct rcg_clk and using the presence of an md_val for
a frequency to determine if the MND counter should be enabled or not.

Second, banked RCG clocks with MND counters stored the mnd_en_mask for
the currently-selected bank within the frequency table's mnd_en_mask
field. This was error-prone since storing state in frequency tables
can lead to data-structure corruption if multiple clocks share the
same table. Improve upon this by storing the currently-selected bank's
mnd_en_mask within struct rcg_clk (which is unique per-clock) instead
of the frequency tables which may be shared.

This allows all fields in struct rcg_clk to be marked as 'const' so
that frequency tables can be shared among clocks without concern. We
take advantage of this by reverting to sharing the same frequency table
for gfx2d0_clk and gfx2d1_clk.

Change-Id: I7dd62366f5a50c6e4b62dcf119fb88e3e920a005
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
6 files changed