Doped polysilicon layer