We have, I think, five prepositions that take or may take the prepositional case: в, на, о, при, по. But which of these (appart from в and на) take the locative in -ý when that form exists? And which don't?
При can also govern the locative form, especially in poetic language, though this usage is quite archaic.
Верстах в двух от него, возле неглубокого яра, при шляху, Григорий спешил казаков, расположил в ярке.
Ой, при лужку, при лужке…
Note the mix of the two cases in the song lyric above.
Also note that the form in -у is used both in locative and prepositional for some nouns (мост, полк, бок etc.)
Prepositional has quite a limited use with по and can be replaced with dative in most cases.