We derive homogeneous abundances of Fe, O, Na and alpha-elements from high resolution FLAMES spectra for 76 red giant stars in NGC 6715 (M 54) and for 25 red giants in the surrounding nucleus of the Sagittarius (Sgr) dwarf galaxy. Our main findings are that: (i) we confirm that M 54 shows intrinsic metallicity dispersion, ~0.19 dex r.m.s.; (ii) when the stars of the Sgr nucleus are included, the metallicity distribution strongly resembles that in omega Cen; the relative contribution of the most metal-rich stars is however different in these two objects; (iii) in both GCs there is a very extended Na-O anticorrelation, signature of different stellar generations born within the cluster, and (iv) the metal-poor and metal-rich components in M 54 (and omega Cen) show clearly distinct extension of the Na-O anticorrelation, the most heavily polluted stars being those of the metal-rich component. We propose a tentative scenario for cluster formation that could explain these features. Finally, similarities and differences found in the two most massive GCs in our Galaxy can be easily explained if they are similar objects (nuclear clusters in dwarf galaxies) observed at different stages of their dynamical evolution.