If you have synced your device with iTunes, you can restore your device.
1. Connect the device to the computer you normally sync with.
2. Open iTunes. If iTunes asks you to enter the passcode, try another computer that you've synced with.
Or try the steps below to use recovery mode.
iTunes will automatically sync your device and create a backup. If it doesn't, sync the device with iTunes. After the sync is complete, restore your device.