Hi, in linux 2.6.22 some constants about MMC voltage have been removed. I firstly did a raw adaption just to make it work, along with other touches I made the following changes (see include/linux/mmc/host.h for the indices value):
+static u_int8_t mmc_voltage[] = {
-+ [MMC_VDD_160] = 5,
-+ [MMC_VDD_170] = 5,
-+ [MMC_VDD_180] = 6,
-+ [MMC_VDD_190] = 6,
-+ [MMC_VDD_200] = 7,
-+ [MMC_VDD_210] = 7,
-+ [MMC_VDD_220] = 8,
-+ [MMC_VDD_230] = 8,
-+ [MMC_VDD_240] = 9,
-+ [MMC_VDD_250] = 9,
-+ [MMC_VDD_260] = 10,
-+ [MMC_VDD_270] = 10,
-+ [MMC_VDD_280] = 11,
-+ [MMC_VDD_290] = 11,
-+ [MMC_VDD_300] = 12,
-+ [MMC_VDD_310] = 12,
-+ [MMC_VDD_320] = 13,
-+ [MMC_VDD_330] = 13,
-+ [MMC_VDD_340] = 14,
-+ [MMC_VDD_350] = 14,
-+ [MMC_VDD_360] = 15,
++ [MMC_VDD_165_195] = 6,
++ [MMC_VDD_20_21] = 7,
++ [MMC_VDD_21_22] = 8,
++ [MMC_VDD_22_23] = 8,
++ [MMC_VDD_23_24] = 9,
++ [MMC_VDD_24_25] = 9,
++ [MMC_VDD_25_26] = 10,
++ [MMC_VDD_26_27] = 10,
++ [MMC_VDD_27_28] = 11,
++ [MMC_VDD_28_29] = 11,
++ [MMC_VDD_29_30] = 12,
++ [MMC_VDD_30_31] = 12,
++ [MMC_VDD_31_32] = 13,
++ [MMC_VDD_32_33] = 13,
++ [MMC_VDD_33_34] = 14,
++ [MMC_VDD_34_35] = 14,
++ [MMC_VDD_35_36] = 15,
+};
But then I realized that using this syntax, with bitmasks as indices
for initialization, can lead to an insanely huge array dimension; so I
tried to initialize the array in a slightly different way (which is
basically functionally equivalent to the current code where the, now
removed, constants represent a bit position and not a mask).
+static u_int8_t mmc_voltage[] = {
+ [ilog2(MMC_VDD_165_195)] = 6,
+ [ilog2(MMC_VDD_20_21)] = 7,
+ [ilog2(MMC_VDD_21_22)] = 8,
+ [ilog2(MMC_VDD_22_23)] = 8,
+ [ilog2(MMC_VDD_23_24)] = 9,
+ [ilog2(MMC_VDD_24_25)] = 9,
+ [ilog2(MMC_VDD_25_26)] = 10,
+ [ilog2(MMC_VDD_26_27)] = 10,
+ [ilog2(MMC_VDD_27_28)] = 11,
+ [ilog2(MMC_VDD_28_29)] = 11,
+ [ilog2(MMC_VDD_29_30)] = 12,
+ [ilog2(MMC_VDD_30_31)] = 12,
+ [ilog2(MMC_VDD_31_32)] = 13,
+ [ilog2(MMC_VDD_32_33)] = 13,
+ [ilog2(MMC_VDD_33_34)] = 14,
+ [ilog2(MMC_VDD_34_35)] = 14,
+ [ilog2(MMC_VDD_35_36)] = 15,
+};
Since ilog2() is a macro and the arg is a constant I find this approach
acceptable (no performance penalty at all), but I have a doubt:
should the code take care of all these voltages for transflash slot?
On motorola kernels only one voltage value is used. And, obviously,
if only one voltage is needed we could simplify the code a lot.
Thanks,
Antonio
--
Web site: http://www.studenti.unina.it/~ospite
Public key: http://www.studenti.unina.it/~ospite/aopubkey.asc
pgpMeR3cIWGBe.pgp
Description: PGP signature
