  The acceleration site for ultra-high energy cosmic rays (UHECR) is still an
open question despite extended research. In this paper, we reconsider the
prompt phase of gamma-ray bursts (GRBs) as a possible candidate for this
acceleration and constrain the maximum proton energy in optically thin
synchrotron and photospheric models, using properties of the prompt photon
spectra. We find that neither of the models favour acceleration of protons to
$10^{20}$ eV in high-luminosity bursts. We repeat the calculations for
low-luminosity GRBs (llGRBs) considering both protons and completely stripped
iron and find that the highest obtainable energies are $< 10^{19}$ eV and $<
10^{20}$ eV for protons and iron respectively, regardless of the model. We
conclude therefore that for our fiducial parameters, GRBs, including
low-luminosity bursts, contribute little to none to the UHECR observed. We
further constrain the conditions necessary for an association between UHECR and
llGRBs and find that iron can be accelerated to $10^{20}$ eV in photospheric
models, given very efficiency acceleration and/or a small fractional energy
given to a small fraction of accelerated electrons. This will necessarily
result in high prompt optical fluxes, and the detection of such a signal could
therefore be an indication of successful UHECR acceleration at the source.
